소스 검색

生成新结构诊断依据

kongwz 4 년 전
부모
커밋
a1be1c3cdc
1개의 변경된 파일31개의 추가작업 그리고 5개의 파일을 삭제
  1. 31 5
      src/main/java/com/diagbot/facade/KlDiagnoseDetailFacade.java

+ 31 - 5
src/main/java/com/diagbot/facade/KlDiagnoseDetailFacade.java

@@ -37,7 +37,7 @@ public class KlDiagnoseDetailFacade extends KlDiagnoseDetailServiceImpl {
     public void exportDiagnose(HttpServletResponse response) {
         // 获取全部数据、分组
         List<KlDiagnoseDetail> klDiagnoseDetailList = klDiagnoseDetailFacade.list(new QueryWrapper<KlDiagnoseDetail>()
-                .eq("dis_name", "急性化脓性扁桃体炎")
+//                .eq("dis_name", "急性化脓性扁桃体炎")
                 .eq("is_deleted", IsDeleteEnum.N.getKey()));
         Map<String, List<KlDiagnoseDetail>> diagnoseDetailMap = EntityUtil.makeEntityListMap(klDiagnoseDetailList, "disName");
         // TODO 获取公式,分隔编码,替换编码,组装导出数据  Map<String, List<ExportDiagnoseDTO>>
@@ -113,22 +113,48 @@ public class KlDiagnoseDetailFacade extends KlDiagnoseDetailServiceImpl {
                 klDiagnoseDetail.setCode(maxCodeArray[0]+"."+max);
                 klDiagnoseDetail.setStandard(relation);
                 klDiagnoseDetails.add(klDiagnoseDetail);
+                codes.add(maxCodeArray[0]+"."+max);
             }
+
         }
+        Map<String,List<String>> typeCodeMap = new HashMap<>();//A --> [1.0,1.1,1.2,1.3]
         for (Map.Entry<Integer, List<KlDiagnoseDetail>> tdd : typeDiagnoseDetails.entrySet()) {
             List<KlDiagnoseDetail> klDiagnoseDetails = tdd.getValue();
             for (KlDiagnoseDetail kdl:klDiagnoseDetails) {
                 Integer type = kdl.getType();
                 String code = kdl.getCode();
+                String typeName = DiagnoseLexiconTypeEnum.getName(type);//A:症状
+
                 ExportDiagnoseDTO exportDiagnoseDTO = new ExportDiagnoseDTO();
                 BeanUtil.copyProperties(kdl, exportDiagnoseDTO);
-                String typeName = DiagnoseLexiconTypeEnum.getName(type);
+
                 if (type == 91 || type == 92 || type == 93) {
                     ReflectUtil.setProperty(exportDiagnoseDTO, "type", typeName);
-                    exportDiagnoseDTO.setRule(kdl.getFormula());
+                    exportDiagnoseDTO.setRule(kdl.getFormula().replaceAll("/","、")
+                    .replaceAll("\\(","[").replaceAll("\\)","]"));
                 }else {
-                    ReflectUtil.setProperty(exportDiagnoseDTO, "type", typeName.split(":")[1]);
-                    ReflectUtil.setProperty(exportDiagnoseDTO, "orderNo", typeName.split(":")[0]+code.split("\\.")[1]);
+                    String tName = typeName.split(":")[1];//症状
+                    String tType = typeName.split(":")[0];//A
+                    String tCode = code.split("\\.")[1];
+                    if(typeCodeMap.containsKey(tType)){
+                        List<String> codes = typeCodeMap.get(tType);
+                        List<String> collect = codes.stream().map(z -> z.split("\\.")[1]).sorted().collect(Collectors.toList());
+                        if(collect.contains(tCode)){
+                            String maxCode = collect.get(collect.size()-1);
+                            tCode = String.valueOf(Integer.parseInt(maxCode)+1);
+                            codes.add(String.valueOf(type)+"."+tCode);
+
+                        }else {
+                            codes.add(String.valueOf(type)+"."+tCode);
+                        }
+                        typeCodeMap.put(tType,codes);
+                    }else {
+                        List<String> codes = Lists.newArrayList();
+                        codes.add(String.valueOf(type)+"."+tCode);
+                        typeCodeMap.put(tType,codes);
+                    }
+                    ReflectUtil.setProperty(exportDiagnoseDTO, "type", tName);
+                    ReflectUtil.setProperty(exportDiagnoseDTO, "orderNo", tType+String.valueOf(tCode));
                     if (code.startsWith("3.") || code.startsWith("4.")) {
                         exportDiagnoseDTO.setRule(kdl.getRelation());
                         exportDiagnoseDTO.setRelation("");