|
@@ -1,24 +1,38 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.diagbot.client.TranServiceClient;
|
|
|
+import com.diagbot.client.bean.Feature;
|
|
|
import com.diagbot.client.bean.FeatureRate;
|
|
|
+import com.diagbot.client.bean.GdbResponse;
|
|
|
import com.diagbot.client.bean.ResponseData;
|
|
|
+import com.diagbot.client.bean.SearchData;
|
|
|
import com.diagbot.dto.ConceptPushDTO;
|
|
|
import com.diagbot.dto.PushDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.Concept;
|
|
|
import com.diagbot.enums.ConceptTypeEnum;
|
|
|
import com.diagbot.enums.FeatureTypeEnum;
|
|
|
import com.diagbot.enums.LexiconTypeEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.FastJsonUtils;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.ParamConvertUtil;
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.SearchVo;
|
|
|
import com.google.common.collect.Lists;
|
|
|
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;
|
|
|
|
|
@@ -45,13 +59,30 @@ public class PushFacade {
|
|
|
public void pushInner(SearchVo searchVo) {
|
|
|
PushDTO pushDTO = new PushDTO();
|
|
|
ResponseData data = clinicalFacade.processClinicalData(searchVo);
|
|
|
- //大数据返回内容
|
|
|
- List<FeatureRate> dis = data.getDis();
|
|
|
|
|
|
String featureType = searchVo.getFeatureType();
|
|
|
String[] featureTypes = featureType.split(",|,");
|
|
|
Set<String> featureTypeSet = new HashSet(Arrays.asList(featureTypes));
|
|
|
|
|
|
+ //诊断
|
|
|
+ List<FeatureRate> dis = data.getDis();
|
|
|
+ //推送科室
|
|
|
+ String deptName = "";
|
|
|
+ if (ListUtil.isNotEmpty(dis)) {
|
|
|
+ for (FeatureRate featureRate : dis) {
|
|
|
+ if (StringUtil.isNotBlank(featureRate.getExtraProperty())) {
|
|
|
+ deptName = featureRate.getExtraProperty();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //没有推送信息时,默认取全科模板
|
|
|
+ if (StringUtil.isBlank(deptName)) {
|
|
|
+ deptName = "全科";
|
|
|
+ }
|
|
|
+ pushDTO.setDeptName(deptName);
|
|
|
+
|
|
|
+
|
|
|
//症状 概念列表
|
|
|
if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Feature_Type_Symptom.getKey()))) {
|
|
|
List<FeatureRate> symptom = data.getSymptom();
|
|
@@ -74,6 +105,17 @@ public class PushFacade {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //化验 概念列表-公表项
|
|
|
+ if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Feature_Type_Lis.getKey()))) {
|
|
|
+ List<FeatureRate> lis = data.getLabs();
|
|
|
+ if (ListUtil.isNotEmpty(lis)) {
|
|
|
+ List<String> nameList = lis.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
|
+ List<Concept> concepts = conceptFacade.getListByNamesAndType(nameList, LexiconTypeEnum.LIS_TABLES.getKey());
|
|
|
+ if (ListUtil.isNotEmpty(concepts)) {
|
|
|
+ pushDTO.setLab(getConceptDTOList(concepts, LexiconTypeEnum.LIS_TABLES.getKey()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//辅检 概念列表
|
|
|
if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Feature_Type_Pacs.getKey()))) {
|
|
|
List<FeatureRate> pacs = data.getPacs();
|
|
@@ -85,6 +127,73 @@ public class PushFacade {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //诊断 map
|
|
|
+ if(featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Feature_Type_Disease.getKey()))){
|
|
|
+ if (ListUtil.isNotEmpty(dis)) {
|
|
|
+ List<String> nameList = dis.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
|
+ Map<String, List<ConceptPushDTO>> disMapDTO = new LinkedHashMap<>();
|
|
|
+ Map<String, List<FeatureRate>> disFeatureMap = new LinkedHashMap<>();
|
|
|
+ //警惕
|
|
|
+ Map<String, String> highRiskMap = new HashMap<>();
|
|
|
+ highRiskMap.put("disease", String.join(",", nameList));
|
|
|
+ SearchData searchData = new SearchData();
|
|
|
+ searchData.setDiag(String.join(",", nameList));
|
|
|
+ GdbResponse graphRes = clinicalFacade.highRiskPageData(searchVo);
|
|
|
+ if (graphRes!=null) {
|
|
|
+ Map<String, String> graphResult = graphRes.getResult();
|
|
|
+ if (graphResult.size() > 0) {
|
|
|
+ List<String> hrNameList = Lists.newLinkedList();
|
|
|
+ for (Map.Entry<String, String> entry : graphResult.entrySet()) {
|
|
|
+ if (entry.getValue().equals("1")) {
|
|
|
+ hrNameList.add(entry.getKey());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Concept> concepts = conceptFacade.getListByNamesAndType(hrNameList, ParamConvertUtil.conceptConvert2Lib(ConceptTypeEnum.Disease.getKey()));
|
|
|
+ if (ListUtil.isNotEmpty(concepts)) {
|
|
|
+ List<ConceptPushDTO> hrDisDTO = getConceptDTOList(concepts, LexiconTypeEnum.PACS_ITEMS.getKey());
|
|
|
+ disMapDTO.put("警惕", hrDisDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //诊断分类
|
|
|
+ for (FeatureRate featureRate : dis) {
|
|
|
+ if (StringUtil.isBlank(featureRate.getDesc())) {
|
|
|
+ featureRate.setDesc("{\"可能诊断\":\"\"}");
|
|
|
+ }
|
|
|
+ Map<String, Object> descMap = FastJsonUtils.getJsonToMap(featureRate.getDesc());
|
|
|
+ for (String disClass : descMap.keySet()) {
|
|
|
+ List<FeatureRate> featureRateList = Lists.newLinkedList();
|
|
|
+ if (disFeatureMap.get(disClass) != null) {
|
|
|
+ featureRateList = disFeatureMap.get(disClass);
|
|
|
+ }
|
|
|
+ featureRateList.add(featureRate);
|
|
|
+ disFeatureMap.put(disClass, featureRateList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Map.Entry<String, List<FeatureRate>> entry : disFeatureMap.entrySet()) {
|
|
|
+ List<String> nameListByDisClass = entry.getValue().stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
|
+ List<Concept> concepts = conceptFacade.getListByNamesAndType(nameListByDisClass, ParamConvertUtil.conceptConvert2Lib(ConceptTypeEnum.Disease.getKey()));
|
|
|
+ if (ListUtil.isNotEmpty(concepts)) {
|
|
|
+ List<ConceptPushDTO> disDTO = getConceptDTOList(concepts, LexiconTypeEnum.PACS_ITEMS.getKey());
|
|
|
+ disMapDTO.put(entry.getKey(), disDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pushDTO.setDis(disMapDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Object> getTreatment(SearchVo searchVo) {
|
|
|
+ Map<String, Object> treatDTO = new LinkedHashMap<>();
|
|
|
+ ResponseData data = clinicalFacade.processClinicalData(searchVo);
|
|
|
+ Map<String, JSONObject> treat = data.getTreat();
|
|
|
+ if (StringUtil.isBlank(searchVo.getDiseaseName())) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_ERROR, "请输入需获取治疗方案的诊断名称");
|
|
|
+ }
|
|
|
+ //Map<String, Object> treatmentMap = treatmentFacade.getTreatment(treat, pushVO.getDiseaseId(), pushVO.getPatientId());
|
|
|
+ return treatDTO;
|
|
|
}
|
|
|
|
|
|
/**
|