From 6beb6edd2090cd7cee49832dbb28ed25303de411 Mon Sep 17 00:00:00 2001 From: zengwh <81383286@qq.com> Date: Thu, 31 Dec 2020 15:10:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC20201229?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/emr/controller/FontController.java | 200 +++++++++++++++- .../com/emr/dao/ArchiveOtherExtMapper.java | 13 +- .../com/emr/singleton/PdfReaderSingleton.java | 33 +++ src/main/java/com/emr/util/DateUtil.java | 46 ++++ .../mapper/ArchiveOtherExtMapper.xml | 44 ++++ .../webapp/WEB-INF/views/font/showRecord.jsp | 2 + .../WEB-INF/views/font/showRecordByOpId.jsp | 214 ++++++++++++++++++ .../WEB-INF/views/font/showRecordIframe.jsp | 8 +- src/main/webapp/WEB-INF/views/index.jsp | 2 +- .../static/js/showRecord/showRecordByOpId.js | 17 ++ .../static/js/showRecord/showRecordIframe.js | 76 ++++++- 11 files changed, 637 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/emr/singleton/PdfReaderSingleton.java create mode 100644 src/main/java/com/emr/util/DateUtil.java create mode 100644 src/main/webapp/WEB-INF/views/font/showRecordByOpId.jsp create mode 100644 src/main/webapp/static/js/showRecord/showRecordByOpId.js diff --git a/src/main/java/com/emr/controller/FontController.java b/src/main/java/com/emr/controller/FontController.java index f195f8a..18f5679 100644 --- a/src/main/java/com/emr/controller/FontController.java +++ b/src/main/java/com/emr/controller/FontController.java @@ -1,6 +1,7 @@ package com.emr.controller; import com.alibaba.fastjson.JSON; +import com.emr.dao.ArchiveOtherExtMapper; import com.emr.dao.Emr_DictionaryMapper; import com.emr.entity.*; import com.emr.service.Archive_DetailService; @@ -9,15 +10,19 @@ import com.emr.service.ipml.ArchiveFlowInfoService; import com.emr.service.ipml.ArchiveOtherService; import com.emr.service.ipml.TPrintinfoService; import com.emr.service.ipml.ZdAssortService; +import com.emr.util.DateUtil; import com.emr.util.ExceptionPrintUtil; import com.emr.util.Msg; import com.emr.vo.ArchiveFlowInfoVo; +import com.emr.vo.ArchiveOtherExtVo; import net.sf.json.JSONObject; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; +import org.apache.shiro.util.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; @@ -31,10 +36,7 @@ import javax.servlet.http.HttpSession; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; +import java.util.*; /** * @author zwh @@ -62,6 +64,8 @@ public class FontController { private ArchiveOtherService archiveOtherService; @Autowired private ArchiveFlowInfoService archiveFlowInfoService; + @Autowired + private ArchiveOtherExtMapper archiveOtherExtMapper; @RequestMapping("selectIsPrintByPatienId") @ResponseBody @@ -118,6 +122,44 @@ public class FontController { return "font/showRecord"; } + /** + * 提供第三方按用户名和记账号查询病历pdf + * */ + @RequestMapping("showRecordByOpId") + public String showRecordByPatientId(String userName, String opID,Model model){ + //判断各参数 + if(StringUtils.isBlank(userName)){ + return retrunErrorPage(model,"工号不能为空!"); + } + if(StringUtils.isBlank(opID)){ + return retrunErrorPage(model,"门诊号不能为空!"); + } + List list = new ArrayList<>(); + //判断工号是否存在 + try { + String checkUserName = checkUserName(userName); + if(StringUtils.isNotBlank(checkUserName)){ + return retrunErrorPage(model,checkUserName); + } + //判断门诊号是否存在 + list = archiveOtherExtMapper.selectListBySysFlagAndJzh(-100,opID,null,null,null); + if(null == list || list.isEmpty()){ + return retrunErrorPage(model,"门诊号不存在!"); + } + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + model.addAttribute("jzh",opID); + if(list.size() > 1){ + //个数超过一个,科室和主治医生置空 + list.get(0).setC7(null); + list.get(0).setC8(null); + } + model.addAttribute("record",list.get(0)); + return "font/showRecordByOpId"; + } + /** * 判断工号是否存在 */ @@ -229,6 +271,28 @@ public class FontController { } } + /** + * 根据文件路径查询病案详情 + * @param filePath 文件路径 + * @return + */ + @ResponseBody + @RequestMapping(value = "/getRecordByFilePath") + public String getRecordByFilePath(String filePath,String jzh){ + try { + List list = archiveOtherExtMapper.selectListBySysFlagAndJzh(-100,jzh,null,null,filePath); + if(!CollectionUtils.isEmpty(list)){ + return JSON.toJSONString(list.get(0)); + }else{ + return null; + } + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + //e.printStackTrace(); + return null; + } + } + /** * 根据master表的记账号和分类id集合组织分类树 * @return @@ -288,7 +352,6 @@ public class FontController { int oneParentId = 0; //定义第二层的id为第三层父id int twoParentId = 0; - AssortTypeTree tree = new AssortTypeTree(); //第一层,根目录全部影像资料 tree.setId(id); @@ -368,6 +431,98 @@ public class FontController { return JSON.toJSONString(treeList); } + /** + * 根据archive_other_ext表的记账号和时间组合组织分类树 + * @return + * @throws Exception + */ + @ResponseBody + @RequestMapping(value = "/getRecordTypeTreeByOpId") + public String getRecordTypeTreeByOpId(String jzh,Integer isSearch,String startDateTo,String endDateTo){ + List treeList = new ArrayList<>(); + if(StringUtils.isNotBlank(jzh)){ + List list = new ArrayList<>(); + //assortIds等于协商的全查的分类id,全查 + try { + list = archiveOtherExtMapper.selectListBySysFlagAndJzh(-100,jzh,startDateTo,endDateTo,null); + List dateList = new ArrayList<>(); + if(!CollectionUtils.isEmpty(list)) { + //开始时间为空时,取集合最后一个时间 + if (StringUtils.isBlank(startDateTo)) { + startDateTo = list.get(list.size() - 1).getSysupdatetimeStr(); + } + //结束时间为空时,取集合第一个时间 + if (StringUtils.isBlank(endDateTo)) { + endDateTo = list.get(0).getSysupdatetimeStr(); + } + //组织查询的日期间的集合 + dateList = DateUtil.getDays(startDateTo, endDateTo); + Collections.reverse(dateList); + } + //组织树 + int id = 1; + //定义第一层的id为第二层父id + int oneParentId = 0; + //定义第二层的id为第三层父id + int twoParentId = 0; + AssortTypeTree tree = new AssortTypeTree(); + //第一层,根目录全部影像资料 + tree.setId(id); + tree.setParentId(0); + tree.setName("全部影像资料"); + tree.setChecked("true"); + treeList.add(tree); + oneParentId = id; + id++; + if(!CollectionUtils.isEmpty(dateList) && !CollectionUtils.isEmpty(list)) { + SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); + SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd"); + for (String date : dateList) { + AssortTypeTree tree1 = new AssortTypeTree(); + //第二层,分类名称,日期 + tree1.setId(id); + tree1.setParentId(oneParentId); + twoParentId = id; + id++; + //定义该类是否有记录 + boolean flag = false; + for (ArchiveOtherExtVo archiveOtherExtVo : list) { + String sysupdatetimeStr = archiveOtherExtVo.getSysupdatetimeStr(); + if (StringUtils.isNotBlank(sysupdatetimeStr) && sysupdatetimeStr.equals(date)) { + if (StringUtils.isNotBlank(archiveOtherExtVo.getC1())) { + AssortTypeTree tree2 = new AssortTypeTree(); + //第三层,资料名称 + tree2.setId(id); + tree2.setParentId(twoParentId); + tree2.setName(archiveOtherExtVo.getC1()); + tree2.setSelfId(archiveOtherExtVo.getSycobj()); + tree2.setChecked("true"); + treeList.add(tree2); + id++; + } + if (!flag) { + flag = true; + } + } + } + //初始化时或有记录时添加日期节点 + if (isSearch == 0 || flag) { + //格式化日期 + String returnDate = fmt.format(fmt1.parse(date)); + tree1.setName(returnDate); + tree1.setChecked("true"); + treeList.add(tree1); + } + } + } + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + } + return JSON.toJSONString(treeList); + } + /** * 根据病案号或类别或图片id获取图片列表,并生成PDF并返回pdf文件名 * @param response @@ -394,6 +549,39 @@ public class FontController { //e.printStackTrace(); } } + + /** + * 根据pdf文件名列表 + * @param detailIds + * @return + * @throws Exception + */ + @ResponseBody + @RequestMapping(value = "/getPdfToPdfByOpId",method = RequestMethod.POST) + public Msg getPdfToPdfByOpId(String detailIds,HttpSession session){ + try { + if(StringUtils.isNotBlank(detailIds)){ + List pathList= new ArrayList<>(); + String[] filePathArr = detailIds.split(","); + for(String pdfFilePath : filePathArr){ + if(StringUtils.isNotBlank(pdfFilePath)){ + pdfFilePath = pdfFilePath.replaceAll("\'", ""); + pathList.add(pdfFilePath); + } + } + //存至session + session.setAttribute("showRecord",pathList); + }else{ + //存至session + session.setAttribute("showRecord",null); + } + return Msg.success(); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + return Msg.fail("查看出错了,请联系系统管理员"); + //e.printStackTrace(); + } + } @ResponseBody @RequestMapping(value = "showPdf") public void showPdf(HttpServletResponse response,HttpSession session){ @@ -482,4 +670,6 @@ public class FontController { List list = dictionaryMapper.selectAllByParentId("dept_code",null); return Msg.success().add("list",list); } + + } diff --git a/src/main/java/com/emr/dao/ArchiveOtherExtMapper.java b/src/main/java/com/emr/dao/ArchiveOtherExtMapper.java index 211343d..c8303f2 100644 --- a/src/main/java/com/emr/dao/ArchiveOtherExtMapper.java +++ b/src/main/java/com/emr/dao/ArchiveOtherExtMapper.java @@ -53,5 +53,16 @@ public interface ArchiveOtherExtMapper { */ String selectMaxETimeByNursingAndJzh(@Param("patientId")String patientId); - List selectListBySysFlagAndIds(@Param("sysFlag")Integer sysFlag,@Param("ids")String ids); + List selectListBySysFlagAndIds(@Param("sysFlag")Integer sysFlag, + @Param("ids")String ids); + /** + * 根据记账号和系统标识查询采集任务集合 + * @param + * @return + */ + List selectListBySysFlagAndJzh(@Param("sysFlag")Integer sysFlag, + @Param("jzh")String jzh, + @Param("startDateTo")String startDateTo, + @Param("endDateTo")String endDateTo, + @Param("filePath")String filePath); } \ No newline at end of file diff --git a/src/main/java/com/emr/singleton/PdfReaderSingleton.java b/src/main/java/com/emr/singleton/PdfReaderSingleton.java new file mode 100644 index 0000000..b47e5b8 --- /dev/null +++ b/src/main/java/com/emr/singleton/PdfReaderSingleton.java @@ -0,0 +1,33 @@ +package com.emr.singleton; + +import com.lowagie.text.pdf.PdfReader; + +import static org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.HOLDER; + +/** + * @ProjectName: + * @Description: + * @Param 传输参数 + * @Return + * @Author: 曾文和 + * @CreateDate: 2020/12/3 13:40 + * @UpdateUser: 曾文和 + * @UpdateDate: 2020/12/3 13:40 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ +public class PdfReaderSingleton extends PdfReader { + private PdfReaderSingleton(){}; + + public static PdfReaderSingleton getInstance(){ + return ContainerHolder.HOLDER.singleton; + } + + private enum ContainerHolder{ + HOLDER; + private PdfReaderSingleton singleton; + ContainerHolder(){ + singleton = new PdfReaderSingleton(); + } + } +} diff --git a/src/main/java/com/emr/util/DateUtil.java b/src/main/java/com/emr/util/DateUtil.java new file mode 100644 index 0000000..ed5db39 --- /dev/null +++ b/src/main/java/com/emr/util/DateUtil.java @@ -0,0 +1,46 @@ +package com.emr.util; + +import com.sun.tools.example.debug.expr.ParseException; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + * @ProjectName: + * @Description: + * @Param 传输参数 + * @Return + * @Author: 曾文和 + * @CreateDate: 2020/12/29 10:48 + * @UpdateUser: 曾文和 + * @UpdateDate: 2020/12/29 10:48 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ +public class DateUtil { + public static List getDays(String startTime, String endTime) { + // 返回的日期集合 + List days = new ArrayList(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date start = dateFormat.parse(startTime); + Date end = dateFormat.parse(endTime); + Calendar tempStart = Calendar.getInstance(); + tempStart.setTime(start); + Calendar tempEnd = Calendar.getInstance(); + tempEnd.setTime(end); + tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束) + while (tempStart.before(tempEnd)) { + days.add(dateFormat.format(tempStart.getTime())); + tempStart.add(Calendar.DAY_OF_YEAR, 1); + } + } catch (Exception e) { + e.printStackTrace(); + } + return days; + } +} diff --git a/src/main/resources/mapper/ArchiveOtherExtMapper.xml b/src/main/resources/mapper/ArchiveOtherExtMapper.xml index 0bd1da4..d7f0532 100644 --- a/src/main/resources/mapper/ArchiveOtherExtMapper.xml +++ b/src/main/resources/mapper/ArchiveOtherExtMapper.xml @@ -418,6 +418,7 @@ + and sysFlag in (1,2,3,4,5,6,7,8,9) and jzh = #{jzh,jdbcType=NVARCHAR} @@ -624,4 +625,47 @@ + + diff --git a/src/main/webapp/WEB-INF/views/font/showRecord.jsp b/src/main/webapp/WEB-INF/views/font/showRecord.jsp index 0c23ac1..e4bea18 100644 --- a/src/main/webapp/WEB-INF/views/font/showRecord.jsp +++ b/src/main/webapp/WEB-INF/views/font/showRecord.jsp @@ -95,6 +95,8 @@ + +
diff --git a/src/main/webapp/WEB-INF/views/font/showRecordByOpId.jsp b/src/main/webapp/WEB-INF/views/font/showRecordByOpId.jsp new file mode 100644 index 0000000..3f2df6d --- /dev/null +++ b/src/main/webapp/WEB-INF/views/font/showRecordByOpId.jsp @@ -0,0 +1,214 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + +<%@ include file="/WEB-INF/jspf/comm.jspf" %> +<%@ include file="/WEB-INF/jspf/ztreeCommom.jsp" %> + + + + + 病案浏览 + + + + + + + + + + + + + + + + + +
+
+
+ + 病案浏览 + +
+
+ +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+ + + + diff --git a/src/main/webapp/WEB-INF/views/font/showRecordIframe.jsp b/src/main/webapp/WEB-INF/views/font/showRecordIframe.jsp index 4a9b22f..d06b31a 100644 --- a/src/main/webapp/WEB-INF/views/font/showRecordIframe.jsp +++ b/src/main/webapp/WEB-INF/views/font/showRecordIframe.jsp @@ -68,11 +68,11 @@
-
- +
+
- +
@@ -86,7 +86,7 @@
- + diff --git a/src/main/webapp/WEB-INF/views/index.jsp b/src/main/webapp/WEB-INF/views/index.jsp index d34b2ee..a9c5216 100644 --- a/src/main/webapp/WEB-INF/views/index.jsp +++ b/src/main/webapp/WEB-INF/views/index.jsp @@ -355,7 +355,7 @@