Quellcode durchsuchen

Merge remote-tracking branch 'origin/dev/icss' into dev/icss

zhoutg vor 6 Jahren
Ursprung
Commit
3b5f8721d1

+ 21 - 0
icss-service/src/main/java/com/diagbot/client/HighRiskServiceClient.java

@@ -0,0 +1,21 @@
+package com.diagbot.client;
+
+import com.diagbot.client.bean.GdbResponse;
+import com.diagbot.client.bean.Response;
+import com.diagbot.client.hystrix.HighRiskServiceHystrix;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/21 11:38
+ */
+@FeignClient(name = "HighRisk", url = "${ai.server.address}", fallback = HighRiskServiceHystrix.class)
+public interface HighRiskServiceClient {
+    @PostMapping(value = "/web/graphdb/HighRisk")
+    Response<GdbResponse> highRiskPageData(@RequestBody Map<String, String> map);
+}

+ 24 - 0
icss-service/src/main/java/com/diagbot/client/hystrix/HighRiskServiceHystrix.java

@@ -0,0 +1,24 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.HighRiskServiceClient;
+import com.diagbot.client.bean.GdbResponse;
+import com.diagbot.client.bean.Response;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/21 11:48
+ */
+@Component
+@Slf4j
+public class HighRiskServiceHystrix implements HighRiskServiceClient {
+    @Override
+    public Response<GdbResponse> highRiskPageData(Map<String, String> map) {
+        log.error("【hystrix】调用{}异常", "highRiskPageData");
+        return null;
+    }
+}

+ 6 - 2
icss-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java

@@ -179,8 +179,12 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         QueryWrapper<InquiryInfo> queryWrapper = new QueryWrapper<InquiryInfo>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
         queryWrapper.eq("hospital_id", hisInquirysVO.getHospitalId());
-        queryWrapper.eq("hospital_dept_id", hisInquirysVO.getHospitalDeptId());
-        queryWrapper.eq("doctor_id", hisInquirysVO.getDoctorId());
+        if(hisInquirysVO.getHospitalDeptId()!=null){
+        	queryWrapper.eq("hospital_dept_id", hisInquirysVO.getHospitalDeptId());
+        }
+        if(hisInquirysVO.getDoctorId()!=null){
+        	queryWrapper.eq("doctor_id", hisInquirysVO.getDoctorId());
+        }
         if (hisInquirysVO.getPatientId() != null) {
             queryWrapper.eq("patient_id", hisInquirysVO.getPatientId());
         }

+ 31 - 3
icss-service/src/main/java/com/diagbot/facade/PushFacade.java

@@ -2,7 +2,9 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.AIServiceClient;
+import com.diagbot.client.HighRiskServiceClient;
 import com.diagbot.client.bean.FeatureRate;
+import com.diagbot.client.bean.GdbResponse;
 import com.diagbot.client.bean.Response;
 import com.diagbot.client.bean.ResponseData;
 import com.diagbot.client.bean.SearchData;
