|
|
|
@ -2,6 +2,7 @@ package com.emr.service;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
import com.emr.dao.Archive_DetailMapper;
|
|
|
|
import com.emr.dao.CommomMapper;
|
|
|
|
import com.emr.dao.CommomMapper;
|
|
|
|
import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper;
|
|
|
|
import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper;
|
|
|
|
import com.emr.entity.EmrComomSet;
|
|
|
|
import com.emr.entity.EmrComomSet;
|
|
|
|
@ -10,8 +11,10 @@ import com.emr.entity.ResultUtil;
|
|
|
|
import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet;
|
|
|
|
import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet;
|
|
|
|
import com.emr.entity.tScanAssort.T_Scan_Assort;
|
|
|
|
import com.emr.entity.tScanAssort.T_Scan_Assort;
|
|
|
|
import com.emr.service.tScanAssort.T_Scan_AssortService;
|
|
|
|
import com.emr.service.tScanAssort.T_Scan_AssortService;
|
|
|
|
|
|
|
|
import com.emr.util.Jpg2PdfUtil;
|
|
|
|
import com.emr.util.img2PdfUtil;
|
|
|
|
import com.emr.util.img2PdfUtil;
|
|
|
|
import com.emr.vo.User;
|
|
|
|
import com.emr.vo.User;
|
|
|
|
|
|
|
|
import com.emr.vo.commomSearch.CommomTree;
|
|
|
|
import com.emr.vo.commomSearch.CommomVo;
|
|
|
|
import com.emr.vo.commomSearch.CommomVo;
|
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
@ -30,8 +33,10 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.*;
|
|
|
|
import java.net.InetAddress;
|
|
|
|
import java.net.InetAddress;
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
@ -71,6 +76,8 @@ public class CommomService {
|
|
|
|
private T_Scan_AssortService scanAssortService;
|
|
|
|
private T_Scan_AssortService scanAssortService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private EmrPdfWaterSetMapper pdfWaterSetMapper;
|
|
|
|
private EmrPdfWaterSetMapper pdfWaterSetMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private Archive_DetailMapper archiveDetailMapper;
|
|
|
|
|
|
|
|
|
|
|
|
//获取所属医院用户名集合
|
|
|
|
//获取所属医院用户名集合
|
|
|
|
public static StringBuilder creaters(HttpServletRequest request) {
|
|
|
|
public static StringBuilder creaters(HttpServletRequest request) {
|
|
|
|
@ -150,15 +157,14 @@ public class CommomService {
|
|
|
|
ResultUtil resultUtil = selectRootPath(patientId, commomVo.getInpatientNo());
|
|
|
|
ResultUtil resultUtil = selectRootPath(patientId, commomVo.getInpatientNo());
|
|
|
|
if (resultUtil.getCode().equals(0)) {
|
|
|
|
if (resultUtil.getCode().equals(0)) {
|
|
|
|
String path = resultUtil.getMsg().replaceAll(" ", "");
|
|
|
|
String path = resultUtil.getMsg().replaceAll(" ", "");
|
|
|
|
//保存至commomtable表
|
|
|
|
commomVo.setNewPath(commomVo.getFilePath());
|
|
|
|
commomVo.setNewPath(path);
|
|
|
|
|
|
|
|
commomMapper.updateByPrimaryKeySelective(commomVo);
|
|
|
|
commomMapper.updateByPrimaryKeySelective(commomVo);
|
|
|
|
List<MultipartFile> fileList = CollectionUtils.arrayToList(files);
|
|
|
|
List<MultipartFile> fileList = CollectionUtils.arrayToList(files);
|
|
|
|
//定义批量添加进图片明细表集合
|
|
|
|
//定义批量添加进图片明细表集合
|
|
|
|
SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
|
|
|
|
SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
|
|
|
|
Date date = new Date(System.currentTimeMillis());
|
|
|
|
Date date = new Date(System.currentTimeMillis());
|
|
|
|
String format = fmt1.format(date);
|
|
|
|
String format = fmt1.format(date);
|
|
|
|
List<T_Scan_Assort> insertList = getScanAssortListByUpdatePic2(fileList, patientId, assortId, path,format);
|
|
|
|
List<T_Scan_Assort> insertList = getScanAssortListByUpdatePic2(fileList, patientId, assortId, path, format);
|
|
|
|
//批量新增图片记录
|
|
|
|
//批量新增图片记录
|
|
|
|
scanAssortService.SimpleInsert(insertList);
|
|
|
|
scanAssortService.SimpleInsert(insertList);
|
|
|
|
return ResultUtil.ok();
|
|
|
|
return ResultUtil.ok();
|
|
|
|
@ -169,46 +175,47 @@ public class CommomService {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getOperIp(){
|
|
|
|
public String getOperIp() {
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
// 获取访问真实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(","));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ipAddress;
|
|
|
|
return ipAddress;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//脐血库显示pdf
|
|
|
|
//脐血库显示pdf
|
|
|
|
public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response,HttpServletRequest request) throws Exception {
|
|
|
|
public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
|
|
|
if (StringUtils.isNotBlank(patientId)) {
|
|
|
|
if (StringUtils.isNotBlank(patientId)) {
|
|
|
|
patientId = patientId.replace("\'", "");
|
|
|
|
patientId = patientId.replace("\'", "");
|
|
|
|
//查询
|
|
|
|
//查询
|
|
|
|
if (StringUtils.isNotBlank(flag)) {
|
|
|
|
if (StringUtils.isNotBlank(flag)) {
|
|
|
|
CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId);
|
|
|
|
CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId);
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(commomVo.getFilePath())) {
|
|
|
|
//flag = home_addr取home_addr字段,path_file取home_addr字段
|
|
|
|
//flag = home_addr取home_addr字段,path_file取home_addr字段
|
|
|
|
String root1 = "";
|
|
|
|
String root1 = "";
|
|
|
|
if ("home_addr".equals(flag)) {
|
|
|
|
if ("home_addr".equals(flag)) {
|
|
|
|
@ -224,12 +231,7 @@ public class CommomService {
|
|
|
|
for (int i = 0; i < scanPageArr.length; i++) {
|
|
|
|
for (int i = 0; i < scanPageArr.length; i++) {
|
|
|
|
String srcStr = "";
|
|
|
|
String srcStr = "";
|
|
|
|
if (StringUtils.isNotBlank(scanPageArr[i])) {
|
|
|
|
if (StringUtils.isNotBlank(scanPageArr[i])) {
|
|
|
|
if ("1".equals(sourceArr[i])) {
|
|
|
|
|
|
|
|
srcStr = root1 + File.separator + scanPageArr[i];
|
|
|
|
srcStr = root1 + File.separator + scanPageArr[i];
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// srcStr = root2 + File.separator + scanPageArr[i];
|
|
|
|
|
|
|
|
srcStr = scanPageArr[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
src.add(srcStr);
|
|
|
|
src.add(srcStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -243,9 +245,18 @@ public class CommomService {
|
|
|
|
if (!filePaths.isEmpty()) {
|
|
|
|
if (!filePaths.isEmpty()) {
|
|
|
|
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;
|
|
|
|
request.getSession().setAttribute(mapKey,filePaths);
|
|
|
|
request.getSession().setAttribute(mapKey, filePaths);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
List<String> commomTrees = archiveDetailMapper.selectPDFRATH(patientId);
|
|
|
|
|
|
|
|
if (!commomTrees.isEmpty()) {
|
|
|
|
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
|
|
|
|
String mapKey = user.getUserName() + "_" + patientId;
|
|
|
|
|
|
|
|
request.getSession().setAttribute(mapKey, commomTrees);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -259,18 +270,18 @@ public class CommomService {
|
|
|
|
|
|
|
|
|
|
|
|
public EmrPdfWaterSet getEmrPdfWaterSet(EmrPdfWaterSet emrPdfWaterSet) {
|
|
|
|
public EmrPdfWaterSet getEmrPdfWaterSet(EmrPdfWaterSet emrPdfWaterSet) {
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = new EmrPdfWaterSet();
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = new EmrPdfWaterSet();
|
|
|
|
BeanUtils.copyProperties(emrPdfWaterSet,emrPdfWaterSet1);
|
|
|
|
BeanUtils.copyProperties(emrPdfWaterSet, emrPdfWaterSet1);
|
|
|
|
//定义第二水印文本
|
|
|
|
//定义第二水印文本
|
|
|
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
|
//获取reuqest
|
|
|
|
//获取reuqest
|
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
|
|
|
|
String text = "";
|
|
|
|
String text = "";
|
|
|
|
if(StringUtils.isNotBlank(user.getUserPosition())){
|
|
|
|
if (StringUtils.isNotBlank(user.getUserName())) {
|
|
|
|
text = user.getUserPosition();
|
|
|
|
text += " " + user.getUserName();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(user.getRemark())){
|
|
|
|
if (StringUtils.isNotBlank(user.getUserPosition())) {
|
|
|
|
text += " " + user.getRemark();
|
|
|
|
text = text + " " + user.getUserPosition();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
text += " " + getOperIp();
|
|
|
|
text += " " + getOperIp();
|
|
|
|
emrPdfWaterSet1.setText(text);
|
|
|
|
emrPdfWaterSet1.setText(text);
|
|
|
|
@ -320,7 +331,7 @@ public class CommomService {
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
|
|
|
|
//定义第二文本水印 姓名 + 科室 + ip
|
|
|
|
//定义第二文本水印 姓名 + 科室 + ip
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet,emrPdfWaterSet1);
|
|
|
|
img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet, emrPdfWaterSet1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -450,11 +461,8 @@ public class CommomService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装批量上传图片,返回上传图片记录
|
|
|
|
//封装批量上传图片,返回上传图片记录
|
|
|
|
private List<T_Scan_Assort> getScanAssortListByUpdatePic2(List<MultipartFile> multipartFiles, String patientId, String assortId, String root,String format) throws Exception {
|
|
|
|
private List<T_Scan_Assort> getScanAssortListByUpdatePic2(List<MultipartFile> multipartFiles, String patientId, String assortId, String root, String format) throws Exception {
|
|
|
|
List<T_Scan_Assort> scanAssorts = new ArrayList<>();
|
|
|
|
List<T_Scan_Assort> scanAssorts = new ArrayList<>();
|
|
|
|
//遍历分类图片集合
|
|
|
|
//遍历分类图片集合
|
|
|
|
for (MultipartFile pic : multipartFiles) {
|
|
|
|
for (MultipartFile pic : multipartFiles) {
|
|
|
|
@ -480,15 +488,14 @@ public class CommomService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装组织新增图片根目录
|
|
|
|
//封装组织新增图片根目录
|
|
|
|
private ResultUtil selectRootPath(String patientId, String inpatientId) {
|
|
|
|
private ResultUtil selectRootPath(String patientId, String inpatientId) {
|
|
|
|
//查询设置的根目录
|
|
|
|
//查询设置的根目录
|
|
|
|
// EmrComomSet emrComomSet = commomSetService.selectByPrimaryKey(1);
|
|
|
|
// EmrComomSet emrComomSet = commomSetService.selectByPrimaryKey(1);
|
|
|
|
// String newPicRoot = emrComomSet.getNewPicRoot();
|
|
|
|
// String newPicRoot = emrComomSet.getNewPicRoot();
|
|
|
|
String filePath=null;
|
|
|
|
String filePath = null;
|
|
|
|
List<CommomVo> commomVos = commomMapper.selectFilePath(patientId);
|
|
|
|
List<CommomVo> commomVos = commomMapper.selectFilePath(patientId);
|
|
|
|
for (CommomVo commomVo:commomVos){
|
|
|
|
for (CommomVo commomVo : commomVos) {
|
|
|
|
filePath = commomVo.getFilePath();
|
|
|
|
filePath = commomVo.getFilePath();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -545,23 +552,38 @@ public class CommomService {
|
|
|
|
Short printEffective = emrPdfWaterSet.getPrintEffective();
|
|
|
|
Short printEffective = emrPdfWaterSet.getPrintEffective();
|
|
|
|
//获取是否打印图片水印
|
|
|
|
//获取是否打印图片水印
|
|
|
|
Short printIsImg = emrPdfWaterSet.getPrintIsImg();
|
|
|
|
Short printIsImg = emrPdfWaterSet.getPrintIsImg();
|
|
|
|
|
|
|
|
//获取是否打印用户信息
|
|
|
|
|
|
|
|
Short userEffective = emrPdfWaterSet.getUserEffective();
|
|
|
|
for (int i = 0; i < nameList.length; i++) {
|
|
|
|
for (int i = 0; i < nameList.length; i++) {
|
|
|
|
//定义图片根目录地址
|
|
|
|
//定义图片根目录地址
|
|
|
|
String rootPath = "";
|
|
|
|
String rootPath = "";
|
|
|
|
|
|
|
|
String srcPath;
|
|
|
|
//组织原图片地址
|
|
|
|
//组织原图片地址
|
|
|
|
if ("1".equals(sourceList[i])) {
|
|
|
|
if ("1".equals(sourceList[i])) {
|
|
|
|
//扫描图片地址位于rootPathList第一个
|
|
|
|
//扫描图片地址位于rootPathList第一个
|
|
|
|
rootPath = rootPathList[0];
|
|
|
|
rootPath = rootPathList[0];
|
|
|
|
|
|
|
|
} else if ("99".equals(sourceList[i])) {
|
|
|
|
|
|
|
|
rootPath = nameList[0];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
rootPath = rootPathList[1];
|
|
|
|
rootPath = rootPathList[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//原图片地址
|
|
|
|
//原图片地址
|
|
|
|
String srcPath = rootPath + File.separator + nameList[i];
|
|
|
|
if ("99".equals(sourceList[i])) {
|
|
|
|
|
|
|
|
srcPath = nameList[i];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
srcPath = rootPath + File.separator + nameList[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
//定义输出地址
|
|
|
|
//定义输出地址
|
|
|
|
String outSrc = "";
|
|
|
|
String outSrc = "";
|
|
|
|
//获取项目上下文地址
|
|
|
|
//获取项目上下文地址
|
|
|
|
if ((printEffective != null && printEffective == 1) ||
|
|
|
|
if ((printEffective != null && printEffective == 1) ||
|
|
|
|
(printIsImg != null && printIsImg == 1)) {
|
|
|
|
(printIsImg != null && printIsImg == 1)) {
|
|
|
|
|
|
|
|
if ("99".equals(sourceList[i])) {
|
|
|
|
|
|
|
|
String rootSrcPath = selectRootByNotWater(srcPath);
|
|
|
|
|
|
|
|
String str2 = srcPath.substring(0, srcPath.indexOf(File.separator));
|
|
|
|
|
|
|
|
String picPath2 = srcPath.substring(str2.length() + 1, srcPath.length());
|
|
|
|
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + rootSrcPath + picPath2;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
//需要水印
|
|
|
|
//需要水印
|
|
|
|
//组织加水印后图片存放目录
|
|
|
|
//组织加水印后图片存放目录
|
|
|
|
String waterPicRoot = WATERPICPATH + patientId + File.separator + sourceList[i] + File.separator;
|
|
|
|
String waterPicRoot = WATERPICPATH + patientId + File.separator + sourceList[i] + File.separator;
|
|
|
|
@ -574,28 +596,40 @@ public class CommomService {
|
|
|
|
if (!new File(waterPicPath).exists()) {
|
|
|
|
if (!new File(waterPicPath).exists()) {
|
|
|
|
//定义第二文本水印 姓名 + 科室 + ip
|
|
|
|
//定义第二文本水印 姓名 + 科室 + ip
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath,emrPdfWaterSet1);
|
|
|
|
if (userEffective==1){
|
|
|
|
|
|
|
|
img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath, emrPdfWaterSet1);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
img2PdfUtil.addWatermarkPic2(new File(srcPath), emrPdfWaterSet, waterPicPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//组织输出地址
|
|
|
|
//组织输出地址
|
|
|
|
|
|
|
|
String root = selectRootByNotWater(WATERPICPATH);
|
|
|
|
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + root+ "/jiashi/reload/"+ patientId + File.separator + sourceList[i] + File.separator + nameList[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + "reload" + File.separator + patientId + File.separator + sourceList[i] + File.separator + nameList[i];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//不需要水印
|
|
|
|
//不需要水印
|
|
|
|
String root = "";
|
|
|
|
String root = "";
|
|
|
|
String picPath = "";
|
|
|
|
String picPath = "";
|
|
|
|
//判断是否是tif图片
|
|
|
|
//判断是否是tif图片
|
|
|
|
boolean tifFileFlag = checkTifFile(srcPath);
|
|
|
|
boolean tifFileFlag = checkTifFile(srcPath);
|
|
|
|
if(tifFileFlag){
|
|
|
|
if (tifFileFlag) {
|
|
|
|
String picSrc = WATERPICPATH + patientId + File.separator + sourceList[i] + File.separator;
|
|
|
|
//保存目录不存在新增
|
|
|
|
//目录不存在则创建
|
|
|
|
if (!new File(WATERTIFTOJPGPATH).isDirectory()) {
|
|
|
|
if (!new File(picSrc).isDirectory()) {
|
|
|
|
new File(WATERTIFTOJPGPATH).mkdirs();
|
|
|
|
new File(picSrc).mkdirs();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//组织加水印后图片存放地址
|
|
|
|
Date date = new Date();
|
|
|
|
picPath = picSrc + nameList[i];
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
|
|
|
//转换图片输出
|
|
|
|
|
|
|
|
//tifToJpg(srcPath,picPath);
|
|
|
|
String format1 = format.format(date);
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + "reload" + File.separator + patientId + File.separator + sourceList[i] + File.separator + nameList[i];
|
|
|
|
try {
|
|
|
|
}else{
|
|
|
|
BufferedImage bufferegImage = ImageIO.read(new File(srcPath));
|
|
|
|
|
|
|
|
ImageIO.write(bufferegImage, "jpg", new File(WATERTIFTOJPGPATH + format1 + ".jpg"));
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
root = selectRootByNotWater(WATERTIFTOJPGPATH);
|
|
|
|
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + root + "/jiashi/tifToJpgLoad/" + format1 + ".jpg";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
//将原图片地址转换成映射地址
|
|
|
|
//将原图片地址转换成映射地址
|
|
|
|
//获取盘符并转换映射地址的头部地址
|
|
|
|
//获取盘符并转换映射地址的头部地址
|
|
|
|
root = selectRootByNotWater(srcPath);
|
|
|
|
root = selectRootByNotWater(srcPath);
|
|
|
|
@ -614,7 +648,7 @@ public class CommomService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<String> selectPrintPic2(HttpServletResponse response, String patientId,String names, String sources, String mapKey) {
|
|
|
|
public List<String> selectPrintPic2(HttpServletResponse response, String patientId, String names, String sources, String mapKey) {
|
|
|
|
List<String> outs = new LinkedList<>();
|
|
|
|
List<String> outs = new LinkedList<>();
|
|
|
|
if (StringUtils.isNotBlank(names)) {
|
|
|
|
if (StringUtils.isNotBlank(names)) {
|
|
|
|
String[] nameList = names.split(",");
|
|
|
|
String[] nameList = names.split(",");
|
|
|
|
@ -639,8 +673,8 @@ public class CommomService {
|
|
|
|
String picPath = "";
|
|
|
|
String picPath = "";
|
|
|
|
//判断是否是tif图片
|
|
|
|
//判断是否是tif图片
|
|
|
|
boolean tifFileFlag = checkTifFile(srcPath);
|
|
|
|
boolean tifFileFlag = checkTifFile(srcPath);
|
|
|
|
if(tifFileFlag){
|
|
|
|
if (tifFileFlag) {
|
|
|
|
String picSrc = WATERPICPATH + patientId + File.separator ;
|
|
|
|
String picSrc = WATERPICPATH + patientId + File.separator;
|
|
|
|
//目录不存在则创建
|
|
|
|
//目录不存在则创建
|
|
|
|
if (!new File(picSrc).isDirectory()) {
|
|
|
|
if (!new File(picSrc).isDirectory()) {
|
|
|
|
new File(picSrc).mkdirs();
|
|
|
|
new File(picSrc).mkdirs();
|
|
|
|
@ -650,7 +684,7 @@ public class CommomService {
|
|
|
|
//转换图片输出
|
|
|
|
//转换图片输出
|
|
|
|
//tifToJpg(srcPath,picPath);
|
|
|
|
//tifToJpg(srcPath,picPath);
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + "reload" + File.separator + patientId + File.separator + nameList[i];
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + "reload" + File.separator + patientId + File.separator + nameList[i];
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
//将原图片地址转换成映射地址
|
|
|
|
//将原图片地址转换成映射地址
|
|
|
|
//获取盘符并转换映射地址的头部地址
|
|
|
|
//获取盘符并转换映射地址的头部地址
|
|
|
|
root = selectRootByNotWater(srcPath);
|
|
|
|
root = selectRootByNotWater(srcPath);
|
|
|
|
@ -660,8 +694,6 @@ public class CommomService {
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + root + picPath;
|
|
|
|
outSrc = EMRRECORDJSP + File.separator + root + picPath;
|
|
|
|
outs.add(outSrc);
|
|
|
|
outs.add(outSrc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer value = Math.round((i + 1) * 100 / nameList.length);
|
|
|
|
Integer value = Math.round((i + 1) * 100 / nameList.length);
|
|
|
|
printLoadingMap.put(mapKey, value);
|
|
|
|
printLoadingMap.put(mapKey, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -671,6 +703,7 @@ public class CommomService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 判断是否是tif图片
|
|
|
|
* 判断是否是tif图片
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param srcPath
|
|
|
|
* @param srcPath
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -779,7 +812,7 @@ public class CommomService {
|
|
|
|
if (!new File(waterPicPath).exists()) {
|
|
|
|
if (!new File(waterPicPath).exists()) {
|
|
|
|
//定义第二文本水印 姓名 + 科室 + ip
|
|
|
|
//定义第二文本水印 姓名 + 科室 + ip
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath,emrPdfWaterSet1);
|
|
|
|
img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath, emrPdfWaterSet1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//组织输出地址
|
|
|
|
//组织输出地址
|
|
|
|
outSrc = EMRRECORDJSP + "\\reload\\" + patientId + File.separator + 3 + File.separator + nameList[i];
|
|
|
|
outSrc = EMRRECORDJSP + "\\reload\\" + patientId + File.separator + 3 + File.separator + nameList[i];
|
|
|
|
@ -794,7 +827,7 @@ public class CommomService {
|
|
|
|
String waterPicPath = waterPicRoot + nameList[i];
|
|
|
|
String waterPicPath = waterPicRoot + nameList[i];
|
|
|
|
if (!new File(waterPicPath).exists()) {
|
|
|
|
if (!new File(waterPicPath).exists()) {
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath,emrPdfWaterSet1);
|
|
|
|
img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath, emrPdfWaterSet1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//组织输出地址
|
|
|
|
//组织输出地址
|
|
|
|
outSrc = EMRRECORDJSP + "\\reload\\" + patientId + File.separator + sourceList[i] + File.separator + nameList[i];
|
|
|
|
outSrc = EMRRECORDJSP + "\\reload\\" + patientId + File.separator + sourceList[i] + File.separator + nameList[i];
|
|
|
|
@ -865,12 +898,13 @@ public class CommomService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 批量添加
|
|
|
|
* 批量添加
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param tableName
|
|
|
|
* @param tableName
|
|
|
|
* @param commomMapper
|
|
|
|
* @param commomMapper
|
|
|
|
* @param operList
|
|
|
|
* @param operList
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void simpleInsert(String tableName,CommomMapper commomMapper,List operList){
|
|
|
|
public void simpleInsert(String tableName, CommomMapper commomMapper, List operList) {
|
|
|
|
if(!CollectionUtils.isEmpty(operList)) {
|
|
|
|
if (!CollectionUtils.isEmpty(operList)) {
|
|
|
|
///查询表列数
|
|
|
|
///查询表列数
|
|
|
|
int colCount = commomMapper.selectColByTableName(tableName);
|
|
|
|
int colCount = commomMapper.selectColByTableName(tableName);
|
|
|
|
List list = new ArrayList();
|
|
|
|
List list = new ArrayList();
|
|
|
|
|