|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.emr.controller.templateSearch;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.emr.annotation.OptionalLog;
|
|
|
|
|
import com.emr.controller.FormTokenFlagUtil;
|
|
|
|
|
import com.emr.dao.Archive_DetailMapper;
|
|
|
|
|
@ -39,6 +40,7 @@ import org.apache.commons.io.IOUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
@ -50,6 +52,7 @@ import javax.servlet.ServletOutputStream;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
|
@ -104,6 +107,11 @@ public class TemplateSearchController {
|
|
|
|
|
private CommomService commomService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private Archive_DetailMapper archiveDetailMapper;
|
|
|
|
|
@Value("${export_pdf_hospital_info}")
|
|
|
|
|
private String hospitaInfo;
|
|
|
|
|
|
|
|
|
|
@Value("${export_pdf_patient_info}")
|
|
|
|
|
private String patientInfo;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @MethodName templateList
|
|
|
|
|
@ -1441,29 +1449,15 @@ public class TemplateSearchController {
|
|
|
|
|
List<ScanPathVo> scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds1(patientIds, assortIds, flag);
|
|
|
|
|
if (null != scanPathVos && !scanPathVos.isEmpty()) {
|
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
|
|
|
|
|
//文件路径集合
|
|
|
|
|
List<String> filePaths = new ArrayList<>();
|
|
|
|
|
for (ScanPathVo scanPathVo : scanPathVos) {
|
|
|
|
|
String fileRealPath = scanPathVo.getFileRealPath();
|
|
|
|
|
if (StringUtils.isNoneBlank(fileRealPath)) {
|
|
|
|
|
filePaths.add(fileRealPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//批量添加下载记录
|
|
|
|
|
printOrDownLoadInfoService.SimpleInsert(scanPathVos, typeId, Short.valueOf("2"));
|
|
|
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
ScanPathVo vo = scanPathVos.get(0);
|
|
|
|
|
String disDate = "";
|
|
|
|
|
if (null != vo.getDisDate()) {
|
|
|
|
|
disDate = fmt.format(vo.getDisDate());
|
|
|
|
|
}
|
|
|
|
|
//每个文件名
|
|
|
|
|
String pdfName = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date());
|
|
|
|
|
String pdfName = exportFlieName(scanPathVos);
|
|
|
|
|
//emrPdfWaterSet设置启用下载的状态
|
|
|
|
|
emrPdfWaterSet.setEffective(emrPdfWaterSet.getDownloadEffective());
|
|
|
|
|
emrPdfWaterSet.setIsImg(emrPdfWaterSet.getDownloadIsImg());
|
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet1 = commomService.getEmrPdfWaterSet(emrPdfWaterSet);
|
|
|
|
|
img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet,emrPdfWaterSet1);
|
|
|
|
|
imgToPdfUtil.imageToPdf(response, scanPathVos, pdfName, emrPdfWaterSet,emrPdfWaterSet1);
|
|
|
|
|
}else {
|
|
|
|
|
String fileRealPath=null;
|
|
|
|
|
List<CommomTree> commomTrees = archiveDetailMapper.selectPdfPathByPatient3(patientIds, assortIds);
|
|
|
|
|
@ -1493,6 +1487,28 @@ public class TemplateSearchController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String exportFlieName(List<ScanPathVo> scanPathVos) throws ParseException {
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
|
sb.append(hospitaInfo);
|
|
|
|
|
ScanPathVo scanPathVo = scanPathVos.get(0);
|
|
|
|
|
JSONObject jsonObject= (JSONObject) JSONObject.toJSON(scanPathVo);
|
|
|
|
|
List<String> patientInfoList = Arrays.asList(patientInfo.split(","));
|
|
|
|
|
for (String list:patientInfoList){
|
|
|
|
|
String contents = jsonObject.getString(list).trim();
|
|
|
|
|
if (list.equals("disDate")){
|
|
|
|
|
String dateString = jsonObject.getString(list);
|
|
|
|
|
SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
Date date = originalFormat.parse(dateString);
|
|
|
|
|
String formattedDate = targetFormat.format(date);
|
|
|
|
|
sb.append("_"+formattedDate);
|
|
|
|
|
}else {
|
|
|
|
|
sb.append("_"+contents);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return sb.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 移动图片路径
|
|
|
|
|
*
|
|
|
|
|
|