123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- <?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
- distinct
- s.*,
- s1.concept_id AS conceptId,
- s1.clinical_pathway_name AS clinicalPathwayName,
- s1.notice_name AS noticeName,
- 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,
- s2.content as abstractContent
- 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.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>
- ) 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 ( t.retrievalName = #{staticKnowledgeIndexPageVO.inputStr}
- OR LOWER(t.spell) = LOWER(#{staticKnowledgeIndexPageVO.inputStr})
- OR LOWER(l1.icd10_code) = LOWER(#{staticKnowledgeIndexPageVO.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.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>
- ) 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 ( t.retrievalName LIKE concat(#{staticKnowledgeIndexPageVO.inputStr},'%')
- OR LOWER(t.spell) LIKE LOWER( concat(#{staticKnowledgeIndexPageVO.inputStr},'%'))
- OR LOWER(l1.icd10_code) LIKE LOWER( concat(#{staticKnowledgeIndexPageVO.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.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>
- ) 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 ( t.retrievalName LIKE concat('%',#{staticKnowledgeIndexPageVO.inputStr},'%')
- OR LOWER(t.spell) LIKE LOWER( concat('%',#{staticKnowledgeIndexPageVO.inputStr},'%'))
- OR LOWER(l1.icd10_code) LIKE LOWER( concat('%',#{staticKnowledgeIndexPageVO.inputStr},'%')))
- </if>
- <if test="(staticKnowledgeIndexPageVO.types != null and staticKnowledgeIndexPageVO.types.size > 0 and (staticKnowledgeIndexPageVO.types.contains(0) or staticKnowledgeIndexPageVO.types.contains(3))) or staticKnowledgeIndexPageVO.types==null or staticKnowledgeIndexPageVO.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.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
- 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.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
- 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.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>
- ) s,
- kl_concept_static s1,
- kl_concept_detail s2
- WHERE s.id = s1.concept_id
- AND s.id = s2.concept_id
- AND s1.is_deleted = 'N'
- AND s2.is_deleted = 'N'
- AND (FIND_IN_SET( 1, s2.content_type ) OR FIND_IN_SET( 2, s2.content_type ) OR FIND_IN_SET( 3, s2.content_type ))
- GROUP BY s.id
- ORDER BY s.type ASC ,s2.order_no ASC
- ) f
- </select>
- </mapper>
|