Преглед на файлове

开单合理入参调整

louhr преди 5 години
родител
ревизия
f0894d06b1

+ 34 - 10
common-push/src/main/java/org/diagbot/common/push/filter/rule/PretreatmentRule.java

@@ -15,19 +15,20 @@ import java.util.Map;
 
 public class PretreatmentRule {
     public void rule(SearchData searchData) throws java.io.IOException {
-        //患者基本信息 性别 年龄
+        //患者基本信息 性别 年龄 婚姻
         if (!StringUtils.isEmpty(searchData.getNormal())) {
             add2PreResultList(new PretreatmentNormal(), searchData.getNormal(), "normal", searchData);
         }
         //症状规则 主诉、现病史提取
         if (!StringUtils.isEmpty(searchData.getChief())) {
             searchData.setChief(add2PreResultList(new PretreatmentSymptom(), searchData.getChief(), "symptom", searchData));
-            add2PreResultList(new PretreatmentSymptom(), searchData.getSymptom(), "symptom", searchData);
         }
         //现病史 提取手术史和过敏史
         if (!StringUtils.isEmpty(searchData.getSymptom())) {
-            add2PreResultList(new PretreatmentOperation(), searchData.getSymptom(), "operation", searchData);
-            add2PreResultList(new PretreatmentAllergy(), searchData.getSymptom(), "allergy", searchData);
+            add2PreResultList(new PretreatmentOperation(), searchData.getSymptom(), "operation", searchData);   //手术史
+            add2PreResultList(new PretreatmentAllergy(), searchData.getSymptom(), "allergy", searchData);       //过敏史
+            add2PreResultList(new PretreatmentSymptom(), searchData.getSymptom(), "symptom", searchData);       //症状
+            add2PreResultList(new PretreatmentInfectious(), searchData.getSymptom(), "infectious", searchData);     //传染病史
         }
         //体征数据 体征、现病史提取
         if (!StringUtils.isEmpty(searchData.getVital())) {
@@ -41,10 +42,8 @@ public class PretreatmentRule {
                 result.setUniqueName("诊断--");
             }
             searchData.setDiagString(add2PreResultList(searchData.getDiag(), searchData.getDiagString(), "diag", searchData));
-            add2PreResultList(new PretreatmentDiag(), searchData.getPasts(), "diag", searchData);
         } else if (!StringUtils.isEmpty(searchData.getDiagString())) {
             searchData.setDiagString(add2PreResultList(new PretreatmentDiag(), searchData.getDiagString(), "diag", searchData));
-            add2PreResultList(new PretreatmentDiag(), searchData.getPasts(), "diag", searchData);
         }
         //药品数据  药品信息(历史)、现病史、既往史
         if (searchData.getDrug() != null && searchData.getDrug().size() > 0) {
@@ -54,16 +53,17 @@ public class PretreatmentRule {
                 result.setUniqueName("药品--");
             }
             searchData.setDrugString(add2PreResultList(searchData.getDrug(), searchData.getDrugString(), "drug", searchData));
-            add2PreResultList(new PretreatmentDrug(), searchData.getPasts(), "drug", searchData);
         } else if (!StringUtils.isEmpty(searchData.getDrugString())) {
             searchData.setDrugString(add2PreResultList(new PretreatmentDrug(), searchData.getDrugString(), "drug", searchData));
-            add2PreResultList(new PretreatmentDrug(), searchData.getPasts(), "drug", searchData);
         }
         //既往史
         if (!StringUtils.isEmpty(searchData.getPasts())) {
             add2PreResultList(new PretreatmentPast(), searchData.getPasts(), "pasts", searchData);
             add2PreResultList(new PretreatmentOperation(), searchData.getPasts(), "operation", searchData);
             add2PreResultList(new PretreatmentAllergy(), searchData.getPasts(), "allergy", searchData);
+            add2PreResultList(new PretreatmentDrug(), searchData.getPasts(), "drug", searchData);
+            add2PreResultList(new PretreatmentDiag(), searchData.getPasts(), "diag", searchData);
+            add2PreResultList(new PretreatmentInfectious(), searchData.getPasts(), "infectious", searchData);
         }
         //手术外伤史 现病史、手术史
         if (!StringUtils.isEmpty(searchData.getOperation())) {
@@ -75,9 +75,33 @@ public class PretreatmentRule {
             add2PreResultList(new PretreatmentAllergy(), searchData.getAllergy(), "allergy", searchData);
         }
         //传染病   现病史、传染病史
-        if (!StringUtils.isEmpty(searchData.getPasts())) {
+        if (!StringUtils.isEmpty(searchData.getInfectious())) {
             add2PreResultList(new PretreatmentInfectious(), searchData.getInfectious(), "infectious", searchData);
-            add2PreResultList(new PretreatmentInfectious(), searchData.getSymptom(), "infectious", searchData);
+        }
+        //个人史
+        if (!StringUtils.isEmpty(searchData.getPersonal())) {
+            add2PreResultList(new PretreatmentPersonal(), searchData.getPersonal(), "personal", searchData);
+        }
+        //家族史
+        if (!StringUtils.isEmpty(searchData.getFamily())) {
+            add2PreResultList(new PretreatmentFamily(), searchData.getFamily(), "family", searchData);
+        }
+        //接种史
+        if (!StringUtils.isEmpty(searchData.getVaccination())) {
+            add2PreResultList(new PretreatmentVaccination(), searchData.getVaccination(), "vaccination", searchData);
+        }
+        //其他史
+        if (!StringUtils.isEmpty(searchData.getOther())) {
+            add2PreResultList(new PretreatmentPast(), searchData.getOther(), "pasts", searchData);
+            add2PreResultList(new PretreatmentOperation(), searchData.getOther(), "operation", searchData);
+            add2PreResultList(new PretreatmentAllergy(), searchData.getOther(), "allergy", searchData);
+            add2PreResultList(new PretreatmentWound(), searchData.getOther(), "wound", searchData);
+            add2PreResultList(new PretreatmentInfectious(), searchData.getOther(), "infectious", searchData);
+            add2PreResultList(new PretreatmentPersonal(), searchData.getOther(), "personal", searchData);
+            add2PreResultList(new PretreatmentFamily(), searchData.getOther(), "family", searchData);
+            add2PreResultList(new PretreatmentVaccination(), searchData.getOther(), "vaccination", searchData);
+            add2PreResultList(new PretreatmentDrug(), searchData.getOther(), "drug", searchData);
+            add2PreResultList(new PretreatmentDiag(), searchData.getOther(), "diag", searchData);
         }
         //lis结构化信息
         if (searchData.getLis() != null && searchData.getLis().size() > 0) {

+ 39 - 0
nlp/src/main/java/org/diagbot/nlp/rule/pretreat/PretreatmentFamily.java

@@ -0,0 +1,39 @@
+package org.diagbot.nlp.rule.pretreat;
+
+import org.diagbot.nlp.participle.ParticipleUtil;
+import org.diagbot.nlp.participle.word.Lexeme;
+import org.diagbot.nlp.participle.word.LexemePath;
+import org.diagbot.nlp.rule.module.PreResult;
+import org.diagbot.nlp.util.NegativeEnum;
+import org.diagbot.nlp.util.NlpUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PretreatmentFamily extends Pretreatment {
+    protected NegativeEnum[] nees_family = new NegativeEnum[]{NegativeEnum.FAMILY_HISTORY};
+
+    public List<PreResult> analyze(String content) throws java.io.IOException{
+        List<PreResult> preResults = new ArrayList<>();
+        LexemePath<Lexeme> lexemes = ParticipleUtil.participle(content);
+        for (int i = 0; i < lexemes.size(); i++) {
+            Lexeme l = lexemes.get(i);
+            if (NlpUtil.isFeature(l.getProperty(), nees_family)) {
+                PreResult result = new PreResult();
+                result.setUniqueName("家族--");
+                result.setDetailName("家族--");
+                result.setValue(NlpUtil.concept(l, NegativeEnum.FAMILY_HISTORY));
+                preResults.add(result);
+            }
+        }
+        return preResults;
+    }
+
+    public PreResult createPreResult(LexemePath<Lexeme> lexemes, Lexeme lexeme, int index) {
+        return null;
+    }
+
+    public String findBodyValue(LexemePath<Lexeme> lexemes, Lexeme lexeme, int index) {
+        return null;
+    }
+}

+ 42 - 0
nlp/src/main/java/org/diagbot/nlp/rule/pretreat/PretreatmentPersonal.java

@@ -0,0 +1,42 @@
+package org.diagbot.nlp.rule.pretreat;
+
+import org.diagbot.nlp.participle.ParticipleUtil;
+import org.diagbot.nlp.participle.word.Lexeme;
+import org.diagbot.nlp.participle.word.LexemePath;
+import org.diagbot.nlp.rule.module.PreResult;
+import org.diagbot.nlp.util.NegativeEnum;
+import org.diagbot.nlp.util.NlpUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by louhr on 2019/12/9.
+ */
+public class PretreatmentPersonal extends Pretreatment {
+    protected NegativeEnum[] nees_allergy = new NegativeEnum[]{NegativeEnum.PERSON_FEATURE_DESC, NegativeEnum.BLOOD, NegativeEnum.BAD_HABBIT};
+
+    public List<PreResult> analyze(String content) throws java.io.IOException{
+        List<PreResult> preResults = new ArrayList<>();
+        LexemePath<Lexeme> lexemes = ParticipleUtil.participle(content);
+        for (int i = 0; i < lexemes.size(); i++) {
+            Lexeme l = lexemes.get(i);
+            if (NlpUtil.isFeature(l.getProperty(), nees_allergy)) {
+                PreResult result = new PreResult();
+                result.setUniqueName("个人--");
+                result.setDetailName("个人--");
+                result.setValue(l.getText());
+                preResults.add(result);
+            }
+        }
+        return preResults;
+    }
+
+    public PreResult createPreResult(LexemePath<Lexeme> lexemes, Lexeme lexeme, int index) {
+        return null;
+    }
+
+    public String findBodyValue(LexemePath<Lexeme> lexemes, Lexeme lexeme, int index) {
+        return null;
+    }
+}

+ 39 - 0
nlp/src/main/java/org/diagbot/nlp/rule/pretreat/PretreatmentVaccination.java

@@ -0,0 +1,39 @@
+package org.diagbot.nlp.rule.pretreat;
+
+import org.diagbot.nlp.participle.ParticipleUtil;
+import org.diagbot.nlp.participle.word.Lexeme;
+import org.diagbot.nlp.participle.word.LexemePath;
+import org.diagbot.nlp.rule.module.PreResult;
+import org.diagbot.nlp.util.NegativeEnum;
+import org.diagbot.nlp.util.NlpUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PretreatmentVaccination extends Pretreatment {
+    protected NegativeEnum[] nees_vaccination = new NegativeEnum[]{NegativeEnum.VACCINATION};
+
+    public List<PreResult> analyze(String content) throws java.io.IOException{
+        List<PreResult> preResults = new ArrayList<>();
+        LexemePath<Lexeme> lexemes = ParticipleUtil.participle(content);
+        for (int i = 0; i < lexemes.size(); i++) {
+            Lexeme l = lexemes.get(i);
+            if (NlpUtil.isFeature(l.getProperty(), nees_vaccination)) {
+                PreResult result = new PreResult();
+                result.setUniqueName("接种--");
+                result.setDetailName("接种--");
+                result.setValue(NlpUtil.concept(l, NegativeEnum.VACCINATION));
+                preResults.add(result);
+            }
+        }
+        return preResults;
+    }
+
+    public PreResult createPreResult(LexemePath<Lexeme> lexemes, Lexeme lexeme, int index) {
+        return null;
+    }
+
+    public String findBodyValue(LexemePath<Lexeme> lexemes, Lexeme lexeme, int index) {
+        return null;
+    }
+}

+ 13 - 1
nlp/src/main/java/org/diagbot/nlp/util/NegativeEnum.java

@@ -13,7 +13,7 @@ public enum NegativeEnum {
     OTHER("44"),
     VITAL_INDEX("33"), VITAL_INDEX_VALUE("34"), VITAL_RESULT("35"),
     ADDRESS("36"), PERSON("38"), PERSON_FEATURE_DESC("39"), PUB_NAME("46"), MEDICINE_NAME("53"),MEDICINE_PRD("54"),PAST_DESC("55"),ALLERGY("65"),
-    MARRIED_DESC("62"), RETURN_VISIT("68"), DIAG_STAND("70");
+    MARRIED_DESC("62"), RETURN_VISIT("68"), DIAG_STAND("70"), BLOOD("58"), BAD_HABBIT("60"), FAMILY_HISTORY("64"), VACCINATION("71");
     private String value;
 
     NegativeEnum(String value) {
@@ -159,9 +159,18 @@ public enum NegativeEnum {
             case "55":
                 negativeEnum = NegativeEnum.PAST_DESC;
                 break;
+            case "58":
+                negativeEnum = NegativeEnum.BLOOD;
+                break;
+            case "60":
+                negativeEnum = NegativeEnum.BAD_HABBIT;
+                break;
             case "62":
                 negativeEnum = NegativeEnum.MARRIED_DESC;
                 break;
+            case "64":
+                negativeEnum = NegativeEnum.FAMILY_HISTORY;
+                break;
             case "65":
                 negativeEnum = NegativeEnum.ALLERGY;
                 break;
@@ -171,6 +180,9 @@ public enum NegativeEnum {
             case "70":
                 negativeEnum = NegativeEnum.DIAG_STAND;
                 break;
+            case "71":
+                negativeEnum = NegativeEnum.VACCINATION;
+                break;
         }
         return negativeEnum;
     }