|
@@ -1,12 +1,12 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.diagbot.dto.FeatureConceptDTO;
|
|
|
-import com.diagbot.entity.Concept;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.ParamConvertUtil;
|
|
|
+import com.diagbot.vo.ConceptNameVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -41,24 +41,39 @@ public class FeatureFacade {
|
|
|
|
|
|
Map<Integer, List<FeatureConceptDTO>> symptomMap
|
|
|
= EntityUtil.makeEntityListMap(symptomFeatureList, "libType");
|
|
|
- Map<Integer, Map<String, Long>> map = new LinkedHashMap<>();
|
|
|
+ Map<Integer, Map<String, FeatureConceptDTO>> map = new LinkedHashMap<>();
|
|
|
for (Map.Entry<Integer, List<FeatureConceptDTO>> entry : symptomMap.entrySet()) {
|
|
|
- List<Concept> concepts
|
|
|
- = conceptFacade.getListByNamesAndType(entry.getValue()
|
|
|
+ List<String> names = entry.getValue()
|
|
|
.stream()
|
|
|
.map(i -> i.getName())
|
|
|
- .collect(Collectors.toList()), entry.getKey());
|
|
|
- Map<String, Long> conceptMap
|
|
|
- = EntityUtil.makeMapWithKeyValue(concepts, "libName", "id");
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ ConceptNameVO conceptNameVO = new ConceptNameVO();
|
|
|
+ conceptNameVO.setNames(names);
|
|
|
+ conceptNameVO.setType(entry.getKey());
|
|
|
+ List<FeatureConceptDTO> featureConcepts = conceptFacade.getFeatureConcept(conceptNameVO);
|
|
|
+ Map<String, FeatureConceptDTO> conceptMap
|
|
|
+ = EntityUtil.makeEntityMap(featureConcepts, "origin");
|
|
|
map.put(entry.getKey(), conceptMap);
|
|
|
}
|
|
|
|
|
|
for (FeatureConceptDTO featureConceptDTO : symptomFeatureList) {
|
|
|
if (null != featureConceptDTO.getLibType()) {
|
|
|
featureConceptDTO.setType(ParamConvertUtil.libConvert2Concept(featureConceptDTO.getLibType()));
|
|
|
- featureConceptDTO.setConceptId(map
|
|
|
- .get(featureConceptDTO.getLibType())
|
|
|
- .get(featureConceptDTO.getName()));
|
|
|
+ if (map.containsKey(featureConceptDTO.getLibType())
|
|
|
+ && map.get(featureConceptDTO.getLibType()).containsKey(featureConceptDTO.getName())) {
|
|
|
+ featureConceptDTO.setConceptId(map
|
|
|
+ .get(featureConceptDTO.getLibType())
|
|
|
+ .get(featureConceptDTO.getName())
|
|
|
+ .getConceptId());
|
|
|
+ featureConceptDTO.setOrigin(map
|
|
|
+ .get(featureConceptDTO.getLibType())
|
|
|
+ .get(featureConceptDTO.getName())
|
|
|
+ .getOrigin());
|
|
|
+ featureConceptDTO.setName(map
|
|
|
+ .get(featureConceptDTO.getLibType())
|
|
|
+ .get(featureConceptDTO.getName())
|
|
|
+ .getName());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return symptomFeatureList;
|