diff --git a/src/main/java/com/emr/controller/FontShowRecordController.java b/src/main/java/com/emr/controller/FontShowRecordController.java index b9312d8..87ae204 100644 --- a/src/main/java/com/emr/controller/FontShowRecordController.java +++ b/src/main/java/com/emr/controller/FontShowRecordController.java @@ -1,11 +1,20 @@ package com.emr.controller; import com.alibaba.fastjson.JSON; +import com.emr.annotation.OptionalLog; import com.emr.dao.CommomMapper; +import com.emr.dao.Emr_DictionaryMapper; +import com.emr.dao.approve.Emr_Apply_ApproveMapper; +import com.emr.entity.Emr_Dictionary; import com.emr.entity.Power_User; import com.emr.entity.ResultUtil; +import com.emr.entity.approve.Emr_Apply_Approve; +import com.emr.entity.emrLog.Emr_Log; import com.emr.service.CommomService; +import com.emr.service.approve.ApplyApproveService; +import com.emr.service.emrLog.LogService; import com.emr.service.emrPrintOrDownLoadInfo.PrintOrDownLoadInfoService; +import com.emr.util.DateUtils; import com.emr.util.ExceptionPrintUtil; import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo; import com.emr.vo.commomSearch.CommomTree; @@ -16,6 +25,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; @@ -25,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.io.File; +import java.text.SimpleDateFormat; import java.util.*; @Controller @@ -40,6 +51,14 @@ public class FontShowRecordController { private PrintOrDownLoadInfoService printOrDownLoadInfoService; @Autowired private CommomService commomService; + @Autowired + private LogService logService; + @Autowired + private ApplyApproveService applyApproveService; + @Autowired + private Emr_DictionaryMapper dictionaryMapper; + + /** * @MethodName recordList * @Description: @@ -72,7 +91,6 @@ public class FontShowRecordController { user.setUserId(-999); user.setRoleId(-999); Set menu = new TreeSet<>(); - //menu.add("/commom/printPdf"); user.setMenus(menu); UsernamePasswordToken userToken = new UsernamePasswordToken(user.getUserName(), "123456"); Subject subject = SecurityUtils.getSubject(); @@ -86,6 +104,172 @@ public class FontShowRecordController { return "font/recordList"; } + /** + * 南方医院接口方法 + * @param inpatientNo + * @param userName + * @param model + * @param request + * @return + */ + @RequestMapping(value = "recordListSouth") + public String showRecordSouth(String inpatientNo, String userName, String deptName, Model model, HttpServletRequest request) { + try{ + //根据病案号查看病案是否存在 + if(StringUtils.isNotBlank(inpatientNo)){ + int commom = commomMapper.isExistInpatientOrAdmissId(inpatientNo, null, null); + if(commom == 0){ + model.addAttribute("msg","病案不存在!"); + return "font/msg"; + } + }else{ + model.addAttribute("msg","参数病案号不能为空!"); + return "font/msg"; + } + //虚假登陆 + //验证shiro(有shiro才此操作) + Power_User user = new Power_User(); + user.setUserName(userName); + user.setUserId(-999); + user.setRoleId(-999); + Set menu = new TreeSet<>(); + //menu.add("/commom/printPdf"); + user.setMenus(menu); + UsernamePasswordToken userToken = new UsernamePasswordToken(user.getUserName(), "123456"); + Subject subject = SecurityUtils.getSubject(); + subject.login(userToken); + request.getSession().setAttribute("CURRENT_USER", user); + request.getSession().setAttribute("userName", userName); + request.getSession().setAttribute("deptName", deptName); + model.addAttribute("inpatientNo",inpatientNo); + Emr_Log emrLog = new Emr_Log(); + emrLog.setLogTitle("接口查看"); + emrLog.setLogContent("接口查询页面"); + logService.insertInterface(emrLog, userName); + }catch (Exception e){ + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + return "font/recordListSouth"; + } + + /** + * 南方医院接口 + * @param page + * @param limit + * @param inpatientNo + * @param request + * @return + */ + @RequestMapping("getRecordListByInpatientNoSouth") + @ResponseBody + public String getRecordListByInpatientNoSouth(Integer page, Integer limit,String inpatientNo, HttpServletRequest request){ + if(null != page && null != limit){ + PageHelper.startPage(page, limit); + } + try{ + List list = commomMapper.selectCommomByInpatientNo(inpatientNo); + PageInfo pageInfo = new PageInfo<>(list); + return JSON.toJSONString(pageInfo); + }catch (Exception e){ + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + return null; + } + } + + /** + * 南方医院接口无登录访问 + * @param userName + * @param deptName + * @param request + * @return + */ + @RequestMapping(value = "commomListSouth") + public String commomListSouth(String userName, String deptName, Model model, HttpServletRequest request){ + //验证shiro(有shiro才此操作) + UsernamePasswordToken userToken = new UsernamePasswordToken(userName, "123456"); + Subject subject = SecurityUtils.getSubject(); + subject.login(userToken); + Power_User user = new Power_User(); + user.setUserName(userName); + request.getSession().setAttribute("cuserName", userName); + request.getSession().setAttribute("CURRENT_USER", user); + request.getSession().setAttribute("cdeptName", deptName); + model.addAttribute("cuserName", userName); + return "font/commomListSouth"; + } + + /** + * 接口保存借阅申请 + * @param applyApprove + * @param patientIds + * @param request + * @return + * @throws Exception + */ + @RequestMapping("addApplyApprove") + @ResponseBody + @OptionalLog(module = "接口保存",methods = "接口查询页面保存借阅申请") + public ResultUtil addApplyApprove(Emr_Apply_Approve applyApprove, String patientIds,HttpServletRequest request) throws Exception { + boolean flag = FormTokenFlagUtil.isFlag(request); + if (!flag) { + return ResultUtil.error("请不要重复提交!"); + } + List commomtables = commomMapper.selectAllByPatients(patientIds.substring(0, patientIds.length()-1)); + if(null != commomtables && !commomtables.isEmpty()) { + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String userName = (String)request.getSession().getAttribute("cuserName"); + applyApprove.setApplyer(userName); + applyApprove.setApplyTime(fmt.format(new Date())); + List list = new ArrayList<>(); + ///查询表列数 + int colCount = commomMapper.selectColByTableName("emr_apply_approve"); + int simpleInsertCount = 2100/colCount; + for (int i = 0; i < commomtables.size(); i++) { + //处理批量添加sql太长问题,设定个数为180 + if(i > 0 && list.size()%simpleInsertCount == 0){ + list.clear(); + } + Emr_Apply_Approve applyApproveInsert = new Emr_Apply_Approve(); + BeanUtils.copyProperties(applyApprove, applyApproveInsert); + BeanUtils.copyProperties(commomtables.get(i), applyApproveInsert); + if(StringUtils.isNotBlank(commomtables.get(i).getDisDate())){ + applyApproveInsert.setDisDate(DateUtils.strToDateLong(commomtables.get(i).getDisDate())); + } + list.add(applyApproveInsert); + if(list.size() == 1 && list.get(0).getId() != null){ + applyApproveService.updateEmrApplyApprove(list.get(0)); + }else{ + //是180的倍数或最后一个 + if((list.size()%simpleInsertCount == 0 || i == commomtables.size() - 1)){ + applyApproveService.SimpleInsert(list); + } + } + } + sendPowerApproveInterface(applyApprove.getApplyType(), commomtables.size()); + return ResultUtil.ok(); + } + return ResultUtil.error("请至少选中一个!"); + } + + //推送给权限系统下发审批人通知 + private void sendPowerApproveInterface(String applyType,Integer count) throws Exception{ + //查询申请类型 + List dictionaryList = dictionaryMapper.selectDictionaryByTypeCode("apply_type"); + String applyTypeName = ""; + if(null != dictionaryList && !dictionaryList.isEmpty()){ + for(Emr_Dictionary dictionary : dictionaryList){ + if(dictionary.getCode().equals(applyType)){ + applyTypeName = dictionary.getName(); + break; + } + } + } + //发送通知 + applyApproveService.sendNotice(applyTypeName,count); + } + @RequestMapping("getRecordListByInpatientNo") @ResponseBody public String getRecordListByInpatientNo(Integer page, Integer limit,String inpatientNo){ @@ -137,7 +321,32 @@ public class FontShowRecordController { } /** - * + * 南方医院接口 + * @param patientId + * @param model + * @param request + * @return + */ + @RequestMapping("showRecordFontSouth") + public String showRecordFontSouth(String patientId, Model model, HttpServletRequest request) { + model.addAttribute("patientId", patientId); + try { + List printCount = printOrDownLoadInfoService.getPrintCount(patientId); + if (null != printCount && !printCount.isEmpty()) { + model.addAttribute("printCount", 1); + } + String userName = (String)request.getSession().getAttribute("userName"); + Emr_Log emrLog = new Emr_Log(); + emrLog.setLogTitle("接口查看"); + emrLog.setLogContent("接口预览页面"); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + return "font/showRecordFontSouth"; + } + + /** * 跳转查看pdfiframe页 * @param patientId * @param model @@ -148,21 +357,24 @@ public class FontShowRecordController { model.addAttribute("patientId", patientId); //查询是否有打印权限 int printFlag = 0; - /*Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); - Set menus = user.getMenus(); - for (String menu : menus) { - if (StringUtils.isNotBlank(menu)) { - if ("/commom/printPdf".equals(menu)) { - printFlag = 1; - break; - } - } - }*/ model.addAttribute("printFlag", printFlag); model.addAttribute("flag", flag); return "font/showRecordIframeFont"; } + + @RequestMapping("showRecordIframeFontSouth") + public String showRecordIframeFontSouth(String patientId, String flag,Model model, HttpServletRequest request) { + model.addAttribute("patientId", patientId); + //查询是否有打印权限 + int printFlag = 0; + model.addAttribute("printFlag", printFlag); + model.addAttribute("flag", flag); + model.addAttribute("userName", (String)request.getSession().getAttribute("userName")); + model.addAttribute("deptName", (String)request.getSession().getAttribute("deptName")); + return "font/showRecordIframeFontSouth"; + } + /** * 脐血、祈福分类树 * @param patientId @@ -275,4 +487,41 @@ public class FontShowRecordController { model.addAttribute("httpFilePath",httpFilePath); return "font/showPdfFrameFont"; } + + /** + * 南方医院查看PDF + * @param patientId + * @param scanPages + * @param sources + * @param flag + * @param model + * @param request + * @return + */ + @RequestMapping(value = "showRecordContentSouthFont") + public String showRecordContentSouthFont(String patientId, String scanPages, String sources, String flag,Model model, HttpServletRequest request){ + String pdfTempRoot = "pdfTemp"; + //临时保存pdf的文件目录 + String fileOutRoot = WATERPICPATH + pdfTempRoot; + //目录不存在则创建 + if(!new File(fileOutRoot).isDirectory()){ + new File(fileOutRoot).mkdirs(); + } + //文件相对路径 + String filePath = pdfTempRoot + "\\" + UUID.randomUUID() + ".pdf"; + //组织暂存pdf文件路径 + String fileOutPath = WATERPICPATH + filePath; + //组织前台访问临时pdf路径 + String httpFilePath = EMRRECORDJSP + "\\reload\\" + filePath; + String userName = (String)request.getSession().getAttribute("userName"); + String deptName = (String)request.getSession().getAttribute("deptName"); + try { + commomService.showRecordContentSouthFont(patientId,userName,deptName,scanPages,sources,flag,fileOutPath); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + model.addAttribute("httpFilePath",httpFilePath); + return "font/showPdfFrameFont"; + } } diff --git a/src/main/java/com/emr/controller/commomSearch/CommomSearchController.java b/src/main/java/com/emr/controller/commomSearch/CommomSearchController.java index f916cc9..2133b2b 100644 --- a/src/main/java/com/emr/controller/commomSearch/CommomSearchController.java +++ b/src/main/java/com/emr/controller/commomSearch/CommomSearchController.java @@ -6,10 +6,12 @@ import com.emr.dao.*; import com.emr.dao.approve.Emr_Apply_ApproveMapper; import com.emr.dao.tScanAssort.T_Scan_AssortMapper; import com.emr.entity.*; +import com.emr.entity.emrLog.Emr_Log; import com.emr.entity.recordType.Emr_Type; import com.emr.entity.recordType.Emr_Type_Related; import com.emr.service.CommomService; import com.emr.service.Zd_AssortServiceImpl; +import com.emr.service.emrLog.LogService; import com.emr.service.emrPrintOrDownLoadInfo.PrintOrDownLoadInfoService; import com.emr.service.recordType.EmrTypeRelatedService; import com.emr.service.recordType.EmrTypeService; @@ -73,9 +75,12 @@ public class CommomSearchController { private Zd_AssortMapper assortMapper; @Autowired private CommomService commomService; + @Autowired + private LogService logService; + //祈福医院 @RequiresPermissions("/commom/commomListqf") - @OptionalLog(module="查看", methods="常用查询页面") + @OptionalLog(module = "查看", methods = "常用查询页面") @RequestMapping("commomListqf") public String commomListqf() { return "recordManage/commomSearch/commomListqf"; @@ -84,12 +89,12 @@ public class CommomSearchController { //加载性别 @RequestMapping("getSex") @ResponseBody - public String getSex(){ + public String getSex() { try { //加载性别集合 List sexList = dictionaryMapper.selectDictionaryByTypeCode("sex_code"); return JSON.toJSONString(sexList); - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return null; @@ -104,7 +109,7 @@ public class CommomSearchController { //加载科室集合 List deptList = dictionaryMapper.selectDictionaryByTypeCode("dept_code"); return JSON.toJSONString(deptList); - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return null; @@ -113,12 +118,13 @@ public class CommomSearchController { /** * 根据公共表id查询公共表信息 + * * @param patientId * @return */ @RequestMapping("getCommomInfoById") @ResponseBody - public String getCommomInfoById(String patientId){ + public String getCommomInfoById(String patientId) { try { CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId); return JSON.toJSONString(commomVo); @@ -131,6 +137,7 @@ public class CommomSearchController { /** * 加载公共表信息 + * * @return */ @RequestMapping("getCommonInfo") @@ -180,7 +187,9 @@ public class CommomSearchController { } } /******************************病案预览操作****************************/ - /**174医院、祈福 + /** + * 174医院、祈福 + * * @MethodName: showRecord174 * @Description: 跳转到档案预览 * @Param String patientId:patientId @@ -215,14 +224,43 @@ public class CommomSearchController { return "recordManage/commomSearch/showRecord174"; } + @RequestMapping("showRecordSouth") + public String showRecordSouth(String patientId, String userName, String deptName ,Model model, HttpServletRequest request) { + model.addAttribute("patientId", patientId); + model.addAttribute("userName", userName); + model.addAttribute("deptName", deptName); + //加载登陆者 + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); + if (null != user) { + model.addAttribute("user", user); + model.addAttribute("roleId", user.getRoleId()); + } + List printCount = null; + try { + printCount = printOrDownLoadInfoService.getPrintCount(patientId); + + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + if (null != printCount && !printCount.isEmpty()) { + model.addAttribute("printCount", 1); + } + Emr_Log emrLog = new Emr_Log(); + emrLog.setLogTitle("接口查看"); + emrLog.setLogContent("接口预览页面"); + logService.insertInterface(emrLog, userName); + return "recordManage/commomSearch/showRecordSouth"; + } + //加载病案信息 @RequestMapping("getRecord") @ResponseBody - public String getRecord(String patientId,String flag) { + public String getRecord(String patientId, String flag) { if (StringUtils.isNoneBlank(patientId)) { try { //根据patientId查询包含其他诊断的基本信息 - List commomVos = commomMapper.selectOtherDiagByPatientId(patientId,flag); + List commomVos = commomMapper.selectOtherDiagByPatientId(patientId, flag); return JSON.toJSONString(commomVos.get(0)); } catch (Exception e) { ExceptionPrintUtil.printException(e); @@ -263,7 +301,7 @@ public class CommomSearchController { */ @RequestMapping("getAssortList") @ResponseBody - public ResultUtil getAssortList(HttpServletRequest request) throws Exception{ + public ResultUtil getAssortList(HttpServletRequest request) throws Exception { Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); List zdAssorts = new ArrayList<>(); if (user.getRoleId() == 0 || user.getRoleId() == -100) { @@ -277,13 +315,14 @@ public class CommomSearchController { /** * 脐血库、祈福 * 跳转查看pdfiframe页 + * * @param patientId * @param model * @param request * @return */ @RequestMapping("showRecordIframeBlood") - public String showRecordIframeBlood(String patientId,String flag,Model model, HttpServletRequest request) { + public String showRecordIframeBlood(String patientId, String flag, Model model, HttpServletRequest request) { model.addAttribute("patientId", patientId); Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); //打印分类集合 @@ -304,21 +343,77 @@ public class CommomSearchController { model.addAttribute("isDownload", isDownload); //查询是否有打印权限 int printFlag = 0; + int moveFlag = 0; Set menus = user.getMenus(); for (String menu : menus) { if (StringUtils.isNotBlank(menu)) { if ("/commom/printPdf".equals(menu)) { printFlag = 1; - break; + } + if ("/commom/movePdf".equals(menu)) { + moveFlag = 1; } } } + model.addAttribute("moveFlag", moveFlag); model.addAttribute("printFlag", printFlag); model.addAttribute("flag", flag); return "recordManage/commomSearch/showRecordIframeBlood"; } - /**查看其它诊断 + /** + * 南方医院访问 + * @param userName + * @param flag + * @param model + * @param request + * @return + */ + @RequestMapping("showRecordIframeSouth") + public String showRecordIframeSouth(String patientId, String userName, String deptName, String flag, Model model, HttpServletRequest request) { + model.addAttribute("patientId", patientId); + model.addAttribute("userName", request.getSession().getAttribute("userName")); + model.addAttribute("deptName", request.getSession().getAttribute("deptName")); + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); + //打印分类集合 + List emrTypes = null; + List zdAssorts = null; + int isDownload = 0; + try { + emrTypes = emrTypeService.selectAllByCreater(1, request); + //病案分段集合 + zdAssorts = assortService.selectAllByPower(user); + isDownload = apply_approveMapper.selectIsPowerByUser(user.getUserName(), patientId, 3); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + model.addAttribute("emrTypes", emrTypes); + model.addAttribute("zdAssorts", zdAssorts); + model.addAttribute("isDownload", isDownload); + //查询是否有打印权限 + int printFlag = 0; + int moveFlag = 0; + Set menus = user.getMenus(); + for (String menu : menus) { + if (StringUtils.isNotBlank(menu)) { + if ("/commom/printPdf".equals(menu)) { + printFlag = 1; + } + if ("/commom/movePdf".equals(menu)) { + moveFlag = 1; + } + } + } + model.addAttribute("moveFlag", moveFlag); + model.addAttribute("printFlag", printFlag); + model.addAttribute("flag", flag); + return "recordManage/commomSearch/showRecordIframeSouth"; + } + + /** + * 查看其它诊断 + * * @MethodName: getOtherDiagNameByAdmissTimesAndInpatientNo * @Description: 根据admissTimes和inpatientNo查询包含其他诊断名称的基本信息 * @Param Integer admissTimes:住院次数,String inpatientNo:病案号 @@ -332,7 +427,7 @@ public class CommomSearchController { */ @RequestMapping(value = "getOtherDiagNameByAdmissTimesAndInpatientNo", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public String getOtherDiagNameByAdmissTimesAndInpatientNo(String name, Short admissTimes, String inpatientNo,String flag) { + public String getOtherDiagNameByAdmissTimesAndInpatientNo(String name, Short admissTimes, String inpatientNo, String flag) { if (StringUtils.isNoneBlank(name) && admissTimes != null && StringUtils.isNoneBlank(inpatientNo)) { try { //根据病案号,住院次数,姓名查询对应的patientId @@ -348,7 +443,7 @@ public class CommomSearchController { return "查询无该档案"; } if (StringUtils.isNoneBlank(patientId)) { - List commomVos = commomMapper.selectOtherDiagByPatientId(patientId,flag); + List commomVos = commomMapper.selectOtherDiagByPatientId(patientId, flag); if (null != commomVos && !commomVos.isEmpty()) { return JSON.toJSONString(commomVos.get(0)); } else { @@ -367,6 +462,7 @@ public class CommomSearchController { /** * 脐血、祈福分类树 + * * @param patientId * @param typeId * @param request @@ -488,6 +584,7 @@ public class CommomSearchController { /** * 祈福打印预览前加载图片 + * * @param patientId * @param rootPaths * @param names @@ -495,20 +592,41 @@ public class CommomSearchController { * @return * @throws Exception */ - @RequestMapping(value="selectPrintPic",method = RequestMethod.POST) + @RequestMapping(value = "selectPrintPic", method = RequestMethod.POST) @ResponseBody - public ResultUtil selectPrintPic(String patientId,String rootPaths,String names,String sources,HttpServletRequest request) throws Exception{ + public ResultUtil selectPrintPic(HttpServletResponse response, String patientId, String rootPaths, String names, String sources, HttpServletRequest request) throws Exception { //生成加载进度mapKey - 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; - List outs = commomService.selectPrintPic(patientId,rootPaths,names,sources,mapKey); + List outs = commomService.selectPrintPic(response, patientId, rootPaths, names, sources, mapKey); return ResultUtil.ok(outs); } + /** + * 南方太和医院打印预览前加载图片 + * + * @param patientId + * @param rootPaths + * @param names + * @param sources + * @return + * @throws Exception + */ + @RequestMapping(value = "selectPrintPicTh", method = RequestMethod.POST) + @ResponseBody + public ResultUtil selectPrintPicTh(String patientId, String rootPaths, String names, String sources, HttpServletRequest request) throws Exception { + //生成加载进度mapKey + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); + String mapKey = user.getUserName() + "_" + patientId; + List outs = commomService.selectPrintPicTh(patientId, rootPaths, names, sources, mapKey); + return ResultUtil.ok(outs); + } + + @RequestMapping("getPrintPicLoading") @ResponseBody - public ResultUtil getPrintPicLoading(String patientId,HttpServletRequest request) throws Exception{ - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + public ResultUtil getPrintPicLoading(String patientId, HttpServletRequest request) throws Exception { + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String mapKey = user.getUserName() + "_" + patientId; Integer loadingInteger = commomService.getPrintPicLoading(mapKey); return ResultUtil.ok(loadingInteger); @@ -516,6 +634,7 @@ public class CommomSearchController { /** * 脐血库、祈福查看pdf + * * @param patientId * @param scanPages * @param sources @@ -524,16 +643,40 @@ public class CommomSearchController { */ @RequestMapping(value = "showRecordContentBlood") @ResponseBody - public void showRecordContentBlood(String patientId,String scanPages, String sources,String flag,HttpServletResponse response) { + public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response) { try { - commomService.showRecordContentBlood(patientId,scanPages,sources,flag,response); + commomService.showRecordContentBlood(patientId, scanPages, sources, flag, response); } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } } - /**脐血库、祈福 + /** + * 南方医院访问 + * @param patientId + * @param userName + * @param scanPages + * @param sources + * @param flag + * @param response + */ + @RequestMapping(value = "showRecordContentSouth") + @ResponseBody + public void showRecordContentSouth(String patientId, String userName, String deptName, String scanPages, String sources, String flag, HttpServletResponse response, HttpServletRequest request) { + try { + userName = (String)request.getSession().getAttribute("userName"); + deptName = (String)request.getSession().getAttribute("deptName"); + commomService.showRecordContentSouth(patientId, userName, deptName, scanPages, sources, flag, response); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } + } + + /** + * 脐血库、祈福 + * * @MethodName: updateScanAssortByBlood * @Description: 重新分页 * @Param String patientId,String assortIds:病案图片集合,newAssortId新的分类id @@ -546,21 +689,21 @@ public class CommomSearchController { * @Version: 1.0 */ @RequiresPermissions("/commom/updateScanAssort") - @OptionalLog(module = "修改", methods = "档案预览页面病案图片重新分类",fieldName = "name",tableName = "commomtable") + @OptionalLog(module = "修改", methods = "档案预览页面病案图片重新分类", fieldName = "name", tableName = "commomtable") @RequestMapping(value = "updateScanAssortByBlood", method = RequestMethod.POST) @ResponseBody - public ResultUtil updateScanAssortByBlood(CommomVo commomVo,String assortIds, String newAssortId) throws Exception{ + public ResultUtil updateScanAssortByBlood(CommomVo commomVo, String assortIds, String newAssortId) throws Exception { if (StringUtils.isNoneBlank(commomVo.getPatientId()) && StringUtils.isNoneBlank(assortIds) && StringUtils.isNoneBlank(newAssortId)) { //根据patientId,admissIds(scanPage分类图片集合)批量更新分段id assrotdId //组织picNames StringBuilder picNameStr = new StringBuilder(); String[] picNames = assortIds.split(","); - for(String picName : picNames){ - if(StringUtils.isNotBlank(picName)){ + for (String picName : picNames) { + if (StringUtils.isNotBlank(picName)) { picNameStr.append("'").append(picName).append("',"); } } - picNameStr = new StringBuilder(picNameStr.substring(0,picNameStr.length()-1)); + picNameStr = new StringBuilder(picNameStr.substring(0, picNameStr.length() - 1)); //批量更新 scanAssortService.SimpleUpdateByPatientIdAndScanPages(commomVo.getPatientId(), newAssortId, picNameStr.toString()); return ResultUtil.ok(); @@ -573,9 +716,9 @@ public class CommomSearchController { @RequiresPermissions("/commom/updatePic") @RequestMapping(value = "updatePic", method = RequestMethod.POST) @ResponseBody - public ResultUtil updatePic(CommomVo commomVo,@RequestParam(required = false, value = "files") MultipartFile[] files,String assortId) throws Exception{ + public ResultUtil updatePic(CommomVo commomVo, @RequestParam(required = false, value = "files") MultipartFile[] files, String assortId) throws Exception { ResultUtil resultUtil = commomService.updatePic(files, commomVo.getPatientId(), assortId); - if(!resultUtil.getCode().equals(0)){ + if (!resultUtil.getCode().equals(0)) { return resultUtil; } return ResultUtil.ok(); @@ -594,10 +737,10 @@ public class CommomSearchController { * @Version: 1.0 */ @RequiresPermissions("/commom/delScanAssort") - @OptionalLog(module = "删除", methods = "档案预览页面删除病案图片",fieldName = "name",tableName = "commomtable") + @OptionalLog(module = "删除", methods = "档案预览页面删除病案图片", fieldName = "name", tableName = "commomtable") @RequestMapping(value = "delScanAssortByBlood", method = RequestMethod.POST) @ResponseBody - public ResultUtil delScanAssortByBlood(String patientId) throws Exception{ + public ResultUtil delScanAssortByBlood(String patientId) throws Exception { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String assortIds = request.getParameter("assortIds"); if (StringUtils.isNoneBlank(patientId) && StringUtils.isNoneBlank(assortIds)) { @@ -622,11 +765,11 @@ public class CommomSearchController { */ @RequestMapping("selectDeledPicRecordTree") @ResponseBody - public List selectDeledPicRecordTree(String patientId,String flag) { + public List selectDeledPicRecordTree(String patientId, String flag) { List treeList = new ArrayList<>(); //根据patientId查询已删除图片集合 try { - List scanAssortVos = scanAssortMapper.selectDeledPicList(patientId,flag); + List scanAssortVos = scanAssortMapper.selectDeledPicList(patientId, flag); //第一级:全部影像资料 ScanDeledAssortTree tree1 = new ScanDeledAssortTree(); Integer id = 1; @@ -688,6 +831,7 @@ public class CommomSearchController { } return treeList; } + /** * @MethodName: getDeledPicRecordTree * @Description: 组织已删除图片的病案分类树 @@ -702,30 +846,31 @@ public class CommomSearchController { */ @OptionalLog(module = "修改", methods = "恢复已删除图片", fieldName = "name", tableName = "commomtable") @RequiresPermissions("/commom/recoverPic") - @RequestMapping(value="recoverPic",method = RequestMethod.POST) + @RequestMapping(value = "recoverPic", method = RequestMethod.POST) @ResponseBody - public ResultUtil recoverPic(CommomVo commomVo,String scanPages) throws Exception{ - scanAssortService.recoverPic(commomVo.getPatientId(),scanPages); + public ResultUtil recoverPic(CommomVo commomVo, String scanPages) throws Exception { + scanAssortService.recoverPic(commomVo.getPatientId(), scanPages); return ResultUtil.ok(); } /**************************恢复已删除图片结束***********************/ /**************************病案维护开始*****************************/ /** * 祈福医院病案修改 + * * @param commomVo * @return * @throws Exception */ @RequiresPermissions("/commom/updateCommomInfo") - @OptionalLog(module = "保存",methods = "病案信息修改") + @OptionalLog(module = "保存", methods = "病案信息修改") @RequestMapping("updateCommomInfo") @ResponseBody - public ResultUtil updateCommomInfo(CommomVo commomVo) throws Exception{ - if (null != commomVo.getInpatientNo()){ + public ResultUtil updateCommomInfo(CommomVo commomVo) throws Exception { + if (null != commomVo.getInpatientNo()) { int vo = commomMapper.selectCountByPatients(commomVo.getPatientId()); - if (vo > 0){ + if (vo > 0) { int i = commomMapper.updateByPrimaryKeySelective(commomVo); - if (i > 0){ + if (i > 0) { return ResultUtil.ok(); } else { return ResultUtil.error("修改失败!"); @@ -778,7 +923,9 @@ public class CommomSearchController { } } - /**getOperateCodeContents + /** + * getOperateCodeContents + * * @MethodName: * @Description: 根据手术编码查询手术对象集合 * @Param @@ -830,7 +977,7 @@ public class CommomSearchController { */ @RequestMapping(value = "getDictionaryByTypeCode", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public String getDictionaryByTypeCode(String typeCode) throws Exception{ + public String getDictionaryByTypeCode(String typeCode) throws Exception { List dictionaries = dictionaryMapper.selectDictionaryByTypeCode(typeCode); return JSON.toJSONString(dictionaries); } @@ -849,7 +996,7 @@ public class CommomSearchController { */ @RequestMapping(value = "getIcdCodeList", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public String getIcdCodeList() throws Exception{ + public String getIcdCodeList() throws Exception { List icdCodes = icdCodeMapper.selectAll(null, null); return JSON.toJSONString(icdCodes); } diff --git a/src/main/java/com/emr/controller/emrApprove/ApproveController.java b/src/main/java/com/emr/controller/emrApprove/ApproveController.java index 30fb976..cbe76d3 100644 --- a/src/main/java/com/emr/controller/emrApprove/ApproveController.java +++ b/src/main/java/com/emr/controller/emrApprove/ApproveController.java @@ -11,6 +11,7 @@ import com.emr.entity.Power_User; import com.emr.entity.ResultUtil; import com.emr.entity.approve.Emr_Apply_Approve; import com.emr.entity.emrReasonAnnoModel.Emr_Reason_Anno_Model; +import com.emr.service.CommomService; import com.emr.service.ImportExcel.ImportExcelEntity; import com.emr.service.ImportExcel.ImportExcelUtil; import com.emr.service.approve.ApplyApproveService; @@ -19,11 +20,13 @@ import com.emr.util.ConvertToSelectJson; import com.emr.util.DateUtils; import com.emr.util.ExceptionPrintUtil; import com.emr.util.ExportExcelUtil; +import com.emr.vo.User; import com.emr.vo.commomSearch.CommomVo; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.apache.shiro.util.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -74,6 +77,8 @@ public class ApproveController { private Emr_Apply_ApproveMapper applyApproveMapper; @Value("${POWER_URLHEAD}") private String POWER_URLHEAD; + @Autowired + private CommomService commomService; /** * @MethodName: approveListByAppleStatus * @Description: 查询该用户该记录是否有未提交,有则返回 @@ -448,6 +453,18 @@ public class ApproveController { obj.setAddOper(addOper); obj.setUpdateOper(updateOper); obj.setDeleteOper(deleteOper); + //转换用户名 + List userList = commomService.getUserList(user.getUserName(), request); + //获取申请者工号 + 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); + } + } + } } } } @@ -643,6 +660,23 @@ public class ApproveController { } for (Emr_Apply_Approve obj : approves){ obj.setUpdateOper(updateOper); + //转换用户名 + List userList = commomService.getUserList(user.getUserName(), request); + //获取申请者工号 + String applyer = obj.getApplyer(); + //获取审批者工号 + String approver = obj.getApprover(); + if(!CollectionUtils.isEmpty(userList)){ + for(User user1 : userList){ + String name = user1.getName(); + if(StringUtils.isNotBlank(applyer) && user1.getUserName().equals(applyer)){ + obj.setApplyer(name); + } + if(StringUtils.isNotBlank(approver) && user1.getUserName().equals(approver)){ + obj.setApprover(name); + } + } + } } } } diff --git a/src/main/java/com/emr/controller/emrPrintOrDownLoadInfo/jetbrains-agent.jar b/src/main/java/com/emr/controller/emrPrintOrDownLoadInfo/jetbrains-agent.jar new file mode 100644 index 0000000..7edbb51 Binary files /dev/null and b/src/main/java/com/emr/controller/emrPrintOrDownLoadInfo/jetbrains-agent.jar differ diff --git a/src/main/java/com/emr/controller/otherManage/BackDatabaseController.java b/src/main/java/com/emr/controller/otherManage/BackDatabaseController.java index d933624..3297566 100644 --- a/src/main/java/com/emr/controller/otherManage/BackDatabaseController.java +++ b/src/main/java/com/emr/controller/otherManage/BackDatabaseController.java @@ -64,6 +64,17 @@ public class BackDatabaseController { return "otherManage/backupDatabase"; } + /** + * 接口借阅日志 + * @return + */ + @RequiresPermissions("/otherManage/interfaceDatabase") + @RequestMapping("interfaceDatabase") + public String interfaceDatabase(){ + return "otherManage/interfaceDatabase"; + } + + /** * @MethodName getLogList * @Description: 获取日志数据表 @@ -111,6 +122,51 @@ public class BackDatabaseController { } } + /** + * 接口借阅日志查询 + * @param page + * @param limit + * @param log + * @param startTime + * @param endTime + * @param request + * @return + */ + @RequestMapping("getLogListIf") + @ResponseBody + public String getLogListIf(Integer page, Integer limit, Emr_Log log, String startTime, String endTime, HttpServletRequest request){ + if(null != page && null != limit){ + PageHelper.startPage(page, limit); + } + try{ + List logs = logMapper.selectAllByFont(log, startTime, endTime); + //匹配权限 + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); + Set menus = user.getMenus(); + if(null != logs && !logs.isEmpty()){ + if(null != menus && !menus.isEmpty()){ + int deleteOper = 0; + for(String menu : menus){ + if(StringUtils.isNotBlank(menu)){ + if("/otherManage/deleteLogById".equals(menu)){ + deleteOper = 1; + } + } + } + for (Emr_Log obj : logs){ + obj.setDeleteOper(deleteOper); + } + } + } + PageInfo pageInfo = new PageInfo<>(logs); + return JSON.toJSONString(pageInfo); + }catch (Exception e){ + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + return null; + } + } + /** * @MethodName deleteLogById * @Description: 根据id删除日志 diff --git a/src/main/java/com/emr/controller/otherManage/monitoringCenterController.java b/src/main/java/com/emr/controller/otherManage/monitoringCenterController.java index cb2bf5b..4a7d2c4 100644 --- a/src/main/java/com/emr/controller/otherManage/monitoringCenterController.java +++ b/src/main/java/com/emr/controller/otherManage/monitoringCenterController.java @@ -3,6 +3,7 @@ package com.emr.controller.otherManage; import com.emr.annotation.OptionalLog; import com.emr.dao.CommomMapper; import com.emr.dao.approve.Emr_Apply_ApproveMapper; +import com.emr.dao.commomSearch.ScanPathMapper; import com.emr.dao.emrPrintAndDownLoad.EmrPrintDownloadInfoMapper; import com.emr.dao.recordLock.Emr_LockMapper; import com.emr.entity.approve.Emr_Apply_Approve; @@ -36,6 +37,8 @@ public class monitoringCenterController { private CommomMapper commomMapper; @Autowired private Emr_LockMapper emrLockMapper; + @Autowired + private ScanPathMapper scanPathMapper; /** * 进入监控中心页面 * @return @@ -44,14 +47,23 @@ public class monitoringCenterController { @RequiresPermissions("/monitoringCenter/select") @RequestMapping("monitoringCenterList") public String monitoringCenter(Model model){ + //正在调阅的数量 int applyApproveNum = 0; + //待批病案数 int applyApproveNullNum = 0; EmrPrintOrDownLoadInfoVo vo = new EmrPrintOrDownLoadInfoVo(); vo.setOperType(Short.valueOf("2")); List emrPrintOrDownLoadInfoVos = null; + //数字病案库存数量 int commomNum = 0; + //病案锁定数 int lockNum = 0; + //病案总盘数 + int phCount = 0; + //病案图像总数 + int pdfCount = 0; try { + //下载量 emrPrintOrDownLoadInfoVos = emrPrintDownloadInfoMapper.selectAll(vo); commomNum = commomMapper.selectCommomCount(); lockNum = emrLockMapper.selectCountLocking(); @@ -72,6 +84,15 @@ public class monitoringCenterController { applyApproveNullNum += 1; } } + //查询总盘数 + List phNums = scanPathMapper.selectCountPh(); + for (Integer phNum : phNums) { + if (0 != phNum) { + phCount += 1; + } + } + //查询图像总数 + pdfCount = scanPathMapper.selectCountPdf(); } catch (ParseException e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); @@ -81,6 +102,8 @@ public class monitoringCenterController { model.addAttribute("emrDownloadInfoNum", emrPrintOrDownLoadInfoVos.size()); model.addAttribute("commomNum", commomNum); model.addAttribute("lockNum", lockNum); + model.addAttribute("phCount", phCount); + model.addAttribute("pdfCount", pdfCount); return "otherManage/monitoringCenter"; } } diff --git a/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java b/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java index 2aa907b..c6982c7 100644 --- a/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java +++ b/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java @@ -23,6 +23,7 @@ import com.emr.entity.templateSearch.Emr_Customize; import com.emr.entity.templateSearch.Emr_Modle; import com.emr.entity.templateSearch.Emr_Modle_Check; import com.emr.service.CommomService; +import com.emr.service.approve.ApplyApproveService; import com.emr.service.emrFunGroupDistribution.FunGroupDistributionService; import com.emr.service.emrLock.EmrLockServiceImpl; import com.emr.service.emrPrintOrDownLoadInfo.PrintOrDownLoadInfoService; @@ -30,6 +31,7 @@ import com.emr.service.templateSearch.TemplateSearchService; import com.emr.util.*; import com.emr.vo.Msg; import com.emr.vo.commomSearch.CommomVo; +import com.emr.vo.commomSearch.ScanAssortVo; import com.emr.vo.commomSearch.ScanPathForPatientListVo; import com.emr.vo.commomSearch.ScanPathVo; import com.emr.vo.templateSearch.Emr_Modle_RelatedVo; @@ -96,6 +98,7 @@ public class TemplateSearchController { private PrintOrDownLoadInfoService printOrDownLoadInfoService; @Autowired private EmrPdfWaterSetMapper pdfWaterSetMapper; + /** * @MethodName templateList * @Description: 跳转到自定义模板页面 @@ -108,30 +111,30 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @OptionalLog(module = "查看",methods = "自定义模板页面") + @OptionalLog(module = "查看", methods = "自定义模板页面") @RequiresPermissions("/template/templateList") @RequestMapping("templateList") - public String templateList(Model model,HttpServletRequest request) { + public String templateList(Model model, HttpServletRequest request) { List parents = null; - try{ + try { parents = customizeMapper.selectParents(); - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } - model.addAttribute("parents",parents); + model.addAttribute("parents", parents); String formToken = UUID.randomUUID().toString(); - request.getSession().setAttribute("formToken",formToken); + request.getSession().setAttribute("formToken", formToken); return "recordManage/templateSearch/templateList1"; } @RequestMapping("getParentSelect") @ResponseBody public Msg getParentSelect() { - try{ + try { List parents = customizeMapper.selectParents(); - return Msg.success().add("list",parents); - }catch (Exception e){ + return Msg.success().add("list", parents); + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return Msg.fail("刷新父节点选择出错了,请联系系统管理员!"); @@ -152,7 +155,7 @@ public class TemplateSearchController { */ @RequestMapping("checkName") @ResponseBody - public ResultUtil checkName(Integer parentId, String columnName) throws Exception{ + public ResultUtil checkName(Integer parentId, String columnName) throws Exception { Integer id = customizeMapper.selectListCheckName(parentId, columnName); if (id != null) { return ResultUtil.error(); @@ -175,7 +178,7 @@ public class TemplateSearchController { */ @RequestMapping("checkColumnExist") @ResponseBody - public ResultUtil checkColumnExist(String columnValue, String tableValue,Integer id) throws Exception{ + public ResultUtil checkColumnExist(String columnValue, String tableValue, Integer id) throws Exception { Integer existId = customizeMapper.checkColumnExist(columnValue, tableValue); if (existId == null || id.equals(existId)) { return ResultUtil.ok(); @@ -197,25 +200,25 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequiresPermissions("/template/addTemplate") - @OptionalLog(module = "新增",methods = "自定义模板",fieldName = "columnName") + @OptionalLog(module = "新增", methods = "自定义模板", fieldName = "columnName") @RequestMapping("addTemplate") @ResponseBody - public ResultUtil addTemplate(Emr_Customize customize,HttpServletRequest request) throws Exception{ + public ResultUtil addTemplate(Emr_Customize customize, HttpServletRequest request) throws Exception { boolean flag = FormTokenFlagUtil.isFlag(request); - if(flag){ - if(StringUtils.isBlank(customize.getColumnName())){ + if (flag) { + if (StringUtils.isBlank(customize.getColumnName())) { return ResultUtil.error("字段名/模板名不能为空!"); } - if(customize.getParentId() == null){ + if (customize.getParentId() == null) { customize.setParentId(0); } Integer id = customizeMapper.selectListCheckName(customize.getParentId(), customize.getColumnName()); if (id != null) { return ResultUtil.error("字段名/模板名不能重复!"); } - templateSearchService.addTemplate(customize,request); + templateSearchService.addTemplate(customize, request); return ResultUtil.ok(customize.getId()); - }else{ + } else { return ResultUtil.error("请不要重复提交!"); } } @@ -233,18 +236,18 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequiresPermissions("/template/updateTemplate") - @OptionalLog(module = "修改",methods = "自定义模板",fieldName = "columnName") + @OptionalLog(module = "修改", methods = "自定义模板", fieldName = "columnName") @RequestMapping("updateTemplate") @ResponseBody - public ResultUtil updateTemplate(Emr_Customize customize,HttpServletRequest request) throws Exception{ - if(null == customize.getParentId()){ + public ResultUtil updateTemplate(Emr_Customize customize, HttpServletRequest request) throws Exception { + if (null == customize.getParentId()) { customize.setParentId(0); } Integer id = customizeMapper.selectListCheckName(customize.getParentId(), customize.getColumnName()); - if(null != id && !id.equals(customize.getId())){ + if (null != id && !id.equals(customize.getId())) { return ResultUtil.error("字段名已存在!"); } - templateSearchService.updateTemplate(customize,request); + templateSearchService.updateTemplate(customize, request); return ResultUtil.ok(); } @@ -293,10 +296,10 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequiresPermissions("/template/deleteTemplate") - @OptionalLog(module = "删除",methods = "自定义模板",fieldName = "columnName",tableName = "emr_customize") + @OptionalLog(module = "删除", methods = "自定义模板", fieldName = "columnName", tableName = "emr_customize") @RequestMapping("deleteTemplate") @ResponseBody - public ResultUtil deleteTemplate(Integer id) throws Exception{ + public ResultUtil deleteTemplate(Integer id) throws Exception { templateSearchService.deleteTemplate(id); return ResultUtil.ok(); } @@ -315,40 +318,40 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequiresPermissions("/template/templateSelectList") - @OptionalLog(module = "查看",methods = "自定义模板选择页面") + @OptionalLog(module = "查看", methods = "自定义模板选择页面") @RequestMapping("templateSelectList") - public String templateSelectList(Model model,HttpServletRequest request) { + public String templateSelectList(Model model, HttpServletRequest request) { try { - getSelectFlagTemplate(model,request); - }catch (Exception e){ + getSelectFlagTemplate(model, request); + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } String formToken = UUID.randomUUID().toString(); - request.getSession().setAttribute("formToken",formToken); + request.getSession().setAttribute("formToken", formToken); return "recordManage/templateSearch/templateSelectList"; } /** * 封装传输默认模板对象 */ - private void getSelectFlagTemplate(Model model,HttpServletRequest request) { + private void getSelectFlagTemplate(Model model, HttpServletRequest request) { Emr_Modle emrModle = new Emr_Modle(); - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String userName = user.getUserName(); Integer roleId = user.getRoleId(); //roleId=0为系统管理员,userName为null try { emrModle = emrModleMapper.selectFlagExist(userName); - if(null == emrModle){ + if (null == emrModle) { emrModle = emrModleMapper.selectByPrimaryKey(1); - if(null != roleId && roleId == 0){ + if (null != roleId && roleId == 0) { emrModle.setIsOper(1); - }else{ + } else { emrModle.setIsOper(0); } } - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } @@ -369,16 +372,16 @@ public class TemplateSearchController { */ @RequestMapping("checkModleFlag") @ResponseBody - public ResultUtil checkModleFlag(String modleFlag,HttpServletRequest request) throws Exception{ + public ResultUtil checkModleFlag(String modleFlag, HttpServletRequest request) throws Exception { if ("系统默认模板".equals(modleFlag)) { return ResultUtil.error("该模板标识已存在!"); } - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String creater = user.getUserId().toString(); Emr_Modle modle = emrModleMapper.checkModleFlag(creater, modleFlag); - if(modle == null){ + if (modle == null) { return ResultUtil.ok(); - }else{ + } else { return ResultUtil.error("该模板标识已存在!"); } } @@ -397,16 +400,16 @@ public class TemplateSearchController { */ @RequestMapping("checkModleName") @ResponseBody - public ResultUtil checkModleName(String modleName,HttpServletRequest request) throws Exception{ + public ResultUtil checkModleName(String modleName, HttpServletRequest request) throws Exception { if ("系统默认模板".equals(modleName)) { return ResultUtil.error("该模板名称已存在!"); } - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String creater = user.getUserId().toString(); Emr_Modle modle = emrModleMapper.checkModleName(creater, modleName); - if(modle == null){ + if (modle == null) { return ResultUtil.ok(); - }else{ + } else { return ResultUtil.error("该模板名称已存在!"); } } @@ -424,19 +427,19 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequiresPermissions("/template/addTemplateSelect") - @OptionalLog(module = "新增",methods = "自定义模板分类",fieldName = "modleName") + @OptionalLog(module = "新增", methods = "自定义模板分类", fieldName = "modleName") @RequestMapping("addTemplateSelect") @ResponseBody - public ResultUtil addTemplateSelect(Emr_Modle emrModle,HttpServletRequest request) throws Exception{ - if(StringUtils.isNotBlank(emrModle.getModleName()) && StringUtils.isNotBlank(emrModle.getModleFlag())){ + public ResultUtil addTemplateSelect(Emr_Modle emrModle, HttpServletRequest request) throws Exception { + if (StringUtils.isNotBlank(emrModle.getModleName()) && StringUtils.isNotBlank(emrModle.getModleFlag())) { boolean flag = FormTokenFlagUtil.isFlag(request); - if(flag){ - templateSearchService.addTemplateSelect(emrModle,request); + if (flag) { + templateSearchService.addTemplateSelect(emrModle, request); return ResultUtil.ok(emrModle.getId()); - }else{ + } else { return ResultUtil.error("请不要重复提交!"); } - }else{ + } else { return ResultUtil.error("模板标识或模板名称不能为空!"); } } @@ -456,17 +459,17 @@ public class TemplateSearchController { @RequestMapping(value = "getTemplateSelectTree", produces = {"text/json;charset=UTF-8"}) @ResponseBody public String getTemplateSelectTree(HttpServletRequest request) { - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String userName = user.getUserName(); Integer roleId = user.getRoleId(); try { List modleList = new ArrayList<>(); - if(roleId == 0){ + if (roleId == 0) { modleList = emrModleMapper.selectAllByCreater(null); - }else if(roleId == -100){ + } else if (roleId == -100) { StringBuilder creaters = CommomService.creaters(request); modleList = emrModleMapper.selectAllByCreater(creaters.toString()); - }else{ + } else { userName = "'" + userName + "'"; modleList = emrModleMapper.selectAllByCreater(userName); } @@ -521,30 +524,30 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequiresPermissions("/template/updateTemplateSelect") - @OptionalLog(module = "修改",methods = "自定义模板分类",fieldName = "modleName") + @OptionalLog(module = "修改", methods = "自定义模板分类", fieldName = "modleName") @RequestMapping("updateTemplateSelect") @ResponseBody - public ResultUtil updateTemplateSelect(Emr_Modle modle, Integer selectFlagId,HttpServletRequest request) throws Exception{ - if("系统默认模板".equals(modle.getModleFlag())){ + public ResultUtil updateTemplateSelect(Emr_Modle modle, Integer selectFlagId, HttpServletRequest request) throws Exception { + if ("系统默认模板".equals(modle.getModleFlag())) { return ResultUtil.error("该模板标识已存在!"); } - if("系统默认模板".equals(modle.getModleName())){ + if ("系统默认模板".equals(modle.getModleName())) { return ResultUtil.error("该模板名称已存在!"); } - if(StringUtils.isNotBlank(modle.getModleFlag()) && StringUtils.isNotBlank(modle.getModleName())){ - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + if (StringUtils.isNotBlank(modle.getModleFlag()) && StringUtils.isNotBlank(modle.getModleName())) { + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String creater = user.getUserId().toString(); Emr_Modle emr_modle = emrModleMapper.checkModleFlag(creater, modle.getModleFlag()); - if(null != emr_modle && !emr_modle.getId().equals(modle.getId())){ + if (null != emr_modle && !emr_modle.getId().equals(modle.getId())) { return ResultUtil.error("该模板标志已存在!"); } Emr_Modle emr_modle1 = emrModleMapper.checkModleName(creater, modle.getModleName()); - if(null != emr_modle1 && !emr_modle1.getId().equals(modle.getId())){ + if (null != emr_modle1 && !emr_modle1.getId().equals(modle.getId())) { return ResultUtil.error("该模板名称已存在!"); } - templateSearchService.updateTemplateSelect(modle, selectFlagId,request); - return ResultUtil.ok(); - }else{ + templateSearchService.updateTemplateSelect(modle, selectFlagId, request); + return ResultUtil.ok(); + } else { return ResultUtil.error("模板标志或模板名称不能为空!"); } } @@ -563,22 +566,22 @@ public class TemplateSearchController { */ @RequestMapping("/udpateCheckByModle/{id}") @ResponseBody - public ResultUtil udpateCheckByModle(@PathVariable("id")Integer id,HttpServletRequest request) throws Exception{ + public ResultUtil udpateCheckByModle(@PathVariable("id") Integer id, HttpServletRequest request) throws Exception { //查询默认的,将默认的取消 - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String creater = user.getUserName(); Emr_Modle flagModle = emrModleMapper.selectFlagExist(creater); //将此设为默认 Emr_Modle modle = emrModleMapper.selectByPrimaryKey(id); - if(id == 1 || modle.getCreater().equals(creater)){ - if(flagModle != null){ + if (id == 1 || modle.getCreater().equals(creater)) { + if (flagModle != null) { flagModle.setSelectFlag(0); - templateSearchService.updateTemplateSelect(flagModle,request); + templateSearchService.updateTemplateSelect(flagModle, request); } modle.setSelectFlag(1); - templateSearchService.updateTemplateSelect(modle,request); - return ResultUtil.ok(); - }else{ + templateSearchService.updateTemplateSelect(modle, request); + return ResultUtil.ok(); + } else { return ResultUtil.error("修改失败,该模板为客户创建,不建议修改"); } } @@ -596,10 +599,10 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequiresPermissions("/template/deleteTemplateSelect") - @OptionalLog(module = "删除",methods = "自定义模板分类",fieldName = "modleName",tableName = "emr_modle") + @OptionalLog(module = "删除", methods = "自定义模板分类", fieldName = "modleName", tableName = "emr_modle") @RequestMapping("deleteTemplateSelect") @ResponseBody - public ResultUtil deleteTemplateSelect(Integer id) throws Exception{ + public ResultUtil deleteTemplateSelect(Integer id) throws Exception { templateSearchService.deleteTemplateSelect(id); return ResultUtil.ok(); } @@ -617,28 +620,28 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequestMapping("templateSelectIframe") - public String templateSelectIframe(Integer id, Model model,HttpServletRequest request) { + public String templateSelectIframe(Integer id, Model model, HttpServletRequest request) { try { - if(id != null){ - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + if (id != null) { + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); //回显选中id String creater = user.getUserName(); Emr_Modle flagModle = emrModleMapper.selectFlagExist(creater); - model.addAttribute("flagModle",flagModle); + model.addAttribute("flagModle", flagModle); Emr_Modle emrModle = emrModleMapper.selectByPrimaryKey(id); Integer roleId = user.getRoleId(); - if(roleId != 0 && emrModle.getId() == 1){ + if (roleId != 0 && emrModle.getId() == 1) { emrModle.setIsOper(0); } //如果选中的是id1并且和选中的id不一样则把改id为1的是否选中改0 - if(emrModle.getId() == 1){ - if(null != flagModle && !emrModle.getId().equals(flagModle.getId())){ + if (emrModle.getId() == 1) { + if (null != flagModle && !emrModle.getId().equals(flagModle.getId())) { emrModle.setSelectFlag(0); - }else{ + } else { emrModle.setSelectFlag(1); } } - model.addAttribute("emrModle",emrModle); + model.addAttribute("emrModle", emrModle); List checks = new ArrayList<>(); List customizes = emrCustomizeMapper.selectAll(); List relateds = emrModleRelatedMapper.selectAllByModleId(id); @@ -679,7 +682,7 @@ public class TemplateSearchController { model.addAttribute("checks", checks); model.addAttribute("modleId", id); } - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } @@ -699,50 +702,51 @@ public class TemplateSearchController { * @Version: 1.0 */ @RequiresPermissions("/template/addModleRelated") - @OptionalLog(module = "保存",methods = "自定义模板分配") + @OptionalLog(module = "保存", methods = "自定义模板分配") @RequestMapping("addModleRelated") @ResponseBody - public ResultUtil addModleRelated(Integer modleId, String checks,HttpServletRequest request) throws Exception{ - if(modleId != null && StringUtils.isNotBlank(checks)){ - templateSearchService.addModleRelated(modleId, checks,request); + public ResultUtil addModleRelated(Integer modleId, String checks, HttpServletRequest request) throws Exception { + if (modleId != null && StringUtils.isNotBlank(checks)) { + templateSearchService.addModleRelated(modleId, checks, request); return ResultUtil.ok(); - }else{ + } else { return ResultUtil.error("modleId不能为空!"); } } + /***************************************自定义查询********************************************/ //祈福医院 @RequiresPermissions("/template/customSearchListqf") - @OptionalLog(module = "查看",methods = "自定义查询页面") + @OptionalLog(module = "查看", methods = "自定义查询页面") @RequestMapping("customSearchListqf") public String customSearchListqf(Model model, HttpServletRequest request) { - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); List modles1 = new ArrayList<>(); - try{ + try { List modles = emrModleMapper.selectAllByCreaterOrderSelect(user.getUserName()); //添加id为1的 Emr_Modle sysModle = emrModleMapper.selectByPrimaryKey(1); //判断是否有选中 boolean flagExist = false; - if(null != modles && !modles.isEmpty()){ + if (null != modles && !modles.isEmpty()) { //定义是否有选中 for (Emr_Modle modle : modles) { - if(modle.getSelectFlag() == 1){ + if (modle.getSelectFlag() == 1) { flagExist = true; break; } } } - if(flagExist){ + if (flagExist) { modles1.addAll(modles); modles1.add(sysModle); - }else{ + } else { modles1.add(sysModle); assert modles != null; modles1.addAll(modles); } - model.addAttribute("modles",modles1); - }catch (Exception e){ + model.addAttribute("modles", modles1); + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } @@ -751,22 +755,22 @@ public class TemplateSearchController { //祈福医院 @RequestMapping("customSearchIframeqf") - public String customSearchIframeqf(Integer selectFlagId,Model model) { - if(null != selectFlagId) { + public String customSearchIframeqf(Integer selectFlagId, Model model) { + if (null != selectFlagId) { try { List relateds = emrModleRelatedMapper.selectAllByModleId(selectFlagId); model.addAttribute("relateds", relateds); //列名转属性名 - if(null != relateds && !relateds.isEmpty()){ + if (null != relateds && !relateds.isEmpty()) { StringBuilder fields = new StringBuilder(); for (Emr_Modle_RelatedVo related : relateds) { String columnValue = related.getColumnValue(); String field = BeanFieldToValue.column2modelProperty(columnValue); fields.append(field).append(","); } - model.addAttribute("fields",fields); + model.addAttribute("fields", fields); } - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } @@ -777,12 +781,12 @@ public class TemplateSearchController { //加载申请借阅类型 @RequestMapping("getLoadApplyType") @ResponseBody - public String getLoadApplyType(){ + public String getLoadApplyType() { try { //加载借阅的申请类型 List applyTypes = dictionaryMapper.selectDictionaryByTypeCode("apply_type"); return JSON.toJSONString(applyTypes); - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return null; @@ -793,20 +797,20 @@ public class TemplateSearchController { //加载通过审批且未过期的patientId集合 @RequestMapping("getApproves") @ResponseBody - public String getApproves(HttpServletRequest request,int type){ + public String getApproves(HttpServletRequest request, int type) { try { //查询通过审批且未过期的patientId集合 - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); String userName = user.getUserName(); - List approveList = applyApproveMapper.selectPatientIdsByUser(userName,null,type); + List approveList = applyApproveMapper.selectPatientIdsByUser(userName, null, type); StringBuilder approves = new StringBuilder(); - if(null != approveList && !approveList.isEmpty()){ + if (null != approveList && !approveList.isEmpty()) { for (Emr_Apply_Approve emr_apply_approve : approveList) { approves.append(emr_apply_approve.getPatientId()).append(","); } } return JSON.toJSONString(approves); - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return null; @@ -816,18 +820,18 @@ public class TemplateSearchController { //查询已锁定的集合 @RequestMapping("getLocks") @ResponseBody - public String getLocks(){ + public String getLocks() { try { //查询已锁定的集合 List emr_locks = lockMapper.selectLockListByStatus(1); StringBuilder locks = new StringBuilder(); - if(null != emr_locks && !emr_locks.isEmpty()) { + if (null != emr_locks && !emr_locks.isEmpty()) { for (Emr_Lock emr_lock : emr_locks) { locks.append("'").append(emr_lock.getPatientId()).append("',"); } } return JSON.toJSONString(locks); - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return null; @@ -837,7 +841,7 @@ public class TemplateSearchController { /** * @MethodName: cutomSearchTable * @Description: 根据模板搜索条件动态查询数据 - * @Param sql:查询语句 + * @Param sql:查询语句 * @Return * @Author: 曾文和 * @CreateDate: 2019-05-23 @@ -846,61 +850,61 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value="cutomSearchTable",produces = {"text/json;charset=UTF-8"},method = RequestMethod.POST) + @RequestMapping(value = "cutomSearchTable", produces = {"text/json;charset=UTF-8"}, method = RequestMethod.POST) @ResponseBody - public String cutomSearchTable(String sql, Integer page, Integer limit, HttpServletRequest request) { - if(StringUtils.isNoneBlank(sql)) { - if(null != page && null != limit){ + public String cutomSearchTable(String sql, Integer page, Integer limit, HttpServletRequest request) { + if (StringUtils.isNoneBlank(sql)) { + if (null != page && null != limit) { PageHelper.startPage(page, limit); } - try{ + try { List commomVos = commomMapper.selectAll(sql); //匹配权限 Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); Set menus = user.getMenus(); - if(null != commomVos && !commomVos.isEmpty()){ - if(null != menus && !menus.isEmpty()){ + if (null != commomVos && !commomVos.isEmpty()) { + if (null != menus && !menus.isEmpty()) { int lockOper = 0; int unlockOper = 0; int borrowingOper = 0; int downloadOper = 0; int editOper = 0; int delOper = 0; - for(String menu : menus){ - if(StringUtils.isNotBlank(menu)){ - if("/commom/addLockByPatientId".equals(menu)){ + for (String menu : menus) { + if (StringUtils.isNotBlank(menu)) { + if ("/commom/addLockByPatientId".equals(menu)) { lockOper = 1; } - if("/commom/updateLockByPatientId".equals(menu)){ + if ("/commom/updateLockByPatientId".equals(menu)) { unlockOper = 1; } - if("/commom/addApplyApprove".equals(menu)){ + if ("/commom/addApplyApprove".equals(menu)) { borrowingOper = 1; } - if("/commom/downloadPdf".equals(menu)){ + if ("/commom/downloadPdf".equals(menu)) { downloadOper = 1; } - if("/commom/updateRecord".equals(menu)){ + if ("/commom/updateRecord".equals(menu)) { editOper = 1; } - if("/commom/deleteRecord".equals(menu)){ + if ("/commom/deleteRecord".equals(menu)) { delOper = 1; } } } List distributions = new ArrayList<>(); //查询是否有免申请查看病案权限 - if(user.getRoleId() != 0){ + if (user.getRoleId() != 0) { distributions = funGroupDistributionService.selectUserIdsByTypeFlag("approve", user.getUserId()); } - for (CommomVo commom : commomVos){ + for (CommomVo commom : commomVos) { commom.setLockOper(lockOper); commom.setUnlockOper(unlockOper); commom.setBorrowingOper(borrowingOper); commom.setDownloadOper(downloadOper); commom.setEditOper(editOper); commom.setDelOper(delOper); - if(null != distributions && !distributions.isEmpty() || user.getRoleId() == 0){ + if (null != distributions && !distributions.isEmpty() || user.getRoleId() == 0) { commom.setIsShowDetail(1); } } @@ -909,12 +913,66 @@ public class TemplateSearchController { assert commomVos != null; PageInfo pageInfo = new PageInfo<>(commomVos); return JSON.toJSONString(pageInfo); - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return null; } - }else{ + } else { + return null; + } + } + + /** + * 南方医院无登录查询 + * @param sql + * @param page + * @param limit + * @param request + * @return + */ + @RequestMapping(value = "cutomSearchTableSouth", produces = {"text/json;charset=UTF-8"}, method = RequestMethod.POST) + @ResponseBody + public String cutomSearchTableSouth(String sql, Integer page, Integer limit, HttpServletRequest request) { + if (StringUtils.isNoneBlank(sql)) { + if (null != page && null != limit) { + PageHelper.startPage(page, limit); + } + try { + List commomVos = commomMapper.selectAll(sql); + //匹配权限 + String userName = (String) request.getSession().getAttribute("cuserName"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + if (null != commomVos && !commomVos.isEmpty()) { + for (CommomVo vo:commomVos) { + Emr_Apply_Approve approve = applyApproveMapper.selectByApplyerAndPatientId(userName, vo.getPatientId()); + if (null != approve) { + Date date = sdf.parse(approve.getEffeTime()); + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + calendar.add(calendar.DATE, 1); + date = calendar.getTime(); + if ("1".equals(approve.getApproveState()) && new Date().compareTo(date) < 0){ + vo.setBorrowingOper(1); + } else if (approve.getApprover() == null && approve.getApproveState() == null) { + vo.setBorrowingOper(2); + } else { + vo.setBorrowingOper(0); + } + } else { + vo.setBorrowingOper(0); + } + } + } + assert commomVos != null; + PageInfo pageInfo = new PageInfo<>(commomVos); + return JSON.toJSONString(pageInfo); + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + return null; + } + } else { return null; } } @@ -922,7 +980,7 @@ public class TemplateSearchController { /** * @MethodName: exportExcel * @Description: 根据模板搜索条件导出excel - * @Param String sql:查询语句,String fields:需要导出的字段 + * @Param String sql:查询语句,String fields:需要导出的字段 * @Return * @Author: 曾文和 * @CreateDate: 2019-05-28 @@ -931,15 +989,15 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value={"/commom/exportExcel"}) - @OptionalLog(module = "导出excel",methods = "病案查询页面") - @RequestMapping(value="exportExcel",produces = {"text/json;charset=UTF-8"}) + @RequiresPermissions(value = {"/commom/exportExcel"}) + @OptionalLog(module = "导出excel", methods = "病案查询页面") + @RequestMapping(value = "exportExcel", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public void exportExcel(HttpServletResponse response, String sql, String fieldCns,String tableThNames){ + public void exportExcel(HttpServletResponse response, String sql, String fieldCns, String tableThNames) { if (StringUtils.isNoneBlank(sql)) { try { //中文转换和%转义 - sql = sql.replaceAll("%25","%"); + sql = sql.replaceAll("%25", "%"); //构造excel的数据 List list = commomMapper.selectAll(sql); //文件名 @@ -947,8 +1005,8 @@ public class TemplateSearchController { //ExportExcelUtil ExportExcelUtil exportExcelUtil = new ExportExcelUtil(); //导出excel的操作 - exportExcelUtil.expordExcel(tableThNames,fieldCns,list,fileName,response); - }catch (Exception e){ + exportExcelUtil.expordExcel(tableThNames, fieldCns, list, fileName, response); + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } @@ -956,10 +1014,11 @@ public class TemplateSearchController { } //脐血库、祈福 + /** * @MethodName: downloadBloodZip * @Description: 根据patientId集合批量下载图片并打包 - * @Param String patientIds:patientIds集合 + * @Param String patientIds:patientIds集合 * @Return * @Author: 曾文和 * @CreateDate: 2019-05-29 @@ -968,23 +1027,23 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value={"/commom/downloadZip"}) - @OptionalLog(module = "下载图片转换pdf压缩包",methods = "病案查询页面") - @RequestMapping(value="downloadBloodZip",produces = {"text/json;charset=UTF-8"},method = RequestMethod.POST) + @RequiresPermissions(value = {"/commom/downloadZip"}) + @OptionalLog(module = "下载图片转换pdf压缩包", methods = "病案查询页面") + @RequestMapping(value = "downloadBloodZip", produces = {"text/json;charset=UTF-8"}, method = RequestMethod.POST) @ResponseBody - public void downloadBloodZip(HttpServletResponse response, String patientIds,String flag){ + public void downloadBloodZip(HttpServletResponse response, String patientIds, String flag) { if (StringUtils.isNoneBlank(patientIds)) { try { - List scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientIds,null,flag); - if(null != scanPathVos && !scanPathVos.isEmpty()){ + List scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientIds, null, flag); + if (null != scanPathVos && !scanPathVos.isEmpty()) { Set list = new LinkedHashSet<>(); Set patientIdSet = new LinkedHashSet<>(); //批量添加下载记录 - printOrDownLoadInfoService.SimpleInsert(scanPathVos,null,Short.valueOf("2")); + printOrDownLoadInfoService.SimpleInsert(scanPathVos, null, Short.valueOf("2")); for (ScanPathVo scanPathVo : scanPathVos) { patientIdSet.add(scanPathVo.getPatientId()); } - for(String patinetId : patientIdSet){ + for (String patinetId : patientIdSet) { ScanPathForPatientListVo vo = new ScanPathForPatientListVo(); List filePaths = new ArrayList<>(); for (ScanPathVo scanPathVo : scanPathVos) { @@ -998,15 +1057,15 @@ public class TemplateSearchController { } } } - if(!filePaths.isEmpty()){ + if (!filePaths.isEmpty()) { vo.setScanPathList(filePaths); list.add(vo); } } String zipName = "档案pdf压缩包"; - downloadPdfZip(response,zipName,list); + downloadPdfZip(response, zipName, list); } - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } @@ -1015,7 +1074,7 @@ public class TemplateSearchController { //封装下载pdf压缩包方法 - private void downloadPdfZip(HttpServletResponse response,String zipName,Set list){ + private void downloadPdfZip(HttpServletResponse response, String zipName, Set list) { response.reset(); response.setContentType("application/vnd.ms-excel;charset=UTF-8"); ZipOutputStream zos = null; @@ -1024,28 +1083,28 @@ public class TemplateSearchController { BufferedInputStream bis = null; try { zipName = java.net.URLEncoder.encode(zipName, "UTF-8"); - response.setHeader("Content-Disposition", "attachment;filename=" + zipName + "("+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) +").zip"); + response.setHeader("Content-Disposition", "attachment;filename=" + zipName + "(" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + ").zip"); zos = new ZipOutputStream(response.getOutputStream()); bos = new BufferedOutputStream(zos); EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); - for (ScanPathForPatientListVo vo : list) { + for (ScanPathForPatientListVo vo : list) { String disDate = ""; - if(null != vo.getDisDate()){ + if (null != vo.getDisDate()) { disDate = fmt.format(vo.getDisDate()); } List scanPathList = vo.getScanPathList(); //每个文件名 - String fileName = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_"+fmt.format(new Date()); - zos.putNextEntry(new ZipEntry(fileName+".pdf")); + String fileName = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date()); + zos.putNextEntry(new ZipEntry(fileName + ".pdf")); //合成pdf - img2PdfUtil.imageToPdfToBuffOut(out,scanPathList,emrPdfWaterSet); + img2PdfUtil.imageToPdfToBuffOut(out, scanPathList, emrPdfWaterSet); byte[] file = out.toByteArray(); //这个zip文件的字节 bis = new BufferedInputStream(new ByteArrayInputStream(file)); //输出 int len = 0; byte[] buf = new byte[10 * 1024]; - while( (len=bis.read(buf, 0, buf.length)) != -1){ + while ((len = bis.read(buf, 0, buf.length)) != -1) { bos.write(buf, 0, len); } } @@ -1054,16 +1113,16 @@ public class TemplateSearchController { e.printStackTrace(); } finally { try { - if(null != bos){ + if (null != bos) { bos.flush(); bos.close(); } - if(null != bis){ + if (null != bis) { bis.close(); } out.flush(); out.close(); - if(null != zos) { + if (null != zos) { zos.flush(); zos.close(); } @@ -1076,7 +1135,7 @@ public class TemplateSearchController { /** * @MethodName: getPatientIdsBySql * @Description: 根据patientId集合下载PDF - * @Param String patientIds:patientIds集合 + * @Param String patientIds:patientIds集合 * @Return * @Author: 曾文和 * @CreateDate: 2019-05-29 @@ -1085,9 +1144,9 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value="getPatientIdsBySql") + @RequestMapping(value = "getPatientIdsBySql") @ResponseBody - public String getPatientIdsBySql(String sql){ + public String getPatientIdsBySql(String sql) { if (StringUtils.isNoneBlank(sql)) { try { StringBuilder json = new StringBuilder(); @@ -1095,18 +1154,18 @@ public class TemplateSearchController { List list = commomMapper.selectAll(sql); long end = System.currentTimeMillis(); //System.out.println("查询patiendId集合时间"+(end - start)/1000.0+"s"); - if(null != list && !list.isEmpty()) { + if (null != list && !list.isEmpty()) { for (CommomVo commomVo : list) { json.append("'").append(commomVo.getPatientId()).append("',"); } } return JSON.toJSONString(json); - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); return null; } - }else{ + } else { return null; } } @@ -1114,7 +1173,7 @@ public class TemplateSearchController { /** * @MethodName: downloadPdf * @Description: 根据patientId集合下载PDF - * @Param String patientIds:patientIds集合 + * @Param String patientIds:patientIds集合 * @Return * @Author: 曾文和 * @CreateDate: 2019-05-29 @@ -1123,16 +1182,16 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value={"/commom/downloadPdf"}) - @OptionalLog(module = "下载PDF",methods = "病案查询页面") - @RequestMapping(value="downloadPdf",produces = {"text/json;charset=UTF-8"}) + @RequiresPermissions(value = {"/commom/downloadPdf"}) + @OptionalLog(module = "下载PDF", methods = "病案查询页面") + @RequestMapping(value = "downloadPdf", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public void downloadPdf(HttpServletResponse response,String patientIds){ + public void downloadPdf(HttpServletResponse response, String patientIds) { if (StringUtils.isNoneBlank(patientIds)) { try { - List scanPathVos = scanPathMapper.selectScanFileByPatientIds(patientIds,null); + List scanPathVos = scanPathMapper.selectScanFileByPatientIds(patientIds, null); List filePaths = new ArrayList<>(); - if(null != scanPathVos && !scanPathVos.isEmpty()){ + if (null != scanPathVos && !scanPathVos.isEmpty()) { for (ScanPathVo scanPathVo : scanPathVos) { String fileRealPath = scanPathVo.getFileRealPath(); if (StringUtils.isNoneBlank(fileRealPath)) { @@ -1140,54 +1199,56 @@ public class TemplateSearchController { } } String pdfName = "数字病案PDF"; - Jpg2PdfUtil.imageToPdf(response,filePaths,pdfName); + Jpg2PdfUtil.imageToPdf(response, filePaths, pdfName); } - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } } } + //脐血库、祈福 - @RequestMapping(value="getScanCountByPatientId") + @RequestMapping(value = "getScanCountByPatientId") @ResponseBody - public String getScanCountByPatientId(String patientId,String flag){ + public String getScanCountByPatientId(String patientId, String flag) { if (StringUtils.isNoneBlank(patientId)) { try { - List scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientId,null,flag); - if(null != scanPathVos && !scanPathVos.isEmpty()){ + List scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientId, null, flag); + if (null != scanPathVos && !scanPathVos.isEmpty()) { return "1"; - }else{ + } else { return "0"; } - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } } return "0"; } + //脐血库、祈福 - @RequiresPermissions(value={"/commom/downloadPdf"}) - @RequestMapping(value="downloadPdfBlood",produces = {"text/json;charset=UTF-8"}) + @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) { if (StringUtils.isNoneBlank(patientIds)) { try { - if(StringUtils.isNotBlank(assortIds)){ + if (StringUtils.isNotBlank(assortIds)) { String[] assortIdStr = assortIds.split(","); StringBuilder assortIdsBuilder = new StringBuilder(); for (int i = 0; i < assortIdStr.length; i++) { - if(i != assortIdStr.length - 1){ + if (i != assortIdStr.length - 1) { assortIdsBuilder.append("'").append(assortIdStr[i]).append("',"); - }else{ + } else { assortIdsBuilder.append("'").append(assortIdStr[i]).append("'"); } } assortIds = assortIdsBuilder.toString(); } - List scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientIds,assortIds,flag); - if(null != scanPathVos && !scanPathVos.isEmpty()){ + List scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientIds, assortIds, flag); + if (null != scanPathVos && !scanPathVos.isEmpty()) { EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); //文件路径集合 List filePaths = new ArrayList<>(); @@ -1198,31 +1259,84 @@ public class TemplateSearchController { } } //批量添加下载记录 - printOrDownLoadInfoService.SimpleInsert(scanPathVos,typeId,Short.valueOf("2")); + printOrDownLoadInfoService.SimpleInsert(scanPathVos, typeId, Short.valueOf("2")); SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); ScanPathVo vo = scanPathVos.get(0); String disDate = ""; - if(null != vo.getDisDate()){ + 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 = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date()); //emrPdfWaterSet设置启用下载的状态 emrPdfWaterSet.setEffective(emrPdfWaterSet.getDownloadEffective()); emrPdfWaterSet.setIsImg(emrPdfWaterSet.getDownloadIsImg()); - img2PdfUtil.imageToPdf(response,filePaths,pdfName,emrPdfWaterSet); + img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet); } - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } } } + /** + * 移动图片路径 + * + * @param response + * @param oldPatientId + * @param newPatientId + * @param assortIds + * @param newAssortId + * @param flag + * @return + */ + @RequiresPermissions(value = {"/commom/movePdf"}) + @RequestMapping(value = "movePdfBlood", method = RequestMethod.POST) + @ResponseBody + public ResultUtil movePdfBlood(HttpServletResponse response, String oldPatientId, String newPatientId, String assortIds, String newAssortId, String flag) { + if (StringUtils.isNoneBlank(oldPatientId) && StringUtils.isNoneBlank(newPatientId)) { + if (StringUtils.isNotBlank(assortIds)) { + String[] assortIdStr = assortIds.split(","); + StringBuilder assortIdsBuilder = new StringBuilder(); + for (int i = 0; i < assortIdStr.length; i++) { + if (i != assortIdStr.length - 1) { + assortIdsBuilder.append("'").append(assortIdStr[i]).append("',"); + } else { + assortIdsBuilder.append("'").append(assortIdStr[i]).append("'"); + } + } + assortIds = assortIdsBuilder.toString(); + } + oldPatientId = "'" + oldPatientId + "'"; + List oldScanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(oldPatientId, assortIds, flag); + CommomVo commomVo = commomMapper.selectByPrimaryKey(newPatientId); + if (null == commomVo) { + return ResultUtil.error("目标病案不存在!"); + } + if (null != oldScanPathVos && !oldScanPathVos.isEmpty()) { + for (ScanPathVo scanPathVo : oldScanPathVos) { + String newFile = commomVo.getFilePath() + "\\" + scanPathVo.getScanPage(); + String oldFile = scanPathVo.getFileRealPath(); + try { + templateSearchService.movePdf(oldFile, newFile); + } catch (IOException e) { + e.printStackTrace(); + } + String sql = "UPDATE dbo.t_scan_assort SET patient_id = '"+ newPatientId +"', assort_id = '" + newAssortId + + "' WHERE patient_id = " + oldPatientId + " AND scan_page = '" + scanPathVo.getScanPage() + "'"; + scanPathMapper.updateScanFileByPatientIdAndScanPage(sql); + } + } + return ResultUtil.ok(); + } + return ResultUtil.error("程序出现错误,请联系管理员进行处理!"); + } + /** * @MethodName: printInfoBlood * @Description: 根据patientId集合批量下载图片并打包 - * @Param String patientIds:patientIds集合 + * @Param String patientIds:patientIds集合 * @Return * @Author: 曾文和 * @CreateDate: 2019-05-29 @@ -1231,28 +1345,28 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @OptionalLog(module = "打印病案",methods = "病案预览页面") - @RequestMapping(value="printInfoBlood",produces = {"text/json;charset=UTF-8"},method = RequestMethod.POST) + @OptionalLog(module = "打印病案", methods = "病案预览页面") + @RequestMapping(value = "printInfoBlood", produces = {"text/json;charset=UTF-8"}, method = RequestMethod.POST) @ResponseBody - public void printInfoBlood(String patientIds,String assortIds,Integer typeId,String flag){ + public void printInfoBlood(String patientIds, String assortIds, Integer typeId, String flag) { if (StringUtils.isNoneBlank(patientIds)) { try { - if(StringUtils.isNotBlank(assortIds)){ + if (StringUtils.isNotBlank(assortIds)) { String[] assortIdStr = assortIds.split(","); StringBuilder assortIdsBuilder = new StringBuilder(); for (int i = 0; i < assortIdStr.length; i++) { - if(i != assortIdStr.length - 1){ + if (i != assortIdStr.length - 1) { assortIdsBuilder.append("'").append(assortIdStr[i]).append("',"); - }else{ + } else { assortIdsBuilder.append("'").append(assortIdStr[i]).append("'"); } } assortIds = assortIdsBuilder.toString(); - List scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientIds,assortIds,flag); + List scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientIds, assortIds, flag); //批量添加打印记录 - printOrDownLoadInfoService.SimpleInsert(scanPathVos,typeId,Short.valueOf("1")); + printOrDownLoadInfoService.SimpleInsert(scanPathVos, typeId, Short.valueOf("1")); } - }catch (Exception e){ + } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } @@ -1262,7 +1376,7 @@ public class TemplateSearchController { /** * @MethodName: addLockByPatientId * @Description: 添加锁定 - * @Param String patientId:patientId + * @Param String patientId:patientId * @Return * @Author: 曾文和 * @CreateDate: 2019-05-29 @@ -1271,16 +1385,16 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value={"/commom/addLockByPatientId"}) - @OptionalLog(module = "新增",methods = "病案查询页面病案锁定") + @RequiresPermissions(value = {"/commom/addLockByPatientId"}) + @OptionalLog(module = "新增", methods = "病案查询页面病案锁定") @RequestMapping("addLockByPatientId") @ResponseBody - public ResultUtil addLockByPatientId(String patientIds,HttpServletRequest request) throws Exception{ + public ResultUtil addLockByPatientId(String patientIds, HttpServletRequest request) throws Exception { List commomtables = commomMapper.selectAllByPatients(patientIds); - if(null != commomtables && !commomtables.isEmpty()){ - lockService.insert(commomtables,request); + if (null != commomtables && !commomtables.isEmpty()) { + lockService.insert(commomtables, request); return ResultUtil.ok(); - }else{ + } else { return null; } } @@ -1288,7 +1402,7 @@ public class TemplateSearchController { /** * @MethodName: updateLockByPatientId * @Description: 解除锁定 - * @Param String patientId:patientId + * @Param String patientId:patientId * @Return * @Author: 曾文和 * @CreateDate: 2019-05-29 @@ -1297,18 +1411,18 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value={"/commom/updateLockByPatientId"}) - @OptionalLog(module = "修改",methods = "病案查询页面病案锁定") + @RequiresPermissions(value = {"/commom/updateLockByPatientId"}) + @OptionalLog(module = "修改", methods = "病案查询页面病案锁定") @RequestMapping("updateLockByPatientId") @ResponseBody - public ResultUtil updateLockByPatientId(String patientId,HttpServletRequest request) throws Exception{ - if(StringUtils.isNoneBlank(patientId)){ - Emr_Lock lock = lockMapper.selectLockByPatientId(patientId,1); - if(null != lock){ - lockService.udpate(lock,request); + public ResultUtil updateLockByPatientId(String patientId, HttpServletRequest request) throws Exception { + if (StringUtils.isNoneBlank(patientId)) { + Emr_Lock lock = lockMapper.selectLockByPatientId(patientId, 1); + if (null != lock) { + lockService.udpate(lock, request); } return ResultUtil.ok(); - }else{ + } else { return null; } } @@ -1316,7 +1430,7 @@ public class TemplateSearchController { /** * @MethodName: updateLockByPatientIds * @Description: 批量解除锁定 - * @Param String patientIds:patientIds + * @Param String patientIds:patientIds * @Return * @Author: 曾文和 * @CreateDate: 2019-05-29 @@ -1325,15 +1439,15 @@ public class TemplateSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value={"/commom/updateLockByPatientId"}) - @OptionalLog(module = "批量修改",methods = "病案查询页面病案锁定") + @RequiresPermissions(value = {"/commom/updateLockByPatientId"}) + @OptionalLog(module = "批量修改", methods = "病案查询页面病案锁定") @RequestMapping("updateLockByPatientIds") @ResponseBody - public ResultUtil updateLockByPatientIds(String patientIds,HttpServletRequest request) throws Exception{ - if(StringUtils.isNoneBlank(patientIds)){ - lockService.udpateUnlockByPatients(patientIds,request); + public ResultUtil updateLockByPatientIds(String patientIds, HttpServletRequest request) throws Exception { + if (StringUtils.isNoneBlank(patientIds)) { + lockService.udpateUnlockByPatients(patientIds, request); return ResultUtil.ok(); - }else{ + } else { return null; } } diff --git a/src/main/java/com/emr/dao/approve/Emr_Apply_ApproveMapper.java b/src/main/java/com/emr/dao/approve/Emr_Apply_ApproveMapper.java index 8dae50a..698bf65 100644 --- a/src/main/java/com/emr/dao/approve/Emr_Apply_ApproveMapper.java +++ b/src/main/java/com/emr/dao/approve/Emr_Apply_ApproveMapper.java @@ -72,4 +72,12 @@ public interface Emr_Apply_ApproveMapper { * @return */ List selectCountByApproveStateIsNull(); + + /** + * 查询接口借阅申请 + * @param userName + * @param patientId + * @return + */ + Emr_Apply_Approve selectByApplyerAndPatientId(@Param("userName")String userName,@Param("patientId")String patientId); } \ No newline at end of file diff --git a/src/main/java/com/emr/dao/commomSearch/ScanPathMapper.java b/src/main/java/com/emr/dao/commomSearch/ScanPathMapper.java index 0df9e17..5e42b32 100644 --- a/src/main/java/com/emr/dao/commomSearch/ScanPathMapper.java +++ b/src/main/java/com/emr/dao/commomSearch/ScanPathMapper.java @@ -8,9 +8,27 @@ import java.util.List; public interface ScanPathMapper { /** * 根据patientId集合和分类id集合查询图片地址集合 - * */ - List selectScanFileByPatientIds(@Param("patientIds")String patientIds,@Param("assortIds")String assortIds); + */ + List selectScanFileByPatientIds(@Param("patientIds") String patientIds, @Param("assortIds") String assortIds); - List selectScanFileByBloodPatientIds(@Param("patientIds")String patientIds, - @Param("assortIds")String assortIds,@Param("flag")String flag); + List selectScanFileByBloodPatientIds(@Param("patientIds") String patientIds, + @Param("assortIds") String assortIds, @Param("flag") String flag); + + /** + * 修改图片路径 + * @param sql + */ + void updateScanFileByPatientIdAndScanPage(@Param("sql") String sql); + + /** + * 查询盘号数量 + * @return + */ + List selectCountPh(); + + /** + * 查询图像总数 + * @return + */ + Integer selectCountPdf(); } \ No newline at end of file diff --git a/src/main/java/com/emr/dao/emrLog/Emr_LogMapper.java b/src/main/java/com/emr/dao/emrLog/Emr_LogMapper.java index 971a557..2b42d34 100644 --- a/src/main/java/com/emr/dao/emrLog/Emr_LogMapper.java +++ b/src/main/java/com/emr/dao/emrLog/Emr_LogMapper.java @@ -29,4 +29,6 @@ public interface Emr_LogMapper { List selectAllByIds(@Param("checks")String checks); void deleteLogByIds(@Param("str")String str); + + List selectAllByFont(@Param("record")Emr_Log record,@Param("startTime") String startTime,@Param("endTime") String endTime); } \ No newline at end of file diff --git a/src/main/java/com/emr/service/CommomService.java b/src/main/java/com/emr/service/CommomService.java index 6f7dade..27c09ee 100644 --- a/src/main/java/com/emr/service/CommomService.java +++ b/src/main/java/com/emr/service/CommomService.java @@ -24,11 +24,14 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.File; +import java.io.*; +import java.net.InetAddress; import java.text.SimpleDateFormat; import java.util.*; +import java.util.List; /** * @ProjectName: @@ -45,13 +48,15 @@ import java.util.*; @Component public class CommomService { //定义打印预览加载进度map - private static Map printLoadingMap = new HashMap<>(); + private static Map printLoadingMap = new HashMap<>(); @Value("${POWER_URLHEAD}") - private String POWER_URLHEAD; + private String POWER_URLHEAD; @Value("${waterPicPath}") private String WATERPICPATH; @Value("${EMR_RECORD_JSP}") private String EMRRECORDJSP; + @Value("${waterTifToJpgPath}") + private String WATERTIFTOJPGPATH; @Autowired private CommomMapper commomMapper; @Autowired @@ -60,69 +65,72 @@ public class CommomService { private T_Scan_AssortService scanAssortService; @Autowired private EmrPdfWaterSetMapper pdfWaterSetMapper; + //获取所属医院用户名集合 - public static StringBuilder creaters(HttpServletRequest request){ - List userList = (List)request.getSession().getAttribute("USER_LIST"); + public static StringBuilder creaters(HttpServletRequest request) { + List userList = (List) request.getSession().getAttribute("USER_LIST"); StringBuilder creaters = new StringBuilder(); for (int i = 0; i < userList.size(); i++) { - if(userList.get(i).getRoleId() != 0){ - creaters.append("'"+userList.get(i).getUserName()+ "',"); + if (userList.get(i).getRoleId() != 0) { + creaters.append("'" + userList.get(i).getUserName() + "',"); } } - if(StringUtils.isNotBlank(creaters)){ - creaters = new StringBuilder(creaters.substring(0,creaters.length()-1)); + if (StringUtils.isNotBlank(creaters)) { + creaters = new StringBuilder(creaters.substring(0, creaters.length() - 1)); } return creaters; } //获取所属医院用户id - public static String userIds(HttpServletRequest request){ - List userList = (List)request.getSession().getAttribute("USER_LIST"); + public static String userIds(HttpServletRequest request) { + List userList = (List) request.getSession().getAttribute("USER_LIST"); StringBuilder userIds = new StringBuilder(); for (User user : userList) { if (user.getRoleId() != 0) { userIds.append("'").append(user.getUserId()).append("',"); } } - if(StringUtils.isNotBlank(userIds)){ - userIds = new StringBuilder(userIds.substring(0,userIds.length()-1)); + if (StringUtils.isNotBlank(userIds)) { + userIds = new StringBuilder(userIds.substring(0, userIds.length() - 1)); } return userIds.toString(); } /** * 获取所属医院下所有用户不包括admin + * * @param userName * @param request * @return */ - public List getUserList(String userName,HttpServletRequest request) throws Exception{ + public List getUserList(String userName, HttpServletRequest request) throws Exception { List userList = new ArrayList<>(); - //查询缓存时候存在 - //调用接口查询 - String resultString = ""; - // 创建uri - String url = POWER_URLHEAD+"/font/getUserList?userName="+userName; - // 执行请求 - CloseableHttpResponse response = HttpClients.createDefault().execute(new HttpGet(url)); - // 判断返回状态是否为200 - if (response.getStatusLine().getStatusCode() == 200) { - resultString = EntityUtils.toString(response.getEntity(), "UTF-8"); - } - if(StringUtils.isNoneBlank(resultString)) { - JSONObject jsonObject = JSON.parseObject(resultString); - String extend = jsonObject.getString("extend"); - JSONObject extendObject = JSONObject.parseObject(extend); - String userList1 = extendObject.getString("userList"); - userList = (List) JSON.parseArray(userList1, User.class); - } - //设置进session - request.getSession().setAttribute("USER_LIST",userList); + //查询缓存时候存在 + //调用接口查询 + String resultString = ""; + // 创建uri + String url = POWER_URLHEAD + "/font/getUserList?userName=" + userName; + // 执行请求 + CloseableHttpResponse response = HttpClients.createDefault().execute(new HttpGet(url)); + // 判断返回状态是否为200 + if (response.getStatusLine().getStatusCode() == 200) { + resultString = EntityUtils.toString(response.getEntity(), "UTF-8"); + } + if (StringUtils.isNoneBlank(resultString)) { + JSONObject jsonObject = JSON.parseObject(resultString); + String extend = jsonObject.getString("extend"); + JSONObject extendObject = JSONObject.parseObject(extend); + String userList1 = extendObject.getString("userList"); + userList = (List) JSON.parseArray(userList1, User.class); + } + //设置进session + request.getSession().setAttribute("USER_LIST", userList); return userList; } /** * 病案预览页面新增图片 + * * @param files * @param patientId * @param assortId @@ -135,7 +143,7 @@ public class CommomService { CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId); ResultUtil resultUtil = selectRootPath(patientId, commomVo.getInpatientNo()); if (resultUtil.getCode().equals(0)) { - String path = resultUtil.getMsg(); + String path = resultUtil.getMsg().replaceAll(" ", ""); //保存至commomtable表 commomVo.setNewPath(path); commomMapper.updateByPrimaryKeySelective(commomVo); @@ -154,18 +162,65 @@ public class CommomService { //脐血库显示pdf - public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response) throws Exception{ + public void showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response) throws Exception { + String pdfName = "档案管理PDF"; + if (StringUtils.isNotBlank(patientId)) { + patientId = patientId.replace("\'", ""); + //查询 + if (StringUtils.isNotBlank(flag)) { + CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId); + //flag = home_addr取home_addr字段,path_file取home_addr字段 + String root1 = ""; + if ("home_addr".equals(flag)) { + root1 = commomVo.getHomeAddr(); + } else if ("file_path".equals(flag)) { + root1 = commomVo.getFilePath(); + } + String root2 = commomVo.getNewPath(); + //组织src + List src = new LinkedList<>(); + String[] scanPageArr = scanPages.split(","); + String[] sourceArr = sources.split(","); + for (int i = 0; i < scanPageArr.length; i++) { + String srcStr = ""; + if (StringUtils.isNotBlank(scanPageArr[i])) { + if ("1".equals(sourceArr[i])) { + srcStr = root1 + "\\" + scanPageArr[i]; + } else { + srcStr = root2 + "\\" + scanPageArr[i]; + } + } + src.add(srcStr); + } + List filePaths = new LinkedList<>(); + for (String srcs : src) { + File file = new File(srcs); + if (file.isFile()) { + filePaths.add(srcs); + } + } + if (!filePaths.isEmpty()) { + //根据图片路径转换pdf + EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); + img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet); + } + } + } + } + + //南方医院显示图像 + public void showRecordContentSouth(String patientId, String userName, String deptName, String scanPages, String sources, String flag, HttpServletResponse response) throws Exception { String pdfName = "档案管理PDF"; if (StringUtils.isNotBlank(patientId)) { patientId = patientId.replace("\'", ""); //查询 - if(StringUtils.isNotBlank(flag)){ + if (StringUtils.isNotBlank(flag)) { CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId); //flag = home_addr取home_addr字段,path_file取home_addr字段 String root1 = ""; - if("home_addr".equals(flag)){ + if ("home_addr".equals(flag)) { root1 = commomVo.getHomeAddr(); - }else if("file_path".equals(flag)){ + } else if ("file_path".equals(flag)) { root1 = commomVo.getFilePath(); } String root2 = commomVo.getNewPath(); @@ -173,13 +228,13 @@ public class CommomService { List src = new LinkedList<>(); String[] scanPageArr = scanPages.split(","); String[] sourceArr = sources.split(","); - for(int i = 0;i < scanPageArr.length;i++){ + for (int i = 0; i < scanPageArr.length; i++) { String srcStr = ""; - if(StringUtils.isNotBlank(scanPageArr[i])){ - if("1".equals(sourceArr[i])){ + if (StringUtils.isNotBlank(scanPageArr[i])) { + if ("1".equals(sourceArr[i])) { srcStr = root1 + "\\" + scanPageArr[i]; - }else{ - srcStr = root2 + "\\" + scanPageArr[i]; + } else { + srcStr = root2 + "\\" + scanPageArr[i]; } } src.add(srcStr); @@ -194,6 +249,12 @@ public class CommomService { if (!filePaths.isEmpty()) { //根据图片路径转换pdf EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); + InetAddress netAddress = InetAddress.getLocalHost(); + String ip = null; + if (null != netAddress) { + ip = netAddress.getHostAddress(); + } + emrPdfWaterSet.setText(userName + " " + ip); img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet); } } @@ -201,17 +262,63 @@ public class CommomService { } //接口显示pdf - public void showRecordContentBloodFont(String patientId, String scanPages, String sources, String flag,String fileOutPath) throws Exception{ + public void showRecordContentBloodFont(String patientId, String scanPages, String sources, String flag, String fileOutPath) throws Exception { + if (StringUtils.isNotBlank(patientId)) { + patientId = patientId.replace("\'", ""); + //查询 + if (StringUtils.isNotBlank(flag)) { + CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId); + //flag = home_addr取home_addr字段,path_file取home_addr字段 + String root1 = ""; + if ("home_addr".equals(flag)) { + root1 = commomVo.getHomeAddr(); + } else if ("file_path".equals(flag)) { + root1 = commomVo.getFilePath(); + } + String root2 = commomVo.getNewPath(); + //组织src + List src = new LinkedList<>(); + String[] scanPageArr = scanPages.split(","); + String[] sourceArr = sources.split(","); + for (int i = 0; i < scanPageArr.length; i++) { + String srcStr = ""; + if (StringUtils.isNotBlank(scanPageArr[i])) { + if ("1".equals(sourceArr[i])) { + srcStr = root1 + "\\" + scanPageArr[i]; + } else { + srcStr = root2 + "\\" + scanPageArr[i]; + } + } + src.add(srcStr); + } + List filePaths = new LinkedList<>(); + for (String srcs : src) { + File file = new File(srcs); + if (file.isFile()) { + filePaths.add(srcs); + } + } + if (!CollectionUtils.isEmpty(filePaths)) { + //根据图片路径转换pdf + EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); + img2PdfUtil.imageToPdfFont(filePaths, emrPdfWaterSet, fileOutPath); + } + } + } + } + + //接口显示pdf + public void showRecordContentSouthFont(String patientId, String userName, String deptName, String scanPages, String sources, String flag, String fileOutPath) throws Exception { if (StringUtils.isNotBlank(patientId)) { patientId = patientId.replace("\'", ""); //查询 - if(StringUtils.isNotBlank(flag)){ + if (StringUtils.isNotBlank(flag)) { CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId); //flag = home_addr取home_addr字段,path_file取home_addr字段 String root1 = ""; - if("home_addr".equals(flag)){ + if ("home_addr".equals(flag)) { root1 = commomVo.getHomeAddr(); - }else if("file_path".equals(flag)){ + } else if ("file_path".equals(flag)) { root1 = commomVo.getFilePath(); } String root2 = commomVo.getNewPath(); @@ -219,13 +326,13 @@ public class CommomService { List src = new LinkedList<>(); String[] scanPageArr = scanPages.split(","); String[] sourceArr = sources.split(","); - for(int i = 0;i < scanPageArr.length;i++){ + for (int i = 0; i < scanPageArr.length; i++) { String srcStr = ""; - if(StringUtils.isNotBlank(scanPageArr[i])){ - if("1".equals(sourceArr[i])){ + if (StringUtils.isNotBlank(scanPageArr[i])) { + if ("1".equals(sourceArr[i])) { srcStr = root1 + "\\" + scanPageArr[i]; - }else{ - srcStr = root2 + "\\" + scanPageArr[i]; + } else { + srcStr = root2 + "\\" + scanPageArr[i]; } } src.add(srcStr); @@ -240,17 +347,23 @@ public class CommomService { if (!CollectionUtils.isEmpty(filePaths)) { //根据图片路径转换pdf EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); - img2PdfUtil.imageToPdfFont(filePaths,emrPdfWaterSet,fileOutPath); + InetAddress netAddress = InetAddress.getLocalHost(); + String ip = null; + if (null != netAddress) { + ip = netAddress.getHostAddress(); + } + emrPdfWaterSet.setText(userName + " " + ip); + img2PdfUtil.imageToPdfFont(filePaths, emrPdfWaterSet, fileOutPath); } } } } //封装批量上传图片,返回上传图片记录 - private List getScanAssortListByUpdatePic(List multipartFiles,String patientId,String assortId,String root) throws Exception{ + private List getScanAssortListByUpdatePic(List multipartFiles, String patientId, String assortId, String root) throws Exception { List scanAssorts = new ArrayList<>(); //遍历分类图片集合 - for(MultipartFile pic : multipartFiles){ + for (MultipartFile pic : multipartFiles) { //定义对象 T_Scan_Assort scanAssort = new T_Scan_Assort(); String picName = pic.getOriginalFilename(); @@ -272,11 +385,11 @@ public class CommomService { } //封装组织新增图片根目录 - private ResultUtil selectRootPath(String patientId,String inpatientId){ + private ResultUtil selectRootPath(String patientId, String inpatientId) { //查询设置的根目录 EmrComomSet emrComomSet = commomSetService.selectByPrimaryKey(1); String newPicRoot = emrComomSet.getNewPicRoot(); - if(StringUtils.isBlank(newPicRoot)){ + if (StringUtils.isBlank(newPicRoot)) { return ResultUtil.error("目录未设置,请先前往参数设置页面设置图片存在根目录!"); } //组织存放目录 @@ -284,6 +397,7 @@ public class CommomService { //格式化年月 SimpleDateFormat fmt1 = new SimpleDateFormat("yyyyMM"); String path = newPicRoot + "\\" + fmt1.format(new Date()) + "\\" + inpatientId + "-" + patientId; + path = path.replaceAll(" ", ""); //该目录不存在,创建目录 if (!new File(path).isDirectory()) { new File(path).mkdirs(); @@ -292,7 +406,7 @@ public class CommomService { } //验证图片是否存在,存在重命名 - private String getPicName(String root,String fullName,MultipartFile pic){ + private String getPicName(String root, String fullName, MultipartFile pic) { SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String src = root + "\\" + fullName; File file = new File(src); @@ -309,15 +423,16 @@ public class CommomService { /** * 脐血库、祈福医院打印预览前加载图片 + * * @param patientId * @param rootPaths * @param names * @param sources * @return */ - public List selectPrintPic(String patientId, String rootPaths, String names, String sources,String mapKey) { + public List selectPrintPic(HttpServletResponse response, String patientId, String rootPaths, String names, String sources, String mapKey) { List outs = new LinkedList<>(); - if(StringUtils.isNotBlank(names)){ + if (StringUtils.isNotBlank(names)) { String[] rootPathList = rootPaths.split(","); String[] nameList = names.split(","); String[] sourceList = sources.split(","); @@ -327,14 +442,14 @@ public class CommomService { Short printEffective = emrPdfWaterSet.getPrintEffective(); //获取是否打印图片水印 Short printIsImg = emrPdfWaterSet.getPrintIsImg(); - for (int i = 0;i < nameList.length;i++) { + for (int i = 0; i < nameList.length; i++) { //定义图片根目录地址 String rootPath = ""; //组织原图片地址 - if("1".equals(sourceList[i])){ + if ("1".equals(sourceList[i])) { //扫描图片地址位于rootPathList第一个 rootPath = rootPathList[0]; - }else{ + } else { rootPath = rootPathList[1]; } //原图片地址 @@ -342,35 +457,175 @@ public class CommomService { //定义输出地址 String outSrc = ""; //获取项目上下文地址 - if((printEffective != null && printEffective == 1) || - (printIsImg != null && printIsImg == 1)){ + if ((printEffective != null && printEffective == 1) || + (printIsImg != null && printIsImg == 1)) { //需要水印 //组织加水印后图片存放目录 - String waterPicRoot = WATERPICPATH + patientId +"\\" + sourceList[i] + "\\"; + String waterPicRoot = WATERPICPATH + patientId + "\\" + sourceList[i] + "\\"; //目录不存在则创建 - if(!new File(waterPicRoot).isDirectory()){ + if (!new File(waterPicRoot).isDirectory()) { new File(waterPicRoot).mkdirs(); } - //组织加水印后图片存放地址 - String waterPicPath = waterPicRoot + nameList[i]; - if(!new File(waterPicPath).exists()) { - img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath); + if (srcPath.substring(srcPath.length() - 3).equals("tif")) { + //需要水印 + //组织加水印后图片存放目录 + String waterJpgRoot = WATERTIFTOJPGPATH + patientId + "\\" + sourceList[i] + "\\"; + //目录不存在则创建 + if (!new File(waterJpgRoot).isDirectory()) { + new File(waterJpgRoot).mkdirs(); + } + //获取到转换后jpg图像存放的位置 + String filePathPrefix = waterJpgRoot + nameList[i]; + String tifToJpgRoot = filePathPrefix.substring(0, filePathPrefix.lastIndexOf("."))+ ".jpg" ; + if (!new File(tifToJpgRoot).exists()) { + //tifToJpg(srcPath, tifToJpgRoot); + //加水印存放的地址 + String waterPicPath = waterPicRoot + nameList[i].substring(0, nameList[i].lastIndexOf("."))+ ".jpg"; + img2PdfUtil.addWatermarkPic1(new File(tifToJpgRoot), emrPdfWaterSet, waterPicPath); + } + outSrc = EMRRECORDJSP + "\\reload\\" + patientId + "\\" + sourceList[i] + "\\" + nameList[i].substring(0, nameList[i].lastIndexOf("."))+ ".jpg"; + } else { + //组织加水印后图片存放地址 + String waterPicPath = waterPicRoot + nameList[i]; + if (!new File(waterPicPath).exists()) { + img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath); + //组织输出地址 + } + outSrc = EMRRECORDJSP + "\\reload\\" + patientId + "\\" + sourceList[i] + "\\" + nameList[i]; + } + } else { + //不需要水印 + //将原图片地址转换成映射地址 + //获取盘符并转换映射地址的头部地址 + String root = selectRootByNotWater(srcPath); + //获取盘符后面的地址 + String str1 = srcPath.substring(0, srcPath.indexOf("\\")); + String picPath = srcPath.substring(str1.length() + 1, srcPath.length()); + outSrc = EMRRECORDJSP + "\\" + root + picPath; + } + outs.add(outSrc); + Integer value = Math.round((i + 1) * 100 / nameList.length); + printLoadingMap.put(mapKey, value); + } + } + return outs; + } + + /*private static String tifToJpg(String tifUrl, String tifToJpgRoot) { + File fileTiff = new File(tifToJpgRoot); + if (fileTiff.exists()) { + return tifToJpgRoot; + } + RenderedOp rd = JAI.create("fileload", tifUrl);//读取iff文件 + OutputStream ops = null; + try { + ops = new FileOutputStream(tifToJpgRoot); + //文件存储输出流 + JPEGEncodeParam param = new JPEGEncodeParam(); + ImageEncoder image = ImageCodec.createImageEncoder("JPEG", ops, param); //指定输出格式 + image.encode(rd ); + //解析输出流进行输出 + ops.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return tifToJpgRoot; + }*/ + + + /** + * 南方太和医院医院打印预览前加载图片 + * + * @param patientId + * @param rootPaths + * @param names + * @param sources + * @return + */ + public List selectPrintPicTh(String patientId, String rootPaths, String names, String sources, String mapKey) { + List outs = new LinkedList<>(); + if (StringUtils.isNotBlank(names)) { + String[] rootPathList = rootPaths.split(","); + String[] nameList = names.split(","); + String[] sourceList = sources.split(","); + //获取水印设置 + EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); + //获取是否打印文本水印 + Short printEffective = emrPdfWaterSet.getPrintEffective(); + //获取是否打印图片水印 + Short printIsImg = emrPdfWaterSet.getPrintIsImg(); + CommomVo commomVo = commomMapper.selectByPrimaryKey(patientId); + //判断是否有两套图像 + int num = 0; + if (null != commomVo.getFilePath2() && !"".equals(commomVo.getFilePath2())) { + num = 1; + } + for (int i = 0; i < nameList.length; i++) { + //定义图片根目录地址 + String rootPath = ""; + //组织原图片地址 + if (num == 1) { + rootPath = commomVo.getFilePath2(); + } else { + if ("1".equals(sourceList[i])) { + //扫描图片地址位于rootPathList第一个 + rootPath = rootPathList[0]; + } else { + rootPath = rootPathList[1]; + } + } + //原图片地址 + String srcPath = rootPath + "\\" + nameList[i]; + //定义输出地址 + String outSrc = ""; + //获取项目上下文地址 + if ((printEffective != null && printEffective == 1) || + (printIsImg != null && printIsImg == 1)) { + if (num == 1) { + //第二套打印图像输出 + //组织加水印后图片存放目录 + String waterPicRoot = WATERPICPATH + patientId + "\\" + 3 + "\\"; + //目录不存在则创建 + if (!new File(waterPicRoot).isDirectory()) { + new File(waterPicRoot).mkdirs(); + } + //组织加水印后图片存放地址 + String waterPicPath = waterPicRoot + nameList[i]; + if (!new File(waterPicPath).exists()) { + img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath); + } + //组织输出地址 + outSrc = EMRRECORDJSP + "\\reload\\" + patientId + "\\" + 3 + "\\" + nameList[i]; + } else { + //组织加水印后图片存放目录 + String waterPicRoot = WATERPICPATH + patientId + "\\" + sourceList[i] + "\\"; + //目录不存在则创建 + if (!new File(waterPicRoot).isDirectory()) { + new File(waterPicRoot).mkdirs(); + } + //组织加水印后图片存放地址 + String waterPicPath = waterPicRoot + nameList[i]; + if (!new File(waterPicPath).exists()) { + img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath); + } + //组织输出地址 + outSrc = EMRRECORDJSP + "\\reload\\" + patientId + "\\" + sourceList[i] + "\\" + nameList[i]; } - //组织输出地址 - outSrc = EMRRECORDJSP + "\\reload\\" + patientId +"\\" + sourceList[i] + "\\" + nameList[i]; - }else{ + } else { //不需要水印 //将原图片地址转换成映射地址 //获取盘符并转换映射地址的头部地址 String root = selectRootByNotWater(srcPath); //获取盘符后面的地址 String str1 = srcPath.substring(0, srcPath.indexOf("\\")); - String picPath = srcPath.substring(str1.length()+1, srcPath.length()); + String picPath = srcPath.substring(str1.length() + 1, srcPath.length()); outSrc = EMRRECORDJSP + "\\" + root + picPath; } outs.add(outSrc); - Integer value = Math.round((i+1)*100/nameList.length); - printLoadingMap.put(mapKey,value); + Integer value = Math.round((i + 1) * 100 / nameList.length); + printLoadingMap.put(mapKey, value); } } return outs; @@ -378,13 +633,14 @@ public class CommomService { /** * 根据地址转换映射头 + * * @param srcPath * @return */ private String selectRootByNotWater(String srcPath) { //获取盘符 String str = srcPath.substring(0, 1).toUpperCase(); - switch (str){ + switch (str) { case "C": return "reloadC\\"; case "D": @@ -403,17 +659,18 @@ public class CommomService { return "reloadJ\\"; case "K": return "reloadK\\"; - default:; + default: + ; } return null; } public Integer getPrintPicLoading(String mapKey) { Integer loadingPerson = printLoadingMap.get(mapKey); - if(loadingPerson == null){ + if (loadingPerson == null) { //为空返回0 return 0; - }else if(loadingPerson == 100){ + } else if (loadingPerson == 100) { //完成后移除内存 printLoadingMap.remove(mapKey); } diff --git a/src/main/java/com/emr/service/emrLog/LogService.java b/src/main/java/com/emr/service/emrLog/LogService.java index 00854e2..c82efe8 100644 --- a/src/main/java/com/emr/service/emrLog/LogService.java +++ b/src/main/java/com/emr/service/emrLog/LogService.java @@ -8,6 +8,8 @@ import java.util.Map; public interface LogService { void insert(Emr_Log log); + void insertInterface(Emr_Log log, String userName); + void autoInsert(Emr_Log log); void deleteLogById(Integer logId); diff --git a/src/main/java/com/emr/service/emrLog/LogServiceImpl.java b/src/main/java/com/emr/service/emrLog/LogServiceImpl.java index 8654d17..3bd55e9 100644 --- a/src/main/java/com/emr/service/emrLog/LogServiceImpl.java +++ b/src/main/java/com/emr/service/emrLog/LogServiceImpl.java @@ -84,6 +84,54 @@ public class LogServiceImpl implements LogService { logMapper.insert(log); } + @Override + public void insertInterface(Emr_Log log, String userName) { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()) + .getRequest(); + // 从session获取用户名 + log.setCreater(userName); + // 获取系统当前时间 + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + log.setCreateDate(fmt.format(new Date())); + // 获取访问真实IP + String ipAddress = request.getHeader("x-forwarded-for"); + if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("Proxy-Client-IP"); + } + if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("WL-Proxy-Client-IP"); + } + if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getRemoteAddr(); + if("127.0.0.1".equals(ipAddress) || "0:0:0:0:0:0:0:1".equals(ipAddress)){ + //根据网卡取本机配置的IP + InetAddress inet=null; + try { + inet = InetAddress.getLocalHost(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + assert inet != null; + ipAddress= inet.getHostAddress(); + } + } + //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 + if(ipAddress!=null && ipAddress.length()>15){ //"***.***.***.***".length() = 15 + if(ipAddress.indexOf(",")>0){ + ipAddress = ipAddress.substring(0,ipAddress.indexOf(",")); + } + } + log.setSysFlag("emr_record"); + //字符串太长,截取 + String remark = log.getRemark(); + if(StringUtils.isNoneBlank(remark) && remark.length() > 100){ + remark = remark.substring(0,100); + log.setRemark(remark); + } + log.setIp(ipAddress); + logMapper.insert(log); + } + @Override public void autoInsert(Emr_Log log) { SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); diff --git a/src/main/java/com/emr/service/templateSearch/TemplateSearchService.java b/src/main/java/com/emr/service/templateSearch/TemplateSearchService.java index 626035c..33b0c13 100644 --- a/src/main/java/com/emr/service/templateSearch/TemplateSearchService.java +++ b/src/main/java/com/emr/service/templateSearch/TemplateSearchService.java @@ -5,6 +5,7 @@ import com.emr.entity.templateSearch.Emr_Modle; import org.springframework.ui.Model; import javax.servlet.http.HttpServletRequest; +import java.io.IOException; /** * @ProjectName: @@ -36,4 +37,6 @@ public interface TemplateSearchService { * 保存模板关联 * */ void addModleRelated(Integer modleId,String checks,HttpServletRequest request); + + void movePdf(String oldFile, String newFile) throws IOException; } diff --git a/src/main/java/com/emr/service/templateSearch/TemplateSearchServiceImpl.java b/src/main/java/com/emr/service/templateSearch/TemplateSearchServiceImpl.java index 8e22021..cbbc4b6 100644 --- a/src/main/java/com/emr/service/templateSearch/TemplateSearchServiceImpl.java +++ b/src/main/java/com/emr/service/templateSearch/TemplateSearchServiceImpl.java @@ -21,6 +21,10 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.Model; import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -164,4 +168,26 @@ public class TemplateSearchServiceImpl implements TemplateSearchService { } } } + + @Override + public void movePdf(String oldFile, String newFile) throws IOException { + //一遍读取一遍写入。 + //无论你是是使用的输出流还是输入流,操作的一定是文件。 + //1.读取数据 //输入字节流 + //1.找到需要复制的图片 + File file = new File(oldFile); // NotFoundException + FileInputStream inputStream = new FileInputStream(file); + File file1 = new File(newFile); + FileOutputStream outputStream = new FileOutputStream(file1); + byte[] b = new byte[1024]; + //int count = 0; + while (inputStream.read(b) != -1) { + //2.写入数据 //输出字节流 + outputStream.write(b); + } + + //关闭流 关闭流的原则: 先开后关 后开的先关。 + outputStream.close(); + inputStream.close(); + } } diff --git a/src/main/java/com/emr/util/Img2BinaryUtil.java b/src/main/java/com/emr/util/Img2BinaryUtil.java new file mode 100644 index 0000000..0f1c6d0 --- /dev/null +++ b/src/main/java/com/emr/util/Img2BinaryUtil.java @@ -0,0 +1,84 @@ +package com.emr.util; + +import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +/** + * @program: emr_record + * @description + * @author: wangsiyi + * @create: 2020-11-21 14:05 + **/ +public class Img2BinaryUtil { + final private static float A4_weight = 595; //标准A4的宽 + final private static float A4_height = 842; //标准A4的高 + + public static void Img2Binary(File srcImgFile, String binaryPicPath){ + if(!new File(binaryPicPath).exists()){ + String src = null; + BufferedImage bi = null; + try { + bi = ImageIO.read(srcImgFile); + // 获取当前图片的高,宽,ARGB + int h = bi.getHeight(); + int w = bi.getWidth(); + int rgb = bi.getRGB(0, 0); + int arr[][] = new int[w][h]; + // 获取图片每一像素点的灰度值 + for (int i = 0; i < w; i++) { + for (int j = 0; j < h; j++) { + // getRGB()返回默认的RGB颜色模型(十进制) + arr[i][j] = getImageRgb(bi.getRGB(i, j));//该点的灰度值 + } + + } + + BufferedImage bufferedImage = new BufferedImage(w, h, BufferedImage.TYPE_BYTE_BINARY);// 构造一个类型为预定义图像类型之一的 BufferedImage,TYPE_BYTE_BINARY(表示一个不透明的以字节打包的 1、2 或 4 位图像。) + int FZ = 130; + for (int i = 0; i < w; i++) { + for (int j = 0; j < h; j++) { + if (getGray(arr, i, j, w, h) > FZ) { + int black = new Color(255, 255, 255).getRGB(); + bufferedImage.setRGB(i, j, black); + } else { + int white = new Color(0, 0, 0).getRGB(); + bufferedImage.setRGB(i, j, white); + } + } + } + ImageIO.write(bufferedImage, "jpg", new File(binaryPicPath)); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + private static int getImageRgb(int i) { + String argb = Integer.toHexString(i);// 将十进制的颜色值转为十六进制 + // argb分别代表透明,红,绿,蓝 分别占16进制2位 + int r = Integer.parseInt(argb.substring(2, 4), 16);//后面参数为使用进制 + int g = Integer.parseInt(argb.substring(4, 6), 16); + int b = Integer.parseInt(argb.substring(6, 8), 16); + int result = (int) ((r + g + b) / 3); + return result; + } + + //自己加周围8个灰度值再除以9,算出其相对灰度值 + public static int getGray(int gray[][], int x, int y, int w, int h) { + int rs = gray[x][y] + + (x == 0 ? 255 : gray[x - 1][y]) + + (x == 0 || y == 0 ? 255 : gray[x - 1][y - 1]) + + (x == 0 || y == h - 1 ? 255 : gray[x - 1][y + 1]) + + (y == 0 ? 255 : gray[x][y - 1]) + + (y == h - 1 ? 255 : gray[x][y + 1]) + + (x == w - 1 ? 255 : gray[x + 1][y]) + + (x == w - 1 || y == 0 ? 255 : gray[x + 1][y - 1]) + + (x == w - 1 || y == h - 1 ? 255 : gray[x + 1][y + 1]); + return rs / 9; + } +} diff --git a/src/main/java/com/emr/util/img2PdfUtil.java b/src/main/java/com/emr/util/img2PdfUtil.java index b964bcb..d221f49 100644 --- a/src/main/java/com/emr/util/img2PdfUtil.java +++ b/src/main/java/com/emr/util/img2PdfUtil.java @@ -11,14 +11,11 @@ import com.lowagie.text.pdf.*; import com.sun.media.jai.codec.ImageCodec; import com.sun.media.jai.codec.ImageEncoder; import com.sun.media.jai.codec.JPEGEncodeParam; -import com.twelvemonkeys.imageio.plugins.tiff.TIFFImageReaderSpi; -import com.twelvemonkeys.imageio.plugins.tiff.TIFFImageWriterSpi; import org.apache.commons.lang3.StringUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.imageio.ImageIO; -import javax.imageio.spi.IIORegistry; import javax.media.jai.JAI; import javax.media.jai.RenderedOp; import javax.servlet.http.HttpServletRequest; @@ -26,6 +23,7 @@ import javax.servlet.http.HttpServletResponse; import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; +import java.util.ArrayList; import java.util.List; /** @@ -41,32 +39,33 @@ import java.util.List; * @Version: 1.0 */ public class img2PdfUtil { - final private static float A4_weight = 595; //标准A4的宽 + final private static float A4_weight = 595; //标准A4的宽 final private static float A4_height = 842; //标准A4的高 - public static void imageToPdf(HttpServletResponse response, List filePaths, String pdfName, EmrPdfWaterSet pdfWaterSet){ - Document document = new Document(PageSize.A4,0,0,0,0); //创建文档容器 + + public static void imageToPdf(HttpServletResponse response, List filePaths, String pdfName, EmrPdfWaterSet pdfWaterSet) { + Document document = new Document(PageSize.A4, 0, 0, 0, 0); //创建文档容器 ByteArrayOutputStream bos = new ByteArrayOutputStream(); //是否启用水印 Short effective = pdfWaterSet.getEffective(); Short isImg = pdfWaterSet.getIsImg(); try { - if(effective == 1 || isImg == 1){ - PdfWriter.getInstance(document,bos); //创建编写器(PDF类型) - }else{ - PdfWriter.getInstance(document,response.getOutputStream()); //创建编写器(PDF类型) + if (effective == 1 || isImg == 1) { + PdfWriter.getInstance(document, bos); //创建编写器(PDF类型) + } else { + PdfWriter.getInstance(document, response.getOutputStream()); //创建编写器(PDF类型) } pdfName = java.net.URLEncoder.encode(pdfName, "UTF-8"); response.reset(); response.setCharacterEncoding("utf-8"); response.setContentType("x-www-form-urlencoded"); // word格式 - response.setHeader("Content-Disposition", "attachment; filename=" + pdfName +".pdf"); + response.setHeader("Content-Disposition", "attachment; filename=" + pdfName + ".pdf"); //图片合成pdf - imgToPdf(document,filePaths); - if(effective == 1 || isImg == 1) { + imgToPdf(document, filePaths); + if (effective == 1 || isImg == 1) { addWaterMark(bos, response, pdfWaterSet.getUpOrUnder(), pdfWaterSet.getTransparent(), pdfWaterSet.getText(), pdfWaterSet.getTextX(), pdfWaterSet.getTextY(), pdfWaterSet.getTextColor(), pdfWaterSet.getTextSize(), pdfWaterSet.getTextRotation(), - pdfWaterSet.getEffective(),pdfWaterSet.getIsImg(),pdfWaterSet.getImgFile(), pdfWaterSet.getImgWidth(), + pdfWaterSet.getEffective(), pdfWaterSet.getIsImg(), pdfWaterSet.getImgFile(), pdfWaterSet.getImgWidth(), pdfWaterSet.getImgHeight(), pdfWaterSet.getImgX(), pdfWaterSet.getImgY()); } } catch (Exception e) { @@ -83,35 +82,74 @@ public class img2PdfUtil { } } - public static void imageToPdfFont(List filePaths,EmrPdfWaterSet pdfWaterSet,String fileOutPath){ - Document document = new Document(PageSize.A4,30,30,30,30); //创建文档容器 + public static void imageToPdf2(HttpServletResponse response, String filePath, String targetPath, EmrPdfWaterSet pdfWaterSet) { + Document document = new Document(PageSize.A4, 30, 30, 30, 30); //创建文档容器 ByteArrayOutputStream bos = new ByteArrayOutputStream(); OutputStream out = null; //是否启用水印 Short effective = pdfWaterSet.getEffective(); Short isImg = pdfWaterSet.getIsImg(); try { - if(effective == 1 || isImg == 1){ - PdfWriter.getInstance(document,bos); //创建编写器(PDF类型) - }else{ + if (effective == 1 || isImg == 1) { + PdfWriter.getInstance(document, bos); //创建编写器(PDF类型) + } else { + out = new FileOutputStream(filePath); + PdfWriter.getInstance(document, out); //创建编写器(PDF类型) + } + //图片合成pdf + List files = new ArrayList<>(); + files.add(filePath); + imgToPdf(document, files); + if (effective == 1 || isImg == 1) { + addWaterMarkFont(bos, pdfWaterSet.getUpOrUnder(), pdfWaterSet.getTransparent(), + pdfWaterSet.getText(), pdfWaterSet.getTextX(), pdfWaterSet.getTextY(), + pdfWaterSet.getTextColor(), pdfWaterSet.getTextSize(), pdfWaterSet.getTextRotation(), + pdfWaterSet.getEffective(), pdfWaterSet.getIsImg(), pdfWaterSet.getImgFile(), pdfWaterSet.getImgWidth(), + pdfWaterSet.getImgHeight(), pdfWaterSet.getImgX(), pdfWaterSet.getImgY(), targetPath); + } + } catch (Exception e) { + ExceptionPrintUtil.printException(e); + e.printStackTrace(); + } finally { + try { + bos.flush(); + bos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + document.close(); + } + } + + public static void imageToPdfFont(List filePaths, EmrPdfWaterSet pdfWaterSet, String fileOutPath) { + Document document = new Document(PageSize.A4, 30, 30, 30, 30); //创建文档容器 + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + OutputStream out = null; + //是否启用水印 + Short effective = pdfWaterSet.getEffective(); + Short isImg = pdfWaterSet.getIsImg(); + try { + if (effective == 1 || isImg == 1) { + PdfWriter.getInstance(document, bos); //创建编写器(PDF类型) + } else { out = new FileOutputStream(fileOutPath); - PdfWriter.getInstance(document,out); //创建编写器(PDF类型) + PdfWriter.getInstance(document, out); //创建编写器(PDF类型) } //图片合成pdf - imgToPdf(document,filePaths); - if(effective == 1 || isImg == 1) { - addWaterMarkFont(bos,pdfWaterSet.getUpOrUnder(), pdfWaterSet.getTransparent(), + imgToPdf(document, filePaths); + if (effective == 1 || isImg == 1) { + addWaterMarkFont(bos, pdfWaterSet.getUpOrUnder(), pdfWaterSet.getTransparent(), pdfWaterSet.getText(), pdfWaterSet.getTextX(), pdfWaterSet.getTextY(), pdfWaterSet.getTextColor(), pdfWaterSet.getTextSize(), pdfWaterSet.getTextRotation(), - pdfWaterSet.getEffective(),pdfWaterSet.getIsImg(),pdfWaterSet.getImgFile(), pdfWaterSet.getImgWidth(), - pdfWaterSet.getImgHeight(), pdfWaterSet.getImgX(), pdfWaterSet.getImgY(),fileOutPath); + pdfWaterSet.getEffective(), pdfWaterSet.getIsImg(), pdfWaterSet.getImgFile(), pdfWaterSet.getImgWidth(), + pdfWaterSet.getImgHeight(), pdfWaterSet.getImgX(), pdfWaterSet.getImgY(), fileOutPath); } } catch (Exception e) { ExceptionPrintUtil.printException(e); e.printStackTrace(); } finally { try { - if(null != out) { + if (null != out) { out.flush(); out.close(); } @@ -125,22 +163,22 @@ public class img2PdfUtil { } //脐血库下载批量 - public static void imageToPdfToBuffOut(ByteArrayOutputStream bos, List filePaths,EmrPdfWaterSet pdfWaterSet) throws Exception{ + public static void imageToPdfToBuffOut(ByteArrayOutputStream bos, List filePaths, EmrPdfWaterSet pdfWaterSet) throws Exception { // 实例化图牿 - Document document = new Document(PageSize.A4,30,30,30,30); //创建文档容器 + Document document = new Document(PageSize.A4, 30, 30, 30, 30); //创建文档容器 //是否启用水印 - PdfWriter.getInstance(document,bos); + PdfWriter.getInstance(document, bos); try { //图片合成pdf - imgToPdf(document,filePaths); + imgToPdf(document, filePaths); //是否启用水印 Short effective = pdfWaterSet.getDownloadEffective(); Short isImg = pdfWaterSet.getDownloadIsImg(); - if(effective == 1 || isImg == 1) { + if (effective == 1 || isImg == 1) { addWaterMark(bos, null, pdfWaterSet.getUpOrUnder(), pdfWaterSet.getTransparent(), pdfWaterSet.getText(), pdfWaterSet.getTextX(), pdfWaterSet.getTextY(), pdfWaterSet.getTextColor(), pdfWaterSet.getTextSize(), pdfWaterSet.getTextRotation(), - effective,isImg,pdfWaterSet.getImgFile(), pdfWaterSet.getImgWidth(), + effective, isImg, pdfWaterSet.getImgFile(), pdfWaterSet.getImgWidth(), pdfWaterSet.getImgHeight(), pdfWaterSet.getImgX(), pdfWaterSet.getImgY()); } } catch (Exception e) { @@ -150,18 +188,13 @@ public class img2PdfUtil { document.close(); } } - public static String addWatermarkPic1(File srcImgFile, EmrPdfWaterSet pdfWaterSet,String outPath) { + + public static String addWatermarkPic1(File srcImgFile, EmrPdfWaterSet pdfWaterSet, String outPath) { java.awt.Image srcImg = null; BufferedImage bufImg = null; Graphics2D g = null; try { - srcImg = ImageIO.read(new FileInputStream(srcImgFile)); - if(null == srcImg){ - IIORegistry registry = IIORegistry.getDefaultInstance(); - registry.registerServiceProvider(new com.twelvemonkeys.imageio.plugins.tiff.TIFFImageWriterSpi()); - registry.registerServiceProvider(new com.twelvemonkeys.imageio.plugins.tiff.TIFFImageReaderSpi()); - srcImg = ImageIO.read(new FileInputStream(srcImgFile)); - } + srcImg = ImageIO.read(srcImgFile);//文件转化为图片 //System.out.println("读取图片"+(end-start)/1000.0+"s"); int srcImgWidth = srcImg.getWidth(null);//获取图片的宽 int srcImgHeight = srcImg.getHeight(null);//获取图片的高 @@ -186,7 +219,7 @@ public class img2PdfUtil { //System.out.println("画文字图片"+(end2-start2)/1000.0+"s"); } //ByteArrayInputStream fis = new ByteArrayInputStream(imageToByteArr);//创建输入流对象 - if(!new File(outPath).exists()) { + if (!new File(outPath).exists()) { ImageIO.write(bufImg, "jpg", new File(outPath)); } /* FileOutputStream fos = new FileOutputStream("d:\\jiashi\\reload\\00004312bfd54291b31d77cc4b8e4c3b\\" + srcImgFile.getName()); //创建输出流对象 @@ -202,24 +235,25 @@ public class img2PdfUtil { } catch (Exception e) { e.printStackTrace(); e.getMessage(); - return outPath; - }finally { - if(null != g){ + return null; + } finally { + if (null != g) { g.dispose();// 释放资源*/ } - if(null != bufImg){ + if (null != bufImg) { bufImg.flush(); } - if(null != srcImg){ + if (null != srcImg) { srcImg.flush(); } } } + //图片合成pdf - private static void imgToPdf(Document document,List filePaths) throws Exception{ + private static void imgToPdf(Document document, List filePaths) throws Exception { document.open(); //打开容器 - float percent=100; - float w,h; + float percent = 100; + float w, h; for (String filePath : filePaths) { File file = new File(filePath); if (file.isFile()) { @@ -232,6 +266,7 @@ public class img2PdfUtil { } else if ((w < A4_weight) && (h > A4_height)) { percent = (A4_height * 100) / h; } else if ((w > A4_weight) && (h > A4_height)) { + percent = (A4_weight * 100) / w; h = (h * percent) / 100; if (h > A4_height) { @@ -249,39 +284,40 @@ public class img2PdfUtil { } document.close(); //关闭容器 } + /** * 添加图片和文字水印 * * @param - * @param response 输出前台 - * @param upOrUnder 加水印后存放地址 - * @param transparent 加水印透明度 - * @param text 加水印的文本内容 - * @param textX 文字横坐标 - * @param textY 文字纵坐标 - * @param textColor 文字颜色 - * @param textSize 文字字号 + * @param response 输出前台 + * @param upOrUnder 加水印后存放地址 + * @param transparent 加水印透明度 + * @param text 加水印的文本内容 + * @param textX 文字横坐标 + * @param textY 文字纵坐标 + * @param textColor 文字颜色 + * @param textSize 文字字号 * @param textRotation 文字旋转角度 - * @param imgFile 加水印图片文件 - * @param imgWidth 图片宽 - * @param imgHeight 图片高 - * @param imgX 图片横坐标 - * @param imgY 图片纵坐标 + * @param imgFile 加水印图片文件 + * @param imgWidth 图片宽 + * @param imgHeight 图片高 + * @param imgX 图片横坐标 + * @param imgY 图片纵坐标 * @throws IOException * @throws DocumentException */ - public static void addWaterMark(ByteArrayOutputStream bos,HttpServletResponse response,int upOrUnder,float transparent, String text, int textX, int textY, - String textColor,int textSize,int textRotation,Short effective,Short isImg, - String imgFile, int imgWidth, int imgHeight,int imgX,int imgY){ + public static void addWaterMark(ByteArrayOutputStream bos, HttpServletResponse response, int upOrUnder, float transparent, String text, int textX, int textY, + String textColor, int textSize, int textRotation, Short effective, Short isImg, + String imgFile, int imgWidth, int imgHeight, int imgX, int imgY) { PdfReader reader = null; PdfStamper stamper = null; try { reader = new PdfReader(bos.toByteArray()); // 加完水印的文件 - if(null != response){ - stamper = new PdfStamper(reader,response.getOutputStream()); - }else{ - stamper = new PdfStamper(reader,bos); + if (null != response) { + stamper = new PdfStamper(reader, response.getOutputStream()); + } else { + stamper = new PdfStamper(reader, bos); } // 设置字体 BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED); @@ -292,10 +328,10 @@ public class img2PdfUtil { PdfGState gs = new PdfGState(); for (int i = 1; i < total; i++) { //upOrUnder = 1为在文本之上 - if(upOrUnder == 1){ + if (upOrUnder == 1) { // 水印在之前文本之上 content = stamper.getOverContent(i); - }else{ + } else { // 水印在文本之下 content = stamper.getUnderContent(i); } @@ -304,7 +340,7 @@ public class img2PdfUtil { content.setGState(gs); // 图片水印 if (null != isImg && isImg == 1) { - HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String tomcatPath = request.getSession().getServletContext().getRealPath("/"); String imgStr = tomcatPath + "static\\pdfWaterSet\\upload\\" + imgFile; com.lowagie.text.Image image = null; @@ -343,22 +379,22 @@ public class img2PdfUtil { ExceptionPrintUtil.printException(e); e.printStackTrace(); } finally { - if(null != stamper){ + if (null != stamper) { try { stamper.close(); } catch (DocumentException | IOException e) { e.printStackTrace(); } } - if(null != reader){ + if (null != reader) { reader.close(); } } } - private static void addWaterMarkFont(ByteArrayOutputStream bos,int upOrUnder,float transparent, String text, int textX, int textY, - String textColor,int textSize,int textRotation,Short effective,Short isImg, - String imgFile, int imgWidth, int imgHeight,int imgX,int imgY,String fileOutPath){ + private static void addWaterMarkFont(ByteArrayOutputStream bos, int upOrUnder, float transparent, String text, int textX, int textY, + String textColor, int textSize, int textRotation, Short effective, Short isImg, + String imgFile, int imgWidth, int imgHeight, int imgX, int imgY, String fileOutPath) { //ByteArrayInputStream fileToUpload = new ByteArrayInputStream(bos.toByteArray()); // 待加水印的文件 //String fileStr = "e:\\11111.pdf"; @@ -370,9 +406,11 @@ public class img2PdfUtil { //输出到本地 out = new FileOutputStream(fileOutPath); // 加完水印的文件 - stamper = new PdfStamper(reader,out); + stamper = new PdfStamper(reader, out); //设置不允许打印 +/* stamper.setEncryption(null, null, ~(PdfWriter.ALLOW_COPY | PdfWriter.ALLOW_PRINTING ), PdfWriter.STANDARD_ENCRYPTION_128); +*/ // 设置字体 BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED); // PDF总页数 @@ -382,10 +420,10 @@ public class img2PdfUtil { PdfGState gs = new PdfGState(); for (int i = 1; i < total; i++) { //upOrUnder = 1为在文本之上 - if(upOrUnder == 1){ + if (upOrUnder == 1) { // 水印在之前文本之上 content = stamper.getOverContent(i); - }else{ + } else { // 水印在文本之下 content = stamper.getUnderContent(i); } @@ -394,7 +432,7 @@ public class img2PdfUtil { content.setGState(gs); // 图片水印 if (null != isImg && isImg == 1) { - HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String tomcatPath = request.getSession().getServletContext().getRealPath("/"); String imgStr = tomcatPath + "static\\pdfWaterSet\\upload\\" + imgFile; com.lowagie.text.Image image = null; @@ -426,14 +464,14 @@ public class img2PdfUtil { ExceptionPrintUtil.printException(e); e.printStackTrace(); } finally { - if(null != stamper){ + if (null != stamper) { try { stamper.close(); } catch (DocumentException | IOException e) { e.printStackTrace(); } } - if(null != out){ + if (null != out) { try { out.flush(); out.close(); @@ -441,7 +479,7 @@ public class img2PdfUtil { e.printStackTrace(); } } - if(null != reader){ + if (null != reader) { reader.close(); } } @@ -449,15 +487,16 @@ public class img2PdfUtil { /** * 字符串转换成Color对象 + * * @param colorStr 16进制颜色字符串 * @return Color对象 - * */ - private static Color toColorFromString(String colorStr){ - int r= Integer.valueOf( colorStr.substring( 1, 3 ), 16 ); - int g= Integer.valueOf( colorStr.substring( 3, 5 ), 16 ); - int b= Integer.valueOf( colorStr.substring( 5, 7 ), 16 ); + */ + private static Color toColorFromString(String colorStr) { + int r = Integer.valueOf(colorStr.substring(1, 3), 16); + int g = Integer.valueOf(colorStr.substring(3, 5), 16); + int b = Integer.valueOf(colorStr.substring(5, 7), 16); //java.awt.Color[r=0,g=0,b=255] - return new Color(r,g,b); + return new Color(r, g, b); } /** @@ -494,4 +533,3 @@ public class img2PdfUtil { return turnJpgFile; } } - diff --git a/src/main/java/com/emr/vo/commomSearch/CommomVo.java b/src/main/java/com/emr/vo/commomSearch/CommomVo.java index f7f28dc..9ee2809 100644 --- a/src/main/java/com/emr/vo/commomSearch/CommomVo.java +++ b/src/main/java/com/emr/vo/commomSearch/CommomVo.java @@ -385,6 +385,16 @@ public class CommomVo { private Integer delCount;//病案图片已删除的个数 + private String filePath2;//第二套图像存放地址 + + public String getFilePath2() { + return filePath2; + } + + public void setFilePath2(String filePath2) { + this.filePath2 = filePath2; + } + public Integer getDelCount() { return delCount; } diff --git a/src/main/java/com/emr/vo/commomSearch/ScanAssortVo.java b/src/main/java/com/emr/vo/commomSearch/ScanAssortVo.java new file mode 100644 index 0000000..6790d47 --- /dev/null +++ b/src/main/java/com/emr/vo/commomSearch/ScanAssortVo.java @@ -0,0 +1,50 @@ +package com.emr.vo.commomSearch; + +/** + * @program: emr_record + * @description + * @author: wangsiyi + * @create: 2020-10-23 10:44 + **/ +public class ScanAssortVo { + private String oldPatientId; + + private String newPatientId; + + private String newAssortId; + + private String scanPage; + + + public String getOldPatientId() { + return oldPatientId; + } + + public void setOldPatientId(String oldPatientId) { + this.oldPatientId = oldPatientId; + } + + public String getNewPatientId() { + return newPatientId; + } + + public void setNewPatientId(String newPatientId) { + this.newPatientId = newPatientId; + } + + public String getNewAssortId() { + return newAssortId; + } + + public void setNewAssortId(String newAssortId) { + this.newAssortId = newAssortId; + } + + public String getScanPage() { + return scanPage; + } + + public void setScanPage(String scanPage) { + this.scanPage = scanPage; + } +} diff --git a/src/main/resources/config/config.properties b/src/main/resources/config/config.properties index c92ea75..69a4564 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 = 192.168.1.3 -POWER_URLHEAD = http://192.168.1.3:8080/power +POWER_IP = localhost +POWER_URLHEAD = http://localhost:8081/power -POWER_JSPHEAD = 192.168.1.3 -POWER_JSP = http://192.168.1.3:8080/power +POWER_JSPHEAD = localhost +POWER_JSP = http://localhost:8081/power #\u672C\u8EAB\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934 -EMR_RECORD_JSP = http://192.168.1.3:8080/emr_record +EMR_RECORD_JSP = http://localhost:8083/emr_record #webSocket\u670D\u52A1\u5668\u5730\u5740 @@ -29,3 +29,5 @@ picPath = static/pdfWaterSet/upload/ #1\u751F\u6210\u52A0\u4E0A\u6C34\u5370\u540E\u7684\u56FE\u7247\u7684\u66F4\u76EE\u5F55 #2\u9884\u89C8\u75C5\u6848\u63A5\u53E3pdf\u4E34\u65F6\u751F\u6210\u76EE\u5F55 waterPicPath = D:/jiashi/reload/ + +waterTifToJpgPath = D:/jiashi/tifToJpgLoad/ diff --git a/src/main/resources/mapper/CommomMapper.xml b/src/main/resources/mapper/CommomMapper.xml index 58116dd..4b695f3 100644 --- a/src/main/resources/mapper/CommomMapper.xml +++ b/src/main/resources/mapper/CommomMapper.xml @@ -1262,12 +1262,8 @@ select patient_id,inpatient_no,name,admiss_id,admiss_times,dis_date,dis_dept from commomtable where inpatient_no like '%${inpatientNo}%' + order by admiss_times desc - - select - - from emr_apply_approve - where id = #{id,jdbcType=INTEGER} - - + + delete from emr_apply_approve where id = #{id,jdbcType=INTEGER} - + insert into emr_apply_approve (applyer, apply_time, effe_time, effe_days, apply_type, apply_reason, apply_state, approver, @@ -49,170 +49,170 @@ #{patientId,jdbcType=VARCHAR}, #{admissId,jdbcType=CHAR}, #{inpatientNo,jdbcType=CHAR}, #{admissTimes,jdbcType=SMALLINT}, #{disDate,jdbcType=TIMESTAMP}) - - insert into emr_apply_approve - - - id, - - - applyer, - - - apply_time, - - - effe_time, - - - effe_days, - - - apply_type, - - - apply_reason, - - - apply_state, - - - approver, - - - approve_time, - - - approve_state, - - - approve_notes, - - - patient_id, - - - admiss_id, - - - inpatient_no, - - - admiss_times, - - - dis_date, - - - - - #{id,jdbcType=INTEGER}, - - - #{applyer,jdbcType=NVARCHAR}, - - - #{applyTime,jdbcType=NCHAR}, - - - #{effeTime,jdbcType=NCHAR}, - - - #{effeDays,jdbcType=INTEGER}, - - - #{applyType,jdbcType=NVARCHAR}, - - - #{applyReason,jdbcType=NVARCHAR}, - - - #{applyState,jdbcType=NVARCHAR}, - - - #{approver,jdbcType=NVARCHAR}, - - - #{approveTime,jdbcType=NCHAR}, - - - #{approveState,jdbcType=NVARCHAR}, - - - #{approveNotes,jdbcType=NVARCHAR}, - - - #{patientId,jdbcType=VARCHAR}, - - - #{admissId,jdbcType=CHAR}, - - - #{inpatientNo,jdbcType=CHAR}, - - - #{admissTimes,jdbcType=SMALLINT}, - - - #{disDate,jdbcType=TIMESTAMP}, - - - - - update emr_apply_approve - - - applyer = #{applyer,jdbcType=NVARCHAR}, - - - apply_time = #{applyTime,jdbcType=NCHAR}, - - - effe_time = #{effeTime,jdbcType=NCHAR}, - - - effe_days = #{effeDays,jdbcType=INTEGER}, - - - apply_type = #{applyType,jdbcType=NVARCHAR}, - - - apply_reason = #{applyReason,jdbcType=NVARCHAR}, - - - apply_state = #{applyState,jdbcType=NVARCHAR}, - - - approver = #{approver,jdbcType=NVARCHAR}, - - - approve_time = #{approveTime,jdbcType=NCHAR}, - - - approve_state = #{approveState,jdbcType=NVARCHAR}, - - - approve_notes = #{approveNotes,jdbcType=NVARCHAR}, - - - patient_id = #{patientId,jdbcType=VARCHAR}, - - - admiss_id = #{admissId,jdbcType=CHAR}, - - - inpatient_no = #{inpatientNo,jdbcType=CHAR}, - - - admiss_times = #{admissTimes,jdbcType=SMALLINT}, - - - dis_date = #{disDate,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=INTEGER} - - + + insert into emr_apply_approve + + + id, + + + applyer, + + + apply_time, + + + effe_time, + + + effe_days, + + + apply_type, + + + apply_reason, + + + apply_state, + + + approver, + + + approve_time, + + + approve_state, + + + approve_notes, + + + patient_id, + + + admiss_id, + + + inpatient_no, + + + admiss_times, + + + dis_date, + + + + + #{id,jdbcType=INTEGER}, + + + #{applyer,jdbcType=NVARCHAR}, + + + #{applyTime,jdbcType=NCHAR}, + + + #{effeTime,jdbcType=NCHAR}, + + + #{effeDays,jdbcType=INTEGER}, + + + #{applyType,jdbcType=NVARCHAR}, + + + #{applyReason,jdbcType=NVARCHAR}, + + + #{applyState,jdbcType=NVARCHAR}, + + + #{approver,jdbcType=NVARCHAR}, + + + #{approveTime,jdbcType=NCHAR}, + + + #{approveState,jdbcType=NVARCHAR}, + + + #{approveNotes,jdbcType=NVARCHAR}, + + + #{patientId,jdbcType=VARCHAR}, + + + #{admissId,jdbcType=CHAR}, + + + #{inpatientNo,jdbcType=CHAR}, + + + #{admissTimes,jdbcType=SMALLINT}, + + + #{disDate,jdbcType=TIMESTAMP}, + + + + + update emr_apply_approve + + + applyer = #{applyer,jdbcType=NVARCHAR}, + + + apply_time = #{applyTime,jdbcType=NCHAR}, + + + effe_time = #{effeTime,jdbcType=NCHAR}, + + + effe_days = #{effeDays,jdbcType=INTEGER}, + + + apply_type = #{applyType,jdbcType=NVARCHAR}, + + + apply_reason = #{applyReason,jdbcType=NVARCHAR}, + + + apply_state = #{applyState,jdbcType=NVARCHAR}, + + + approver = #{approver,jdbcType=NVARCHAR}, + + + approve_time = #{approveTime,jdbcType=NCHAR}, + + + approve_state = #{approveState,jdbcType=NVARCHAR}, + + + approve_notes = #{approveNotes,jdbcType=NVARCHAR}, + + + patient_id = #{patientId,jdbcType=VARCHAR}, + + + admiss_id = #{admissId,jdbcType=CHAR}, + + + inpatient_no = #{inpatientNo,jdbcType=CHAR}, + + + admiss_times = #{admissTimes,jdbcType=SMALLINT}, + + + dis_date = #{disDate,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + update emr_apply_approve set applyer = #{applyer,jdbcType=NVARCHAR}, apply_time = #{applyTime,jdbcType=NCHAR}, @@ -232,77 +232,77 @@ dis_date = #{disDate,jdbcType=TIMESTAMP} where id = #{id,jdbcType=INTEGER} - - - - - - + + + + + + - - + SELECT a.id, a.applyer, a.apply_time, @@ -315,74 +315,79 @@ a.dis_date, a.approve_notes, a.patient_id, - CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN apply_state='1' THEN '未提交' WHEN apply_state='2' THEN '已提交' END apply_state, + CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN apply_state='1' THEN '未提交' WHEN apply_state='2' THEN '已提交' + END apply_state, a.approver, a.approve_time, - CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN approve_state = '1' THEN '审核通过' WHEN approve_state='2' THEN '审核不通过' WHEN approve_state is null THEN '待审批' END approve_state, + CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN approve_state = '1' THEN '审核通过' WHEN approve_state='2' THEN + '审核不通过' WHEN approve_state is null THEN '待审批' END approve_state, c.name, CASE WHEN emr_lock.id is null THEN 0 ELSE 1 END lockStatus - FROM + FROM emr_apply_approve a - LEFT JOIN - commomtable c - ON + LEFT JOIN + commomtable c + ON a.patient_id = c.patient_id - LEFT JOIN + LEFT JOIN (select code,Name from emr_dictionary where parent_id = 'apply_type') emr_dictionary - ON + ON a.apply_type = emr_dictionary.code - LEFT JOIN + LEFT JOIN emr_lock - ON + ON a.patient_id = emr_lock.patient_id - AND emr_lock.lock_state = 1 - - - a.applyer IN (${applyers}) - - - AND a.applyer LIKE '%${record.applyer}%' - - - AND a.approver LIKE '${record.approver}%' - - - AND a.effe_days = ${record.effeDays} - - - AND a.inpatient_no LIKE '%${record.inpatientNo}%' - - - AND a.apply_time >= #{startTime1} - - AND a.apply_time <= #{endTime1} - - - - AND a.approve_time >= #{startTime2} - - AND a.approve_time <= #{endTime2} - - - - AND c.name LIKE '%${record.name}%' - - - AND a.apply_type = ${record.applyType} - - - AND (CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN apply_state='1' THEN '未提交' WHEN apply_state='2' THEN '已提交' END) = #{record.applyState} - - - AND (CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN approve_state = '1' THEN '审核通过' WHEN approve_state='2' THEN '审核不通过' WHEN approve_state is null THEN '待审批' WHEN approve_state = '' THEN '待审批' END) = #{record.approveState} - - - ORDER BY a.apply_time DESC - + AND emr_lock.lock_state = 1 + + + a.applyer IN (${applyers}) + + + AND a.applyer LIKE '%${record.applyer}%' + + + AND a.approver LIKE '${record.approver}%' + + + AND a.effe_days = ${record.effeDays} + + + AND a.inpatient_no LIKE '%${record.inpatientNo}%' + + + AND a.apply_time >= #{startTime1} + + AND a.apply_time <= #{endTime1} + + + + AND a.approve_time >= #{startTime2} + + AND a.approve_time <= #{endTime2} + + + + AND c.name LIKE '%${record.name}%' + + + AND a.apply_type = ${record.applyType} + + + AND (CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN apply_state='1' THEN '未提交' WHEN apply_state='2' + THEN '已提交' END) = #{record.applyState} + + + AND (CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN approve_state = '1' THEN '审核通过' WHEN + approve_state='2' THEN '审核不通过' WHEN approve_state is null THEN '待审批' WHEN approve_state = '' THEN '待审批' + END) = #{record.approveState} + + + ORDER BY a.apply_time DESC + - - + SELECT a.id, a.applyer, a.apply_time, @@ -395,73 +400,77 @@ a.dis_date, a.approve_notes, a.patient_id, - CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN apply_state='1' THEN '未提交' WHEN apply_state='2' THEN '已提交' END apply_state, + CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN apply_state='1' THEN '未提交' WHEN apply_state='2' THEN '已提交' + END apply_state, a.approver, a.approve_time, - CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN approve_state = '1' THEN '审核通过' WHEN approve_state='2' THEN '审核不通过' WHEN approve_state is null THEN '待审批' WHEN approve_state = '' THEN '待审批' END approve_state, + CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN approve_state = '1' THEN '审核通过' WHEN approve_state='2' THEN + '审核不通过' WHEN approve_state is null THEN '待审批' WHEN approve_state = '' THEN '待审批' END approve_state, c.name, CASE WHEN emr_lock.id is null THEN 0 ELSE 1 END lockStatus - FROM + FROM emr_apply_approve a - LEFT JOIN + LEFT JOIN commomtable c - ON + ON a.patient_id = c.patient_id - LEFT JOIN + LEFT JOIN (select code,Name from emr_dictionary where parent_id = 'apply_type') emr_dictionary - ON + ON a.apply_type = emr_dictionary.code - LEFT JOIN + LEFT JOIN emr_lock - ON + ON a.patient_id = emr_lock.patient_id - AND emr_lock.lock_state = 1 - - - a.applyer IN (${userIds}) - - - AND a.applyer LIKE '%${record.applyer}%' - - - AND a.approver IN (${record.approver}) - - - AND a.effe_days = ${record.effeDays} - - - AND a.inpatient_no LIKE '%${record.inpatientNo}%' - - - AND a.apply_time >= #{startTime1} - - AND a.apply_time <= #{endTime1} - - - - AND a.approve_time >= #{startTime2} - - AND a.approve_time <= #{endTime2} - - - - AND c.name LIKE '%${record.name}%' - - - AND a.apply_type = ${record.applyType} - - - AND (CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN apply_state='1' THEN '未提交' WHEN apply_state='2' THEN '已提交' END) = #{record.applyState} - - - AND (CASE WHEN effe_time <= GETDATE() THEN '已过期' WHEN approve_state = '1' THEN '审核通过' WHEN approve_state='2' THEN '审核不通过' WHEN approve_state is null THEN '待审批' WHEN approve_state = '' THEN '待审批' END) = #{record.approveState} - - - ORDER BY a.apply_time DESC - - - - + + - - INSERT INTO emr_apply_approve( - applyer, apply_time, effe_time, effe_days, apply_type, apply_reason, apply_state, - approver, approve_time, approve_state, approve_notes, patient_id, admiss_id, inpatient_no, - admiss_times, dis_date + applyer, apply_time, effe_time, effe_days, apply_type, apply_reason, apply_state, + approver, approve_time, approve_state, approve_notes, patient_id, admiss_id, inpatient_no, + admiss_times, dis_date ) - - select #{item.applyer,jdbcType=NVARCHAR}, #{item.applyTime,jdbcType=NCHAR}, - #{item.effeTime,jdbcType=NCHAR}, #{item.effeDays,jdbcType=INTEGER}, #{item.applyType,jdbcType=NVARCHAR}, - #{item.applyReason,jdbcType=NVARCHAR}, #{item.applyState,jdbcType=NVARCHAR}, #{item.approver,jdbcType=NVARCHAR}, - #{item.approveTime,jdbcType=NCHAR}, #{item.approveState,jdbcType=NVARCHAR}, #{item.approveNotes,jdbcType=NVARCHAR}, - #{item.patientId,jdbcType=VARCHAR}, #{item.admissId,jdbcType=CHAR}, #{item.inpatientNo,jdbcType=CHAR}, - #{item.admissTimes,jdbcType=SMALLINT}, #{item.disDate,jdbcType=TIMESTAMP} - + + select #{item.applyer,jdbcType=NVARCHAR}, #{item.applyTime,jdbcType=NCHAR}, + #{item.effeTime,jdbcType=NCHAR}, #{item.effeDays,jdbcType=INTEGER}, #{item.applyType,jdbcType=NVARCHAR}, + #{item.applyReason,jdbcType=NVARCHAR}, #{item.applyState,jdbcType=NVARCHAR}, + #{item.approver,jdbcType=NVARCHAR}, + #{item.approveTime,jdbcType=NCHAR}, #{item.approveState,jdbcType=NVARCHAR}, + #{item.approveNotes,jdbcType=NVARCHAR}, + #{item.patientId,jdbcType=VARCHAR}, #{item.admissId,jdbcType=CHAR}, #{item.inpatientNo,jdbcType=CHAR}, + #{item.admissTimes,jdbcType=SMALLINT}, #{item.disDate,jdbcType=TIMESTAMP} + + \ No newline at end of file diff --git a/src/main/resources/mapper/commomSearch/ScanPathMapper.xml b/src/main/resources/mapper/commomSearch/ScanPathMapper.xml index 67a6f21..258c4f8 100644 --- a/src/main/resources/mapper/commomSearch/ScanPathMapper.xml +++ b/src/main/resources/mapper/commomSearch/ScanPathMapper.xml @@ -1,70 +1,82 @@ - - - - - - - - - - - + SELECT dbo.t_scan_assort.assort_id, dbo.t_scan_assort.scan_page, (dbo.t_gdh_index.file_path+'\'+dbo.t_scan_assort.scan_page) fileRealPath - FROM + FROM dbo.t_gdh_index - LEFT OUTER JOIN + LEFT OUTER JOIN dbo.t_scan_assort - ON + ON dbo.t_gdh_index.patient_id = dbo.t_scan_assort.patient_id - - dbo.t_scan_assort.patient_id in (${patientIds}) - - AND dbo.t_scan_assort.assort_id in (${assortIds}) - - - ORDER BY + + dbo.t_scan_assort.patient_id in (${patientIds}) + + AND dbo.t_scan_assort.assort_id in (${assortIds}) + + + ORDER BY dbo.t_scan_assort.assort_id - + - - + SELECT commomtable.patient_id, commomtable.name, commomtable.inpatient_no, commomtable.dis_date, dbo.t_scan_assort.assort_id, dbo.t_scan_assort.scan_page, - case - when t_scan_assort.source = 1 - then convert(nvarchar(255),dbo.commomtable.${flag})+'\'+dbo.t_scan_assort.scan_page - when t_scan_assort.source = 2 - then convert(nvarchar(255),dbo.commomtable.new_path)+'\'+dbo.t_scan_assort.scan_page - end fileRealPath - FROM + case + when t_scan_assort.source = 1 + then convert(nvarchar(255),dbo.commomtable.${flag})+'\'+dbo.t_scan_assort.scan_page + when t_scan_assort.source = 2 + then convert(nvarchar(255),dbo.commomtable.new_path)+'\'+dbo.t_scan_assort.scan_page + end fileRealPath + FROM dbo.commomtable - LEFT OUTER JOIN + LEFT OUTER JOIN dbo.t_scan_assort - ON + ON dbo.commomtable.patient_id = dbo.t_scan_assort.patient_id - LEFT OUTER JOIN + LEFT OUTER JOIN dbo.zd_assort - ON + ON dbo.zd_assort.assort_id = dbo.t_scan_assort.assort_id - - dbo.commomtable.patient_id in (${patientIds}) - AND t_scan_assort.is_del != 1 - - AND dbo.t_scan_assort.scan_page in (${assortIds}) - - - ORDER BY + + dbo.commomtable.patient_id in (${patientIds}) + AND t_scan_assort.is_del != 1 + + AND dbo.t_scan_assort.scan_page in (${assortIds}) + + + ORDER BY dbo.zd_assort.assort_sort - + + + + ${sql} + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/emrLog/Emr_LogMapper.xml b/src/main/resources/mapper/emrLog/Emr_LogMapper.xml index 0518324..282ab0f 100644 --- a/src/main/resources/mapper/emrLog/Emr_LogMapper.xml +++ b/src/main/resources/mapper/emrLog/Emr_LogMapper.xml @@ -162,6 +162,28 @@ ORDER BY create_date DESC,log_id DESC + diff --git a/src/main/webapp/WEB-INF/views/approveManage/approveList/approveList174.jsp b/src/main/webapp/WEB-INF/views/approveManage/approveList/approveList174.jsp index f539ecc..7cb3f7c 100644 --- a/src/main/webapp/WEB-INF/views/approveManage/approveList/approveList174.jsp +++ b/src/main/webapp/WEB-INF/views/approveManage/approveList/approveList174.jsp @@ -526,13 +526,11 @@ @@ -543,3 +541,4 @@ --%> + diff --git a/src/main/webapp/WEB-INF/views/approveManage/collection/collectManage174.jsp b/src/main/webapp/WEB-INF/views/approveManage/collection/collectManage174.jsp index f433e0d..2ca3c8f 100644 --- a/src/main/webapp/WEB-INF/views/approveManage/collection/collectManage174.jsp +++ b/src/main/webapp/WEB-INF/views/approveManage/collection/collectManage174.jsp @@ -521,7 +521,7 @@ - + diff --git a/src/main/webapp/WEB-INF/views/font/commomListSouth.jsp b/src/main/webapp/WEB-INF/views/font/commomListSouth.jsp new file mode 100644 index 0000000..58f4b0c --- /dev/null +++ b/src/main/webapp/WEB-INF/views/font/commomListSouth.jsp @@ -0,0 +1,720 @@ +<%@ 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/common.jspf" %> + + + + 常用查询 + + + + + + + + + + + + +
+
+
+ + 常用查询 + +
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + + + + + + + +
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
-
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+ 至 +
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+ 至 +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+ 至 +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+ 至 +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+ 至 +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ + + + + + +
+ + + + + + + diff --git a/src/main/webapp/WEB-INF/views/font/recordList.jsp b/src/main/webapp/WEB-INF/views/font/recordList.jsp index 56d9db5..16a42e6 100644 --- a/src/main/webapp/WEB-INF/views/font/recordList.jsp +++ b/src/main/webapp/WEB-INF/views/font/recordList.jsp @@ -47,6 +47,7 @@ +
diff --git a/src/main/webapp/WEB-INF/views/font/recordListSouth.jsp b/src/main/webapp/WEB-INF/views/font/recordListSouth.jsp new file mode 100644 index 0000000..c15d82a --- /dev/null +++ b/src/main/webapp/WEB-INF/views/font/recordListSouth.jsp @@ -0,0 +1,139 @@ +<%@ 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/common.jspf" %> + + + + + + + +
+
+
+ + 预览列表 + +
+
+
+ +
+ +
+
+
+
+ + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/font/showPdfFrameFont.jsp b/src/main/webapp/WEB-INF/views/font/showPdfFrameFont.jsp index f9ab4fc..37730fa 100644 --- a/src/main/webapp/WEB-INF/views/font/showPdfFrameFont.jsp +++ b/src/main/webapp/WEB-INF/views/font/showPdfFrameFont.jsp @@ -22,7 +22,7 @@ onselect=document.selection.empty()>

- + <%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + + + 预览PDF + + + + + + + + + + + + + + + + + + +
+
+
+ + 病案浏览 + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+ +
已打印
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+ + + + diff --git a/src/main/webapp/WEB-INF/views/font/showRecordIframeFont.jsp b/src/main/webapp/WEB-INF/views/font/showRecordIframeFont.jsp index 4254627..ad3e702 100644 --- a/src/main/webapp/WEB-INF/views/font/showRecordIframeFont.jsp +++ b/src/main/webapp/WEB-INF/views/font/showRecordIframeFont.jsp @@ -52,7 +52,7 @@ } .loading { width: 160px; - height: 56px; + height:100%; position: absolute; top: 50%; left: 50%; diff --git a/src/main/webapp/WEB-INF/views/font/showRecordIframeFontSouth.jsp b/src/main/webapp/WEB-INF/views/font/showRecordIframeFontSouth.jsp new file mode 100644 index 0000000..ddf2296 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/font/showRecordIframeFontSouth.jsp @@ -0,0 +1,115 @@ + <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + <%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + + + 预览pdfIframe页面 + + + + + <%--<%@ include file="/WEB-INF/jspf/common.jspf" %>--%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
+
+
+ +
+ + + + diff --git a/src/main/webapp/WEB-INF/views/otherManage/interfaceDatabase.jsp b/src/main/webapp/WEB-INF/views/otherManage/interfaceDatabase.jsp new file mode 100644 index 0000000..cd15e5a --- /dev/null +++ b/src/main/webapp/WEB-INF/views/otherManage/interfaceDatabase.jsp @@ -0,0 +1,163 @@ +<%@ 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/common.jspf" %> + + + + + 其他管理 + + + + + + + + +
+
+
+ + 接口日志管理 + +
+
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ + + + + + +
+ +
+ + +
+
+
+ <%--
+

通知管理

+
+
--%> + + + + + + diff --git a/src/main/webapp/WEB-INF/views/otherManage/monitoringCenter.jsp b/src/main/webapp/WEB-INF/views/otherManage/monitoringCenter.jsp index 6be04e4..8a1f48c 100644 --- a/src/main/webapp/WEB-INF/views/otherManage/monitoringCenter.jsp +++ b/src/main/webapp/WEB-INF/views/otherManage/monitoringCenter.jsp @@ -27,39 +27,48 @@ margin-right: -15px; margin-bottom: -15px; } + .mainDiv { background-color: #fff; } + .timeShow { height: 50px; } + .colorBack1 { width: 29%; height: 13%; float: left; border-radius: 60px; } + .colorBack2 { width: 30%; height: 12%; float: left; border-radius: 60px; } + .textBack1 { margin-top: 17%; } + .textBack2 { margin-top: 15%; } + .textNum { font-size: 18px; } + .welcomeInfo { float: left; margin-right: 5%; color: #2aabd2; font-size: 22px; } + .companyInfo { margin-top: 8px; color: #2aabd2; @@ -120,15 +129,17 @@
-
-
-
- ${emrDownloadInfoNum} -
- +
@@ -154,6 +165,32 @@
+
+
+
+
+
+
+ ${phCount} +
+
+ 病案总盘数 +
+
+
+
+
+
+
+ ${pdfCount} +
+
+ 病案图像总数 +
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/commomListqf.jsp b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/commomListqf.jsp index dc4dcca..06fb8b0 100644 --- a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/commomListqf.jsp +++ b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/commomListqf.jsp @@ -80,9 +80,11 @@ font-family: "Segoe UI", Helvetica, Arial, sans-serif; border: 1px solid #ddd; } + .TableView { margin-left: 2%; } + .form-group { width: 110%; } @@ -330,13 +332,17 @@
- +
- 至 +
+ 至 +
- +
@@ -346,13 +352,17 @@
- +
- 至 +
+ 至 +
- +
@@ -399,9 +409,30 @@
+ +
+
+ +
+
+
+ 至 +
+
+
+ +
+
+
+ +
+
+
+
-
+
-
-
-
+
-
+
- +
-
- +
+
-
-
-
-
-
- +
+
+ 至 +
-
- +
+
@@ -482,6 +508,39 @@
+
+
+
+ +
+
+ +
+
+
+ 至 +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
@@ -493,17 +552,52 @@
- <%--
+
- +
- +
-
--%> +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
@@ -593,7 +687,8 @@
- +
@@ -603,7 +698,7 @@
+ name="effeDays" oninput="if(value.length>3)value=value.slice(0,3)" readonly>
@@ -631,7 +726,8 @@
- --%> + <%-- + + --%>
- + +
+
+ + - - -
- +
@@ -271,11 +308,12 @@
- -
+ +
-
@@ -813,7 +854,8 @@
- +
@@ -823,7 +865,8 @@ -