|
@@ -1,13 +1,28 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.client.CdssCoreClient;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.RetrievalDTO;
|
|
|
+import com.diagbot.dto.StaticKnowledgeIndexDTO;
|
|
|
+import com.diagbot.entity.ConceptDetail;
|
|
|
+import com.diagbot.entity.ConceptInfo;
|
|
|
+import com.diagbot.entity.DictionaryInfo;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.util.EntityUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.vo.RetrievalVO;
|
|
|
+import com.diagbot.vo.StaticKnowledgeIndexVO;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* @Description:
|
|
|
* @Author:zhaops
|
|
@@ -17,6 +32,13 @@ import org.springframework.stereotype.Component;
|
|
|
public class RetrievalFacade {
|
|
|
@Autowired
|
|
|
private CdssCoreClient cdssCoreClient;
|
|
|
+ @Autowired
|
|
|
+ private DictionaryFacade dictionaryFacade;
|
|
|
+ @Autowired
|
|
|
+ private ConceptInfoFacade conceptInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private ConceptDetailFacade conceptDetailFacade;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 检索
|
|
@@ -31,4 +53,85 @@ public class RetrievalFacade {
|
|
|
retrievalDTO = respDTO.data;
|
|
|
return retrievalDTO;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 医学知识(静态信息)检索
|
|
|
+ *
|
|
|
+ * @param staticKnowledgeIndexVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<StaticKnowledgeIndexDTO> staticKnowledgeIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
|
|
|
+ List<StaticKnowledgeIndexDTO> retList = Lists.newLinkedList();
|
|
|
+ QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("group_type", 7)
|
|
|
+ .eq("return_type", 2)
|
|
|
+ .orderByAsc("order_no");
|
|
|
+ List<DictionaryInfo> dicList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
|
|
|
+
|
|
|
+ List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = Lists.newLinkedList();
|
|
|
+ RespDTO<List<StaticKnowledgeIndexDTO>> respDTO = cdssCoreClient.staticKnowledgeIndex(staticKnowledgeIndexVO);
|
|
|
+ RespDTOUtil.respNGDealCover(respDTO, "检索失败");
|
|
|
+ staticKnowledgeIndexDTOList = respDTO.data;
|
|
|
+ if (ListUtil.isNotEmpty(staticKnowledgeIndexDTOList)) {
|
|
|
+ //是否有静态知识
|
|
|
+ List<String> conNameList = staticKnowledgeIndexDTOList
|
|
|
+ .stream()
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("name", conNameList);
|
|
|
+ List<ConceptInfo> conceptInfoList = conceptInfoFacade.list(conceptInfoQueryWrapper);
|
|
|
+ Map<String, ConceptInfo> infoMap
|
|
|
+ = EntityUtil.makeEntityMapByKeys(conceptInfoList, "_", "name", "type");
|
|
|
+ for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
|
|
|
+ if (infoMap.containsKey(item.getName() + "_" + item.getTypeName())) {
|
|
|
+ item.setId(infoMap.get(item.getName() + "_" + item.getTypeName()).getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Long> conceptIdList = conceptInfoList.stream()
|
|
|
+ .map(i -> i.getId())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(conceptIdList)) {
|
|
|
+ QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
|
|
|
+ conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("concept_id", conceptIdList);
|
|
|
+ List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
|
|
|
+ Map<Long, List<ConceptDetail>> detailMap
|
|
|
+ = EntityUtil.makeEntityListMap(conceptDetailList, "conceptId");
|
|
|
+ for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
|
|
|
+ if (item.getId() == null
|
|
|
+ || !detailMap.containsKey(item.getId())) {
|
|
|
+ item.setHasInfomation(0);
|
|
|
+ item.setHasClinicalPathway(0);
|
|
|
+ item.setHasNotice((0));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (ConceptDetail detail : detailMap.get(item.getId())) {
|
|
|
+ List<String> contentTypeList = Arrays.asList(detail.getConcentType().split(","));
|
|
|
+ if (contentTypeList.contains(1)) {
|
|
|
+ item.setHasInfomation(1);
|
|
|
+ }
|
|
|
+ if (contentTypeList.contains(2)) {
|
|
|
+ item.setHasNotice(1);
|
|
|
+ }
|
|
|
+ if (contentTypeList.contains(3)) {
|
|
|
+ item.setHasClinicalPathway(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //排序
|
|
|
+ Map<String, List<StaticKnowledgeIndexDTO>> map
|
|
|
+ = EntityUtil.makeEntityListMap(staticKnowledgeIndexDTOList, "typeName");
|
|
|
+ for (DictionaryInfo dic : dicList) {
|
|
|
+ if (map.containsKey(dic.getName())) {
|
|
|
+ retList.addAll(map.get(dic.getName()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
}
|