|
@@ -1,9 +1,9 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.client.AiptServiceClient;
|
|
|
-import com.diagbot.client.BigDataServiceClient;
|
|
|
import com.diagbot.client.TranServiceClient;
|
|
|
import com.diagbot.client.bean.FeatureRate;
|
|
|
import com.diagbot.client.bean.GdbResponse;
|
|
@@ -65,8 +65,6 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Component
|
|
|
public class PushFacade {
|
|
|
- @Autowired
|
|
|
- private BigDataServiceClient bigDataServiceClient;
|
|
|
@Autowired
|
|
|
private QuestionFacade questionFacade;
|
|
|
@Autowired
|
|
@@ -151,29 +149,27 @@ public class PushFacade {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 推理接口
|
|
|
+ * 中间层接口
|
|
|
*
|
|
|
- * @param pushVO
|
|
|
- * @return
|
|
|
+ * @param searchData
|
|
|
+ * @return ResponseData
|
|
|
*/
|
|
|
- public ResponseData pushAI(PushVO pushVO) {
|
|
|
- SearchData searchData = assembleData(pushVO);
|
|
|
- Response<ResponseData> res = bigDataServiceClient.bayesPageData(searchData);
|
|
|
+ public ResponseData pushAipt(SearchData searchData) {
|
|
|
+ Response<ResponseData> res = aiptServiceClient.aiptData(searchData);
|
|
|
if (null == res || null == res.getData()) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "AI没有返回结果");
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "中间层没有返回结果");
|
|
|
}
|
|
|
- System.out.println(res.getData().getTreat());
|
|
|
return res.getData();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 中间层接口
|
|
|
+ * 获取量表
|
|
|
*
|
|
|
* @param searchData
|
|
|
- * @return ResponseData
|
|
|
+ * @return
|
|
|
*/
|
|
|
- public ResponseData pushAipt(SearchData searchData) {
|
|
|
- Response<ResponseData> res = aiptServiceClient.aiptData(searchData);
|
|
|
+ public Map<String, Object> scale(SearchData searchData) {
|
|
|
+ Response<Map<String, Object>> res = aiptServiceClient.scale(searchData);
|
|
|
if (null == res || null == res.getData()) {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "中间层没有返回结果");
|
|
|
}
|
|
@@ -275,7 +271,7 @@ public class PushFacade {
|
|
|
highRiskMap.put("disease", String.join(",", nameList));
|
|
|
SearchData searchData = new SearchData();
|
|
|
searchData.setDiag(String.join(",", nameList));
|
|
|
- Response<GdbResponse> graphRes = bigDataServiceClient.highRiskPageData(searchData);
|
|
|
+ Response<GdbResponse> graphRes = aiptServiceClient.highRisk(searchData);
|
|
|
if (graphRes != null) {
|
|
|
Map<String, String> graphResult = graphRes.getData().getResult();
|
|
|
if (graphResult.size() > 0) {
|
|
@@ -325,22 +321,10 @@ public class PushFacade {
|
|
|
|
|
|
//量表内容 featuretype=21
|
|
|
if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Scale.getKey()))) {
|
|
|
- Map<String, JSONObject> scale = data.getScale();
|
|
|
- /***********************测试数据********************************/
|
|
|
- if (scale == null) {
|
|
|
- scale = new LinkedHashMap<>();
|
|
|
- String scaleStr = "{\"type\":\"checkbox\",\"details\":[{\"name\":\"轻度\",\"isSelected\":0}," +
|
|
|
- "{\"name\":\"中度\",\"isSelected\":1},{\"name\":\"重度\",\"isSelected\":0}]}";
|
|
|
- JSONObject scaleJson = JSONObject.parseObject(scaleStr);
|
|
|
- scale.put("高血压量表1", scaleJson);
|
|
|
- }
|
|
|
- /***********************正式流程********************************/
|
|
|
+ Map<String, Object> scale = scale(aiSearchData);
|
|
|
String scaleContent = "";
|
|
|
- if (scale != null && scale.get(pushVO.getScaleName()) != null) {
|
|
|
- JSONObject scaleJson = scale.get(pushVO.getScaleName());
|
|
|
- if (scaleJson != null) {
|
|
|
- scaleContent = scaleJson.toJSONString();
|
|
|
- }
|
|
|
+ if (scale != null && scale.size() > 0) {
|
|
|
+ scaleContent = JSON.toJSONString(scale);
|
|
|
}
|
|
|
List<ScaleContent> scaleContentList = scaleContentFacade.getContent(pushVO.getScaleId(), scaleContent);
|
|
|
pushDTO.setScale(scaleContentList);
|
|
@@ -730,7 +714,7 @@ public class PushFacade {
|
|
|
//警惕
|
|
|
searchData = new SearchData();
|
|
|
searchData.setDiag(String.join(",", disNameList));
|
|
|
- Response<GdbResponse> graphRes = bigDataServiceClient.highRiskPageData(searchData);
|
|
|
+ Response<GdbResponse> graphRes = aiptServiceClient.highRisk(searchData);
|
|
|
Map<String, String> graphResult = graphRes.getData().getResult();
|
|
|
if (graphResult.size() > 0) {
|
|
|
List<EMRQuestionDTO> highRiskDisList = Lists.newLinkedList();
|
|
@@ -773,18 +757,11 @@ public class PushFacade {
|
|
|
}
|
|
|
}
|
|
|
SearchData searchData = assembleData(pushVO);
|
|
|
- ResponseData data = pushAipt(searchData);
|
|
|
- Map<String, JSONObject> scale = data.getScale();
|
|
|
- if (scale == null) {
|
|
|
- String scaleStr = "{\"type\":\"checkbox\",\"details\":[{\"name\":\"轻度\",\"isSelected\":0}," +
|
|
|
- "{\"name\":\"中度\",\"isSelected\":1},{\"name\":\"重度\",\"isSelected\":0}]}";
|
|
|
- JSONObject scaleJson = JSONObject.parseObject(scaleStr);
|
|
|
- scale = new LinkedHashMap<>();
|
|
|
- scale.put("高血压量表1", scaleJson);
|
|
|
- }
|
|
|
+ Map<String, Object> scale = scale(searchData);
|
|
|
+
|
|
|
String scaleContent = "";
|
|
|
- if (scale.get(pushVO.getScaleName()) != null) {
|
|
|
- scaleContent = scale.get(pushVO.getScaleName()).toJSONString();
|
|
|
+ if (scale != null && scale.size() > 0) {
|
|
|
+ scaleContent = JSON.toJSONString(scale);
|
|
|
}
|
|
|
return scaleContent;
|
|
|
}
|