|
@@ -1026,4 +1026,248 @@
|
|
|
t1.approval-->
|
|
|
</select>
|
|
|
|
|
|
+ <!--ICD编码查询-->
|
|
|
+ <select id="findDiseaeByCode" resultType="com.diagbot.dto.DiseaseIndexDTO">
|
|
|
+ SELECT
|
|
|
+ t.id,
|
|
|
+ <if test="diseaseIndexPageVO.type != null">
|
|
|
+ <choose>
|
|
|
+ <when test="diseaseIndexPageVO.type == 1">
|
|
|
+ t.lib_name AS NAME,
|
|
|
+ t.icd10_code AS CODE,
|
|
|
+ </when>
|
|
|
+ <when test="diseaseIndexPageVO.type == 2">
|
|
|
+ t.guoname AS NAME,
|
|
|
+ t.guocode AS CODE,
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ t.partId
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.id,
|
|
|
+ a.lib_name,
|
|
|
+ b.spell,
|
|
|
+ c.icd10_code,
|
|
|
+ c.guoname,
|
|
|
+ c.guocode,
|
|
|
+ c.guospell,
|
|
|
+ CONCAT( '1', a.lib_type ) AS partId
|
|
|
+ FROM
|
|
|
+ kl_concept a,
|
|
|
+ kl_library_info b,
|
|
|
+ kl_disease c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.id = b.concept_id
|
|
|
+ AND a.id = c.concept_id
|
|
|
+ AND b.is_concept = 1
|
|
|
+ AND a.lib_type = 100
|
|
|
+ AND a.`status` = 1
|
|
|
+ <if test="diseaseIndexPageVO.inputStr != null and diseaseIndexPageVO.inputStr != '' and diseaseIndexPageVO.type != null">
|
|
|
+ <choose>
|
|
|
+ <when test="diseaseIndexPageVO.type == 1">
|
|
|
+ AND c.icd10_code != ''
|
|
|
+ AND ( a.lib_name = #{diseaseIndexPageVO.inputStr}
|
|
|
+ OR b.spell = #{diseaseIndexPageVO.inputStr}
|
|
|
+ OR c.icd10_code = #{diseaseIndexPageVO.inputStr} )
|
|
|
+ </when>
|
|
|
+ <when test="diseaseIndexPageVO.type == 2">
|
|
|
+ AND c.guocode != ''
|
|
|
+ AND ( c.guoname = #{diseaseIndexPageVO.inputStr}
|
|
|
+ OR c.guospell = #{diseaseIndexPageVO.inputStr}
|
|
|
+ OR c.guocode = #{diseaseIndexPageVO.inputStr} )
|
|
|
+ </when>
|
|
|
+ <otherwise></otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ a.id,
|
|
|
+ a.lib_name,
|
|
|
+ b.spell,
|
|
|
+ c.icd10_code,
|
|
|
+ c.guoname,
|
|
|
+ c.guocode,
|
|
|
+ c.guospell,
|
|
|
+ CONCAT( '2', a.lib_type ) AS partId
|
|
|
+ FROM
|
|
|
+ kl_concept a,
|
|
|
+ kl_library_info b,
|
|
|
+ kl_disease c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.id = b.concept_id
|
|
|
+ AND a.id = c.concept_id
|
|
|
+ AND b.is_concept = 1
|
|
|
+ AND a.lib_type = 100
|
|
|
+ AND a.`status` = 1
|
|
|
+ <if test="diseaseIndexPageVO.inputStr != null and diseaseIndexPageVO.inputStr != '' and diseaseIndexPageVO.type != null">
|
|
|
+ <choose>
|
|
|
+ <when test="diseaseIndexPageVO.type == 1">
|
|
|
+ AND c.icd10_code != ''
|
|
|
+ AND ( a.lib_name LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR b.spell LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.icd10_code LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' ) )
|
|
|
+ </when>
|
|
|
+ <when test="diseaseIndexPageVO.type == 2">
|
|
|
+ AND c.guocode != ''
|
|
|
+ AND ( c.guoname LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.guospell LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.guocode LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' ) )
|
|
|
+ </when>
|
|
|
+ <otherwise></otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ a.id,
|
|
|
+ a.lib_name,
|
|
|
+ b.spell,
|
|
|
+ c.icd10_code,
|
|
|
+ c.guoname,
|
|
|
+ c.guocode,
|
|
|
+ c.guospell,
|
|
|
+ CONCAT( '3', a.lib_type ) AS partId
|
|
|
+ FROM
|
|
|
+ kl_concept a,
|
|
|
+ kl_library_info b,
|
|
|
+ kl_disease c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.id = b.concept_id
|
|
|
+ AND a.id = c.concept_id
|
|
|
+ AND b.is_concept = 1
|
|
|
+ AND a.lib_type = 100
|
|
|
+ AND a.`status` = 1
|
|
|
+ <if test="diseaseIndexPageVO.inputStr != null and diseaseIndexPageVO.inputStr != '' and diseaseIndexPageVO.type != null">
|
|
|
+ <choose>
|
|
|
+ <when test="diseaseIndexPageVO.type == 1">
|
|
|
+ AND c.icd10_code != ''
|
|
|
+ AND ( a.lib_name LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR b.spell LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.icd10_code LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' ) )
|
|
|
+ AND (
|
|
|
+ a.lib_name NOT LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ AND b.spell NOT LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ AND c.icd10_code NOT LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <when test="diseaseIndexPageVO.type == 2">
|
|
|
+ AND c.guocode != ''
|
|
|
+ AND ( c.guoname LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.guospell LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.guocode LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' ) )
|
|
|
+ AND (
|
|
|
+ c.guoname NOT LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ AND c.guospell NOT LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ AND c.guocode NOT LIKE CONCAT( #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <otherwise></otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ ORDER BY
|
|
|
+ t.partId
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--ICD编码查询-->
|
|
|
+ <select id="diseaseIndex" resultType="com.diagbot.dto.DiseaseIndexDTO">
|
|
|
+ SELECT
|
|
|
+ k.id,
|
|
|
+ k.name,
|
|
|
+ k.code,
|
|
|
+ k.spell,
|
|
|
+ k.pos,
|
|
|
+ least( k.nameLen, k.spellLen, k.codeLen ) AS len
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t.*,
|
|
|
+ LEAST( t.namePos, t.spellPos, t.codePos ) AS pos,
|
|
|
+ IF( LEAST( t.namePos, t.spellPos, t.codePos )= namePos, CHAR_LENGTH( t.name ), 999 ) AS nameLen,
|
|
|
+ IF( LEAST( t.namePos, t.spellPos, t.codePos )= spellPos, CHAR_LENGTH( t.spell ), 999 ) AS spellLen,
|
|
|
+ IF( LEAST( t.namePos, t.spellPos, t.codePos )= codePos, CHAR_LENGTH( t.code ), 999 ) AS codeLen
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ <if test="diseaseIndexPageVO.inputStr != null and diseaseIndexPageVO.inputStr != '' and diseaseIndexPageVO.type != null">
|
|
|
+ <choose>
|
|
|
+ <when test="diseaseIndexPageVO.type == 1">
|
|
|
+ IF( POSITION( #{diseaseIndexPageVO.inputStr} IN a.lib_name )> 0, POSITION( #{diseaseIndexPageVO.inputStr} IN a.lib_name ), 999 ) AS namePos,
|
|
|
+ IF( POSITION( #{diseaseIndexPageVO.inputStr} IN b.spell )> 0, POSITION( #{diseaseIndexPageVO.inputStr} IN b.spell ), 999 ) AS spellPos,
|
|
|
+ IF( POSITION( #{diseaseIndexPageVO.inputStr} IN c.icd10_code )> 0, POSITION( #{diseaseIndexPageVO.inputStr} IN c.icd10_code ), 999 ) AS codePos,
|
|
|
+ </when>
|
|
|
+ <when test="diseaseIndexPageVO.type == 2">
|
|
|
+ IF( POSITION( #{diseaseIndexPageVO.inputStr} IN c.guoname )> 0, POSITION( #{diseaseIndexPageVO.inputStr} IN c.guoname ), 999 ) AS namePos,
|
|
|
+ IF( POSITION( #{diseaseIndexPageVO.inputStr} IN c.guospell )> 0, POSITION( #{diseaseIndexPageVO.inputStr} IN c.guospell ), 999 ) AS spellPos,
|
|
|
+ IF( POSITION( #{diseaseIndexPageVO.inputStr} IN c.guocode )> 0, POSITION( #{diseaseIndexPageVO.inputStr} IN c.guocode ), 999 ) AS codePos,
|
|
|
+ </when>
|
|
|
+ <otherwise></otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="diseaseIndexPageVO.type != null">
|
|
|
+ <choose>
|
|
|
+ <when test="diseaseIndexPageVO.type == 1">
|
|
|
+ a.lib_name AS NAME,
|
|
|
+ c.icd10_code AS CODE,
|
|
|
+ b.spell AS spell,
|
|
|
+ </when>
|
|
|
+ <when test="diseaseIndexPageVO.type == 2">
|
|
|
+ c.guoname AS NAME,
|
|
|
+ c.guocode AS CODE,
|
|
|
+ c.guospell AS spell,
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ a.id
|
|
|
+ FROM
|
|
|
+ kl_concept a,
|
|
|
+ kl_library_info b,
|
|
|
+ kl_disease c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.id = b.concept_id
|
|
|
+ AND a.id = c.concept_id
|
|
|
+ AND b.is_concept = 1
|
|
|
+ AND a.lib_type = 100
|
|
|
+ AND a.`status` = 1
|
|
|
+ <if test="diseaseIndexPageVO.inputStr != null and diseaseIndexPageVO.inputStr != '' and diseaseIndexPageVO.type != null">
|
|
|
+ <choose>
|
|
|
+ <when test="diseaseIndexPageVO.type == 1">
|
|
|
+ AND c.icd10_code != ''
|
|
|
+ AND ( a.lib_name LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR b.spell LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.icd10_code LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' ) )
|
|
|
+ </when>
|
|
|
+ <when test="diseaseIndexPageVO.type == 2">
|
|
|
+ AND c.guocode != ''
|
|
|
+ AND ( c.guoname LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.guospell LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' )
|
|
|
+ OR c.guocode LIKE CONCAT( '%', #{diseaseIndexPageVO.inputStr}, '%' ) )
|
|
|
+ </when>
|
|
|
+ <otherwise></otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ ) k
|
|
|
+ ORDER BY
|
|
|
+ k.pos,
|
|
|
+ len
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|