瀏覽代碼

关系抽取页面展示修改

louhr 6 年之前
父節點
當前提交
1a34f41997

+ 31 - 0
nlp/src/main/java/org/diagbot/nlp/relation/analyze/RelationAnalyze.java

@@ -8,6 +8,8 @@ import org.diagbot.nlp.feature.FeatureType;
 import org.diagbot.nlp.participle.ParticipleUtil;
 import org.diagbot.nlp.participle.word.Lexeme;
 import org.diagbot.nlp.participle.word.LexemePath;
+import org.diagbot.nlp.relation.extract.LisExtract;
+import org.diagbot.nlp.relation.extract.PacsExtract;
 import org.diagbot.nlp.relation.extract.PresentExtract;
 import org.diagbot.nlp.relation.extract.VitalExtract;
 import org.diagbot.nlp.relation.util.OutputInfo;
@@ -44,6 +46,9 @@ public class RelationAnalyze {
             switch (featureType) {
                 case SYMPTOM:
                     this.lemmaPresentExtract(outputInfo, lemmaTree, lemmaParticiple);
+                    this.lemmaVitalExtract(outputInfo, lemmaTree, lemmaParticiple);
+                    this.lemmaLisExtract(outputInfo, lemmaTree, lemmaParticiple);
+                    this.lemmaPacsExtract(outputInfo, lemmaTree, lemmaParticiple);
             }
             if (outputInfo != null) {
                 outputInfos.add(outputInfo);
@@ -71,4 +76,30 @@ public class RelationAnalyze {
         outputInfo = vitalExtract.extract(outputInfo, lemmaTree, lemmaParticiple);
         return outputInfo;
     }
+
+    /**
+     * 化验特征提取
+     * @param outputInfo
+     * @param lemmaTree
+     * @param lemmaParticiple
+     * @return
+     */
+    public OutputInfo lemmaLisExtract(OutputInfo outputInfo, List<Lemma> lemmaTree, List<Lemma> lemmaParticiple) {
+        LisExtract lisExtract = new LisExtract();
+        outputInfo = lisExtract.extract(outputInfo, lemmaTree, lemmaParticiple);
+        return outputInfo;
+    }
+
+    /**
+     * 检查特征提取
+     * @param outputInfo
+     * @param lemmaTree
+     * @param lemmaParticiple
+     * @return
+     */
+    public OutputInfo lemmaPacsExtract(OutputInfo outputInfo, List<Lemma> lemmaTree, List<Lemma> lemmaParticiple) {
+        PacsExtract pacsExtract = new PacsExtract();
+        outputInfo = pacsExtract.extract(outputInfo, lemmaTree, lemmaParticiple);
+        return outputInfo;
+    }
 }

+ 72 - 0
nlp/src/main/java/org/diagbot/nlp/relation/extract/LisExtract.java

@@ -0,0 +1,72 @@
+package org.diagbot.nlp.relation.extract;
+
+import org.algorithm.core.cnn.entity.Lemma;
+import org.diagbot.nlp.relation.module.Lis;
+import org.diagbot.nlp.relation.module.cell.PD;
+import org.diagbot.nlp.relation.util.OutputInfo;
+import org.diagbot.nlp.util.Constants;
+import org.diagbot.nlp.util.NlpUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName org.diagbot.nlp.relation.extract.LisExtract
+ * @Description TODO
+ * @Author fyeman
+ * @Date 2019/3/22/022 10:23
+ * @Version 1.0
+ **/
+public class LisExtract extends BaseExtract {
+    public OutputInfo extract(OutputInfo outputInfo, List<Lemma> lemmaTree, List<Lemma> lemmaParticiple) {
+        List<String> repeatLisList = new ArrayList<>();
+        for (int index = 0; index < lemmaParticiple.size(); index++) {
+            Lemma participle_lemma = lemmaParticiple.get(index);
+            String property = participle_lemma.getProperty();
+            if (NlpUtil.isFeature(property, Constants.lis_name_type)) {          //特征词 症状
+                if (repeatLisList.contains(participle_lemma.getText())) {
+                    continue;
+                }
+                Lis lis = lookLisRelations(participle_lemma, lemmaTree);
+                outputInfo.getLises().add(lis);
+
+                repeatLisList.add(participle_lemma.getText());
+            }
+        }
+        lemmaTree.removeAll(containsLemmaTree);
+        return outputInfo;
+    }
+
+    private Lis lookLisRelations(Lemma participle_lemma, List<Lemma> lemmaTree) {
+        Lis lis = new Lis();
+        lis.setLisName(participle_lemma.getText());
+        for (Lemma cnn_l : lemmaTree) {
+            if (cnn_l.getText().equals(participle_lemma.getText())
+                    && cnn_l.getPosition().equals(participle_lemma.getPosition())) {
+                for (Lemma relation_l : cnn_l.getRelationLemmas()) {
+                    addFeatureToLis(relation_l, lis);
+                }
+                containsLemmaTree.add(cnn_l);
+            }
+        }
+        return lis;
+    }
+
+    private void addFeatureToLis(Lemma lemma, Lis lis) {
+        //化验结果信息
+        if (NlpUtil.isFeature(lemma.getProperty(), Constants.unit_time_type)) {
+            PD pd = lis.getPd();
+            if (pd == null) {
+                pd = new PD();
+                pd.setValue(lemma.getText());
+            } else {
+                pd.setValue(pd.getValue() + "、" + lemma.getText());
+            }
+            lis.setPd(pd);
+        }
+
+        if (NlpUtil.isFeature(lemma.getProperty(), Constants.lis_result_type)) {
+            lis.setValue(lemma.getText());
+        }
+    }
+}

+ 59 - 0
nlp/src/main/java/org/diagbot/nlp/relation/extract/PacsExtract.java

@@ -0,0 +1,59 @@
+package org.diagbot.nlp.relation.extract;
+
+import org.algorithm.core.cnn.entity.Lemma;
+import org.diagbot.nlp.relation.module.Pacs;
+import org.diagbot.nlp.relation.util.OutputInfo;
+import org.diagbot.nlp.util.Constants;
+import org.diagbot.nlp.util.NlpUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName org.diagbot.nlp.relation.extract.PacsExtract
+ * @Description TODO
+ * @Author fyeman
+ * @Date 2019/3/25/025 10:05
+ * @Version 1.0
+ **/
+public class PacsExtract extends BaseExtract {
+    public OutputInfo extract(OutputInfo outputInfo, List<Lemma> lemmaTree, List<Lemma> lemmaParticiple) {
+        List<String> repeatPacsList = new ArrayList<>();
+        for (int index = 0; index < lemmaParticiple.size(); index++) {
+            Lemma participle_lemma = lemmaParticiple.get(index);
+            String property = participle_lemma.getProperty();
+            if (NlpUtil.isFeature(property, Constants.pacs_name_type)) {          //特征词 症状
+                if (repeatPacsList.contains(participle_lemma.getText())) {
+                    continue;
+                }
+                Pacs pacs = lookPacsRelations(participle_lemma, lemmaTree);
+                outputInfo.getPacses().add(pacs);
+
+                repeatPacsList.add(participle_lemma.getText());
+            }
+        }
+        lemmaTree.removeAll(containsLemmaTree);
+        return outputInfo;
+    }
+
+    private Pacs lookPacsRelations(Lemma participle_lemma, List<Lemma> lemmaTree) {
+        Pacs pacs = new Pacs();
+        pacs.setPacsName(participle_lemma.getText());
+        for (Lemma cnn_l : lemmaTree) {
+            if (cnn_l.getText().equals(participle_lemma.getText())
+                    && cnn_l.getPosition().equals(participle_lemma.getPosition())) {
+                for (Lemma relation_l : cnn_l.getRelationLemmas()) {
+                    addFeatureToLis(relation_l, pacs);
+                }
+                containsLemmaTree.add(cnn_l);
+            }
+        }
+        return pacs;
+    }
+
+    private void addFeatureToLis(Lemma lemma, Pacs pacs) {
+        if (NlpUtil.isFeature(lemma.getProperty(), Constants.pacs_result_type)) {
+            pacs.setValue(lemma.getText());
+        }
+    }
+}

+ 1 - 1
nlp/src/main/java/org/diagbot/nlp/relation/extract/PresentExtract.java

@@ -54,7 +54,7 @@ public class PresentExtract extends BaseExtract {
 
     private void addFeatureToSymptom(Lemma lemma, Symptom symptom) {
         //时间信息
-        if (NlpUtil.isFeature(lemma.getProperty(), Constants.unit_time_type)) {
+        if (NlpUtil.isFeature(lemma.getProperty(), Constants.unit_time_type) || NlpUtil.isFeature(lemma.getProperty(), Constants.event_time_desc_type)) {
             PD pd = symptom.getPd();
             if (symptom.getPd() == null) {
                 pd = new PD();

+ 49 - 29
nlp/src/main/java/org/diagbot/nlp/relation/extract/VitalExtract.java

@@ -2,8 +2,8 @@ package org.diagbot.nlp.relation.extract;
 
 import org.algorithm.core.cnn.entity.Lemma;
 import org.diagbot.nlp.relation.module.Vital;
-import org.diagbot.nlp.relation.util.OutputInfo;
 import org.diagbot.nlp.relation.module.cell.*;
+import org.diagbot.nlp.relation.util.OutputInfo;
 import org.diagbot.nlp.util.Constants;
 import org.diagbot.nlp.util.NlpUtil;
 
@@ -39,38 +39,58 @@ public class VitalExtract extends BaseExtract {
             if (cnn_l.getText().equals(participle_lemma.getText())
                     && cnn_l.getPosition().equals(participle_lemma.getPosition())) {    //三元组中存在该特征
                 vital = new Vital();
-                vital.setVitalName(cnn_l.getText());
-                for (Lemma l : cnn_l.getRelationLemmas()) {
-                    if (NlpUtil.isFeature(l.getProperty(), Constants.negative_type)) {      //阴性
-                        Negative negative = new Negative();
-                        negative.setNegaName(l.getText());
-                        vital.setNegative(negative);
-                    } else if (NlpUtil.isFeature(l.getProperty(), Constants.degree_type)) {   //程度
-                        Degree degree = new Degree();
-                        degree.setDegreeName(l.getText());
-                        vital.setDegree(degree);
-                    } else if (NlpUtil.isFeature(l.getProperty(), Constants.body_part_type)) {   //方位
-                        BodyPart bodyPart = new BodyPart();
-                        bodyPart.setPartBodyName(l.getText());
-                        //部位需要查看下有没有方位
-                        for (Lemma position_l : l.getRelationLemmas()) {
-                            if (NlpUtil.isFeature(l.getProperty(), Constants.position_type)) {
-                                Position position = new Position();
-                                position.setPositionName(position_l.getText());
-                                bodyPart.setPosition(position);
-                            }
-                        }
-                        vital.setBodyPart(bodyPart);
-                    } else if (NlpUtil.isFeature(l.getProperty(), Constants.vital_index_type)) {
-                        Item item = new Item();
-                        item.setItemName(l.getText());
-                        vital.setItem(item);
-                    }
+                if (NlpUtil.isFeature(participle_lemma.getProperty(), Constants.vital_index_type)) {
+                    vital.setVitalName(cnn_l.getText());
+                }
+                if (NlpUtil.isFeature(participle_lemma.getProperty(), Constants.body_part_type)) {
+                    BodyPart bodyPart = new BodyPart();
+                    bodyPart.setPartBodyName(cnn_l.getText());
+                    vital.setBodyPart(bodyPart);
+                }
+                for (Lemma relation_l : cnn_l.getRelationLemmas()) {
+                    addFeatureToVital(relation_l, vital);
                 }
                 containsLemmaTree.add(cnn_l);
-                break;
             }
         }
         return vital;
     }
+
+    private void addFeatureToVital(Lemma lemma, Vital vital) {
+        if (NlpUtil.isFeature(lemma.getProperty(), Constants.negative_type)) {      //阴性
+            Negative negative = new Negative();
+            negative.setNegaName(lemma.getText());
+            vital.setNegative(negative);
+        } else if (NlpUtil.isFeature(lemma.getProperty(), Constants.degree_type)) {   //程度
+            Degree degree = new Degree();
+            degree.setDegreeName(lemma.getText());
+            vital.setDegree(degree);
+        } else if (NlpUtil.isFeature(lemma.getProperty(), Constants.body_part_type)) {   //部位
+            BodyPart bodyPart = vital.getBodyPart();
+            if (bodyPart == null) {
+                bodyPart = new BodyPart();
+            }
+            bodyPart.setPartBodyName(lemma.getText());
+            //部位需要查看下有没有方位
+            for (Lemma position_l : lemma.getRelationLemmas()) {
+                if (NlpUtil.isFeature(lemma.getProperty(), Constants.position_type)) {
+                    Position position = new Position();
+                    position.setPositionName(position_l.getText());
+                    bodyPart.setPosition(position);
+                }
+            }
+            vital.setBodyPart(bodyPart);
+        } else if (NlpUtil.isFeature(lemma.getProperty(), Constants.vital_value_type)) {
+            vital.setValue(lemma.getText());
+        } else if (NlpUtil.isFeature(lemma.getProperty(), Constants.unit_time_type)) {
+            PD pd = vital.getPd();
+            if (vital.getPd() == null) {
+                pd = new PD();
+                pd.setValue(lemma.getText());
+            } else {
+                pd.setValue(pd.getValue() + "、" + lemma.getText());
+            }
+            vital.setPd(pd);
+        }
+    }
 }

+ 40 - 0
nlp/src/main/java/org/diagbot/nlp/relation/module/Lis.java

@@ -0,0 +1,40 @@
+package org.diagbot.nlp.relation.module;
+
+import org.diagbot.nlp.relation.module.cell.PD;
+
+/**
+ * @ClassName org.diagbot.nlp.relation.module.Lis
+ * @Description TODO
+ * @Author fyeman
+ * @Date 2019/3/22/022 10:30
+ * @Version 1.0
+ **/
+public class Lis {
+    private String lisName;
+    private String value;
+    private PD pd;
+
+    public String getLisName() {
+        return lisName;
+    }
+
+    public void setLisName(String lisName) {
+        this.lisName = lisName;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public PD getPd() {
+        return pd;
+    }
+
+    public void setPd(PD pd) {
+        this.pd = pd;
+    }
+}

+ 29 - 0
nlp/src/main/java/org/diagbot/nlp/relation/module/Pacs.java

@@ -0,0 +1,29 @@
+package org.diagbot.nlp.relation.module;
+
+/**
+ * @ClassName org.diagbot.nlp.relation.module.Pacs
+ * @Description TODO
+ * @Author fyeman
+ * @Date 2019/3/25/025 10:06
+ * @Version 1.0
+ **/
+public class Pacs {
+    private String pacsName;
+    private String value;
+
+    public String getPacsName() {
+        return pacsName;
+    }
+
+    public void setPacsName(String pacsName) {
+        this.pacsName = pacsName;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

+ 15 - 9
nlp/src/main/java/org/diagbot/nlp/relation/module/Vital.java

@@ -1,9 +1,6 @@
 package org.diagbot.nlp.relation.module;
 
-import org.diagbot.nlp.relation.module.cell.BodyPart;
-import org.diagbot.nlp.relation.module.cell.Degree;
-import org.diagbot.nlp.relation.module.cell.Item;
-import org.diagbot.nlp.relation.module.cell.Negative;
+import org.diagbot.nlp.relation.module.cell.*;
 
 /**
  * @ClassName org.diagbot.nlp.relation.extract.module.Vital
@@ -17,7 +14,8 @@ public class Vital {
     private BodyPart bodyPart;
     private Degree degree;
     private Negative negative;
-    private Item item;
+    private String value;
+    private PD pd;
 
     public String getVitalName() {
         return vitalName;
@@ -51,11 +49,19 @@ public class Vital {
         this.negative = negative;
     }
 
-    public Item getItem() {
-        return item;
+    public String getValue() {
+        return value;
     }
 
-    public void setItem(Item item) {
-        this.item = item;
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public PD getPd() {
+        return pd;
+    }
+
+    public void setPd(PD pd) {
+        this.pd = pd;
     }
 }

+ 5 - 0
nlp/src/main/java/org/diagbot/nlp/relation/util/LemmaUtil.java

@@ -52,6 +52,8 @@ public class LemmaUtil {
             case SYMPTOM:
                 select(lemmaTree, triads, Constants.symptom_type);
                 select(lemmaTree, triads, Constants.vital_type);
+                select(lemmaTree, triads, Constants.lis_name_type);
+                select(lemmaTree, triads, Constants.pacs_name_type);
         }
         return lemmaTree;
     }
@@ -61,6 +63,9 @@ public class LemmaUtil {
         for (Triad triad : triads) {
             Lemma left_l = null;
             Lemma right_l = null;
+            if (triad.getL_1().getText().equals("体温最高") || triad.getL_2().getText().equals("体温最高")) {
+                System.out.println("体温最高");
+            }
             if (NlpUtil.isFeature(triad.getL_1().getProperty(), type)) {
                 left_l = this.copyProperties(triad.getL_1());
                 right_l = this.copyProperties(triad.getL_2());

+ 20 - 0
nlp/src/main/java/org/diagbot/nlp/relation/util/OutputInfo.java

@@ -1,5 +1,7 @@
 package org.diagbot.nlp.relation.util;
 
+import org.diagbot.nlp.relation.module.Lis;
+import org.diagbot.nlp.relation.module.Pacs;
 import org.diagbot.nlp.relation.module.Symptom;
 import org.diagbot.nlp.relation.module.Vital;
 
@@ -16,6 +18,8 @@ import java.util.List;
 public class OutputInfo {
     List<Symptom> symptoms = new ArrayList<>();
     List<Vital> vitals = new ArrayList<>();
+    List<Lis> lises = new ArrayList<>();
+    List<Pacs> pacses = new ArrayList<>();
 
     public List<Symptom> getSymptoms() {
         return symptoms;
@@ -32,4 +36,20 @@ public class OutputInfo {
     public void setVitals(List<Vital> vitals) {
         this.vitals = vitals;
     }
+
+    public List<Lis> getLises() {
+        return lises;
+    }
+
+    public void setLises(List<Lis> lises) {
+        this.lises = lises;
+    }
+
+    public List<Pacs> getPacses() {
+        return pacses;
+    }
+
+    public void setPacses(List<Pacs> pacses) {
+        this.pacses = pacses;
+    }
 }

+ 6 - 1
nlp/src/main/java/org/diagbot/nlp/util/Constants.java

@@ -19,7 +19,8 @@ public class Constants {
 
     public static NegativeEnum[] symptom_type = new NegativeEnum[]{NegativeEnum.SYMPTOM, NegativeEnum.SYMPTOM_INDEX, NegativeEnum.SYMPTOM_PERFORMANCE};
     public static NegativeEnum[] unit_time_type = new NegativeEnum[]{NegativeEnum.EVENT_TIME, NegativeEnum.UNIT};
-    public static NegativeEnum[] vital_type = new NegativeEnum[]{NegativeEnum.VITAL_INDEX_VALUE, NegativeEnum.VITAL_RESULT};
+    public static NegativeEnum[] event_time_desc_type = new NegativeEnum[]{NegativeEnum.EVENT_TIME_DESC};
+    public static NegativeEnum[] vital_type = new NegativeEnum[]{NegativeEnum.VITAL_INDEX, NegativeEnum.VITAL_RESULT, NegativeEnum.BODY_PART};
     public static NegativeEnum[] vital_index_type = new NegativeEnum[]{NegativeEnum.VITAL_INDEX};
     public static NegativeEnum[] vital_result_type = new NegativeEnum[]{NegativeEnum.VITAL_RESULT};
     public static NegativeEnum[] vital_value_type = new NegativeEnum[]{NegativeEnum.VITAL_INDEX_VALUE};
@@ -29,6 +30,10 @@ public class Constants {
     public static NegativeEnum[] degree_type = new NegativeEnum[]{NegativeEnum.DEEP};
     public static NegativeEnum[] cause_type = new NegativeEnum[]{NegativeEnum.CAUSE};
     public static NegativeEnum[] negative_type = new NegativeEnum[]{NegativeEnum.FEMININE};
+    public static NegativeEnum[] lis_name_type = new NegativeEnum[]{NegativeEnum.LIS_NAME};
+    public static NegativeEnum[] lis_result_type = new NegativeEnum[]{NegativeEnum.LIS_RESULT};
+    public static NegativeEnum[] pacs_name_type = new NegativeEnum[]{NegativeEnum.PACS_NAME};
+    public static NegativeEnum[] pacs_result_type = new NegativeEnum[]{NegativeEnum.PACS_RESULT};
 
     public static String[] negative_words = new String[]{"无", "未", "未及", "无殊", "否认", "未见", "不", "未闻", "未闻及", "欠", "非"};
 

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

@@ -22,7 +22,7 @@ public class NlpUtil {
 
     public static boolean isNumberString(Lexeme l) {
         if (l == null) return false;
-        if (NlpUtil.isFeature(l.getProperty(), new NegativeEnum[]{NegativeEnum.EVENT_TIME_DESC})) {
+        if (NlpUtil.isFeature(l.getProperty(), new NegativeEnum[]{NegativeEnum.NUMBER_QUANTIFIER})) {
             return true;
         }
         for (char c : l.getText().toCharArray()) {

+ 5 - 4
nlp/src/main/resources/tc.dict

@@ -31880,6 +31880,7 @@ q5MbN6z0rCbgy9lbgpb0qw==
 k4fbRoBkf7fLBkSQTHc21UpgEZ36UZf7
 +CerOIwEFFrCFLUSGoJvhw==
 QtUfg4T7hfKWVjlZ+AUcTEpgEZ36UZf7
+7lBPhs+IpMcBssZY1mzCiCyrN35xm8Fe
 Gio2c1VZcJcxcvohb+etoxAzZ2eoWU+i
 h96o5TH9dqZwKPG5bazIdw==
 HdexW9iJwc2Lmrn171LyUA==
@@ -68079,7 +68080,7 @@ hPzsNFYRHlLzlt6SiLetpA==
 0gGUhVPoq4EUTBUPIb3LAwl3NysruQBC
 0gGUhVPoq4H/PJ1JQKhjUxDEqH2YqjhtD/sUsKfwatU=
 0gGUhVPoq4GsQhIREunAkZ5tkxCxQvJel2KhXa/DbNwcWRi+SJuCc0P3OGrJyWATv4j9I08OiuFKYBGd+lGX+w==
-0gGUhVPoq4G6hnX53NjgLvNNEaI2FB0k
+0gGUhVPoq4G6hnX53NjgLv/4dTtNq2Gc
 0gGUhVPoq4GBYblhJnRs4Np9HMGBxd4R
 0gGUhVPoq4G47F9p3C4Ljgh7HhTO1MaEV038IAU5qX4=
 0gGUhVPoq4H31YeIu3C4wkh10mAGHzdbICtQTVycWc8=
@@ -303147,7 +303148,7 @@ XKMv9ZcokulqQjanXsrwMw==
 2b6/YwXsrcZueZxp4CIgUeZZHrTErPc/VRZTPWgm/GE=
 yH77v5+cx8dueZxp4CIgUeZZHrTErPc/omtJop9JKfI=
 j+KNQ7/3z6W4N4oatIbVCQ==
-IqM+rvhPgwAjKX0DyKt7+DIapu2Ke4BdSmARnfpRl/s=
+IqM+rvhPgwAjKX0DyKt7+BJmkhqcliulSmARnfpRl/s=
 IqM+rvhPgwAjKX0DyKt7+N6+fshNJnT++rMqXfwh44VKYBGd+lGX+w==
 IqM+rvhPgwAjKX0DyKt7+N6+fshNJnT+B5VqWQRopTMit6W1YI7bog==
 IqM+rvhPgwAjKX0DyKt7+N8kL7KdpB2Vm91NosS4pm0=
@@ -319694,7 +319695,7 @@ MigXoWUZSXBxZaT5RQ/jGA==
 mcLPoNNeuwS7gJSOdC91Kw==
 +ODwGJOKSzRqQjanXsrwMw==
 z+u+PBLiSd9qQjanXsrwMw==
-P53mEf+vI2RPiFA97DSzTQ==
+P53mEf+vI2RMPMGmZjn5GQ==
 +yt6yDPr4DRqQjanXsrwMw==
 hV6kHT5YU/+U//UNA71MQQ==
 S/z93k6Gkg4IiLHrWP1A+RAzZ2eoWU+i
@@ -325576,7 +325577,7 @@ vIeF9UvIVYF1BwQU72U08BAzZ2eoWU+i
 ricLfGNY6sYdeU8Sl2b2rmlv9z0IZz0e
 ricLfGNY6sakrADDVvnyM7QivoghFYAD
 c7d9rp7GDAhqQjanXsrwMw==
-iGEVqbed1RfRNmyktio1LUpgEZ36UZf7
+iGEVqbed1Rd9lM7wyjhpHDJqNUspTeQV
 tQwU3nwbltXwkz7d9fHQ/Q==
 UmfuMXcjH+3EmxhY/WBeFkpgEZ36UZf7
 zSU+d0rU0/pqQjanXsrwMw==

+ 138 - 3
nlp/src/test/java/org/diagbot/nlp/test/EntityExtractTest.java

@@ -83,13 +83,13 @@ public class EntityExtractTest {
 
             if (results_pair.size() > 0) {
                 MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/nlp-web?useUnicode=true&characterEncoding=UTF-8");
-                nlpJdbc.insert(results_pair, "re_tagging_result_part", new String[]{"sentence_id", "sentence_uuid", "sentence", "entity_1_position", "entity_2_position",
+                nlpJdbc.insert(results_pair, "re_tagging_result_compare", new String[]{"sentence_id", "sentence_uuid", "sentence", "entity_1_position", "entity_2_position",
                         "entity_1_name", "entity_2_name", "entity_1_prop", "entity_2_prop", "entity_1_prop_name", "entity_2_prop_name", "relation"});
             }
 
             if (results_none_pair.size() > 0) {
                 MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/nlp-web?useUnicode=true&characterEncoding=UTF-8");
-                nlpJdbc.insert(results_none_pair, "re_tagging_result_none_part", new String[]{"sentence_id", "sentence_uuid", "sentence", "entity_1_position", "entity_2_position",
+                nlpJdbc.insert(results_none_pair, "re_tagging_result_none_compare", new String[]{"sentence_id", "sentence_uuid", "sentence", "entity_1_position", "entity_2_position",
                         "entity_1_name", "entity_2_name", "entity_1_prop", "entity_2_prop", "entity_1_prop_name", "entity_2_prop_name", "relation"});
             }
         } catch (Exception e) {
@@ -97,6 +97,39 @@ public class EntityExtractTest {
         }
     }
 
+    public void participleReload() {
+        Configuration configuration = new DefaultConfig();
+        Segment segment = configuration.loadMainDict("tc.dict");
+
+        EntityExtractTest entityExtractTest = new EntityExtractTest();
+        List<Map<String, String>> data = entityExtractTest.searchData();
+
+        Map<String, List<String>> pairList =  entityExtractTest.searchPropertyPair();
+
+        Map<String, String> lexiconTypeMap = entityExtractTest.searchLexiconType();
+
+        String present = "";
+        String[] partPresents;
+        String sentenceId = "";
+        LexemePath<Lexeme> lexemes = null;
+        try {
+            for (int i = 0; i < data.size(); i++) {
+                present = data.get(i).get("xbs");
+                present = present.replaceAll("\r\n", "");
+                sentenceId = data.get(i).get("zyxh");
+                partPresents = present.split(";|;|。");
+                for (int k = 0; k < partPresents.length; k++) {
+                    if (partPresents[k].length() == 0) {
+                        continue;
+                    }
+
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
     public List<Map<String, String>> searchData() {
         MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/nlp-web?useUnicode=true&characterEncoding=UTF-8");
         List<Map<String, String>> data = nlpJdbc.query("tb_ryjl_extract", new String[]{"zyxh", "xbs"}, " limit 0, 3");
@@ -114,6 +147,32 @@ public class EntityExtractTest {
         return result;
     }
 
+    public List<Map<String, String>> searchTaggingResult() {
+        MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/nlp-web?useUnicode=true&characterEncoding=UTF-8");
+        List<Map<String, String>> data = nlpJdbc.query("re_tagging_result_part", new String[]{"sentence_id", "sentence_uuid", "sentence", "entity_1_name", "entity_2_name", "entity_1_position", "entity_2_position"}, " order by sentence_id, sentence_uuid");
+
+        Map<String, List<Map<String, List<Map<String, String>>>>> taggingResults = new HashMap<>();
+
+        String sentence_id = "";
+        String sentence_uuid = "";
+
+        List<Map<String, List<Map<String, String>>>> sentence_id_list = null;
+        Map<String, List<Map<String, String>>> sentence_id_map = null;
+        List<Map<String, String>> sentence_uuid_list = null;
+        for (Map<String, String> map : data) {
+            sentence_id = map.get("sentence_id");
+            sentence_uuid = map.get("sentence_uuid");
+            if (taggingResults.get(sentence_id) == null) {
+                sentence_id_list = new ArrayList<>();
+                sentence_uuid_list = new ArrayList<>();
+                sentence_uuid_list.add(map);
+
+
+            }
+        }
+        return data;
+    }
+
     public Map<String, List<String>> searchPropertyPair() {
         MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/nlp-web?useUnicode=true&characterEncoding=UTF-8");
         List<Map<String, String>> data = nlpJdbc.query("re_lexicon_property_pair", new String[]{"prop1_id", "prop2_id"}, " where has_relation = 1");
@@ -229,7 +288,7 @@ public class EntityExtractTest {
 
     public static boolean isNumberString(Lexeme l) {
         if (l == null) return false;
-        if (isFeature(l.getProperty(), new NegativeEnum[]{NegativeEnum.EVENT_TIME_DESC})) {
+        if (isFeature(l.getProperty(), new NegativeEnum[]{NegativeEnum.NUMBER_QUANTIFIER})) {
             return true;
         }
         for (char c : l.getText().toCharArray()) {
@@ -266,4 +325,80 @@ public class EntityExtractTest {
         return false;
     }
 
+    class TaggingResult {
+        private String sentence_id;
+        private String sentence_uuid;
+        private String sentence;
+        private String entity_1_name;
+        private String entity_2_name;
+        private String entity_1_position;
+        private String entity_2_position;
+
+        List<TaggingResult> taggingResults = new ArrayList<>();
+
+        public String getSentence_id() {
+            return sentence_id;
+        }
+
+        public void setSentence_id(String sentence_id) {
+            this.sentence_id = sentence_id;
+        }
+
+        public String getSentence_uuid() {
+            return sentence_uuid;
+        }
+
+        public void setSentence_uuid(String sentence_uuid) {
+            this.sentence_uuid = sentence_uuid;
+        }
+
+        public String getSentence() {
+            return sentence;
+        }
+
+        public void setSentence(String sentence) {
+            this.sentence = sentence;
+        }
+
+        public String getEntity_1_name() {
+            return entity_1_name;
+        }
+
+        public void setEntity_1_name(String entity_1_name) {
+            this.entity_1_name = entity_1_name;
+        }
+
+        public String getEntity_2_name() {
+            return entity_2_name;
+        }
+
+        public void setEntity_2_name(String entity_2_name) {
+            this.entity_2_name = entity_2_name;
+        }
+
+        public String getEntity_1_position() {
+            return entity_1_position;
+        }
+
+        public void setEntity_1_position(String entity_1_position) {
+            this.entity_1_position = entity_1_position;
+        }
+
+        public String getEntity_2_position() {
+            return entity_2_position;
+        }
+
+        public void setEntity_2_position(String entity_2_position) {
+            this.entity_2_position = entity_2_position;
+        }
+
+        public List<TaggingResult> getTaggingResults() {
+            return taggingResults;
+        }
+
+        public void setTaggingResults(List<TaggingResult> taggingResults) {
+            this.taggingResults = taggingResults;
+        }
+    }
+
 }

+ 174 - 40
push-web/src/main/resources/static/pages/relation/sample.html

@@ -176,6 +176,98 @@
                 </div>
             </div>
             <!-- /.box -->
+
+            <!-- TABLE: LATEST ORDERS -->
+            <div class="box box-info">
+                <div class="box-header with-border">
+                    <h3 class="box-title">体征信息</h3>
+                    <div class="box-tools pull-right">
+                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
+                        </button>
+                        <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
+                    </div>
+                </div>
+                <!-- /.box-header -->
+                <div class="box-body">
+                    <div class="table-responsive">
+                        <table class="table no-margin">
+                            <thead>
+                            <tr>
+                                <th width="20%">项目名称</th>
+                                <th width="20%">部位</th>
+                                <th width="20%">结果信息</th>
+                                <th width="20%">程度</th>
+                                <th width="20%">阴性标识</th>
+                            </tr>
+                            </thead>
+                            <tbody id="vital_extract_id">
+                            </tbody>
+                        </table>
+                    </div>
+                    <!-- /.table-responsive -->
+                </div>
+            </div>
+            <!-- /.box -->
+
+            <!-- TABLE: LATEST ORDERS -->
+            <div class="box box-info">
+                <div class="box-header with-border">
+                    <h3 class="box-title">化验信息</h3>
+                    <div class="box-tools pull-right">
+                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
+                        </button>
+                        <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
+                    </div>
+                </div>
+                <!-- /.box-header -->
+                <div class="box-body">
+                    <div class="table-responsive">
+                        <table class="table no-margin">
+                            <thead>
+                            <tr>
+                                <th width="20%">项目名称</th>
+                                <th width="20%">结果信息</th>
+                                <th width="60%">其他</th>
+                            </tr>
+                            </thead>
+                            <tbody id="lis_extract_id">
+                            </tbody>
+                        </table>
+                    </div>
+                    <!-- /.table-responsive -->
+                </div>
+            </div>
+            <!-- /.box -->
+
+            <!-- TABLE: LATEST ORDERS -->
+            <div class="box box-info">
+                <div class="box-header with-border">
+                    <h3 class="box-title">检查信息</h3>
+                    <div class="box-tools pull-right">
+                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
+                        </button>
+                        <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
+                    </div>
+                </div>
+                <!-- /.box-header -->
+                <div class="box-body">
+                    <div class="table-responsive">
+                        <table class="table no-margin">
+                            <thead>
+                            <tr>
+                                <th width="20%">项目名称</th>
+                                <th width="20%">结果信息</th>
+                                <th width="60%">其他</th>
+                            </tr>
+                            </thead>
+                            <tbody id="pacs_extract_id">
+                            </tbody>
+                        </table>
+                    </div>
+                    <!-- /.table-responsive -->
+                </div>
+            </div>
+            <!-- /.box -->
             <script>
                 function _ajax(url) {
                     $.support.cors = true;
@@ -197,37 +289,35 @@
                         success: function (data) {
                             var outputInfos = data.data;
                             var h = "";
+                            var vital_h = "";
+                            var lis_h = "";
+                            var pacs_h = "";
                             $.each(outputInfos, function (index, outputInfo) {
                                 var symptoms = outputInfo.symptoms;
                                 if (symptoms != null) {
                                     $.each(symptoms, function (symptom_index, symptom) {
-                                        var hasProp = false;
                                         h += "<tr><td><strong>";
 
                                         if (symptom.negative != null) {
                                             h += symptom.negative.negaName;
-                                            hasProp = true;
                                         }
                                         h += symptom.symptomName + "</strong></td>"
 
                                         h += "<td>";
                                         if (symptom.pd != null) {
                                             h += symptom.pd.value;
-                                            hasProp = true;
                                         }
                                         h += "</td>";
 
                                         h += "<td>";
                                         if (symptom.property != null) {
                                             h += symptom.property.propertyName;
-                                            hasProp = true;
                                         }
                                         h += "</td>";
 
                                         h += "<td>";
                                         if (symptom.cause != null) {
                                             h += symptom.cause.causeName;
-                                            hasProp = true;
                                         }
                                         h += "</td>";
 
@@ -238,7 +328,6 @@
                                             } else {
                                                 h += symptom.degree.degreeName;
                                             }
-                                            hasProp = true;
                                         }
                                         h += "</span></td>";
 
@@ -249,54 +338,99 @@
                                             } else {
                                                 h += symptom.bodyPart.partBodyName;
                                             }
-                                            hasProp = true;
                                         }
-                                        h += "</td>";
-
-//                                        if (symptom.desc != null) {
-//                                            if (symptom.desc.degree != null) {
-//                                                h += "<dd>" + symptom.desc.info + "(" + symptom.item.degree.degreeName + ")</dd>";
-//                                            } else {
-//                                                h += "<dd>" + symptom.desc.info + "</dd>";
-//                                            }
-//                                            hasProp = true;
-//                                        }
+                                        h += "</td></tr>";
                                     });
                                 }
+
                                 var vitals = outputInfo.vitals;
                                 if (vitals != null) {
                                     $.each(vitals, function (vital_index, vital) {
-                                        var hasProp = false;
+                                        vital_h += "<tr><td>";
+                                        if (vital.vitalName != null) {
+                                            vital_h += vital.vitalName;
+                                        }
+                                        vital_h += "</td>";
+
+                                        vital_h += "<td>";
                                         if (vital.bodyPart != null) {
-                                            h += "<dt>" + vital.vitalName + "</dt>";
-                                            if (vital.item != null) {
-                                                h += "<dd>" + vital.item.itemName + "</dd>";
-                                                hasProp = true;
-                                            }
-                                            if (vital.bodyPart != null) {
-                                                if (vital.bodyPart.position != null) {
-                                                    h += "<dd>" + vital.bodyPart.position.positionName + vital.bodyPart.partBodyName + "</dd>";
-                                                } else {
-                                                    h += "<dd>" + vital.bodyPart.partBodyName + "</dd>";
-                                                }
-                                                hasProp = true;
-                                            }
-                                            if (vital.degree != null) {
-                                                h += "<dd>" + vital.degree.degreeName + "</dd>";
-                                                hasProp = true;
-                                            }
-                                            if (vital.negative != null) {
-                                                h += "<dd>" + vital.negative.negaName + "</dd>";
-                                                hasProp = true;
+                                            if (vital.bodyPart.position != null) {
+                                                vital_h += vital.bodyPart.position.positionName + vital.bodyPart.partBodyName;
+                                            } else {
+                                                vital_h += vital.bodyPart.partBodyName;
                                             }
                                         }
-                                        if (hasProp == false) {
-                                            h += "<dd></dd>";
+                                        vital_h += "</td>";
+
+                                        vital_h += "<td>";
+                                        if (vital.value != null) {
+                                            vital_h += vital.value;
+                                        }
+                                        if (vital.pd != null) {
+                                            vital_h += vital.pd.value;
+                                        }
+                                        vital_h += "</td>";
+
+                                        vital_h += "<td>";
+                                        if (vital.degree != null) {
+                                            vital_h += vital.degree.degreeName;
+                                        }
+                                        vital_h += "</td>";
+
+                                        vital_h += "<td>";
+                                        if (vital.negative != null) {
+                                            vital_h += vital.negative.negaName;
+                                        }
+                                        vital_h += "</td></tr>";
+                                    });
+                                }
+
+                                var lises = outputInfo.lises;
+                                if (lises != null) {
+                                    $.each(lises, function (lis_index, lis) {
+                                        lis_h += "<tr><td>";
+                                        if (lis.lisName != null) {
+                                            lis_h += lis.lisName;
+                                        }
+                                        lis_h += "</td>";
+
+                                        lis_h += "<td>";
+                                        if (lis.pd != null) {
+                                            lis_h += lis.pd.value;
                                         }
+                                        lis_h += "</td>";
+
+                                        lis_h += "<td>";
+                                        if (lis.value != null) {
+                                            lis_h += lis.value;
+                                        }
+                                        lis_h += "</td><td></td></tr>";
+                                    });
+                                }
+
+                                var pacses = outputInfo.pacses;
+                                if (pacses != null) {
+                                    $.each(pacses, function (lis_index, pacs) {
+                                        pacs_h += "<tr><td>";
+                                        if (pacs.pacsName != null) {
+                                            pacs_h += pacs.pacsName;
+                                        }
+                                        pacs_h += "</td>";
+
+                                        pacs_h += "<td>";
+                                        if (pacs.value != null) {
+                                            pacs_h += pacs.value;
+                                        }
+                                        pacs_h += "</td><td></td></tr>";
                                     });
                                 }
                             });
+
+
                             $("#symptom_extract_id").html(h);
+                            $("#vital_extract_id").html(vital_h);
+                            $("#lis_extract_id").html(lis_h);
+                            $("#pacs_extract_id").html(pacs_h);
                         }
                     });
                 };