Browse Source

北仑:日常病程录的解析处理优化

wangsy 4 years ago
parent
commit
3e11ecfdde
1 changed files with 47 additions and 16 deletions
  1. 47 16
      trans/src/main/java/com/lantone/qc/trans/beilun/BeilunDocTrans.java

+ 47 - 16
trans/src/main/java/com/lantone/qc/trans/beilun/BeilunDocTrans.java

@@ -27,12 +27,14 @@ public class BeilunDocTrans extends DocTrans {
     @Override
     protected InputInfo extract(QueryVo queryVo) {
         InputInfo inputInfo = new InputInfo();
+
+        List<MedrecVo> medrecVoList = new ArrayList<>();
         for (MedrecVo i : queryVo.getMedrec()) {
             if (i.getTitle() != null && i.getTitle().equals("查房记录")) {
                 List<Map<String, Object>> contentMaps = (List) i.getContent().get("content");
                 contentMaps.forEach(contentMap -> {
                     try {
-                        threeLevelWardAnalyse(queryVo, contentMaps, contentMap);
+                        threeLevelWardAnalyse(queryVo, medrecVoList, contentMap);
                     } catch (Exception e) {
                         log.error(e.getMessage(), e);
                     }
@@ -40,6 +42,12 @@ public class BeilunDocTrans extends DocTrans {
             }
         }
 
+        if (medrecVoList.size() > 0 && medrecVoList != null) {
+            for (MedrecVo i : medrecVoList) {
+                queryVo.getMedrec().add(i);
+            }
+        }
+
         for (MedrecVo i : queryVo.getMedrec()) {
             if (i.getTitle() != null) {
                 if (i.getTitle().equals("会诊")) {
@@ -276,33 +284,36 @@ public class BeilunDocTrans extends DocTrans {
         }
     }
 
-    private void threeLevelWardAnalyse(QueryVo queryVo, List<Map<String, Object>> contentMaps, Map<String, Object> contentMap) {
+    private void threeLevelWardAnalyse(QueryVo queryVo, List<MedrecVo> medrecVoList, Map<String, Object> contentMap) {
         String recTitle = contentMap.get("recTitle").toString();
         if (StringUtil.isNotBlank(recTitle)) {
             if (recTitle.contains("会诊记录")) {
-                consultationAnalyseMap(queryVo, contentMaps, contentMap, "会诊记录");
+                consultationAnalyseMap(queryVo, medrecVoList, contentMap, "会诊记录", "会诊");
             }
             if (recTitle.contains("输血制品病程") || recTitle.contains("输血记录") || recTitle.contains("输血病程记录")) {
-                commonAnalyseList(queryVo, contentMaps, contentMap, "输血/血制品病程记录");
+                commonAnalyseList(queryVo, medrecVoList, contentMap, "输血/血制品病程记录");
             }
             if (recTitle.contains("输血") && (recTitle.contains("评价") || recTitle.contains("评估"))) {
-                commonAnalyseList(queryVo, contentMaps, contentMap, "输血后效果评价");
+                commonAnalyseList(queryVo, medrecVoList, contentMap, "输血后效果评价");
             }
             if (recTitle.contains("术后首次") && recTitle.contains("病程")) {
-                consultationAnalyseMap(queryVo, contentMaps, contentMap, "术后首次病程及谈话记录");
+                consultationAnalyseMap(queryVo, medrecVoList, contentMap, "术后首次病程及谈话记录", "手术");
             }
             if (recTitle.contains("危急值") && recTitle.contains("记录")) {
-                commonAnalyseList(queryVo, contentMaps, contentMap, "危急值记录");
+                commonAnalyseList(queryVo, medrecVoList, contentMap, "危急值记录");
             }
         }
     }
 
     //(List)
-    private void commonAnalyseList(QueryVo queryVo, List<Map<String, Object>> contentMaps, Map<String, Object> contentMap, String recTitle) {
+    private void commonAnalyseList(QueryVo queryVo, List<MedrecVo> medrecVoList, Map<String, Object> contentMap, String recTitle) {
+        boolean flag = true;
+        List<Map<String, Object>> specialContent = new ArrayList<>();
+        Map<String, Object> keyContent = new LinkedHashMap<>();
         for (MedrecVo i : queryVo.getMedrec()) {
             if (recTitle.contains(i.getTitle())) {
-                List<Map<String, Object>> specialContent = new ArrayList<>();
-                Map<String, Object> keyContent = i.getContent();
+                flag = false;
+                keyContent = i.getContent();
                 try {
                     specialContent = JSON.parseObject(JSON.toJSONString(keyContent.get("content")), new TypeReference<List<Map<String, Object>>>() {
                     });
@@ -313,17 +324,28 @@ public class BeilunDocTrans extends DocTrans {
                 }
             }
         }
+        if (flag) {
+            MedrecVo medrecVo = new MedrecVo();
+            medrecVo.setTitle(recTitle);
+            specialContent.add(contentMap);
+            keyContent.put("content", specialContent);
+            medrecVo.setContent(keyContent);
+            medrecVo.setLabel(null);
+            medrecVoList.add(medrecVo);
+        }
     }
 
     //(Map)
-    private void consultationAnalyseMap(QueryVo queryVo, List<Map<String, Object>> contentMaps, Map<String, Object> contentMap, String recTitle) {
+    private void consultationAnalyseMap(QueryVo queryVo, List<MedrecVo> medrecVoList, Map<String, Object> contentMap, String recTitle, String title) {
+        boolean flag = true;
+        Map<String, List<Map<String, Object>>> specialContent = new LinkedHashMap<>();
+        List<Map<String, Object>> recordContentDTOS = new ArrayList<>();
+        Map<String, Object> keyContent = new LinkedHashMap<>();
         for (MedrecVo i : queryVo.getMedrec()) {
             if (recTitle.contains(i.getTitle())) {
-                Map<String, List<Map<String, Object>>> specialContent = new LinkedHashMap<>();
-                List<Map<String, Object>> recordContentDTOS = new ArrayList<>();
+                flag = false;
                 recordContentDTOS.add(contentMap);
-
-                Map<String, Object> keyContent = i.getContent();
+                keyContent = i.getContent();
                 try {
                     specialContent = JSON.parseObject(JSON.toJSONString(keyContent.get("content")), new TypeReference<Map<String, List<Map<String, Object>>>>() {
                     });
@@ -338,6 +360,15 @@ public class BeilunDocTrans extends DocTrans {
                 }
             }
         }
+        if (flag) {
+            MedrecVo medrecVo = new MedrecVo();
+            medrecVo.setTitle(title);
+            recordContentDTOS.add(contentMap);
+            specialContent.put(recTitle, recordContentDTOS);
+            keyContent.put("content", specialContent);
+            medrecVo.setContent(keyContent);
+            medrecVo.setLabel(null);
+            medrecVoList.add(medrecVo);
+        }
     }
-
 }