diff --git a/src/main/java/com/emr/controller/commomSearch/CommomSearchController.java b/src/main/java/com/emr/controller/commomSearch/CommomSearchController.java index ada5ff0..c6679aa 100644 --- a/src/main/java/com/emr/controller/commomSearch/CommomSearchController.java +++ b/src/main/java/com/emr/controller/commomSearch/CommomSearchController.java @@ -181,23 +181,6 @@ public class CommomSearchController { } } - //阿拉伯数字转中文 - private static String toChinese(String str) { - String[] s1 = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"}; - String[] s2 = {"十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千"}; - String result = ""; - int n = str.length(); - for (int i = 0; i < n; i++) { - int num = str.charAt(i) - '0'; - if (i != n - 1 && num != 0) { - result += s1[num] + s2[n - 2 - i]; - } else { - result += s1[num]; - } - } - return result; - } - //加载科室 @RequestMapping("getDept") @ResponseBody @@ -224,10 +207,8 @@ public class CommomSearchController { return JSON.toJSONString(commomVo); } - /** * 加载公共表信息 - * * @return */ @RequestMapping("getCommonInfo") @@ -267,7 +248,6 @@ public class CommomSearchController { return null; } } - /*******************************************病案预览操作*********************************************************/ //加载转归情况 @RequestMapping("getDiagStatus174") @@ -281,8 +261,20 @@ public class CommomSearchController { return null; } } - - /** + /*** + * 根据用户权限查询分段 + * @param request + * @return + */ + @RequestMapping("selectIsPowerByUser") + @ResponseBody + public String selectIsPowerByUser(HttpServletRequest request) { + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); + List zdAssorts = assortService.selectAllByPower(user); + return JSON.toJSONString(zdAssorts); + } + /******************************病案预览操作****************************/ + /**英德、湛江 * @MethodName: showRecord * @Description: 跳转到病案预览 * @Param String patientId:patientId @@ -310,6 +302,7 @@ public class CommomSearchController { } /** + * 脐血库 * @MethodName: showRecordBlood * @Description: 跳转到档案预览 * @Param String patientId:patientId @@ -340,7 +333,7 @@ public class CommomSearchController { return "recordManage/commomSearch/showRecordBlood"; } - /** + /**174医院、祈福 * @MethodName: showRecord174 * @Description: 跳转到档案预览 * @Param String patientId:patientId @@ -429,6 +422,7 @@ public class CommomSearchController { } /** + * 湛江、英德查看pdfIframe页 * @MethodName: showRecordIframe * @Description: 病案预览Iframe, 按住院次数显示页面 * @Param String patientId:patientId @@ -460,7 +454,14 @@ public class CommomSearchController { return "recordManage/commomSearch/showRecordIframe"; } - //脐血库 + /** + * 脐血库、祈福 + * 跳转查看pdfiframe页 + * @param patientId + * @param model + * @param request + * @return + */ @RequestMapping("showRecordIframeBlood") public String showRecordIframeBlood(String patientId,Model model, HttpServletRequest request) { model.addAttribute("patientId", patientId); @@ -489,38 +490,7 @@ public class CommomSearchController { return "recordManage/commomSearch/showRecordIframeBlood"; } - //查询分段集合 - @RequestMapping("selectIsPowerByUser") - @ResponseBody - public String selectIsPowerByUser(HttpServletRequest request) { - Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); - List zdAssorts = assortService.selectAllByPower(user); - return JSON.toJSONString(zdAssorts); - } - - @RequiresPermissions("/commom/updateCommomInfo") - @OptionalLog(module = "保存",methods = "病案信息修改") - @RequestMapping("updateCommomInfo") - @ResponseBody - public ResultUtil updateCommomInfo(CommomVo commomVo) throws Exception{ - if (null != commomVo.getInpatientNo()){ - int vo = commomMapper.selectCountByPatients(commomVo.getPatientId()); - if (vo > 0){ - int i = commomMapper.updateByPrimaryKeySelective(commomVo); - if (i > 0){ - return ResultUtil.ok(); - } else { - return ResultUtil.error("修改失败!"); - } - } else { - return ResultUtil.error("修改失败,该病案主键不存在!"); - } - } else { - return ResultUtil.error("修改失败,主键不能为空!"); - } - } - - /** + /**查看其它诊断 * @MethodName: getOtherDiagNameByAdmissTimesAndInpatientNo * @Description: 根据admissTimes和inpatientNo查询包含其他诊断名称的基本信息 * @Param Integer admissTimes:住院次数,String inpatientNo:病案号 @@ -573,9 +543,9 @@ public class CommomSearchController { } return null; } - //脐血库 /** + * 英德湛江分类树 * @MethodName: getRecordTypeTree * @Description: 根据patientId组织病案分类集合树 * @Param String patientId:patientId @@ -663,135 +633,12 @@ public class CommomSearchController { } /** - * @MethodName: getRecordTree - * @Description: 根据patientId组织病案集合树 - * @Param String patientId:patientId - * @Return - * @Author: 曾文和 - * @CreateDate: 2019-06-04 - * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-04 - * @UpdateRemark: 更新说明 - * @Version: 1.0 + * 脐血、祈福分类树 + * @param patientId + * @param typeId + * @param request + * @return */ - @RequestMapping(value = "getRecordTree", produces = {"text/json;charset=UTF-8"}) - @ResponseBody - public String getRecordTree(String patientId, Integer typeId, HttpServletRequest request) { - long start = System.currentTimeMillis(); - List treeList = new ArrayList<>(); - //查询该有的权限分类 - try { - Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); - List commomVos = new ArrayList<>(); - //先查归档表 - if (user.getRoleId() == 0 || user.getRoleId() == -100) { - commomVos = commomMapper.selectScanCountByMedicalPatientId(patientId, null, null); - } else { - commomVos = commomMapper.selectScanCountByMedicalPatientId(patientId, user.getRoleId(), user.getUserId()); - } - //归档不表不存在,查病案数据表 - //从归档查type为1 - int type = 1; - if (null == commomVos || commomVos.isEmpty()) { - if (user.getRoleId() == 0 || user.getRoleId() == -100) { - commomVos = commomMapper.selectScanPathByPatientId(patientId, null, null); - } else { - commomVos = commomMapper.selectScanPathByPatientId(patientId, user.getRoleId(), user.getUserId()); - } - type = 2; - } - long end = System.currentTimeMillis(); - System.out.println((end - start) / 1000 + "s"); - //按打印分类id查询归属分类集合 - List typeRelateds = new ArrayList<>(); - if (typeId != null) { - typeRelateds = typeRelatedService.selectAssortIdsByTypeId(typeId); - } - - //第一级:全部影像资料 - CommomTree tree1 = new CommomTree(); - Integer id = 1; - tree1.setId(id); - tree1.setAssortName("全部影像资料"); - if (null != commomVos && !commomVos.isEmpty()) { - //去重,取出不重复的分类集合 - Map assortMap = new LinkedHashMap<>(); - for (int i = 0; i < commomVos.size(); i++) { - assortMap.put(commomVos.get(i).getAssortId(), commomVos.get(i)); - } - //判断分类是否全选,全选,父类跟着全选 - if (null != typeRelateds && !typeRelateds.isEmpty()) { - Boolean checkedFlag = true; - for (Map.Entry map : assortMap.entrySet()) { - //定义是否存在 - Boolean flag = false; - for (int i = 0; i < typeRelateds.size(); i++) { - if (typeRelateds.get(i).getAssortId().equals(map.getKey())) { - flag = true; - break; - } - } - if (!flag) { - checkedFlag = false; - break; - } - } - if (checkedFlag) { - tree1.setChecked("true"); - } - } - treeList.add(tree1); - int oneId = 0; - for (Map.Entry map : assortMap.entrySet()) { - id++; - oneId = id; - String assortId = map.getValue().getAssortId(); - CommomTree tree2 = new CommomTree(); - tree2.setId(id); - tree2.setParentId(1); - tree2.setAssortId(map.getValue().getAssortId()); - //判断选中 - Boolean checkFlag = false; - if (null != typeRelateds && !typeRelateds.isEmpty()) { - for (int j = 0; j < typeRelateds.size(); j++) { - if (StringUtils.isNotBlank(assortId) && assortId.equals(typeRelateds.get(j).getAssortId())) { - tree2.setChecked("true"); - checkFlag = true; - break; - } - } - } - //定义该类影像图片数量 - int scanPathCount = 0; - //第二层 图片 - for (int i = 0; i < commomVos.size(); i++) { - if (StringUtils.isNotBlank(assortId) && StringUtils.isNotBlank(commomVos.get(i).getAssortId()) && - assortId.equals(commomVos.get(i).getAssortId())) { - id++; - CommomTree tree3 = new CommomTree(); - tree3.setId(id); - tree3.setParentId(oneId); - tree3.setAssortId(assortId); - if (checkFlag) { - tree3.setChecked("true"); - } - tree3.setAssortName(commomVos.get(i).getScanPage()); - treeList.add(tree3); - scanPathCount++; - } - } - tree2.setAssortName(map.getValue().getAssortName() + "(" + scanPathCount + ")"); - treeList.add(tree2); - } - } - return JSON.toJSONString(treeList); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - //脐血库 @RequestMapping(value = "getBloodRecordTree", produces = {"text/json;charset=UTF-8"}) @ResponseBody public String getBloodRecordTree(String patientId, Integer typeId, HttpServletRequest request) { @@ -807,7 +654,6 @@ public class CommomSearchController { commomVos = commomMapper.selectScanPathByPatientId(patientId, user.getRoleId(), user.getUserId()); } } - //按打印分类id查询归属分类集合 List typeRelateds = new ArrayList<>(); if (typeId != null) { @@ -892,6 +738,7 @@ public class CommomSearchController { //设置树图片节点的名称 tree3.setNewName("(第"+scanPathCount+"页)"+name); tree3.setSource(commomVos.get(i).getSource()); + //存储水印图片 treeList.add(tree3); } @@ -907,6 +754,29 @@ public class CommomSearchController { } } + /** + * 祈福打印预览前加载图片 + * @param patientId + * @param rootPaths + * @param names + * @param sources + * @return + * @throws Exception + */ + @RequestMapping(value="selectPrintPic",method = RequestMethod.POST) + @ResponseBody + public ResultUtil selectPrintPic(String patientId,String rootPaths,String names,String sources) throws Exception{ + List outs = commomService.selectPrintPic(patientId,rootPaths,names,sources); + return ResultUtil.ok(outs); + } + + /** + * 英德分段计算页数 + * @param patientId + * @param type + * @return + * @throws Exception + */ private Map setPdfPageWithAssorts(String patientId, int type) throws Exception { //定义分段map Map map = new HashMap<>(); @@ -1032,7 +902,7 @@ public class CommomSearchController { } } - /** + /**英德、湛江查看pdf * @MethodName: showRecordContent * @Description: 显示病案pdf内容,加载pdf * @Param String patientId:patientId String assortIds:病案分段id集合 @@ -1091,7 +961,14 @@ public class CommomSearchController { } } - //脐血库 + /** + * 脐血库、祈福查看pdf + * @param patientId + * @param scanPages + * @param sources + * @param flag + * @param response + */ @RequestMapping(value = "showRecordContentBlood") @ResponseBody public void showRecordContentBlood(String patientId,String scanPages, String sources,String flag,HttpServletResponse response) { @@ -1102,8 +979,7 @@ public class CommomSearchController { } } - //脐血库 - /** + /**第一版本 * @MethodName: updateScanAssort * @Description: 重新分页 * @Param String patientId,String assortIds:病案分段id集合,Integer index:pdf当前页数 @@ -1137,9 +1013,8 @@ public class CommomSearchController { } return null; } - //脐血库 - /** + /**脐血库、祈福 * @MethodName: updateScanAssortByBlood * @Description: 重新分页 * @Param String patientId,String assortIds:病案图片集合,newAssortId新的分类id @@ -1174,657 +1049,821 @@ public class CommomSearchController { return null; } - /*****************************************编码操作**************************************************/ + /*****************************病案图片操作****************************/ + @OptionalLog(module = "保存", methods = "图片资料", fieldName = "name", tableName = "commomtable") + @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{ + ResultUtil resultUtil = commomService.updatePic(files, commomVo.getPatientId(), assortId); + if(!resultUtil.getCode().equals(0)){ + return resultUtil; + } + return ResultUtil.ok(); + } + /** - * @MethodName: codeTable - * @Description: 跳转到编码录入页面 - * @Param + * @MethodName: delScanAssortByBlood + * @Description: 删除图片 + * @Param String patientId,String assortIds:病案图片集合 * @Return * @Author: 曾文和 - * @CreateDate: 2019-12-04 + * @CreateDate: 2020-03-09 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-12-04 + * @UpdateDate: 2020-03-09 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping("codeTable") - public String codeTable(String patientId, Model model) { - model.addAttribute("patientId", patientId); - try { - //加载诊断编码和名称 - List diags = diagService.selectAllByPatientId(patientId, null); - model.addAttribute("diags", diags); - //加载手术编码和手术名称 - List operates = operateService.selectAllByPatientId(patientId, null); - model.addAttribute("operates", operates); - //麻醉方式 - List anaesthesias = dictionaryMapper.selectDictionaryByTypeCode("anaesthesia"); - model.addAttribute("anaesthesias", anaesthesias); - //切口愈合等级 - List cutHealGrades = dictionaryMapper.selectDictionaryByTypeCode("cut_heal_grade"); - model.addAttribute("cutHealGrades", cutHealGrades); - //是否择期手术 - List whether = dictionaryMapper.selectDictionaryByTypeCode("whether"); - model.addAttribute("whether", whether); - //手术类型 - List operateClasses = dictionaryMapper.selectDictionaryByTypeCode("operate_class"); - model.addAttribute("operateClasses", operateClasses); - } catch (Exception e) { - e.printStackTrace(); + @RequiresPermissions("/commom/delScanAssort") + @OptionalLog(module = "删除", methods = "档案预览页面删除病案图片",fieldName = "name",tableName = "commomtable") + @RequestMapping(value = "delScanAssortByBlood", method = RequestMethod.POST) + @ResponseBody + 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)) { + scanAssortService.SimpleDelByPatientIdAndScanPages(patientId, assortIds); + return ResultUtil.ok(); } - return "recordManage/commomSearch/codeTable"; + return null; } + /*****************************病案备注操作****************************/ /** - * @MethodName: getDiagCodeContents - * @Description: 根据icd编码查询诊断对象集合 + * @MethodName: updateRecordReMark + * @Description: 修改病案备注 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-07-03 + * @CreateDate: 2020-06-05 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-07-03 + * @UpdateDate: 2020-06-05 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "getDiagCodeContents", produces = {"text/json;charset=UTF-8"}) + @OptionalLog(module = "修改", methods = "修改病案备注", fieldName = "name", tableName = "commomtable") + @RequiresPermissions("/commom/addReMark") + @RequestMapping(value="updateRecordReMark",method = RequestMethod.POST) @ResponseBody - public String getDiagCodeContents(String code, String name) { - try { - List icdCodes = new ArrayList<>(); - if (StringUtils.isNotBlank(code)) { - icdCodes = icdCodeMapper.selectAll(code, null); - } else { - icdCodes = icdCodeMapper.selectAll(null, name); - } - Map map = new HashMap<>(); - if (null != icdCodes && !icdCodes.isEmpty()) { - for (int i = 0; i < icdCodes.size(); i++) { - if (StringUtils.isNoneBlank(icdCodes.get(i).getCode())) { - map.put(icdCodes.get(i).getCode(), icdCodes.get(i).getName()); - } - } - } - return JSON.toJSONString(map); - } catch (Exception e) { - e.printStackTrace(); - return null; - } + public ResultUtil updateRecordReMark(CommomVo commomVo) throws Exception{ + commomService.updateRecordReMark(commomVo); + return ResultUtil.ok(); } - - - - /**getOperateCodeContents - * @MethodName: - * @Description: 根据手术编码查询手术对象集合 + /**************************病案备注结束*******************************/ + /**************************恢复已删除图片开始*************************/ + /** + * @MethodName: getDeledPicRecordTree + * @Description: 组织已删除图片的病案分类树 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-07-03 + * @CreateDate: 2020-06-08 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-07-03 + * @UpdateDate: 2020-06-08 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "getOperateCodeContents", produces = {"text/json;charset=UTF-8"}) + @RequestMapping("selectDeledPicRecordTree") @ResponseBody - public String getOperateCodeContents(String code, String name) { - try { - List zdCm3s = new ArrayList<>(); - if (StringUtils.isNotBlank(code)) { - zdCm3s = cm3Mapper.selectAll(code, null); - } else { - zdCm3s = cm3Mapper.selectAll(null, name); + public List selectDeledPicRecordTree(String patientId,String flag) { + List treeList = new ArrayList<>(); + //根据patientId查询已删除图片集合 + List scanAssortVos = scanAssortMapper.selectDeledPicList(patientId,flag); + //第一级:全部影像资料 + ScanDeledAssortTree tree1 = new ScanDeledAssortTree(); + Integer id = 1; + tree1.setId(id); + tree1.setName("全部影像资料(" + scanAssortVos.size() + ")"); + tree1.setCount(scanAssortVos.size()); + //定义图片集合 + String scanPathList = ""; + //定义绝对路径集合 + String srcs = ""; + //定义分类名称集合 + String assortNames = ""; + if (null != scanAssortVos && !scanAssortVos.isEmpty()) { + //定义图片分类不重复结合 + Set assortNameSet = new LinkedHashSet<>(); + for (ScanAssortVo scanAssort : scanAssortVos) { + if (StringUtils.isNotBlank(scanAssort.getAssortName())) { + assortNameSet.add(scanAssort.getAssortName()); + scanPathList += scanAssort.getScanPage() + ","; + srcs += scanAssort.getRootPath() + "\\" + scanAssort.getScanPage() + ","; + assortNames += scanAssort.getAssortName() + ","; + } } - Map map = new HashMap<>(); - if (null != zdCm3s && !zdCm3s.isEmpty()) { - for (int i = 0; i < zdCm3s.size(); i++) { - if (StringUtils.isNoneBlank(zdCm3s.get(i).getCode())) { - map.put(zdCm3s.get(i).getCode(), zdCm3s.get(i).getName()); + //设置图片名称集合 + tree1.setScanPageList(scanPathList); + tree1.setSrcs(srcs); + tree1.setAssortNames(assortNames); + treeList.add(tree1); + for (String assortName : assortNameSet) { + id++; + ScanDeledAssortTree tree2 = new ScanDeledAssortTree(); + tree2.setId(id); + tree2.setParentId(1); + //定义图片集合 + String scanPathList1 = ""; + String srcs1 = ""; + //定义分类图片的个数 + Integer count = 0; + for (ScanAssortVo scanAssort : scanAssortVos) { + if (StringUtils.isNotBlank(scanAssort.getAssortName())) { + if (scanAssort.getAssortName().equals(assortName)) { + scanPathList1 += scanAssort.getScanPage() + ","; + srcs1 += scanAssort.getRootPath() + "\\" + scanAssort.getScanPage() + ","; + count++; + } } } + tree2.setName(assortName + "(" + count + ")"); + tree2.setCount(count); + tree2.setScanPageList(scanPathList1); + tree2.setSrcs(srcs1); + tree2.setAssortNames(assortName); + treeList.add(tree2); } - return JSON.toJSONString(map); - } catch (Exception e) { - e.printStackTrace(); - return null; } + return treeList; } - /** - * @MethodName: loadSelect - * @Description: 加载编码字典 + * @MethodName: getDeledPicRecordTree + * @Description: 组织已删除图片的病案分类树 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-12-05 + * @CreateDate: 2020-06-08 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-12-05 + * @UpdateDate: 2020-06-08 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping("loadCM3") + @OptionalLog(module = "修改", methods = "恢复已删除图片", fieldName = "name", tableName = "commomtable") + @RequiresPermissions("/commom/recoverPic") + @RequestMapping(value="recoverPic",method = RequestMethod.POST) @ResponseBody - public String loadCM3() { - try { - //加载手术cmd3 - List cm3s = cm3Mapper.selectAll(null, null); - return JSON.toJSONString(cm3s); - } catch (Exception e) { - e.printStackTrace(); - return null; + 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 = "病案信息修改") + @RequestMapping("updateCommomInfo") + @ResponseBody + public ResultUtil updateCommomInfo(CommomVo commomVo) throws Exception{ + if (null != commomVo.getInpatientNo()){ + int vo = commomMapper.selectCountByPatients(commomVo.getPatientId()); + if (vo > 0){ + int i = commomMapper.updateByPrimaryKeySelective(commomVo); + if (i > 0){ + return ResultUtil.ok(); + } else { + return ResultUtil.error("修改失败!"); + } + } else { + return ResultUtil.error("修改失败,该病案主键不存在!"); + } + } else { + return ResultUtil.error("修改失败,主键不能为空!"); } } - - - - /** - * @MethodName: getCodeTypeTree - * @Description: 根据patientId加载类别树 - * @Param - * @Return - * @Author: 曾文和 - * @CreateDate: 2019-06-11 - * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-11 - * @UpdateRemark: 更新说明 - * @Version: 1.0 + * 验证编号和协议号是否存在 + * @param commomBlood + * @return + * @throws Exception */ - @RequestMapping(value = "getCodeTypeTree", produces = {"text/json;charset=UTF-8"}) + //脐血库 + @RequestMapping("validExistForm") @ResponseBody - public String getCodeTypeTree(String patientId) { - if (StringUtils.isNoneBlank(patientId)) { - try { - List types = codeTypeService.selectAllByPatientId(patientId); - List treeList = new ArrayList<>(); - if (null != types && !types.isEmpty()) { - Integer id = 0; - Integer parentId = 0; - //第一级,类别层级 - for (int i = 0; i < types.size(); i++) { - id++; - CodeTree tree = new CodeTree(); - BeanUtils.copyProperties(types.get(i), tree); - tree.setId(id); - tree.setParentId(0); - tree.setSelfId(types.get(i).getId()); - tree.setName(types.get(i).getTypeName()); - //子集赋值父Id - parentId = id; - treeList.add(tree); - //第二级,手术类或西医编码类或中医编码类 - String typeFlag = types.get(i).getTypeFlag(); - //1.手术 - if (StringUtils.isNoneBlank(typeFlag) && "operate".equals(typeFlag)) { - List operates = operateService.selectAllByPatientId(patientId, null); - if (null != operates && !operates.isEmpty()) { - for (int j = 0; j < operates.size(); j++) { - id++; - CodeTree tree1 = new CodeTree(); - BeanUtils.copyProperties(operates.get(j), tree1); - tree1.setId(id); - tree1.setParentId(parentId); - tree1.setName(operates.get(j).getOperateNo() + "." + operates.get(j).getOperateName()); - //转换时间格式 - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); - if (null != tree1.getOperateDate()) { - tree1.setOperateDateStr(fmt.format(tree1.getOperateDate())); - } - if (null != tree1.getOperDate()) { - tree1.setOperDateStr(fmt.format(tree1.getOperDate())); - } - treeList.add(tree1); - } - } - //西医诊断 - } else if (StringUtils.isNoneBlank(typeFlag) && "diag".equals(typeFlag)) { - List diags = diagService.selectAllByPatientId(patientId, null); - if (null != diags && !diags.isEmpty()) { - for (int j = 0; j < diags.size(); j++) { - id++; - CodeTree tree2 = new CodeTree(); - BeanUtils.copyProperties(diags.get(j), tree2); - tree2.setId(id); - tree2.setParentId(parentId); - tree2.setName(diags.get(j).getDiagNo() + "." + diags.get(j).getDiagName()); - //转换时间格式 - if (null != tree2.getOperDate()) { - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - tree2.setOperDateStr(fmt.format(tree2.getOperDate())); - treeList.add(tree2); - } - } - } - //中医诊断 - } else if (StringUtils.isNoneBlank(typeFlag) && "herbDiag".equals(typeFlag)) { - List herbDiags = herbDiagService.selectAllByPatientId(patientId, null); - if (null != herbDiags && !herbDiags.isEmpty()) { - for (int j = 0; j < herbDiags.size(); j++) { - id++; - CodeTree tree3 = new CodeTree(); - BeanUtils.copyProperties(herbDiags.get(j), tree3); - tree3.setId(id); - tree3.setParentId(parentId); - tree3.setName(herbDiags.get(j).getHerbNo() + "." + herbDiags.get(j).getHerbName()); - //转换时间格式 - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); - tree3.setOperDateStr(fmt.format(tree3.getOperDate())); - treeList.add(tree3); - } - } - } - } - } - return JSON.toJSONString(treeList); - } catch (Exception e) { - e.printStackTrace(); - return null; + public ResultUtil validExistForm(CommomBlood commomBlood) throws Exception{ + String patientId = commomBlood.getPatientId(); + commomBlood.setPatientId(null); + FontCommom commom = new FontCommom(); + BeanUtils.copyProperties(commomBlood,commom); + List list = commomMapper.isExistInpatient(commom); + if(!CollectionUtils.isEmpty(list)){ + //修改的情况,同一份病案返回成功 + if(StringUtils.isNotBlank(patientId) && list.get(0).getPatientId().equals(patientId)){ + return ResultUtil.ok(); } - } else { - return null; + return ResultUtil.ok("已存在"); + } + return ResultUtil.ok(); + } + /** + * 脐血库新增档案 + * @param commomBlood + * @return + * @throws Exception + */ + @OptionalLog(module = "新增", methods = "新增档案") + @RequiresPermissions("/commom/addRecord") + @RequestMapping(value="addRecord",method = RequestMethod.POST) + @ResponseBody + public ResultUtil addRecordBlood(@Valid CommomBlood commomBlood,HttpServletRequest request) throws Exception{ + //判断formToken + boolean flag = FormTokenFlagUtil.isFlag(request); + if(!flag){ + return ResultUtil.error("请不要重复提交!"); + } + //判断表单不为空和不可重复的字段 + ResultUtil result = validFieldOper(commomBlood); + if(!result.getCode().equals(0)){ + return result; + } + //进入添加病案方法 + ResultUtil resultUtil = commomService.addRecordBlood(commomBlood, request); + //有错误返回错误信息 + if(!resultUtil.getCode().equals(0)){ + return resultUtil; } + return ResultUtil.ok(); } /** - * @MethodName: addCodeType - * @Description: 保存编码类别信息 - * @Param Emr_Code_Type codeType编码类别对象,Integer index:pdf当前页码,String patientId,String assortIds:分段id - * @Return - * @Author: 曾文和 - * @CreateDate: 2019-06-10 - * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-10 - * @UpdateRemark: 更新说明 - * @Version: 1.0 + * 加载分类树 + * @param request + * @return */ - @RequiresPermissions(value = {"/commom/addCodeType", "/commom/updateCodeType"}) - @OptionalLog(module = "新增", methods = "编码类别", fieldName = "typeName") - @RequestMapping("addCodeType") + @RequestMapping("selectRecordTree") @ResponseBody - public ResultUtil addCodeType(Emr_Code_Type codeType, Integer index, String patientId, String assortIds, - HttpServletRequest request) throws Exception{ - if (StringUtils.isBlank(assortIds)) { - return ResultUtil.error("没有分段数据,请先在用户分配调阅里添加并分配分段数据!"); + public List selectRecordTree(HttpServletRequest request){ + List treeList = new ArrayList<>(); + Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); + try { + List assorts = assortService.selectAllByPower(user); + //第一级:全部影像资料 + Zd_Assort tree1 = new Zd_Assort(); + tree1.setAssortId("0"); + tree1.setAssortName("全部分类"); + treeList.add(tree1); + if(!CollectionUtils.isEmpty(assorts)){ + for(Zd_Assort assort : assorts){ + assort.setPrintFlag("0"); + } + treeList.addAll(assorts); + } + return treeList; + }catch (Exception e){ + e.printStackTrace(); + log.error(ExceptionUtils.getExceptionStr(e)); + return null; } - if (StringUtils.isNoneBlank(patientId) && null != index) { - //验证标志和名称都不能重复 - Emr_Code_Type isExistFlag = codeTypeMapper.checkFlagAndNameIsExist(codeType.getTypeFlag(), null); - Emr_Code_Type isExistName = codeTypeMapper.checkFlagAndNameIsExist(null, codeType.getTypeName()); - if (codeType.getId() == null) { - if (isExistFlag == null) { - if (isExistName == null) { - //新增 - codeType.setPatientId(patientId); - //根据index:当前pdf页数,patientId,admissIds获取pdf信息 - List scanPathVo = getPdfPathVo(index, patientId, assortIds); - if (null != scanPathVo && !scanPathVo.isEmpty()) { - codeType.setAssortId(scanPathVo.get(0).getAssortId()); - codeType.setScanPage(scanPathVo.get(0).getScanPage()); - } else { - return ResultUtil.error("图片不存在!"); - } - codeTypeService.addCodeType(codeType, request); + } + + //判断表单不为空和不可重复的字段 + private ResultUtil validFieldOper(CommomBlood commomBlood) throws Exception{ + String patientId = commomBlood.getPatientId(); + //判断脐血编号不为空 + String inpatientNo = commomBlood.getInpatientNo(); + if(StringUtils.isBlank(inpatientNo)){ + return ResultUtil.error("脐血编号不能为空!"); + }else{ + FontCommom commom = new FontCommom(); + commom.setInpatientNo(inpatientNo); + List list = commomMapper.isExistInpatient(commom); + if(!CollectionUtils.isEmpty(list)){ + if(StringUtils.isNotBlank(patientId)){ + if(list.get(0).getPatientId().equals(patientId)){ return ResultUtil.ok(); - } else { - return ResultUtil.error("类别名称不能重复!"); } - } else { - return ResultUtil.error("类别标志不能重复!"); } - } else { - if (null != isExistName && !isExistName.getId().equals(codeType.getId())) { - return ResultUtil.error("类别名称不能重复!"); - } else { - if (null != isExistFlag && !isExistFlag.getId().equals(codeType.getId())) { - return ResultUtil.error("类别标志不能重复!"); - } else { - //修改 - codeTypeService.updateCodeType(codeType, request); + return ResultUtil.error("脐血编号已存在!"); + } + } + //验证协议号是否存在 + String admissId = commomBlood.getAdmissId(); + if(StringUtils.isNotBlank(admissId)){ + FontCommom commom = new FontCommom(); + commom.setAdmissId(admissId); + List list = commomMapper.isExistInpatient(commom); + if(!CollectionUtils.isEmpty(list)){ + if(StringUtils.isNotBlank(patientId)){ + if(list.get(0).getPatientId().equals(patientId)){ return ResultUtil.ok(); } } + return ResultUtil.error("协议号已存在!"); } } - return null; + //判断孕妇姓名不为空 + if(StringUtils.isBlank(commomBlood.getName())){ + return ResultUtil.error("孕妇姓名不能为空!"); + } + return ResultUtil.ok(); } /** - * @MethodName: delCodeTypeById - * @Description: 根据id删除编码类别 - * @Param - * @Return - * @Author: 曾文和 - * @CreateDate: 2019-06-11 - * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-11 - * @UpdateRemark: 更新说明 - * @Version: 1.0 + * 脐血库修改档案 + * @param commomBlood + * @return + * @throws Exception */ - @RequiresPermissions("/commom/delCodeTypeById") - @OptionalLog(module = "删除", methods = "编码类别", fieldName = "typeName", tableName = "emr_code_type") - @RequestMapping(value = "delCodeTypeById/{id}") + @OptionalLog(module = "修改", methods = "修改档案",fieldName = "name",tableName = "commomtable") + @RequiresPermissions("/commom/updateRecord") + @RequestMapping(value="updateRecordBlood",method = RequestMethod.POST) @ResponseBody - public ResultUtil delCodeTypeById(@PathVariable("id") Integer id) throws Exception{ - codeTypeService.deleteByPrimaryKey(id); + public ResultUtil updateRecordBlood(CommomBlood commomBlood) throws Exception{ + //判断表单不为空和不可重复的字段 + ResultUtil resultUtil = validFieldOper(commomBlood); + if(!resultUtil.getCode().equals(0)){ + return resultUtil; + } + CommomVo commomVo = new CommomVo(); + BeanUtils.copyProperties(commomBlood,commomVo); + commomService.updateRecord(commomVo); return ResultUtil.ok(); } - /********************************************手术编码*******************************************************/ /** - * @MethodName: addDiagCode - * @Description: 保存诊断编码 - * @Param - * @Return - * @Author: 曾文和 - * @CreateDate: 2020-01-03 - * @UpdateUser: 曾文和 - * @UpdateDate: 2020-01-03 - * @UpdateRemark: 更新说明 - * @Version: 1.0 + * 脐血库删除档案 + * @param patientId + * @return + * @throws Exception */ - @RequiresPermissions("/commom/addOperCode") - @RequestMapping(value = "addDiagCode") + @OptionalLog(module = "删除", methods = "删除档案",fieldName = "name",tableName = "commomtable") + @RequiresPermissions("/commom/deleteRecord") + @RequestMapping(value="deleteRecordBlood",method = RequestMethod.POST) @ResponseBody - public ResultUtil addDiagCode(String patientId, String diagNos, String diagNames, String diagCodes, String inhospstats) throws Exception{ - diagService.addDiagCode(patientId, diagNos, diagNames, diagCodes, inhospstats); + public ResultUtil deleteRecordBlood(String patientId) throws Exception{ + commomService.deleteRecord(patientId); return ResultUtil.ok(); } - + /**************************病案维护结束*****************************/ + /*******************第一版本手术、诊断操作开始**********************/ + /*****************************************编码操作**************************************************/ /** - * @MethodName: checkOperateNo - * @Description: 验证手术序号是否存在 + * @MethodName: codeTable + * @Description: 跳转到编码录入页面 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-12 + * @CreateDate: 2019-12-04 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 + * @UpdateDate: 2019-12-04 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "checkOperateNo") - @ResponseBody - public ResultUtil checkOperateNo(String patientId, Short operateNo) throws Exception{ - if (StringUtils.isNoneBlank(patientId) && operateNo != null) { - //根据patientId和手术编码查询手术编码集合 - List operates = operateService.selectAllByPatientId(patientId, operateNo); - if (operates != null && !operates.isEmpty()) { - //存在 - return ResultUtil.error(); - } else { - return ResultUtil.ok(); - } + @RequestMapping("codeTable") + public String codeTable(String patientId, Model model) { + model.addAttribute("patientId", patientId); + try { + //加载诊断编码和名称 + List diags = diagService.selectAllByPatientId(patientId, null); + model.addAttribute("diags", diags); + //加载手术编码和手术名称 + List operates = operateService.selectAllByPatientId(patientId, null); + model.addAttribute("operates", operates); + //麻醉方式 + List anaesthesias = dictionaryMapper.selectDictionaryByTypeCode("anaesthesia"); + model.addAttribute("anaesthesias", anaesthesias); + //切口愈合等级 + List cutHealGrades = dictionaryMapper.selectDictionaryByTypeCode("cut_heal_grade"); + model.addAttribute("cutHealGrades", cutHealGrades); + //是否择期手术 + List whether = dictionaryMapper.selectDictionaryByTypeCode("whether"); + model.addAttribute("whether", whether); + //手术类型 + List operateClasses = dictionaryMapper.selectDictionaryByTypeCode("operate_class"); + model.addAttribute("operateClasses", operateClasses); + } catch (Exception e) { + e.printStackTrace(); } - return ResultUtil.error(); - } - - /** - * @MethodName: getOperByCodeOrName - * @Description: 通过手术编码或手术名称查询手术字典集合 - * @Param - * @Return - * @Author: 曾文和 - * @CreateDate: 2019-06-12 - * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 - * @UpdateRemark: 更新说明 - * @Version: 1.0 - */ - @RequestMapping(value = "getOperByCodeOrName", produces = {"text/json;charset=UTF-8"}) - @ResponseBody - public String getOperByCodeOrName(String code, String name) throws Exception{ - //根据手术编码和名称查询手术编码对象 - List cm3s = cm3Mapper.selectAll(code, name); - return JSON.toJSONString(cm3s); + return "recordManage/commomSearch/codeTable"; } /** - * @MethodName: saveOperCode - * @Description: 保存手术编码 + * @MethodName: getDiagCodeContents + * @Description: 根据icd编码查询诊断对象集合 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-12 + * @CreateDate: 2019-07-03 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 + * @UpdateDate: 2019-07-03 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value = {"/commom/addOperCode", "/commom/updateOperCode"}) - @OptionalLog(module = "新增", methods = "手术编码", fieldName = "operateName") - @RequestMapping(value = "saveOperCode") + @RequestMapping(value = "getDiagCodeContents", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public ResultUtil saveOperCode(T_Operate operate, Integer isUpdateOperNo, HttpServletRequest request) throws Exception{ - if (operate.getCurrentOperateNo() == null) { - //新增 - boolean flag = FormTokenFlagUtil.isFlag(request); - if (!flag) { - return ResultUtil.error("请不要重复提交!"); + public String getDiagCodeContents(String code, String name) { + try { + List icdCodes = new ArrayList<>(); + if (StringUtils.isNotBlank(code)) { + icdCodes = icdCodeMapper.selectAll(code, null); + } else { + icdCodes = icdCodeMapper.selectAll(null, name); } - operateService.insert(operate); - } else { - //修改 - if (isUpdateOperNo == 1) { - //有修改手术序号 - //查询手术序号是否存在 - List operates = operateService.selectAllByPatientId(operate.getPatientId(), operate.getOperateNo()); - if (null != operates && !operates.isEmpty()) { - //存在 - return ResultUtil.error("该手术序号已存在!"); - } else { - operateService.updateByPrimaryKeySelective(operate); + Map map = new HashMap<>(); + if (null != icdCodes && !icdCodes.isEmpty()) { + for (int i = 0; i < icdCodes.size(); i++) { + if (StringUtils.isNoneBlank(icdCodes.get(i).getCode())) { + map.put(icdCodes.get(i).getCode(), icdCodes.get(i).getName()); + } } - } else { - //手术序号一样 - operateService.updateByPrimaryKeySelective(operate); } + return JSON.toJSONString(map); + } catch (Exception e) { + e.printStackTrace(); + return null; } - return ResultUtil.ok(); } - /** - * @MethodName: deleteOperCodeByPatientIdAndOperNo - * @Description: 根据petientId和手术序号删除手术编码对象 - * @Param - * @Return - * @Author: 曾文和 - * @CreateDate: 2019-06-12 - * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 - * @UpdateRemark: 更新说明 - * @Version: 1.0 - */ - @RequiresPermissions("/commom/deleteOperCode") - @OptionalLog(module = "删除", methods = "手术编码", fieldName = "operateName", tableName = "t_operate") - @RequestMapping(value = "deleteOperCodeByPatientIdAndOperNo") - @ResponseBody - public ResultUtil deleteOperCodeByPatientIdAndOperNo(String patientId, Short operateNo) throws Exception{ - if (StringUtils.isNoneBlank(patientId) && null != operateNo) { - operateService.deleteOperCodeByPatientIdAndOperNo(patientId, operateNo); - return ResultUtil.ok(); - } else { - return ResultUtil.error(); - } - }/**************************************************西医诊断操作*************************************************/ -/** - * @MethodName: addOperCode - * @Description: 保存手术编码 - * @Param - * @Return - * @Author: 曾文和 - * @CreateDate: 2020-01-03 - * @UpdateUser: 曾文和 - * @UpdateDate: 2020-01-03 - * @UpdateRemark: 更新说明 - * @Version: 1.0 - */ - @RequiresPermissions("/commom/addOperCode") - @RequestMapping(value = "addOperCode") - @ResponseBody - public ResultUtil addOperCode(String patientId, String operNos, String operDates, String operCodes, String operNames, String operateClasses, String operators, String assistant1s, String assistant2s, String cuts, String chossurgs, String anaesthesiaTypes, String anaesthesiaNames) throws Exception{ - operateService.addOperCode(patientId, operNos, operDates, operCodes, operNames, operateClasses, operators, assistant1s, assistant2s, cuts, chossurgs, anaesthesiaTypes, anaesthesiaNames); - return ResultUtil.ok(); - } - /** - * @MethodName: getDictionaryByTypeCode - * @Description: 根据字典标识查询字典集合 + /**getOperateCodeContents + * @MethodName: + * @Description: 根据手术编码查询手术对象集合 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-12 + * @CreateDate: 2019-07-03 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 + * @UpdateDate: 2019-07-03 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "getDictionaryByTypeCode", produces = {"text/json;charset=UTF-8"}) + @RequestMapping(value = "getOperateCodeContents", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public String getDictionaryByTypeCode(String typeCode) throws Exception{ - List dictionaries = dictionaryMapper.selectDictionaryByTypeCode(typeCode); - return JSON.toJSONString(dictionaries); + public String getOperateCodeContents(String code, String name) { + try { + List zdCm3s = new ArrayList<>(); + if (StringUtils.isNotBlank(code)) { + zdCm3s = cm3Mapper.selectAll(code, null); + } else { + zdCm3s = cm3Mapper.selectAll(null, name); + } + Map map = new HashMap<>(); + if (null != zdCm3s && !zdCm3s.isEmpty()) { + for (int i = 0; i < zdCm3s.size(); i++) { + if (StringUtils.isNoneBlank(zdCm3s.get(i).getCode())) { + map.put(zdCm3s.get(i).getCode(), zdCm3s.get(i).getName()); + } + } + } + return JSON.toJSONString(map); + } catch (Exception e) { + e.printStackTrace(); + return null; + } } /** - * @MethodName: getIcdCodeList - * @Description: 加载icd编码字典表 + * @MethodName: loadSelect + * @Description: 加载编码字典 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-12 + * @CreateDate: 2019-12-05 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 + * @UpdateDate: 2019-12-05 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "getIcdCodeList", produces = {"text/json;charset=UTF-8"}) + @RequestMapping("loadCM3") @ResponseBody - public String getIcdCodeList() throws Exception{ - List icdCodes = icdCodeMapper.selectAll(null, null); - return JSON.toJSONString(icdCodes); + public String loadCM3() { + try { + //加载手术cmd3 + List cm3s = cm3Mapper.selectAll(null, null); + return JSON.toJSONString(cm3s); + } catch (Exception e) { + e.printStackTrace(); + return null; + } } + //封装根据index:当前pdf页数,patientId,admissIds获取pdf信息 + private List getPdfPathVo(Integer index, String patientId, String assortIds) throws Exception { + List list = new ArrayList<>(); + patientId = "'" + patientId + "'"; + List scanPathVos = scanPathMapper.selectScanFileByPatientIds(patientId, assortIds); + //重新组织存在的文件,即转换成功的文件 + if (null != scanPathVos && !scanPathVos.isEmpty()) { + // 实例化图片 + Image image = null; + //不成张合成的高度 + float tempHeight = 0; + Integer pageCount = 0; + for (ScanPathVo scanPathVo : scanPathVos) { + String fileRealPath = scanPathVo.getFileRealPath(); + if (StringUtils.isNoneBlank(fileRealPath)) { + //判断文件是否存在 + File file1 = new File(fileRealPath); + if (file1.exists()) { + if (file1.getName().endsWith(".tif") || file1.getName().endsWith(".tiff")) { + Object localObject1 = null; + Object localObject2 = null; + URL paramURL = Utilities.toURL(fileRealPath); + try { + if ("file".equals(paramURL.getProtocol())) { + localObject2 = paramURL.getFile(); + localObject2 = Utilities + .unEscapeURL((String) localObject2); + localObject1 = new RandomAccessFileOrArray( + (String) localObject2); + } else { + localObject1 = new RandomAccessFileOrArray(paramURL); + } + + int pageNums = TiffImage + .getNumberOfPages((RandomAccessFileOrArray) localObject1); + if (pageNums > 0) { + for (int i = 1; i <= pageNums; i++) { + localObject2 = TiffImage.getTiffImage( + (RandomAccessFileOrArray) localObject1, i); + image = (Image) localObject2; + } + } + if (localObject1 != null) { + ((RandomAccessFileOrArray) localObject1).close(); + } + + } finally { + if (localObject1 != null) { + ((RandomAccessFileOrArray) localObject1).close(); + } + } + } else if (file1.getName().endsWith(".png") + || file1.getName().endsWith(".jpg") + || file1.getName().endsWith(".gif") + || file1.getName().endsWith(".jpeg") + ) { + // 实例化图牿 + image = Image.getInstance(fileRealPath); + } + // 获得图片的高庿 + float heigth = image.getHeight(); + float width = image.getWidth(); + // 合理压缩,h>w,按w压缩,否则按w压缩 + int percent = Jpg2PdfUtil.getPercent(heigth, width); + + // 设置图片居中显示 + image.setAlignment(Image.ALIGN_CENTER); + // 按百分比显示图片的比便 + if (width > 1024 || heigth > 786) { + image.scalePercent(percent + 5); + pageCount++; + if (pageCount.equals(index)) { + //当前页返回 + list.clear(); + list.add(scanPathVo); + return list; + } + //整张,把合成的高度置为0; + tempHeight = 0; + } else if (heigth < 786) { + if (tempHeight == 0) { + pageCount++; + } + tempHeight += heigth; + if (tempHeight > 786) { + pageCount++; + if (pageCount.equals(index)) { + //当前页返回 + list.clear(); + list.add(scanPathVo); + return list; + } else if (pageCount == (index + 1)) { + //已另起一页,返回前一页 + return list; + } + tempHeight = heigth; + } else { + //连续的几张图片高度总和小于786添加进集合 + list.add(scanPathVo); + } + } + } + } + } + } + return list; + } /** - * @MethodName: getIcdCodeByCodeOrName - * @Description: 根据icd编码或名称查询icd字典集合 + * @MethodName: getCodeTypeTree + * @Description: 根据patientId加载类别树 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-12 + * @CreateDate: 2019-06-11 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 + * @UpdateDate: 2019-06-11 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "getIcdCodeByCodeOrName", produces = {"text/json;charset=UTF-8"}) + @RequestMapping(value = "getCodeTypeTree", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public String getIcdCodeByCodeOrName(String code, String name) throws Exception{ - List icdCodes = icdCodeMapper.selectAll(code, name); - return JSON.toJSONString(icdCodes); + public String getCodeTypeTree(String patientId) { + if (StringUtils.isNoneBlank(patientId)) { + try { + List types = codeTypeService.selectAllByPatientId(patientId); + List treeList = new ArrayList<>(); + if (null != types && !types.isEmpty()) { + Integer id = 0; + Integer parentId = 0; + //第一级,类别层级 + for (int i = 0; i < types.size(); i++) { + id++; + CodeTree tree = new CodeTree(); + BeanUtils.copyProperties(types.get(i), tree); + tree.setId(id); + tree.setParentId(0); + tree.setSelfId(types.get(i).getId()); + tree.setName(types.get(i).getTypeName()); + //子集赋值父Id + parentId = id; + treeList.add(tree); + //第二级,手术类或西医编码类或中医编码类 + String typeFlag = types.get(i).getTypeFlag(); + //1.手术 + if (StringUtils.isNoneBlank(typeFlag) && "operate".equals(typeFlag)) { + List operates = operateService.selectAllByPatientId(patientId, null); + if (null != operates && !operates.isEmpty()) { + for (int j = 0; j < operates.size(); j++) { + id++; + CodeTree tree1 = new CodeTree(); + BeanUtils.copyProperties(operates.get(j), tree1); + tree1.setId(id); + tree1.setParentId(parentId); + tree1.setName(operates.get(j).getOperateNo() + "." + operates.get(j).getOperateName()); + //转换时间格式 + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + if (null != tree1.getOperateDate()) { + tree1.setOperateDateStr(fmt.format(tree1.getOperateDate())); + } + if (null != tree1.getOperDate()) { + tree1.setOperDateStr(fmt.format(tree1.getOperDate())); + } + treeList.add(tree1); + } + } + //西医诊断 + } else if (StringUtils.isNoneBlank(typeFlag) && "diag".equals(typeFlag)) { + List diags = diagService.selectAllByPatientId(patientId, null); + if (null != diags && !diags.isEmpty()) { + for (int j = 0; j < diags.size(); j++) { + id++; + CodeTree tree2 = new CodeTree(); + BeanUtils.copyProperties(diags.get(j), tree2); + tree2.setId(id); + tree2.setParentId(parentId); + tree2.setName(diags.get(j).getDiagNo() + "." + diags.get(j).getDiagName()); + //转换时间格式 + if (null != tree2.getOperDate()) { + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + tree2.setOperDateStr(fmt.format(tree2.getOperDate())); + treeList.add(tree2); + } + } + } + //中医诊断 + } else if (StringUtils.isNoneBlank(typeFlag) && "herbDiag".equals(typeFlag)) { + List herbDiags = herbDiagService.selectAllByPatientId(patientId, null); + if (null != herbDiags && !herbDiags.isEmpty()) { + for (int j = 0; j < herbDiags.size(); j++) { + id++; + CodeTree tree3 = new CodeTree(); + BeanUtils.copyProperties(herbDiags.get(j), tree3); + tree3.setId(id); + tree3.setParentId(parentId); + tree3.setName(herbDiags.get(j).getHerbNo() + "." + herbDiags.get(j).getHerbName()); + //转换时间格式 + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + tree3.setOperDateStr(fmt.format(tree3.getOperDate())); + treeList.add(tree3); + } + } + } + } + } + return JSON.toJSONString(treeList); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } else { + return null; + } } /** - * @MethodName: checkDiagNo - * @Description: 验证西医诊断序号是否存在 - * @Param + * @MethodName: addCodeType + * @Description: 保存编码类别信息 + * @Param Emr_Code_Type codeType编码类别对象,Integer index:pdf当前页码,String patientId,String assortIds:分段id * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-12 + * @CreateDate: 2019-06-10 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 + * @UpdateDate: 2019-06-10 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "checkDiagNo") + @RequiresPermissions(value = {"/commom/addCodeType", "/commom/updateCodeType"}) + @OptionalLog(module = "新增", methods = "编码类别", fieldName = "typeName") + @RequestMapping("addCodeType") @ResponseBody - public ResultUtil checkDiagNo(String patientId, Short diagNo) throws Exception{ - if (StringUtils.isNoneBlank(patientId) && diagNo != null) { - List diags = diagService.selectAllByPatientId(patientId, diagNo); - if (diags != null && !diags.isEmpty()) { - //存在 - return ResultUtil.error(); + public ResultUtil addCodeType(Emr_Code_Type codeType, Integer index, String patientId, String assortIds, + HttpServletRequest request) throws Exception{ + if (StringUtils.isBlank(assortIds)) { + return ResultUtil.error("没有分段数据,请先在用户分配调阅里添加并分配分段数据!"); + } + if (StringUtils.isNoneBlank(patientId) && null != index) { + //验证标志和名称都不能重复 + Emr_Code_Type isExistFlag = codeTypeMapper.checkFlagAndNameIsExist(codeType.getTypeFlag(), null); + Emr_Code_Type isExistName = codeTypeMapper.checkFlagAndNameIsExist(null, codeType.getTypeName()); + if (codeType.getId() == null) { + if (isExistFlag == null) { + if (isExistName == null) { + //新增 + codeType.setPatientId(patientId); + //根据index:当前pdf页数,patientId,admissIds获取pdf信息 + List scanPathVo = getPdfPathVo(index, patientId, assortIds); + if (null != scanPathVo && !scanPathVo.isEmpty()) { + codeType.setAssortId(scanPathVo.get(0).getAssortId()); + codeType.setScanPage(scanPathVo.get(0).getScanPage()); + } else { + return ResultUtil.error("图片不存在!"); + } + codeTypeService.addCodeType(codeType, request); + return ResultUtil.ok(); + } else { + return ResultUtil.error("类别名称不能重复!"); + } + } else { + return ResultUtil.error("类别标志不能重复!"); + } } else { - return ResultUtil.ok(); + if (null != isExistName && !isExistName.getId().equals(codeType.getId())) { + return ResultUtil.error("类别名称不能重复!"); + } else { + if (null != isExistFlag && !isExistFlag.getId().equals(codeType.getId())) { + return ResultUtil.error("类别标志不能重复!"); + } else { + //修改 + codeTypeService.updateCodeType(codeType, request); + return ResultUtil.ok(); + } + } } } - return ResultUtil.error(); + return null; } /** - * @MethodName: saveDiag - * @Description: 保存西医诊断 + * @MethodName: delCodeTypeById + * @Description: 根据id删除编码类别 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-12 + * @CreateDate: 2019-06-11 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-12 + * @UpdateDate: 2019-06-11 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value = {"/commom/addOperCode", "/commom/updateOperCode"}) - @OptionalLog(module = "保存", methods = "西医诊断编码", fieldName = "diagName") - @RequestMapping(value = "saveDiag") + @RequiresPermissions("/commom/delCodeTypeById") + @OptionalLog(module = "删除", methods = "编码类别", fieldName = "typeName", tableName = "emr_code_type") + @RequestMapping(value = "delCodeTypeById/{id}") @ResponseBody - public ResultUtil saveDiag(T_Diag diag, Integer isUpdateOperNo, HttpServletRequest request) throws Exception{ - if (diag.getCurrentDiagNo() == null) { - //新增 - boolean flag = FormTokenFlagUtil.isFlag(request); - if (!flag) { - return ResultUtil.error("请不要重复提交!"); - } - diagService.insert(diag); - } else { - //修改 - if (isUpdateOperNo == 1) { - //有修改序号 - //查询序号是否存在 - List diags = diagService.selectAllByPatientId(diag.getPatientId(), diag.getDiagNo()); - if (null != diags && !diags.isEmpty()) { - //存在 - return ResultUtil.error("该诊断序号已存在!"); - } else { - diagService.updateByPrimaryKeySelective(diag); - } - } else { - //诊断序号一样 - diagService.updateByPrimaryKeySelective(diag); - } - } + public ResultUtil delCodeTypeById(@PathVariable("id") Integer id) throws Exception{ + codeTypeService.deleteByPrimaryKey(id); return ResultUtil.ok(); } - /*****************************************中医诊断********************************************************/ + /********************************************手术编码*******************************************************/ /** - * @MethodName: deleteCodeByPatientIdAndDiagNo - * @Description: 根据petientId和诊断序号删除西医诊断编码对象 + * @MethodName: addDiagCode + * @Description: 保存诊断编码 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-13 + * @CreateDate: 2020-01-03 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-13 + * @UpdateDate: 2020-01-03 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions("/commom/deleteOperCode") - @OptionalLog(module = "删除", methods = "西医诊断编码", fieldName = "diagName", tableName = "t_diag") - @RequestMapping(value = "deleteCodeByPatientIdAndDiagNo") + @RequiresPermissions("/commom/addOperCode") + @RequestMapping(value = "addDiagCode") @ResponseBody - public ResultUtil deleteCodeByPatientIdAndDiagNo(String patientId, Short diagNo) throws Exception{ - if (StringUtils.isNoneBlank(patientId) && null != diagNo) { - diagService.deleteDiagByPatientIdAndDiagNo(patientId, diagNo); - return ResultUtil.ok(); - } else { - return ResultUtil.error(); - } + public ResultUtil addDiagCode(String patientId, String diagNos, String diagNames, String diagCodes, String inhospstats) throws Exception{ + diagService.addDiagCode(patientId, diagNos, diagNames, diagCodes, inhospstats); + return ResultUtil.ok(); } /** - * @MethodName: checkHerbNo - * @Description: 验证中医诊断序号是否存在 + * @MethodName: checkOperateNo + * @Description: 验证手术序号是否存在 * @Param * @Return * @Author: 曾文和 @@ -1834,12 +1873,13 @@ public class CommomSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping(value = "checkHerbNo") + @RequestMapping(value = "checkOperateNo") @ResponseBody - public ResultUtil checkHerbNo(String patientId, Short herbNo) throws Exception{ - if (StringUtils.isNoneBlank(patientId) && herbNo != null) { - List herbDiags = herbDiagService.selectAllByPatientId(patientId, herbNo); - if (herbDiags != null && !herbDiags.isEmpty()) { + public ResultUtil checkOperateNo(String patientId, Short operateNo) throws Exception{ + if (StringUtils.isNoneBlank(patientId) && operateNo != null) { + //根据patientId和手术编码查询手术编码集合 + List operates = operateService.selectAllByPatientId(patientId, operateNo); + if (operates != null && !operates.isEmpty()) { //存在 return ResultUtil.error(); } else { @@ -1850,8 +1890,8 @@ public class CommomSearchController { } /** - * @MethodName: saveHerbDiag - * @Description: 保存中医诊断 + * @MethodName: getOperByCodeOrName + * @Description: 通过手术编码或手术名称查询手术字典集合 * @Param * @Return * @Author: 曾文和 @@ -1861,479 +1901,367 @@ public class CommomSearchController { * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions(value = {"/commom/addOperCode", "/commom/updateOperCode"}) - @OptionalLog(module = "保存", methods = "中医诊断编码", fieldName = "herbName") - @RequestMapping(value = "saveHerbDiag") + @RequestMapping(value = "getOperByCodeOrName", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public ResultUtil saveHerbDiag(T_Herb_Diag herbDiag, Integer isUpdateOperNo, HttpServletRequest request) throws Exception{ - if (herbDiag.getCurrentHerbDiagNo() == null) { - //新增 - boolean flag = FormTokenFlagUtil.isFlag(request); - if (!flag) { - return ResultUtil.error("请不要重复提交!"); - } - herbDiagService.insert(herbDiag); - } else { - //修改 - if (isUpdateOperNo == 1) { - //有修改序号 - //查询序号是否存在 - List herbDiags = herbDiagService.selectAllByPatientId(herbDiag.getPatientId(), herbDiag.getHerbNo()); - if (null != herbDiags && !herbDiags.isEmpty()) { - //存在 - return ResultUtil.error("该诊断序号已存在!"); - } else { - herbDiagService.updateByPrimaryKeySelective(herbDiag); - } - } else { - //诊断序号一样 - herbDiagService.updateByPrimaryKeySelective(herbDiag); - } - } - return ResultUtil.ok(); + public String getOperByCodeOrName(String code, String name) throws Exception{ + //根据手术编码和名称查询手术编码对象 + List cm3s = cm3Mapper.selectAll(code, name); + return JSON.toJSONString(cm3s); } /** - * @MethodName: deleteCodeByPatientIdAndHerbNo - * @Description: 根据petientId和诊断序号删除中医诊断编码对象 + * @MethodName: saveOperCode + * @Description: 保存手术编码 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2019-06-13 + * @CreateDate: 2019-06-12 * @UpdateUser: 曾文和 - * @UpdateDate: 2019-06-13 + * @UpdateDate: 2019-06-12 * @UpdateRemark: 更新说明 - * @Version: 1.0 - */ - @RequiresPermissions("/commom/deleteOperCode") - @OptionalLog(module = "删除", methods = "中医诊断编码", fieldName = "herbName", tableName = "t_herb_diag") - @RequestMapping(value = "deleteCodeByPatientIdAndHerbNo") - @ResponseBody - public ResultUtil deleteCodeByPatientIdAndHerbNo(String patientId, Short herbNo) throws Exception{ - if (StringUtils.isNoneBlank(patientId) && null != herbNo) { - herbDiagService.deleteHerbDiagByPatientIdAndHerbNo(patientId, herbNo); - return ResultUtil.ok(); - } else { - return ResultUtil.error(); - } - } - - //封装根据index:当前pdf页数,patientId,admissIds获取pdf信息 - private List getPdfPathVo(Integer index, String patientId, String assortIds) throws Exception { - List list = new ArrayList<>(); - patientId = "'" + patientId + "'"; - List scanPathVos = scanPathMapper.selectScanFileByPatientIds(patientId, assortIds); - //重新组织存在的文件,即转换成功的文件 - if (null != scanPathVos && !scanPathVos.isEmpty()) { - // 实例化图片 - Image image = null; - //不成张合成的高度 - float tempHeight = 0; - Integer pageCount = 0; - for (ScanPathVo scanPathVo : scanPathVos) { - String fileRealPath = scanPathVo.getFileRealPath(); - if (StringUtils.isNoneBlank(fileRealPath)) { - //判断文件是否存在 - File file1 = new File(fileRealPath); - if (file1.exists()) { - if (file1.getName().endsWith(".tif") || file1.getName().endsWith(".tiff")) { - Object localObject1 = null; - Object localObject2 = null; - URL paramURL = Utilities.toURL(fileRealPath); - try { - if ("file".equals(paramURL.getProtocol())) { - localObject2 = paramURL.getFile(); - localObject2 = Utilities - .unEscapeURL((String) localObject2); - localObject1 = new RandomAccessFileOrArray( - (String) localObject2); - } else { - localObject1 = new RandomAccessFileOrArray(paramURL); - } - - int pageNums = TiffImage - .getNumberOfPages((RandomAccessFileOrArray) localObject1); - if (pageNums > 0) { - for (int i = 1; i <= pageNums; i++) { - localObject2 = TiffImage.getTiffImage( - (RandomAccessFileOrArray) localObject1, i); - image = (Image) localObject2; - } - } - if (localObject1 != null) { - ((RandomAccessFileOrArray) localObject1).close(); - } - - } finally { - if (localObject1 != null) { - ((RandomAccessFileOrArray) localObject1).close(); - } - } - } else if (file1.getName().endsWith(".png") - || file1.getName().endsWith(".jpg") - || file1.getName().endsWith(".gif") - || file1.getName().endsWith(".jpeg") - ) { - // 实例化图牿 - image = Image.getInstance(fileRealPath); - } - // 获得图片的高庿 - float heigth = image.getHeight(); - float width = image.getWidth(); - // 合理压缩,h>w,按w压缩,否则按w压缩 - int percent = Jpg2PdfUtil.getPercent(heigth, width); - - // 设置图片居中显示 - image.setAlignment(Image.ALIGN_CENTER); - // 按百分比显示图片的比便 - if (width > 1024 || heigth > 786) { - image.scalePercent(percent + 5); - pageCount++; - if (pageCount.equals(index)) { - //当前页返回 - list.clear(); - list.add(scanPathVo); - return list; - } - //整张,把合成的高度置为0; - tempHeight = 0; - } else if (heigth < 786) { - if (tempHeight == 0) { - pageCount++; - } - tempHeight += heigth; - if (tempHeight > 786) { - pageCount++; - if (pageCount.equals(index)) { - //当前页返回 - list.clear(); - list.add(scanPathVo); - return list; - } else if (pageCount == (index + 1)) { - //已另起一页,返回前一页 - return list; - } - tempHeight = heigth; - } else { - //连续的几张图片高度总和小于786添加进集合 - list.add(scanPathVo); - } - } - } + * @Version: 1.0 + */ + @RequiresPermissions(value = {"/commom/addOperCode", "/commom/updateOperCode"}) + @OptionalLog(module = "新增", methods = "手术编码", fieldName = "operateName") + @RequestMapping(value = "saveOperCode") + @ResponseBody + public ResultUtil saveOperCode(T_Operate operate, Integer isUpdateOperNo, HttpServletRequest request) throws Exception{ + if (operate.getCurrentOperateNo() == null) { + //新增 + boolean flag = FormTokenFlagUtil.isFlag(request); + if (!flag) { + return ResultUtil.error("请不要重复提交!"); + } + operateService.insert(operate); + } else { + //修改 + if (isUpdateOperNo == 1) { + //有修改手术序号 + //查询手术序号是否存在 + List operates = operateService.selectAllByPatientId(operate.getPatientId(), operate.getOperateNo()); + if (null != operates && !operates.isEmpty()) { + //存在 + return ResultUtil.error("该手术序号已存在!"); + } else { + operateService.updateByPrimaryKeySelective(operate); } + } else { + //手术序号一样 + operateService.updateByPrimaryKeySelective(operate); } } - return list; + return ResultUtil.ok(); } - /*****************************病案图片操作****************************/ - @OptionalLog(module = "保存", methods = "图片资料", fieldName = "name", tableName = "commomtable") - @RequiresPermissions("/commom/updatePic") - @RequestMapping(value = "updatePic", method = RequestMethod.POST) + + /** + * @MethodName: deleteOperCodeByPatientIdAndOperNo + * @Description: 根据petientId和手术序号删除手术编码对象 + * @Param + * @Return + * @Author: 曾文和 + * @CreateDate: 2019-06-12 + * @UpdateUser: 曾文和 + * @UpdateDate: 2019-06-12 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ + @RequiresPermissions("/commom/deleteOperCode") + @OptionalLog(module = "删除", methods = "手术编码", fieldName = "operateName", tableName = "t_operate") + @RequestMapping(value = "deleteOperCodeByPatientIdAndOperNo") @ResponseBody - 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)){ - return resultUtil; + public ResultUtil deleteOperCodeByPatientIdAndOperNo(String patientId, Short operateNo) throws Exception{ + if (StringUtils.isNoneBlank(patientId) && null != operateNo) { + operateService.deleteOperCodeByPatientIdAndOperNo(patientId, operateNo); + return ResultUtil.ok(); + } else { + return ResultUtil.error(); } + }/**************************************************西医诊断操作*************************************************/ + + /** + * @MethodName: addOperCode + * @Description: 保存手术编码 + * @Param + * @Return + * @Author: 曾文和 + * @CreateDate: 2020-01-03 + * @UpdateUser: 曾文和 + * @UpdateDate: 2020-01-03 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ + @RequiresPermissions("/commom/addOperCode") + @RequestMapping(value = "addOperCode") + @ResponseBody + public ResultUtil addOperCode(String patientId, String operNos, String operDates, String operCodes, String operNames, String operateClasses, String operators, String assistant1s, String assistant2s, String cuts, String chossurgs, String anaesthesiaTypes, String anaesthesiaNames) throws Exception{ + operateService.addOperCode(patientId, operNos, operDates, operCodes, operNames, operateClasses, operators, assistant1s, assistant2s, cuts, chossurgs, anaesthesiaTypes, anaesthesiaNames); return ResultUtil.ok(); } /** - * @MethodName: delScanAssortByBlood - * @Description: 删除图片 - * @Param String patientId,String assortIds:病案图片集合 + * @MethodName: getDictionaryByTypeCode + * @Description: 根据字典标识查询字典集合 + * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2020-03-09 + * @CreateDate: 2019-06-12 * @UpdateUser: 曾文和 - * @UpdateDate: 2020-03-09 + * @UpdateDate: 2019-06-12 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequiresPermissions("/commom/delScanAssort") - @OptionalLog(module = "删除", methods = "档案预览页面删除病案图片",fieldName = "name",tableName = "commomtable") - @RequestMapping(value = "delScanAssortByBlood", method = RequestMethod.POST) + @RequestMapping(value = "getDictionaryByTypeCode", produces = {"text/json;charset=UTF-8"}) @ResponseBody - 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)) { - scanAssortService.SimpleDelByPatientIdAndScanPages(patientId, assortIds); - return ResultUtil.ok(); - } - return null; + public String getDictionaryByTypeCode(String typeCode) throws Exception{ + List dictionaries = dictionaryMapper.selectDictionaryByTypeCode(typeCode); + return JSON.toJSONString(dictionaries); } - /*****************************病案备注操作****************************/ /** - * @MethodName: updateRecordReMark - * @Description: 修改病案备注 + * @MethodName: getIcdCodeList + * @Description: 加载icd编码字典表 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2020-06-05 + * @CreateDate: 2019-06-12 * @UpdateUser: 曾文和 - * @UpdateDate: 2020-06-05 + * @UpdateDate: 2019-06-12 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @OptionalLog(module = "修改", methods = "修改病案备注", fieldName = "name", tableName = "commomtable") - @RequiresPermissions("/commom/addReMark") - @RequestMapping(value="updateRecordReMark",method = RequestMethod.POST) + @RequestMapping(value = "getIcdCodeList", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public ResultUtil updateRecordReMark(CommomVo commomVo) throws Exception{ - commomService.updateRecordReMark(commomVo); - return ResultUtil.ok(); + public String getIcdCodeList() throws Exception{ + List icdCodes = icdCodeMapper.selectAll(null, null); + return JSON.toJSONString(icdCodes); } - /**************************病案备注结束*******************************/ - /**************************恢复已删除图片开始*************************/ + /** - * @MethodName: getDeledPicRecordTree - * @Description: 组织已删除图片的病案分类树 + * @MethodName: getIcdCodeByCodeOrName + * @Description: 根据icd编码或名称查询icd字典集合 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2020-06-08 + * @CreateDate: 2019-06-12 * @UpdateUser: 曾文和 - * @UpdateDate: 2020-06-08 + * @UpdateDate: 2019-06-12 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @RequestMapping("selectDeledPicRecordTree") + @RequestMapping(value = "getIcdCodeByCodeOrName", produces = {"text/json;charset=UTF-8"}) @ResponseBody - public List selectDeledPicRecordTree(String patientId,String flag) { - List treeList = new ArrayList<>(); - //根据patientId查询已删除图片集合 - List scanAssortVos = scanAssortMapper.selectDeledPicList(patientId,flag); - //第一级:全部影像资料 - ScanDeledAssortTree tree1 = new ScanDeledAssortTree(); - Integer id = 1; - tree1.setId(id); - tree1.setName("全部影像资料(" + scanAssortVos.size() + ")"); - tree1.setCount(scanAssortVos.size()); - //定义图片集合 - String scanPathList = ""; - //定义绝对路径集合 - String srcs = ""; - //定义分类名称集合 - String assortNames = ""; - if (null != scanAssortVos && !scanAssortVos.isEmpty()) { - //定义图片分类不重复结合 - Set assortNameSet = new LinkedHashSet<>(); - for (ScanAssortVo scanAssort : scanAssortVos) { - if (StringUtils.isNotBlank(scanAssort.getAssortName())) { - assortNameSet.add(scanAssort.getAssortName()); - scanPathList += scanAssort.getScanPage() + ","; - srcs += scanAssort.getRootPath() + "\\" + scanAssort.getScanPage() + ","; - assortNames += scanAssort.getAssortName() + ","; - } + public String getIcdCodeByCodeOrName(String code, String name) throws Exception{ + List icdCodes = icdCodeMapper.selectAll(code, name); + return JSON.toJSONString(icdCodes); + } + + /** + * @MethodName: checkDiagNo + * @Description: 验证西医诊断序号是否存在 + * @Param + * @Return + * @Author: 曾文和 + * @CreateDate: 2019-06-12 + * @UpdateUser: 曾文和 + * @UpdateDate: 2019-06-12 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ + @RequestMapping(value = "checkDiagNo") + @ResponseBody + public ResultUtil checkDiagNo(String patientId, Short diagNo) throws Exception{ + if (StringUtils.isNoneBlank(patientId) && diagNo != null) { + List diags = diagService.selectAllByPatientId(patientId, diagNo); + if (diags != null && !diags.isEmpty()) { + //存在 + return ResultUtil.error(); + } else { + return ResultUtil.ok(); } - //设置图片名称集合 - tree1.setScanPageList(scanPathList); - tree1.setSrcs(srcs); - tree1.setAssortNames(assortNames); - treeList.add(tree1); - for (String assortName : assortNameSet) { - id++; - ScanDeledAssortTree tree2 = new ScanDeledAssortTree(); - tree2.setId(id); - tree2.setParentId(1); - //定义图片集合 - String scanPathList1 = ""; - String srcs1 = ""; - //定义分类图片的个数 - Integer count = 0; - for (ScanAssortVo scanAssort : scanAssortVos) { - if (StringUtils.isNotBlank(scanAssort.getAssortName())) { - if (scanAssort.getAssortName().equals(assortName)) { - scanPathList1 += scanAssort.getScanPage() + ","; - srcs1 += scanAssort.getRootPath() + "\\" + scanAssort.getScanPage() + ","; - count++; - } - } - } - tree2.setName(assortName + "(" + count + ")"); - tree2.setCount(count); - tree2.setScanPageList(scanPathList1); - tree2.setSrcs(srcs1); - tree2.setAssortNames(assortName); - treeList.add(tree2); + } + return ResultUtil.error(); + } + + /** + * @MethodName: saveDiag + * @Description: 保存西医诊断 + * @Param + * @Return + * @Author: 曾文和 + * @CreateDate: 2019-06-12 + * @UpdateUser: 曾文和 + * @UpdateDate: 2019-06-12 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ + @RequiresPermissions(value = {"/commom/addOperCode", "/commom/updateOperCode"}) + @OptionalLog(module = "保存", methods = "西医诊断编码", fieldName = "diagName") + @RequestMapping(value = "saveDiag") + @ResponseBody + public ResultUtil saveDiag(T_Diag diag, Integer isUpdateOperNo, HttpServletRequest request) throws Exception{ + if (diag.getCurrentDiagNo() == null) { + //新增 + boolean flag = FormTokenFlagUtil.isFlag(request); + if (!flag) { + return ResultUtil.error("请不要重复提交!"); + } + diagService.insert(diag); + } else { + //修改 + if (isUpdateOperNo == 1) { + //有修改序号 + //查询序号是否存在 + List diags = diagService.selectAllByPatientId(diag.getPatientId(), diag.getDiagNo()); + if (null != diags && !diags.isEmpty()) { + //存在 + return ResultUtil.error("该诊断序号已存在!"); + } else { + diagService.updateByPrimaryKeySelective(diag); + } + } else { + //诊断序号一样 + diagService.updateByPrimaryKeySelective(diag); } } - return treeList; + return ResultUtil.ok(); } + /*****************************************中医诊断********************************************************/ + /** - * @MethodName: getDeledPicRecordTree - * @Description: 组织已删除图片的病案分类树 + * @MethodName: deleteCodeByPatientIdAndDiagNo + * @Description: 根据petientId和诊断序号删除西医诊断编码对象 * @Param * @Return * @Author: 曾文和 - * @CreateDate: 2020-06-08 + * @CreateDate: 2019-06-13 * @UpdateUser: 曾文和 - * @UpdateDate: 2020-06-08 + * @UpdateDate: 2019-06-13 * @UpdateRemark: 更新说明 * @Version: 1.0 */ - @OptionalLog(module = "修改", methods = "恢复已删除图片", fieldName = "name", tableName = "commomtable") - @RequiresPermissions("/commom/recoverPic") - @RequestMapping(value="recoverPic",method = RequestMethod.POST) + @RequiresPermissions("/commom/deleteOperCode") + @OptionalLog(module = "删除", methods = "西医诊断编码", fieldName = "diagName", tableName = "t_diag") + @RequestMapping(value = "deleteCodeByPatientIdAndDiagNo") @ResponseBody - public ResultUtil recoverPic(CommomVo commomVo,String scanPages) throws Exception{ - scanAssortService.recoverPic(commomVo.getPatientId(),scanPages); - return ResultUtil.ok(); + public ResultUtil deleteCodeByPatientIdAndDiagNo(String patientId, Short diagNo) throws Exception{ + if (StringUtils.isNoneBlank(patientId) && null != diagNo) { + diagService.deleteDiagByPatientIdAndDiagNo(patientId, diagNo); + return ResultUtil.ok(); + } else { + return ResultUtil.error(); + } } - /**************************恢复已删除图片结束***********************/ - /**************************病案维护开始*****************************/ + /** - * 验证编号和协议号是否存在 - * @param commomBlood - * @return - * @throws Exception + * @MethodName: checkHerbNo + * @Description: 验证中医诊断序号是否存在 + * @Param + * @Return + * @Author: 曾文和 + * @CreateDate: 2019-06-12 + * @UpdateUser: 曾文和 + * @UpdateDate: 2019-06-12 + * @UpdateRemark: 更新说明 + * @Version: 1.0 */ - //脐血库 - @RequestMapping("validExistForm") + @RequestMapping(value = "checkHerbNo") @ResponseBody - public ResultUtil validExistForm(CommomBlood commomBlood) throws Exception{ - String patientId = commomBlood.getPatientId(); - commomBlood.setPatientId(null); - FontCommom commom = new FontCommom(); - BeanUtils.copyProperties(commomBlood,commom); - List list = commomMapper.isExistInpatient(commom); - if(!CollectionUtils.isEmpty(list)){ - //修改的情况,同一份病案返回成功 - if(StringUtils.isNotBlank(patientId) && list.get(0).getPatientId().equals(patientId)){ + public ResultUtil checkHerbNo(String patientId, Short herbNo) throws Exception{ + if (StringUtils.isNoneBlank(patientId) && herbNo != null) { + List herbDiags = herbDiagService.selectAllByPatientId(patientId, herbNo); + if (herbDiags != null && !herbDiags.isEmpty()) { + //存在 + return ResultUtil.error(); + } else { return ResultUtil.ok(); } - return ResultUtil.ok("已存在"); - } - return ResultUtil.ok(); - } - /** - * 脐血库新增档案 - * @param commomBlood - * @return - * @throws Exception - */ - @OptionalLog(module = "新增", methods = "新增档案") - @RequiresPermissions("/commom/addRecord") - @RequestMapping(value="addRecord",method = RequestMethod.POST) - @ResponseBody - public ResultUtil addRecordBlood(@Valid CommomBlood commomBlood,HttpServletRequest request) throws Exception{ - //判断formToken - boolean flag = FormTokenFlagUtil.isFlag(request); - if(!flag){ - return ResultUtil.error("请不要重复提交!"); - } - //判断表单不为空和不可重复的字段 - ResultUtil result = validFieldOper(commomBlood); - if(!result.getCode().equals(0)){ - return result; - } - //进入添加病案方法 - ResultUtil resultUtil = commomService.addRecordBlood(commomBlood, request); - //有错误返回错误信息 - if(!resultUtil.getCode().equals(0)){ - return resultUtil; } - return ResultUtil.ok(); + return ResultUtil.error(); } /** - * 加载分类树 - * @param request - * @return + * @MethodName: saveHerbDiag + * @Description: 保存中医诊断 + * @Param + * @Return + * @Author: 曾文和 + * @CreateDate: 2019-06-12 + * @UpdateUser: 曾文和 + * @UpdateDate: 2019-06-12 + * @UpdateRemark: 更新说明 + * @Version: 1.0 */ - @RequestMapping("selectRecordTree") + @RequiresPermissions(value = {"/commom/addOperCode", "/commom/updateOperCode"}) + @OptionalLog(module = "保存", methods = "中医诊断编码", fieldName = "herbName") + @RequestMapping(value = "saveHerbDiag") @ResponseBody - public List selectRecordTree(HttpServletRequest request){ - List treeList = new ArrayList<>(); - Power_User user = (Power_User)request.getSession().getAttribute("CURRENT_USER"); - try { - List assorts = assortService.selectAllByPower(user); - //第一级:全部影像资料 - Zd_Assort tree1 = new Zd_Assort(); - tree1.setAssortId("0"); - tree1.setAssortName("全部分类"); - treeList.add(tree1); - if(!CollectionUtils.isEmpty(assorts)){ - for(Zd_Assort assort : assorts){ - assort.setPrintFlag("0"); - } - treeList.addAll(assorts); - } - return treeList; - }catch (Exception e){ - e.printStackTrace(); - log.error(ExceptionUtils.getExceptionStr(e)); - return null; - } - } - - //判断表单不为空和不可重复的字段 - private ResultUtil validFieldOper(CommomBlood commomBlood) throws Exception{ - String patientId = commomBlood.getPatientId(); - //判断脐血编号不为空 - String inpatientNo = commomBlood.getInpatientNo(); - if(StringUtils.isBlank(inpatientNo)){ - return ResultUtil.error("脐血编号不能为空!"); - }else{ - FontCommom commom = new FontCommom(); - commom.setInpatientNo(inpatientNo); - List list = commomMapper.isExistInpatient(commom); - if(!CollectionUtils.isEmpty(list)){ - if(StringUtils.isNotBlank(patientId)){ - if(list.get(0).getPatientId().equals(patientId)){ - return ResultUtil.ok(); - } - } - return ResultUtil.error("脐血编号已存在!"); + public ResultUtil saveHerbDiag(T_Herb_Diag herbDiag, Integer isUpdateOperNo, HttpServletRequest request) throws Exception{ + if (herbDiag.getCurrentHerbDiagNo() == null) { + //新增 + boolean flag = FormTokenFlagUtil.isFlag(request); + if (!flag) { + return ResultUtil.error("请不要重复提交!"); } - } - //验证协议号是否存在 - String admissId = commomBlood.getAdmissId(); - if(StringUtils.isNotBlank(admissId)){ - FontCommom commom = new FontCommom(); - commom.setAdmissId(admissId); - List list = commomMapper.isExistInpatient(commom); - if(!CollectionUtils.isEmpty(list)){ - if(StringUtils.isNotBlank(patientId)){ - if(list.get(0).getPatientId().equals(patientId)){ - return ResultUtil.ok(); - } + herbDiagService.insert(herbDiag); + } else { + //修改 + if (isUpdateOperNo == 1) { + //有修改序号 + //查询序号是否存在 + List herbDiags = herbDiagService.selectAllByPatientId(herbDiag.getPatientId(), herbDiag.getHerbNo()); + if (null != herbDiags && !herbDiags.isEmpty()) { + //存在 + return ResultUtil.error("该诊断序号已存在!"); + } else { + herbDiagService.updateByPrimaryKeySelective(herbDiag); } - return ResultUtil.error("协议号已存在!"); + } else { + //诊断序号一样 + herbDiagService.updateByPrimaryKeySelective(herbDiag); } } - //判断孕妇姓名不为空 - if(StringUtils.isBlank(commomBlood.getName())){ - return ResultUtil.error("孕妇姓名不能为空!"); - } return ResultUtil.ok(); } - @OptionalLog(module = "修改", methods = "修改档案",fieldName = "name",tableName = "commomtable") - @RequiresPermissions("/commom/updateRecord") - @RequestMapping(value="updateRecordBlood",method = RequestMethod.POST) + /** + * @MethodName: deleteCodeByPatientIdAndHerbNo + * @Description: 根据petientId和诊断序号删除中医诊断编码对象 + * @Param + * @Return + * @Author: 曾文和 + * @CreateDate: 2019-06-13 + * @UpdateUser: 曾文和 + * @UpdateDate: 2019-06-13 + * @UpdateRemark: 更新说明 + * @Version: 1.0 + */ + @RequiresPermissions("/commom/deleteOperCode") + @OptionalLog(module = "删除", methods = "中医诊断编码", fieldName = "herbName", tableName = "t_herb_diag") + @RequestMapping(value = "deleteCodeByPatientIdAndHerbNo") @ResponseBody - public ResultUtil updateRecordBlood(CommomBlood commomBlood) throws Exception{ - //判断表单不为空和不可重复的字段 - ResultUtil resultUtil = validFieldOper(commomBlood); - if(!resultUtil.getCode().equals(0)){ - return resultUtil; + public ResultUtil deleteCodeByPatientIdAndHerbNo(String patientId, Short herbNo) throws Exception{ + if (StringUtils.isNoneBlank(patientId) && null != herbNo) { + herbDiagService.deleteHerbDiagByPatientIdAndHerbNo(patientId, herbNo); + return ResultUtil.ok(); + } else { + return ResultUtil.error(); } - CommomVo commomVo = new CommomVo(); - BeanUtils.copyProperties(commomBlood,commomVo); - commomService.updateRecord(commomVo); - return ResultUtil.ok(); } - - @OptionalLog(module = "删除", methods = "删除档案",fieldName = "name",tableName = "commomtable") - @RequiresPermissions("/commom/deleteRecord") - @RequestMapping(value="deleteRecordBlood",method = RequestMethod.POST) - @ResponseBody - public ResultUtil deleteRecordBlood(String patientId) throws Exception{ - commomService.deleteRecord(patientId); - return ResultUtil.ok(); + /*******************第一版本手术、诊断操作结束**********************/ + //阿拉伯数字转中文 + private static String toChinese(String str) { + String[] s1 = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"}; + String[] s2 = {"十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千"}; + String result = ""; + int n = str.length(); + for (int i = 0; i < n; i++) { + int num = str.charAt(i) - '0'; + if (i != n - 1 && num != 0) { + result += s1[num] + s2[n - 2 - i]; + } else { + result += s1[num]; + } + } + return result; } - /**************************病案维护结束*****************************/ } diff --git a/src/main/java/com/emr/dao/emrPdfWaterSet/EmrPdfWaterSetMapper.xml b/src/main/java/com/emr/dao/emrPdfWaterSet/EmrPdfWaterSetMapper.xml index cda8b3a..2715ea3 100644 --- a/src/main/java/com/emr/dao/emrPdfWaterSet/EmrPdfWaterSetMapper.xml +++ b/src/main/java/com/emr/dao/emrPdfWaterSet/EmrPdfWaterSetMapper.xml @@ -12,19 +12,25 @@ + + + + + - id, effective, up_or_under, transparent, text, text_x, text_y, text_color, text_size, - text_rotation, img_file, img_width, img_height, img_x, img_y, unique_id + id, effective, up_or_under, transparent, text, text_x, text_y, text_color, text_size, + text_rotation, is_img, img_file, img_width, img_height, img_x, img_y, unique_id, + download_effective, download_is_img, print_effective, print_is_img select @@ -38,20 +40,22 @@ where id = #{id,jdbcType=INTEGER} - insert into emr_pdf_water_set (id, effective, download_effective, - up_or_under, transparent, text, - text_x, text_y, text_color, - text_size, text_rotation, is_img, - download_is_img, img_file, img_width, - img_height, img_x, img_y, - unique_id) - values (#{id,jdbcType=INTEGER}, #{effective,jdbcType=SMALLINT}, #{downloadEffective,jdbcType=SMALLINT}, - #{upOrUnder,jdbcType=SMALLINT}, #{transparent,jdbcType=REAL}, #{text,jdbcType=NVARCHAR}, - #{textX,jdbcType=INTEGER}, #{textY,jdbcType=INTEGER}, #{textColor,jdbcType=NVARCHAR}, - #{textSize,jdbcType=INTEGER}, #{textRotation,jdbcType=INTEGER}, #{isImg,jdbcType=SMALLINT}, - #{downloadIsImg,jdbcType=SMALLINT}, #{imgFile,jdbcType=NVARCHAR}, #{imgWidth,jdbcType=INTEGER}, - #{imgHeight,jdbcType=INTEGER}, #{imgX,jdbcType=INTEGER}, #{imgY,jdbcType=INTEGER}, - #{uniqueId,jdbcType=NVARCHAR}) + insert into emr_pdf_water_set (id, effective, up_or_under, + transparent, text, text_x, + text_y, text_color, text_size, + text_rotation, is_img, img_file, + img_width, img_height, img_x, + img_y, unique_id, download_effective, + download_is_img, print_effective, print_is_img + ) + values (#{id,jdbcType=INTEGER}, #{effective,jdbcType=SMALLINT}, #{upOrUnder,jdbcType=SMALLINT}, + #{transparent,jdbcType=REAL}, #{text,jdbcType=NVARCHAR}, #{textX,jdbcType=INTEGER}, + #{textY,jdbcType=INTEGER}, #{textColor,jdbcType=NVARCHAR}, #{textSize,jdbcType=INTEGER}, + #{textRotation,jdbcType=INTEGER}, #{isImg,jdbcType=SMALLINT}, #{imgFile,jdbcType=NVARCHAR}, + #{imgWidth,jdbcType=INTEGER}, #{imgHeight,jdbcType=INTEGER}, #{imgX,jdbcType=INTEGER}, + #{imgY,jdbcType=INTEGER}, #{uniqueId,jdbcType=NVARCHAR}, #{downloadEffective,jdbcType=SMALLINT}, + #{downloadIsImg,jdbcType=SMALLINT}, #{printEffective,jdbcType=SMALLINT}, #{printIsImg,jdbcType=SMALLINT} + ) insert into emr_pdf_water_set @@ -62,9 +66,6 @@ effective, - - download_effective, - up_or_under, @@ -92,9 +93,6 @@ is_img, - - download_is_img, - img_file, @@ -113,6 +111,18 @@ unique_id, + + download_effective, + + + download_is_img, + + + print_effective, + + + print_is_img, + @@ -121,9 +131,6 @@ #{effective,jdbcType=SMALLINT}, - - #{downloadEffective,jdbcType=SMALLINT}, - #{upOrUnder,jdbcType=SMALLINT}, @@ -151,9 +158,6 @@ #{isImg,jdbcType=SMALLINT}, - - #{downloadIsImg,jdbcType=SMALLINT}, - #{imgFile,jdbcType=NVARCHAR}, @@ -172,6 +176,18 @@ #{uniqueId,jdbcType=NVARCHAR}, + + #{downloadEffective,jdbcType=SMALLINT}, + + + #{downloadIsImg,jdbcType=SMALLINT}, + + + #{printEffective,jdbcType=SMALLINT}, + + + #{printIsImg,jdbcType=SMALLINT}, + @@ -180,9 +196,6 @@ effective = #{effective,jdbcType=SMALLINT}, - - download_effective = #{downloadEffective,jdbcType=SMALLINT}, - up_or_under = #{upOrUnder,jdbcType=SMALLINT}, @@ -210,9 +223,6 @@ is_img = #{isImg,jdbcType=SMALLINT}, - - download_is_img = #{downloadIsImg,jdbcType=SMALLINT}, - img_file = #{imgFile,jdbcType=NVARCHAR}, @@ -231,13 +241,24 @@ unique_id = #{uniqueId,jdbcType=NVARCHAR}, + + download_effective = #{downloadEffective,jdbcType=SMALLINT}, + + + download_is_img = #{downloadIsImg,jdbcType=SMALLINT}, + + + print_effective = #{printEffective,jdbcType=SMALLINT}, + + + print_is_img = #{printIsImg,jdbcType=SMALLINT}, + where id = #{id,jdbcType=INTEGER} update emr_pdf_water_set set effective = #{effective,jdbcType=SMALLINT}, - download_effective = #{downloadEffective,jdbcType=SMALLINT}, up_or_under = #{upOrUnder,jdbcType=SMALLINT}, transparent = #{transparent,jdbcType=REAL}, text = #{text,jdbcType=NVARCHAR}, @@ -247,13 +268,16 @@ text_size = #{textSize,jdbcType=INTEGER}, text_rotation = #{textRotation,jdbcType=INTEGER}, is_img = #{isImg,jdbcType=SMALLINT}, - download_is_img = #{downloadIsImg,jdbcType=SMALLINT}, img_file = #{imgFile,jdbcType=NVARCHAR}, img_width = #{imgWidth,jdbcType=INTEGER}, img_height = #{imgHeight,jdbcType=INTEGER}, img_x = #{imgX,jdbcType=INTEGER}, img_y = #{imgY,jdbcType=INTEGER}, - unique_id = #{uniqueId,jdbcType=NVARCHAR} + unique_id = #{uniqueId,jdbcType=NVARCHAR}, + download_effective = #{downloadEffective,jdbcType=SMALLINT}, + download_is_img = #{downloadIsImg,jdbcType=SMALLINT}, + print_effective = #{printEffective,jdbcType=SMALLINT}, + print_is_img = #{printIsImg,jdbcType=SMALLINT} where id = #{id,jdbcType=INTEGER} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml b/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml index 93cd155..6812e8d 100644 --- a/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml +++ b/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml @@ -46,6 +46,16 @@ + + + + + + + + + +
- +
- +
- +
- - +
- +
- +
+
+
+
+ +
+
+ + +
+
+

