瀏覽代碼

静态知识检索修改

wangyu 6 年之前
父節點
當前提交
9c279d858d

+ 2 - 0
aipt-service/src/main/java/com/diagbot/dto/ConceptRetrievalDTO.java

@@ -20,4 +20,6 @@ public class ConceptRetrievalDTO {
     private Long libTypeId;//标签类型id
     private String libTypeName;//标签类型名称
     private Integer type;//questionType
+    private Long uniqueId;//公表id
+    private String uniqueName;//公表名称
 }

+ 44 - 73
aipt-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -14,7 +14,6 @@ import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.ConceptServiceImpl;
-import com.diagbot.util.ArrayUtil;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.IntegerUtil;
 import com.diagbot.util.ListUtil;
@@ -25,7 +24,6 @@ import com.diagbot.vo.ConceptExistVO;
 import com.diagbot.vo.ConceptFindVO;
 import com.diagbot.vo.ConceptSearchVO;
 import com.diagbot.vo.ConceptUsualVO;
-import com.diagbot.vo.ExistListByConceptIdsVO;
 import com.diagbot.vo.GetStaticKnowledgeVO;
 import com.diagbot.vo.RetrievalVO;
 import com.google.common.collect.Lists;
@@ -266,7 +264,7 @@ public class ConceptFacade extends ConceptServiceImpl {
         Boolean bla = true;
         if (null != retrievalVO.getType()) {
             if (retrievalVO.getType().intValue() == ConceptTypeEnum.Lis.getKey()) {//如果是化验,添加化验子项类型
-                retrievalVO.setDetilType(LexiconTypeEnum.LIS_DETAILS.getKey());
+                retrievalVO.setDetailType(LexiconTypeEnum.LIS_DETAILS.getKey());
                 bla = true;
             } else if (retrievalVO.getType().intValue() == ConceptTypeEnum.Past.getKey()
                     || retrievalVO.getType().intValue() == ConceptTypeEnum.Other.getKey()) {//如果是其他史设置其他史类型
@@ -302,31 +300,53 @@ public class ConceptFacade extends ConceptServiceImpl {
         List<Long> selfList = new ArrayList<>(); // 本体
         List<Long> subList = new ArrayList<>(); // 子项
         List<String> conceptNameList = new ArrayList<>();//名称结果集保证数据唯一
+        List<Long> uniqueIdList = new ArrayList<>();
         for (ConceptRetrievalDTO bean : conceptRetrievalDTOS) {
             if (StringUtil.isNotEmpty(bean.getParentName())) { // 重置showType
                 bean.setShowType(2L);
             }
             if (bean.getShowType().intValue() == 1) { // 本体
                 selfList.add(bean.getSelfId());
-            } else if (bean.getShowType().intValue() == 2 && retrievalVO.getIsSonShow().intValue() == 0) { // 子项
+            } else if (bean.getShowType().intValue() == 2) { // 子项
                 subList.add(bean.getSelfId());
             }
         }
         // 有本体,过滤同义词和子项;无本体,有子项,过滤同义词
         for (ConceptRetrievalDTO bean : conceptRetrievalDTOS) {
             if (bean.getShowType().intValue() == 1) {
-                res.add(bean);
-            } else if (bean.getShowType().intValue() == 2) {
-                if (!selfList.contains(bean.getParentId()) && !conceptNameList.contains(bean.getParentName()) && retrievalVO.getIsSonShow().intValue() == 0) {
-                    conceptNameList.add(bean.getParentName());
-                    res.add(bean);
-                } else {
+                if(retrievalVO.getIsSonShow().intValue() == 0){//isSonShow为0执行检索去重逻辑
                     res.add(bean);
+                }else {//sSonShow不为0执行静态知识检索去重逻辑
+                    if(bean.getUniqueId() != null && bean.getUniqueId() != 0 && !uniqueIdList.contains(bean.getUniqueId())){
+                        res.add(bean);
+                        uniqueIdList.add(bean.getUniqueId());
+                    }else {
+                        res.add(bean);
+                    }
+                }
+            } else if (bean.getShowType().intValue() == 2) {
+                if(retrievalVO.getIsSonShow().intValue() == 0){//isSonShow为0执行检索去重逻辑
+                    if (!selfList.contains(bean.getParentId()) && !conceptNameList.contains(bean.getParentName()) ) {
+                        conceptNameList.add(bean.getParentName());
+                        res.add(bean);
+                    }
+                } else {//sSonShow不为0执行静态知识检索去重逻辑
+                    if(bean.getUniqueId() != null && bean.getUniqueId() != 0 && !uniqueIdList.contains(bean.getUniqueId())){
+                        res.add(bean);
+                        uniqueIdList.add(bean.getUniqueId());
+                    }
                 }
             } else if (bean.getShowType().intValue() == 0) {
-                if (!selfList.contains(bean.getSelfId()) && !subList.contains(bean.getSelfId()) && !conceptNameList.contains(bean.getSelfName())) {
-                    conceptNameList.add(bean.getSelfName());
-                    res.add(bean);
+                if(retrievalVO.getIsSonShow().intValue() == 0){//isSonShow为0执行检索去重逻辑
+                    if (!selfList.contains(bean.getSelfId()) && !subList.contains(bean.getSelfId()) && !conceptNameList.contains(bean.getSelfName())) {
+                        conceptNameList.add(bean.getSelfName());
+                        res.add(bean);
+                    }
+                }else {//sSonShow不为0执行静态知识检索去重逻辑
+                    if(bean.getUniqueId() != null && bean.getUniqueId() != 0 && !uniqueIdList.contains(bean.getUniqueId())){
+                        res.add(bean);
+                        uniqueIdList.add(bean.getUniqueId());
+                    }
                 }
             }
         }
@@ -356,39 +376,28 @@ public class ConceptFacade extends ConceptServiceImpl {
         retrievalVO.setIsStatic(1);
         List<Integer> types = new ArrayList<>();
         for (Integer type : getStaticKnowledgeVO.getTypes()) {
-            types.add(ParamConvertUtil.conceptConvert2Lib(type));
+            if(type.intValue() == ConceptTypeEnum.Lis.getKey()){//单独设置化验类型
+                retrievalVO.setType(type);
+            }else {//查询时去掉化验
+                types.add(ParamConvertUtil.conceptConvert2Lib(type));
+            }
         }
-        types.add(LexiconTypeEnum.LIS_DETAILS.getKey());//加入化验类型
-        //设置类型为诊断、药品、化验、辅检
+        //设置类型为诊断、药品、辅检
         retrievalVO.setOtherType(types);
-        //如果为化验时设置子项类型
-        retrievalVO.setDetilType(LexiconTypeEnum.LIS_DETAILS.getKey());
         //获取标签信息
         List<ConceptRetrievalDTO> conceptRetrievalDTOList = this.retrivelConceptInfo(retrievalVO);
         List<RetrievalDTO> staticRetrievalList = new ArrayList<>();
-        List<String> uniqueNameList = new ArrayList<>();
         if (ListUtil.isNotEmpty(conceptRetrievalDTOList)) {
             //封装
             for (ConceptRetrievalDTO conceptRetrievalDTO : conceptRetrievalDTOList) {
                 retrievalDTO = new RetrievalDTO();
                 retrievalDTO.setConceptId(conceptRetrievalDTO.getSelfId());
                 retrievalDTO.setName(conceptRetrievalDTO.getSelfName());
-                if (StringUtil.isEmpty(conceptRetrievalDTO.getParentName()) && conceptRetrievalDTO.getLibTypeId().intValue() == LexiconTypeEnum.LIS_PACKAGE.getKey()) {
-                    retrievalDTO.setUniqueName(conceptRetrievalDTO.getSelfName());
-                    uniqueNameList.add(conceptRetrievalDTO.getSelfName());
-                }
+                retrievalDTO.setUniqueName(conceptRetrievalDTO.getUniqueName());
                 if (StringUtil.isNotEmpty(conceptRetrievalDTO.getParentName())) {//parent不为空时说明有子项,返回父级id
                     retrievalDTO.setConceptId(conceptRetrievalDTO.getParentId());
                     retrievalDTO.setName(conceptRetrievalDTO.getParentName());
                     retrievalDTO.setRetrievalName(conceptRetrievalDTO.getSelfName());
-                    if (StringUtil.isNotEmpty(conceptRetrievalDTO.getSelfName())) {//如果selfName不为空是:大项(小项)组合
-                        retrievalDTO.setUniqueName(conceptRetrievalDTO.getParentName() + "--" + conceptRetrievalDTO.getSelfName());
-                        uniqueNameList.add(conceptRetrievalDTO.getParentName() + "--" + conceptRetrievalDTO.getSelfName());
-                    } else {//如果selfName为空是:子项推出大项
-                        retrievalDTO.setUniqueName(conceptRetrievalDTO.getParentName());
-                        uniqueNameList.add(conceptRetrievalDTO.getParentName());
-                    }
-
                 }
                 if (StringUtil.isNotEmpty(conceptRetrievalDTO.getSameName())) {//同义词
                     retrievalDTO.setRetrievalName(conceptRetrievalDTO.getSameName());
@@ -400,48 +409,10 @@ public class ConceptFacade extends ConceptServiceImpl {
                 retrievalDTOS.add(retrievalDTO);
             }
         }
-        List<Concept> conceptDetilList = new ArrayList<>();//化验公表项
-        if (ListUtil.isNotEmpty(uniqueNameList)) {//如果有化验公表项,获取化验公表项id
-            QueryWrapper<Concept> conceptQueryWrapper = new QueryWrapper<>();
-            conceptQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("lib_type", LexiconTypeEnum.LIS_TABLES.getKey())
-                    .in("lib_name", uniqueNameList);
-            conceptDetilList = this.list(conceptQueryWrapper);
-        }
-
-        //判断是否存在静态知识
-        List<Long> cenceptIdList = retrievalDTOS.stream().map(RetrievalDTO::getConceptId).collect(Collectors.toList());
-        for (RetrievalDTO retrievalDTO1 : retrievalDTOS) {
-            for (Concept concept : conceptDetilList) {
-                if (StringUtil.isNotEmpty(retrievalDTO1.getUniqueName()) && retrievalDTO1.getUniqueName().equals(concept.getLibName())) {//添加公表项id
-                    retrievalDTO1.setUniqueId(concept.getId());
-                    cenceptIdList.add(concept.getId());
-                }
-            }
-        }
-        ExistListByConceptIdsVO existListByConceptIdsVO = new ExistListByConceptIdsVO();
-        existListByConceptIdsVO.setConceptIds(cenceptIdList);
-        List<Long> existConceptIdList = conceptDetailFacade.existListByConceptIds(existListByConceptIdsVO);
-        if (ListUtil.isNotEmpty(existConceptIdList)) {
-            for (RetrievalDTO retrievalDTOInfo : retrievalDTOS) {
-                if (StringUtil.isNotEmpty(retrievalDTOInfo.getUniqueName())) {
-                    for (Long concept : existConceptIdList) {
-                        if (null != retrievalDTOInfo.getUniqueId() && retrievalDTOInfo.getUniqueId().intValue() == concept.intValue()) {//如果是化验时返回化验公表项
-                            retrievalDTO = new RetrievalDTO();
-                            BeanUtil.copyProperties(retrievalDTOInfo, retrievalDTO);
-                            staticRetrievalList.add(retrievalDTO);
-                        }
-                    }
-                } else {
-                    for (Long concept : existConceptIdList) {
-                        if (retrievalDTOInfo.getConceptId().intValue() == concept.intValue()) {
-                            retrievalDTO = new RetrievalDTO();
-                            BeanUtil.copyProperties(retrievalDTOInfo, retrievalDTO);
-                            staticRetrievalList.add(retrievalDTO);
-                        }
-                    }
-                }
-            }
+        for (RetrievalDTO retrievalDTOInfo : retrievalDTOS) {
+            retrievalDTO = new RetrievalDTO();
+            BeanUtil.copyProperties(retrievalDTOInfo, retrievalDTO);
+            staticRetrievalList.add(retrievalDTO);
         }
         return staticRetrievalList;
     }

+ 1 - 1
aipt-service/src/main/java/com/diagbot/vo/RetrievalVO.java

@@ -22,7 +22,7 @@ public class RetrievalVO {
     //需要去重的id
     private List<Long> inputIds;
     //获取子项时需要用到的type类型
-    private Integer detilType;
+    private Integer detailType;
     //类型为其他史时用到的type类型
     private List<Integer> otherType;
     //是否是静态搜索

+ 259 - 307
aipt-service/src/main/resources/mapper/ConceptMapper.xml

@@ -298,7 +298,7 @@
         </if>
         AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
         LIMIT 100)
-        <if test="detilType != null and detilType != ''">
+        <if test="detailType != null and detailType != ''">
             UNION
             (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
             LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
@@ -313,8 +313,8 @@
             AND t4.is_deleted = 'N'
             AND t5.is_deleted = 'N'
             AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
+            <if test="detailType != null">
+                AND t1.lib_type = #{detailType}
             </if>
             <if test="sexType == 3">
                 and t3.sex_type in ('1','2','3')
@@ -349,8 +349,8 @@
             AND t4.is_deleted = 'N'
             AND t5.is_deleted = 'N'
             AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
+            <if test="detailType != null">
+                AND t1.lib_type = #{detailType}
             </if>
             <if test="sexType == 3">
                 and t3.sex_type in ('1','2','3')
@@ -388,8 +388,8 @@
             AND t4.is_deleted = 'N'
             AND t5.is_deleted = 'N'
             AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
+            <if test="detailType != null">
+                AND t1.lib_type = #{detailType}
             </if>
             <if test="sexType == 3">
                 and t3.sex_type in ('1','2','3')
@@ -416,82 +416,74 @@
     </select>
 
     <select id="staticKnowledge" resultType="com.diagbot.dto.ConceptRetrievalDTO">
-        SELECT a1.* from (
-        (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+        -- 除化验外其他类型标签
+        (SELECT b1.*,0 uniqueId,null uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
         LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
         LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
         LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+        LEFT JOIN kl_concept_detail t7 ON t7.concept_id = t1.id
         WHERE
         t1.is_deleted = 'N'
         AND t2.is_deleted = 'N'
         AND t3.is_deleted = 'N'
         AND t6.is_deleted = 'N'
-        <if test="type != null">
-            AND t1.lib_type = #{type}
-        </if>
+        AND t7.is_deleted = 'N'
         <if test="otherType != null and otherType.size > 0">
-            and t1.lib_type in
+            AND t1.lib_type in
             <foreach item="type" collection="otherType" open="(" separator="," close=")">
                 #{type}
             </foreach>
         </if>
-        <if test="sexType == 3">
-            and t3.sex_type in ('1','2','3')
-        </if>
-        <if test="sexType != 3">
-            and t3.sex_type in ('3',#{sexType})
-        </if>
-        <if test="age != null and age != ''">
-            AND <![CDATA[ t3.min_age <= #{age} ]]>
-            AND <![CDATA[ t3.max_age >= #{age} ]]>
-        </if>
-        <if test="inputIds != null and inputIds.size > 0">
-            and t1.id not in
-            <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                #{id}
-            </foreach>
-        </if>
-        AND (t2.spell =  UPPER(#{InputStr}) OR t2.name =  #{InputStr})
-        GROUP BY t1.id
+        AND (t2.spell = UPPER(#{InputStr}) OR t2.name = (#{InputStr}))
+        GROUP BY t1.id) b1)
         UNION
-        (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+        (SELECT b1.*,0 uniqueId,null uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
         LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
         LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
         LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+        LEFT JOIN kl_concept_detail t7 ON t7.concept_id = t1.id
         WHERE
         t1.is_deleted = 'N'
         AND t2.is_deleted = 'N'
         AND t3.is_deleted = 'N'
         AND t6.is_deleted = 'N'
-        <if test="type != null">
-            AND t1.lib_type = #{type}
-        </if>
+        AND t7.is_deleted = 'N'
         <if test="otherType != null and otherType.size > 0">
-            and t1.lib_type in
+            AND t1.lib_type in
             <foreach item="type" collection="otherType" open="(" separator="," close=")">
                 #{type}
             </foreach>
         </if>
-        <if test="sexType == 3">
-            and t3.sex_type in ('1','2','3')
-        </if>
-        <if test="sexType != 3">
-            and t3.sex_type in ('3',#{sexType})
-        </if>
-        <if test="age != null and age != ''">
-            AND <![CDATA[ t3.min_age <= #{age} ]]>
-            AND <![CDATA[ t3.max_age >= #{age} ]]>
-        </if>
-        <if test="inputIds != null and inputIds.size > 0">
-            and t1.id not in
-            <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                #{id}
-            </foreach>
-        </if>
-        AND (t2.spell LIKE CONCAT( UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT( #{InputStr},'%'))
-        GROUP BY t1.id
+        AND (t2.spell LIKE CONCAT(UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT((#{InputStr}),'%'))
+        GROUP BY t1.id) b1)
         UNION
-        (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+        (SELECT b1.*,0 uniqueId,null uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+                LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+                LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
+                LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+                LEFT JOIN kl_concept_detail t7 ON t7.concept_id = t1.id
+                WHERE
+                t1.is_deleted = 'N'
+                AND t2.is_deleted = 'N'
+                AND t3.is_deleted = 'N'
+                AND t6.is_deleted = 'N'
+                AND t7.is_deleted = 'N'
+                <if test="otherType != null and otherType.size > 0">
+                    AND t1.lib_type in
+                    <foreach item="type" collection="otherType" open="(" separator="," close=")">
+                        #{type}
+                    </foreach>
+                </if>
+                AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',(#{InputStr}),'%'))
+                GROUP BY t1.id) b1)
+
+        -- 化验本体标签公表项匹配静态知识
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
         LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
         LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
         LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
@@ -500,258 +492,218 @@
         AND t2.is_deleted = 'N'
         AND t3.is_deleted = 'N'
         AND t6.is_deleted = 'N'
-        <if test="type != null">
-            AND t1.lib_type = #{type}
-        </if>
-        <if test="otherType != null and otherType.size > 0">
-            and t1.lib_type in
-            <foreach item="type" collection="otherType" open="(" separator="," close=")">
-                #{type}
-            </foreach>
-        </if>
-        <if test="sexType == 3">
-            and t3.sex_type in ('1','2','3')
-        </if>
-        <if test="sexType != 3">
-            and t3.sex_type in ('3',#{sexType})
-        </if>
-        <if test="age != null and age != ''">
-            AND <![CDATA[ t3.min_age <= #{age} ]]>
-            AND <![CDATA[ t3.max_age >= #{age} ]]>
-        </if>
-        <if test="inputIds != null and inputIds.size > 0">
-            and t1.id not in
-            <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                #{id}
-            </foreach>
-        </if>
-        AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
-        GROUP BY t1.id
-        <if test="detilType != null and detilType != ''">
-            UNION
-            (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType
-            ,t1.lib_type libTypeId
-            ,t6.`name` libTypeName FROM kl_concept t1
-            LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
-            LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
-            LEFT JOIN kl_concept t5 on t5.id = t4.start_id
-            LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
-            LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
-            WHERE
-            t1.is_deleted = 'N'
-            AND t2.is_deleted = 'N'
-            AND t3.is_deleted = 'N'
-            AND t4.is_deleted = 'N'
-            AND t5.is_deleted = 'N'
-            AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
-            </if>
-            <if test="sexType == 3">
-                and t3.sex_type in ('1','2','3')
-            </if>
-            <if test="sexType != 3">
-                and t3.sex_type in ('3',#{sexType})
-            </if>
-            <if test="age != null and age != ''">
-                AND <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>
-            </if>
-            AND (t2.spell =  UPPER(#{InputStr}) OR t2.name =  #{InputStr})
-            <if test="inputIds != null and inputIds.size > 0">
-                and t1.id not in
-                <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                    #{id}
-                </foreach>
-            </if>
-            AND t4.relation_id = 18
-            GROUP BY t5.id
-            UNION
-            (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType
-            ,t1.lib_type libTypeId
-            ,t6.`name` libTypeName FROM kl_concept t1
-            LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
-            LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
-            LEFT JOIN kl_concept t5 on t5.id = t4.start_id
-            LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
-            LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
-            WHERE
-            t1.is_deleted = 'N'
-            AND t2.is_deleted = 'N'
-            AND t3.is_deleted = 'N'
-            AND t4.is_deleted = 'N'
-            AND t5.is_deleted = 'N'
-            AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
-            </if>
-            <if test="sexType == 3">
-                and t3.sex_type in ('1','2','3')
-            </if>
-            <if test="sexType != 3">
-                and t3.sex_type in ('3',#{sexType})
-            </if>
-            <if test="age != null and age != ''">
-                AND <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>
-            </if>
-            AND (t2.spell LIKE CONCAT(UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT( #{InputStr},'%'))
-            <if test="inputIds != null and inputIds.size > 0">
-                and t1.id not in
-                <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                    #{id}
-                </foreach>
-            </if>
-            AND t4.relation_id = 18
-            GROUP BY t5.id
-            UNION
-            (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType
-            ,t1.lib_type libTypeId
-            ,t6.`name` libTypeName FROM kl_concept t1
-            LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
-            LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
-            LEFT JOIN kl_concept t5 on t5.id = t4.start_id
-            LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
-            LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
-            WHERE
-            t1.is_deleted = 'N'
-            AND t2.is_deleted = 'N'
-            AND t3.is_deleted = 'N'
-            AND t4.is_deleted = 'N'
-            AND t5.is_deleted = 'N'
-            AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
-            </if>
-            <if test="sexType == 3">
-                and t3.sex_type in ('1','2','3')
-            </if>
-            <if test="sexType != 3">
-                and t3.sex_type in ('3',#{sexType})
-            </if>
-            <if test="age != null and age != ''">
-                AND <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>
-            </if>
-            AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
-            <if test="inputIds != null and inputIds.size > 0">
-                and t1.id not in
-                <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                    #{id}
-                </foreach>
-            </if>
-            AND t4.relation_id = 18
-            GROUP BY t5.id
-        </if>
-            UNION
-            (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
-            LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
-            LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
-            LEFT JOIN kl_concept t5 on t5.id = t4.start_id
-            LEFT JOIN kl_lexicon t6 ON t6.id = t5.lib_type
-            LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
-            WHERE
-            t1.is_deleted = 'N'
-            AND t2.is_deleted = 'N'
-            AND t3.is_deleted = 'N'
-            AND t4.is_deleted = 'N'
-            AND t5.is_deleted = 'N'
-            AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
-            </if>
-            <if test="sexType == 3">
-                and t3.sex_type in ('1','2','3')
-            </if>
-            <if test="sexType != 3">
-                and t3.sex_type in ('3',#{sexType})
-            </if>
-            <if test="age != null and age != ''">
-                AND <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>
-            </if>
-            AND (t2.spell =  UPPER(#{InputStr}) OR t2.name =  #{InputStr})
-            <if test="inputIds != null and inputIds.size > 0">
-                and t1.id not in
-                <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                    #{id}
-                </foreach>
-            </if>
-            AND t4.relation_id = 18
-            GROUP BY t5.id
-            UNION
-            (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
-            LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
-            LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
-            LEFT JOIN kl_concept t5 on t5.id = t4.start_id
-            LEFT JOIN kl_lexicon t6 ON t6.id = t5.lib_type
-            LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
-            WHERE
-            t1.is_deleted = 'N'
-            AND t2.is_deleted = 'N'
-            AND t3.is_deleted = 'N'
-            AND t4.is_deleted = 'N'
-            AND t5.is_deleted = 'N'
-            AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
-            </if>
-            <if test="sexType == 3">
-                and t3.sex_type in ('1','2','3')
-            </if>
-            <if test="sexType != 3">
-                and t3.sex_type in ('3',#{sexType})
-            </if>
-            <if test="age != null and age != ''">
-                AND <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>
-            </if>
-            AND (t2.spell LIKE CONCAT(UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT( #{InputStr},'%'))
-            <if test="inputIds != null and inputIds.size > 0">
-                and t1.id not in
-                <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                    #{id}
-                </foreach>
-            </if>
-            AND t4.relation_id = 18
-            GROUP BY t5.id
-            UNION
-            (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
-            LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
-            LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
-            LEFT JOIN kl_concept t5 on t5.id = t4.start_id
-            LEFT JOIN kl_lexicon t6 ON t6.id = t5.lib_type
-            LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
-            WHERE
-            t1.is_deleted = 'N'
-            AND t2.is_deleted = 'N'
-            AND t3.is_deleted = 'N'
-            AND t4.is_deleted = 'N'
-            AND t5.is_deleted = 'N'
-            AND t6.is_deleted = 'N'
-            <if test="detilType != null">
-                AND t1.lib_type = #{detilType}
-            </if>
-            <if test="sexType == 3">
-                and t3.sex_type in ('1','2','3')
-            </if>
-            <if test="sexType != 3">
-                and t3.sex_type in ('3',#{sexType})
-            </if>
-            <if test="age != null and age != ''">
-                AND <![CDATA[ t3.min_age <= #{age} ]]>
-                AND <![CDATA[ t3.max_age >= #{age} ]]>
-            </if>
-            AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
-            <if test="inputIds != null and inputIds.size > 0">
-                and t1.id not in
-                <foreach item="id" collection="inputIds" open="(" separator="," close=")">
-                    #{id}
-                </foreach>
-            </if>
-            AND t4.relation_id = 18
-            GROUP BY t5.id
-        ) a1
+        AND t1.lib_type = #{type}
+        AND (t2.spell = UPPER(#{InputStr}) OR t2.name = (#{InputStr}))
+        GROUP BY t1.id) b1,
+        kl_concept b2,
+        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and b1.selfName = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+        LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+        LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
+        LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+        WHERE
+        t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
+        AND t6.is_deleted = 'N'
+        AND t1.lib_type = #{type}
+        AND (t2.spell LIKE CONCAT(UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT((#{InputStr}),'%'))
+        GROUP BY t1.id) b1,
+        kl_concept b2,
+        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and b1.selfName = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,0 parentId,null parentName,t2.`name` sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+                LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+                LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
+                LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+                WHERE
+                t1.is_deleted = 'N'
+                AND t2.is_deleted = 'N'
+                AND t3.is_deleted = 'N'
+                AND t6.is_deleted = 'N'
+                AND t1.lib_type = #{type}
+                AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',(#{InputStr}),'%'))
+                GROUP BY t1.id) b1,
+                        kl_concept b2,
+                        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and b1.selfName = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
+
+        -- 化验子项推父项,父项公表项匹配静态知识
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+        LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+        LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
+        LEFT JOIN kl_concept t5 on t5.id = t4.start_id
+        LEFT JOIN kl_lexicon t6 ON t6.id = t5.lib_type
+        LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
+        WHERE
+        t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
+        AND t4.is_deleted = 'N'
+        AND t5.is_deleted = 'N'
+        AND t6.is_deleted = 'N'
+        AND t1.lib_type = #{detailType}
+        AND (t2.spell = UPPER(#{InputStr}) OR t2.name = #{InputStr})
+        AND t4.relation_id = 18
+        GROUP BY t5.id) b1,
+        kl_concept b2,
+        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and b1.parentName = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+        LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+        LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
+        LEFT JOIN kl_concept t5 on t5.id = t4.start_id
+        LEFT JOIN kl_lexicon t6 ON t6.id = t5.lib_type
+        LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
+        WHERE
+        t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
+        AND t4.is_deleted = 'N'
+        AND t5.is_deleted = 'N'
+        AND t6.is_deleted = 'N'
+        AND t1.lib_type = #{detailType}
+        AND (t2.spell LIKE CONCAT(UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT(#{InputStr},'%'))
+        AND t4.relation_id = 18
+        GROUP BY t5.id) b1,
+        kl_concept b2,
+        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and b1.parentName = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+                    LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+                    LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
+                    LEFT JOIN kl_concept t5 on t5.id = t4.start_id
+                    LEFT JOIN kl_lexicon t6 ON t6.id = t5.lib_type
+                    LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
+                    WHERE
+                    t1.is_deleted = 'N'
+                    AND t2.is_deleted = 'N'
+                    AND t3.is_deleted = 'N'
+                    AND t4.is_deleted = 'N'
+                    AND t5.is_deleted = 'N'
+                    AND t6.is_deleted = 'N'
+                    AND t1.lib_type = #{detailType}
+                    AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
+                    AND t4.relation_id = 18
+                    GROUP BY t5.id) b1,
+                        kl_concept b2,
+                        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and b1.parentName = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
+
+        -- 化验子项推父项,父项--子项组合公表项匹配静态知识
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+        LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+        LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
+        LEFT JOIN kl_concept t5 on t5.id = t4.start_id
+        LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+        LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
+        WHERE
+        t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
+        AND t4.is_deleted = 'N'
+        AND t5.is_deleted = 'N'
+        AND t6.is_deleted = 'N'
+        AND t1.lib_type = #{detailType}
+        AND (t2.spell = UPPER(#{InputStr}) OR t2.name = #{InputStr})
+        AND t4.relation_id = 18
+        GROUP BY t5.id) b1,
+        kl_concept b2,
+        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and CONCAT(b1.parentName,'--',b1.selfName) = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+        LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+        LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
+        LEFT JOIN kl_concept t5 on t5.id = t4.start_id
+        LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+        LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
+        WHERE
+        t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
+        AND t4.is_deleted = 'N'
+        AND t5.is_deleted = 'N'
+        AND t6.is_deleted = 'N'
+        AND t1.lib_type = #{detailType}
+        AND (t2.spell LIKE CONCAT(UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT(#{InputStr},'%'))
+        AND t4.relation_id = 18
+        GROUP BY t5.id) b1,
+        kl_concept b2,
+        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and CONCAT(b1.parentName,'--',b1.selfName) = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
+        UNION
+        (SELECT b1.*,b2.id uniqueId,b2.lib_name uniqueName
+        FROM (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t1.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
+                    LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
+                    LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
+                    LEFT JOIN kl_concept t5 on t5.id = t4.start_id
+                    LEFT JOIN kl_lexicon t6 ON t6.id = t1.lib_type
+                    LEFT JOIN kl_concept_common t3 ON t1.id = t3.concept_id
+                    WHERE
+                    t1.is_deleted = 'N'
+                    AND t2.is_deleted = 'N'
+                    AND t3.is_deleted = 'N'
+                    AND t4.is_deleted = 'N'
+                    AND t5.is_deleted = 'N'
+                    AND t6.is_deleted = 'N'
+                    AND t1.lib_type = #{detailType}
+                    AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
+                    AND t4.relation_id = 18
+                    GROUP BY t5.id) b1,
+                        kl_concept b2,
+                        kl_concept_detail b3
+        WHERE b2.is_deleted = 'N'
+        and b3.is_deleted = 'N'
+        and CONCAT(b1.parentName,'--',b1.selfName) = b2.lib_name
+        and b2.lib_type = 46
+        and b2.id = b3.concept_id)
     </select>
 
     <select id="getConceptConMap" resultType="com.diagbot.dto.ConceptBaseDTO" parameterType="com.diagbot.vo.ConceptFindVO">