瀏覽代碼

Merge branch 'dev/20220228_v3.0.1通用版_渠道管理第一期' into test

rengb 3 年之前
父節點
當前提交
fbb08cf6af
共有 29 個文件被更改,包括 1413 次插入8 次删除
  1. 4 0
      config-center/src/main/resources/shared/mdsp-service-debug.yml
  2. 4 0
      config-center/src/main/resources/shared/mdsp-service-inner.yml
  3. 4 0
      config-center/src/main/resources/shared/mdsp-service-local.yml
  4. 4 0
      config-center/src/main/resources/shared/mdsp-service-outer.yml
  5. 4 0
      config-center/src/main/resources/shared/mdsp-service-test.yml
  6. 12 0
      mdsp-service/src/main/java/com/lantone/client/CdssCoreClient.java
  7. 23 0
      mdsp-service/src/main/java/com/lantone/client/StandConvertServiceClient.java
  8. 20 0
      mdsp-service/src/main/java/com/lantone/client/hystrix/CdssCoreHystrix.java
  9. 19 0
      mdsp-service/src/main/java/com/lantone/client/hystrix/StandConvertServiceHystrix.java
  10. 24 0
      mdsp-service/src/main/java/com/lantone/dto/med/IndexDTO.java
  11. 51 0
      mdsp-service/src/main/java/com/lantone/dto/med/LisDetailDTO.java
  12. 17 0
      mdsp-service/src/main/java/com/lantone/dto/med/RetrievalConceptDTO.java
  13. 82 0
      mdsp-service/src/main/java/com/lantone/dto/med/RetrievalDTO.java
  14. 31 0
      mdsp-service/src/main/java/com/lantone/dto/med/StandConvertCrfDTO.java
  15. 56 0
      mdsp-service/src/main/java/com/lantone/enums/med/StandConvertCrfEnum.java
  16. 83 0
      mdsp-service/src/main/java/com/lantone/facade/cdss/CdssRetrievalFacade.java
  17. 222 0
      mdsp-service/src/main/java/com/lantone/facade/med/MedRetrievalFacade.java
  18. 175 5
      mdsp-service/src/main/java/com/lantone/facade/med/TermMatchingFacade.java
  19. 4 0
      mdsp-service/src/main/java/com/lantone/mapper/med/KlConceptMapper.java
  20. 9 0
      mdsp-service/src/main/java/com/lantone/mapper/med/KlLibraryInfoMapper.java
  21. 18 0
      mdsp-service/src/main/java/com/lantone/vo/med/MedRetrievalVO.java
  22. 51 0
      mdsp-service/src/main/java/com/lantone/vo/med/RetrievalVO.java
  23. 18 0
      mdsp-service/src/main/java/com/lantone/vo/med/StandConvertCrfVO.java
  24. 18 0
      mdsp-service/src/main/java/com/lantone/vo/med/TermMatchingListVO.java
  25. 42 0
      mdsp-service/src/main/java/com/lantone/web/cdss/CdssRetrievalController.java
  26. 21 2
      mdsp-service/src/main/java/com/lantone/web/med/RetrievalController.java
  27. 1 1
      mdsp-service/src/main/java/com/lantone/web/med/TermMatchingController.java
  28. 255 0
      mdsp-service/src/main/resources/mapper/med/KlConceptMapper.xml
  29. 141 0
      mdsp-service/src/main/resources/mapper/med/KlLibraryInfoMapper.xml

+ 4 - 0
config-center/src/main/resources/shared/mdsp-service-debug.yml

@@ -16,4 +16,8 @@ spring:
           username: root
           password: lantone
 
+StandConvert:
+  url: http://192.168.2.234:23232
+  rate: 0.9
+
 swagger.show: true

+ 4 - 0
config-center/src/main/resources/shared/mdsp-service-inner.yml

@@ -16,4 +16,8 @@ spring:
           username: teamback
           password: goTulmLeon
 
+StandConvert:
+  url: http://192.168.2.234:23232
+  rate: 0.9
+
 swagger.show: true

+ 4 - 0
config-center/src/main/resources/shared/mdsp-service-local.yml

@@ -16,4 +16,8 @@ spring:
           username: root
           password: lantone
 
+StandConvert:
+  url: http://192.168.2.234:23232
+  rate: 0.9
+
 swagger.show: true

+ 4 - 0
config-center/src/main/resources/shared/mdsp-service-outer.yml

@@ -16,4 +16,8 @@ spring:
           username: root
           password: lantone
 
+StandConvert:
+  url: http://192.168.2.234:23232
+  rate: 0.9
+
 swagger.show: false

+ 4 - 0
config-center/src/main/resources/shared/mdsp-service-test.yml

@@ -16,4 +16,8 @@ spring:
           username: root
           password: lantone
 
+StandConvert:
+  url: http://192.168.2.234:23232
+  rate: 0.9
+
 swagger.show: true

+ 12 - 0
mdsp-service/src/main/java/com/lantone/client/CdssCoreClient.java

@@ -3,11 +3,15 @@ package com.lantone.client;
 import com.diagbot.dto.RespDTO;
 import com.lantone.dto.med.IndexBatchDTO;
 import com.lantone.dto.med.KllisDetailDTO;
+import com.lantone.dto.med.RetrievalDTO;
+import com.lantone.vo.cdss.RetrievalVO;
 import com.lantone.vo.med.ConceptVO;
 import com.lantone.vo.med.FilterVO;
 import com.lantone.vo.med.IndexByApprovalVO;
 import com.lantone.vo.med.KllisDetailVO;
+import org.springframework.web.bind.annotation.RequestBody;
 
+import javax.validation.Valid;
 import java.util.List;
 import java.util.Map;
 
