|
@@ -188,132 +188,70 @@
|
|
|
|
|
|
<select id="retrievalConcept" resultType="com.diagbot.dto.ConceptRetrievalDTO">
|
|
|
SELECT a1.* 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
|
|
|
+ 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 = 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_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 t4.is_deleted = 'N'
|
|
|
- AND t5.is_deleted = 'N'
|
|
|
AND t6.is_deleted = 'N'
|
|
|
<if test="type != null">
|
|
|
AND t1.lib_type = #{type}
|
|
|
</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 = #{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}
|
|
|
+ <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 t4.relation_id = 18
|
|
|
- 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_concept_common t3 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
|
|
|
- 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="type != null">
|
|
|
- AND t1.lib_type = #{type}
|
|
|
- </if>
|
|
|
<if test="sexType == 3">
|
|
|
- and t3.sex_type in ('1','2','3')
|
|
|
+ and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
|
|
|
</if>
|
|
|
<if test="sexType != 3">
|
|
|
- and t3.sex_type in ('3',#{sexType})
|
|
|
+ and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
|
|
|
</if>
|
|
|
<if test="age != null and age != ''">
|
|
|
- AND <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
- AND <![CDATA[ t3.max_age >= #{age} ]]>
|
|
|
+ AND (( <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>)
|
|
|
+ or (t3.min_age is null and t3.max_age is null))
|
|
|
</if>
|
|
|
- AND (t2.spell LIKE CONCAT( #{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
|
|
|
+ AND (t2.spell = UPPER(#{InputStr}) OR t2.name = #{InputStr})
|
|
|
+ LIMIT 100
|
|
|
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
|
|
|
+ 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 = 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_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 t4.is_deleted = 'N'
|
|
|
- AND t5.is_deleted = 'N'
|
|
|
AND t6.is_deleted = 'N'
|
|
|
<if test="type != null">
|
|
|
AND t1.lib_type = #{type}
|
|
|
</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('%',#{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}
|
|
|
+ <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 t4.relation_id = 18
|
|
|
- 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
|
|
|
- LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
- LEFT JOIN kl_concept_common t3 ON t1.id = t2.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'
|
|
|
- <if test="type != null">
|
|
|
- AND t1.lib_type = #{type}
|
|
|
- </if>
|
|
|
<if test="sexType == 3">
|
|
|
- and t3.sex_type in ('1','2','3')
|
|
|
+ and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
|
|
|
</if>
|
|
|
<if test="sexType != 3">
|
|
|
- and t3.sex_type in ('3',#{sexType})
|
|
|
+ and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
|
|
|
</if>
|
|
|
<if test="age != null and age != ''">
|
|
|
- AND <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
- AND <![CDATA[ t3.max_age >= #{age} ]]>
|
|
|
+ AND (( <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>)
|
|
|
+ or (t3.min_age is null and t3.max_age is null))
|
|
|
</if>
|
|
|
<if test="inputIds != null and inputIds.size > 0">
|
|
|
and t1.id not in
|
|
@@ -321,59 +259,36 @@
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- AND (t2.spell = #{InputStr} OR t2.name = #{InputStr})
|
|
|
+ AND (t2.spell LIKE CONCAT( UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT( #{InputStr},'%'))
|
|
|
+ LIMIT 100
|
|
|
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
|
|
|
LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
- LEFT JOIN kl_concept_common t3 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'
|
|
|
<if test="type != null">
|
|
|
AND t1.lib_type = #{type}
|
|
|
</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}
|
|
|
+ <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( #{InputStr},'%') OR t2.name LIKE CONCAT( #{InputStr},'%'))
|
|
|
- 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
|
|
|
- LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
- LEFT JOIN kl_concept_common t3 ON t1.id = t2.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'
|
|
|
- <if test="type != null">
|
|
|
- AND t1.lib_type = #{type}
|
|
|
- </if>
|
|
|
<if test="sexType == 3">
|
|
|
- and t3.sex_type in ('1','2','3')
|
|
|
+ and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
|
|
|
</if>
|
|
|
<if test="sexType != 3">
|
|
|
- and t3.sex_type in ('3',#{sexType})
|
|
|
+ and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
|
|
|
</if>
|
|
|
<if test="age != null and age != ''">
|
|
|
- AND <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
- AND <![CDATA[ t3.max_age >= #{age} ]]>
|
|
|
+ AND (( <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>)
|
|
|
+ or (t3.min_age is null and t3.max_age is null))
|
|
|
</if>
|
|
|
<if test="inputIds != null and inputIds.size > 0">
|
|
|
and t1.id not in
|
|
@@ -381,8 +296,122 @@
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- AND (t2.spell LIKE CONCAT('%',#{InputStr},'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
|
|
|
+ AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
|
|
|
+ LIMIT 100
|
|
|
+ <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,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_concept_common t3 ON t1.id = t3.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
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = 'N'
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t4.is_deleted = 'N'
|
|
|
+ AND t5.is_deleted = 'N'
|
|
|
+ AND t6.is_deleted = 'N'
|
|
|
+ AND t2.is_concept = 1
|
|
|
+ <if test="detilType != null">
|
|
|
+ AND t1.lib_type = #{detilType}
|
|
|
+ </if>
|
|
|
+ <if test="sexType == 3">
|
|
|
+ and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
|
|
|
+ </if>
|
|
|
+ <if test="sexType != 3">
|
|
|
+ and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
|
|
|
+ </if>
|
|
|
+ <if test="age != null and age != ''">
|
|
|
+ AND (( <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>)
|
|
|
+ or (t3.min_age is null and t3.max_age is null))
|
|
|
+ </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
|
|
|
+ LIMIT 100
|
|
|
+ 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
|
|
|
+ LEFT JOIN kl_concept_common t3 ON t1.id = t3.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
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = 'N'
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t4.is_deleted = 'N'
|
|
|
+ AND t5.is_deleted = 'N'
|
|
|
+ AND t6.is_deleted = 'N'
|
|
|
+ AND t2.is_concept = 1
|
|
|
+ <if test="detilType != null">
|
|
|
+ AND t1.lib_type = #{detilType}
|
|
|
+ </if>
|
|
|
+ <if test="sexType == 3">
|
|
|
+ and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
|
|
|
+ </if>
|
|
|
+ <if test="sexType != 3">
|
|
|
+ and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
|
|
|
+ </if>
|
|
|
+ <if test="age != null and age != ''">
|
|
|
+ AND (( <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>)
|
|
|
+ or (t3.min_age is null and t3.max_age is null))
|
|
|
+ </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
|
|
|
+ LIMIT 100
|
|
|
+ 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
|
|
|
+ LEFT JOIN kl_concept_common t3 ON t1.id = t3.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
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = 'N'
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t4.is_deleted = 'N'
|
|
|
+ AND t5.is_deleted = 'N'
|
|
|
+ AND t6.is_deleted = 'N'
|
|
|
+ AND t2.is_concept = 1
|
|
|
+ <if test="detilType != null">
|
|
|
+ AND t1.lib_type = #{detilType}
|
|
|
+ </if>
|
|
|
+ <if test="sexType == 3">
|
|
|
+ and (t3.sex_type in ('1','2','3') or t3.sex_type is null)
|
|
|
+ </if>
|
|
|
+ <if test="sexType != 3">
|
|
|
+ and (t3.sex_type in ('3',#{sexType}) or t3.sex_type is null)
|
|
|
+ </if>
|
|
|
+ <if test="age != null and age != ''">
|
|
|
+ AND (( <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>)
|
|
|
+ or (t3.min_age is null and t3.max_age is null))
|
|
|
+ </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
|
|
|
+ LIMIT 100
|
|
|
+ </if>
|
|
|
) a1
|
|
|
- GROUP BY a1.selfId,a1.showType
|
|
|
+ LIMIT 100
|
|
|
</select>
|
|
|
</mapper>
|