|
@@ -226,7 +226,7 @@
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- s.moduleNo,
|
|
|
+ s.moduleNo,
|
|
|
s.id,
|
|
|
s.name,
|
|
|
s.retrievalName,
|
|
@@ -244,20 +244,23 @@
|
|
|
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.moduleNo,
|
|
|
t.id,
|
|
|
t.NAME,
|
|
|
IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
|
t.isConcept,
|
|
|
t.type,
|
|
|
t.typeName,
|
|
|
- t1.icd10_code AS code
|
|
|
+ t1.icd10_code AS code
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- concat( '1', b.lib_type ) AS moduleNo,
|
|
|
+ concat( '1', b.lib_type ) AS moduleNo,
|
|
|
a.NAME AS retrievalName,
|
|
|
a.spell AS spell,
|
|
|
a.is_concept AS isConcept,
|
|
@@ -277,29 +280,27 @@
|
|
|
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=")" >
|
|
|
+ <foreach item="typeId" collection="typeIds" open="and(" separator="or" close=")">
|
|
|
a.type_id =#{typeId}
|
|
|
- </foreach>
|
|
|
+ </foreach>AND ( a.name = #{inputStr}</if>
|
|
|
+ <if test="inputStr!=null and inputStr!=''">OR LOWER(a.spell
|
|
|
+ ) = LOWER(#{inputStr}))
|
|
|
</if>
|
|
|
- <if test="inputStr!=null and inputStr!=''">
|
|
|
- AND ( a.name = #{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.moduleNo,
|
|
|
t.id,
|
|
|
t.NAME,
|
|
|
IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
|
t.isConcept,
|
|
|
t.type,
|
|
|
t.typeName,
|
|
|
- t1.icd10_code AS code
|
|
|
+ t1.icd10_code AS code
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- concat( '2', b.lib_type ) AS moduleNo,
|
|
|
+ concat( '2', b.lib_type ) AS moduleNo,
|
|
|
a.NAME AS retrievalName,
|
|
|
a.spell AS spell,
|
|
|
a.is_concept AS isConcept,
|
|
@@ -323,25 +324,25 @@
|
|
|
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>
|
|
|
+ <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.moduleNo,
|
|
|
t.id,
|
|
|
t.NAME,
|
|
|
IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
|
t.isConcept,
|
|
|
t.type,
|
|
|
t.typeName,
|
|
|
- t1.icd10_code AS code
|
|
|
+ t1.icd10_code AS code
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- concat( '3', b.lib_type ) AS moduleNo,
|
|
|
+ concat( '3', b.lib_type ) AS moduleNo,
|
|
|
a.NAME AS retrievalName,
|
|
|
a.spell AS spell,
|
|
|
a.is_concept AS isConcept,
|
|
@@ -365,15 +366,15 @@
|
|
|
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>
|
|
|
+ <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,
|
|
|
+ concat( '1', e.lib_type ) AS moduleNo,
|
|
|
e.id AS id,
|
|
|
e.lib_name AS NAME,
|
|
|
b.lib_name AS retrievalName,
|
|
@@ -406,7 +407,7 @@
|
|
|
</if>
|
|
|
UNION
|
|
|
SELECT DISTINCT
|
|
|
- concat( '2', e.lib_type ) AS moduleNo,
|
|
|
+ concat( '2', e.lib_type ) AS moduleNo,
|
|
|
e.id AS id,
|
|
|
e.lib_name AS NAME,
|
|
|
b.lib_name AS retrievalName,
|
|
@@ -439,7 +440,7 @@
|
|
|
</if>
|
|
|
UNION
|
|
|
SELECT DISTINCT
|
|
|
- concat( '3', e.lib_type ) AS moduleNo,
|
|
|
+ concat( '3', e.lib_type ) AS moduleNo,
|
|
|
e.id AS id,
|
|
|
e.lib_name AS NAME,
|
|
|
b.lib_name AS retrievalName,
|
|
@@ -468,13 +469,14 @@
|
|
|
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},'%')))
|
|
|
+ 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.moduleNo,
|
|
|
t.id,
|
|
|
t.NAME,
|
|
|
IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
@@ -485,7 +487,7 @@
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- concat( '1', b.lib_type ) AS moduleNo,
|
|
|
+ concat( '1', b.lib_type ) AS moduleNo,
|
|
|
a.NAME AS retrievalName,
|
|
|
a.spell AS spell,
|
|
|
a.is_concept AS isConcept,
|
|
@@ -515,7 +517,7 @@
|
|
|
</if>
|
|
|
UNION
|
|
|
SELECT
|
|
|
- t.moduleNo,
|
|
|
+ t.moduleNo,
|
|
|
t.id,
|
|
|
t.NAME,
|
|
|
IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
@@ -526,7 +528,7 @@
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- concat( '2', b.lib_type ) AS moduleNo,
|
|
|
+ concat( '2', b.lib_type ) AS moduleNo,
|
|
|
a.NAME AS retrievalName,
|
|
|
a.spell AS spell,
|
|
|
a.is_concept AS isConcept,
|
|
@@ -556,7 +558,7 @@
|
|
|
</if>
|
|
|
UNION
|
|
|
SELECT
|
|
|
- t.moduleNo,
|
|
|
+ t.moduleNo,
|
|
|
t.id,
|
|
|
t.NAME,
|
|
|
IF ( t.isConcept = 0, t.retrievalName, '' ) AS retrievalName,
|
|
@@ -567,7 +569,7 @@
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- concat( '3', b.lib_type ) AS moduleNo,
|
|
|
+ concat( '3', b.lib_type ) AS moduleNo,
|
|
|
a.NAME AS retrievalName,
|
|
|
a.spell AS spell,
|
|
|
a.is_concept AS isConcept,
|
|
@@ -595,7 +597,9 @@
|
|
|
<if test="inputStr!=null and inputStr!=''">
|
|
|
AND LOWER(l1.icd10_code) LIKE LOWER( concat('%',#{inputStr},'%'))
|
|
|
</if>
|
|
|
- </if>
|
|
|
+ </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'
|
|
@@ -617,7 +621,6 @@
|
|
|
</when>
|
|
|
</choose>
|
|
|
</if>
|
|
|
- order by f.type asc,f.moduleNo ASC,f.isConcept DESC
|
|
|
<if test="size!=null">
|
|
|
LIMIT #{size}
|
|
|
</if>
|