@@ -54,4 +58,12 @@ public interface CdssCoreClient {
      */
     RespDTO<Map<String, KllisDetailDTO>> getLisDetaisByNames(KllisDetailVO kllisDetailVO);
 
+    /**
+     * 化验大项、化验小项、辅检、诊断、药品、手术等检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    RespDTO<RetrievalDTO> index(@RequestBody @Valid RetrievalVO retrievalVO);
+
 }

+ 23 - 0
mdsp-service/src/main/java/com/lantone/client/StandConvertServiceClient.java

@@ -0,0 +1,23 @@
+package com.lantone.client;
+
+
+import com.lantone.dto.med.StandConvertCrfDTO;
+import com.lantone.vo.med.StandConvertCrfVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+
+/**
+ * @description: 标准词转换
+ * @author: zhoutg
+ * @date: 2020/8/12 10:41
+ */
+@FeignClient(value = "StandConvert-service", url = "${StandConvert.url}")
+public interface StandConvertServiceClient {
+
+    @PostMapping(value = "/api/similarity")
+    StandConvertCrfDTO similarity(StandConvertCrfVO standConvertCrfVO);
+
+}
+
+
+

+ 20 - 0
mdsp-service/src/main/java/com/lantone/client/hystrix/CdssCoreHystrix.java

@@ -1,10 +1,14 @@
 package com.lantone.client.hystrix;
 
 import com.diagbot.dto.RespDTO;
+import com.diagbot.util.BeanUtil;
 import com.lantone.client.CdssCoreClient;
 import com.lantone.dto.med.IndexBatchDTO;
 import com.lantone.dto.med.KllisDetailDTO;
+import com.lantone.dto.med.RetrievalDTO;
 import com.lantone.facade.med.KlConceptFacade;
+import com.lantone.facade.med.MedRetrievalFacade;
+import com.lantone.vo.cdss.RetrievalVO;
 import com.lantone.vo.med.ConceptVO;
 import com.lantone.vo.med.FilterVO;
 import com.lantone.vo.med.IndexByApprovalVO;
@@ -12,7 +16,9 @@ import com.lantone.vo.med.KllisDetailVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
 
+import javax.validation.Valid;
 import java.util.List;
 import java.util.Map;
 
@@ -30,6 +36,8 @@ public class CdssCoreHystrix implements CdssCoreClient {
 
     @Autowired
     private KlConceptFacade klConceptFacade;
+    @Autowired
+    private MedRetrievalFacade medRetrievalFacade;
 
     /**
      * 国药准字匹配
@@ -79,5 +87,17 @@ public class CdssCoreHystrix implements CdssCoreClient {
         return RespDTO.onSuc(klConceptFacade.getLisDetaisByNamesFac(kllisDetailVO));
     }
 
+    /**
+     * 化验大项、化验小项、辅检、诊断、药品、手术等检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    @Override
+    public RespDTO<RetrievalDTO> index(@RequestBody @Valid RetrievalVO retrievalVO) {
+        com.lantone.vo.med.RetrievalVO newRetrievalVO = new com.lantone.vo.med.RetrievalVO();
+        BeanUtil.copyProperties(retrievalVO, newRetrievalVO);
+        return RespDTO.onSuc(medRetrievalFacade.index(newRetrievalVO));
+    }
 
 }

+ 19 - 0
mdsp-service/src/main/java/com/lantone/client/hystrix/StandConvertServiceHystrix.java

@@ -0,0 +1,19 @@
+package com.lantone.client.hystrix;
+
+
+import com.lantone.client.StandConvertServiceClient;
+import com.lantone.dto.med.StandConvertCrfDTO;
+import com.lantone.vo.med.StandConvertCrfVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+@Component
+@Slf4j
+public class StandConvertServiceHystrix implements StandConvertServiceClient {
+
+    @Override
+    public StandConvertCrfDTO similarity(StandConvertCrfVO standConvertCrfVO) {
+        log.error("【hystrix】调用{}异常", "similarity");
+        return null;
+    }
+}

+ 24 - 0
mdsp-service/src/main/java/com/lantone/dto/med/IndexDTO.java

@@ -0,0 +1,24 @@
+package com.lantone.dto.med;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/2/22 9:49
+ */
+@Getter
+@Setter
+public class IndexDTO {
+    private Long id;
+    private String name;
+    private String icd10Code;
+    private String code;
+    private Double maxValue;
+    private Double minValue;
+    private String units;
+    private Integer range;
+    private Long packId;
+    private String packName;
+}

+ 51 - 0
mdsp-service/src/main/java/com/lantone/dto/med/LisDetailDTO.java

@@ -0,0 +1,51 @@
+package com.lantone.dto.med;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/12 15:53
+ */
+@Getter
+@Setter
+public class LisDetailDTO {
+    private Long id;
+    /**
+     * 大项(套餐)
+     */
+    private String name;
+    /**
+     * 小项(公表名)
+     */
+    private String uniqueName;
+    /**
+     * 数值
+     */
+    private Double value;
+    /**
+     * 单位
+     */
+    private String units;
+    /**
+     * 下限
+     */
+    private Double minValue;
+    /**
+     * 上限
+     */
+    private Double maxValue;
+    /**
+     * 非数值结果
+     */
+    private String otherValue;
+    /**
+     * 非数值类型参考值
+     */
+    private String referenceValue;
+    /**
+     * 参考范围:0-范围内,1-范围外
+     */
+    private Integer range;
+}

+ 17 - 0
mdsp-service/src/main/java/com/lantone/dto/med/RetrievalConceptDTO.java

@@ -0,0 +1,17 @@
+package com.lantone.dto.med;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-10 14:46
+ */
+@Setter
+@Getter
+public class RetrievalConceptDTO {
+    private Long id;
+    private String name;
+    private String code;
+}

+ 82 - 0
mdsp-service/src/main/java/com/lantone/dto/med/RetrievalDTO.java

@@ -0,0 +1,82 @@
+package com.lantone.dto.med;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/12 15:45
+ */
+@Getter
+@Setter
+public class RetrievalDTO {
+    /**
+     * 化验大项 辅检 诊断 药品 手术或操作 科室 输血 症状 体征 量表 护理 中医诊断 中医证候 麻醉 药品剂型
+     */
+    private List<RetrievalConceptDTO> nameList;
+    /**
+     * 化验小项
+     */
+    private List<LisDetailDTO> lisDetailNames;
+    /**
+     * 辅检
+     *//*
+    private List<RetrievalConceptDTO> pacsNames;
+    *//**
+     * 诊断
+     *//*
+    private List<RetrievalConceptDTO> diseaseNames;
+    *//**
+     * 药品
+     *//*
+    private List<RetrievalConceptDTO> drugNames;
+    *//**
+     * 手术或操作
+     *//*
+    private List<RetrievalConceptDTO> operationNames;
+    *//**
+     * 科室
+     *//*
+    private List<RetrievalConceptDTO> deptNames;
+    *//**
+     * 输血
+     *//*
+    private List<RetrievalConceptDTO> transfusionNames;
+    *//**
+     * 症状
+     *//*
+    private List<RetrievalConceptDTO> symptomNames;
+    *//**
+     * 体征
+     *//*
+    private List<RetrievalConceptDTO> vitalNames;
+    *//**
+     * 量表
+     *//*
+    private List<RetrievalConceptDTO> scalenames;
+    *//**
+     * 护理
+     *//*
+    private List<RetrievalConceptDTO> nursenames;
+    *//**
+     * 中医诊断
+     *//*
+    private List<RetrievalConceptDTO> tcmdiseaseNames;
+    *//**
+     * 中医证候
+     *//*
+    private List<RetrievalConceptDTO> tcmsyndromeNames;
+    *//**
+     * 麻醉
+     *//*
+    private List<RetrievalConceptDTO> anesthesiaInfonames;
+
+    *//**
+     * 药品剂型
+     *//*
+    private List<RetrievalConceptDTO> drugDosage;*/
+
+}

+ 31 - 0
mdsp-service/src/main/java/com/lantone/dto/med/StandConvertCrfDTO.java

@@ -0,0 +1,31 @@
+package com.lantone.dto.med;
+
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description: 标准词转换类出参
+ * @author: zhoutg
+ * @date: 2020/8/12 10:48
+ */
+@Data
+public class StandConvertCrfDTO {
+    // 成功返回true, 否则返回false
+    private Boolean status;
+    // 标准词列表,有顺序,第一个是最大可能性的
+    private List<Map<String,String>> standard_words;
+    /**
+     * 错误码(error_code)列表:
+     *     1000 ---> 正常
+     *     1001 ---> 输入错误,word_type或word为空
+     *     1002 ---> 没有这个模型, word_type出错
+     *     1003 ---> 模型预测出错
+     *     1004 ---> 模型其他错误
+     *     1005 ---> 其他错误
+     *     1006 ---> 字符串(即word)不符合所规定的格式【错误格式:没有中文字符,数字或者非前括号符号开头,空字符串,
+     *         不是字符串, 长度超过40字符】
+     */
+    private Integer error_code;
+}

+ 56 - 0
mdsp-service/src/main/java/com/lantone/enums/med/StandConvertCrfEnum.java

@@ -0,0 +1,56 @@
+package com.lantone.enums.med;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-11 9:28
+ */
+public enum StandConvertCrfEnum implements KeyedNamed {
+    // 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 查体:vital
+    disease(1, "disease"),
+    symptom(2, "symptom"),
+    operation(3, "operation"),
+    drug(4, "drug"),
+    lis(5, "lis"),
+    pacs(6, "pacs"),
+    vital(7, "vital");
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    StandConvertCrfEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static StandConvertCrfEnum getEnum(int key) {
+        for (StandConvertCrfEnum item : StandConvertCrfEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        StandConvertCrfEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+}

+ 83 - 0
mdsp-service/src/main/java/com/lantone/facade/cdss/CdssRetrievalFacade.java

@@ -0,0 +1,83 @@
+package com.lantone.facade.cdss;
+
+import com.diagbot.dto.RespDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
+import com.lantone.client.CdssCoreClient;
+import com.lantone.dto.med.RetrievalDTO;
+import com.lantone.vo.cdss.RetrievalVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/12 16:44
+ */
+@Component
+public class CdssRetrievalFacade {
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
+
+    /**
+     * 检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    public RetrievalDTO index(RetrievalVO retrievalVO) {
+        RetrievalDTO retrievalDTO = new RetrievalDTO();
+        if (null == retrievalVO
+                || (null != retrievalVO
+                && (null == retrievalVO.getHospitalId() || retrievalVO.getHospitalId().equals(-1L)))) {
+            //无医院或者朗通医院查询标准词
+            RespDTO<RetrievalDTO> respDTO = cdssCoreClient.index(retrievalVO);
+            RespDTOUtil.respNGDealCover(respDTO, "检索失败");
+            retrievalDTO = respDTO.data;
+        } else {
+            //实际医院查询医院词
+            if (retrievalVO.getDefaultList().equals(0)
+                    && StringUtil.isBlank(retrievalVO.getInputStr())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "请输入检索内容!");
+            }
+            /*HospitalCheckVO hospitalCheckVO = new HospitalCheckVO();
+            hospitalCheckVO.setHospitalId(retrievalVO.getHospitalId());
+            if (!hospitalInfoFacade.checkHospital(hospitalCheckVO)) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS, "该医院ID不存在或者未启用!");
+            }
+            else {
+                switch (retrievalVO.getType()) {
+                    case 2:
+                        retrievalDTO.setLisDetailNames(mappingConfigFacade.getHisDetailNames(retrievalVO));
+                        break;
+                    case 1:
+                    case 3:
+                    case 4:
+                    case 5:
+                    case 6:
+                    case 7:
+                    case 8:
+                    case 10:
+                    case 11:
+                    case 12:
+                    case 13:
+                    case 14:
+                    case 16:
+                        List<RetrievalConceptDTO> hisNameList = new ArrayList<>();
+                        List<String> hisNames = mappingConfigFacade.getHisNames(retrievalVO);
+                        for (String str : hisNames) {
+                            RetrievalConceptDTO data = new RetrievalConceptDTO();
+                            data.setName(str);
+                            hisNameList.add(data);
+                        }
+                        retrievalDTO.setNameList(hisNameList);
+                        break;
+
+                }
+            }*/
+        }
+        return retrievalDTO;
+    }
+}

+ 222 - 0
mdsp-service/src/main/java/com/lantone/facade/med/MedRetrievalFacade.java

@@ -0,0 +1,222 @@
+package com.lantone.facade.med;
+
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.google.common.collect.Lists;
+import com.lantone.dto.med.IndexDTO;
+import com.lantone.dto.med.LisDetailDTO;
+import com.lantone.dto.med.RetrievalConceptDTO;
+import com.lantone.dto.med.RetrievalDTO;
+import com.lantone.enums.med.LexiconEnum;
+import com.lantone.vo.med.MedRetrievalVO;
+import com.lantone.vo.med.RetrievalVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @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);
+        }
+        if (retrievalVO.getDefaultList().equals(0)
+                && StringUtil.isBlank(retrievalVO.getInputStr())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "请输入检索内容");
+        }
+        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-症状、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉、15-药品剂型、16-给药途径、17-物理治疗
+         */
+
+        switch (retrievalVO.getType()) {
+            case 1:
+                medRetrievalVO.setTypeId(LexiconEnum.LisName.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.LisName.getKey());
+                List<RetrievalConceptDTO> nameList = new ArrayList<>();
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    nameList = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(nameList);
+                }
+                break;
+            case 2:
+                medRetrievalVO.setTypeId(LexiconEnum.LisSubName.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.LisSubName.getKey());
+                indexList = klConceptFacade.getBaseMapper().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(LexiconEnum.PacsName.getKey());
+                medRetrievalVO.getTypeIds().addAll(Arrays.asList(LexiconEnum.PacsName.getKey(),
+                        LexiconEnum.PacsSubName.getKey()));
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    List<RetrievalConceptDTO> pacsNames = new ArrayList<>();
+                    pacsNames = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(pacsNames);
+                }
+                break;
+            case 4:
+                medRetrievalVO.setTypeId(LexiconEnum.Disease.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Disease.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 5:
+                medRetrievalVO.setTypeId(LexiconEnum.Medicine.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Medicine.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 6:
+                medRetrievalVO.setTypeId(LexiconEnum.Operation.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Operation.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 7:
+                medRetrievalVO.setTypeId(LexiconEnum.Dept.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Dept.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    List<RetrievalConceptDTO> deptNames = new ArrayList<>();
+                    deptNames = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(deptNames);
+                }
+                break;
+            case 8:
+                medRetrievalVO.setTypeId(LexiconEnum.Transfusion.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Transfusion.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    List<RetrievalConceptDTO> transfusionNames = new ArrayList<>();
+                    transfusionNames = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(transfusionNames);
+                }
+                break;
+            case 9:
+                medRetrievalVO.setTypeId(LexiconEnum.Symptom.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Symptom.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    List<RetrievalConceptDTO> symptomNames = new ArrayList<>();
+                    symptomNames = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(symptomNames);
+                }
+                break;
+            case 10:
+                medRetrievalVO.setTypeId(LexiconEnum.Scale.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Scale.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 11:
+                medRetrievalVO.setTypeId(LexiconEnum.Nurse.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Nurse.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 12:
+                medRetrievalVO.setTypeId(LexiconEnum.Tcmdisease.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Tcmdisease.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 13:
+                medRetrievalVO.setTypeId(LexiconEnum.Tcmsyndrome.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Tcmsyndrome.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 14:
+                medRetrievalVO.setTypeId(LexiconEnum.Anesthesia.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Anesthesia.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 15:
+                medRetrievalVO.setTypeId(LexiconEnum.Form.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Form.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 16:
+                medRetrievalVO.setTypeId(LexiconEnum.AdministrationRoute.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.AdministrationRoute.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 17:
+                medRetrievalVO.setTypeId(LexiconEnum.Physicotherapy.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Physicotherapy.getKey());
+                indexList = klConceptFacade.getBaseMapper().index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+        }
+        return retrievalDTO;
+    }
+
+}

+ 175 - 5
mdsp-service/src/main/java/com/lantone/facade/med/TermMatchingFacade.java

@@ -2,15 +2,26 @@ package com.lantone.facade.med;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
-import com.google.common.collect.Lists;
+import com.lantone.client.StandConvertServiceClient;
+import com.lantone.dto.med.StandConvertCrfDTO;
 import com.lantone.dto.med.TermConceptDTO;
-import com.lantone.entity.med.KlConcept;
+import com.lantone.entity.med.KlLibraryInfo;
+import com.lantone.enums.med.LexiconEnum;
+import com.lantone.enums.med.StandConvertCrfEnum;
+import com.lantone.vo.med.StandConvertCrfVO;
+import com.lantone.vo.med.TermMatchingListVO;
 import com.lantone.vo.med.TermMatchingVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author wangfeng
@@ -20,9 +31,13 @@ import java.util.List;
 @Component
 public class TermMatchingFacade {
 
+    //    @Autowired
+    //    private KlConceptFacade klConceptFacade;
     @Autowired
-    private KlConceptFacade klConceptFacade;
-
+    private KlLibraryInfoFacade klLibraryInfoFacade;
+    @Autowired
+    private StandConvertServiceClient standConvertServiceClient;
+/*
     public List<TermConceptDTO> getTermMatchingAll(TermMatchingVO termMatchingVO) {
         List<TermConceptDTO> ret = Lists.newArrayList();
         QueryWrapper<KlConcept> klConceptQueryWrapper = new QueryWrapper<>();
@@ -34,10 +49,165 @@ public class TermMatchingFacade {
             TermConceptDTO termConceptDTO = new TermConceptDTO();
             termConceptDTO.setId(i.getLibId());
             termConceptDTO.setName(i.getLibName());
-//            termConceptDTO.setSource(i.getIsConcept() == 1 ? 1 : 2);
+            //            termConceptDTO.setSource(i.getIsConcept() == 1 ? 1 : 2);
             ret.add(termConceptDTO);
         });
         return ret;
+    }*/
+
+    public List<TermConceptDTO> getTermMatchingAll(TermMatchingVO termMatchingVO) {
+        List<TermConceptDTO> list = new ArrayList<>();
+        Integer type = convertType(termMatchingVO.getType());
+        TermMatchingVO termMatchingVONew = new TermMatchingVO();
+        BeanUtil.copyProperties(termMatchingVO, termMatchingVONew);
+        termMatchingVONew.setType(type);
+        if (type != null) {
+            TermConceptDTO libraryInfo = klLibraryInfoFacade.getBaseMapper().getConcept(termMatchingVONew);
+            if (null == libraryInfo && type.equals(LexiconEnum.PacsName.getKey())) {
+                termMatchingVONew.setType(LexiconEnum.PacsSubName.getKey());
+                libraryInfo = klLibraryInfoFacade.getBaseMapper().getConcept(termMatchingVONew);
+            }
+            if (null != libraryInfo) {
+                TermConceptDTO termConceptDTO = new TermConceptDTO();
+                termConceptDTO.setId(libraryInfo.getId());
+                termConceptDTO.setName(libraryInfo.getName());
+                termConceptDTO.setSource(libraryInfo.getSource() == 1 ? 1 : 2);
+                termConceptDTO.setCode(libraryInfo.getCode());
+                list.add(termConceptDTO);
+            }
+        }
+        //没有找到标准词或同义词才找相似词
+        if (ListUtil.isEmpty(list)) {
+            //相似词
+            StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
+            // 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital
+            String wordType = wordType(termMatchingVO.getType());
+            if (StringUtil.isNotBlank(wordType)) {
+                standConvertCrfVO.setWord_type(wordType);
+                standConvertCrfVO.setWord(termMatchingVO.getInputStr());
+                standConvertCrfVO.setNumber(5);
+                StandConvertCrfDTO standConvertCrfDTO = new StandConvertCrfDTO();
+                try {
+                    standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
+                } catch (Exception e) {
+                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准词转换【服务器】挂了!" + e.getMessage());
+                }
+
+                List<Map<String, String>> standard_words = standConvertCrfDTO.getStandard_words();
+                List<String> placeToList = new ArrayList<>();
+                if (ListUtil.isNotEmpty(standard_words)) {
+                    for (Map<String, String> map : standard_words) {
+                        String placeTo = map.get("standard_word");
+                        placeToList.add(placeTo);
+                    }
+                    TermMatchingListVO termMatchingListVO = new TermMatchingListVO();
+                    termMatchingListVO.setPlaceToList(placeToList);
+                    termMatchingListVO.setType(type);
+                    QueryWrapper<KlLibraryInfo> klLibraryInfo = new QueryWrapper<>();
+                    klLibraryInfo.eq("is_deleted", IsDeleteEnum.N.getKey())
+                            .eq("type_id", type)
+                            .in("name", placeToList);
+                    List<TermConceptDTO> libraryInfoList = klLibraryInfoFacade.getBaseMapper().getConceptList(termMatchingListVO);
+                    if (ListUtil.isNotEmpty(libraryInfoList)) {
+                        for (TermConceptDTO data : libraryInfoList) {
+                            TermConceptDTO termConceptDTO = new TermConceptDTO();
+                            termConceptDTO.setId(data.getId());
+                            termConceptDTO.setName(data.getName());
+                            termConceptDTO.setCode(data.getCode());
+                            termConceptDTO.setSource(5);
+                            list.add(termConceptDTO);
+                        }
+                    }
+                }
+            }
+        }
+        return list;
+    }
+
+    public Integer convertType(Integer type) {
+        Integer retType = null;
+        //type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉、15-药品剂型、16-给药途径
+        switch (type) {
+            case 1:
+                retType = LexiconEnum.LisName.getKey();
+                break;
+            case 2:
+                retType = LexiconEnum.LisSubName.getKey();
+                break;
+            case 3:
+                retType = LexiconEnum.PacsName.getKey();
+                break;
+            case 4:
+                retType = LexiconEnum.Disease.getKey();
+                break;
+            case 5:
+                retType = LexiconEnum.Medicine.getKey();
+                break;
+            case 6:
+                retType = LexiconEnum.Operation.getKey();
+                break;
+            case 7:
+                retType = LexiconEnum.Dept.getKey();
+                break;
+            case 8:
+                retType = LexiconEnum.Transfusion.getKey();
+                break;
+            case 9:
+                retType = LexiconEnum.Symptom.getKey();
+                break;
+            case 10:
+                retType = LexiconEnum.Scale.getKey();
+                break;
+            case 11:
+                retType = LexiconEnum.Nurse.getKey();
+                break;
+            case 12:
+                retType = LexiconEnum.Tcmdisease.getKey();
+                break;
+            case 13:
+                retType = LexiconEnum.Tcmsyndrome.getKey();
+                break;
+            case 14:
+                retType = LexiconEnum.Anesthesia.getKey();
+                break;
+            case 15:
+                retType = LexiconEnum.Form.getKey();
+                break;
+            case 16:
+                retType = LexiconEnum.AdministrationRoute.getKey();
+            default:
+                break;
+        }
+        return retType;
+    }
+
+    public String wordType(Integer type) {
+        String retType = null;
+        //type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候
+        //类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 查体:vital
+        switch (type) {
+            case 1:
+                retType = StandConvertCrfEnum.lis.getName();
+                break;
+            case 2:
+                retType = StandConvertCrfEnum.lis.getName();
+                break;
+            case 3:
+                retType = StandConvertCrfEnum.pacs.getName();
+                break;
+            case 4:
+                retType = StandConvertCrfEnum.disease.getName();
+                break;
+            case 5:
+                retType = StandConvertCrfEnum.drug.getName();
+                break;
+            case 6:
+                retType = StandConvertCrfEnum.operation.getName();
+                break;
+            default:
+                break;
+        }
+        return retType;
     }
 
 }

+ 4 - 0
mdsp-service/src/main/java/com/lantone/mapper/med/KlConceptMapper.java

@@ -3,10 +3,12 @@ package com.lantone.mapper.med;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.lantone.dto.med.IndexBatchDTO;
+import com.lantone.dto.med.IndexDTO;
 import com.lantone.dto.med.KllisDetailDTO;
 import com.lantone.entity.med.KlConcept;
 import com.lantone.vo.med.IndexByApprovalVO;
 import com.lantone.vo.med.KllisDetailVO;
+import com.lantone.vo.med.MedRetrievalVO;
 
 import java.util.List;
 
@@ -26,4 +28,6 @@ public interface KlConceptMapper extends BaseMapper<KlConcept> {
 
     List<KllisDetailDTO> getLisDetaisByNames(KllisDetailVO kllisDetailVO);
 
+    List<IndexDTO> index(MedRetrievalVO medRetrievalVO);
+
 }

+ 9 - 0
mdsp-service/src/main/java/com/lantone/mapper/med/KlLibraryInfoMapper.java

@@ -2,7 +2,12 @@ package com.lantone.mapper.med;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.lantone.dto.med.TermConceptDTO;
 import com.lantone.entity.med.KlLibraryInfo;
+import com.lantone.vo.med.TermMatchingListVO;
+import com.lantone.vo.med.TermMatchingVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -15,4 +20,8 @@ import com.lantone.entity.med.KlLibraryInfo;
 @DS("med")
 public interface KlLibraryInfoMapper extends BaseMapper<KlLibraryInfo> {
 
+    TermConceptDTO getConcept(TermMatchingVO termMatchingVO);
+
+    List<TermConceptDTO> getConceptList(TermMatchingListVO termMatchingListVO);
+
 }

+ 18 - 0
mdsp-service/src/main/java/com/lantone/vo/med/MedRetrievalVO.java

@@ -0,0 +1,18 @@
+package com.lantone.vo.med;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/2/22 10:36
+ */
+@Getter
+@Setter
+public class MedRetrievalVO extends RetrievalVO {
+    private Integer typeId;
+    private List<Integer> typeIds;
+}

+ 51 - 0
mdsp-service/src/main/java/com/lantone/vo/med/RetrievalVO.java

@@ -0,0 +1,51 @@
+package com.lantone.vo.med;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/12 15:40
+ */
+@Getter
+@Setter
+public class RetrievalVO {
+    /**
+     * 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状
+     */
+    @NotNull(message = "请输入检索类型")
+    private Integer type;
+    /**
+     * 检索内容
+     */
+    //@NotBlank(message = "请输入检索内容")
+    private String inputStr;
+    //    /**
+    //     * 性别:1-男、2-女、3-通用
+    //     */
+    //    private Integer sex;
+    //    /**
+    //     * 年龄
+    //     */
+    //    private Integer age;
+    /**
+     * 术语返回数量
+     */
+    @ApiModelProperty(hidden = true)
+    private Integer size;
+
+    /**
+     * 默认展示 0:不展示,1:展示全部
+     */
+    private Integer defaultList = 0;
+
+    /**
+     * 排除项标准术语id
+     */
+    private List<Long> notInIds;
+}

+ 18 - 0
mdsp-service/src/main/java/com/lantone/vo/med/StandConvertCrfVO.java

@@ -0,0 +1,18 @@
+package com.lantone.vo.med;
+
+import lombok.Data;
+
+/**
+ * @description: 标准词转换类
+ * @author: zhoutg
+ * @date: 2020/8/12 10:48
+ */
+@Data
+public class StandConvertCrfVO {
+    // 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital
+    private String word_type;
+    // 原始词
+    private String word;
+    // 最多返回个数
+    private Integer number = 1;
+}

+ 18 - 0
mdsp-service/src/main/java/com/lantone/vo/med/TermMatchingListVO.java

@@ -0,0 +1,18 @@
+package com.lantone.vo.med;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-24 19:03
+ */
+@Setter
+@Getter
+public class TermMatchingListVO {
+    private List<String> placeToList;
+    private Integer type;
+}

+ 42 - 0
mdsp-service/src/main/java/com/lantone/web/cdss/CdssRetrievalController.java

@@ -0,0 +1,42 @@
+package com.lantone.web.cdss;
+
+import com.diagbot.dto.RespDTO;
+import com.lantone.dto.med.RetrievalDTO;
+import com.lantone.facade.cdss.CdssRetrievalFacade;
+import com.lantone.vo.cdss.RetrievalVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/12 16:45
+ */
+@RestController
+@RequestMapping("/demo/retrieval")
+@Api(value = "术语检索相关API", tags = { "术语检索相关API" })
+@SuppressWarnings("unchecked")
+public class CdssRetrievalController {
+    @Autowired
+    private CdssRetrievalFacade cdssRetrievalFacade;
+
+    @ApiOperation(value = "术语检索[zhaops]",
+            notes = "type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状、10-量表、11-护理、12-中医疾病、13-中医证候、14-麻醉、15-药品剂型、16-给药途径 <br>" +
+                    "inputStr: 检索内容<br>" +
+                    "defaultList: 默认展示 0:不展示,1:展示全部<br>" +
+                    "sex: 性别:1-男、2-女、3-通用 <br>" +
+                    "age: 年龄<br>")
+    @PostMapping("/index")
+    public RespDTO<RetrievalDTO> index(@Valid @RequestBody RetrievalVO retrievalVO) {
+        RetrievalDTO data = cdssRetrievalFacade.index(retrievalVO);
+        return RespDTO.onSuc(data);
+    }
+
+}

+ 21 - 2
mdsp-service/src/main/java/com/lantone/web/med/RetrievalController.java

@@ -1,13 +1,16 @@
 package com.lantone.web.med;
 
+import com.diagbot.dto.RespDTO;
 import com.lantone.dto.med.IndexBatchDTO;
 import com.lantone.dto.med.KllisDetailDTO;
-import com.diagbot.dto.RespDTO;
+import com.lantone.dto.med.RetrievalDTO;
 import com.lantone.facade.med.KlConceptFacade;
+import com.lantone.facade.med.MedRetrievalFacade;
 import com.lantone.vo.med.ConceptVO;
 import com.lantone.vo.med.FilterVO;
 import com.lantone.vo.med.IndexByApprovalVO;
 import com.lantone.vo.med.KllisDetailVO;
+import com.lantone.vo.med.RetrievalVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,6 +18,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
 
 import javax.validation.Valid;
 import java.util.List;
@@ -25,15 +29,30 @@ import java.util.Map;
  * @Author:zhaops
  * @time: 2020/8/12 16:45
  */
+@ApiIgnore
 @RestController
 @RequestMapping("/retrieval")
 @Api(value = "术语检索相关API", tags = { "术语检索相关API" })
 @SuppressWarnings("unchecked")
-public class RetrievalController {
+public class MedRetrievalController {
 
     @Autowired
     private KlConceptFacade klConceptFacade;
+    @Autowired
+    private MedRetrievalFacade medRetrievalFacade;
 
+    @ApiOperation(value = "术语检索[zhaops]",
+            notes = "type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉、15-药品剂型、16-给药途径、17-物理治疗 <br>" +
+                    "inputStr: 检索内容<br>" +
+                    "defaultList: 默认展示 0:不展示,1:展示全部<br>" +
+                    "notInIds: 排除项标准术语id<br>" +
+                    "sex: 性别:1-男、2-女、3-通用 <br>" +
+                    "age: 年龄<br>")
+    @PostMapping("/index")
+    public RespDTO<RetrievalDTO> index(@Valid @RequestBody RetrievalVO retrievalVO) {
+        RetrievalDTO data = medRetrievalFacade.index(retrievalVO);
+        return RespDTO.onSuc(data);
+    }
 
     @ApiOperation(value = "术语批量查询[zhaops]",
             notes = "type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉、15-药品剂型、16-给药途径<br>" +

+ 1 - 1
mdsp-service/src/main/java/com/lantone/web/med/TermMatchingController.java

@@ -29,7 +29,7 @@ public class TermMatchingController {
     private TermMatchingFacade termMatchingFacade;
 
     @ApiOperation(value = "术语匹配搜索[wangfeng]",
-            notes = "type: 类型:100-疾病、101-药品通用名、102-药品剂型、106-手术和操作 <br>" +
+            notes = "type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉、16-给药途径 <br>" +
                     "inputStr: 检索内容<br>")
     @PostMapping("/termMatching")
     public RespDTO<List<TermConceptDTO>> getTermMatching(@Valid @RequestBody TermMatchingVO termMatchingVO) {

+ 255 - 0
mdsp-service/src/main/resources/mapper/med/KlConceptMapper.xml

@@ -87,4 +87,259 @@
         t1.approval-->
     </select>
 
+    <select id="index" resultType="com.lantone.dto.med.IndexDTO">
+        SELECT DISTINCT
+        t.id as id,
+        t.lib_name as name
+        <if test="typeId!=null and typeId==100">
+            ,t.code as code
+        </if>
+        <if test="typeId!=null and typeId==127">
+            ,t.code as code
+        </if>
+        <if test="typeId!=null and typeId==128">
+            ,t.code as code
+        </if>
+        <if test="typeId!=null and typeId==106">
+            ,t.code as code
+        </if>
+        <if test="typeId!=null and typeId==108">
+            ,
+            t1.max_value as `maxValue`,
+            t1.min_value as minValue,
+            t1.unit as units,
+            t1.type as `range`,
+            t4.lib_name AS packName,
+            t4.id as packId
+        </if>
+        FROM
+        (
+        SELECT DISTINCT
+        b.id,
+        b.lib_name
+        <if test="typeId!=null and typeId==100">
+            ,c.icd10_code as code
+        </if>
+        <if test="typeId!=null and typeId==127">
+            ,c.code as code
+        </if>
+        <if test="typeId!=null and typeId==128">
+            ,c.code as code
+        </if>
+        <if test="typeId!=null and typeId==106">
+            ,c.operation_code as code
+        </if>
+        FROM
+        kl_library_info a,
+        kl_concept b
+        <if test="typeId!=null and typeId==100">
+            left join kl_disease c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==127">
+            left join kl_tcm_disease c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==128">
+            left join kl_tcm_syndrome c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==106">
+            LEFT JOIN `kl_operation` c
+            ON c.is_deleted = 'N'
+            AND b.id = c.concept_id
+        </if>
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.concept_id = b.id
+        AND a.id = b.lib_id
+        AND b.status = 1
+        <if test="inputStr!=null and inputStr!=''">
+            AND ( a.`name` = #{inputStr} OR LOWER(a.spell) = LOWER(#{inputStr})
+            <if test="typeId!=null and typeId==100">
+                OR LOWER(c.icd10_code) = LOWER(#{inputStr})
+            </if>
+            <if test="typeId!=null and typeId==127">
+                OR LOWER(c.code) = LOWER(#{inputStr})
+            </if>
+            <if test="typeId!=null and typeId==128">
+                OR LOWER(c.code) = LOWER(#{inputStr})
+            </if>
+            <if test="typeId!=null and typeId==106">
+                OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
+            </if>
+            )
+        </if>
+        <if test="typeIds != null and typeIds.size > 0">
+            <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
+                a.type_id =#{typeId}
+            </foreach>
+        </if>
+        <if test="notInIds != null and notInIds.size > 0">
+            <foreach item="notInId" collection="notInIds" open="and(" separator="and" close=")">
+                b.id != #{notInId}
+            </foreach>
+        </if>
+        UNION
+        SELECT DISTINCT
+        b.id,
+        b.lib_name
+        <if test="typeId!=null and typeId==100">
+            ,c.icd10_code as code
+        </if>
+        <if test="typeId!=null and typeId==127">
+            ,c.code as code
+        </if>
+        <if test="typeId!=null and typeId==128">
+            ,c.code as code
+        </if>
+        <if test="typeId!=null and typeId==106">
+            ,c.operation_code as code
+        </if>
+        FROM
+        kl_library_info a,
+        kl_concept b
+        <if test="typeId!=null and typeId==100">
+            left join kl_disease c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==127">
+            left join kl_tcm_disease c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==128">
+            left join kl_tcm_syndrome c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==106">
+            LEFT JOIN `kl_operation` c
+            ON c.is_deleted = 'N'
+            AND b.id = c.concept_id
+        </if>
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.concept_id = b.id
+        AND a.id = b.lib_id
+        AND b.status = 1
+        <if test="inputStr!=null and inputStr!=''">
+            AND ( a.`name` LIKE concat(#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER(concat(#{inputStr},'%'))
+            <if test="typeId!=null and typeId==100">
+                OR LOWER(c.icd10_code) LIKE LOWER(concat(#{inputStr},'%'))
+            </if>
+            <if test="typeId!=null and typeId==127">
+                OR LOWER(c.code) LIKE LOWER(concat(#{inputStr},'%'))
+            </if>
+            <if test="typeId!=null and typeId==128">
+                OR LOWER(c.code) LIKE LOWER(concat(#{inputStr},'%'))
+            </if>
+            <if test="typeId!=null and typeId==106">
+                OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
+            </if>
+            )
+        </if>
+        <if test="typeIds != null and typeIds.size > 0">
+            <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
+                a.type_id =#{typeId}
+            </foreach>
+        </if>
+        <if test="notInIds != null and notInIds.size > 0">
+            <foreach item="notInId" collection="notInIds" open="and(" separator="and" close=")">
+                b.id != #{notInId}
+            </foreach>
+        </if>
+        UNION
+        SELECT DISTINCT
+        b.id,
+        b.lib_name
+        <if test="typeId!=null and typeId==100">
+            ,c.icd10_code as code
+        </if>
+        <if test="typeId!=null and typeId==127">
+            ,c.code as code
+        </if>
+        <if test="typeId!=null and typeId==128">
+            ,c.code as code
+        </if>
+        <if test="typeId!=null and typeId==106">
+            ,c.operation_code as code
+        </if>
+        FROM
+        kl_library_info a,
+        kl_concept b
+        <if test="typeId!=null and typeId==100">
+            left join kl_disease c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==127">
+            left join kl_tcm_disease c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==128">
+            left join kl_tcm_syndrome c
+            on c.is_deleted = 'N'
+            and b.id = c.concept_id
+        </if>
+        <if test="typeId!=null and typeId==106">
+            LEFT JOIN `kl_operation` c
+            ON c.is_deleted = 'N'
+            AND b.id = c.concept_id
+        </if>
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.concept_id = b.id
+        AND a.id = b.lib_id
+        AND b.status = 1
+        <if test="inputStr!=null and inputStr!=''">
+            AND ( a.`name` LIKE concat('%',#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat('%',#{inputStr},'%'))
+            <if test="typeId!=null and typeId==100">
+                OR LOWER(c.icd10_code) LIKE LOWER( concat('%',#{inputStr},'%'))
+            </if>
+            <if test="typeId!=null and typeId==127">
+                OR LOWER(c.code) LIKE LOWER( concat('%',#{inputStr},'%'))
+            </if>
+            <if test="typeId!=null and typeId==128">
+                OR LOWER(c.code) LIKE LOWER( concat('%',#{inputStr},'%'))
+            </if>
+            <if test="typeId!=null and typeId==106">
+                OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
+            </if>
+            )
+        </if>
+        <if test="typeIds != null and typeIds.size > 0">
+            <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
+                a.type_id =#{typeId}
+            </foreach>
+        </if>
+        <if test="notInIds != null and notInIds.size > 0">
+            <foreach item="notInId" collection="notInIds" open="and(" separator="and" close=")">
+                b.id != #{notInId}
+            </foreach>
+        </if>
+        ) t
+        <if test="typeId!=null and typeId==108">
+            LEFT JOIN kl_lis t1 ON t.id = t1.concept_id
+            AND t1.is_deleted = 'N'
+            LEFT JOIN kl_relation t3 ON t.id = t3.end_id
+            AND t3.relation_id = 600
+            AND t3.is_deleted = 'N'
+            LEFT JOIN kl_concept t4 ON t3.start_id = t4.id
+            AND t4.lib_type = 107
+            AND t4.is_deleted = 'N'
+        </if>
+        <if test="size!=null">
+            LIMIT #{size}
+        </if>
+    </select>
+
 </mapper>

+ 141 - 0
mdsp-service/src/main/resources/mapper/med/KlLibraryInfoMapper.xml

@@ -18,4 +18,145 @@
         <result column="remark" property="remark"/>
     </resultMap>
 
+    <select id="getConcept" resultType="com.lantone.dto.med.TermConceptDTO">
+        SELECT DISTINCT
+        t.id as id,
+        t.name ,
+        t.isConcept as source
+        <if test="type!=null and type==100">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==127">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==128">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==106">,
+            t.code as code
+        </if>
+        FROM
+        (SELECT DISTINCT
+        a.concept_id as id,
+        c.lib_name AS name,
+        a.is_concept as isConcept
+        <if test="type!=null and type==100">,
+            b.icd10_code as code
+        </if>
+        <if test="type!=null and type==127">,
+            b.code as code
+        </if>
+        <if test="type!=null and type==128">,
+            b.code as code
+        </if>
+        <if test="type!=null and type==106">,
+            b.operation_code as code
+        </if>
+        FROM
+        kl_library_info a
+        LEFT JOIN kl_concept c
+        ON a.concept_id = c.id
+        <if test="type!=null and type==100">
+            left join kl_disease b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==127">
+            left join kl_tcm_disease b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==128">
+            left join kl_tcm_syndrome b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==106">
+            left join kl_operation b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        WHERE a.is_deleted = "N"
+        AND c.status = 1
+        <if test="type!=null">
+            AND a.type_id = #{type}
+        </if>
+        <if test="inputStr!=null and inputStr!=''">
+            AND a.name = #{inputStr}
+        </if>
+        ) t
+    </select>
+
+    <select id="getConceptList" resultType="com.lantone.dto.med.TermConceptDTO">
+        SELECT DISTINCT
+        t.id as id,
+        t.name ,
+        t.isConcept as source
+        <if test="type!=null and type==100">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==127">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==128">,
+            t.code as code
+        </if>
+        <if test="type!=null and type==106">,
+            t.code as code
+        </if>
+        FROM
+        (SELECT DISTINCT
+        a.concept_id as id,
+        c.lib_name AS name,
+        a.is_concept as isConcept
+        <if test="type!=null and type==100">,
+            b.icd10_code as code
+        </if>
+        <if test="type!=null and type==127">,
+            b.code as code
+        </if>
+        <if test="type!=null and type==128">,
+            b.code as code
+        </if>
+        <if test="type!=null and type==106">,
+            b.operation_code as code
+        </if>
+        FROM
+        kl_library_info a
+        LEFT JOIN kl_concept c
+        ON a.concept_id = c.id
+        <if test="type!=null and type==100">
+            left join kl_disease b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==127">
+            left join kl_tcm_disease b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==128">
+            left join kl_tcm_syndrome b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        <if test="type!=null and type==106">
+            left join kl_operation b
+            on b.is_deleted = 'N'
+            and a.concept_id = b.concept_id
+        </if>
+        WHERE a.is_deleted = "N"
+        AND c.status = 1
+        <if test="type!=null">
+            AND a.type_id = #{type}
+        </if>
+        <if test="placeToList != null and placeToList.size > 0">
+            and a.name in
+            <foreach item="name" collection="placeToList" open="(" separator="," close=")">
+                #{name}
+            </foreach>
+        </if>
+        ) t
+    </select>
+
 </mapper>