|
|
|
|
@ -36,12 +36,11 @@ import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.cxf.endpoint.Client;
|
|
|
|
|
import org.apache.http.client.HttpClient;
|
|
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
|
|
|
import org.apache.http.entity.StringEntity;
|
|
|
|
|
import org.apache.http.impl.client.DefaultHttpClient;
|
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
import org.apache.tools.zip.ZipEntry;
|
|
|
|
|
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
|
import org.dom4j.Document;
|
|
|
|
|
import org.dom4j.DocumentHelper;
|
|
|
|
|
import org.dom4j.Element;
|
|
|
|
|
@ -64,7 +63,6 @@ import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import org.apache.tools.zip.ZipOutputStream;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ProjectName:TemplateSearchController
|
|
|
|
|
@ -1259,6 +1257,8 @@ public class TemplateSearchController {
|
|
|
|
|
vo.setName(scanPathVo.getName());
|
|
|
|
|
vo.setInpatientNo(scanPathVo.getInpatientNo());
|
|
|
|
|
vo.setSubjectNo(scanPathVo.getSubjectNo());
|
|
|
|
|
vo.setProName(scanPathVo.getProName());
|
|
|
|
|
vo.setProContent(scanPathVo.getProContent());
|
|
|
|
|
String disDate = scanPathVo.getDisDate();
|
|
|
|
|
if (!ObjectUtils.isEmpty(disDate)) {
|
|
|
|
|
try {
|
|
|
|
|
@ -1390,7 +1390,10 @@ public class TemplateSearchController {
|
|
|
|
|
zipName = URLEncoder.encode(zipName, "UTF-8");
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + zipName + "(" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + ").zip");
|
|
|
|
|
String filePdfName = "";
|
|
|
|
|
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) {
|
|
|
|
|
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream(), StandardCharsets.UTF_8)) {
|
|
|
|
|
// 设置UTF-8编码
|
|
|
|
|
zos.setMethod(ZipOutputStream.DEFLATED);
|
|
|
|
|
|
|
|
|
|
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
|
|
|
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
for (ScanPathForPatientListVo vo : list) {
|
|
|
|
|
@ -1401,15 +1404,20 @@ public class TemplateSearchController {
|
|
|
|
|
List<String> scanPathList = vo.getScanPathList();
|
|
|
|
|
// 每个文件名
|
|
|
|
|
String inpatientNo = ObjectUtils.isEmpty(vo.getInpatientNo()) ? "无" : vo.getInpatientNo().trim();
|
|
|
|
|
String proName = ObjectUtils.isEmpty(vo.getProName()) ? "无" : vo.getProName().trim();
|
|
|
|
|
String proContent = ObjectUtils.isEmpty(vo.getProContent()) ? "无" : vo.getProContent().trim();
|
|
|
|
|
String name = ObjectUtils.isEmpty(vo.getName()) ? "无" : vo.getName().trim();
|
|
|
|
|
if ("3".equals(dataSource)) {
|
|
|
|
|
// 药学楼
|
|
|
|
|
filePdfName = vo.getSubjectNo().trim() + "_" + name + "_" + fmt.format(new Date());
|
|
|
|
|
} else {
|
|
|
|
|
} else if("6".equals(dataSource)){
|
|
|
|
|
filePdfName = inpatientNo + "_" + proContent;
|
|
|
|
|
}else {
|
|
|
|
|
filePdfName = inpatientNo + "_" + name + "_" + disDate.trim() + "_" + fmt.format(new Date());
|
|
|
|
|
}
|
|
|
|
|
String fileName = hospitaInfo + "_" + filePdfName;
|
|
|
|
|
fileName = new String(fileName.getBytes(),"ISO-8859-1");
|
|
|
|
|
|
|
|
|
|
// 使用UTF-8编码处理文件名
|
|
|
|
|
ZipEntry zipEntry = new ZipEntry(fileName + ".pdf");
|
|
|
|
|
zos.putNextEntry(zipEntry);
|
|
|
|
|
|
|
|
|
|
@ -1553,7 +1561,7 @@ public class TemplateSearchController {
|
|
|
|
|
@RequiresPermissions(value = {"/commom/downloadPdf"})
|
|
|
|
|
@RequestMapping(value = "downloadPdfBlood", produces = {"text/json;charset=UTF-8"})
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public void downloadPdfBlood(HttpServletResponse response, String patientIds, String assortIds, Integer typeId, String flag) {
|
|
|
|
|
public void downloadPdfBlood(HttpServletResponse response, String patientIds, String assortIds, Integer typeId, String flag, String dataSource) {
|
|
|
|
|
if (StringUtils.isNoneBlank(patientIds)) {
|
|
|
|
|
List<String> filePaths = new ArrayList<>();
|
|
|
|
|
try {
|
|
|
|
|
@ -1575,7 +1583,7 @@ public class TemplateSearchController {
|
|
|
|
|
//批量添加下载记录
|
|
|
|
|
printOrDownLoadInfoService.SimpleInsert(scanPathVos, typeId, Short.valueOf("2"));
|
|
|
|
|
//每个文件名
|
|
|
|
|
String pdfName = exportFlieName(scanPathVos);
|
|
|
|
|
String pdfName = exportFlieName(scanPathVos, dataSource);
|
|
|
|
|
//emrPdfWaterSet设置启用下载的状态
|
|
|
|
|
emrPdfWaterSet.setEffective(emrPdfWaterSet.getDownloadEffective());
|
|
|
|
|
emrPdfWaterSet.setIsImg(emrPdfWaterSet.getDownloadIsImg());
|
|
|
|
|
@ -1607,12 +1615,18 @@ public class TemplateSearchController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String exportFlieName(List<ScanPathVo> scanPathVos) throws ParseException {
|
|
|
|
|
private String exportFlieName(List<ScanPathVo> scanPathVos, String dataSource) throws ParseException {
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
|
sb.append(hospitaInfo);
|
|
|
|
|
ScanPathVo scanPathVo = scanPathVos.get(0);
|
|
|
|
|
JSONObject jsonObject= (JSONObject) JSONObject.toJSON(scanPathVo);
|
|
|
|
|
String name = ObjectUtils.isEmpty(jsonObject.getString("name")) ? "无" : jsonObject.getString("name").trim();
|
|
|
|
|
if("6".equals(dataSource)){
|
|
|
|
|
String inpatientNo = ObjectUtils.isEmpty(jsonObject.getString("inpatientNo")) ? "无" : jsonObject.getString("inpatientNo").trim();
|
|
|
|
|
String proName = ObjectUtils.isEmpty(jsonObject.getString("proName")) ? "无" : jsonObject.getString("proName").trim();
|
|
|
|
|
String proContent = ObjectUtils.isEmpty(jsonObject.getString("proContent")) ? "无" : jsonObject.getString("proContent").trim();
|
|
|
|
|
sb.append("_" + inpatientNo + "_" + proContent);
|
|
|
|
|
}else{
|
|
|
|
|
List<String> patientInfoList = Arrays.asList(patientInfo.split(","));
|
|
|
|
|
for (String list:patientInfoList){
|
|
|
|
|
String contents = ObjectUtils.isEmpty(jsonObject.getString(list)) ? "无" : jsonObject.getString(list).trim();
|
|
|
|
|
@ -1628,6 +1642,7 @@ public class TemplateSearchController {
|
|
|
|
|
//sb.append("_" + contents + "_" + name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return sb.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|