浏览代码

分诊症状推症状调用新的知识库

zhaops 5 年之前
父节点
当前提交
7e623d198e

+ 37 - 4
triage-service/src/main/java/com/diagbot/facade/AIV2Facade.java

@@ -1,10 +1,13 @@
 package com.diagbot.facade;
 package com.diagbot.facade;
 
 
 import com.diagbot.biz.push.entity.FeatureRateV2;
 import com.diagbot.biz.push.entity.FeatureRateV2;
+import com.diagbot.biz.push.entity.FeatureRateWithExplainV2;
 import com.diagbot.biz.push.entity.ResponseDataWithExplainV2;
 import com.diagbot.biz.push.entity.ResponseDataWithExplainV2;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.AiptServiceClient;
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.client.TranServiceClient;
+import com.diagbot.dto.AIDTO;
 import com.diagbot.dto.DiseaseDeptDTO;
 import com.diagbot.dto.DiseaseDeptDTO;
+import com.diagbot.dto.FeatureRateDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.SYFDTO;
 import com.diagbot.dto.SYFDTO;
 import com.diagbot.dto.SYFDeptDTO;
 import com.diagbot.dto.SYFDeptDTO;
@@ -44,11 +47,41 @@ public class AIV2Facade {
     private AssembleFacade assembleFacade;
     private AssembleFacade assembleFacade;
 
 
 
 
+    /**
+     * 症状推理
+     *
+     * @param aivo
+     * @param type
+     * @return
+     */
+    public AIDTO pushV2(AIVO aivo, String type) {
+        RespDTO<ResponseDataWithExplainV2> res
+                = aiptServiceClient.pushWithExplainV2(assembleFacade.assembleData(aivo, type));
+        RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
+        AIDTO aidto = new AIDTO();
+
+        List<FeatureRateWithExplainV2> symptom = res.data.getSymptom();
+        if (ListUtil.isNotEmpty(symptom)) {
+            List<FeatureRateDTO> symptomDTO = BeanUtil.listCopyTo(symptom, FeatureRateDTO.class);
+            aidto.setItems(symptomDTO);
+        }
+        return aidto;
+    }
+
+
+    /**
+     * 邵逸夫诊断推理
+     *
+     * @param aivo
+     * @param type
+     * @return
+     */
     public SYFDTO pushDisForSYFV2(AIVO aivo, String type) {
     public SYFDTO pushDisForSYFV2(AIVO aivo, String type) {
         if (StringUtil.isBlank(aivo.getHospitalCode())) {
         if (StringUtil.isBlank(aivo.getHospitalCode())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "请输入医院编码");
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "请输入医院编码");
         }
         }
-        RespDTO<ResponseDataWithExplainV2> res = aiptServiceClient.pushWithExplainV2(assembleFacade.assembleData(aivo, type));
+        RespDTO<ResponseDataWithExplainV2> res
+                = aiptServiceClient.pushWithExplainV2(assembleFacade.assembleData(aivo, type));
         RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
         RespDTOUtil.respNGDealCover(res, "中间层没有结果返回");
         SYFDTO syfdto = new SYFDTO();
         SYFDTO syfdto = new SYFDTO();
 
 
@@ -115,14 +148,14 @@ public class AIV2Facade {
                 featureRateList.addAll(disFeatureMap.get("可能诊断"));
                 featureRateList.addAll(disFeatureMap.get("可能诊断"));
             }
             }
 
 
-            if(ListUtil.isEmpty(featureRateList)){
+            if (ListUtil.isEmpty(featureRateList)) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "推理结果为空");
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "推理结果为空");
             }
             }
 
 
             //过滤科室为空的数据
             //过滤科室为空的数据
-            featureRateList=featureRateList
+            featureRateList = featureRateList
                     .stream()
                     .stream()
-                    .filter(i->StringUtil.isNotBlank(i.getConcatDept()))
+                    .filter(i -> StringUtil.isNotBlank(i.getConcatDept()))
                     .collect(Collectors.toList());
                     .collect(Collectors.toList());
 
 
             List<SYFFeatureDTO> syfFeatureDTOList = featureRateList
             List<SYFFeatureDTO> syfFeatureDTOList = featureRateList

+ 1 - 1
triage-service/src/main/java/com/diagbot/web/AIController.java

@@ -47,7 +47,7 @@ public class AIController {
     @PostMapping("/pushSymptom")
     @PostMapping("/pushSymptom")
     @SysLogger("pushSymptom")
     @SysLogger("pushSymptom")
     public RespDTO<AIDTO> pushSymptom(@RequestBody @Valid AIVO aivo) {
     public RespDTO<AIDTO> pushSymptom(@RequestBody @Valid AIVO aivo) {
-        return RespDTO.onSuc(aiFacade.push(aivo, "1"));
+        return RespDTO.onSuc(aiv2Facade.pushV2(aivo, "1"));
     }
     }
 
 
     /**
     /**