|
@@ -2,8 +2,12 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.GetAllForRelationDTO;
|
|
|
+import com.diagbot.dto.IndexBatchDTO;
|
|
|
import com.diagbot.dto.KllisDetailDTO;
|
|
|
import com.diagbot.entity.KlConcept;
|
|
|
+import com.diagbot.entity.KlDisease;
|
|
|
+import com.diagbot.entity.TcmDisease;
|
|
|
+import com.diagbot.entity.TcmSyndrome;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.LexiconEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
@@ -16,6 +20,7 @@ import com.diagbot.vo.KllisDetailVO;
|
|
|
import com.diagbot.vo.SearchConceptVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -32,17 +37,24 @@ import java.util.stream.Collectors;
|
|
|
@Component
|
|
|
public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private KlDiseaseFacade klDiseaseFacade;
|
|
|
+ @Autowired
|
|
|
+ private TcmDiseaseFacade tcmDiseaseFacade;
|
|
|
+ @Autowired
|
|
|
+ private TcmSyndromeFacade tcmSyndromeFacade;
|
|
|
+
|
|
|
/**
|
|
|
* 批量校验标准术语
|
|
|
*
|
|
|
* @param conceptVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<String> getConceptNames(ConceptVO conceptVO) {
|
|
|
+ public List<IndexBatchDTO> getConceptNames(ConceptVO conceptVO) {
|
|
|
if (ListUtil.isEmpty(conceptVO.getNames())) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
- List<String> retList = Lists.newLinkedList();
|
|
|
+ List<IndexBatchDTO> retList = Lists.newLinkedList();
|
|
|
//type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候
|
|
|
Integer type = convertType(conceptVO.getType());
|
|
|
|
|
@@ -58,7 +70,49 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
List<KlConcept> concepts = this.list(queryWrapper);
|
|
|
|
|
|
if (ListUtil.isNotEmpty(concepts)) {
|
|
|
- retList = concepts.stream().map(i -> i.getLibName()).distinct().collect(Collectors.toList());
|
|
|
+ for (KlConcept concept : concepts) {
|
|
|
+ IndexBatchDTO dto = new IndexBatchDTO();
|
|
|
+ dto.setId(concept.getId());
|
|
|
+ dto.setName(concept.getLibName());
|
|
|
+ retList.add(dto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(retList)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ List<Long> conceptIds = retList.stream().map(IndexBatchDTO::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (type.equals(LexiconEnum.Disease.getKey())) {
|
|
|
+ List<KlDisease> diseases = klDiseaseFacade.list(new QueryWrapper<KlDisease>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("concept_id", conceptIds));
|
|
|
+ if (ListUtil.isNotEmpty(diseases)) {
|
|
|
+ Map<Long, KlDisease> idMap = diseases.stream().collect(Collectors.toMap(KlDisease::getConceptId, v -> v));
|
|
|
+ for (IndexBatchDTO dto : retList) {
|
|
|
+ dto.setCode(idMap.get(dto.getId()).getIcd10Code());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type.equals(LexiconEnum.Tcmdisease.getKey())) {
|
|
|
+ List<TcmDisease> tcmDiseases = tcmDiseaseFacade.list(new QueryWrapper<TcmDisease>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("concept_id", conceptIds));
|
|
|
+ if (ListUtil.isNotEmpty(tcmDiseases)) {
|
|
|
+ Map<Long, TcmDisease> idMap = tcmDiseases.stream().collect(Collectors.toMap(TcmDisease::getConceptId, v -> v));
|
|
|
+ for (IndexBatchDTO dto : retList) {
|
|
|
+ dto.setCode(idMap.get(dto.getId()).getCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type.equals(LexiconEnum.Tcmsyndrome.getKey())) {
|
|
|
+ List<TcmSyndrome> tcmSyndromes = tcmSyndromeFacade.list(new QueryWrapper<TcmSyndrome>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("concept_id", conceptIds));
|
|
|
+ if (ListUtil.isNotEmpty(tcmSyndromes)) {
|
|
|
+ Map<Long, TcmSyndrome> idMap = tcmSyndromes.stream().collect(Collectors.toMap(TcmSyndrome::getConceptId, v -> v));
|
|
|
+ for (IndexBatchDTO dto : retList) {
|
|
|
+ dto.setCode(idMap.get(dto.getId()).getCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return retList;
|