|
@@ -20,10 +20,10 @@
|
|
|
SELECT DISTINCT
|
|
|
t.id as id,
|
|
|
t.lib_name as name
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
,t.icd10Code as icd10Code
|
|
|
</if>
|
|
|
- <if test="typeId!=null and typeId=108">
|
|
|
+ <if test="typeId!=null and typeId==108">
|
|
|
,
|
|
|
t1.max_value as `maxValue`,
|
|
|
t1.min_value as minValue,
|
|
@@ -37,13 +37,13 @@
|
|
|
SELECT DISTINCT
|
|
|
b.id,
|
|
|
b.lib_name
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
,c.icd10_code as icd10Code
|
|
|
</if>
|
|
|
FROM
|
|
|
kl_library_info a,
|
|
|
kl_concept b
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
left join kl_disease c
|
|
|
on c.is_deleted = 'N'
|
|
|
and b.id = c.concept_id
|
|
@@ -55,7 +55,7 @@
|
|
|
AND a.id = b.lib_id
|
|
|
<if test="inputStr!=null and inputStr!=''">
|
|
|
AND ( a.`name` = #{inputStr} OR LOWER(a.spell) = LOWER(#{inputStr})
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
OR LOWER(c.icd10_code) = LOWER(#{inputStr})
|
|
|
</if>
|
|
|
)
|
|
@@ -69,13 +69,13 @@
|
|
|
SELECT DISTINCT
|
|
|
b.id,
|
|
|
b.lib_name
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
,c.icd10_code as icd10Code
|
|
|
</if>
|
|
|
FROM
|
|
|
kl_library_info a,
|
|
|
kl_concept b
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
left join kl_disease c
|
|
|
on c.is_deleted = 'N'
|
|
|
and b.id = c.concept_id
|
|
@@ -87,7 +87,7 @@
|
|
|
AND a.id = b.lib_id
|
|
|
<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">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
OR LOWER(c.icd10_code) LIKE LOWER(concat(#{inputStr},'%'))
|
|
|
</if>
|
|
|
)
|
|
@@ -101,13 +101,13 @@
|
|
|
SELECT DISTINCT
|
|
|
b.id,
|
|
|
b.lib_name
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
,c.icd10_code as icd10Code
|
|
|
</if>
|
|
|
FROM
|
|
|
kl_library_info a,
|
|
|
kl_concept b
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
left join kl_disease c
|
|
|
on c.is_deleted = 'N'
|
|
|
and b.id = c.concept_id
|
|
@@ -119,7 +119,7 @@
|
|
|
AND a.id = b.lib_id
|
|
|
<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">
|
|
|
+ <if test="typeId!=null and typeId==100">
|
|
|
OR LOWER(c.icd10_code) LIKE LOWER( concat('%',#{inputStr},'%'))
|
|
|
</if>
|
|
|
)
|
|
@@ -130,7 +130,7 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
) t
|
|
|
- <if test="typeId!=null and typeId=108">
|
|
|
+ <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
|
|
@@ -146,92 +146,264 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="staticIndex" resultType="com.diagbot.dto.StaticKnowledgeIndexDTO">
|
|
|
- SELECT
|
|
|
- f.*
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- s.*,
|
|
|
- s1.concept_id AS conceptId,
|
|
|
- s1.clinical_pathway_name,
|
|
|
- s1.notice_name,
|
|
|
- s1.`status` AS STATUS
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- t.id,
|
|
|
- t.NAME,
|
|
|
- l1.icd10_code AS icd10Code
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.NAME AS libName,
|
|
|
- a.spell AS spell,
|
|
|
- b.id AS id,
|
|
|
- b.lib_name AS NAME
|
|
|
- FROM
|
|
|
- kl_library_info a,
|
|
|
- kl_concept b
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND b.is_deleted = 'N'
|
|
|
- AND a.id = b.lib_id
|
|
|
- <if test="typeId!=null">
|
|
|
- AND a.type_id= #{typeId}
|
|
|
- </if>
|
|
|
- ) t
|
|
|
- LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
|
|
|
- AND l1.is_deleted = 'N'
|
|
|
- WHERE
|
|
|
- 1=1
|
|
|
- <if test="inputStr!=null and inputStr!=''">
|
|
|
- AND ( t.libName = #{inputStr} OR LOWER(t.spell) = LOWER(#{inputStr})
|
|
|
- <if test="typeId!=null and typeId=100">
|
|
|
- OR LOWER(l1.icd10_code) = LOWER(#{inputStr})
|
|
|
- </if>
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="">
|
|
|
- UNION
|
|
|
- SELECT DISTINCT
|
|
|
- e.id AS id,
|
|
|
- e.lib_name AS NAME,
|
|
|
- NULL AS icd10Code
|
|
|
- FROM
|
|
|
- kl_library_info a,
|
|
|
- kl_concept b,
|
|
|
- kl_relation d,
|
|
|
- kl_concept e
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND b.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
- AND e.is_deleted = 'N'
|
|
|
- AND a.id = b.lib_id
|
|
|
- AND b.id = d.end_id
|
|
|
- AND e.id = d.start_id
|
|
|
- AND b.lib_type = 108
|
|
|
- AND e.lib_type = 107
|
|
|
- AND d.relation_id = 600
|
|
|
- <if test="inputStr!=null and inputStr!=''">
|
|
|
- AND ( a.name = #{inputStr} OR LOWER(a.spell) = LOWER(#{inputStr}))
|
|
|
- </if>
|
|
|
- <if test="typeId!=null">
|
|
|
- AND a.type_id= #{typeId}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- ) s
|
|
|
- LEFT JOIN kl_concept_static s1 ON s.id = s1.concept_id
|
|
|
- AND s1.is_deleted = 'N'
|
|
|
- ) f
|
|
|
- WHERE
|
|
|
- 1 = 1
|
|
|
- <if test="hasInfo!=null and hasInfo=1">
|
|
|
- AND f.STATUS = 1
|
|
|
- AND f.conceptId IS NOT NULL
|
|
|
- </if>
|
|
|
- <if test="hasInfo==null or hasInfo=0">
|
|
|
- AND f.conceptId IS NULL
|
|
|
- </if>
|
|
|
+ SELECT
|
|
|
+ f.*
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ distinct
|
|
|
+ s.*,
|
|
|
+ s1.concept_id AS conceptId,
|
|
|
+ s1.clinical_pathway_name,
|
|
|
+ s1.notice_name,
|
|
|
+ s1.`status` AS STATUS,
|
|
|
+ IF( count( s2.id )> 0, 1, 0 ) AS hasInfo ,
|
|
|
+ IF( sum( IF ( FIND_IN_SET( 1, s2.content_type )> 0, 1, 0 ))> 0, 1, 0 ) AS hasStaticKnowledge,
|
|
|
+ IF( sum( IF ( FIND_IN_SET( 2, s2.content_type )> 0, 1, 0 ))> 0, 1, 0 ) AS hasNotice,
|
|
|
+ IF( sum( IF ( FIND_IN_SET( 3, s2.content_type )> 0, 1, 0 ))> 0, 1, 0 ) AS hasClinicalPathway,
|
|
|
+ IF( sum( IF ( FIND_IN_SET( 4, s2.content_type )> 0, 1, 0 ))> 0, 1, 0 ) AS hasTreatInfo
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t.id,
|
|
|
+ t.NAME,
|
|
|
+ t.retrievalName,
|
|
|
+ t.type,
|
|
|
+ t.typeName,
|
|
|
+ l1.icd10_code AS code
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.NAME AS retrievalName,
|
|
|
+ a.spell AS spell,
|
|
|
+ b.id AS id,
|
|
|
+ b.lib_name AS NAME,
|
|
|
+ b.lib_type AS type,
|
|
|
+ c.NAME AS typeName
|
|
|
+ FROM
|
|
|
+ kl_library_info a,
|
|
|
+ kl_concept b,
|
|
|
+ kl_lexicon c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.id = b.lib_id
|
|
|
+ AND b.lib_type = c.code
|
|
|
+ <if test="typeIds != null and typeIds.size > 0">
|
|
|
+ <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")" >
|
|
|
+ a.type_id =#{typeId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
|
|
|
+ AND l1.is_deleted = 'N'
|
|
|
+ WHERE
|
|
|
+ 1=1
|
|
|
+ <if test="inputStr!=null and inputStr!=''">
|
|
|
+ AND ( t.name = #{inputStr}
|
|
|
+ OR LOWER(t.spell) = LOWER(#{inputStr})
|
|
|
+ OR LOWER(l1.icd10_code) = LOWER(#{inputStr}))
|
|
|
+ </if>
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ t.id,
|
|
|
+ t.NAME,
|
|
|
+ t.retrievalName,
|
|
|
+ t.type,
|
|
|
+ t.typeName,
|
|
|
+ l1.icd10_code AS code
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.NAME AS retrievalName,
|
|
|
+ a.spell AS spell,
|
|
|
+ b.id AS id,
|
|
|
+ b.lib_name AS NAME,
|
|
|
+ b.lib_type AS type,
|
|
|
+ c.NAME AS typeName
|
|
|
+ FROM
|
|
|
+ kl_library_info a,
|
|
|
+ kl_concept b,
|
|
|
+ kl_lexicon c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.id = b.lib_id
|
|
|
+ AND b.lib_type = c.code
|
|
|
+ <if test="typeIds != null and typeIds.size > 0">
|
|
|
+ <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")" >
|
|
|
+ a.type_id =#{typeId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
|
|
|
+ AND l1.is_deleted = 'N'
|
|
|
+ WHERE
|
|
|
+ 1=1
|
|
|
+ <if test="inputStr!=null and inputStr!=''">
|
|
|
+ AND ( t.name LIKE concat(#{inputStr},'%')
|
|
|
+ OR LOWER(t.spell) LIKE LOWER( concat(#{inputStr},'%'))
|
|
|
+ OR LOWER(l1.icd10_code) LIKE LOWER( concat(#{inputStr},'%')))
|
|
|
+ </if>
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ t.id,
|
|
|
+ t.NAME,
|
|
|
+ t.retrievalName,
|
|
|
+ t.type,
|
|
|
+ t.typeName,
|
|
|
+ l1.icd10_code AS code
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.NAME AS retrievalName,
|
|
|
+ a.spell AS spell,
|
|
|
+ b.id AS id,
|
|
|
+ b.lib_name AS NAME,
|
|
|
+ b.lib_type AS type,
|
|
|
+ c.NAME AS typeName
|
|
|
+ FROM
|
|
|
+ kl_library_info a,
|
|
|
+ kl_concept b,
|
|
|
+ kl_lexicon c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.id = b.lib_id
|
|
|
+ AND b.lib_type = c.code
|
|
|
+ <if test="typeIds != null and typeIds.size > 0">
|
|
|
+ <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")" >
|
|
|
+ a.type_id =#{typeId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
|
|
|
+ AND l1.is_deleted = 'N'
|
|
|
+ WHERE
|
|
|
+ 1=1
|
|
|
+ <if test="inputStr!=null and inputStr!=''">
|
|
|
+ AND ( t.name LIKE concat('%',#{inputStr},'%')
|
|
|
+ OR LOWER(t.spell) LIKE LOWER( concat('%',#{inputStr},'%'))
|
|
|
+ OR LOWER(l1.icd10_code) LIKE LOWER( concat('%',#{inputStr},'%')))
|
|
|
+ </if>
|
|
|
+ <if test="(types != null and types.size > 0 and (types.contains(0) or types.contains(3))) or types==null or types.size==0">
|
|
|
+ UNION
|
|
|
+ SELECT DISTINCT
|
|
|
+ e.id AS id,
|
|
|
+ e.lib_name AS NAME,
|
|
|
+ b.lib_name AS retrievalName,
|
|
|
+ e.lib_type AS type,
|
|
|
+ c.name AS typeName,
|
|
|
+ NULL AS code
|
|
|
+ FROM
|
|
|
+ kl_library_info a,
|
|
|
+ kl_concept b,
|
|
|
+ kl_lexicon c,
|
|
|
+ kl_relation d,
|
|
|
+ kl_concept e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ AND a.id = b.lib_id
|
|
|
+ AND b.id = d.end_id
|
|
|
+ AND e.id = d.start_id
|
|
|
+ AND e.lib_type = c.code
|
|
|
+ AND b.lib_type = 108
|
|
|
+ AND e.lib_type = 107
|
|
|
+ AND d.relation_id = 600
|
|
|
+ <if test="inputStr!=null and inputStr!=''">
|
|
|
+ AND ( a.name = #{inputStr} OR LOWER(a.spell) = LOWER(#{inputStr}))
|
|
|
+ </if>
|
|
|
+ UNION
|
|
|
+ SELECT DISTINCT
|
|
|
+ e.id AS id,
|
|
|
+ e.lib_name AS NAME,
|
|
|
+ b.lib_name AS retrievalName,
|
|
|
+ e.lib_type AS type,
|
|
|
+ c.name AS typeName,
|
|
|
+ NULL AS code
|
|
|
+ FROM
|
|
|
+ kl_library_info a,
|
|
|
+ kl_concept b,
|
|
|
+ kl_lexicon c,
|
|
|
+ kl_relation d,
|
|
|
+ kl_concept e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ AND a.id = b.lib_id
|
|
|
+ AND b.id = d.end_id
|
|
|
+ AND e.id = d.start_id
|
|
|
+ AND e.lib_type = c.code
|
|
|
+ AND b.lib_type = 108
|
|
|
+ AND e.lib_type = 107
|
|
|
+ AND d.relation_id = 600
|
|
|
+ <if test="inputStr!=null and inputStr!=''">
|
|
|
+ AND ( a.name LIKE concat(#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat(#{inputStr},'%')))
|
|
|
+ </if>
|
|
|
+ UNION
|
|
|
+ SELECT DISTINCT
|
|
|
+ e.id AS id,
|
|
|
+ e.lib_name AS NAME,
|
|
|
+ b.lib_name AS retrievalName,
|
|
|
+ e.lib_type AS type,
|
|
|
+ c.name AS typeName,
|
|
|
+ NULL AS code
|
|
|
+ FROM
|
|
|
+ kl_library_info a,
|
|
|
+ kl_concept b,
|
|
|
+ kl_lexicon c,
|
|
|
+ kl_relation d,
|
|
|
+ kl_concept e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ AND a.id = b.lib_id
|
|
|
+ AND b.id = d.end_id
|
|
|
+ AND e.id = d.start_id
|
|
|
+ AND e.lib_type = c.code
|
|
|
+ AND b.lib_type = 108
|
|
|
+ AND e.lib_type = 107
|
|
|
+ AND d.relation_id = 600
|
|
|
+ <if test="inputStr!=null and inputStr!=''">
|
|
|
+ AND ( a.name LIKE concat('%',#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat('%',#{inputStr},'%')))
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ ) s
|
|
|
+ LEFT JOIN kl_concept_static s1 ON s.id = s1.concept_id
|
|
|
+ AND s1.is_deleted = 'N'
|
|
|
+ LEFT JOIN kl_concept_detail s2 ON s.id = s2.concept_id
|
|
|
+ AND s2.is_deleted = 'N'
|
|
|
+ GROUP BY s.id
|
|
|
+ ) f
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ <if test="hasInfo!=null ">
|
|
|
+ <choose>
|
|
|
+ <when test="hasInfo==0">
|
|
|
+ AND f.conceptId IS NULL
|
|
|
+ </when>
|
|
|
+ <when test="hasInfo==1">
|
|
|
+ AND f.STATUS = 1
|
|
|
+ AND f.conceptId IS NOT NULL
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ order by f.type asc
|
|
|
+ <if test="size!=null">
|
|
|
+ LIMIT #{size}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
</mapper>
|