zhaops 4 years ago
parent
commit
d065f35855
1 changed files with 90 additions and 0 deletions
  1. 90 0
      src/main/resources/mapper/KlConceptMapper.xml

+ 90 - 0
src/main/resources/mapper/KlConceptMapper.xml

@@ -144,4 +144,94 @@
 			LIMIT #{size}
 		</if>
     </select>
+
+    <select id="staticIndex" resultType="com.diagbot.dto.StaticKnowledgeIndexDTO">
+        SELECT
+        f.*
+        FROM
+        (
+        SELECT
+        s.*,
+        s1.concept_id AS conceptId,
+        s1.clinical_pathway_name,
+        s1.notice_name,
+        s1.`status` AS STATUS
+        FROM
+        (
+        SELECT
+        t.id,
+        t.NAME,
+        l1.icd10_code AS icd10Code
+        FROM
+        (
+        SELECT
+        a.NAME AS libName,
+        a.spell AS spell,
+        b.id AS id,
+        b.lib_name AS NAME
+        FROM
+        kl_library_info a,
+        kl_concept b
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.id = b.lib_id
+        <if test="typeId!=null">
+            AND a.type_id= #{typeId}
+        </if>
+        ) t
+        LEFT JOIN kl_disease l1 ON t.id = l1.concept_id
+        AND l1.is_deleted = 'N'
+        WHERE
+        1=1
+        <if test="inputStr!=null and inputStr!=''">
+            AND ( t.libName = #{inputStr} OR LOWER(t.spell) = LOWER(#{inputStr})
+            <if test="typeId!=null and typeId=100">
+                OR LOWER(l1.icd10_code) = LOWER(#{inputStr})
+            </if>
+            )
+        </if>
+        <if test="">
+            UNION
+            SELECT DISTINCT
+            e.id AS id,
+            e.lib_name AS NAME,
+            NULL AS icd10Code
+            FROM
+            kl_library_info a,
+            kl_concept b,
+            kl_relation d,
+            kl_concept e
+            WHERE
+            a.is_deleted = 'N'
+            AND b.is_deleted = 'N'
+            AND d.is_deleted = 'N'
+            AND e.is_deleted = 'N'
+            AND a.id = b.lib_id
+            AND b.id = d.end_id
+            AND e.id = d.start_id
+            AND b.lib_type = 108
+            AND e.lib_type = 107
+            AND d.relation_id = 600
+            <if test="inputStr!=null and inputStr!=''">
+                AND ( a.name = #{inputStr} OR LOWER(a.spell) = LOWER(#{inputStr}))
+            </if>
+            <if test="typeId!=null">
+                AND a.type_id= #{typeId}
+            </if>
+        </if>
+        ) s
+        LEFT JOIN kl_concept_static s1 ON s.id = s1.concept_id
+        AND s1.is_deleted = 'N'
+        ) f
+        WHERE
+        1 = 1
+        <if test="hasInfo!=null and hasInfo=1">
+        AND f.STATUS = 1
+        AND f.conceptId IS NOT NULL
+        </if>
+        <if test="hasInfo==null or hasInfo=0">
+            AND f.conceptId IS NULL
+        </if>
+    </select>
 </mapper>