Explorar el Código

1.空指针修改
2.既往史相关规则修改逻辑,如果既往史为空则不报错

hujing hace 5 años
padre
commit
e657b5fd6a

+ 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");
             }
         }

+ 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");
         }
     }
 }

+ 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;