@@ -183,6 +196,31 @@
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ + + + + +
+
+
@@ -206,7 +244,7 @@
- +
- +
-
-
-
- -
-
- - - - - -
-
-
diff --git a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecord174.jsp b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecord174.jsp index d82c74e..e563df3 100644 --- a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecord174.jsp +++ b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecord174.jsp @@ -155,8 +155,11 @@ - - + + + + +
@@ -243,6 +246,11 @@
+ + +
@@ -875,5 +883,6 @@
+ diff --git a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordBlood.jsp b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordBlood.jsp index 3e8a113..0a698f5 100644 --- a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordBlood.jsp +++ b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordBlood.jsp @@ -135,7 +135,10 @@ + + +
@@ -447,4 +450,5 @@ --%> + diff --git a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframe.jsp b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframe.jsp index 547e0fd..d09c31f 100644 --- a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframe.jsp +++ b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframe.jsp @@ -43,8 +43,10 @@ - - + + + +
@@ -76,7 +78,7 @@ <%––%>
--%> - +
diff --git a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframeBlood.jsp b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframeBlood.jsp index b0bc669..479bb18 100644 --- a/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframeBlood.jsp +++ b/src/main/webapp/WEB-INF/views/recordManage/commomSearch/showRecordIframeBlood.jsp @@ -52,6 +52,10 @@ + + + +
@@ -95,5 +99,6 @@
+ diff --git a/src/main/webapp/static/img/000239.jpg b/src/main/webapp/static/img/000239.jpg new file mode 100644 index 0000000..c3207c8 Binary files /dev/null and b/src/main/webapp/static/img/000239.jpg differ diff --git a/src/main/webapp/static/js/recordManage/commomSearch/showRecord174.js b/src/main/webapp/static/js/recordManage/commomSearch/showRecord174.js index 3d04578..85fb5e3 100644 --- a/src/main/webapp/static/js/recordManage/commomSearch/showRecord174.js +++ b/src/main/webapp/static/js/recordManage/commomSearch/showRecord174.js @@ -1,21 +1,3 @@ -//屏蔽鼠标右键 -document.oncontextmenu = function(e) { - var e = e || window.event; - e.returnValue = false; - return false; -} -//禁止快捷键打印 -function disabledPrint(){ - if(event.keyCode==80 && event.ctrlKey){ - event.keyCode=0; - event.returnValue=false; - } - if (event.ctrlKey && event.keyCode == 83) { - event.preventDefault(); - event.returnValue = false; - return false; - } -} //初始化函数 $(function(){ //加载其他诊断名称鼠标滑过显示全部文本 @@ -49,7 +31,7 @@ function loadRecord(){ $.ajax({ type:'get', url:path+'/commom/getRecord', - data:{patientId:$("#patientId").val()}, + data:{patientId:$("#patientId").val(),flag:$("#flag").val()}, async:false, dataType:'json', success:function (data) { @@ -63,6 +45,26 @@ function loadRecord(){ $("#disDate").val(data.disDate); $("#disDeptName").val(data.disDept); $("#diagName").val(data.mainDiagName); + var delCount = data.delCount; + //不为空,有已删除的图片,显示恢复图片按钮 + if(delCount != null){ + $("#recoverPic").show(); + } + //判断哪家医院赋值扫描图片和新上传图片的根目录集合 + var flag = $("#flag").val(); + var rootPaths = ""; + if(flag != '' && flag == 'home_addr'){ + //脐血库 + rootPaths = data.homeAddr + ","; + }else if(flag != '' && flag == 'file_path'){ + //祈福医院 + rootPaths = data.filePath + ","; + } + //拼接新上传图片根目录 + if(data.newFile != null && data.newFile != ''){ + rootPaths += data.newFile; + } + $("#rootPaths").val(rootPaths); //$("#otherDiagName").val(data.otherDiagName); } } diff --git a/src/main/webapp/static/js/recordManage/commomSearch/showRecordBlood.js b/src/main/webapp/static/js/recordManage/commomSearch/showRecordBlood.js index fc9fd6d..a7bcea8 100644 --- a/src/main/webapp/static/js/recordManage/commomSearch/showRecordBlood.js +++ b/src/main/webapp/static/js/recordManage/commomSearch/showRecordBlood.js @@ -1,21 +1,3 @@ -//屏蔽鼠标右键 -document.oncontextmenu = function(e) { - var e = e || window.event; - e.returnValue = false; - return false; -} -//禁止快捷键打印 -function disabledPrint(){ - if(event.keyCode==80 && event.ctrlKey){ - event.keyCode=0; - event.returnValue=false; - } - if (event.ctrlKey && event.keyCode == 83) { - event.preventDefault(); - event.returnValue = false; - return false; - } -} //初始化函数 $(function(){ //加载病案信息 @@ -57,6 +39,21 @@ function loadRecord(){ if(delCount != null){ $("#recoverPic").show(); } + //判断哪家医院赋值扫描图片和新上传图片的根目录集合 + var flag = $("#flag").val(); + var rootPaths = ""; + if(flag != '' && flag == 'home_addr'){ + //脐血库 + rootPaths = data.homeAddr + ","; + }else if(flag != '' && flag == 'file_path'){ + //祈福医院 + rootPaths = data.filePath + ","; + } + //拼接新上传图片根目录 + if(data.newFile != null && data.newFile != ''){ + rootPaths += data.newFile; + } + $("#rootPaths").val(rootPaths); } } }) diff --git a/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBlood.js b/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBlood.js index 2fe6f6e..b89c26b 100644 --- a/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBlood.js +++ b/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBlood.js @@ -110,6 +110,11 @@ $("#typeId").change(function(){ }) //加载pdf按钮功能 function onloadPdf(){ + $("#iframeLoad").val(""); + $("#printPicLoaded").val(""); + if($("#iframeLoad").val() == 1) { + window.frames['iframe1'].contentDocument.getElementById("printContainer1").innerHTML = ''; + } var patientId = $("#patientId").val(); //图片集合 var scanPages = $("#assortIds").val(); @@ -119,6 +124,65 @@ function onloadPdf(){ var flag = parent.$("#flag").val(); var str= path+"/commom/showRecordContentBlood?patientId="+patientId+"&scanPages="+scanPages+"&sources="+sources+"&flag="+flag; $("#iframe1").attr("src",path+"/static/pdfjs/web/viewer1.html?file="+encodeURIComponent(str)); + var rootPaths = parent.$("#rootPaths").val(); + //获取加水印后的图片 + if(scanPages != ''){ + selectPrintPic(patientId,rootPaths,scanPages,sources); + } +} + +/** + * 加载打印预览所需图片 + */ +function selectPrintPic(patientId,rootPaths,scanPages,sources){ + $.ajax({ + type:'post', + url:path+"/commom/selectPrintPic", + data:{ + patientId:patientId, + rootPaths:rootPaths, + names:scanPages, + sources:sources + }, + datType:'json', + success:function(data){ + if(data.code == 0){ + var resultList = data.data; + if(null != resultList){ + var img = ''; + for (var i = 0; i < resultList.length; i++) { + img += ""; + } + setInterval(function () { + if($("#iframeLoad").val() == 1 && $("#printPicLoaded").val() != 1) { + window.frames['iframe1'].contentDocument.getElementById("printContainer1").innerHTML = img; + $("#printPicLoaded").val(1); + } + },1*1000); + + } + } + } + }) +} +var iframe = window.frames['iframe1']; +if(iframe.attachEvent){ + iframe.attachEvent("onreadystatechange", function() { + //此事件在内容没有被载入时候也会被触发,所以我们要判断状态 + //有时候会比较怪异 readyState状态会跳过 complete 所以我们loaded状态也要判断 + if (iframe.readyState === "complete" || iframe.readyState == "loaded") { + //代码能执行到这里说明已经载入成功完毕了 + //要清除掉事件 + iframe.detachEvent("onreadystatechange", arguments.callee); + //这里是回调函数 + } + }); +}else{ + iframe.addEventListener("load", function() { + $("#iframeLoad").val(1); + //代码能执行到这里说明已经载入成功完毕了 + this.removeEventListener("load", arguments.call, false); + }, false); } //下载pdf按钮功能 function onloadJpgForPdf(){ @@ -231,22 +295,4 @@ function printInfoBlood(){ } } }) -} -//屏蔽鼠标右键 -// document.oncontextmenu = function(e) { -// var e = e || window.event; -// e.returnValue = false; -// return false; -// } -//禁止快捷键打印 -function disabledPrint(){ - if(event.keyCode==80 && event.ctrlKey){ - event.keyCode=0; - event.returnValue=false; - } - if (event.ctrlKey && event.keyCode == 83) { - event.preventDefault(); - event.returnValue = false; - return false; - } } \ No newline at end of file diff --git a/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js b/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js index f04490a..bb64c1b 100644 --- a/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js +++ b/src/main/webapp/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js @@ -16,195 +16,3 @@ function disabledPrint(){ return false; } } -//树操作 -var menu = { - setting: { - view:{ - fontCss : {"font-family": "微软雅黑","color":"blue"} - }, - data:{ - key:{ - name:"assortName" - }, - simpleData: { - chkStyle: "checkbox", - enable: true, - idKey: "id", - pIdKey: "parentId", - }, - }, - check:{ - enable:true - }, - callback: { //回调函数 - onCheck: onCheck } - }, - loadMenuTree:function(){ - $.ajax({ - type: "post", - url:path+"/commom/getRecordTree", - data:{patientId:$("#patientId").val(),typeId:$("#typeId").val()}, - dataType:"json", - success:function(data){ - $("#assortIds").val(""); - if(data != null){ - var assortIds = ''; - for (var i = 0; i < data.length; i++) { - if(data[i].parentId != null && data[i].parentId != 1 && data[i].checked == 'true'){ - assortIds += data[i].assortName+","; - } - } - if(assortIds != ''){ - assortIds = assortIds.substring(0,assortIds.length-1); - $("#assortIds").val(assortIds); - } - $.fn.zTree.init($("#ztree"), menu.setting, data); - zTree = $.fn.zTree.getZTreeObj("ztree"); - var nodes = zTree.getNodes(); - for (var i = 0; i < nodes.length; i++) { //设置节点展开 - zTree.expandNode(nodes[i], true, false, true); - } - //加载pdf - onloadPdf(); - } - } - }) - } -}; -//加载树 -$().ready(function(data){ - menu.loadMenuTree(); - //loadFilePath(); -}); - - -//树选中事件 -function onCheck(e, treeId, treeNode) { - var treeObj=$.fn.zTree.getZTreeObj("ztree"); - nodes=treeObj.getCheckedNodes(true); - var assortIds = ''; - for (var i = 0; i < nodes.length; i++) { - if(nodes[i].level == 2){ - if(i == 0){ - assortIds = nodes[i].assortName+","; - }else{ - if(i != (nodes.length-1)){ - assortIds += nodes[i].assortName+","; - }else{ - assortIds += nodes[i].assortName; - } - } - } - } - $("#assortIds").val(assortIds); -}; -//打印分类变更事件 -$("#typeId").change(function(){ - menu.loadMenuTree(); -}) -//记录打印记录 -function printInfoBlood(){ - var patientId = "'"+$("#patientId").val()+"'"; - var assortIds = $("#assortIds").val(); - var typeId = $("#typeId").val(); - post(path+'/template/printInfoBlood',{"patientIds":patientId,"assortIds":assortIds,"typeId":typeId}); -} -//确定按钮功能 -function sure(){ - Common.confirm({ - title: "提示", - message: "确认将左侧树选中的图片是否重新归页?", - operate: function (reselt) { - if (reselt) { - //pdf页数 - var newAssortId = $("#newAssortId").val(); - if (newAssortId != '') { - var patientId = $("#patientId").val(); - var assortIds = $("#assortIds").val(); - if(assortIds != ''){ - $.ajax({ - type: 'post', - url: path + '/commom/updateScanAssortByBlood', - data: {patientId: patientId, assortIds: assortIds,newAssortId: newAssortId}, - dataType: 'json', - success: function (data) { - if (data.code == 0) { - toastr.success("重新归页成功!"); - } - //重新加载 - menu.loadMenuTree(); - } - }) - }else{ - toastr.warning("左侧树至少选中一张图片!") - } - } else { - toastr.warning("要重新分页,需选中其中下拉框其中一项!") - } - } - } - }) -} -function delPic(){ - Common.confirm({ - title: "提示", - message: "确认将左侧树选中的图片删除,删除就不可恢复?", - operate: function (reselt) { - if (reselt) { - var patientId = $("#patientId").val(); - var assortIds = $("#assortIds").val(); - if(assortIds != '') { - $.ajax({ - type: 'post', - url: path + '/commom/delScanAssortByBlood', - data: {patientId: patientId, assortIds: assortIds}, - dataType: 'json', - success: function (data) { - if (data.code == 0) { - toastr.success("删除成功!"); - } - //重新加载 - menu.loadMenuTree(); - } - }) - } - } - } - }) -} -/* -//确定按钮功能 -function sure(){ - Common.confirm({ - title: "提示", - message: "确认是否重新归页?", - operate: function (reselt) { - if (reselt) { - //pdf页数 - var index = $("#iframe1").contents().find("#pageNumber").val(); - var newAssortId = $("#newAssortId").val(); - if (newAssortId != '') { - if (index != '' && index != null) { - var patientId = $("#patientId").val(); - var assortIds = $("#assortIds").val(); - $.ajax({ - type: 'post', - url: path + '/commom/updateScanAssort', - data: {patientId: patientId, assortIds: assortIds, index: index, newAssortId: newAssortId}, - dataType: 'json', - success: function (data) { - if (data.code == 0) { - toastr.success("重新归页成功!"); - } - //重新加载 - menu.loadMenuTree(); - } - }) - } - } else { - toastr.warning("要重新分页,需选中其中下拉框其中一项!") - } - } - } - }) -}*/ diff --git a/src/main/webapp/static/pdfjs/Print.js b/src/main/webapp/static/pdfjs/Print.js new file mode 100644 index 0000000..a0a9baf --- /dev/null +++ b/src/main/webapp/static/pdfjs/Print.js @@ -0,0 +1,124 @@ +/* @Print.js + * DH (http://denghao.me) + * 2017-7-14 + */ +(function (window, document) { + var Print = function (dom, options) { + if (!(this instanceof Print)) return new Print(dom, options); + + this.options = this.extend({ + noPrint: '.no-print', + onStart: function () { }, + onEnd: function () { } + }, options); + + if ((typeof dom) === "string") { + this.dom = document.querySelector(dom); + } else { + this.dom = dom; + } + + this.init(); + }; + Print.prototype = { + init: function () { + var content = this.getStyle() + this.getHtml(); + this.writeIframe(content); + }, + extend: function (obj, obj2) { + for (var k in obj2) { + obj[k] = obj2[k]; + } + return obj; + }, + + getStyle: function () { + var str = "", + styles = document.querySelectorAll('style,link'); + for (var i = 0; i < styles.length; i++) { + str += styles[i].outerHTML; + } + str += ""; + + return str; + }, + + getHtml: function () { + var inputs = document.querySelectorAll('input'); + var textareas = document.querySelectorAll('textarea'); + var selects = document.querySelectorAll('select'); + + for (var k in inputs) { + if (inputs[k].type == "checkbox" || inputs[k].type == "radio") { + if (inputs[k].checked == true) { + inputs[k].setAttribute('checked', "checked") + } else { + inputs[k].removeAttribute('checked') + } + } else if (inputs[k].type == "text") { + inputs[k].setAttribute('value', inputs[k].value) + } + } + + for (var k2 in textareas) { + if (textareas[k2].type == 'textarea') { + textareas[k2].innerHTML = textareas[k2].value + } + } + + for (var k3 in selects) { + if (selects[k3].type == 'select-one') { + var child = selects[k3].children; + for (var i in child) { + if (child[i].tagName == 'OPTION') { + if (child[i].selected == true) { + child[i].setAttribute('selected', "selected") + } else { + child[i].removeAttribute('selected') + } + } + } + } + } + + return this.dom.outerHTML; + }, + + writeIframe: function (content) { + var w, doc, iframe = document.createElement('iframe'), + f = document.body.appendChild(iframe); + iframe.id = "myIframe"; + iframe.style = "position:absolute;width:0;height:0;top:-10px;left:-10px;"; + + w = f.contentWindow || f.contentDocument; + doc = f.contentDocument || f.contentWindow.document; + doc.open(); + doc.write(content); + doc.close(); + this.toPrint(w, function () { + document.body.removeChild(iframe) + }); + }, + + toPrint: function (w, cb) { + var _this = this; + w.onload = function () { + try { + setTimeout(function () { + w.focus(); + typeof _this.options.onStart === 'function' && _this.options.onStart(); + if (!w.document.execCommand('print', false, null)) { + w.print(); + } + typeof _this.options.onEnd === 'function' && _this.options.onEnd(); + w.close(); + cb && cb() + }); + } catch (err) { + console.log('err', err); + } + } + } + }; + window.Print = Print; +}(window, document)); \ No newline at end of file diff --git a/src/main/webapp/static/pdfjs/build/pdf.js b/src/main/webapp/static/pdfjs/build/pdf.js index c6ffc51..ea2f30b 100644 --- a/src/main/webapp/static/pdfjs/build/pdf.js +++ b/src/main/webapp/static/pdfjs/build/pdf.js @@ -13,13 +13,13 @@ function loadPdf() { } } //屏蔽鼠标右键 -document.oncontextmenu = function(e) { +/*document.oncontextmenu = function(e) { var e = e || window.event; e.returnValue = false; return false; -} +}*/ //禁止快捷键打印 -function disabledPrint(){ +/*function disabledPrint(){ if(event.keyCode==80 && event.ctrlKey){ event.keyCode=0; event.returnValue=false; @@ -29,7 +29,7 @@ function disabledPrint(){ event.returnValue = false; return false; } -} +}*/ document.onkeydown = function(e) { //快捷键ctrl+上图片放大 if (38 == e.keyCode && e.ctrlKey) { diff --git a/src/main/webapp/static/pdfjs/web/viewer1.html b/src/main/webapp/static/pdfjs/web/viewer1.html index fe0cd26..6954b78 100644 --- a/src/main/webapp/static/pdfjs/web/viewer1.html +++ b/src/main/webapp/static/pdfjs/web/viewer1.html @@ -45,6 +45,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/ +
- <!– TODO: Localise the following strings –> - Preparing document for printing... + 打印加载中...
0% @@ -470,12 +472,23 @@ http://sourceforge.net/adobe/cmap/wiki/License/
diff --git a/src/main/webapp/static/pdfjs/web/viewer1.js b/src/main/webapp/static/pdfjs/web/viewer1.js index b744998..44fbbe2 100644 --- a/src/main/webapp/static/pdfjs/web/viewer1.js +++ b/src/main/webapp/static/pdfjs/web/viewer1.js @@ -1883,7 +1883,22 @@ var SecondaryToolbar = { }, printClick: function secondaryToolbarPrintClick(evt) { - window.print(); + //window.print(); + //是否打印预览图片加载完成标识 + var printPicLoaded = parent.$("#printPicLoaded").val(); + if(printPicLoaded == 1){ + Print('#printContainer1', { + onStart: function () { + console.log('onStart', new Date()) + }, + onEnd: function () { + console.log('onEnd', new Date()) + $("#printContainer1").hide(); + } + }) + }else{ + alert("预览图片未加载完,请稍后再试"); + } this.close(); },