12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007 |
- <?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.KlConceptMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.KlConcept">
- <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="lib_id" property="libId"/>
- <result column="lib_name" property="libName"/>
- <result column="lib_type" property="libType"/>
- <result column="status" property="status"/>
- </resultMap>
- <select id="index" resultType="com.diagbot.dto.IndexDTO">
- SELECT DISTINCT
- t.id as id,
- t.lib_name as name
- <if test="typeId!=null and typeId==100">
- ,t.code as code
- </if>
- <if test="typeId!=null and typeId==127">
- ,t.code as code
- </if>
- <if test="typeId!=null and typeId==128">
- ,t.code as code
- </if>
- <if test="typeId!=null and typeId==106">
- ,t.code as code
- </if>
- <if test="typeId!=null and typeId==108">
- ,
- t1.max_value as `maxValue`,
- t1.min_value as minValue,
- t1.unit as units,
- t1.type as `range`,
- t4.lib_name AS packName,
- t4.id as packId
- </if>
- FROM
- (
- SELECT DISTINCT
- b.id,
- b.lib_name
- <if test="typeId!=null and typeId==100">
- ,c.icd10_code as code
- </if>
- <if test="typeId!=null and typeId==127">
- ,c.code as code
- </if>
- <if test="typeId!=null and typeId==128">
- ,c.code as code
- </if>
- <if test="typeId!=null and typeId==106">
- ,c.operation_code as code
- </if>
- FROM
- kl_library_info a,
- kl_concept b
- <if test="typeId!=null and typeId==100">
- left join kl_disease c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==127">
- left join kl_tcm_disease c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==128">
- left join kl_tcm_syndrome c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==106">
- LEFT JOIN `kl_operation` c
- ON c.is_deleted = 'N'
- AND b.id = c.concept_id
- </if>
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND a.concept_id = b.id
- AND a.id = b.lib_id
- AND b.status = 1
- <if test="inputStr!=null and inputStr!=''">
- AND ( a.`name` = #{inputStr} OR LOWER(a.spell) = LOWER(#{inputStr})
- <if test="typeId!=null and typeId==100">
- OR LOWER(c.icd10_code) = LOWER(#{inputStr})
- </if>
- <if test="typeId!=null and typeId==127">
- OR LOWER(c.code) = LOWER(#{inputStr})
- </if>
- <if test="typeId!=null and typeId==128">
- OR LOWER(c.code) = LOWER(#{inputStr})
- </if>
- <if test="typeId!=null and typeId==106">
- OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
- </if>
- )
- </if>
- <if test="typeIds != null and typeIds.size > 0">
- <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
- a.type_id =#{typeId}
- </foreach>
- </if>
- UNION
- SELECT DISTINCT
- b.id,
- b.lib_name
- <if test="typeId!=null and typeId==100">
- ,c.icd10_code as code
- </if>
- <if test="typeId!=null and typeId==127">
- ,c.code as code
- </if>
- <if test="typeId!=null and typeId==128">
- ,c.code as code
- </if>
- <if test="typeId!=null and typeId==106">
- ,c.operation_code as code
- </if>
- FROM
- kl_library_info a,
- kl_concept b
- <if test="typeId!=null and typeId==100">
- left join kl_disease c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==127">
- left join kl_tcm_disease c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==128">
- left join kl_tcm_syndrome c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==106">
- LEFT JOIN `kl_operation` c
- ON c.is_deleted = 'N'
- AND b.id = c.concept_id
- </if>
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND a.concept_id = b.id
- AND a.id = b.lib_id
- AND b.status = 1
- <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">
- OR LOWER(c.icd10_code) LIKE LOWER(concat(#{inputStr},'%'))
- </if>
- <if test="typeId!=null and typeId==127">
- OR LOWER(c.code) LIKE LOWER(concat(#{inputStr},'%'))
- </if>
- <if test="typeId!=null and typeId==128">
- OR LOWER(c.code) LIKE LOWER(concat(#{inputStr},'%'))
- </if>
- <if test="typeId!=null and typeId==106">
- OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
- </if>
- )
- </if>
- <if test="typeIds != null and typeIds.size > 0">
- <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
- a.type_id =#{typeId}
- </foreach>
- </if>
- UNION
- SELECT DISTINCT
- b.id,
- b.lib_name
- <if test="typeId!=null and typeId==100">
- ,c.icd10_code as code
- </if>
- <if test="typeId!=null and typeId==127">
- ,c.code as code
- </if>
- <if test="typeId!=null and typeId==128">
- ,c.code as code
- </if>
- <if test="typeId!=null and typeId==106">
- ,c.operation_code as code
- </if>
- FROM
- kl_library_info a,
- kl_concept b
- <if test="typeId!=null and typeId==100">
- left join kl_disease c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==127">
- left join kl_tcm_disease c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==128">
- left join kl_tcm_syndrome c
- on c.is_deleted = 'N'
- and b.id = c.concept_id
- </if>
- <if test="typeId!=null and typeId==106">
- LEFT JOIN `kl_operation` c
- ON c.is_deleted = 'N'
- AND b.id = c.concept_id
- </if>
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND a.concept_id = b.id
- AND a.id = b.lib_id
- AND b.status = 1
- <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">
- OR LOWER(c.icd10_code) LIKE LOWER( concat('%',#{inputStr},'%'))
- </if>
- <if test="typeId!=null and typeId==127">
- OR LOWER(c.code) LIKE LOWER( concat('%',#{inputStr},'%'))
- </if>
- <if test="typeId!=null and typeId==128">
- OR LOWER(c.code) LIKE LOWER( concat('%',#{inputStr},'%'))
- </if>
- <if test="typeId!=null and typeId==106">
- OR LOWER(c.operation_code) LIKE LOWER( concat('%',#{inputStr},'%'))
- </if>
- )
- </if>
- <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
- <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
- AND t3.relation_id = 600
- AND t3.is_deleted = 'N'
- LEFT JOIN kl_concept t4 ON t3.start_id = t4.id
- AND t4.lib_type = 107
- AND t4.is_deleted = 'N'
- </if>
- <if test="size!=null">
- LIMIT #{size}
- </if>
- </select>
- <select id="staticIndex" resultType="com.diagbot.dto.StaticKnowledgeIndexDTO">
- SELECT
- f.*
- FROM
- (
- SELECT
- s.moduleNo,
- s.id,
- s.name,
- s.retrievalName,
- s.isConcept,
- s.type,
- s.typeName,
- s.code,
- IF( s2.concept_id IS NOT NULL, s2.concept_id, s3.concept_id ) AS conceptId,
- s1.clinical_pathway_name,
- s1.notice_name,
- s1.`status` AS status,
- IF( count( s2.id )> 0, 1, IF( count( s3.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
- o1.*
- 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="typeIds != null and typeIds.size > 0">
- <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
- a.type_id =#{typeId}
- </foreach>AND ( a.name = #{inputStr}
- </if>
- <if test="inputStr!=null and inputStr!=''">OR LOWER(a.spell
- ) = LOWER(#{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="typeIds != null and typeIds.size > 0">
- <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
- a.type_id =#{typeId}
- </foreach>
- </if>
- <if test="inputStr!=null and inputStr!=''">
- AND ( a.name LIKE concat(#{inputStr},'%')
- OR LOWER(a.spell) LIKE LOWER( concat(#{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="typeIds != null and typeIds.size > 0">
- <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
- a.type_id =#{typeId}
- </foreach>
- </if>
- <if test="inputStr!=null and inputStr!=''">
- AND ( a.name LIKE concat('%',#{inputStr},'%')
- OR LOWER(a.spell) LIKE LOWER( concat('%',#{inputStr},'%')))
- </if>
- ) t left join kl_disease t1 on t.id = t1.concept_id and t1.is_deleted='N'
- <if test="typeIds.contains(107) or 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="inputStr!=null and inputStr!=''">
- AND ( a.name = #{inputStr} OR LOWER(a.spell) = LOWER(#{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="inputStr!=null and inputStr!=''">
- AND ( a.name LIKE concat(#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat(#{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="inputStr!=null and inputStr!=''">
- AND ( a.name LIKE concat('%',#{inputStr},'%') OR LOWER(a.spell) LIKE
- LOWER( concat('%',#{inputStr},'%')))
- </if>
- </if>
- <if test="typeIds.contains(109) or typeIds.contains(110)">
- 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 = 110
- AND e.lib_type = 109
- AND d.relation_id = 600
- AND b.`status` = 1
- <if test="inputStr!=null and inputStr!=''">
- AND ( a.name = #{inputStr} OR LOWER(a.spell) = LOWER(#{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 = 110
- AND e.lib_type = 109
- AND d.relation_id = 600
- AND b.`status` = 1
- <if test="inputStr!=null and inputStr!=''">
- AND ( a.name LIKE concat(#{inputStr},'%') OR LOWER(a.spell) LIKE LOWER( concat(#{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 = 110
- AND e.lib_type = 109
- AND d.relation_id = 600
- AND b.`status` = 1
- <if test="inputStr!=null and inputStr!=''">
- AND ( a.name LIKE concat('%',#{inputStr},'%') OR LOWER(a.spell) LIKE
- LOWER( concat('%',#{inputStr},'%')))
- </if>
- </if>
- <if test="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>
- <if test="inputStr!=null and inputStr!=''">
- AND LOWER(l1.icd10_code) = LOWER(#{inputStr})
- </if>
- </where>
- 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>
- <if test="inputStr!=null and inputStr!=''">
- AND LOWER(l1.icd10_code) LIKE LOWER( concat(#{inputStr},'%'))
- </if>
- </where>
- 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>
- <if test="inputStr!=null and inputStr!=''">
- AND LOWER(l1.icd10_code) LIKE LOWER( concat('%',#{inputStr},'%'))
- </if>
- </where>
- </if>
- )o1
- order by o1.type asc,o1.moduleNo ASC,o1.isConcept DESC
- Limit 1000
- ) 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'
- LEFT JOIN kl_concept_scale s3 ON s.id = s3.concept_id
- AND s3.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.conceptId IS NOT NULL
- </when>
- </choose>
- </if>
- <if test="size!=null">
- LIMIT #{size}
- </if>
- </select>
- <select id="getLisDetaisByNames" parameterType="com.diagbot.vo.KllisDetailVO"
- resultType="com.diagbot.dto.KllisDetailDTO">
- SELECT
- t1.lib_name,
- t1.id,
- t2.min_value,
- t2.max_value,
- t2.type,
- t2.unit
- FROM
- `kl_concept` t1,
- kl_lis t2
- WHERE
- t1.is_deleted = "N"
- AND t2.is_deleted = "N"
- AND t1.id = t2.concept_id
- AND t1.lib_type = 108
- AND t1.`status` = 1
- <if test="names != null and names.size > 0">
- and t1.lib_name in
- <foreach item="name" collection="names" open="(" separator="," close=")">
- #{name}
- </foreach>
- </if>
- </select>
- <select id="searchByTypeAndName" parameterType="com.diagbot.vo.SearchConceptVO"
- resultType="com.diagbot.dto.GetAllForRelationDTO">
- <!-- SELECT-->
- <!-- kc.id AS conceptId,-->
- <!-- kc.lib_name AS conceptName,-->
- <!-- kc.lib_type AS libType,-->
- <!-- kc.lib_name AS conceptNameType-->
- <!-- FROM-->
- <!-- `kl_concept` kc-->
- <!-- WHERE-->
- <!-- kc.`status` = 1-->
- <!-- <if test="libType!=null">-->
- <!-- AND kc.lib_type = #{libType}-->
- <!-- </if>-->
- <!-- <if test="name != null and name != ''">-->
- <!-- AND UPPER(kc.lib_name) LIKE CONCAT('%', UPPER(trim(#{name})), '%')-->
- <!-- </if>-->
- <!-- <if test="excludedConceptIds != null and excludedConceptIds.size > 0">-->
- <!-- AND kc.id not in-->
- <!-- <foreach item="id" collection="excludedConceptIds" open="(" separator="," close=")">-->
- <!-- #{id}-->
- <!-- </foreach>-->
- <!-- </if>-->
- <!-- AND kc.is_deleted = 'N'-->
- <!-- AND kc.id NOT IN (1)-->
- <!-- AND kc.id IN (-->
- <!-- SELECT DISTINCT-->
- <!-- start_id-->
- <!-- FROM-->
- <!-- kl_relation-->
- <!-- WHERE-->
- <!-- is_deleted = 'N'-->
- <!-- AND relation_id = 600-->
- <!-- )-->
- select kc.id AS conceptId,
- kc.lib_name AS conceptName,
- kc.lib_type AS libType,
- kc.lib_name AS conceptNameType
- from (SELECT
- a.*,
- <choose>
- <when test="libType gte 308 and libType lte 328"> b.id as tRelationId</when>
- <otherwise>null as tRelationId</otherwise>
- </choose>
- FROM
- kl_concept a
- <choose>
- <when test="libType gte 308 and libType lte 328"> LEFT JOIN kl_relation b ON a.id = b.start_id
- AND a.lib_type = #{libType} AND b.relation_id = 600 and UPPER(a.lib_name) LIKE CONCAT('%', UPPER(trim(#{name})), '%')</when>
- <otherwise>where a.lib_type = #{libType} and UPPER(a.lib_name) LIKE CONCAT('%', UPPER(trim(#{name})), '%')</otherwise>
- </choose>
- GROUP BY
- a.id)kc
- where
- <choose>
- <when test="libType gte 308 and libType lte 328"> kc.tRelationId is not null</when>
- <otherwise>kc.tRelationId is null</otherwise>
- </choose>
- limit 100
- </select>
- <select id="searchByTypeAndNameAdd" parameterType="com.diagbot.vo.SearchConceptVO"
- resultType="com.diagbot.dto.GetAllForRelationDTO">
- SELECT
- kc.id AS conceptId,
- kc.lib_name AS conceptName,
- kc.lib_type AS libType,
- kc.lib_name AS conceptNameType,
- kli.remark
- FROM
- `kl_concept` kc,
- kl_library_info kli
- WHERE
- <if test="libType!=null">
- kc.lib_type = #{libType}
- </if>
- AND kc.`status` = 1
- AND kc.is_deleted = 'N'
- <if test="name != null and name != ''">
- AND UPPER(kc.lib_name) LIKE CONCAT('%', UPPER(trim(#{name})), '%')
- </if>
- <if test="excludedConceptIds != null and excludedConceptIds.size > 0">
- AND kc.id not in
- <foreach item="id" collection="excludedConceptIds" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- AND kc.id NOT IN (
- SELECT DISTINCT
- start_id
- FROM
- kl_relation
- WHERE
- is_deleted = 'N'
- AND relation_id = 600
- )
- AND kc.id = kli.concept_id
- AND kli.is_deleted = 'N'
- AND kli.is_concept = 1
- limit 100
- </select>
- <select id="searchCollectionConcept" parameterType="com.diagbot.vo.SearchCollectionConceptVO"
- resultType="com.diagbot.dto.GetAllForRelationDTO">
- select kc.id AS conceptId,
- kc.lib_name AS conceptName,
- kc.lib_type AS libType,
- kc.lib_name AS conceptNameType
- from kl_concept kc
- where
- <if test="libType!=null">
- kc.lib_type = #{libType}
- </if>
- AND kc.status = 1
- <if test="excludedConceptIds != null and excludedConceptIds.size > 0">
- AND kc.id not in
- <foreach item="id" collection="excludedConceptIds" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- <if test="names != null and names.size > 0">
- and
- <choose>
- <when test="logicalOperator != null and logicalOperator eq 0">
- <foreach collection="names" item="id" open="(" separator="and" close=")">
- <if test="id != null and id != ''">
- UPPER(kc.lib_name) LIKE CONCAT('%', UPPER(trim(#{id})), '%')
- </if>
- </foreach>
- </when>
- <when test="logicalOperator != null and logicalOperator eq 1">
- <foreach collection="names" item="id" open="(" separator="or" close=")">
- <if test="id != null and id != ''">
- UPPER(kc.lib_name) LIKE CONCAT('%', UPPER(trim(#{id})), '%')
- </if>
- </foreach>
- </when>
- </choose>
- </if>
- LIMIT 100
- </select>
- <select id="indexByApproval" resultType="com.diagbot.dto.IndexBatchDTO">
- SELECT
- t1.approvalNum,
- t1.approval,
- t1.id,
- t1.NAME,
- t1.regName,
- t1.form,
- t1.status,
- t2.id AS formConceptId
- FROM
- (
- SELECT
- REPLACE ( a.approval, '国药准字', '' ) AS approvalNum,
- a.approval AS approval,
- c.id AS id,
- c.lib_name AS NAME,
- a.NAME AS regName,
- a.form AS form,
- c.status AS status
- FROM
- kl_drug_register a,
- `kl_drug_mapping` b,
- kl_concept c
- WHERE
- a.id = b.register_id
- AND b.drug_concept = c.id
- AND a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- <if test="status != null">
- AND c.STATUS = #{status}
- </if>
- <if test="approvalList != null and approvalList.size > 0">
- <foreach item="approval" collection="approvalList" open="and(" separator="or" close=")">
- a.approval = #{approval}
- </foreach>
- </if>
- ) t1
- LEFT JOIN ( SELECT * FROM kl_concept WHERE is_deleted = 'N' AND STATUS = 1 AND lib_type = 102 ) t2 ON t1.form = t2.lib_name
- <!--GROUP BY
- t1.approval-->
- </select>
- <select id="getGather" resultType="com.diagbot.dto.GatherDTO">
- SELECT
- a.lib_name par_name,
- a.lib_type par_lib_type,
- c.lib_name son_name
- FROM
- `kl_concept` a,
- kl_relation b,
- kl_concept c
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.`status` = 1
- AND c.`status` = 1
- AND a.id = b.start_id
- AND b.end_id = c.id
- AND b.relation_id = 600
- AND CONCAT(a.lib_name, '#', a.lib_type) IN
- <foreach collection="gatherNameList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- </mapper>
|