|
@@ -16,30 +16,6 @@
|
|
|
<result column="notice_name" property="noticeName" />
|
|
|
</resultMap>
|
|
|
|
|
|
- <select id="getStaticInfo" resultType="com.diagbot.entity.KlConceptStatic">
|
|
|
- SELECT
|
|
|
- b.*
|
|
|
- FROM
|
|
|
- kl_concept a,
|
|
|
- kl_concept_static b,
|
|
|
- kl_lexicon c
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND b.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND a.id = b.concept_id
|
|
|
- AND a.lib_type = c.CODE
|
|
|
- <if test="status!=null and status!=''">
|
|
|
- AND b.`status` = #{status}
|
|
|
- </if>
|
|
|
- <if test="name!=null and name!=''">
|
|
|
- AND a.lib_name = #{name}
|
|
|
- </if>
|
|
|
- <if test="typeName!=null and typeName!=''">
|
|
|
- AND c.NAME = #{typeName}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="getPage" resultType="com.diagbot.dto.KlConceptStaticDTO">
|
|
|
SELECT
|
|
@@ -85,4 +61,272 @@
|
|
|
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,
|
|
|
+ IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
|
+ t.isConcept,
|
|
|
+ t.type,
|
|
|
+ t.typeName,
|
|
|
+ l1.icd10_code AS code
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ 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>
|
|
|
+ ) 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,
|
|
|
+ IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
|
+ t.isConcept,
|
|
|
+ t.type,
|
|
|
+ t.typeName,
|
|
|
+ l1.icd10_code AS code
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ 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>
|
|
|
+ ) 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,
|
|
|
+ IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
|
+ t.isConcept,
|
|
|
+ t.type,
|
|
|
+ t.typeName,
|
|
|
+ l1.icd10_code AS code
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ 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>
|
|
|
+ ) 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,
|
|
|
+ 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
|
|
|
+ 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
|
|
|
+ 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>
|
|
|
+ ) 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,
|
|
|
+ s.isConcept DESC,
|
|
|
+ s2.order_no ASC
|
|
|
+ ) f
|
|
|
+ </select>
|
|
|
</mapper>
|