Browse Source

Merge remote-tracking branch 'origin/dev-1.2' into dev

louhr 5 years ago
parent
commit
2caa128e6c
28 changed files with 632 additions and 140 deletions
  1. 16 15
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0024.java
  2. 16 13
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0025.java
  3. 3 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0026.java
  4. 8 7
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0028.java
  5. 16 10
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0029.java
  6. 15 13
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0030.java
  7. 14 4
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0031.java
  8. 10 5
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0073.java
  9. 34 22
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0449.java
  10. 8 4
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0454.java
  11. 57 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0490.java
  12. 99 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0724.java
  13. 55 25
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0178.java
  14. 72 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0195.java
  15. 21 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0222.java
  16. 33 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0252.java
  17. 44 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0146.java
  18. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0328.java
  19. 6 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0436.java
  20. 28 9
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java
  21. 4 1
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/EntityEnum.java
  22. 8 0
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java
  23. 2 0
      public/src/main/java/com/lantone/qc/pub/model/InputInfo.java
  24. 19 0
      public/src/main/java/com/lantone/qc/pub/model/doc/MedicalRecordInfoDoc.java
  25. 2 1
      public/src/main/java/com/lantone/qc/pub/model/label/ThreeLevelWardLabel.java
  26. 1 0
      trans/src/main/java/com/lantone/qc/trans/changx/ChangxBeHospitalizedDocTrans.java
  27. 4 0
      trans/src/main/java/com/lantone/qc/trans/changx/ChangxDocTrans.java
  28. 35 0
      trans/src/main/java/com/lantone/qc/trans/changx/ChangxMedicalRecordInfoDocTrans.java

+ 16 - 15
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0024.java

