@ -20,6 +20,7 @@ import com.emr.service.recordType.EmrTypeRelatedService;
import com.emr.service.recordType.EmrTypeService ;
import com.emr.service.recordType.EmrTypeService ;
import com.emr.service.tScanAssort.T_Scan_AssortService ;
import com.emr.service.tScanAssort.T_Scan_AssortService ;
import com.emr.util.ExceptionPrintUtil ;
import com.emr.util.ExceptionPrintUtil ;
import com.emr.util.Jpg2PdfUtil ;
import com.emr.util.img2PdfUtil ;
import com.emr.util.img2PdfUtil ;
import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo ;
import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo ;
import com.emr.vo.FontVo.ScanAssortVo ;
import com.emr.vo.FontVo.ScanAssortVo ;
@ -38,6 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse ;
import javax.servlet.http.HttpServletResponse ;
import javax.servlet.http.HttpSession ;
import java.net.InetAddress ;
import java.net.InetAddress ;
import java.net.UnknownHostException ;
import java.net.UnknownHostException ;
import java.text.SimpleDateFormat ;
import java.text.SimpleDateFormat ;
@ -63,6 +65,8 @@ public class CommomSearchController {
@Autowired
@Autowired
private CommomMapper commomMapper ;
private CommomMapper commomMapper ;
@Autowired
@Autowired
private Archive_DetailMapper archiveDetailMapper ;
@Autowired
private EmrTypeRelatedService typeRelatedService ;
private EmrTypeRelatedService typeRelatedService ;
@Autowired
@Autowired
private T_Scan_AssortService scanAssortService ;
private T_Scan_AssortService scanAssortService ;
@ -241,7 +245,7 @@ public class CommomSearchController {
String attending = null ;
String attending = null ;
String fileSource = null ;
String fileSource = null ;
List < CommomVo > commomVos = commomMapper . selectAllAndPatientId ( patientId ) ;
List < CommomVo > commomVos = commomMapper . selectAllAndPatientId ( patientId ) ;
for ( CommomVo list : commomVos ) {
for ( CommomVo list : commomVos ) {
admissTimes = list . getAdmissTimes ( ) ;
admissTimes = list . getAdmissTimes ( ) ;
name = list . getName ( ) ;
name = list . getName ( ) ;
fileSource = list . getFileSource ( ) ;
fileSource = list . getFileSource ( ) ;
@ -250,10 +254,10 @@ public class CommomSearchController {
attending = list . getAttending ( ) ;
attending = list . getAttending ( ) ;
}
}
String userName = user . getUserPosition ( ) ;
String userName = user . getUserPosition ( ) ;
SimpleDateFormat formatter = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss " ) ;
SimpleDateFormat formatter = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss " ) ;
Date date = new Date ( System . currentTimeMillis ( ) ) ;
Date date = new Date ( System . currentTimeMillis ( ) ) ;
String format = formatter . format ( date ) ;
String format = formatter . format ( date ) ;
browseRecords browseRecords = new browseRecords ( ) ;
browseRecords browseRecords = new browseRecords ( ) ;
browseRecords . setAdmissTimes ( admissTimes ) ;
browseRecords . setAdmissTimes ( admissTimes ) ;
browseRecords . setPatientName ( name ) ;
browseRecords . setPatientName ( name ) ;
browseRecords . setDisDate ( disDate ) ;
browseRecords . setDisDate ( disDate ) ;
@ -264,30 +268,30 @@ public class CommomSearchController {
browseRecords . setBrowseName ( userName ) ;
browseRecords . setBrowseName ( userName ) ;
// 获取访问真实IP
// 获取访问真实IP
String ipAddress = request . getHeader ( "x-forwarded-for" ) ;
String ipAddress = request . getHeader ( "x-forwarded-for" ) ;
if ( ipAddress = = null | | ipAddress . length ( ) = = 0 | | "unknown" . equalsIgnoreCase ( ipAddress ) ) {
if ( ipAddress = = null | | ipAddress . length ( ) = = 0 | | "unknown" . equalsIgnoreCase ( ipAddress ) ) {
ipAddress = request . getHeader ( "Proxy-Client-IP" ) ;
ipAddress = request . getHeader ( "Proxy-Client-IP" ) ;
}
}
if ( ipAddress = = null | | ipAddress . length ( ) = = 0 | | "unknown" . equalsIgnoreCase ( ipAddress ) ) {
if ( ipAddress = = null | | ipAddress . length ( ) = = 0 | | "unknown" . equalsIgnoreCase ( ipAddress ) ) {
ipAddress = request . getHeader ( "WL-Proxy-Client-IP" ) ;
ipAddress = request . getHeader ( "WL-Proxy-Client-IP" ) ;
}
}
if ( ipAddress = = null | | ipAddress . length ( ) = = 0 | | "unknown" . equalsIgnoreCase ( ipAddress ) ) {
if ( ipAddress = = null | | ipAddress . length ( ) = = 0 | | "unknown" . equalsIgnoreCase ( ipAddress ) ) {
ipAddress = request . getRemoteAddr ( ) ;
ipAddress = request . getRemoteAddr ( ) ;
if ( "127.0.0.1" . equals ( ipAddress ) | | "0:0:0:0:0:0:0:1" . equals ( ipAddress ) ) {
if ( "127.0.0.1" . equals ( ipAddress ) | | "0:0:0:0:0:0:0:1" . equals ( ipAddress ) ) {
//根据网卡取本机配置的IP
//根据网卡取本机配置的IP
InetAddress inet = null ;
InetAddress inet = null ;
try {
try {
inet = InetAddress . getLocalHost ( ) ;
inet = InetAddress . getLocalHost ( ) ;
} catch ( UnknownHostException e ) {
} catch ( UnknownHostException e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
assert inet ! = null ;
assert inet ! = null ;
ipAddress = inet . getHostAddress ( ) ;
ipAddress = inet . getHostAddress ( ) ;
}
}
}
}
//对于通过多个代理的情况, 第一个IP为客户端真实IP,多个IP按照','分割
//对于通过多个代理的情况, 第一个IP为客户端真实IP,多个IP按照','分割
if ( ipAddress ! = null & & ipAddress . length ( ) > 15 ) { //"***.***.***.***".length() = 15
if ( ipAddress ! = null & & ipAddress . length ( ) > 15 ) { //"***.***.***.***".length() = 15
if ( ipAddress . indexOf ( "," ) > 0 ) {
if ( ipAddress . indexOf ( "," ) > 0 ) {
ipAddress = ipAddress . substring ( 0 , ipAddress . indexOf ( "," ) ) ;
ipAddress = ipAddress . substring ( 0 , ipAddress . indexOf ( "," ) ) ;
}
}
}
}
browseRecords . setIp ( ipAddress ) ;
browseRecords . setIp ( ipAddress ) ;
@ -296,7 +300,7 @@ public class CommomSearchController {
}
}
@RequestMapping ( "showRecordSouth" )
@RequestMapping ( "showRecordSouth" )
public String showRecordSouth ( String patientId , String userName , String deptName , Model model , HttpServletRequest request ) {
public String showRecordSouth ( String patientId , String userName , String deptName , Model model , HttpServletRequest request ) {
model . addAttribute ( "patientId" , patientId ) ;
model . addAttribute ( "patientId" , patientId ) ;
model . addAttribute ( "userName" , userName ) ;
model . addAttribute ( "userName" , userName ) ;
model . addAttribute ( "deptName" , deptName ) ;
model . addAttribute ( "deptName" , deptName ) ;
@ -434,6 +438,7 @@ public class CommomSearchController {
/ * *
/ * *
* 南 方 医 院 访 问
* 南 方 医 院 访 问
*
* @param userName
* @param userName
* @param flag
* @param flag
* @param model
* @param model
@ -557,6 +562,7 @@ public class CommomSearchController {
if ( typeId ! = null ) {
if ( typeId ! = null ) {
typeRelateds = typeRelatedService . selectAssortIdsByTypeId ( typeId ) ;
typeRelateds = typeRelatedService . selectAssortIdsByTypeId ( typeId ) ;
}
}
if ( commomVos . size ( ) > 0 ) {
//第一级:全部影像资料
//第一级:全部影像资料
CommomTree tree1 = new CommomTree ( ) ;
CommomTree tree1 = new CommomTree ( ) ;
Integer id = 1 ;
Integer id = 1 ;
@ -645,6 +651,102 @@ public class CommomSearchController {
treeList . add ( tree2 ) ;
treeList . add ( tree2 ) ;
}
}
}
}
}
List < Archive_Detail > archiveDetails = new ArrayList < > ( ) ;
if ( commomVos . size ( ) = = 0 ) {
List < CommomTree > archiveDetail = archiveDetailMapper . selectPdfPathByPatient2 ( patientId ) ;
//第一级:全部影像资料
CommomTree tree1 = new CommomTree ( ) ;
Integer id = 1 ;
tree1 . setId ( id ) ;
tree1 . setNewName ( "全部影像资料" ) ;
if ( null ! = archiveDetail & & ! archiveDetail . isEmpty ( ) ) {
//去重,取出不重复的分类集合
Map < String , CommomTree > assortMap = new LinkedHashMap < > ( ) ;
for ( CommomTree commomVo1 : archiveDetail ) {
assortMap . put ( commomVo1 . getAssortId ( ) , commomVo1 ) ;
}
//判断分类是否全选,全选,父类跟着全选
if ( null ! = typeRelateds & & ! typeRelateds . isEmpty ( ) ) {
boolean checkedFlag = true ;
for ( Map . Entry < String , CommomTree > map : assortMap . entrySet ( ) ) {
//定义是否存在
boolean flag = false ;
for ( Emr_Type_Related typeRelated : typeRelateds ) {
if ( typeRelated . getAssortId ( ) . equals ( map . getKey ( ) ) ) {
flag = true ;
break ;
}
}
if ( ! flag ) {
checkedFlag = false ;
break ;
}
}
if ( checkedFlag ) {
tree1 . setChecked ( "true" ) ;
}
} else {
tree1 . setChecked ( "true" ) ;
}
treeList . add ( tree1 ) ;
int oneId = 0 ;
for ( Map . Entry < String , CommomTree > map : assortMap . entrySet ( ) ) {
id + + ;
oneId = id ;
String assortId = map . getValue ( ) . getAssortId ( ) ;
CommomTree tree2 = new CommomTree ( ) ;
tree2 . setId ( id ) ;
tree2 . setParentId ( 1 ) ;
tree2 . setAssortId ( map . getValue ( ) . getAssortId ( ) ) ;
//判断选中
boolean checkFlag = false ;
if ( null ! = typeRelateds & & ! typeRelateds . isEmpty ( ) ) {
for ( Emr_Type_Related typeRelated : typeRelateds ) {
if ( StringUtils . isNotBlank ( assortId ) & & assortId . equals ( typeRelated . getAssortId ( ) ) ) {
tree2 . setChecked ( "true" ) ;
checkFlag = true ;
break ;
}
}
} else {
checkFlag = true ;
tree2 . setChecked ( "true" ) ;
}
//定义该类影像图片数量
int scanPathCount = 0 ;
//第二层 图片
int scanPathCountNum = 0 ;
for ( CommomTree commomVo : archiveDetail ) {
if ( StringUtils . isNotBlank ( assortId ) & & StringUtils . isNotBlank ( commomVo . getAssortId ( ) ) & &
assortId . equals ( commomVo . getAssortId ( ) ) ) {
id + + ;
CommomTree tree3 = new CommomTree ( ) ;
tree3 . setId ( id ) ;
tree3 . setParentId ( oneId ) ;
tree3 . setAssortId ( assortId ) ;
if ( checkFlag ) {
tree3 . setChecked ( "true" ) ;
}
scanPathCount + + ;
//图片名称
String name = commomVo . getScanPage ( ) ;
tree3 . setAssortName ( name ) ;
//设置树图片节点的名称
tree3 . setNewName ( commomVo . getTitle ( ) ) ;
tree3 . setSource ( commomVo . getSource ( ) ) ;
//存储水印图片
treeList . add ( tree3 ) ;
scanPathCountNum = commomVo . getPageCount ( ) ;
}
}
tree2 . setNewName ( map . getValue ( ) . getAssortName ( ) + "(" + scanPathCountNum + ")" ) ;
treeList . add ( tree2 ) ;
}
}
}
return JSON . toJSONString ( treeList ) ;
return JSON . toJSONString ( treeList ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
ExceptionPrintUtil . printException ( e ) ;
ExceptionPrintUtil . printException ( e ) ;
@ -673,6 +775,28 @@ public class CommomSearchController {
return ResultUtil . ok ( outs ) ;
return ResultUtil . ok ( outs ) ;
}
}
@RequestMapping ( value = "selectPrintPic2" , method = RequestMethod . POST )
@ResponseBody
public ResultUtil selectPrintPic2 ( HttpServletResponse response , String patientId , String rootPaths , String names , String sources , HttpServletRequest request ) throws Exception {
//生成加载进度mapKey
Power_User user = ( Power_User ) request . getSession ( ) . getAttribute ( "CURRENT_USER" ) ;
String mapKey = user . getUserName ( ) + "_" + patientId ;
List < String > outs = commomService . selectPrintPic2 ( response , patientId , names , sources , mapKey ) ;
return ResultUtil . ok ( outs ) ;
}
// @RequestMapping("showPdf")
// public void showPdf(String patientId, HttpServletRequest request, HttpServletResponse response) {
// EmrPdfWaterSet emrPdfWaterSet = new EmrPdfWaterSet();
// Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
// String mapKey = user.getUserName() + "_" + patientId;
// List<String> fileList = (List<String>) request.getSession().getAttribute(mapKey);
// String pdfWater = "儿童医院";
// Jpg2PdfUtil.mulFile2One(response, fileList, pdfWater);
// }
/ * *
/ * *
* 南 方 太 和 医 院 打 印 预 览 前 加 载 图 片
* 南 方 太 和 医 院 打 印 预 览 前 加 载 图 片
*
*
@ -714,9 +838,9 @@ public class CommomSearchController {
* /
* /
@RequestMapping ( value = "showRecordContentBlood" )
@RequestMapping ( value = "showRecordContentBlood" )
@ResponseBody
@ResponseBody
public ResultUtil showRecordContentBlood ( String patientId , String scanPages , String sources , String flag , HttpServletResponse response , HttpServletRequest request ) {
public ResultUtil showRecordContentBlood ( String patientId , String scanPages , String sources , String flag , HttpServletResponse response , HttpServletRequest request ) {
try {
try {
commomService . showRecordContentBlood ( patientId , scanPages , sources , flag , response , request ) ;
commomService . showRecordContentBlood ( patientId , scanPages , sources , flag , response , request ) ;
return ResultUtil . ok ( ) ;
return ResultUtil . ok ( ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
ExceptionPrintUtil . printException ( e ) ;
ExceptionPrintUtil . printException ( e ) ;
@ -727,12 +851,14 @@ public class CommomSearchController {
@RequestMapping ( value = "getRecordContentBlood" )
@RequestMapping ( value = "getRecordContentBlood" )
@ResponseBody
@ResponseBody
public void getRecordContentBlood ( String patientId , HttpServletRequest request , HttpServletResponse response ) {
public void getRecordContentBlood ( String patientId , HttpServletRequest request , HttpServletResponse response ) {
List < CommomTree > commomTrees = archiveDetailMapper . selectPdfPathByPatient2 ( patientId ) ;
if ( commomTrees . size ( ) = = 0 ) {
try {
try {
Power_User user = ( Power_User ) request . getSession ( ) . getAttribute ( "CURRENT_USER" ) ;
Power_User user = ( Power_User ) request . getSession ( ) . getAttribute ( "CURRENT_USER" ) ;
String mapKey = user . getUserName ( ) + "_" + patientId ;
String mapKey = user . getUserName ( ) + "_" + patientId ;
List < String > scanPages = ( List < String > ) request . getSession ( ) . getAttribute ( mapKey ) ;
List < String > scanPages = ( List < String > ) request . getSession ( ) . getAttribute ( mapKey ) ;
if ( ! CollectionUtils . isEmpty ( scanPages ) ) {
if ( ! CollectionUtils . isEmpty ( scanPages ) ) {
String pdfName = "档案管理PDF" ;
String pdfName = "档案管理PDF" ;
//根据图片路径转换pdf
//根据图片路径转换pdf
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper . selectByPrimaryKey ( 1 ) ;
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper . selectByPrimaryKey ( 1 ) ;
@ -740,11 +866,11 @@ public class CommomSearchController {
EmrPdfWaterSet emrPdfWaterSet1 = commomService . getEmrPdfWaterSet ( emrPdfWaterSet ) ;
EmrPdfWaterSet emrPdfWaterSet1 = commomService . getEmrPdfWaterSet ( emrPdfWaterSet ) ;
//获取角色是否加水印
//获取角色是否加水印
Integer userSex = user . getUserSex ( ) ;
Integer userSex = user . getUserSex ( ) ;
if ( userSex = = null | | userSex = = 0 ) {
if ( userSex = = null | | userSex = = 0 ) {
emrPdfWaterSet . setEffective ( Short . valueOf ( "0" ) ) ;
emrPdfWaterSet . setEffective ( Short . valueOf ( "0" ) ) ;
emrPdfWaterSet1 . setEffective ( Short . valueOf ( "0" ) ) ;
emrPdfWaterSet1 . setEffective ( Short . valueOf ( "0" ) ) ;
}
}
img2PdfUtil . imageToPdf ( response , scanPages , pdfName , emrPdfWaterSet , emrPdfWaterSet1 ) ;
img2PdfUtil . imageToPdf ( response , scanPages , pdfName , emrPdfWaterSet , emrPdfWaterSet1 ) ;
//移除缓存
//移除缓存
request . removeAttribute ( mapKey ) ;
request . removeAttribute ( mapKey ) ;
}
}
@ -752,10 +878,18 @@ public class CommomSearchController {
ExceptionPrintUtil . printException ( e ) ;
ExceptionPrintUtil . printException ( e ) ;
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
} else {
String pdfWater = "" ;
Power_User user = ( Power_User ) request . getSession ( ) . getAttribute ( "CURRENT_USER" ) ;
String mapKey = user . getUserName ( ) + "_" + patientId ;
List < String > filePaths = ( List < String > ) request . getSession ( ) . getAttribute ( mapKey ) ;
Jpg2PdfUtil . mulFile2One ( response , filePaths , pdfWater ) ;
}
}
}
/ * *
/ * *
* 南 方 医 院 访 问
* 南 方 医 院 访 问
*
* @param patientId
* @param patientId
* @param userName
* @param userName
* @param scanPages
* @param scanPages
@ -767,8 +901,8 @@ public class CommomSearchController {
@ResponseBody
@ResponseBody
public void showRecordContentSouth ( String patientId , String userName , String deptName , String scanPages , String sources , String flag , HttpServletResponse response , HttpServletRequest request ) {
public void showRecordContentSouth ( String patientId , String userName , String deptName , String scanPages , String sources , String flag , HttpServletResponse response , HttpServletRequest request ) {
try {
try {
userName = ( String ) request . getSession ( ) . getAttribute ( "userName" ) ;
userName = ( String ) request . getSession ( ) . getAttribute ( "userName" ) ;
deptName = ( String ) request . getSession ( ) . getAttribute ( "deptName" ) ;
deptName = ( String ) request . getSession ( ) . getAttribute ( "deptName" ) ;
commomService . showRecordContentSouth ( patientId , userName , deptName , scanPages , sources , flag , response ) ;
commomService . showRecordContentSouth ( patientId , userName , deptName , scanPages , sources , flag , response ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
ExceptionPrintUtil . printException ( e ) ;
ExceptionPrintUtil . printException ( e ) ;