|
@@ -2,25 +2,20 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.diagbot.client.TranServiceClient;
|
|
import com.diagbot.client.TranServiceClient;
|
|
-import com.diagbot.client.bean.Feature;
|
|
|
|
import com.diagbot.client.bean.FeatureRate;
|
|
import com.diagbot.client.bean.FeatureRate;
|
|
import com.diagbot.client.bean.GdbResponse;
|
|
import com.diagbot.client.bean.GdbResponse;
|
|
import com.diagbot.client.bean.ResponseData;
|
|
import com.diagbot.client.bean.ResponseData;
|
|
import com.diagbot.client.bean.SearchData;
|
|
import com.diagbot.client.bean.SearchData;
|
|
import com.diagbot.dto.ConceptPushDTO;
|
|
import com.diagbot.dto.ConceptPushDTO;
|
|
import com.diagbot.dto.PushDTO;
|
|
import com.diagbot.dto.PushDTO;
|
|
-import com.diagbot.dto.RespDTO;
|
|
|
|
import com.diagbot.entity.Concept;
|
|
import com.diagbot.entity.Concept;
|
|
-import com.diagbot.enums.ConceptTypeEnum;
|
|
|
|
import com.diagbot.enums.FeatureTypeEnum;
|
|
import com.diagbot.enums.FeatureTypeEnum;
|
|
import com.diagbot.enums.LexiconTypeEnum;
|
|
import com.diagbot.enums.LexiconTypeEnum;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.exception.CommonException;
|
|
-import com.diagbot.util.DateUtil;
|
|
|
|
import com.diagbot.util.FastJsonUtils;
|
|
import com.diagbot.util.FastJsonUtils;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ParamConvertUtil;
|
|
import com.diagbot.util.ParamConvertUtil;
|
|
-import com.diagbot.util.RespDTOUtil;
|
|
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.vo.SearchVo;
|
|
import com.diagbot.vo.SearchVo;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
@@ -48,6 +43,8 @@ public class PushFacade {
|
|
@Autowired
|
|
@Autowired
|
|
private ConceptFacade conceptFacade;
|
|
private ConceptFacade conceptFacade;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private TreatmentFacade treatmentFacade;
|
|
|
|
+ @Autowired
|
|
private TranServiceClient tranServiceClient;
|
|
private TranServiceClient tranServiceClient;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -88,9 +85,8 @@ public class PushFacade {
|
|
List<FeatureRate> symptom = data.getSymptom();
|
|
List<FeatureRate> symptom = data.getSymptom();
|
|
if (ListUtil.isNotEmpty(symptom)) {
|
|
if (ListUtil.isNotEmpty(symptom)) {
|
|
List<String> nameList = symptom.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
List<String> nameList = symptom.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
- List<Concept> concepts = conceptFacade.getListByNamesAndType(nameList, ParamConvertUtil.conceptConvert2Lib(ConceptTypeEnum.Symptom.getKey()));
|
|
|
|
- if (ListUtil.isNotEmpty(concepts)) {
|
|
|
|
- pushDTO.setSymptom(getConceptDTOList(concepts, LexiconTypeEnum.SYMPTOM.getKey()));
|
|
|
|
|
|
+ if (ListUtil.isNotEmpty(nameList)) {
|
|
|
|
+ pushDTO.setSymptom(getConceptDTOList(nameList, LexiconTypeEnum.SYMPTOM.getKey()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -99,9 +95,8 @@ public class PushFacade {
|
|
List<FeatureRate> vital = data.getVitals();
|
|
List<FeatureRate> vital = data.getVitals();
|
|
if (ListUtil.isNotEmpty(vital)) {
|
|
if (ListUtil.isNotEmpty(vital)) {
|
|
List<String> nameList = vital.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
List<String> nameList = vital.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
- List<Concept> concepts = conceptFacade.getListByNamesAndType(nameList, ParamConvertUtil.conceptConvert2Lib(ConceptTypeEnum.Vital.getKey()));
|
|
|
|
- if (ListUtil.isNotEmpty(concepts)) {
|
|
|
|
- pushDTO.setVital(getConceptDTOList(concepts, LexiconTypeEnum.VITAL_INDEX.getKey()));
|
|
|
|
|
|
+ if (ListUtil.isNotEmpty(nameList)) {
|
|
|
|
+ pushDTO.setVital(getConceptDTOList(nameList, LexiconTypeEnum.VITAL_INDEX.getKey()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -110,9 +105,8 @@ public class PushFacade {
|
|
List<FeatureRate> lis = data.getLabs();
|
|
List<FeatureRate> lis = data.getLabs();
|
|
if (ListUtil.isNotEmpty(lis)) {
|
|
if (ListUtil.isNotEmpty(lis)) {
|
|
List<String> nameList = lis.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
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 (ListUtil.isNotEmpty(nameList)) {
|
|
|
|
+ pushDTO.setLab(getConceptDTOList(nameList, LexiconTypeEnum.LIS_TABLES.getKey()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -121,14 +115,13 @@ public class PushFacade {
|
|
List<FeatureRate> pacs = data.getPacs();
|
|
List<FeatureRate> pacs = data.getPacs();
|
|
if (ListUtil.isNotEmpty(pacs)) {
|
|
if (ListUtil.isNotEmpty(pacs)) {
|
|
List<String> nameList = pacs.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
List<String> nameList = pacs.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
- List<Concept> concepts = conceptFacade.getListByNamesAndType(nameList, ParamConvertUtil.conceptConvert2Lib(ConceptTypeEnum.Pacs.getKey()));
|
|
|
|
- if (ListUtil.isNotEmpty(concepts)) {
|
|
|
|
- pushDTO.setPacs(getConceptDTOList(concepts, LexiconTypeEnum.PACS_ITEMS.getKey()));
|
|
|
|
|
|
+ if (ListUtil.isNotEmpty(nameList)) {
|
|
|
|
+ pushDTO.setPacs(getConceptDTOList(nameList, LexiconTypeEnum.PACS_ITEMS.getKey()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//诊断 map
|
|
//诊断 map
|
|
- if(featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Feature_Type_Disease.getKey()))){
|
|
|
|
|
|
+ if (featureTypeSet.contains(String.valueOf(FeatureTypeEnum.Feature_Type_Disease.getKey()))) {
|
|
if (ListUtil.isNotEmpty(dis)) {
|
|
if (ListUtil.isNotEmpty(dis)) {
|
|
List<String> nameList = dis.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
List<String> nameList = dis.stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
Map<String, List<ConceptPushDTO>> disMapDTO = new LinkedHashMap<>();
|
|
Map<String, List<ConceptPushDTO>> disMapDTO = new LinkedHashMap<>();
|
|
@@ -139,7 +132,7 @@ public class PushFacade {
|
|
SearchData searchData = new SearchData();
|
|
SearchData searchData = new SearchData();
|
|
searchData.setDiag(String.join(",", nameList));
|
|
searchData.setDiag(String.join(",", nameList));
|
|
GdbResponse graphRes = clinicalFacade.highRiskPageData(searchVo);
|
|
GdbResponse graphRes = clinicalFacade.highRiskPageData(searchVo);
|
|
- if (graphRes!=null) {
|
|
|
|
|
|
+ if (graphRes != null) {
|
|
Map<String, String> graphResult = graphRes.getResult();
|
|
Map<String, String> graphResult = graphRes.getResult();
|
|
if (graphResult.size() > 0) {
|
|
if (graphResult.size() > 0) {
|
|
List<String> hrNameList = Lists.newLinkedList();
|
|
List<String> hrNameList = Lists.newLinkedList();
|
|
@@ -148,9 +141,8 @@ public class PushFacade {
|
|
hrNameList.add(entry.getKey());
|
|
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());
|
|
|
|
|
|
+ if (ListUtil.isNotEmpty(hrNameList)) {
|
|
|
|
+ List<ConceptPushDTO> hrDisDTO = getConceptDTOList(hrNameList, LexiconTypeEnum.DIAGNOSIS.getKey());
|
|
disMapDTO.put("警惕", hrDisDTO);
|
|
disMapDTO.put("警惕", hrDisDTO);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -172,38 +164,42 @@ public class PushFacade {
|
|
}
|
|
}
|
|
for (Map.Entry<String, List<FeatureRate>> entry : disFeatureMap.entrySet()) {
|
|
for (Map.Entry<String, List<FeatureRate>> entry : disFeatureMap.entrySet()) {
|
|
List<String> nameListByDisClass = entry.getValue().stream().map(featureRate -> featureRate.getFeatureName()).collect(Collectors.toList());
|
|
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());
|
|
|
|
|
|
+ if (ListUtil.isNotEmpty(nameListByDisClass)) {
|
|
|
|
+ List<ConceptPushDTO> disDTO = getConceptDTOList(nameListByDisClass, LexiconTypeEnum.DIAGNOSIS.getKey());
|
|
disMapDTO.put(entry.getKey(), disDTO);
|
|
disMapDTO.put(entry.getKey(), disDTO);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
pushDTO.setDis(disMapDTO);
|
|
pushDTO.setDis(disMapDTO);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getTreatment(SearchVo searchVo) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取治疗方案
|
|
|
|
+ *
|
|
|
|
+ * @param searchVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Map<String, Object> getTreatment(SearchVo searchVo) {
|
|
Map<String, Object> treatDTO = new LinkedHashMap<>();
|
|
Map<String, Object> treatDTO = new LinkedHashMap<>();
|
|
ResponseData data = clinicalFacade.processClinicalData(searchVo);
|
|
ResponseData data = clinicalFacade.processClinicalData(searchVo);
|
|
Map<String, JSONObject> treat = data.getTreat();
|
|
Map<String, JSONObject> treat = data.getTreat();
|
|
if (StringUtil.isBlank(searchVo.getDiseaseName())) {
|
|
if (StringUtil.isBlank(searchVo.getDiseaseName())) {
|
|
throw new CommonException(CommonErrorCode.PARAM_ERROR, "请输入需获取治疗方案的诊断名称");
|
|
throw new CommonException(CommonErrorCode.PARAM_ERROR, "请输入需获取治疗方案的诊断名称");
|
|
}
|
|
}
|
|
- //Map<String, Object> treatmentMap = treatmentFacade.getTreatment(treat, pushVO.getDiseaseId(), pushVO.getPatientId());
|
|
|
|
- return treatDTO;
|
|
|
|
|
|
+ Map<String, Object> treatmentMap = treatmentFacade.getTreatment(treat, searchVo.getDiseaseName(), searchVo.getDisType());
|
|
|
|
+ return treatmentMap;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 概念转成返回格式
|
|
|
|
|
|
+ * 推理返回概念
|
|
*
|
|
*
|
|
- * @param concepts
|
|
|
|
|
|
+ * @param nameList
|
|
* @param libType
|
|
* @param libType
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<ConceptPushDTO> getConceptDTOList(List<Concept> concepts, Integer libType) {
|
|
|
|
|
|
+ public List<ConceptPushDTO> getConceptDTOList(List<String> nameList, Integer libType) {
|
|
|
|
+ List<Concept> concepts = conceptFacade.getListByNamesAndType(nameList, libType);
|
|
List<ConceptPushDTO> conceptDTOS = Lists.newLinkedList();
|
|
List<ConceptPushDTO> conceptDTOS = Lists.newLinkedList();
|
|
if (ListUtil.isNotEmpty(concepts)) {
|
|
if (ListUtil.isNotEmpty(concepts)) {
|
|
for (Concept concept : concepts) {
|
|
for (Concept concept : concepts) {
|