Selaa lähdekoodia

更新分词,在分词时根据不同类别,将词性无关的词剔除;增加测试界面中化验和辅检结果的输入

MarkHuang 6 vuotta sitten
vanhempi
commit
b95095b8fa

+ 48 - 4
bigdata-web/src/main/java/org/diagbot/bigdata/work/ParamsDataProxy.java

@@ -16,10 +16,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.util.StringUtils;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @ClassName org.diagbot.bigdata.work.ParamsDataProxy
@@ -82,6 +79,9 @@ public class ParamsDataProxy {
             List<Map<String, Object>> featuresList = fa.start(searchData.getSymptom(), FeatureType.FEATURE);
             paramFeatureInit(searchData, featuresList);
 
+            // 清洗特征词,去除词性不匹配的词
+            searchData = cleanFeature(featuresList, fa, searchData);
+
             //如果既往史中诊断信息,需要提取这个特征
             featuresList = fa.start(searchData.getOther(), FeatureType.DIAG);
             paramFeatureInit(searchData, featuresList);
@@ -359,4 +359,48 @@ public class ParamsDataProxy {
     }
 
 
+    private SearchData cleanFeature(List<Map<String, Object>> featuresList, FeatureAnalyze fa,
+                                    SearchData searchData) {
+        // 在输入的辅检文本中,只提取辅检信息
+        String[] PACS_Feature = {Constants.word_property_PACS,
+                Constants.word_property_PACS_Detail, Constants.word_property_PACS_Result};
+        searchData = removeFeature(featuresList, fa, searchData, PACS_Feature);
+
+        // 在输入的化验文本中,只提取化验信息
+        String[] LIS_Feature = {Constants.word_property_LIS,
+                Constants.word_property_LIS_Detail, Constants.word_property_LIS_Result};
+        searchData = removeFeature(featuresList, fa, searchData, LIS_Feature);
+
+        return searchData;
+    }
+
+    private SearchData removeFeature(List<Map<String, Object>> featureList, FeatureAnalyze fa,
+                                     SearchData searchData, String[] Feature) {
+        String name = "";
+        Boolean related = false;
+
+        try {
+            // 在输入的辅检文本中,只提取辅检信息
+            featureList = fa.start(searchData.getPacs(), FeatureType.FEATURE);
+            for (Map<String, Object> item: featureList) {
+                name = item.get("feature_name").toString();
+                String[] property = item.get("property").toString().split(",");
+                for (String prop:property) {
+                    if (Arrays.asList(Feature).indexOf(prop) >= 0) {
+                        related = true;
+                        break;
+                    }
+                }
+
+                if (!related) {
+                    searchData.getInputs().remove(name);
+                }
+            }
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            return searchData;
+        }
+    }
 }

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

@@ -12,7 +12,9 @@ public class Constants {
     public final static String feature_type_diag  = "2";    //诊断
     public final static String feature_type_vital  = "3";   //体征
     public final static String feature_type_lis = "4";      //化验
+    public final static String feature_type_lis_result = "14";      //化验结果
     public final static String feature_type_pacs = "5";     //检查
+    public final static String feature_type_pacs_result = "17";     //检查结果
     public final static String feature_type_treat = "6";       //治疗
     public final static String feature_type_history = "7";       //历史
     public final static String feature_type_feature = "9"; //症状描述中的特征信息 如部位、性质等
@@ -54,12 +56,14 @@ public class Constants {
     public final static String word_property_cause = "5";
     public final static String word_property_degree = "6";
     public final static String word_property_neg = "7";
-    public final static String word_property_med = "10";
+    public final static String word_property_med = "53";
+    public final static String word_property_medcom = "54";
     public final static String word_property_treat = "11";
     public final static String word_property_LIS = "12";
     public final static String word_property_LIS_Detail = "13";
     public final static String word_property_LIS_Result = "14";
     public final static String word_property_PACS = "15";
+    public final static String word_property_PACS_Detail = "16";
     public final static String word_property_PACS_Result = "17";
     public final static String word_property_diagnose = "18";
     public final static String word_property_direction = "20";

+ 24 - 0
push-web/src/main/resources/static/pages/algorithm/list.html

@@ -99,6 +99,14 @@
                     <label for="other_id">其他史</label>&nbsp;
                     <input type="text" id="other_id" placeholder="" size="150">&nbsp;&nbsp;&nbsp;&nbsp;
                 </div>
+                <div class="form-group">
+                    <label for="other_id">化验结果</label>&nbsp;
+                    <input type="text" id="lis_id" placeholder="" size="140">&nbsp;&nbsp;&nbsp;&nbsp;
+                </div>
+                <div class="form-group">
+                    <label for="other_id">辅检结果</label>&nbsp;
+                    <input type="text" id="pacs_id" placeholder="" size="140">&nbsp;&nbsp;&nbsp;&nbsp;
+                </div>
                 <div class="form-group">
                     <label for="diag_id">诊断</label>&nbsp;
                     <input type="text" id="diag_id" placeholder="" size="50">&nbsp;&nbsp;&nbsp;&nbsp;
@@ -391,6 +399,8 @@
                     d.algorithmClassifyValue =  algorithmClassify;
                     var symptom = $("#symptom_id").val();
                     var other = $("#other_id").val();
+                    var lis = $("#lis_id").val();
+                    var pacs = $("#pacs_id").val();
                     var diag = $("#diag_id").val();
                     var length = $("#length").val();
                     var sex = $("#sex").val();
@@ -405,6 +415,12 @@
                     if (other != null && other != undefined) {
                         d.other = other;
                     }
+                    if (lis != null && lis != undefined) {
+                        d.lis = lis;
+                    }
+                    if (pacs != null && pacs != undefined) {
+                        d.pacs = pacs;
+                    }
                     if (diag != null && diag != undefined && diag != '') {
                         d.diag = diag;
                     }
@@ -485,6 +501,8 @@
                     d.algorithmClassifyValue =  algorithmClassify;
                     var symptom = $("#symptom_id").val();
                     var other = $("#other_id").val();
+                    var lis = $("#lis_id").val();
+                    var pacs = $("#pacs_id").val();
                     var diag = $("#diag_id").val();
                     var length = $("#length").val();
                     var sex = $("#sex").val();
@@ -499,6 +517,12 @@
                     if (other != null && other != undefined) {
                         d.other = other;
                     }
+                    if (lis != null && lis != undefined) {
+                        d.lis = lis;
+                    }
+                    if (pacs != null && pacs != undefined) {
+                        d.pacs = pacs;
+                    }
                     if (diag != null && diag != undefined && diag != '') {
                         d.diag = diag;
                     }