@@ -23,11 +23,23 @@ public class BEH0024 extends QCCatalogue {
 
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if(inputInfo.getBeHospitalizedDoc() == null){
+        if (inputInfo.getBeHospitalizedDoc() == null) {
             status.set("0");
             return;
         }
-        List<Wound> wounds = inputInfo.getBeHospitalizedDoc().getPastLabel().getWounds();
+        //台州结构化
+        Map<String, String> behStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
+        if (StringUtils.isNotEmpty(behStructureMap.get("手术外伤史"))) {
+            status.set("0");
+            return;
+        }
+        PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
+        /* 如果既往史为空或者既往史文本为空,则不报错 */
+        if (pastLabel == null || StringUtil.isBlank(pastLabel.getText())) {
+            status.set("0");
+            return;
+        }
+        List<Wound> wounds = pastLabel.getWounds();
         if (ListUtil.isNotEmpty(wounds)) {
             if (wounds.stream().map(i -> i.getName()).filter(i -> StringUtil.isNotBlank(i)).count() > 0) {
                 status.set("0");
@@ -35,20 +47,9 @@ public class BEH0024 extends QCCatalogue {
             }
         }
         //硬规则匹配
-        PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (pastLabel != null){
-            String pastLabelText = pastLabel.getText();
-            if (StringUtil.isNotBlank(pastLabelText) && pastLabelText.contains("外伤")){
-                status.set("0");
-                return;
-            }
-        }
-        //台州结构化
-        Map<String, String> structureMap_beh = inputInfo.getBeHospitalizedDoc().getStructureMap();
-        if(StringUtils.isNotEmpty(structureMap_beh.get("手术外伤史"))){
+        String pastLabelText = pastLabel.getText();
+        if (pastLabelText.contains("外伤")) {
             status.set("0");
         }
-
     }
-
 }

+ 16 - 13
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0025.java

@@ -23,11 +23,23 @@ public class BEH0025 extends QCCatalogue {
 
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if(inputInfo.getBeHospitalizedDoc() == null){
+        if (inputInfo.getBeHospitalizedDoc() == null) {
             status.set("0");
             return;
         }
-        List<Operation> operations = inputInfo.getBeHospitalizedDoc().getPastLabel().getOperations();
+        //台州结构化
+        Map<String, String> behStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
+        if (StringUtils.isNotEmpty(behStructureMap.get("手术外伤史"))) {
+            status.set("0");
+            return;
+        }
+        PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
+        /* 如果既往史为空或者既往史文本为空,则不报错 */
+        if (pastLabel == null || StringUtil.isBlank(pastLabel.getText())) {
+            status.set("0");
+            return;
+        }
+        List<Operation> operations = pastLabel.getOperations();
         if (ListUtil.isNotEmpty(operations)) {
             if (operations.stream().map(i -> i.getName()).filter(i -> StringUtil.isNotBlank(i)).count() > 0) {
                 status.set("0");
@@ -35,17 +47,8 @@ public class BEH0025 extends QCCatalogue {
             }
         }
         //规则硬匹配
-        PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (pastLabel != null){
-            String pastLabelText = pastLabel.getText();
-            if (StringUtil.isNotBlank(pastLabelText) && pastLabelText.contains("手术")){
-                status.set("0");
-                return;
-            }
-        }
-        //台州结构化
-        Map<String, String> structureMap_beh = inputInfo.getBeHospitalizedDoc().getStructureMap();
-        if(StringUtils.isNotEmpty(structureMap_beh.get("手术外伤史"))){
+        String pastLabelText = pastLabel.getText();
+        if (pastLabelText.contains("手术")) {
             status.set("0");
         }
     }

+ 3 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0026.java

@@ -33,12 +33,13 @@ public class BEH0026 extends QCCatalogue {
             return;
         }
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (pastLabel == null) {
+        /* 如果既往史为空或者既往史文本为空,则不报错 */
+        if (pastLabel == null || StringUtil.isBlank(pastLabel.getText())) {
             status.set("0");
             return;
         }
         String pastText = pastLabel.getText();
-        if (StringUtil.isNotBlank(pastText) && pastText.contains("食物过敏史")) {
+        if (pastText.contains("食物过敏史")) {
             status.set("0");
             return;
         }

+ 8 - 7
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0028.java

@@ -27,13 +27,19 @@ public class BEH0028 extends QCCatalogue {
             status.set("0");
             return;
         }
+        Map<String, String> behStructure = inputInfo.getBeHospitalizedDoc().getStructureMap();
+        if (StringUtils.isNotEmpty(behStructure.get("输血史"))) {
+            status.set("0");
+            return;
+        }
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (pastLabel == null) {
+        /* 如果既往史为空或者既往史文本为空,则不报错 */
+        if (pastLabel == null || StringUtil.isBlank(pastLabel.getText())) {
             status.set("0");
             return;
         }
         String pastText = pastLabel.getText();
-        if (StringUtil.isNotBlank(pastText) && pastText.contains("输血")) {
+        if (pastText.contains("输血")) {
             status.set("0");
             return;
         }
@@ -41,13 +47,8 @@ public class BEH0028 extends QCCatalogue {
         if (ListUtil.isNotEmpty(bloodTransfusions)) {
             if (bloodTransfusions.stream().map(i -> i.getName()).filter(i -> StringUtil.isNotBlank(i)).count() > 0) {
                 status.set("0");
-                return;
             }
         }
-        Map<String, String> structureMap_beh = inputInfo.getBeHospitalizedDoc().getStructureMap();
-        if (StringUtils.isNotEmpty(structureMap_beh.get("输血史"))) {
-            status.set("0");
-        }
     }
 
 }

+ 16 - 10
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0029.java

@@ -5,6 +5,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.Vaccinate;
+import com.lantone.qc.pub.model.label.PastLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -23,24 +24,29 @@ public class BEH0029 extends QCCatalogue {
 
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if(inputInfo.getBeHospitalizedDoc() == null){
+        if (inputInfo.getBeHospitalizedDoc() == null) {
             status.set("0");
             return;
         }
-        List<Vaccinate> vaccinates = inputInfo.getBeHospitalizedDoc().getPastLabel().getVaccinates();
-        if (ListUtil.isNotEmpty(vaccinates)) {
-            if (vaccinates.stream().map(i -> i.getName()).filter(i -> StringUtil.isNotBlank(i)).count() > 0) {
-                status.set("0");
-                return;
-            }
-        }
-        //台州结构化
         BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        //台州结构化
         Map<String, String> structureMap = beHospitalizedDoc.getStructureMap();
-        if(StringUtils.isNotEmpty(structureMap.get("预防接种史"))){
+        if (StringUtils.isNotEmpty(structureMap.get("预防接种史"))) {
             status.set("0");
             return;
         }
+        PastLabel pastLabel = beHospitalizedDoc.getPastLabel();
+        /* 如果既往史为空或者既往史文本为空,则不报错 */
+        if (pastLabel == null || StringUtil.isBlank(pastLabel.getText())) {
+            status.set("0");
+            return;
+        }
+        List<Vaccinate> vaccinates = pastLabel.getVaccinates();
+        if (ListUtil.isNotEmpty(vaccinates)) {
+            if (vaccinates.stream().map(i -> i.getName()).filter(i -> StringUtil.isNotBlank(i)).count() > 0) {
+                status.set("0");
+            }
+        }
     }
 
 }

+ 15 - 13
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0030.java

@@ -27,25 +27,27 @@ public class BEH0030 extends QCCatalogue {
             return;
         }
         Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
-        if (StringUtils.isNotEmpty(structureMap.get("结核病"))
-                || StringUtils.isNotEmpty(structureMap.get("病毒性肝炎"))) {
+        if (StringUtils.isNotEmpty(structureMap.get("结核病")) || StringUtils.isNotEmpty(structureMap.get("病毒性肝炎"))) {
             status.set("0");
             return;
         }
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (pastLabel != null) {
-            if (ListUtil.isNotEmpty(
-                    CatalogueUtil.filterDiagsByNature(
-                            pastLabel.getDiags(),
-                            "infectious",
-                            "1"
-                    )
-            )) {
-                status.set("0");
-            }
+        /* 如果既往史为空或者既往史文本为空,则不报错 */
+        if (pastLabel == null || StringUtil.isBlank(pastLabel.getText())) {
+            status.set("0");
+            return;
+        }
+        if (ListUtil.isNotEmpty(
+                CatalogueUtil.filterDiagsByNature(
+                        pastLabel.getDiags(),
+                        "infectious",
+                        "1"
+                )
+        )) {
+            status.set("0");
         }
         String pastText = pastLabel.getText();
-        if (StringUtil.isNotBlank(pastText) && (pastText.contains("肝炎") || pastText.contains("结核"))){
+        if (pastText.contains("肝炎") || pastText.contains("结核")) {
             status.set("0");
         }
     }

+ 14 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0031.java

@@ -1,5 +1,6 @@
 package com.lantone.qc.kernel.catalogue.behospitalized;
 
+import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
@@ -8,6 +9,7 @@ import com.lantone.qc.pub.util.ListUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -20,7 +22,7 @@ public class BEH0031 extends QCCatalogue {
 
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if(inputInfo.getBeHospitalizedDoc() == null){
+        if (inputInfo.getBeHospitalizedDoc() == null) {
             status.set("0");
             return;
         }
@@ -42,9 +44,17 @@ public class BEH0031 extends QCCatalogue {
         //硬规则匹配
         String text = inputInfo.getBeHospitalizedDoc().getPastLabel().getText();
         if (StringUtils.isNotEmpty(text)) {
-            if (text.contains("心脑血管") || text.contains("肺肝")
-                    || text.contains("内分泌") || text.contains("高血压") || text.contains("糖尿病")) {
-                status.set("0");
+            List<String> words = Lists.newArrayList("高血压", "糖尿病", "阿尔茨海默病", "帕金森", "冠心病心律失常型"
+                    , "冠状动脉性心脏病", "冠状动脉粥样硬化性心脏病", "慢性肾炎综合征", "肾病", "慢性肾衰竭", "肾功能异常", "哮喘"
+                    , "肺结核", "腹膜透析", "慢性阻塞性肺病", "精神分裂症", "分裂情感性精神病", "双相情感障碍,目前为缓解状态", "前列腺增生"
+                    , "高脂血症", "高低密度脂蛋白胆固醇血症", "高胆固醇血症", "高甘油三酯血症", "骨质疏松", "慢性乙型病毒性肝炎"
+                    , "慢性庚型肝炎", "慢性肝炎", "慢性丁型肝炎", "慢性病毒性肝炎", "慢性丙型病毒性肝炎", "酒精性肝病", "脂肪肝"
+                    , "肝硬化", "肝恶性肿瘤", "肝恶性细胞瘤", "肝病", "类风湿性关节炎", "心脑血管", "内分泌");
+            for (String word : words) {
+                if (text.contains(word)) {
+                    status.set("0");
+                    return;
+                }
             }
         }
     }

+ 10 - 5
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0073.java

@@ -7,6 +7,7 @@ import com.lantone.qc.pub.model.entity.Diag;
 import com.lantone.qc.pub.model.entity.Family;
 import com.lantone.qc.pub.model.label.FamilyLabel;
 import com.lantone.qc.pub.model.label.PastLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
@@ -33,9 +34,13 @@ public class BEH0073 extends QCCatalogue {
             status.set("0");
             return;
         }
-        if (inputInfo.getBeHospitalizedDoc().getFamilyLabel() != null) {
-            FamilyLabel familyLabel = inputInfo.getBeHospitalizedDoc().getFamilyLabel();
-            List<Family> families = familyLabel.getFamilies();
+        FamilyLabel familyLabel = inputInfo.getBeHospitalizedDoc().getFamilyLabel();
+        if (familyLabel == null || StringUtil.isBlank(familyLabel.getText())) {
+            status.set("0");
+            return;
+        }
+        List<Family> families = familyLabel.getFamilies();
+        if (ListUtil.isNotEmpty(families)) {
             for (Family family : families) {
                 if (family.getDiags() == null || family.getDiags().size() == 0) {
                     continue;
@@ -53,9 +58,9 @@ public class BEH0073 extends QCCatalogue {
         }
         //规则硬匹配
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (pastLabel != null){
+        if (pastLabel != null) {
             String pastLabelText = pastLabel.getText();
-            if (StringUtil.isNotBlank(pastLabelText) && (pastLabelText.contains("肝炎") || pastLabelText.contains("结核"))){
+            if (StringUtil.isNotBlank(pastLabelText) && (pastLabelText.contains("肝炎") || pastLabelText.contains("结核"))) {
                 status.set("0");
             }
         }

+ 34 - 22
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0449.java

@@ -2,8 +2,8 @@ package com.lantone.qc.kernel.catalogue.behospitalized;
 
 import com.alibaba.fastjson.JSONArray;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-import com.lantone.qc.kernel.client.SimilarityServiceClient;
-import com.lantone.qc.kernel.structure.ai.FirstCourseRecordAI;
+import com.lantone.qc.kernel.client.ChiefPresentSimilarityServiceClient;
+import com.lantone.qc.kernel.structure.ai.ModelAI;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -27,7 +28,7 @@ import java.util.stream.Collectors;
 @Component
 public class BEH0449 extends QCCatalogue {
     @Autowired
-    SimilarityServiceClient similarityServiceClient;
+    ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         if (inputInfo.getBeHospitalizedDoc() == null) {
@@ -41,29 +42,32 @@ public class BEH0449 extends QCCatalogue {
             status.set("0");
             return;
         } else {
-            List<Clinical> clinicals_chief = beHospitalizedDoc.getChiefLabel().getClinicals();
-            List<Clinical> clinicals_present = beHospitalizedDoc.getPresentLabel().getClinicals();
-            if (ListUtil.isNotEmpty(clinicals_chief) && ListUtil.isNotEmpty(clinicals_present)) {
-                Clinical clinical_chief = clinicals_chief.get(0);
-                clinicals_present = clinicals_present.stream().filter(clinical -> clinical.getNegative() == null).collect(Collectors.toList());
-                for (Clinical cliPre : clinicals_present) {
-                    String name_pre = cliPre.getName();
-                    String name_chief = clinical_chief.getName();
-                    if (name_chief.equals(name_pre)) {
+            List<Clinical> chiefClinicals = beHospitalizedDoc.getChiefLabel().getClinicals();
+            List<Clinical> presentClinicals = beHospitalizedDoc.getPresentLabel().getClinicals();
+            if (ListUtil.isNotEmpty(chiefClinicals) && ListUtil.isNotEmpty(presentClinicals)) {
+                Clinical chiefClinical = chiefClinicals.get(0);
+                String chiefClinic = chiefClinical.getName();
+                /* 去除阴性症状,只保留阳性症状 */
+                presentClinicals = presentClinicals.stream().filter(clinical -> clinical.getNegative() == null).collect(Collectors.toList());
+                for (Clinical cliPre : presentClinicals) {
+                    String presentClinical = cliPre.getName();
+                    if (chiefClinic.equals(presentClinical)) {
                         status.set("0");
                         return;
-                    } else if (name_pre.contains(name_chief) || name_chief.contains(name_pre)) {
+                    } else if (presentClinical.contains(chiefClinic) || chiefClinic.contains(presentClinical)) {
+                        status.set("0");
+                        return;
+                    }
+                }
+                List<String> clinicName = getClinicName(presentClinicals);
+                /* 文本相似度模型 */
+                ModelAI modelAI = new ModelAI();
+                JSONArray jsonArray = modelAI.loadChiefPresentSimilarAI(chiefClinic, clinicName, false, chiefPresentSimilarityServiceClient);
+                if (jsonArray.size() == 2) {
+                    double likeRate = jsonArray.getDoubleValue(1);
+                    if (likeRate > 0.9) {
                         status.set("0");
                         return;
-                    } else {
-                        JSONArray similarContent = new JSONArray();
-                        FirstCourseRecordAI firstCourseRecordAI = new FirstCourseRecordAI();
-                        firstCourseRecordAI.putContent(similarContent, name_chief, name_pre);
-                        double likeRate = firstCourseRecordAI.loadSimilarAI(similarContent, similarityServiceClient);
-                        if (likeRate > 0.9) {
-                            status.set("0");
-                            return;
-                        }
                     }
                 }
             }
@@ -83,4 +87,12 @@ public class BEH0449 extends QCCatalogue {
             status.set("0");
         }
     }
+
+    private List<String> getClinicName(List<Clinical> presentClinicals) {
+        List<String> clinicNames = new ArrayList<>();
+        for (Clinical clinical : presentClinicals) {
+            clinicNames.add(clinical.getName());
+        }
+        return clinicNames;
+    }
 }

+ 8 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0454.java

@@ -4,6 +4,7 @@ import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.label.PastLabel;
+import com.lantone.qc.pub.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
@@ -29,10 +30,13 @@ public class BEH0454 extends QCCatalogue {
             return;
         }
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (pastLabel != null) {
-            if (StringUtils.isNotEmpty(pastLabel.getHeathCondition()) || pastLabel.getText().contains("既往")) {
-                status.set("0");
-            }
+        /* 如果既往史为空或者既往史文本为空,则不报错 */
+        if (pastLabel == null || StringUtil.isBlank(pastLabel.getText())) {
+            status.set("0");
+            return;
+        }
+        if (StringUtils.isNotEmpty(pastLabel.getHeathCondition()) || pastLabel.getText().contains("既往")) {
+            status.set("0");
         }
     }
 }

+ 57 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0490.java

@@ -0,0 +1,57 @@
+package com.lantone.qc.kernel.catalogue.behospitalized;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.entity.PD;
+import com.lantone.qc.pub.model.entity.Pacs;
+import com.lantone.qc.pub.model.label.PacsLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+
+/**
+ * @ClassName : BEH0490
+ * @Description : 实验室检查未注明时间和地点
+ * @Author : 胡敬
+ * @Date: 2020-06-03 13:34
+ */
+@Component
+public class BEH0490 extends QCCatalogue {
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        if (inputInfo.getBeHospitalizedDoc() == null) {
+            return;
+        }
+
+        PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
+        if (pacsLabel == null || StringUtil.isBlank(pacsLabel.getText())) {
+            return;
+        }
+
+        String pacsText = pacsLabel.getText();
+        List<Pacs> pacses = pacsLabel.getPacses();
+        for (Pacs pacs : pacses) {
+            if (pacs.getName() == null && pacs.getPd() == null) {
+                status.set("-1");
+                return;
+            } else {
+                PD pd = pacs.getPd();
+                if (pd == null) {
+                    continue;
+                }
+                String name = pd.getName();
+                int timeIndex = pacsText.indexOf(name);
+                String beforeTimeText = pacsText.substring(Math.max(timeIndex - 5, 0), timeIndex);
+                String afterTimeText = pacsText.substring(timeIndex + name.length(), timeIndex + name.length() + 10);
+                if (!beforeTimeText.contains("院") && !afterTimeText.contains("院")) {
+                    status.set("-1");
+                    return;
+                }
+            }
+        }
+    }
+}

+ 99 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0724.java

@@ -0,0 +1,99 @@
+package com.lantone.qc.kernel.catalogue.behospitalized;
+
+import com.alibaba.fastjson.JSONArray;
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.client.ChiefPresentSimilarityServiceClient;
+import com.lantone.qc.kernel.structure.ai.ModelAI;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
+import com.lantone.qc.pub.model.entity.Allergy;
+import com.lantone.qc.pub.model.label.PastLabel;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 药物过敏史与病案首页不一致
+ * @author: 胡敬
+ * @time: 2020/06/03 17:28
+ */
+@Component
+public class BEH0724 extends QCCatalogue {
+    @Autowired
+    ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
+
+    @Override
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        if (firstPageRecordDoc == null || beHospitalizedDoc == null) {
+            status.set("0");
+            return;
+        }
+        Map<String, String> firpStructureMap = firstPageRecordDoc.getStructureMap();
+        String firpAllergyMedicine = firpStructureMap.get("过敏药物");
+        if (StringUtil.isBlank(firpAllergyMedicine)) {
+            status.set("0");
+            return;
+        }
+        PastLabel pastLabel = beHospitalizedDoc.getPastLabel();
+        if (pastLabel == null) {
+            status.set("0");
+            return;
+        }
+
+        List<Allergy> allergies = pastLabel.getAllergies();
+        if (ListUtil.isNotEmpty(allergies)) {
+            if (firpAllergyMedicine.contains("无")) {
+                allergies = allergies.stream().filter(i -> i != null
+                                && i.getNegative() != null
+                                && StringUtil.isNotBlank(i.getName())
+                                && i.getAllergyMedicine() != null
+                                && StringUtil.isNotBlank(i.getAllergyMedicine().getName())
+                ).collect(Collectors.toList());
+                /* 模型提出的药物过敏史内容有一个否定就算与病案首页的药物过敏:无 相同 */
+                if (allergies.size() > 0) {
+                    status.set("0");
+                }
+            } else {
+                allergies = allergies.stream().filter(i -> i != null
+                                && StringUtil.isNotBlank(i.getName())
+                                && i.getAllergyMedicine() != null
+                                && StringUtil.isNotBlank(i.getAllergyMedicine().getName())
+                ).collect(Collectors.toList());
+
+                List<String> allergyMedicine = getAllergyMedicine(allergies);
+                /* 主诉现病史相似度算法接口 */
+                ModelAI modelAI = new ModelAI();
+                JSONArray jsonArray = modelAI.loadChiefPresentSimilarAI(firpAllergyMedicine, allergyMedicine,
+                        false, chiefPresentSimilarityServiceClient);
+                if (jsonArray.size() == 2) {
+                    /* 相似度分数 */
+                    double likeRate = jsonArray.getDoubleValue(1);
+                    if (likeRate > 0.9) {
+                        status.set("0");
+                    } else {
+                        status.set("-1");
+                    }
+                }
+            }
+        }
+    }
+
+    private List<String> getAllergyMedicine(List<Allergy> allergies) {
+        List<String> allergieStrList = new ArrayList<>();
+        for (Allergy allergieStr : allergies) {
+            allergieStrList.add(allergieStr.getAllergyMedicine().getName());
+        }
+        return allergieStrList;
+    }
+
+}

+ 55 - 25
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0178.java

@@ -1,13 +1,17 @@
 package com.lantone.qc.kernel.catalogue.firstpagerecord;
 
+import com.alibaba.fastjson.JSONArray;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.client.SimilarityServiceClient;
+import com.lantone.qc.kernel.structure.ai.ModelAI;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
-import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.label.DiagLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -22,51 +26,77 @@ import java.util.Map;
  */
 @Component
 public class FIRP0178 extends QCCatalogue {
+    @Autowired
+    SimilarityServiceClient similarityServiceClient;
+
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null
-                && inputInfo.getBeHospitalizedDoc() != null) {
+        if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getLeaveHospitalDoc() != null) {
             Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
             List<Map<String, String>> dischargeDiag = (List) firstpageStructureMap.get(Content.dischargeDiag);
-            if (ListUtil.isEmpty(dischargeDiag)){
+            if (ListUtil.isEmpty(dischargeDiag)) {
                 return;
             }
+            /* 病案首页出院小结诊断 除去主诊断*/
+            List<String> firstpageLeaveDiags = getFirstPageDiag(dischargeDiag);
 
-            BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
-            List<String> beHospitalDiag = new ArrayList<>();//收集入院记录中初步诊断、修正诊断、其他诊断所有诊断
-            if (beHospitalizedDoc.getInitialDiagLabel() != null) {
-                putDiagToList(beHospitalizedDoc.getInitialDiagLabel().getDiags(),beHospitalDiag); //初步诊断
-            }
-            if (beHospitalizedDoc.getRevisedDiagLabel() != null){
-                putDiagToList(beHospitalizedDoc.getRevisedDiagLabel().getDiags(),beHospitalDiag); //修正诊断
-            }
-            if (beHospitalizedDoc.getSuppleDiagLabel() != null){
-                putDiagToList(beHospitalizedDoc.getSuppleDiagLabel().getDiags(), beHospitalDiag); //其他诊断
+            DiagLabel leaveDiagLabel = inputInfo.getLeaveHospitalDoc().getLeaveDiagLabel();
+            if (leaveDiagLabel == null) {
+                return;
             }
+            List<Diag> leaveDiags = leaveDiagLabel.getDiags();
+            List<String> leaveDiagsStr = putDiagToList(leaveDiags);
 
-            if (beHospitalDiag.size() > 0 && dischargeDiag.size() < 2) {
+            /* 病案首页出院诊断会把主诊断去掉,所以size会少一个,这里将出院小结里的出院诊断size也-1 */
+            if (firstpageLeaveDiags.size() != leaveDiagsStr.size() - 1) {
                 status.set("-1");
                 return;
             }
 
-            List<String> firstpageDiag = new ArrayList<>();
-            for (int i = 1; i < dischargeDiag.size(); i++) {
-                String diagnoseName = dischargeDiag.get(i).get(Content.diagnoseName);
-                if (StringUtil.isBlank(diagnoseName)) {
-                    continue;
+            /* 目前相似度算法是针对文本的,在此处并不适用,如 截瘫 - 高位截瘫,相似度为0 */
+            ModelAI modelAI = new ModelAI();
+            int matchDiagSum = 0;
+            for (String firstpageLeaveDiag : firstpageLeaveDiags) {
+                for (String leaveDiag : leaveDiagsStr) {
+                    if (firstpageLeaveDiag.equals(leaveDiag) || leaveDiag.contains(firstpageLeaveDiag)) {
+                        matchDiagSum++;
+                        break;
+                    } else {
+                        JSONArray similarContent = new JSONArray();
+                        modelAI.putContent(similarContent, firstpageLeaveDiag, leaveDiag);
+                        double likeRate = modelAI.loadSimilarAI(similarContent, similarityServiceClient);
+                        if (likeRate > 0.9) {
+                            matchDiagSum++;
+                            break;
+                        }
+                    }
                 }
-                firstpageDiag.add(diagnoseName);
             }
 
-            if (!ListUtil.equals(firstpageDiag,beHospitalDiag)){
+            if (matchDiagSum != firstpageLeaveDiags.size()) {
                 status.set("-1");
             }
+
+        }
+    }
+
+    private List<String> getFirstPageDiag(List<Map<String, String>> dischargeDiag) {
+        List<String> firstpageDiag = new ArrayList<>();
+        for (int i = 1; i < dischargeDiag.size(); i++) {
+            String diagnoseName = dischargeDiag.get(i).get(Content.diagnoseName);
+            if (StringUtil.isBlank(diagnoseName)) {
+                continue;
+            }
+            firstpageDiag.add(diagnoseName);
         }
+        return firstpageDiag;
     }
 
-    private void putDiagToList(List<Diag> diagList, List<String> beHospitalDiag){
-        for (Diag diag:diagList) {
-            beHospitalDiag.add(diag.getName());
+    private List<String> putDiagToList(List<Diag> diagList) {
+        List<String> diags = new ArrayList<>();
+        for (Diag diag : diagList) {
+            diags.add(diag.getHospitalDiagName());
         }
+        return diags;
     }
 }

+ 72 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0195.java

@@ -0,0 +1,72 @@
+package com.lantone.qc.kernel.catalogue.firstpagerecord;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.DeathCaseDiscussDoc;
+import com.lantone.qc.pub.model.doc.DeathRecordDoc;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : FIRP0195
+ * @Description :离院方式选择错误
+ * @Author : 胡敬
+ * @Date: 2020-06-03 16:54
+ */
+@Component
+public class FIRP0195 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
+        DeathCaseDiscussDoc deathCaseDiscussDoc = inputInfo.getDeathCaseDiscussDoc();
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        if (inputInfo.getFirstPageRecordDoc() == null) {
+            return;
+        }
+        Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+        String outWay = firstpageStructureMap.get(Content.outWay);
+        if (StringUtil.isBlank(outWay)) {
+            return;
+        }
+        String wardOutWay;
+        if (deathRecordDoc != null || deathCaseDiscussDoc != null) {
+            wardOutWay = "死亡";
+            if (!match(outWay, wardOutWay)) {
+                status.set("-1");
+                return;
+            }
+        }
+
+        if (threeLevelWardDocs.size() > 0) {
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+            ThreeLevelWardDoc lastWardDoc = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1);
+            List<ThreeLevelWardLabel> threeLevelWardLabels = lastWardDoc.getThreeLevelWardLabel();
+            if (threeLevelWardLabels.size() > 0) {
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardLabels.get(0);
+                if (threeLevelWardLabel != null) {
+                    wardOutWay = threeLevelWardLabel.getDischargeMode();
+                    if (StringUtil.isNotBlank(wardOutWay)) {
+                        if (!match(outWay, wardOutWay)) {
+                            status.set("-1");
+                        }
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    private boolean match(String str1, String str2) {
+        return str1.equals(str2) || str1.contains(str2) || str2.contains(str1);
+    }
+}

+ 21 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0222.java

@@ -1,10 +1,13 @@
 package com.lantone.qc.kernel.catalogue.firstpagerecord;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
+import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
+import com.lantone.qc.pub.model.doc.transferrecord.TransferRecordDoc;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
@@ -19,6 +22,22 @@ import java.util.Map;
 public class FIRP0222 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
+        TransferRecordDoc transferRecordDocs = inputInfo.getTransferRecordDocs();
+        /* 如果有转入转出科室记录,则不判断 */
+        if (transferRecordDocs != null) {
+            return;
+        }
+        if (firstPageRecordDoc == null || medicalRecordInfoDoc == null) {
+            return;
+        }
+        Map<String, String> firpStructureMap = firstPageRecordDoc.getStructureMap();
+        Map<String, String> medStructureMap = medicalRecordInfoDoc.getStructureMap();
+        String admitDept = firpStructureMap.get(Content.admitDept);
+        String behDeptId = medStructureMap.get("behDeptId");
+        if (StringUtil.isNotBlank(admitDept) && StringUtil.isNotBlank(behDeptId) && !admitDept.equals(behDeptId)) {
+            status.set("-1");
+        }
     }
 }

+ 33 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0252.java

@@ -0,0 +1,33 @@
+package com.lantone.qc.kernel.catalogue.firstpagerecord;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @ClassName : FIRP0252
+ * @Description : 单病种管理填写错误
+ * @Author : 楼辉荣
+ * @Date: 2020-03-06 17:28ss
+ */
+@Component
+public class FIRP0252 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getFirstPageRecordDoc() == null){
+            status.set("0");
+            return;
+        }
+        if (inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
+            Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+            String name = firstpageStructureMap.get(Content.single_disease_management);
+            if (StringUtil.isNotBlank(name)){
+                status.set("0");
+            }
+        }
+    }
+}

+ 44 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0146.java

@@ -3,20 +3,58 @@ package com.lantone.qc.kernel.catalogue.leavehospital;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
+import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.label.DiagLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
- * @Description:
- * @author: rengb
- * @time: 2020/3/10 13:53
+ * @ClassName : LEA0146
+ * @Description :出院其他诊断不完全
+ * @Author : 胡敬
+ * @Date: 2020-03-16 14:01
  */
 @Component
 public class LEA0146 extends QCCatalogue {
-
-    @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getLeaveHospitalDoc() != null) {
+            DiagLabel leaveDiagLabel = inputInfo.getLeaveHospitalDoc().getLeaveDiagLabel();
+            if (leaveDiagLabel == null) {
+                return;
+            }
+            List<Diag> dischargeDiag = leaveDiagLabel.getDiags();
+            if (ListUtil.isEmpty(dischargeDiag)) {
+                return;
+            }
+            List<String> leaveDiags = new ArrayList<>();
+            putDiagToList(dischargeDiag, leaveDiags);
+
+            BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+            List<String> beHospitalDiag = new ArrayList<>();//收集入院记录中初步诊断、修正诊断、其他诊断所有诊断
+            if (beHospitalizedDoc.getInitialDiagLabel() != null) {
+                putDiagToList(beHospitalizedDoc.getInitialDiagLabel().getDiags(), beHospitalDiag); //初步诊断
+            }
+            if (beHospitalizedDoc.getRevisedDiagLabel() != null) {
+                putDiagToList(beHospitalizedDoc.getRevisedDiagLabel().getDiags(), beHospitalDiag); //修正诊断
+            }
+            if (beHospitalizedDoc.getSuppleDiagLabel() != null) {
+                putDiagToList(beHospitalizedDoc.getSuppleDiagLabel().getDiags(), beHospitalDiag); //其他诊断
+            }
+
+            if (!leaveDiags.containsAll(beHospitalDiag)) {
+                status.set("-1");
+            }
+        }
+    }
 
+    private void putDiagToList(List<Diag> diagList, List<String> beHospitalDiag) {
+        for (Diag diag : diagList) {
+            beHospitalDiag.add(diag.getName());
+        }
     }
-    
 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0328.java

@@ -24,7 +24,8 @@ public class PRE0328 extends QCCatalogue {
         if (operationDocs == null || operationDocs.size() == 0) {
             return;
         }
-        if(inputInfo.getBeHospitalizedDoc().getStructureMap().get("现病史") !=null
+        if(inputInfo.getBeHospitalizedDoc() != null
+                && inputInfo.getBeHospitalizedDoc().getStructureMap().get("现病史") !=null
                 && inputInfo.getBeHospitalizedDoc().getStructureMap().get("现病史").contains("急诊手术")){
             return;
         }

+ 6 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0436.java

@@ -77,6 +77,9 @@ public class THR0436 extends QCCatalogue {
         for (RescueDoc rescueDoc : rescueDocs) {
             Map<String, String> rescueStructureMap = rescueDoc.getStructureMap();
             recordTime = rescueStructureMap.get("抢救结束时间");
+            if (StringUtil.isBlank(recordTime)) {
+                continue;
+            }
             Date recordDate = StringUtil.parseDateTime(recordTime);
             if (recordDate == null || CatalogueUtil.equalsDate(recordDate, timeOfComparison, "yyyy-MM-dd")) {
                 continue;
@@ -89,6 +92,9 @@ public class THR0436 extends QCCatalogue {
             Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
             recordTime = rescueStructureMap.get("查房日期");
             title = CatalogueUtil.subTitle(rescueStructureMap.get("查房标题"));
+            if (StringUtil.isBlank(recordTime)) {
+                continue;
+            }
             Date recordDate = StringUtil.parseDateTime(recordTime);
             if (recordDate == null || StringUtil.isBlank(title) || !title.contains(Content.director)) {//只存副高以上查房记录
                 continue;

+ 28 - 9
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java

@@ -65,6 +65,11 @@ public class ThreeLevelWardAI extends ModelAI {
         }
 
         List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();//所有查房记录
+        if (allDoctorWradDocs.size() > 0) {
+            Map<String, String> lastWardStructureMap = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1).getStructureMap();
+            putContent(crfContent, medicalTextType.get(1), lastWardStructureMap.get("病情记录"), "末次查房");
+        }
+
         List<Map<String, String>> directorDifficultRecord = new ArrayList<>();
         //疑难患者副高及以上查房记录
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0) {
@@ -96,6 +101,10 @@ public class ThreeLevelWardAI extends ModelAI {
         if (midData.get(Content.director + "最后一次") != null) {
             putWardRoundCrfData(midData.getJSONObject(Content.director + "最后一次"), inputInfo, 0);//最后一次查房记录
         }
+        //最后一次查房记录模型输出
+        if (midData.get("末次查房") != null) {
+            putWardRoundCrfData(midData.getJSONObject("末次查房"), inputInfo, 0);//最后一次查房记录
+        }
         //疑难患者副高及以上查房记录模型输出
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0 && ListUtil.isNotEmpty(directorDifficultRecord)) {
             for (int i = 0; i < directorDifficultRecord.size(); i++) {
@@ -111,7 +120,7 @@ public class ThreeLevelWardAI extends ModelAI {
                 if (midData.get(Content.rescuingPatients + i) == null) {
                     continue;
                 }
-                putWardRoundCrfData(midData.getJSONObject(Content.difficultPatients + i), inputInfo, 3);//查房记录
+                putWardRoundCrfData(midData.getJSONObject(Content.rescuingPatients + i), inputInfo, 3);//查房记录
             }
         }
 
@@ -150,13 +159,23 @@ public class ThreeLevelWardAI extends ModelAI {
         threeLevelWardLabel.setSerious(serious);
         ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
         if (serious == 0) {//处理主治/主任查房记录
-            if (Content.attend.equals(detailTitle)) {
-                threeLevelWardDoc.getAttendingDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
-            } else if (Content.director.equals(detailTitle)) {
-                threeLevelWardDoc.getDirectorDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
-            } else if ((Content.director + "最后一次").equals(detailTitle)) {
-                List<DirectorDoctorWardDoc> director = threeLevelWardDoc.getDirectorDoctorWardDocs();
-                director.get(director.size() - 1).setThreeLevelWardLabel(threeLevelWardLabel);
+            switch (detailTitle) {
+                case Content.attend:
+                    threeLevelWardDoc.getAttendingDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
+                    break;
+                case Content.director:
+                    threeLevelWardDoc.getDirectorDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
+                    break;
+                case Content.director + "最后一次":
+                    List<DirectorDoctorWardDoc> director = threeLevelWardDoc.getDirectorDoctorWardDocs();
+                    director.get(director.size() - 1).setThreeLevelWardLabel(threeLevelWardLabel);
+                    break;
+                case "末次查房":
+                    List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
+                    List<ThreeLevelWardLabel> lastWardLebelList = new ArrayList<>();
+                    lastWardLebelList.add(threeLevelWardLabel);
+                    allDoctorWradDocs.get(allDoctorWradDocs.size() - 1).setThreeLevelWardLabel(lastWardLebelList);
+                    break;
             }
         } else {
             List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
@@ -257,7 +276,7 @@ public class ThreeLevelWardAI extends ModelAI {
         for (RescueDoc rescueDoc : rescueDocs) {
             Map<String, String> rescueStructureMap = rescueDoc.getStructureMap();
             recordTime = rescueStructureMap.get("抢救结束时间");
-            if(recordTime == null){
+            if (recordTime == null) {
                 continue;
             }
             Date recordDate = StringUtil.parseDateTime(recordTime);

+ 4 - 1
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/EntityEnum.java

@@ -28,7 +28,7 @@ public enum EntityEnum {
     TITLE_OF_OPERATIVE_FINDINGS("手术经过标题"), TITLE_OF_MEASURES_AFTER_OP("术后处理措施标题"),
     TITLE_OF_RISK_AFTER_OP("术后风险标题"), TITLE_OF_ATTENTION_AFTER_OP("术后注意事项标题"), VITAL("生命体征"),
     BETTER_FINDING("好转表现"),OUTCOME_TO_BETTER("转归情况-好转"),OUTCOME_CURE("转归情况-治愈"),POSITIVE_FINDING("阳性表现"),
-    INSPECTION_ITEMS("检查项目");
+    INSPECTION_ITEMS("检查项目"),DISCHARGE_MODE("出院方式");
 
     private String value;
 
@@ -232,6 +232,9 @@ public enum EntityEnum {
             case "检查项目":
                 entityEnum = EntityEnum.INSPECTION_ITEMS;
                 break;
+            case "出院方式":
+                entityEnum = EntityEnum.DISCHARGE_MODE;
+                break;
         }
         return entityEnum;
     }

+ 8 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java

@@ -112,6 +112,14 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         }
         threeLevelWardLabel.setTreatmentPlans(treatmentPlans);
 
+        //离院方式
+        List<Lemma> dischargeMode = createEntityTree(aiOut, EntityEnum.DISCHARGE_MODE.toString());
+        for (Lemma lemma : dischargeMode) {
+            String text = lemma.getText();
+            threeLevelWardLabel.setDischargeMode(text);
+        }
+
+
         //好转表现
         List<Lemma> betterFindingLemmas = createEntityTree(aiOut, EntityEnum.BETTER_FINDING.toString());
         List<BetterFinding> betterFindings = new ArrayList<>();

+ 2 - 0
public/src/main/java/com/lantone/qc/pub/model/InputInfo.java

@@ -89,6 +89,8 @@ public class InputInfo {
     private List<ReasonableDiagnosisDoc> reasonableDiagnosisDocs = new ArrayList<>();
     //日常病程录
     private List<DailyCourseRecordDoc> dailyCourseRecordDocs = Lists.newArrayList();
+    //住院病历信息
+    private MedicalRecordInfoDoc medicalRecordInfoDoc;
 
     //新增记录
     public <T> void addDoc(List<T> list, T obj) {

+ 19 - 0
public/src/main/java/com/lantone/qc/pub/model/doc/MedicalRecordInfoDoc.java

@@ -0,0 +1,19 @@
+package com.lantone.qc.pub.model.doc;
+
+import com.lantone.qc.pub.model.label.CaseCharacteristicLabel;
+import com.lantone.qc.pub.model.label.DiagLabel;
+import com.lantone.qc.pub.model.label.DiagnosisLabel;
+import com.lantone.qc.pub.model.label.TreatPlanLabel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : MedicalRecordInfoDoc
+ * @Description : 住院病历信息
+ * @Author : 胡敬
+ * @Date: 2020-06-03 15:46
+ */
+@Getter
+@Setter
+public class MedicalRecordInfoDoc extends ModelDoc {
+}

+ 2 - 1
public/src/main/java/com/lantone/qc/pub/model/label/ThreeLevelWardLabel.java

@@ -23,7 +23,7 @@ import java.util.List;
 @Getter
 @Setter
 public class ThreeLevelWardLabel {
-    int serious = 0;    //不严重患者:0,危重患者:1,疑难患者:2,抢救患者:3
+    int serious = 0;    //0:不严重患者,1:危重患者,2:疑难患者,3:抢救患者
     String title;   //医师职称
     List<Clinical> clinicals = new ArrayList<>();   //病史(临床表现)
     List<Sign> signs = new ArrayList<>();   //查体
@@ -31,6 +31,7 @@ public class ThreeLevelWardLabel {
     String diagBasisText;   //诊断依据文本
     String diffDiagText;    //鉴别诊断文本
     List<Diag> diags = new ArrayList<>();   //补充诊断/初步诊断/修正诊断
+    String dischargeMode;  //离院方式
     List<TreatmentPlan> treatmentPlans = new ArrayList<>();   //诊疗计划
     List<BetterFinding> betterFindings = new ArrayList<>();   //好转表现
     List<OutcomeToBetter> outcomeToBetters = new ArrayList<>();   //转归情况-好转

+ 1 - 0
trans/src/main/java/com/lantone/qc/trans/changx/ChangxBeHospitalizedDocTrans.java

@@ -113,6 +113,7 @@ public class ChangxBeHospitalizedDocTrans extends ModelDocTrans {
             "++++过敏史=过敏史",
             "++++输血史=输血史",
             "++++胸闷心悸史=胸闷心悸史",
+            "实验室检查++++辅助检查=辅助检查",
             "签名++++=医师签名",
             "兄弟姐妹健康状况++++兄弟姐妹=兄弟姐妹健康状况"
     );

+ 4 - 0
trans/src/main/java/com/lantone/qc/trans/changx/ChangxDocTrans.java

@@ -127,6 +127,10 @@ public class ChangxDocTrans extends DocTrans {
                 ChangxDailyCourseRecordDocTrans dailyCourseRecordDocTrans = new ChangxDailyCourseRecordDocTrans();
                 inputInfo.setDailyCourseRecordDocs(dailyCourseRecordDocTrans.extract(i));
             }
+            if (i.getTitle().equals("住院病历信息")) {
+                ChangxMedicalRecordInfoDocTrans medicalRecordInfoDocTrans = new ChangxMedicalRecordInfoDocTrans();
+                inputInfo.setMedicalRecordInfoDoc(medicalRecordInfoDocTrans.extract(i));
+            }
         }
         pageDataHandle(inputInfo);
         return inputInfo;

+ 35 - 0
trans/src/main/java/com/lantone/qc/trans/changx/ChangxMedicalRecordInfoDocTrans.java

@@ -0,0 +1,35 @@
+package com.lantone.qc.trans.changx;
+
+import com.google.common.collect.Maps;
+import com.lantone.qc.dbanaly.util.ModuleMappingUtil;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
+import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
+import com.lantone.qc.pub.model.vo.MedrecVo;
+import com.lantone.qc.pub.util.FastJsonUtils;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import com.lantone.qc.trans.ModelDocTrans;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 住院病历信息
+ * @author: 胡敬
+ * @time: 2020/6/3 15:45
+ */
+public class ChangxMedicalRecordInfoDocTrans extends ModelDocTrans {
+
+    @Override
+    public MedicalRecordInfoDoc extract(MedrecVo medrecVo) {
+        Map<String, String> content = (Map) ((List) medrecVo.getContent().get("content")).get(0);
+        MedicalRecordInfoDoc medicalRecordInfoDoc = new MedicalRecordInfoDoc();
+        medicalRecordInfoDoc.setStructureMap(content);
+        medicalRecordInfoDoc.setPageData(medrecVo.getContent());
+        return medicalRecordInfoDoc;
+    }
+
+}