Преглед изворни кода

推理结果关联静态知识

zhaops пре 4 година
родитељ
комит
9d423c5137

+ 10 - 0
src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -2,6 +2,7 @@ package com.diagbot.client;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.client.hystrix.CdssCoreHystrix;
+import com.diagbot.dto.ConceptDetailDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndicationDTO;
@@ -152,6 +153,15 @@ public interface CdssCoreClient {
     @PostMapping("/kl/conceptStatic/isExist")
     RespDTO<Boolean> isExist(@Valid @RequestBody KlConceptStaticVO klConceptStaticVO);
 
+    /**
+     * 推理结果匹配静态知识
+     *
+     * @param getDetailVO
+     * @return
+     */
+    @PostMapping("/kl/conceptStatic/getDetailByConcept")
+    RespDTO<Map<String, List<ConceptDetailDTO>>> getDetailByConcept(@Valid @RequestBody GetDetailVO getDetailVO);
+
     /**
      * 获取规则下拉菜单信息
      *

+ 13 - 1
src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java

@@ -2,6 +2,7 @@ package com.diagbot.client.hystrix;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.client.CdssCoreClient;
+import com.diagbot.dto.ConceptDetailDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.IndicationDTO;
@@ -198,6 +199,17 @@ public class CdssCoreHystrix implements CdssCoreClient {
         return null;
     }
 
+    /**
+     * 推理结果匹配静态知识
+     *
+     * @param getDetailVO
+     * @return
+     */
+    public RespDTO<Map<String, List<ConceptDetailDTO>>> getDetailByConcept(@Valid @RequestBody GetDetailVO getDetailVO) {
+        log.error("【hystrix】调用{}异常", "getDetailByConcept");
+        return null;
+    }
+
     @Override
     public RespDTO<List<KlRuleMenuWrapper>> getMenus(KlRuleMenuVO klRuleMenuVO) {
         log.error("【hystrix】调用{}异常", "getMenus");
@@ -251,4 +263,4 @@ public class CdssCoreHystrix implements CdssCoreClient {
         log.error("【hystrix】调用{}异常", "searchConcept");
         return null;
     }
-}
+}

+ 19 - 13
src/main/java/com/diagbot/facade/PushFacade.java

@@ -2,6 +2,7 @@ package com.diagbot.facade;
 
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.dto.BillMsg;
+import com.diagbot.dto.ConceptDetailDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.PushBaseDTO;
@@ -9,12 +10,12 @@ import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.PushPlanDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.TreatDTO;
-import com.diagbot.entity.ConceptDetail;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
+import com.diagbot.vo.GetDetailVO;
 import com.diagbot.vo.IndicationPushVO;
 import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
@@ -131,8 +132,6 @@ public class PushFacade {
         List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
         Map<Integer, String> dicStaticTypeValNameMap =
                 EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
-        Map<String, Integer> dicStaticTypeNameValMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "name", "val");
 
         if (ListUtil.isNotEmpty(pushDTO.getLis())) {
             conceptBaseList.addAll(pushDTO.getLis());
@@ -158,7 +157,14 @@ public class PushFacade {
                     .map(i -> i.getName())
                     .collect(Collectors.toList());
 
-            Map<String, List<ConceptDetail>> conceptDetailMap = conceptInfoFacade.getDetailByConcept(conceptNameList, Arrays.asList(new Integer[] { 1, 2, 3 }));
+            GetDetailVO getDetailVO = new GetDetailVO();
+            getDetailVO.setNameList(conceptNameList);
+            getDetailVO.setContentTypes(Arrays.asList(new Integer[] { 1, 2, 3 }));
+            RespDTO<Map<String, List<ConceptDetailDTO>>> respDTO = cdssCoreClient.getDetailByConcept(getDetailVO);
+            if (RespDTOUtil.respIsNG(respDTO)) {
+                return pushDTO;
+            }
+            Map<String, List<ConceptDetailDTO>> conceptDetailMap = respDTO.data;
             if (pushDTO.getDis() != null) {
                 for (Map.Entry<String, List<PushBaseDTO>> entry : pushDTO.getDis().entrySet()) {
                     if (ListUtil.isNotEmpty(entry.getValue())) {
@@ -182,11 +188,6 @@ public class PushFacade {
                     if (conceptDetailMap.containsKey(item.getName() + "_" + dicStaticTypeValNameMap.get("5"))) {
                         item.setHasInfo(1);
                     }
-                    /*if (item.getHasInfo().equals(0)) {
-                        if (conceptDetailMap.containsKey(item.getName() + "_" + dicStaticTypeValNameMap.get("6))) {
-                            item.setHasInfo(1);
-                        }
-                    }*/
                 });
             }
             if (ListUtil.isNotEmpty(pushDTO.getMedicines())) {
@@ -220,14 +221,19 @@ public class PushFacade {
         List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
         Map<Integer, String> dicStaticTypeValNameMap =
                 EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
-        Map<String, Integer> dicStaticTypeNameValMap =
-                EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "name", "val");
         if (ListUtil.isNotEmpty(retGeneraTreat)) {
             List<String> conceptNameList = retGeneraTreat.stream()
                     .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
                     .map(i -> i.getUniqueName())
                     .collect(Collectors.toList());
-            Map<String, List<ConceptDetail>> conceptDetailMap = conceptInfoFacade.getDetailByConcept(conceptNameList, Arrays.asList(new Integer[] { 4 }));
+            GetDetailVO getDetailVO = new GetDetailVO();
+            getDetailVO.setNameList(conceptNameList);
+            getDetailVO.setContentTypes(Arrays.asList(new Integer[] { 4 }));
+            RespDTO<Map<String, List<ConceptDetailDTO>>> respDTO = cdssCoreClient.getDetailByConcept(getDetailVO);
+            if (RespDTOUtil.respIsNG(respDTO)) {
+                return retGeneraTreat;
+            }
+            Map<String, List<ConceptDetailDTO>> conceptDetailMap = respDTO.data;
             if (conceptDetailMap == null || conceptDetailMap.size() == 0) {
                 return retGeneraTreat;
             }
@@ -235,7 +241,7 @@ public class PushFacade {
                 if (StringUtil.isNotBlank(treatDTO.getUniqueName())) {
                     String key = treatDTO.getUniqueName() + "_" + dicStaticTypeValNameMap.get("1");
                     if (conceptDetailMap.containsKey(key)) {
-                        List<ConceptDetail> conceptDetailList = conceptDetailMap.get(key);
+                        List<ConceptDetailDTO> conceptDetailList = conceptDetailMap.get(key);
                         treatDTO.setGeneraTreat(conceptDetailList
                                 .stream()
                                 .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("4"))

+ 18 - 0
src/main/java/com/diagbot/vo/GetDetailVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/3/19 13:33
+ */
+@Getter
+@Setter
+public class GetDetailVO {
+    List<String> nameList;
+    List<Integer> contentTypes;
+}