From 2c327b172005c4639866e047ec7ed10f7cf64177 Mon Sep 17 00:00:00 2001 From: linjj <850658129@qq.com> Date: Sun, 7 Apr 2024 15:14:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BD=AE=E5=B7=9E=E4=BA=BA=E5=8C=BB=E5=BF=AB?= =?UTF-8?q?=E9=80=9F=E5=80=9F=E9=98=85=E3=80=81=E5=BF=AB=E9=80=9F=E5=BD=92?= =?UTF-8?q?=E8=BF=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/emr/controller/FontController.java | 137 +++++++--- .../emrApprove/ApproveController.java | 15 ++ .../TemplateSearchController.java | 2 +- .../com/emr/dao/Archive_DetailMapper.java | 3 + .../com/emr/dao/Archive_MasterMapper.java | 3 + src/main/java/com/emr/util/Jpg2PdfUtil.java | 237 +++++++++++------- src/main/java/com/emr/vo/ArchiveMasterVo.java | 19 ++ src/main/resources/config/config.properties | 11 +- src/main/resources/config/jdbc.properties | 4 +- .../resources/mapper/Archive_DetailMapper.xml | 15 ++ .../resources/mapper/Archive_MasterMapper.xml | 4 + src/main/resources/mapper/CommomMapper.xml | 4 +- 12 files changed, 311 insertions(+), 143 deletions(-) create mode 100644 src/main/java/com/emr/vo/ArchiveMasterVo.java diff --git a/src/main/java/com/emr/controller/FontController.java b/src/main/java/com/emr/controller/FontController.java index eb9a9b5..e00eda3 100644 --- a/src/main/java/com/emr/controller/FontController.java +++ b/src/main/java/com/emr/controller/FontController.java @@ -1,11 +1,16 @@ package com.emr.controller; +import com.emr.dao.Archive_DetailMapper; +import com.emr.dao.Archive_MasterMapper; import com.emr.dao.CommomMapper; import com.emr.dao.approve.Emr_Apply_ApproveMapper; +import com.emr.dao.commomSearch.ScanPathMapper; +import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper; import com.emr.dao.recordLock.Emr_LockMapper; import com.emr.dao.tScanAssort.T_Scan_AssortMapper; import com.emr.entity.Power_User; import com.emr.entity.Zd_Assort; +import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet; import com.emr.entity.recordType.Emr_Type; import com.emr.service.FontService; import com.emr.service.Zd_AssortServiceImpl; @@ -14,11 +19,14 @@ import com.emr.service.recordType.EmrTypeService; import com.emr.service.tScanAssort.T_Scan_AssortService; import com.emr.util.ExceptionPrintUtil; import com.emr.util.Jpg2PdfUtil; +import com.emr.vo.ArchiveMasterVo; import com.emr.vo.FontVo.*; import com.emr.vo.Msg; import com.emr.vo.PushRcvBasicDTO; import com.emr.vo.ZhFyImageVo; +import com.emr.vo.commomSearch.CommomTree; import com.emr.vo.commomSearch.CommomVo; +import com.emr.vo.commomSearch.ScanPathVo; import com.lowagie.text.Document; import com.lowagie.text.Image; import com.lowagie.text.Utilities; @@ -77,9 +85,16 @@ public class FontController { @Autowired private PushRcvBasicService pushRcvBasicService; + @Autowired + private Archive_MasterMapper archiveMasterMapper; + @Autowired + private Archive_DetailMapper archiveDetailMapper; + @Autowired + private EmrPdfWaterSetMapper pdfWaterSetMapper; /** * 2.1 + * * @MethodName getLockList * @Description: 返回锁定记录接口 * @Param lockVo.patientId, admissTimes, admissId @@ -91,9 +106,9 @@ public class FontController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value= "getLockList",method = RequestMethod.GET) + @RequestMapping(value = "getLockList", method = RequestMethod.GET) @ResponseBody - public Msg getLockList(LockVo lock) throws Exception{ + public Msg getLockList(LockVo lock) throws Exception { FontCommom commom = new FontCommom(); BeanUtils.copyProperties(lock, commom); List list = commomMapper.isExistInpatient(commom); @@ -110,6 +125,7 @@ public class FontController { /** * 2.2 + * * @MethodName getInpatientList * @Description: 返回病案记录接口 * @Param lockVo.patientId, admissTimes, admissId @@ -123,8 +139,8 @@ public class FontController { */ @RequestMapping("getInpatientList") @ResponseBody - public Msg getInpatientList(FontCommom commom) throws Exception{ - Msg msg = getScanAssortVoList(commom,0); + public Msg getInpatientList(FontCommom commom) throws Exception { + Msg msg = getScanAssortVoList(commom, 0); if (msg.getCode() == 200) { return msg; } @@ -141,9 +157,9 @@ public class FontController { /** * 封装查询分段信息的判断及查询分段信息 */ - private Msg getScanAssortVoList(FontCommom commom,int flag) throws Exception{ + private Msg getScanAssortVoList(FontCommom commom, int flag) throws Exception { //判断参数是否不为全空 - if (StringUtils.isNotBlank(commom.getPatientId()) && StringUtils.isBlank(commom.getInpatientNo()) && StringUtils.isBlank(commom.getAdmissId()) &&StringUtils.isNotBlank(commom.getName()) + if (StringUtils.isNotBlank(commom.getPatientId()) && StringUtils.isBlank(commom.getInpatientNo()) && StringUtils.isBlank(commom.getAdmissId()) && StringUtils.isNotBlank(commom.getName()) && null == commom.getAdmissTimes() && StringUtils.isBlank(commom.getDisDate()) && StringUtils.isBlank(commom.getIdCard())) { return Msg.fail("由于数据太大,参数不能全为空!"); } @@ -153,7 +169,7 @@ public class FontController { return Msg.fail("由于数据太大,参数不能只带住院次数!"); } //判断住院记录是否存在 - if(flag == 1){ + if (flag == 1) { //是否需要判断 List list = commomMapper.isExistInpatient(commom); if (CollectionUtils.isEmpty(list)) { @@ -165,6 +181,7 @@ public class FontController { /** * 2.3 + * * @MethodName getScanAssortPathList * @Description: 返回分段页数与PDF路径接口(无PDF) * @Param lockVo.patientId, admissTimes, admissId @@ -176,10 +193,10 @@ public class FontController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value="getScanAssortPathList",method = RequestMethod.GET) + @RequestMapping(value = "getScanAssortPathList", method = RequestMethod.GET) @ResponseBody - public Msg getScanAssortPathList(FontCommom commom) throws Exception{ - Msg msg = getScanAssortVoList(commom,1); + public Msg getScanAssortPathList(FontCommom commom) throws Exception { + Msg msg = getScanAssortVoList(commom, 1); if (msg.getCode() == 200) { return msg; } @@ -280,8 +297,45 @@ public class FontController { return Msg.success().add("list", scanAssortVos1); } + /** + * @description: 潮州人医一次性接口导出2月到3月份出院病历知情同意书 + * @author linjj + * @date: 2024/3/25 15:25 + */ + @RequestMapping(value = "downloadPdfBlood", method = RequestMethod.GET) + @ResponseBody + public void downloadPdf(HttpServletResponse response) { + //查询需要下载患者 + List list = archiveMasterMapper.getMasterID(); + for (ArchiveMasterVo archiveMaster : list) { + String masterId = archiveMaster.getId(); + List pdfPaths = archiveDetailMapper.selectPDFRATH2(masterId, "7A9C621E3F4F4C9CA95292141C5E15E8"); + if (pdfPaths!=null||pdfPaths.isEmpty()){ + String newPath = "D:\\jiashi\\copy" + File.separator + archiveMaster.getName() + "-" + archiveMaster.getInpNo()+"-知情同意书"; + if (!new File(newPath).isDirectory()) { + new File(newPath).mkdirs(); + } + for (String pdfPath:pdfPaths){ + String newSrc = newPath + File.separator + new File(pdfPath).getName(); + try (InputStream inputStream = new FileInputStream(pdfPath); + OutputStream outputStream = new FileOutputStream(newSrc)) { + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + System.out.println("文件拷贝完成"); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + /** * 2.4 + * * @MethodName getScanAssortFilePathList * @Description: 返回分段页数与PDF路径接口 * @Param lockVo.patientId, admissTimes, admissId @@ -293,10 +347,10 @@ public class FontController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "getScanAssortFilePathList",method = RequestMethod.GET) + @RequestMapping(value = "getScanAssortFilePathList", method = RequestMethod.GET) @ResponseBody - public Msg getScanAssortFilePathList(FontCommom commom, HttpServletResponse response) throws Exception{ - Msg msg = getScanAssortVoList(commom,1); + public Msg getScanAssortFilePathList(FontCommom commom, HttpServletResponse response) throws Exception { + Msg msg = getScanAssortVoList(commom, 1); if (msg.getCode() == 200) { return msg; } @@ -398,13 +452,13 @@ public class FontController { byte[] bytes = baos.toByteArray(); String filePath1 = Base64Utils.encodeToString(bytes); scanAssortVo.setFilePath(filePath1); - } else { - scanAssortVo.setFilePath(""); + } else { + scanAssortVo.setFilePath(""); + } + ScanAssortVo1 vo1 = new ScanAssortVo1(); + BeanUtils.copyProperties(scanAssortVo, vo1); + scanAssortVos1.add(vo1); } - ScanAssortVo1 vo1 = new ScanAssortVo1(); - BeanUtils.copyProperties(scanAssortVo, vo1); - scanAssortVos1.add(vo1); - } } catch (Exception e) { e.printStackTrace(); } finally { @@ -422,6 +476,7 @@ public class FontController { /** * 2.8 + * * @MethodName updateTableCommom * @Description: 操作公共表commomtable、commomtable1 * @Param @@ -435,15 +490,15 @@ public class FontController { */ @RequestMapping(value = "updateTableCommom", method = RequestMethod.POST) @ResponseBody - public Msg updateTableCommom(CommomVo commom) throws Exception{ + public Msg updateTableCommom(CommomVo commom) throws Exception { return fontService.updateTableCommom(commom); } /** * @description: 第三方调阅病案影像图像 - * @params: patientId - * @params: flag + * @params: patientId + * @params: flag * @author linjj * @date: 2023/5/18 15:45 */ @@ -477,6 +532,7 @@ public class FontController { model.addAttribute("flag", flag); return "recordManage/commomSearch/showRecordIframeBlood"; } + /** * @description: 珠海妇幼根据住院号住院次数返回患者病案信息 * @params: inpatientNo @@ -486,16 +542,16 @@ public class FontController { */ @RequestMapping(value = "getPathListByInpatientNo", method = RequestMethod.POST) @ResponseBody - public Msg getPathListByInpatientNo(String inpatientNo,String admissTimes){ - if (StringUtils.isBlank(inpatientNo)){ - return Msg.fail("inpatientNo住院号不得为空"); - } - if (StringUtils.isBlank(admissTimes)){ - return Msg.fail("admissTimes住院次数不得为空"); - } - List list = tScanAssortService.getPathListByInpatientNo(inpatientNo, admissTimes); - return Msg.successData(list); - } + public Msg getPathListByInpatientNo(String inpatientNo, String admissTimes) { + if (StringUtils.isBlank(inpatientNo)) { + return Msg.fail("inpatientNo住院号不得为空"); + } + if (StringUtils.isBlank(admissTimes)) { + return Msg.fail("admissTimes住院次数不得为空"); + } + List list = tScanAssortService.getPathListByInpatientNo(inpatientNo, admissTimes); + return Msg.successData(list); + } /** @@ -507,27 +563,28 @@ public class FontController { */ @RequestMapping(value = "getPathListByDisDate", method = RequestMethod.POST) @ResponseBody - public Msg getPathListByDisDate(String startTime,String endTime){ - if (StringUtils.isBlank(startTime)){ + public Msg getPathListByDisDate(String startTime, String endTime) { + if (StringUtils.isBlank(startTime)) { return Msg.fail("startTime开始时间范围不得为空"); } - if (StringUtils.isBlank(endTime)){ + if (StringUtils.isBlank(endTime)) { return Msg.fail("endTime结束时间范围不得为空"); } - List list = tScanAssortService.getPathListByDisDate(startTime,endTime); + List list = tScanAssortService.getPathListByDisDate(startTime, endTime); return Msg.successData(list); } - /** + + /** * @description: 病案回收存储调用接口 * @author linjj * @date: 2023/9/26 11:09 */ @RequestMapping(value = "addRcvBasic", method = RequestMethod.POST) @ResponseBody - public Msg addRcvBasic(@RequestBody List list){ + public Msg addRcvBasic(@RequestBody List list) { int i = pushRcvBasicService.addRcvBasic(list); - if (i==1){ - return Msg.success(); + if (i == 1) { + return Msg.success(); } return Msg.fail(); } diff --git a/src/main/java/com/emr/controller/emrApprove/ApproveController.java b/src/main/java/com/emr/controller/emrApprove/ApproveController.java index 4fdc4d6..af7d1a7 100644 --- a/src/main/java/com/emr/controller/emrApprove/ApproveController.java +++ b/src/main/java/com/emr/controller/emrApprove/ApproveController.java @@ -521,6 +521,21 @@ public class ApproveController { emrApplyApprove.setDisTime(fmt.format(disDate)); } } + List userList = commomService.getUserList(user.getUserName(), request); + //查询条件用户名转姓名 + for (Emr_Apply_Approve obj : approve){ + //转换用户名 + //获取申请者工号 + String applyer = obj.getApplyer(); + if(!CollectionUtils.isEmpty(userList)){ + for(User user1 : userList){ + String name = user1.getName(); + if(StringUtils.isNotBlank(applyer) && user1.getUserName().equals(applyer)){ + obj.setApplyer(name); + } + } + } + } return JSON.toJSONString(emrApplyApprove); }catch (Exception e){ ExceptionPrintUtil.printException(e); diff --git a/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java b/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java index 087769c..d3c6aa4 100644 --- a/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java +++ b/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java @@ -1483,7 +1483,7 @@ public class TemplateSearchController { } EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); //下载文件名 - String filename = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date()); + String filename = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date()); Jpg2PdfUtil.mulFile2One3(response,filePaths,filename,emrPdfWaterSet); } } catch (Exception e) { diff --git a/src/main/java/com/emr/dao/Archive_DetailMapper.java b/src/main/java/com/emr/dao/Archive_DetailMapper.java index e6b184e..8c20714 100644 --- a/src/main/java/com/emr/dao/Archive_DetailMapper.java +++ b/src/main/java/com/emr/dao/Archive_DetailMapper.java @@ -16,6 +16,9 @@ public interface Archive_DetailMapper { List selectPdfPathByPatient2(@Param("patientId")String patientId); List selectPDFRATH(@Param("patientId")String patientId); + + List selectPDFRATH2(@Param("masterId")String masterId,@Param("assortId")String assortId); + List getPDFRATH(@Param("patientId")String patientId,@Param("scanPages")String scanPages); diff --git a/src/main/java/com/emr/dao/Archive_MasterMapper.java b/src/main/java/com/emr/dao/Archive_MasterMapper.java index 3640a01..690b792 100644 --- a/src/main/java/com/emr/dao/Archive_MasterMapper.java +++ b/src/main/java/com/emr/dao/Archive_MasterMapper.java @@ -1,5 +1,6 @@ package com.emr.dao; +import com.emr.vo.ArchiveMasterVo; import com.emr.vo.UpdateReturnVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -24,4 +25,6 @@ public interface Archive_MasterMapper { * @date: 2023/12/27 17:11 */ List getInpNoAndVisitIdByBarCode(@Param("barCode") String barCode); + + List getMasterID(); } diff --git a/src/main/java/com/emr/util/Jpg2PdfUtil.java b/src/main/java/com/emr/util/Jpg2PdfUtil.java index d86222f..185ddbc 100644 --- a/src/main/java/com/emr/util/Jpg2PdfUtil.java +++ b/src/main/java/com/emr/util/Jpg2PdfUtil.java @@ -32,8 +32,9 @@ import java.util.List; * @Version: 1.0 */ public class Jpg2PdfUtil { - static Logger logger = LoggerFactory.getLogger(Jpg2PdfUtil.class); - public static void imageToPdf(HttpServletResponse response, List filePaths, String pdfName) throws Exception{ + static Logger logger = LoggerFactory.getLogger(Jpg2PdfUtil.class); + + public static void imageToPdf(HttpServletResponse response, List filePaths, String pdfName) throws Exception { // 实例化图牿 Image image = null; pdfName = java.net.URLEncoder.encode(pdfName, "UTF-8"); @@ -41,14 +42,14 @@ public class Jpg2PdfUtil { response.reset(); response.setCharacterEncoding("utf-8"); response.setContentType("application/pdf"); // word格式 - response.setHeader("Content-Disposition", "attachment; filename=" + pdfName+ "("+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) +").pdf"); + response.setHeader("Content-Disposition", "attachment; filename=" + pdfName + "(" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + ").pdf"); PdfWriter writer = PdfWriter.getInstance(doc, response.getOutputStream()); // 开启文桿 doc.open(); try { for (String filePath : filePaths) { File file1 = new File(filePath); - if(file1.exists()){ + if (file1.exists()) { if (file1.getName().endsWith(".tif") || file1.getName().endsWith(".tiff")) { Object localObject1 = null; Object localObject2 = null; @@ -81,7 +82,7 @@ public class Jpg2PdfUtil { ((RandomAccessFileOrArray) localObject1).close(); } } - }else if (file1.getName().endsWith(".png") + } else if (file1.getName().endsWith(".png") || file1.getName().endsWith(".jpg") || file1.getName().endsWith(".gif") || file1.getName().endsWith(".jpeg") @@ -101,21 +102,21 @@ public class Jpg2PdfUtil { //image.scaleAbsolute(500, 400); // 按百分比显示图片的比便 if (width > 1024 || heigth > 786) { - image.scalePercent(percent+5); + image.scalePercent(percent + 5); } PdfContentByte canvas = writer.getDirectContent(); //pdf文档中中文字体的设置,注意一定要添加iTextAsian.jar包 BaseFont bfChinese = BaseFont.createFont("STSong-Light", - "UniGB-UCS2-H",BaseFont.NOT_EMBEDDED); - Font fontChinese = new Font(bfChinese, 50, Font.NORMAL,Color.blue); - Phrase phrase = new Phrase("老客户看黑科技好客户客户客户客户客户客户看黑科技",fontChinese); + "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); + Font fontChinese = new Font(bfChinese, 50, Font.NORMAL, Color.blue); + Phrase phrase = new Phrase("老客户看黑科技好客户客户客户客户客户客户看黑科技", fontChinese); ColumnText.showTextAligned( canvas, Element.ALIGN_UNDEFINED, phrase, 200, 200, 50); Image image1 = null; image1 = Image.getInstance("D:\\出差准备文档\\pdf\\9d17f073c61adfaf79438401bc6ffb7.jpg"); - //位置 + //位置 image1.setAbsolutePosition(200, 200); - // 设置图片的显示大小 + // 设置图片的显示大小 image1.scaleToFit(200, 200); canvas.addImage(image1); doc.add(image); @@ -132,19 +133,20 @@ public class Jpg2PdfUtil { writer.close(); } } + public static boolean check(String file) { PdfReader pdfReader = null; try { File f = new File(file); - if(f.isFile()){ + if (f.isFile()) { pdfReader = new PdfReader(file); if (pdfReader.getNumberOfPages() != 0) { return true; } } } catch (Exception e) { - }finally { - if(null != pdfReader){ + } finally { + if (null != pdfReader) { pdfReader.close(); } } @@ -152,31 +154,31 @@ public class Jpg2PdfUtil { } - public static void mulFile2One(HttpServletResponse response,List filePaths,String waterMarkName) { + public static void mulFile2One(HttpServletResponse response, List filePaths, String waterMarkName) { SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //遍历删除,除去损坏,文件不存在,抛异常就是空白页 Iterator iterator = filePaths.iterator(); while (iterator.hasNext()) { String fileStr = iterator.next(); File file = new File(fileStr); - if(file.isFile()){ + if (file.isFile()) { boolean flag = check(fileStr); - if(!flag){ + if (!flag) { iterator.remove(); - System.out.println(fmt.format(new Date())+":"+file+"文件损坏"); + System.out.println(fmt.format(new Date()) + ":" + file + "文件损坏"); } - }else{ + } else { iterator.remove(); - System.out.println(fmt.format(new Date())+":"+file+"文件不存在"); + System.out.println(fmt.format(new Date()) + ":" + file + "文件不存在"); } } - if(!filePaths.isEmpty()){ + if (!filePaths.isEmpty()) { // pdf合并工具类 Document document = null; PdfCopy copy = null; try { document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1)); - copy = new PdfCopy(document,response.getOutputStream()); + copy = new PdfCopy(document, response.getOutputStream()); document.open(); for (String file : filePaths) { PdfReader reader = new PdfReader(file); @@ -198,21 +200,21 @@ public class Jpg2PdfUtil { } copy.addPage(page); } - if(null != pdfReader){ + if (null != pdfReader) { pdfReader.close(); } reader.close(); try { bos.flush(); bos.close(); - }catch (Exception e){ + } catch (Exception e) { //e.printStackTrace(); } } - }catch (Exception e){ + } catch (Exception e) { //e.printStackTrace(); - }finally { - if(null != document){ + } finally { + if (null != document) { document.close(); } } @@ -220,7 +222,7 @@ public class Jpg2PdfUtil { } } - public static void setWatermark(ByteArrayOutputStream bos, PdfReader reader, String waterMarkName, String imgPath){ + public static void setWatermark(ByteArrayOutputStream bos, PdfReader reader, String waterMarkName, String imgPath) { PdfStamper stamper = null; try { stamper = new PdfStamper(reader, bos); @@ -231,7 +233,7 @@ public class Jpg2PdfUtil { for (int i = 1; i < total; i++) { content = stamper.getOverContent(i);// 在内容上方加水印 //加文字水印 - if(StringUtils.isNotBlank(waterMarkName)) { + if (StringUtils.isNotBlank(waterMarkName)) { gs.setFillOpacity(0.3f); gs.setStrokeOpacity(0.3f); content.setGState(gs); @@ -249,7 +251,7 @@ public class Jpg2PdfUtil { content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 250, 1500, 40); content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 1100, 40); content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 1500, 40);*/ - if(waterMarks.length > 1){ + if (waterMarks.length > 1) { //v:距左 v1:距下 v2: content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 310, 400, 40); /* content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 310, 150, 40);*/ @@ -262,7 +264,7 @@ public class Jpg2PdfUtil { } content.endText(); } - if(StringUtils.isNotBlank(imgPath)){ + if (StringUtils.isNotBlank(imgPath)) { Image image = Image.getInstance(imgPath); image.setAbsolutePosition(200, 206); // set the first background image.scaleToFit(200, 200); @@ -283,26 +285,26 @@ public class Jpg2PdfUtil { } } - public static void mulFile2One3(HttpServletResponse response,List filePaths,String filename,EmrPdfWaterSet emrPdfWaterSet) { - String waterMarkName=""; - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + public static void mulFile2One3(HttpServletResponse response, List filePaths, String filename, EmrPdfWaterSet emrPdfWaterSet) { + String waterMarkName = ""; + SimpleDateFormat fmt= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //遍历删除,除去损坏,文件不存在,抛异常就是空白页 Iterator iterator = filePaths.iterator(); while (iterator.hasNext()) { String fileStr = iterator.next(); File file = new File(fileStr); - if(file.isFile()){ + if (file.isFile()) { boolean flag = check(fileStr); - if(!flag){ + if (!flag) { iterator.remove(); - System.out.println(fmt.format(new Date())+":"+file+"文件损坏"); + System.out.println(fmt.format(new Date()) + ":" + file + "文件损坏"); } - }else{ + } else { iterator.remove(); - System.out.println(fmt.format(new Date())+":"+file+"文件不存在"); + System.out.println(fmt.format(new Date()) + ":" + file + "文件不存在"); } } - if(!filePaths.isEmpty()){ + if (!filePaths.isEmpty()) { // pdf合并工具类 Document document = null; PdfCopy copy = null; @@ -313,14 +315,14 @@ public class Jpg2PdfUtil { response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf"); document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1)); - copy = new PdfCopy(document,response.getOutputStream()); + copy = new PdfCopy(document, response.getOutputStream()); document.open(); for (String file : filePaths) { PdfReader reader = new PdfReader(file); ByteArrayOutputStream bos = new ByteArrayOutputStream(); PdfReader pdfReader = null; //判断是否加水印 - if (emrPdfWaterSet.getDownloadEffective()==1) { + if (emrPdfWaterSet.getDownloadEffective() == 1) { setWatermark(bos, reader, emrPdfWaterSet.getText(), null); pdfReader = new PdfReader(bos.toByteArray()); } @@ -328,28 +330,28 @@ public class Jpg2PdfUtil { for (int j = 1; j <= n; j++) { document.newPage(); PdfImportedPage page = null; - if (emrPdfWaterSet.getDownloadEffective()==1) { + if (emrPdfWaterSet.getDownloadEffective() == 1) { page = copy.getImportedPage(pdfReader, j); } else { page = copy.getImportedPage(reader, j); } copy.addPage(page); } - if(null != pdfReader){ + if (null != pdfReader) { pdfReader.close(); } reader.close(); try { bos.flush(); bos.close(); - }catch (Exception e){ + } catch (Exception e) { //e.printStackTrace(); } } - }catch (Exception e){ + } catch (Exception e) { //e.printStackTrace(); - }finally { - if(null != document){ + } finally { + if (null != document) { document.close(); } } @@ -357,6 +359,54 @@ public class Jpg2PdfUtil { } } + + public static void mulFile2One4(HttpServletResponse response, List filePath, String filename) { + // pdf合并工具类 + Document document = null; + PdfCopy copy = null; + try { + filename = java.net.URLEncoder.encode(filename, "UTF-8"); + response.reset(); + response.setCharacterEncoding("utf-8"); + response.setContentType("application/pdf"); + response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf"); + document = new Document(new PdfReader(filePath.get(0)).getPageSize(1)); + copy = new PdfCopy(document, response.getOutputStream()); + document.open(); + for (String file : filePath) { + PdfReader reader = new PdfReader(file); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PdfReader pdfReader = null; + //判断是否加水印 + int n = reader.getNumberOfPages(); + for (int j = 1; j <= n; j++) { + document.newPage(); + PdfImportedPage page = null; + page = copy.getImportedPage(reader, j); + copy.addPage(page); + } + if (null != pdfReader) { + pdfReader.close(); + } + reader.close(); + try { + bos.flush(); + bos.close(); + } catch (Exception e) { + //e.printStackTrace(); + } + } + } catch (Exception e) { + //e.printStackTrace(); + } finally { + if (null != document) { + document.close(); + } + } + + + } + public static void mulFile2One2(HttpServletResponse response, List filePaths, String filename, EmrPdfWaterSet emrPdfWaterSet) { //是否启用水印 Short effective = emrPdfWaterSet.getEffective(); @@ -367,18 +417,18 @@ public class Jpg2PdfUtil { while (iterator.hasNext()) { String fileStr = iterator.next(); File file = new File(fileStr); - if(file.isFile()){ + if (file.isFile()) { boolean flag = check(fileStr); - if(!flag){ + if (!flag) { iterator.remove(); - System.out.println(fmt.format(new Date())+":"+file+"文件损坏"); + System.out.println(fmt.format(new Date()) + ":" + file + "文件损坏"); } - }else{ + } else { iterator.remove(); - System.out.println(fmt.format(new Date())+":"+file+"文件不存在"); + System.out.println(fmt.format(new Date()) + ":" + file + "文件不存在"); } } - if(!filePaths.isEmpty()){ + if (!filePaths.isEmpty()) { // pdf合并工具类 Document document = null; PdfCopy copy = null; @@ -388,7 +438,7 @@ public class Jpg2PdfUtil { response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf"); document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1)); - copy = new PdfCopy(document,response.getOutputStream()); + copy = new PdfCopy(document, response.getOutputStream()); document.open(); for (String file : filePaths) { PdfReader reader = new PdfReader(file); @@ -410,21 +460,21 @@ public class Jpg2PdfUtil { } copy.addPage(page); } - if(null != pdfReader){ + if (null != pdfReader) { pdfReader.close(); } reader.close(); try { bos.flush(); bos.close(); - }catch (Exception e){ + } catch (Exception e) { //e.printStackTrace(); } } - }catch (Exception e){ + } catch (Exception e) { //e.printStackTrace(); - }finally { - if(null != document){ + } finally { + if (null != document) { document.close(); } } @@ -435,6 +485,7 @@ public class Jpg2PdfUtil { /** * 在不改变图片形状的同时,判断,如果h>w,则按h压缩,否则在w>h或w=h的情况下,按宽度压缩 + * * @param h * @param w * @return @@ -452,48 +503,48 @@ public class Jpg2PdfUtil { } - public static void mulFile2OneOne(HttpServletResponse response,String filePaths,String waterMarkName) { - if(!filePaths.isEmpty()){ + public static void mulFile2OneOne(HttpServletResponse response, String filePaths, String waterMarkName) { + if (!filePaths.isEmpty()) { // pdf合并工具类 Document document = null; PdfCopy copy = null; try { document = new Document(new PdfReader(filePaths).getPageSize(1)); - copy = new PdfCopy(document,response.getOutputStream()); + copy = new PdfCopy(document, response.getOutputStream()); document.open(); - PdfReader reader = new PdfReader(filePaths); - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - PdfReader pdfReader = null; - //判断是否加水印 + PdfReader reader = new PdfReader(filePaths); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PdfReader pdfReader = null; + //判断是否加水印 + if (StringUtils.isNotBlank(waterMarkName)) { + setWatermark(bos, reader, waterMarkName, null); + pdfReader = new PdfReader(bos.toByteArray()); + } + int n = reader.getNumberOfPages(); + for (int j = 1; j <= n; j++) { + document.newPage(); + PdfImportedPage page = null; if (StringUtils.isNotBlank(waterMarkName)) { - setWatermark(bos, reader, waterMarkName, null); - pdfReader = new PdfReader(bos.toByteArray()); - } - int n = reader.getNumberOfPages(); - for (int j = 1; j <= n; j++) { - document.newPage(); - PdfImportedPage page = null; - if (StringUtils.isNotBlank(waterMarkName)) { - page = copy.getImportedPage(pdfReader, j); - } else { - page = copy.getImportedPage(reader, j); - } - copy.addPage(page); + page = copy.getImportedPage(pdfReader, j); + } else { + page = copy.getImportedPage(reader, j); } - if(null != pdfReader){ - pdfReader.close(); - } - reader.close(); - try { - bos.flush(); - bos.close(); - }catch (Exception e){ - //e.printStackTrace(); - } - }catch (Exception e){ + copy.addPage(page); + } + if (null != pdfReader) { + pdfReader.close(); + } + reader.close(); + try { + bos.flush(); + bos.close(); + } catch (Exception e) { + //e.printStackTrace(); + } + } catch (Exception e) { //e.printStackTrace(); - }finally { - if(null != document){ + } finally { + if (null != document) { document.close(); } } diff --git a/src/main/java/com/emr/vo/ArchiveMasterVo.java b/src/main/java/com/emr/vo/ArchiveMasterVo.java new file mode 100644 index 0000000..352b09d --- /dev/null +++ b/src/main/java/com/emr/vo/ArchiveMasterVo.java @@ -0,0 +1,19 @@ +package com.emr.vo; + +import lombok.Data; + +/** + * @ClassName ArchiveMasterVO + * @Author linjj + * @Date 2024/3/25 15:42 + * @Version 1.0 + */ +@Data +public class ArchiveMasterVo { + + private String id; + private String inpNo; + private String visitId; + private String name; + +} diff --git a/src/main/resources/config/config.properties b/src/main/resources/config/config.properties index b16f10b..2b6652c 100644 --- a/src/main/resources/config/config.properties +++ b/src/main/resources/config/config.properties @@ -1,12 +1,12 @@ #power\u6743\u9650\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934 -POWER_IP =localhost -POWER_URLHEAD = http://localhost:8081/power +POWER_IP =172.16.11.90 +POWER_URLHEAD = http://172.16.11.90:8081/power -POWER_JSPHEAD = localhost -POWER_JSP = http://localhost:8081/power +POWER_JSPHEAD = 172.16.11.90 +POWER_JSP = http://172.16.11.90:8081/power #\u672C\u8EAB\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934 -EMR_RECORD_JSP = http://localhost:8081/emr_record +EMR_RECORD_JSP = http://172.16.11.90:8081/emr_record #webSocket\u670D\u52A1\u5668\u5730\u5740 @@ -53,4 +53,5 @@ fullTextSearchMethod = SearchFulltext fullTextDays = 90 + NEW_EMR_RECORD_JSP : http://localhost:8081/emr_record \ No newline at end of file diff --git a/src/main/resources/config/jdbc.properties b/src/main/resources/config/jdbc.properties index 8dc7c8e..25afaa6 100644 --- a/src/main/resources/config/jdbc.properties +++ b/src/main/resources/config/jdbc.properties @@ -3,9 +3,9 @@ jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver #jdbc.username=sa #jdbc.password=docus@702 -jdbc.url=jdbc\:sqlserver\://localhost:1433;databaseName=qf_record +jdbc.url=jdbc\:sqlserver\://localhost:1433;databaseName=emr_record jdbc.username=sa -jdbc.password=admin123 +jdbc.password=docus@702 #dataSource2 jdbc.url2=jdbc\:sqlserver\://localhost:1433;databaseName=blgd_java diff --git a/src/main/resources/mapper/Archive_DetailMapper.xml b/src/main/resources/mapper/Archive_DetailMapper.xml index 39f97a9..3dea5aa 100644 --- a/src/main/resources/mapper/Archive_DetailMapper.xml +++ b/src/main/resources/mapper/Archive_DetailMapper.xml @@ -160,6 +160,21 @@ + + + + + select inp_no,visit_id,discharge_date_time,name from archive_master where bar_code=#{barCode} + + \ No newline at end of file diff --git a/src/main/resources/mapper/CommomMapper.xml b/src/main/resources/mapper/CommomMapper.xml index 3081435..c24e6a1 100644 --- a/src/main/resources/mapper/CommomMapper.xml +++ b/src/main/resources/mapper/CommomMapper.xml @@ -1158,7 +1158,7 @@ commomtable - AND inpatient_no like '%${inpatientNo}%' + AND admiss_id =#{inpatientNo} AND admiss_id = #{admissId} @@ -1239,7 +1239,7 @@ from commomtable 1=1 - AND inpatient_no like '%${inpatientNo}%' + AND admiss_id =#{inpatientNo} AND id_card = #{idCard}