Browse Source

同义词结构调整

zhoutg 4 years ago
parent
commit
3349c95c29

+ 2 - 2
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -168,10 +168,10 @@ public class CommonFacade {
         CoreUtil.setPropertyList(presentLabel.getMedicines(), map.get(StandConvertEnum.drug.getName()));
         CoreUtil.setPropertyList(presentLabel.getMedicines(), map.get(StandConvertEnum.drug.getName()));
         CoreUtil.setPropertyList(pastLabel.getAllergyMedicines(), map.get(StandConvertEnum.drug.getName()));
         CoreUtil.setPropertyList(pastLabel.getAllergyMedicines(), map.get(StandConvertEnum.drug.getName()));
         CoreUtil.setPropertyList(wordCrfDTO.getDrugOrder(),"name", "uniqueName", map.get(StandConvertEnum.drug.getName()));
         CoreUtil.setPropertyList(wordCrfDTO.getDrugOrder(),"name", "uniqueName", map.get(StandConvertEnum.drug.getName()));
-        // TODO: 2020/8/5 化验回填
+        //化验回填
         CoreUtil.setPropertyList(lis, "name", "detailName", "uniqueName", map.get(StandConvertEnum.lis.getName()));
         CoreUtil.setPropertyList(lis, "name", "detailName", "uniqueName", map.get(StandConvertEnum.lis.getName()));
         CoreUtil.setPropertyList(wordCrfDTO.getLisOrder(), "name", "detailName", "uniqueName", map.get(StandConvertEnum.lis.getName()));
         CoreUtil.setPropertyList(wordCrfDTO.getLisOrder(), "name", "detailName", "uniqueName", map.get(StandConvertEnum.lis.getName()));
-        // TODO: 2020/8/5 辅助检查回填
+        //辅助检查回填
         CoreUtil.setPropertyList(pacsNews, "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
         CoreUtil.setPropertyList(pacsNews, "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
         CoreUtil.setPropertyList(wordCrfDTO.getPacsOrder(), "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
         CoreUtil.setPropertyList(wordCrfDTO.getPacsOrder(), "name", "uniqueName", map.get(StandConvertEnum.pacs.getName()));
         //体征回填
         //体征回填

+ 17 - 29
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -36,13 +36,14 @@ import com.diagbot.vo.BillNeoVO;
 import com.diagbot.vo.CriticalNeoVO;
 import com.diagbot.vo.CriticalNeoVO;
 import com.diagbot.vo.HighRiskNeoVO;
 import com.diagbot.vo.HighRiskNeoVO;
 import com.diagbot.vo.NeoPushVO;
 import com.diagbot.vo.NeoPushVO;
-import com.diagbot.vo.PushNeoVO;
 import com.diagbot.vo.StandConvert;
 import com.diagbot.vo.StandConvert;
 import com.diagbot.vo.StandConvertCrfVO;
 import com.diagbot.vo.StandConvertCrfVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashMap;
@@ -81,6 +82,8 @@ public class NeoFacade {
     StandConvertServiceClient standConvertServiceClient;
     StandConvertServiceClient standConvertServiceClient;
     @Autowired
     @Autowired
     RedisUtil redisUtil;
     RedisUtil redisUtil;
+    @Value("StandConvert.rate")
+    String standConvertRate;
 
 
     /**
     /**
      * 返回药品缓存信息
      * 返回药品缓存信息
@@ -117,32 +120,6 @@ public class NeoFacade {
         return res;
         return res;
     }
     }
 
 
-    /**
-     * 返回文本相似度匹配需要的词性列表
-     *
-     * @return
-     */
-    @Cacheable(value = "cache", key = "'similarCache'")
-    public Map<String, List<String>> getSimilarCache() {
-        Map<String, List<String>> res = new HashMap<>();
-        // 临床表现,诊断,化验,辅检,药品,查体,手术
-        // TODO 测试数据
-        res.put(StandConvertEnum.symptom.getName(), Arrays.asList("胸痛","咳嗽"));
-        res.put(StandConvertEnum.disease.getName(), Arrays.asList("高血压", "糖尿病"));
-        return res;
-    }
-
-    /**
-     * 通过诊断反推
-     *
-     * @return
-     */
-    public Map<String, PushDTO> getInverse(PushNeoVO pushNeoVO) {
-        Map<String, PushDTO> map = getDiag(pushNeoVO.getDiags());
-
-        return map;
-    }
-
     /**
     /**
      * 图谱推送出来的数据
      * 图谱推送出来的数据
      * @param pushVO
      * @param pushVO
@@ -353,7 +330,7 @@ public class NeoFacade {
         try {
         try {
             standConvertCrfBatchDTO = standConvertServiceClient.similarityBatch(standConvertCrfVOList);
             standConvertCrfBatchDTO = standConvertServiceClient.similarityBatch(standConvertCrfVOList);
         } catch (Exception e) {
         } catch (Exception e) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准词转换服务出错!【找毕金良】" + e.getMessage());
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准词转换【服务器】挂了!" + e.getMessage());
         }
         }
         Map<String, Map<String, StandConvertCrfDTO>> crfMap = standConvertCrfBatchDTO.getData();
         Map<String, Map<String, StandConvertCrfDTO>> crfMap = standConvertCrfBatchDTO.getData();
         getConvertMap(crfMap, StandConvertEnum.symptom.getName(), clinicalConList, standConvert.getClinicalList(), map);
         getConvertMap(crfMap, StandConvertEnum.symptom.getName(), clinicalConList, standConvert.getClinicalList(), map);
@@ -429,7 +406,18 @@ public class NeoFacade {
             for (String s : convertList) {
             for (String s : convertList) {
                 StandConvertCrfDTO standConvertCrfDTO = crfMap.get(s);
                 StandConvertCrfDTO standConvertCrfDTO = crfMap.get(s);
                 if (standConvertCrfDTO != null) {
                 if (standConvertCrfDTO != null) {
-                    redisMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
+                    String rateStr = standConvertCrfDTO.getStandard_words().get(0).get("rate");
+                    if (StringUtil.isBlank(rateStr)) {
+                        redisMap.put(s, s); // 没有rate就用原词
+                    } else {
+                        BigDecimal rate = new BigDecimal(rateStr);
+                        int flag = rate.compareTo(new BigDecimal(standConvertRate));
+                        if (flag < 0) {
+                            redisMap.put(s, s); // rate 小于阈值
+                        } else {
+                            redisMap.put(s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
+                        }
+                    }
                 } else {
                 } else {
                     redisMap.put(s, s); // 找不到就认为是标准词
                     redisMap.put(s, s); // 找不到就认为是标准词
                 }
                 }

+ 2 - 2
src/main/java/com/diagbot/model/ai/BeHospitalizedAI.java

@@ -154,7 +154,7 @@ public class BeHospitalizedAI extends ModelAI {
 
 
                 StringBuffer sb = new StringBuffer();
                 StringBuffer sb = new StringBuffer();
                 for (PacsNew pacsNew : collect) {
                 for (PacsNew pacsNew : collect) {
-                    sb.append(StringUtils.isNotBlank(pacsNew.getUniqueName())? pacsNew.getUniqueName():pacsNew.getName()+ ":").append(pacsNew.getResult() + "。\n");
+                    sb.append(StringUtils.isNotBlank(pacsNew.getUniqueName())? pacsNew.getUniqueName() + ":":pacsNew.getName()+ ":").append(pacsNew.getResult() + "。\n");
                 }
                 }
                 pacsLabel.setText(sb.toString());
                 pacsLabel.setText(sb.toString());
                 pacsLabel.setAiText(sb.toString());
                 pacsLabel.setAiText(sb.toString());
@@ -216,7 +216,7 @@ public class BeHospitalizedAI extends ModelAI {
             try {
             try {
                  midData = loadAI(crfContent, crfServiceClient);
                  midData = loadAI(crfContent, crfServiceClient);
             } catch (Exception e) {
             } catch (Exception e) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "调用CRF模型出错!" + e.getMessage());
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "CRF模型【服务器】挂了!" + e.getMessage());
             }
             }
             /* 处理主诉 */
             /* 处理主诉 */
             if (StringUtil.isNotBlank(wordCrfDTO.getChiefLabel().getText())) {
             if (StringUtil.isNotBlank(wordCrfDTO.getChiefLabel().getText())) {

+ 0 - 1
src/main/java/com/diagbot/util/CoreUtil.java

@@ -147,7 +147,6 @@ public class CoreUtil {
      * @param standName : 要替换的属性名
      * @param standName : 要替换的属性名
      * @param value : 将要设置的值
      * @param value : 将要设置的值
      */
      */
-
     public static void setFieldValue(Object object, String name, String standName, Map<String, String> value){
     public static void setFieldValue(Object object, String name, String standName, Map<String, String> value){
 
 
         //根据 对象和属性名通过反射 调用上面的方法获取 Field对象
         //根据 对象和属性名通过反射 调用上面的方法获取 Field对象

+ 41 - 41
src/main/java/com/diagbot/web/KgController.java

@@ -1,41 +1,41 @@
-package com.diagbot.web;
-
-import com.diagbot.annotation.SysLogger;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.facade.KgFacade;
-import com.diagbot.vo.KgQueryVO;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.annotations.ApiIgnore;
-
-/**
- * @Description: 朗通知识图谱控制层
- * @author: zhoutg
- * @time: 2018/8/30 10:12
- */
-@RestController
-@RequestMapping("/kg")
-@Api(value = "朗通知识图谱API", tags = { "朗通知识图谱API" })
-@SuppressWarnings("unchecked")
-@Slf4j
-@ApiIgnore
-public class KgController {
-
-    @Autowired
-    private KgFacade kgFacade;
-
-    @ApiOperation(value = "查询节点", notes = "查询节点")
-    @PostMapping("/getNode")
-    @SysLogger("getNode")
-    public RespDTO<String> getTree(@RequestBody KgQueryVO kgQueryVO) {
-        return RespDTO.onSuc(kgFacade.getTreeFac(kgQueryVO));
-    }
-
-}
-
+// package com.diagbot.web;
+//
+// import com.diagbot.annotation.SysLogger;
+// import com.diagbot.dto.RespDTO;
+// import com.diagbot.facade.KgFacade;
+// import com.diagbot.vo.KgQueryVO;
+// import io.swagger.annotations.Api;
+// import io.swagger.annotations.ApiOperation;
+// import lombok.extern.slf4j.Slf4j;
+// import org.springframework.beans.factory.annotation.Autowired;
+// import org.springframework.web.bind.annotation.PostMapping;
+// import org.springframework.web.bind.annotation.RequestBody;
+// import org.springframework.web.bind.annotation.RequestMapping;
+// import org.springframework.web.bind.annotation.RestController;
+// import springfox.documentation.annotations.ApiIgnore;
+//
+// /**
+//  * @Description: 朗通知识图谱控制层
+//  * @author: zhoutg
+//  * @time: 2018/8/30 10:12
+//  */
+// @RestController
+// @RequestMapping("/kg")
+// @Api(value = "朗通知识图谱API", tags = { "朗通知识图谱API" })
+// @SuppressWarnings("unchecked")
+// @Slf4j
+// @ApiIgnore
+// public class KgController {
+//
+//     @Autowired
+//     private KgFacade kgFacade;
+//
+//     @ApiOperation(value = "查询节点", notes = "查询节点")
+//     @PostMapping("/getNode")
+//     @SysLogger("getNode")
+//     public RespDTO<String> getTree(@RequestBody KgQueryVO kgQueryVO) {
+//         return RespDTO.onSuc(kgFacade.getTreeFac(kgQueryVO));
+//     }
+//
+// }
+//

+ 2 - 1
src/main/resources/application-dev.yml

@@ -152,4 +152,5 @@ ChiefPresentSimilarity:
   url: http://192.168.2.234:3456
   url: http://192.168.2.234:3456
 
 
 StandConvert:
 StandConvert:
-  url: http://192.168.3.150:23232
+  url: http://192.168.3.150:23232
+  rate: 0.9

+ 2 - 1
src/main/resources/application-local.yml

@@ -152,4 +152,5 @@ ChiefPresentSimilarity:
   url: http://192.168.2.234:3456
   url: http://192.168.2.234:3456
 
 
 StandConvert:
 StandConvert:
-  url: http://192.168.3.150:23232
+  url: http://192.168.3.150:23232
+  rate: 0.9

+ 2 - 1
src/main/resources/application-pre.yml

@@ -152,4 +152,5 @@ ChiefPresentSimilarity:
   url: http://192.168.2.234:3456
   url: http://192.168.2.234:3456
 
 
 StandConvert:
 StandConvert:
-  url: http://192.168.3.150:23232
+  url: http://192.168.3.150:23232
+  rate: 0.9

+ 1 - 0
src/main/resources/application-pro.yml

@@ -155,3 +155,4 @@ ChiefPresentSimilarity:
 
 
 StandConvert:
 StandConvert:
   url: http://192.168.3.150:23232
   url: http://192.168.3.150:23232
+  rate: 0.9

+ 2 - 1
src/main/resources/application-test.yml

@@ -152,4 +152,5 @@ ChiefPresentSimilarity:
   url: http://192.168.2.234:3456
   url: http://192.168.2.234:3456
 
 
 StandConvert:
 StandConvert:
-  url: http://192.168.3.150:23232
+  url: http://192.168.3.150:23232
+  rate: 0.9