Browse Source

Merge branch 'beilun/dev' into beilun/dev-fqw

fangqw 4 years ago
parent
commit
3ad7865459

+ 20 - 5
kernel/src/main/java/com/lantone/qc/kernel/catalogue/yiwu/behospitalized/BEH0013.java

@@ -1,5 +1,6 @@
 package com.lantone.qc.kernel.catalogue.yiwu.behospitalized;
 
+import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -24,22 +26,35 @@ import java.util.List;
 public class BEH0013 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getBeHospitalizedDoc() == null) {
+        List<String> words = Lists.newArrayList("无", "否认", "内固定", "诱因");
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        if (beHospitalizedDoc == null) {
             return;
         }
-        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
         //现病史
         PresentLabel presentLabel = beHospitalizedDoc.getPresentLabel();
         //既往史
         PastLabel pastLabel = beHospitalizedDoc.getPastLabel();
+        //入院记录存在一般情况
+        Map<String, String> structureMap_bh = beHospitalizedDoc.getStructureMap();
+        String generalCondition = structureMap_bh.get("一般情况");
+        if (StringUtil.isNotBlank(generalCondition) && presentLabel == null) {
+            for (String word : words) {
+                if (generalCondition.contains(word)) {
+                    return;
+                }
+            }
+        }
         if ((presentLabel == null || StringUtil.isBlank(presentLabel.getText()) || "。".equals(presentLabel.getText()))
-                && (StringUtil.isBlank(pastLabel.getText()) || "。".equals(pastLabel.getText()))) {
+                && (pastLabel == null || StringUtil.isBlank(pastLabel.getText()) || "。".equals(pastLabel.getText()))) {
             return;
         }
         String text = presentLabel.getText();
         if (StringUtil.isNotBlank(text)) {
-            if ((text.contains("无") || text.contains("否认") || text.contains("内固定")) && !text.contains("诱因")) {
-                return;
+            for (String word : words) {
+                if (text.contains(word)) {
+                    return;
+                }
             }
         }
         List<Clinical> clinicalNegative = new ArrayList<>();

+ 31 - 11
kernel/src/main/java/com/lantone/qc/kernel/catalogue/yiwu/behospitalized/BEH0014.java

@@ -3,6 +3,7 @@ package com.lantone.qc.kernel.catalogue.yiwu.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.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.Cause;
 import com.lantone.qc.pub.model.entity.Clinical;
 import com.lantone.qc.pub.model.entity.Diag;
@@ -15,6 +16,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -29,7 +31,8 @@ public class BEH0014 extends QCCatalogue {
             , "药物", "误服", "查", "撞", "伤", "月经", "暴力", "超", "术");
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if (inputInfo.getBeHospitalizedDoc() == null) {
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        if (beHospitalizedDoc == null) {
             status.set("0");
             return;
         }
@@ -45,10 +48,19 @@ public class BEH0014 extends QCCatalogue {
             }
         }*/
         PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
+        Map<String, String> structureMap_bh = beHospitalizedDoc.getStructureMap();
+        String generalCondition = structureMap_bh.get("一般情况");
+        if (StringUtil.isNotBlank(generalCondition) && presentLabel == null) {
+            //能取到一般情况,前30个字有"体检"或"发现"或"检查"(containList)字样
+            if (isInducement(generalCondition)) {
+                status.set("0");
+                return;
+            }
+        }
         //既往史
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
         if ((presentLabel == null || StringUtil.isBlank(presentLabel.getText()) || "。".equals(presentLabel.getText()))
-                && (StringUtil.isBlank(pastLabel.getText()) || "。".equals(pastLabel.getText()))) {
+                && (pastLabel == null || StringUtil.isBlank(pastLabel.getText()) || "。".equals(pastLabel.getText()))) {
             status.set("0");
             return;
         }
@@ -64,15 +76,9 @@ public class BEH0014 extends QCCatalogue {
         //硬规则匹配 前30个字有"体检"或"发现"或"检查"(containList)字样
         String present = presentLabel.getText();
         if (StringUtils.isNotEmpty(present)) {
-            if (present.length() > 30) {
-                present = present.substring(0, 30);
-            }
-            present = present.replaceAll("[\"“”]", "");
-            for (String word : containList) {
-                if (present.contains(word)) {
-                    status.set("0");
-                    return;
-                }
+            if (isInducement(present)) {
+                status.set("0");
+                return;
             }
             //模型在现病史前30个字里能提出来疾病,那也可以算有诱因
             List<Diag> presentDiags = presentLabel.getDiags();
@@ -95,4 +101,18 @@ public class BEH0014 extends QCCatalogue {
             status.set("0");
         }
     }
+
+    //判断一般情况和现病史中是否含有containList字样
+    private boolean isInducement(String text) {
+        if (text.length() > 30) {
+            text = text.substring(0, 30);
+        }
+        text = text.replaceAll("[\"“”]", "");
+        for (String word : containList) {
+            if (text.contains(word)) {
+                return true;
+            }
+        }
+        return false;
+    }
 }

+ 12 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/yiwu/behospitalized/BEH0444.java

@@ -13,6 +13,7 @@ import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -24,14 +25,24 @@ import java.util.List;
 @Component
 public class BEH0444 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        List<String> words = Lists.newArrayList("神志", "神清", "神不清", "意识清", "意识不清", "昏迷", "精神", "意识", "反应可", "哭声响", "未开奶");
         BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
         if (beHospitalizedDoc == null) {
             status.set("0");
             return;
         }
         PresentLabel presentLabel = beHospitalizedDoc.getPresentLabel();
+        Map<String, String> structureMap_bh = beHospitalizedDoc.getStructureMap();
+        String generalCondition = structureMap_bh.get("一般情况");
+        if (StringUtil.isNotBlank(generalCondition) && presentLabel == null) {
+            for (String word : words) {
+                if (generalCondition.contains(word)) {
+                    status.set("0");
+                    return;
+                }
+            }
+        }
         if (presentLabel != null) {
-            List<String> words = Lists.newArrayList("神志", "神清", "神不清", "意识清", "意识不清", "昏迷", "精神", "意识", "反应可", "哭声响", "未开奶");
             String presentLabelText = presentLabel.getText();
             if (StringUtil.isNotBlank(presentLabelText)) {
                 for (String word : words) {