|
@@ -0,0 +1,140 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.diagbot.dto.DiseaseInfoDTO;
|
|
|
+import com.diagbot.dto.DrugInfoDTO;
|
|
|
+import com.diagbot.dto.IndexDTO;
|
|
|
+import com.diagbot.dto.LisDetailDTO;
|
|
|
+import com.diagbot.dto.OperationInfoDTO;
|
|
|
+import com.diagbot.dto.RetrievalDTO;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.MedRetrievalVO;
|
|
|
+import com.diagbot.vo.RetrievalVO;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @Author:zhaops
|
|
|
+ * @time: 2021/2/22 10:35
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class MedRetrievalFacade {
|
|
|
+ @Autowired
|
|
|
+ private KlConceptFacade klConceptFacade;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检索
|
|
|
+ *
|
|
|
+ * @param retrievalVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public RetrievalDTO index(RetrievalVO retrievalVO) {
|
|
|
+ if (retrievalVO.getSize() == null) {
|
|
|
+ retrievalVO.setSize(100);
|
|
|
+ }
|
|
|
+ RetrievalDTO retrievalDTO = new RetrievalDTO();
|
|
|
+ MedRetrievalVO medRetrievalVO = new MedRetrievalVO();
|
|
|
+ BeanUtil.copyProperties(retrievalVO, medRetrievalVO);
|
|
|
+ medRetrievalVO.setTypeIds(new ArrayList<>());
|
|
|
+ List<IndexDTO> indexList = Lists.newLinkedList();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状
|
|
|
+ */
|
|
|
+ switch (retrievalVO.getType()) {
|
|
|
+ case 1:
|
|
|
+ medRetrievalVO.setTypeId(107L);
|
|
|
+ medRetrievalVO.getTypeIds().add(107L);
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ retrievalDTO.setLisNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ medRetrievalVO.setTypeId(108L);
|
|
|
+ medRetrievalVO.getTypeIds().add(108L);
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ List<LisDetailDTO> lisDetails = Lists.newLinkedList();
|
|
|
+ indexList.forEach(item -> {
|
|
|
+ LisDetailDTO lisDetail = new LisDetailDTO();
|
|
|
+ BeanUtil.copyProperties(item, lisDetail);
|
|
|
+ lisDetail.setName(item.getPackName());
|
|
|
+ lisDetail.setUniqueName(item.getName());
|
|
|
+ //默认套餐名称
|
|
|
+ if (StringUtil.isBlank(lisDetail.getName())) {
|
|
|
+ lisDetail.setName(lisDetail.getUniqueName());
|
|
|
+ }
|
|
|
+ lisDetails.add(lisDetail);
|
|
|
+ });
|
|
|
+ retrievalDTO.setLisDetailNames(lisDetails);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ medRetrievalVO.setTypeId(109L);
|
|
|
+ medRetrievalVO.getTypeIds().addAll(Arrays.asList(new Long[] { 109L, 110L }));
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ retrievalDTO.setPacsNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ medRetrievalVO.setTypeId(100L);
|
|
|
+ medRetrievalVO.getTypeIds().add(100L);
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ retrievalDTO.setDiseaseNames(BeanUtil.listCopyTo(indexList, DiseaseInfoDTO.class));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ medRetrievalVO.setTypeId(101L);
|
|
|
+ medRetrievalVO.getTypeIds().add(101L);
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ retrievalDTO.setDrugNames(BeanUtil.listCopyTo(indexList, DrugInfoDTO.class));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ medRetrievalVO.setTypeId(106L);
|
|
|
+ medRetrievalVO.getTypeIds().add(106L);
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ retrievalDTO.setOperationNames(BeanUtil.listCopyTo(indexList, OperationInfoDTO.class));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ medRetrievalVO.setTypeId(115L);
|
|
|
+ medRetrievalVO.getTypeIds().add(115L);
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ retrievalDTO.setDeptNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ medRetrievalVO.setTypeId(113L);
|
|
|
+ medRetrievalVO.getTypeIds().add(113L);
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ retrievalDTO.setTransfusionNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ medRetrievalVO.setTypeId(103L);
|
|
|
+ medRetrievalVO.getTypeIds().add(103L);
|
|
|
+ indexList = klConceptFacade.index(medRetrievalVO);
|
|
|
+ if (ListUtil.isNotEmpty(indexList)) {
|
|
|
+ retrievalDTO.setSymptomNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return retrievalDTO;
|
|
|
+ }
|
|
|
+}
|