Browse Source

修改给症状添加标准词部分

hujing 6 years ago
parent
commit
efd81c11fd

+ 12 - 6
bigdata-web/src/main/java/org/diagbot/bigdata/work/ParamsDataProxy.java

@@ -337,15 +337,15 @@ public class ParamsDataProxy {
                 for (Map<String, String> standWordMap : standWordList) {
                     if (standWordMap.containsKey("unit") && standWordMap.containsKey("value")) {
                         if (features.length == 2) {
-                            newStandWord = judgment(features, standWordMap, newStandWord,sData);
+                            newStandWord = judgment(features, standWordMap, newStandWord, sData);
                         } else {
                             if (standWordMap.get("unit").equals(features[2].toLowerCase())) {
-                                newStandWord = judgment(features, standWordMap, newStandWord,sData);
+                                newStandWord = judgment(features, standWordMap, newStandWord, sData);
                             }
                         }
                     } else if (standWordMap.containsKey("value")) {
                         if (features.length == 2) {
-                            newStandWord = judgment(features, standWordMap, newStandWord,sData);
+                            newStandWord = judgment(features, standWordMap, newStandWord, sData);
                         }
                     }
                 }
@@ -376,13 +376,14 @@ public class ParamsDataProxy {
     /**
      * 将标准词中体征指标值(数字)与分词结果中体征指标值(数字)比较
      * 除了血压>140/90mmHg类似标准词,其他标准词直接添加在症状后面
+     *
      * @param features
      * @param standWordMap
      * @param standWord
      * @param sData
      * @return 血压>140/90mmHg或血压小于90/60mmHg或同时返回,在addStandWord()中进一步处理
      */
-    private String judgment(String[] features, Map<String, String> standWordMap, String standWord,SearchData sData) {
+    private String judgment(String[] features, Map<String, String> standWordMap, String standWord, SearchData sData) {
         if (hasDigit(features[1])) {
             try {
                 if (">".equals(standWordMap.get("op"))) {
@@ -479,6 +480,7 @@ public class ParamsDataProxy {
 
     /**
      * 判断分词后的特征中是否含有数字
+     *
      * @param content
      * @return
      */
@@ -492,6 +494,7 @@ public class ParamsDataProxy {
 
     /**
      * 将字符串中的数字提取出来,针对分词结果中"90."类似情况
+     *
      * @param standWord
      * @return
      */
@@ -507,12 +510,15 @@ public class ParamsDataProxy {
 
     /**
      * 将血压超过标准值的标准词改为血压升高
+     *
      * @param standWord
      * @return
      */
-    private String proxy(String standWord){
-        if (standWord.contains("压") && (standWord.contains("≥") || standWord.contains("大于"))){
+    private String proxy(String standWord) {
+        if (standWord.contains("压") && (standWord.contains("≥") || standWord.contains("大于"))) {
             standWord = "血压升高";
+        } else if (standWord.contains("心率") && (standWord.contains("大于") || standWord.contains("超过"))) {
+            standWord = "心率快";
         }
         return standWord;
     }

+ 2 - 1
bigdata-web/src/test/java/org/diagbot/AddStandWordTest.java

@@ -36,7 +36,8 @@ public class AddStandWordTest {
         long cacheTime = endCacheTime - startTime;
         System.out.println("处理标准词最终用了:" + cacheTime + "毫秒.");
         SearchData searchData = new SearchData();
-        searchData.setSymptom("血压14/43mmhg,收缩压140mmhg,血压149/43mmhg");
+//        searchData.setSymptom("血压14/43mmhg,收缩压140mmhg,血压149/43mmhg");
+        searchData.setSymptom("心率120");
         long splitStartTime = System.currentTimeMillis();
         LexemePath<Lexeme> data = ParticipleUtil.participle(searchData.getSymptom());
         ParamsDataProxy paramsDataProxy = new ParamsDataProxy();