|
@@ -1,23 +1,20 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.client.bean.AdverseReaction;
|
|
|
import com.diagbot.client.bean.Medicition;
|
|
|
import com.diagbot.client.bean.MedicitionClass;
|
|
|
-import com.diagbot.dto.ConceptDetailDTO;
|
|
|
+import com.diagbot.dto.ConceptIntroduceDTO;
|
|
|
import com.diagbot.dto.ConceptRes;
|
|
|
import com.diagbot.entity.Concept;
|
|
|
-import com.diagbot.entity.ConceptDetail;
|
|
|
import com.diagbot.entity.wrapper.ConceptWrapper;
|
|
|
import com.diagbot.enums.ConceptTypeEnum;
|
|
|
import com.diagbot.enums.DisTypeEnum;
|
|
|
-import com.diagbot.enums.PositionTypeEnum;
|
|
|
import com.diagbot.enums.LexiconRSTypeEnum;
|
|
|
import com.diagbot.enums.LexiconTypeEnum;
|
|
|
+import com.diagbot.enums.PositionTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
-import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.FastJsonUtils;
|
|
|
import com.diagbot.util.ListUtil;
|
|
@@ -72,40 +69,47 @@ public class TreatmentFacade {
|
|
|
conceptIntroduceVO.setLibType(LexiconTypeEnum.DIAGNOSIS.getKey());
|
|
|
conceptIntroduceVO.setPosition(PositionTypeEnum.T3.getKey());
|
|
|
conceptIntroduceVO.setType(ConceptTypeEnum.Disease.getKey());
|
|
|
- List<ConceptDetail> commonTreatmentDetailList = conceptDetailFacade.getConceptDetailList(conceptIntroduceVO);
|
|
|
- if (ListUtil.isNotEmpty(commonTreatmentDetailList)) {
|
|
|
- ConceptDetailDTO commonDetailDTO = new ConceptDetailDTO();
|
|
|
- BeanUtil.copyProperties(commonTreatmentDetailList.get(0), commonDetailDTO);
|
|
|
- retMap.put("commonTreatment", commonDetailDTO);
|
|
|
+ ConceptIntroduceDTO commonTreatment
|
|
|
+ = conceptDetailFacade.getConceptDetail(conceptIntroduceVO);
|
|
|
+ if (ListUtil.isNotEmpty(commonTreatment.getDetails())) {
|
|
|
+ retMap.put("commonTreatment", commonTreatment.getDetails().get(0));
|
|
|
} else {
|
|
|
retMap.put("commonTreatment", null);
|
|
|
}
|
|
|
|
|
|
//手术治疗
|
|
|
conceptIntroduceVO.setPosition(PositionTypeEnum.T4.getKey());
|
|
|
- List<ConceptDetail> surgeryTreatmentDetailList = conceptDetailFacade.getConceptDetailList(conceptIntroduceVO);
|
|
|
- if (ListUtil.isNotEmpty(surgeryTreatmentDetailList)) {
|
|
|
- ConceptDetailDTO surgeryDetailDTO = new ConceptDetailDTO();
|
|
|
- BeanUtil.copyProperties(surgeryTreatmentDetailList.get(0), surgeryDetailDTO);
|
|
|
- retMap.put("surgeryTreatment", surgeryDetailDTO);
|
|
|
+ ConceptIntroduceDTO surgeryTreatment
|
|
|
+ = conceptDetailFacade.getConceptDetail(conceptIntroduceVO);
|
|
|
+ if (ListUtil.isNotEmpty(surgeryTreatment.getDetails())) {
|
|
|
+ retMap.put("surgeryTreatment", surgeryTreatment.getDetails().get(0));
|
|
|
} else {
|
|
|
retMap.put("surgeryTreatment", null);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//获取知识图谱治疗方案
|
|
|
JSONObject treatmentJson = treatmentMap.get(diseaseName);
|
|
|
if (treatmentJson == null || treatmentJson.isEmpty()) {
|
|
|
return retMap;
|
|
|
}
|
|
|
|
|
|
- List<MedicitionClass> drugsList = FastJsonUtils.getJsonToListByKey(treatmentJson.toString(), "treatment", MedicitionClass.class);
|
|
|
- List<String> cateBigNameList = drugsList.stream().map(drugs -> drugs.getBigdrugsName()).collect(Collectors.toList());
|
|
|
- List<Concept> cateBigConceptList = conceptFacade.getListByNamesAndType(cateBigNameList, LexiconTypeEnum.DRUG_CATEGORY_BIG.getKey());
|
|
|
- Map<String, Concept> cateBigConceptMap = EntityUtil.makeEntityMap(cateBigConceptList, "libName");
|
|
|
- List<String> cateSmallNameList = drugsList.stream().map(drugs -> drugs.getSubdrugsName()).collect(Collectors.toList());
|
|
|
- List<Concept> cateSmallConceptList = conceptFacade.getListByNamesAndType(cateSmallNameList, LexiconTypeEnum.DRUG_CATEGORY_SMALL.getKey());
|
|
|
- Map<String, Concept> cateSmallConceptMap = EntityUtil.makeEntityMap(cateSmallConceptList, "libName");
|
|
|
+ List<MedicitionClass> drugsList
|
|
|
+ = FastJsonUtils.getJsonToListByKey(treatmentJson.toString(),
|
|
|
+ "treatment", MedicitionClass.class);
|
|
|
+ List<String> cateBigNameList
|
|
|
+ = drugsList.stream().map(drugs -> drugs.getBigdrugsName()).collect(Collectors.toList());
|
|
|
+ List<Concept> cateBigConceptList
|
|
|
+ = conceptFacade.getListByNamesAndType(cateBigNameList,
|
|
|
+ LexiconTypeEnum.DRUG_CATEGORY_BIG.getKey());
|
|
|
+ Map<String, Concept> cateBigConceptMap
|
|
|
+ = EntityUtil.makeEntityMap(cateBigConceptList, "libName");
|
|
|
+ List<String> cateSmallNameList
|
|
|
+ = drugsList.stream().map(drugs -> drugs.getSubdrugsName()).collect(Collectors.toList());
|
|
|
+ List<Concept> cateSmallConceptList
|
|
|
+ = conceptFacade.getListByNamesAndType(cateSmallNameList,
|
|
|
+ LexiconTypeEnum.DRUG_CATEGORY_SMALL.getKey());
|
|
|
+ Map<String, Concept> cateSmallConceptMap
|
|
|
+ = EntityUtil.makeEntityMap(cateSmallConceptList, "libName");
|
|
|
|
|
|
for (MedicitionClass medicitionClass : drugsList) {
|
|
|
Concept cateBigConcept = cateBigConceptMap.get(medicitionClass.getBigdrugsName());
|
|
@@ -130,17 +134,21 @@ public class TreatmentFacade {
|
|
|
}
|
|
|
}
|
|
|
LinkedList<Medicition> medicitionList = medicitionClass.getMedicitionsList();
|
|
|
- List<String> drugNameList = medicitionList.stream().map(medicition -> medicition.getMedicitionName()).collect(Collectors.toList());
|
|
|
- List<Concept> drugList = conceptFacade.getListByNamesAndType(drugNameList, LexiconTypeEnum.DRUGS.getKey());
|
|
|
+ List<String> drugNameList
|
|
|
+ = medicitionList.stream().map(m -> m.getMedicitionName()).collect(Collectors.toList());
|
|
|
+ List<Concept> drugList
|
|
|
+ = conceptFacade.getListByNamesAndType(drugNameList, LexiconTypeEnum.DRUGS.getKey());
|
|
|
Map<String, Concept> drugMap = EntityUtil.makeEntityMap(drugList, "libName");
|
|
|
- Map<String, Concept> drugDetailMap = conceptDetailFacade.existList(drugNameList, LexiconTypeEnum.DRUGS.getKey());
|
|
|
+ Map<String, Concept> drugDetailMap
|
|
|
+ = conceptDetailFacade.existList(drugNameList, LexiconTypeEnum.DRUGS.getKey());
|
|
|
for (Medicition medicition : medicitionList) {
|
|
|
Concept drugConcept = drugMap.get(medicition.getMedicitionName());
|
|
|
if (drugConcept != null) {
|
|
|
medicition.setConceptId(drugConcept.getId());
|
|
|
}
|
|
|
medicition.setLibType(ConceptTypeEnum.Drug.getKey());
|
|
|
- if (drugDetailMap != null && drugDetailMap.containsKey(medicition.getMedicitionName())) {
|
|
|
+ if (drugDetailMap != null
|
|
|
+ && drugDetailMap.containsKey(medicition.getMedicitionName())) {
|
|
|
medicition.setShowInfo("1");
|
|
|
} else {
|
|
|
medicition.setShowInfo("0");
|
|
@@ -172,18 +180,25 @@ public class TreatmentFacade {
|
|
|
//上次用药-icss层处理
|
|
|
retMap.put("drugHistory", null);
|
|
|
//不良反应
|
|
|
- List<AdverseReaction> adverseReactionList = FastJsonUtils.getJsonToListByKey(treatmentJson.toString(), "adverseEvent", AdverseReaction.class);
|
|
|
- List<String> adNameList = adverseReactionList.stream().map(adverseReaction -> adverseReaction.getName()).collect(Collectors.toList());
|
|
|
- List<Concept> adConceptList = conceptFacade.getListByNamesAndType(adNameList, LexiconTypeEnum.SIDE_EFFECTS.getKey());
|
|
|
- Map<String, Concept> adConceptMap = EntityUtil.makeEntityMap(adConceptList, "libName");
|
|
|
- Map<String, Concept> adConceptDetailMap = conceptDetailFacade.existList(adNameList, LexiconTypeEnum.SIDE_EFFECTS.getKey());
|
|
|
+ List<AdverseReaction> adverseReactionList
|
|
|
+ = FastJsonUtils.getJsonToListByKey(treatmentJson.toString(),
|
|
|
+ "adverseEvent", AdverseReaction.class);
|
|
|
+ List<String> adNameList
|
|
|
+ = adverseReactionList.stream().map(a -> a.getName()).collect(Collectors.toList());
|
|
|
+ List<Concept> adConceptList
|
|
|
+ = conceptFacade.getListByNamesAndType(adNameList, LexiconTypeEnum.SIDE_EFFECTS.getKey());
|
|
|
+ Map<String, Concept> adConceptMap
|
|
|
+ = EntityUtil.makeEntityMap(adConceptList, "libName");
|
|
|
+ Map<String, Concept> adConceptDetailMap
|
|
|
+ = conceptDetailFacade.existList(adNameList, LexiconTypeEnum.SIDE_EFFECTS.getKey());
|
|
|
for (AdverseReaction adverseReaction : adverseReactionList) {
|
|
|
Concept adConcept = adConceptMap.get(adverseReaction.getName());
|
|
|
if (adConcept != null) {
|
|
|
adverseReaction.setConceptId(adConcept.getId());
|
|
|
}
|
|
|
adverseReaction.setLibType(ConceptTypeEnum.SIDE_EFFECTS.getKey());
|
|
|
- if (adConceptDetailMap != null && adConceptDetailMap.containsKey(adverseReaction.getName())) {
|
|
|
+ if (adConceptDetailMap != null
|
|
|
+ && adConceptDetailMap.containsKey(adverseReaction.getName())) {
|
|
|
adverseReaction.setShowInfo("1");
|
|
|
} else {
|
|
|
adverseReaction.setShowInfo("0");
|