@@ -31,11 +33,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -56,6 +60,8 @@ public class PushFacade {
     private VitalOrderFacade vitalOrderFacade;
     @Autowired
     private TreatmentFacade treatmentFacade;
+    @Autowired
+    private HighRiskServiceClient highRiskServiceClient;
 
     /**
      * 推理接口
@@ -91,6 +97,9 @@ public class PushFacade {
         searchData.setLength(10);
 
         Response<ResponseData> res = aiServiceClient.bayesPageData(searchData);
+        if (null == res || null == res.getData()) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "AI没有返回结果");
+        }
         return res.getData();
     }
 
@@ -129,14 +138,33 @@ public class PushFacade {
         //诊断 返回tagName+标签
         if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Disease.getKey()))) {
             Map<String, List<QuestionDTO>> disMapDTO = new LinkedHashMap<>();
-            Map<String, List<FeatureRate>> disFeatureMap=new LinkedHashMap<>();
+            Map<String, List<FeatureRate>> disFeatureMap = new LinkedHashMap<>();
+            //警惕
+            List<String> diseaseNameList = dis.stream().map(disease -> disease.getFeatureName()).collect(Collectors.toList());
+            Map<String, String> highRiskMap = new HashMap<>();
+            highRiskMap.put("disease", String.join(",", diseaseNameList));
+            Response<GdbResponse> graphRes = highRiskServiceClient.highRiskPageData(highRiskMap);
+            if (graphRes != null) {
+                Map<String, String> graphResult = graphRes.getData().getResult();
+                if (graphResult.size() > 0) {
+                    Map<String, Object> disMap = new LinkedHashMap<>();
+                    for (Map.Entry<String, String> entry : graphResult.entrySet()) {
+                        if (entry.getValue().equals("1")) {
+                            disMap.put(entry.getKey(), "");
+                        }
+                    }
+                    List<QuestionDTO> disDTO = getTagListByMap(disMap, pushVO, QuestionTypeEnum.Disease.getKey());
+                    disMapDTO.put("警惕", disDTO);
+                }
+            }
+
             //诊断分类
-            for(FeatureRate featureRate:dis) {
+            for (FeatureRate featureRate : dis) {
                 if (StringUtil.isBlank(featureRate.getDesc())) {
                     featureRate.setDesc("{\"可能诊断\":\"\"}");
                 }
                 Map<String, Object> descMap = FastJsonUtils.getJsonToMap(featureRate.getDesc());
-                for(String disClass:descMap.keySet()) {
+                for (String disClass : descMap.keySet()) {
                     List<FeatureRate> featureRateList = Lists.newLinkedList();
                     if (disFeatureMap.get(disClass) != null) {
                         featureRateList = disFeatureMap.get(disClass);

+ 6 - 5
icss-service/src/main/java/com/diagbot/vo/HisInquirysVO.java

@@ -31,21 +31,22 @@ public class HisInquirysVO {
     /**
      * 科室id
      */
-	@ApiModelProperty(value="科室id",required=true)
-	@NotNull(message="科室id必传")
+	@ApiModelProperty(value="科室id")
+	//@NotNull(message="科室id必传")
     private Long hospitalDeptId;
 
     /**
      * 医生id
      */
-	@ApiModelProperty(value="医生id",required=true)
-	@NotNull(message="医生id必传")
+	@ApiModelProperty(value="医生id")
+	//@NotNull(message="医生id必传")
     private Long doctorId;
 
     /**
      * 患者id
      */
-	@ApiModelProperty(value="患者id")
+	@ApiModelProperty(value="患者id",required=true)
+	@NotNull(message="患者id必传")
     private Long patientId;
     
     /**

+ 20 - 20
icss-service/src/main/java/com/diagbot/web/PushController.java

@@ -36,14 +36,14 @@ public class PushController {
     @ApiOperation(value = "推理接口(半结构化)[by:zhaops]",
             notes = "age: 年龄(必填)<br>" +
                     "sex:性别,1:男,2:女(必填)<br>" +
-                    "symptom:症状<br>" +
-                    "other:其它史<br>" +
-                    "vital:查体<br>" +
-                    "lis:化验<br>" +
-                    "pacs:辅检<br>" +
-                    "dis:诊断<br>" +
-                    "featureType:类型,1:症状,4:查体,5:化验,6:辅检,7:诊断,8:治疗方案(必填)<br>"+
-                    "diseaeId:取治疗方案的诊断<br>" )
+                    "symptom:症状,String<br>" +
+                    "other:其它史,String<br>" +
+                    "vital:查体,String<br>" +
+                    "lis:化验,Array<br>" +
+                    "pacs:辅检,String<br>" +
+                    "diag:诊断,String<br>" +
+                    "featureType:类型,1:症状,4:查体,5:化验,6:辅检,7:诊断,8:治疗方案(必填),String<br>"+
+                    "diseaeId:取治疗方案的诊断,Long<br>" )
     @PostMapping("/pushInner")
     @SysLogger("pushInner")
     public RespDTO<PushDTO> pushInner(@RequestBody @Valid PushVO pushVO) {
@@ -53,14 +53,14 @@ public class PushController {
     @ApiOperation(value = "推理接口(文本模式)[by:zhaops]",
             notes = "age: 年龄(必填)<br>" +
                     "sex:性别,1:男,2:女(必填)<br>" +
-                    "symptom:症状<br>" +
-                    "other:其它史<br>" +
-                    "vital:查体<br>" +
-                    "lis:化验<br>" +
-                    "pacs:辅检<br>" +
-                    "dis:诊断<br>" +
-                    "featureType:类型,1:症状,4:查体,5:化验,6:辅检,7:诊断,8:治疗方案(必填)<br>"+
-                    "diseaeId:取治疗方案的诊断<br>" )
+                    "symptom:症状,String<br>" +
+                    "other:其它史,String<br>" +
+                    "vital:查体,String<br>" +
+                    "lis:化验,Array<br>" +
+                    "pacs:辅检,String<br>" +
+                    "diag:诊断,String<br>" +
+                    "featureType:类型,1:症状,4:查体,5:化验,6:辅检,7:诊断,8:治疗方案(必填),String<br>"+
+                    "diseaeId:取治疗方案的诊断,Long<br>" )
     @PostMapping("/pushText")
     @SysLogger("pushText")
     public RespDTO<PushDTO> pushText(@RequestBody @Valid PushVO pushVO) {
@@ -70,11 +70,11 @@ public class PushController {
     @ApiOperation(value = "推理接口(大数据结果)[by:zhaops]",
             notes = "age: 年龄(必填)<br>" +
                     "sex:性别,1:男,2:女(必填)<br>" +
-                    "symptom:症状<br>" +
-                    "other:其它史<br>" +
+                    "symptom:症状,String<br>" +
+                    "other:其它史,String<br>" +
                     "vital:查体<br>" +
-                    "lis:化验<br>" +
-                    "pacs:辅检<br>" +
+                    "lis:化验,Array<br>" +
+                    "pacs:辅检,String<br>" +
                     "dis:诊断<br>" +
                     "featureType:类型,1:症状,4:查体,5:化验,6:辅检,7:诊断,8:治疗方案(必填)<br>")
     @PostMapping("/pushAI")