|
@@ -2,12 +2,8 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.client.TreatServiceClient;
|
|
|
-import com.diagbot.client.bean.GdbResponse;
|
|
|
import com.diagbot.client.bean.Medicition;
|
|
|
import com.diagbot.client.bean.MedicitionClass;
|
|
|
-import com.diagbot.client.bean.Response;
|
|
|
-import com.diagbot.client.bean.TreatInput;
|
|
|
-import com.diagbot.dto.TreatmentDTO;
|
|
|
import com.diagbot.entity.IntroduceDetail;
|
|
|
import com.diagbot.entity.IntroduceMap;
|
|
|
import com.diagbot.entity.QuestionInfo;
|
|
@@ -19,7 +15,6 @@ import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.FastJsonUtils;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
-import com.diagbot.vo.TreatmentVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -48,22 +43,19 @@ public class TreatmentFacade {
|
|
|
/**
|
|
|
* 获取治疗方案
|
|
|
*
|
|
|
- * @param treatmentVO
|
|
|
+ * @param
|
|
|
* @return
|
|
|
*/
|
|
|
- public TreatmentDTO getTreatment(TreatmentVO treatmentVO) {
|
|
|
- TreatmentDTO treatmentDTO = new TreatmentDTO();
|
|
|
+ public Map<String,Object> getTreatment(Map<String,String> treatmentMap,Long diseaseId) {
|
|
|
Map<String, Object> retMap = new LinkedHashMap<>();
|
|
|
-
|
|
|
- TreatInput treatInput = new TreatInput();
|
|
|
- treatInput.setDisease(treatmentVO.getDiag());
|
|
|
- treatInput.setFilds(treatmentVO.getSymptom());
|
|
|
-
|
|
|
- Long diseaseId = treatmentVO.getDiseaseId();
|
|
|
- QuestionInfo disease = questionFacade.getById(diseaseId);
|
|
|
- if (!disease.getTagName().equals(treatmentVO.getDiag())) {
|
|
|
+ QuestionInfo disease=questionFacade.getById(diseaseId);
|
|
|
+ if(disease==null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "诊断不存在");
|
|
|
+ }
|
|
|
+ if(!treatmentMap.containsKey(disease.getTagName())){
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "诊断名称和id不匹配");
|
|
|
}
|
|
|
+
|
|
|
//一般治疗
|
|
|
List<IntroduceDetail> commonTreatmentDetailList = getIntroduceDetailList(diseaseId, IntroducePositionEnum.CommonTreatment.getKey());
|
|
|
retMap.put("commonTreatment", commonTreatmentDetailList.size() > 0 ? commonTreatmentDetailList.get(0).getContent() : "");
|
|
@@ -73,19 +65,12 @@ public class TreatmentFacade {
|
|
|
retMap.put("surgeryTreatment", surgeryTreatmentDetailList.size() > 0 ? surgeryTreatmentDetailList.get(0).getContent() : "");
|
|
|
|
|
|
//获取知识图谱治疗方案
|
|
|
- Response<GdbResponse> responseTreatData = treatServiceClient.treatPageData(treatInput);
|
|
|
- Map<String, String> resultMap = responseTreatData.getData().getResult();
|
|
|
- if (resultMap.size() == 0) {
|
|
|
- treatmentDTO.setMap(retMap);
|
|
|
- return treatmentDTO;
|
|
|
- }
|
|
|
- String resultDes = resultMap.get("des");
|
|
|
- if (StringUtil.isBlank(resultDes)) {
|
|
|
- treatmentDTO.setMap(retMap);
|
|
|
- return treatmentDTO;
|
|
|
+ String treatment=treatmentMap.get(disease.getTagName());
|
|
|
+ if (StringUtil.isBlank(treatment)) {
|
|
|
+ return retMap;
|
|
|
}
|
|
|
|
|
|
- List<MedicitionClass> drugsList = FastJsonUtils.getJsonToListByKey(resultDes, "treatment", MedicitionClass.class);
|
|
|
+ List<MedicitionClass> drugsList = FastJsonUtils.getJsonToListByKey(treatment, "treatment", MedicitionClass.class);
|
|
|
|
|
|
List<String> classNameList = drugsList.stream().map(drugs -> drugs.getDrugsName()).collect(Collectors.toList());
|
|
|
List<QuestionInfo> drugClassList = getTopQuestionList(classNameList, QuestionTypeEnum.DrugClass.getKey());
|
|
@@ -122,8 +107,7 @@ public class TreatmentFacade {
|
|
|
}
|
|
|
|
|
|
retMap.put("treatment", drugsList);
|
|
|
- treatmentDTO.setMap(retMap);
|
|
|
- return treatmentDTO;
|
|
|
+ return retMap;
|
|
|
}
|
|
|
|
|
|
|