123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.diagbot.mapper.ConceptMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.Concept">
- <id column="id" property="id" />
- <result column="is_deleted" property="isDeleted" />
- <result column="gmt_create" property="gmtCreate" />
- <result column="gmt_modified" property="gmtModified" />
- <result column="creator" property="creator" />
- <result column="modifier" property="modifier" />
- <result column="lib_id" property="libId" />
- <result column="lib_name" property="libName" />
- <result column="lib_type" property="libType" />
- </resultMap>
- <select id="getConcept" resultType="com.diagbot.dto.ConceptRes" parameterType="com.diagbot.entity.wrapper.ConceptWrapper">
- SELECT
- t1.id AS startId,
- t1.lib_name AS startName,
- t3.id AS endId,
- t3.lib_name AS endName
- FROM
- `kl_concept` t1,
- `kl_relation` t2,
- <if test="startSex != null or startAge != null">
- kl_concept_common c1,
- </if>
- <if test="endSex != null or endAge != null">
- kl_concept_common c2,
- </if>
- `kl_concept` t3
- WHERE
- t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t3.is_deleted = 'N'
- AND t1.id = t2.start_id
- AND t3.id = t2.end_id
- <if test="startId != null">
- AND t2.start_id = #{startId}
- </if>
- <if test="startName != null and startName != ''">
- AND t1.lib_name = #{startName}
- </if>
- <if test="startSex != null or startAge != null">
- AND c1.is_deleted = 'N'
- <if test="startSex != null">
- <if test="startSex == 3">
- and c1.sex_type in ('1','2','3')
- </if>
- <if test="startSex != 3">
- and c1.sex_type in ('3',#{startSex})
- </if>
- </if>
- <if test="startAge != null">
- <![CDATA[ AND c1.min_age <= #{startAge} ]]>
- <![CDATA[ AND c1.max_age >= #{startAge} ]]>
- </if>
- AND t2.start_id = c1.concept_id
- </if>
- <if test="startType != null">
- AND t1.lib_type = #{startType}
- </if>
- <if test="relationType != null">
- AND t2.relation_id = #{relationType}
- </if>
- <if test="endId != null">
- AND t2.end_id = #{endId}
- </if>
- <if test="endName != null and endName != ''">
- AND t3.lib_name = #{endName}
- </if>
- <if test="endSex != null or endAge != null">
- AND c2.is_deleted = 'N'
- <if test="endSex != null">
- <if test="endSex == 3">
- and c2.sex_type in ('1','2','3')
- </if>
- <if test="endSex != 3">
- and c2.sex_type in ('3',#{endSex})
- </if>
- </if>
- <if test="endAge != null">
- <![CDATA[ AND c2.min_age <= #{endAge} ]]>
- <![CDATA[ AND c2.max_age >= #{endAge} ]]>
- </if>
- AND t2.end_id = c2.concept_id
- </if>
- <if test="endType != null">
- AND t3.lib_type = #{endType}
- </if>
- </select>
- <select id="getConceptWithOrder" resultType="com.diagbot.dto.ConceptWithOrderRes" parameterType="com.diagbot.entity.wrapper.ConceptWrapper">
- SELECT
- t1.id AS startId,
- t1.lib_name AS startName,
- t3.id AS endId,
- t3.lib_name AS endName,
- t4.order_no AS orderNo
- FROM
- `kl_concept` t1,
- `kl_relation` t2,
- <if test="startSex != null or startAge != null">
- kl_concept_common c1,
- </if>
- <if test="endSex != null or endAge != null">
- kl_concept_common c2,
- </if>
- `kl_concept` t3,
- `kl_relation_order` t4
- WHERE
- t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t3.is_deleted = 'N'
- AND t4.is_deleted = 'N'
- AND t1.id = t2.start_id
- AND t3.id = t2.end_id
- AND t2.id = t4.t_relation_id
- <if test="startId != null">
- AND t2.start_id = #{startId}
- </if>
- <if test="startName != null and startName != ''">
- AND t1.lib_name = #{startName}
- </if>
- <if test="startSex != null or startAge != null">
- AND c1.is_deleted = 'N'
- <if test="startSex != null">
- <if test="startSex == 3">
- and c1.sex_type in ('1','2','3')
- </if>
- <if test="startSex != 3">
- and c1.sex_type in ('3',#{startSex})
- </if>
- </if>
- <if test="startAge != null">
- <![CDATA[ AND c1.min_age <= #{startAge} ]]>
- <![CDATA[ AND c1.max_age >= #{startAge} ]]>
- </if>
- AND t2.start_id = c1.concept_id
- </if>
- <if test="startNameList != null and startNameList.size() > 0">
- AND t1.lib_name in
- <foreach collection="startNameList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="startType != null">
- AND t1.lib_type = #{startType}
- </if>
- <if test="relationType != null">
- AND t2.relation_id = #{relationType}
- </if>
- <if test="endId != null">
- AND t2.end_id = #{endId}
- </if>
- <if test="endName != null and endName != ''">
- AND t3.lib_name = #{endName}
- </if>
- <if test="endSex != null or endAge != null">
- AND c2.is_deleted = 'N'
- <if test="endSex != null">
- <if test="endSex == 3">
- and c2.sex_type in ('1','2','3')
- </if>
- <if test="endSex != 3">
- and c2.sex_type in ('3',#{endSex})
- </if>
- </if>
- <if test="endAge != null">
- <![CDATA[ AND c2.min_age <= #{endAge} ]]>
- <![CDATA[ AND c2.max_age >= #{endAge} ]]>
- </if>
- AND t2.end_id = c2.concept_id
- </if>
- <if test="endNameList != null and endNameList.size() > 0">
- AND t3.lib_name in
- <foreach collection="endNameList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="endType != null">
- AND t3.lib_type = #{endType}
- </if>
- ORDER BY t4.order_no
- </select>
- <select id="retrievalConcept" 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
- 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'
- <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 (UPPER(t2.spell) = UPPER(TRIM(#{InputStr})) OR UPPER(t2.name) = UPPER(TRIM(#{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 = 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="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 (UPPER(t2.spell) LIKE CONCAT( UPPER(TRIM(#{InputStr})),'%') OR UPPER(t2.name) LIKE CONCAT( UPPER(TRIM(#{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 = 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="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 (UPPER(t2.spell) LIKE CONCAT('%',UPPER(TRIM(#{InputStr})),'%') OR UPPER(t2.name) LIKE CONCAT('%',UPPER(TRIM(#{InputStr})),'%'))
- LIMIT 100)
- <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
- 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="detailType != null">
- AND t1.lib_type = #{detailType}
- </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 (UPPER(t2.spell) = UPPER(TRIM(#{InputStr})) OR UPPER(t2.name) = UPPER(TRIM(#{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_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="detailType != null">
- AND t1.lib_type = #{detailType}
- </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 (UPPER(t2.spell) LIKE CONCAT(UPPER(TRIM(#{InputStr})),'%') OR UPPER(t2.name) LIKE CONCAT( UPPER(TRIM(#{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>
- <if test="isStatic != null and isStatic == 1">
- GROUP BY t5.id
- </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_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="detailType != null">
- AND t1.lib_type = #{detailType}
- </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 (UPPER(t2.spell) LIKE CONCAT('%',UPPER(TRIM(#{InputStr})),'%') OR UPPER(t2.name) LIKE CONCAT('%',UPPER(TRIM(#{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
- LIMIT 100
- </select>
- <select id="staticKnowledge" resultType="com.diagbot.dto.RetrievalDTO">
- SELECT
- a1.*
- FROM
- (
- -- 除化验外其他类型标签
- <if test="typesNoLis != null and typesNoLis.size() > 0">
- (
- SELECT
- b1.*, 0 uniqueId,
- NULL uniqueName
- FROM
- (
- SELECT
- t1.id conceptId,
- t1.lib_name `name`,
- (
- CASE t1.lib_type
- WHEN 18 THEN
- 10
- WHEN 10 THEN
- 20
- WHEN 1 THEN
- 25
- WHEN 16 THEN
- 50
- WHEN 25 THEN
- 60
- ELSE
- 100
- END
- ) + 1 AS orderNo,
- t2.`name` retrievalName,
- t2.is_concept showType,
- t1.lib_type libTypeId,
- CASE t6.`name`
- when '药品通用名' then '药品'
- when '辅检项目' then '辅检'
- ELSE t6.`name`
- END libTypeName
- FROM
- kl_concept t1
- LEFT JOIN kl_library_info t2 ON t1.id = t2.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 t6.is_deleted = 'N'
- AND t7.is_deleted = 'N'
- AND t1.lib_type IN
- <foreach collection="typesNoLis" item="item" open="(" close=")"
- separator=",">
- #{item}
- </foreach>
- AND (
- UPPER(t2.spell) = UPPER(TRIM(#{InputStr}))
- OR UPPER(TRIM(t2. NAME)) = UPPER((TRIM(#{InputStr})))
- )
- ) b1
- )
- UNION
- (
- SELECT
- b1.*, 0 uniqueId,
- NULL uniqueName
- FROM
- (
- SELECT
- t1.id conceptId,
- t1.lib_name `name`,
- (
- CASE t1.lib_type
- WHEN 18 THEN
- 10
- WHEN 10 THEN
- 20
- WHEN 1 THEN
- 25
- WHEN 16 THEN
- 50
- WHEN 25 THEN
- 60
- ELSE
- 100
- END
- ) + 2 AS orderNo,
- t2.`name` retrievalName,
- t2.is_concept showType,
- t1.lib_type libTypeId,
- CASE t6.`name`
- when '药品通用名' then '药品'
- when '辅检项目' then '辅检'
- ELSE t6.`name`
- END libTypeName
- FROM
- kl_concept t1
- LEFT JOIN kl_library_info t2 ON t1.id = t2.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 t6.is_deleted = 'N'
- AND t7.is_deleted = 'N'
- AND t1.lib_type IN
- <foreach collection="typesNoLis" item="item" open="(" close=")"
- separator=",">
- #{item}
- </foreach>
- AND (
- UPPER(t2.spell) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
- OR UPPER(t2. NAME) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
- )
- ) b1
- )
- UNION
- (
- SELECT
- b1.*, 0 uniqueId,
- NULL uniqueName
- FROM
- (
- SELECT
- t1.id conceptId,
- t1.lib_name `name`,
- (
- CASE t1.lib_type
- WHEN 18 THEN
- 10
- WHEN 10 THEN
- 20
- WHEN 1 THEN
- 25
- WHEN 16 THEN
- 50
- WHEN 25 THEN
- 60
- ELSE
- 100
- END
- ) + 3 AS orderNo,
- t2.`name` retrievalName,
- t2.is_concept showType,
- t1.lib_type libTypeId,
- CASE t6.`name`
- when '药品通用名' then '药品'
- when '辅检项目' then '辅检'
- ELSE t6.`name`
- END libTypeName
- FROM
- kl_concept t1
- LEFT JOIN kl_library_info t2 ON t1.id = t2.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 t6.is_deleted = 'N'
- AND t7.is_deleted = 'N'
- AND t1.lib_type IN
- <foreach collection="typesNoLis" item="item" open="(" close=")"
- separator=",">
- #{item}
- </foreach>
- AND (
- UPPER(t2.spell) LIKE CONCAT('%', UPPER(TRIM(#{InputStr})), '%')
- OR UPPER(t2. NAME) LIKE CONCAT('%',UPPER(TRIM(#{InputStr})), '%')
- )
- ) b1
- )
- </if>
- -- 化验本体标签公表项匹配静态知识
- <if test="typesNoLis != null and typesNoLis.size() > 0 and hasLis == true">
- UNION
- </if>
- <if test="hasLis == true">
- (
- SELECT
- b2.id conceptId,
- b1.selfName `name`,
- 31 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t2.`name` retrievalName,
- 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_lexicon t6 ON t6.id = t1.lib_type
- WHERE
- t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t6.is_deleted = 'N'
- AND t1.lib_type = 12
- AND (
- UPPER(t2.spell) = UPPER(TRIM(#{InputStr}))
- OR UPPER(t2. NAME) = UPPER(TRIM(#{InputStr}))
- )
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.item_id = 0
- AND m.meal_id = b1.selfId
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- )
- UNION
- (
- SELECT
- b2.id conceptId,
- b1.selfName `name`,
- 32 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t2.`name` retrievalName,
- 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_lexicon t6 ON t6.id = t1.lib_type
- WHERE
- t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t6.is_deleted = 'N'
- AND t1.lib_type = 12
- AND (
- UPPER(t2.spell) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
- OR UPPER(t2. NAME) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
- )
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.item_id = 0
- AND m.meal_id = b1.selfId
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- )
- UNION
- (
- SELECT
- b2.id conceptId,
- b1.selfName `name`,
- 33 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t2.`name` retrievalName,
- 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_lexicon t6 ON t6.id = t1.lib_type
- WHERE
- t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t6.is_deleted = 'N'
- AND t1.lib_type = 12
- AND (
- UPPER(t2.spell) LIKE CONCAT('%', UPPER(TRIM(#{InputStr})), '%')
- OR UPPER(t2. NAME) LIKE CONCAT('%',UPPER(TRIM(#{InputStr})), '%')
- )
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.item_id = 0
- AND m.meal_id = b1.selfId
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- ) -- 化验子项推父项,父项公表项匹配静态知识
- UNION
- (
- SELECT
- b2.id conceptId,
- b1.parentName `name`,
- 34 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType + 10 showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t5.id parentId,
- t5.lib_name parentName,
- t2.`name` retrievalName,
- 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
- 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 t1.lib_type = 13
- AND (
- UPPER(t2.spell) = UPPER(TRIM(#{InputStr}))
- OR UPPER(t2. NAME) = UPPER(TRIM(#{InputStr}))
- )
- AND t4.relation_id = 18
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.meal_id = b1.parentId
- AND m.item_id = 0
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- )
- UNION
- (
- SELECT
- b2.id conceptId,
- b1.parentName `name`,
- 35 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType + 10 showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t5.id parentId,
- t5.lib_name parentName,
- t2.`name` retrievalName,
- 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
- 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 t1.lib_type = 13
- AND (
- UPPER(t2.spell) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
- OR UPPER(t2. NAME) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
- )
- AND t4.relation_id = 18
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.meal_id = b1.parentId
- AND m.item_id = 0
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- )
- UNION
- (
- SELECT
- b2.id conceptId,
- b1.parentName `name`,
- 36 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType + 10 showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t5.id parentId,
- t5.lib_name parentName,
- t2.`name` retrievalName,
- 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
- 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 t1.lib_type = 13
- AND (
- UPPER(t2.spell) LIKE CONCAT('%', UPPER(TRIM(#{InputStr})), '%')
- OR UPPER(t2. NAME) LIKE CONCAT('%', UPPER(TRIM(#{InputStr})), '%')
- )
- AND t4.relation_id = 18
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.meal_id = b1.parentId
- AND m.item_id = 0
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- ) -- 化验子项推父项,父项--子项组合公表项匹配静态知识
- UNION
- (
- SELECT
- b2.id conceptId,
- CONCAT(b1.parentName,'(',b1.selfName,')') `name`,
- 41 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType + 20 showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t5.id parentId,
- t5.lib_name parentName,
- t2.`name` retrievalName,
- 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
- 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 t1.lib_type = 13
- AND (
- UPPER(t2.spell) = UPPER(TRIM(#{InputStr}))
- OR UPPER(t2. NAME) = UPPER(TRIM(#{InputStr}))
- )
- AND t4.relation_id = 18
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.meal_id = b1.parentId
- AND m.item_id = b1.selfId
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- )
- UNION
- (
- SELECT
- b2.id conceptId,
- CONCAT(b1.parentName,'(',b1.selfName,')') `name`,
- 42 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType + 20 showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t5.id parentId,
- t5.lib_name parentName,
- t2.`name` retrievalName,
- 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
- 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 t1.lib_type = 13
- AND (
- UPPER(t2.spell) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
- OR UPPER(t2. NAME) LIKE CONCAT(UPPER(TRIM(#{InputStr})), '%')
- )
- AND t4.relation_id = 18
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.meal_id = b1.parentId
- AND m.item_id = b1.selfId
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- )
- UNION
- (
- SELECT
- b2.id conceptId,
- CONCAT(b1.parentName,'(',b1.selfName,')') `name`,
- 43 AS orderNo,
- b1.retrievalName retrievalName,
- b1.showType + 20 showType,
- b1.libTypeId libTypeId,
- b1.libTypeName libTypeName,
- b2.id uniqueId,
- b2.lib_name uniqueName
- FROM
- (
- SELECT
- t1.id selfId,
- t1.lib_name selfName,
- t5.id parentId,
- t5.lib_name parentName,
- t2.`name` retrievalName,
- 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
- 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 t1.lib_type = 13
- AND (
- UPPER(t2.spell) LIKE CONCAT('%', UPPER(TRIM(#{InputStr})), '%')
- OR UPPER(t2. NAME) LIKE CONCAT('%', UPPER(TRIM(#{InputStr})), '%')
- )
- AND t4.relation_id = 18
- ) b1,
- kl_concept b2,
- kl_concept_detail b3,
- kl_lis_mapping m
- WHERE
- b2.is_deleted = 'N'
- AND b3.is_deleted = 'N'
- AND m.is_deleted = 'N'
- AND m.meal_id = b1.parentId
- AND m.item_id = b1.selfId
- AND m.unique_id = b2.id
- AND b2.lib_type = 46
- AND b2.id = b3.concept_id
- )
- </if>
- ) a1
- ORDER BY
- a1.orderNo ASC,
- a1.showType DESC,
- a1.conceptId ASC
- </select>
- <select id="getConceptConMap" resultType="com.diagbot.dto.ConceptBaseDTO" parameterType="com.diagbot.vo.ConceptFindVO">
- SELECT
- t1.id as conceptId,
- t1.lib_name as name
- FROM
- kl_concept t1,
- kl_concept_common t2
- WHERE
- t1.id = t2.concept_id
- AND t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- <if test="conceptIds != null and conceptIds.size > 0">
- and t1.id in
- <foreach item="id" collection="conceptIds" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- <if test="sexType == 3">
- AND t2.sex_type IN ('1','2','3')
- </if>
- <if test="sexType != 3">
- AND t2.sex_type IN ('3',#{sexType})
- </if>
- <if test="age != null and age != ''">
- AND <![CDATA[ t2.min_age <= #{age} ]]>
- AND <![CDATA[ t2.max_age >= #{age} ]]>
- </if>
- </select>
- <select id="getStandWord" resultType="java.lang.String">
- SELECT lib_name FROM kl_concept WHERE is_deleted = 'N' AND lib_type = 33
- </select>
- <select id="indexConcept" resultType="com.diagbot.dto.ConceptBaseDTO">
- SELECT DISTINCT b.id concept_id,b.lib_name name FROM `kl_library_info` a, kl_concept b
- where a.is_deleted = 'N' and b.is_deleted = 'N'
- and a.concept_id = b.id
- and UPPER(TRIM(a.`name`)) like concat('%',UPPER(TRIM(#{name})),'%') and a.type_id = #{libType} and b.lib_type = #{libType}
- </select>
- </mapper>
|