123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- <?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.KlConceptStaticMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.KlConceptStatic">
- <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="concept_id" property="conceptId" />
- <result column="status" property="status" />
- <result column="clinical_pathway_name" property="clinicalPathwayName" />
- <result column="notice_name" property="noticeName" />
- </resultMap>
- <!-- 分页查询 -->
- <select id="getPage" resultType="com.diagbot.dto.KlConceptStaticDTO">
- SELECT
- t1.id,
- t1.NAME,
- t1.clinicalPathwayName,
- t1.noticeName,
- t1.type,
- t1.status,
- t1.title,
- t1.gmtModified,
- t1.modifier
- FROM
- (
- SELECT
- a.id,
- a.lib_name as NAME ,
- b.clinical_pathway_name AS clinicalPathwayName,
- b.notice_name AS noticeName,
- a.lib_type as type,
- b.status,
- "" AS title,
- b.gmt_modified AS gmtModified,
- b.modifier
- FROM
- kl_concept a,
- kl_concept_static b
- WHERE
- a.id = b.concept_id
- and a.is_deleted = 'N'
- and b.is_deleted = 'N'
- <if test="klConceptStaticPageVO.status!=null ">
- AND b.status = #{klConceptStaticPageVO.status}
- </if>
- <if test="klConceptStaticPageVO.name!=null and klConceptStaticPageVO.name!=''">
- AND a.lib_name like concat('%', #{klConceptStaticPageVO.name},'%')
- </if>
- <if test="klConceptStaticPageVO.type!=null and klConceptStaticPageVO.type!=''">
- AND a.lib_type = #{klConceptStaticPageVO.type}
- </if>
- ) t1
- ORDER BY
- t1.status DESC,
- t1.gmtModified DESC
- </select>
- <!-- 静态知识检索分页返回 -->
- <select id="staticIndexPage" resultType="com.diagbot.dto.StaticKnowledgeIndexPageDTO">
- SELECT
- f.*
- FROM
- (
- SELECT
- s.moduleNo,
- s.id,
- s.name,
- s.retrievalName,
- s.isConcept,
- s.type,
- s.typeName,
- s.code,
- s1.concept_id AS conceptId,
- s1.clinical_pathway_name AS clinicalPathwayName,
- s1.notice_name AS noticeName,
- s1.`status` AS status
- FROM
- (
- SELECT
- t.moduleNo,
- t.id,
- t.NAME,
- IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
- t.isConcept,
- t.type,
- t.typeName,
- t1.icd10_code AS code
- FROM
- (
- SELECT
- concat( '1', b.lib_type ) AS moduleNo,
- a.NAME AS retrievalName,
- a.spell AS spell,
- a.is_concept AS isConcept,
- 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.concept_id = b.id
- AND b.lib_type = c.code
- AND b.`status` = 1
- <if test="staticKnowledgeIndexPageVO.typeIds != null and staticKnowledgeIndexPageVO.typeIds.size > 0">
- <foreach item="typeId" collection="staticKnowledgeIndexPageVO.typeIds" open="and(" separator="or" close=")" >
- a.type_id =#{typeId}
- </foreach>
- </if>
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND ( a.name = #{staticKnowledgeIndexPageVO.inputStr}
- OR LOWER(a.spell) = LOWER(#{staticKnowledgeIndexPageVO.inputStr}))
- </if>
- ) t left join kl_disease t1 on t.id = t1.concept_id and t1.is_deleted='N'
- UNION
- SELECT
- t.moduleNo,
- t.id,
- t.NAME,
- IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
- t.isConcept,
- t.type,
- t.typeName,
- t1.icd10_code AS code
- FROM
- (
- SELECT
- concat( '2', b.lib_type ) AS moduleNo,
- a.NAME AS retrievalName,
- a.spell AS spell,
- a.is_concept AS isConcept,
- 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.concept_id = b.id
- AND b.lib_type = c.code
- AND b.`status` = 1
- <if test="staticKnowledgeIndexPageVO.typeIds != null and staticKnowledgeIndexPageVO.typeIds.size > 0">
- <foreach item="typeId" collection="staticKnowledgeIndexPageVO.typeIds" open="and(" separator="or" close=")" >
- a.type_id =#{typeId}
- </foreach>
- </if>
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND ( a.name LIKE concat(#{staticKnowledgeIndexPageVO.inputStr},'%')
- OR LOWER(a.spell) LIKE LOWER( concat(#{staticKnowledgeIndexPageVO.inputStr},'%')))
- </if>
- ) t left join kl_disease t1 on t.id = t1.concept_id and t1.is_deleted='N'
- UNION
- SELECT
- t.moduleNo,
- t.id,
- t.NAME,
- IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
- t.isConcept,
- t.type,
- t.typeName,
- t1.icd10_code AS code
- FROM
- (
- SELECT
- concat( '3', b.lib_type ) AS moduleNo,
- a.NAME AS retrievalName,
- a.spell AS spell,
- a.is_concept AS isConcept,
- 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.concept_id = b.id
- AND b.lib_type = c.code
- AND b.`status` = 1
- <if test="staticKnowledgeIndexPageVO.typeIds != null and staticKnowledgeIndexPageVO.typeIds.size > 0">
- <foreach item="typeId" collection="staticKnowledgeIndexPageVO.typeIds" open="and(" separator="or" close=")" >
- a.type_id =#{typeId}
- </foreach>
- </if>
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND ( a.name LIKE concat('%',#{staticKnowledgeIndexPageVO.inputStr},'%')
- OR LOWER(a.spell) LIKE LOWER( concat('%',#{staticKnowledgeIndexPageVO.inputStr},'%')))
- </if>
- ) t left join kl_disease t1 on t.id = t1.concept_id and t1.is_deleted='N'
- <if test="staticKnowledgeIndexPageVO.typeIds.contains(107) or staticKnowledgeIndexPageVO.typeIds.contains(108)">
- UNION
- SELECT DISTINCT
- concat( '1', e.lib_type ) AS moduleNo,
- e.id AS id,
- e.lib_name AS NAME,
- b.lib_name AS retrievalName,
- 1 AS isConcept,
- 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.concept_id = b.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
- AND b.`status` = 1
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND ( a.name = #{staticKnowledgeIndexPageVO.inputStr} OR LOWER(a.spell) = LOWER(#{staticKnowledgeIndexPageVO.inputStr}))
- </if>
- UNION
- SELECT DISTINCT
- concat( '2', e.lib_type ) AS moduleNo,
- e.id AS id,
- e.lib_name AS NAME,
- b.lib_name AS retrievalName,
- 1 AS isConcept,
- 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.concept_id = b.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
- AND b.`status` = 1
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND ( a.name LIKE concat(#{staticKnowledgeIndexPageVO.inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat(#{staticKnowledgeIndexPageVO.inputStr},'%')))
- </if>
- UNION
- SELECT DISTINCT
- concat( '3', e.lib_type ) AS moduleNo,
- e.id AS id,
- e.lib_name AS NAME,
- b.lib_name AS retrievalName,
- 1 AS isConcept,
- 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.concept_id = b.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
- AND b.`status` = 1
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND ( a.name LIKE concat('%',#{staticKnowledgeIndexPageVO.inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat('%',#{staticKnowledgeIndexPageVO.inputStr},'%')))
- </if>
- </if>
- <if test="staticKnowledgeIndexPageVO.typeIds.contains(100) ">
- UNION
- SELECT
- t.moduleNo,
- t.id,
- t.NAME,
- IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
- t.isConcept,
- t.type,
- t.typeName,
- l1.icd10_code AS code
- FROM
- (
- SELECT
- concat( '1', b.lib_type ) AS moduleNo,
- a.NAME AS retrievalName,
- a.spell AS spell,
- a.is_concept AS isConcept,
- 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.concept_id = b.id
- AND b.lib_type = c.code
- AND b.`status` = 1
- AND a.type_id =100
- ) t
- LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
- AND l1.is_deleted = 'N'
- WHERE
- 1=1
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND LOWER(l1.icd10_code) = LOWER(#{staticKnowledgeIndexPageVO.inputStr})
- </if>
- UNION
- SELECT
- t.moduleNo,
- t.id,
- t.NAME,
- IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
- t.isConcept,
- t.type,
- t.typeName,
- l1.icd10_code AS code
- FROM
- (
- SELECT
- concat( '2', b.lib_type ) AS moduleNo,
- a.NAME AS retrievalName,
- a.spell AS spell,
- a.is_concept AS isConcept,
- 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.concept_id = b.id
- AND b.lib_type = c.code
- AND b.`status` = 1
- AND a.type_id =100
- ) t
- LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
- AND l1.is_deleted = 'N'
- WHERE
- 1=1
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND LOWER(l1.icd10_code) LIKE LOWER( concat(#{staticKnowledgeIndexPageVO.inputStr},'%'))
- </if>
- UNION
- SELECT
- t.moduleNo,
- t.id,
- t.NAME,
- IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
- t.isConcept,
- t.type,
- t.typeName,
- l1.icd10_code AS code
- FROM
- (
- SELECT
- concat( '3', b.lib_type ) AS moduleNo,
- a.NAME AS retrievalName,
- a.spell AS spell,
- a.is_concept AS isConcept,
- 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.concept_id = b.id
- AND b.lib_type = c.code
- AND b.`status` = 1
- AND a.type_id =100
- ) t
- LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
- AND l1.is_deleted = 'N'
- WHERE
- 1=1
- <if test="staticKnowledgeIndexPageVO.inputStr!=null and staticKnowledgeIndexPageVO.inputStr!=''">
- AND LOWER(l1.icd10_code) LIKE LOWER( concat('%',#{staticKnowledgeIndexPageVO.inputStr},'%'))
- </if>
- </if>
- ) s,
- kl_concept_static s1
- WHERE s.id = s1.concept_id
- AND s1.is_deleted = 'N'
- GROUP BY s.id
- ORDER BY s.type ASC,
- s.moduleNo ASC,
- s.isConcept DESC
- ) f
- </select>
- </mapper>
|