|
@@ -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);
|