|
@@ -18,88 +18,88 @@
|
|
|
|
|
|
<select id="getDiagnoseByIds" resultType="com.diagbot.dto.DiagnoseDTO" parameterType="com.diagbot.vo.DiagnoseVO">
|
|
|
SELECT DISTINCT
|
|
|
- t12.concept_id,
|
|
|
- t12.lib_name,
|
|
|
- t12.condition_type
|
|
|
+ t12.concept_id,
|
|
|
+ t12.lib_name,
|
|
|
+ t12.condition_type
|
|
|
FROM
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- t11.concept_id,
|
|
|
- t11.lib_name,
|
|
|
- t11.condition_type,
|
|
|
- t11.condition_group,
|
|
|
- (
|
|
|
- count(t11.condition_group) <= sum(baseGroupDiff)
|
|
|
- ) AS groupDiff
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- t3.*, IFNULL(t5.cnt, 0) AS cnt,
|
|
|
- (
|
|
|
- t3.fit_no <= IFNULL(t5.cnt, 0)
|
|
|
- ) AS baseGroupDiff
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- t1.concept_id,t2.*, c1.lib_name
|
|
|
- FROM
|
|
|
- kl_diagnose t1,
|
|
|
- kl_diagnose_condition t2,
|
|
|
- kl_concept c1,
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- t4.diagnose_id
|
|
|
- FROM
|
|
|
- `kl_diagnose_condition` t4
|
|
|
- WHERE
|
|
|
- t4.condition_type = 1
|
|
|
- AND t4.is_deleted = "N"
|
|
|
- <if test="ids != null and ids.size > 0">
|
|
|
- and t4.diagnose_base_id in
|
|
|
- <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- ) t10
|
|
|
- WHERE
|
|
|
- t1.is_deleted = "N"
|
|
|
- AND t1.`status` = 1
|
|
|
- AND t2.is_deleted = "N"
|
|
|
- AND t1.id = t2.diagnose_id
|
|
|
- AND t2.condition_type IN (2, 3, 4)
|
|
|
- AND c1.is_deleted = "N"
|
|
|
- AND c1.`status` = 1
|
|
|
- AND c1.id = t1.concept_id
|
|
|
- AND t1.id = t10.diagnose_id
|
|
|
- ) t3
|
|
|
- LEFT JOIN (
|
|
|
- SELECT
|
|
|
- t4.diagnose_id,
|
|
|
- t4.base_group,
|
|
|
- COUNT(t4.id) AS cnt
|
|
|
- FROM
|
|
|
- `kl_diagnose_condition` t4
|
|
|
- WHERE
|
|
|
- t4.condition_type = 1
|
|
|
- AND t4.is_deleted = "N"
|
|
|
- <if test="ids != null and ids.size > 0">
|
|
|
- and t4.diagnose_base_id in
|
|
|
- <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- t4.diagnose_id,
|
|
|
- t4.base_group
|
|
|
- ) t5 ON t3.diagnose_id = t5.diagnose_id
|
|
|
- AND t3.base_group = t5.base_group
|
|
|
- ) t11
|
|
|
- GROUP BY
|
|
|
- t11.concept_id,
|
|
|
- t11.condition_type,
|
|
|
- t11.condition_group
|
|
|
- ) t12,
|
|
|
- kl_concept_common t15
|
|
|
+ (
|
|
|
+ SELECT DISTINCT
|
|
|
+ t11.concept_id,
|
|
|
+ t11.lib_name,
|
|
|
+ t11.condition_type,
|
|
|
+ t11.condition_group,
|
|
|
+ (
|
|
|
+ count(t11.condition_group) <= sum(baseGroupDiff)
|
|
|
+ ) AS groupDiff
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t3.*, IFNULL(t5.cnt, 0) AS cnt,
|
|
|
+ (
|
|
|
+ t3.fit_no <= IFNULL(t5.cnt, 0)
|
|
|
+ ) AS baseGroupDiff
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t1.concept_id,t2.*, c1.lib_name
|
|
|
+ FROM
|
|
|
+ kl_diagnose t1,
|
|
|
+ kl_diagnose_condition t2,
|
|
|
+ kl_concept c1,
|
|
|
+ (
|
|
|
+ SELECT DISTINCT
|
|
|
+ t4.diagnose_id
|
|
|
+ FROM
|
|
|
+ `kl_diagnose_condition` t4
|
|
|
+ WHERE
|
|
|
+ t4.condition_type = 1
|
|
|
+ AND t4.is_deleted = "N"
|
|
|
+ <if test="ids != null and ids.size > 0">
|
|
|
+ and t4.diagnose_base_id in
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) t10
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = "N"
|
|
|
+ AND t1.`status` = 1
|
|
|
+ AND t2.is_deleted = "N"
|
|
|
+ AND t1.id = t2.diagnose_id
|
|
|
+ AND t2.condition_type IN (2, 3, 4)
|
|
|
+ AND c1.is_deleted = "N"
|
|
|
+ AND c1.`status` = 1
|
|
|
+ AND c1.id = t1.concept_id
|
|
|
+ AND t1.id = t10.diagnose_id
|
|
|
+ ) t3
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ t4.diagnose_id,
|
|
|
+ t4.base_group,
|
|
|
+ COUNT(t4.id) AS cnt
|
|
|
+ FROM
|
|
|
+ `kl_diagnose_condition` t4
|
|
|
+ WHERE
|
|
|
+ t4.condition_type = 1
|
|
|
+ AND t4.is_deleted = "N"
|
|
|
+ <if test="ids != null and ids.size > 0">
|
|
|
+ and t4.diagnose_base_id in
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ t4.diagnose_id,
|
|
|
+ t4.base_group
|
|
|
+ ) t5 ON t3.diagnose_id = t5.diagnose_id
|
|
|
+ AND t3.base_group = t5.base_group
|
|
|
+ ) t11
|
|
|
+ GROUP BY
|
|
|
+ t11.concept_id,
|
|
|
+ t11.condition_type,
|
|
|
+ t11.condition_group
|
|
|
+ ) t12,
|
|
|
+ kl_concept_common t15
|
|
|
WHERE
|
|
|
t15.concept_id = t12.concept_id
|
|
|
AND t15.is_deleted = "N"
|
|
@@ -119,5 +119,90 @@
|
|
|
</if>
|
|
|
AND t12.groupDiff = 1
|
|
|
</select>
|
|
|
+ <select id="getKlDiagnosePages" resultType="com.diagbot.dto.KlDiagnoseInfoDTO">
|
|
|
+ select * from kl_diagnose where is_deleted = 'N'
|
|
|
+ <if test="description!=null and description!=''">
|
|
|
+ AND UPPER(description) LIKE CONCAT('%', UPPER(trim(#{description})), '%')
|
|
|
+ </if>
|
|
|
+ <if test="status!=null">
|
|
|
+ AND status = #{status}
|
|
|
+ </if>
|
|
|
+ ORDER BY gmt_modified DESC
|
|
|
+ </select>
|
|
|
+ <select id="getByIdDiagnoses" resultType="com.diagbot.dto.KlDiagnoseByIdDTO">
|
|
|
+ SELECT
|
|
|
+ di.id as id,
|
|
|
+ di.description as description,
|
|
|
+ di.concept_id AS conceptId,
|
|
|
+ di.lib_name as libName,
|
|
|
+ di.lib_type as libType,
|
|
|
+ di.lename as lename,
|
|
|
+ di.status as status,
|
|
|
+ dico.condition_group as conditionGroup,
|
|
|
+ dico.base_group as baseGroup,
|
|
|
+ dico.fit_no as fitNo,
|
|
|
+ dico.condition_type as conditionType,
|
|
|
+ dibas.basid as basid,
|
|
|
+ dibas.basDescription as basDescription,
|
|
|
+ dibas.basConceptId as basConceptId,
|
|
|
+ dibas.basLibName as basLibName,
|
|
|
+ dibas.baslibType as baslibType,
|
|
|
+ dibas.basLename as basLename,
|
|
|
+ dibas.basType as basType,
|
|
|
+ dibas.min_operator as minOperator,
|
|
|
+ dibas.min_value AS minVal,
|
|
|
+ dibas.min_unit AS minUnit,
|
|
|
+ dibas.max_value AS maxVal,
|
|
|
+ dibas.max_unit as maxUnit,
|
|
|
+ dibas.max_operator as maxOperator,
|
|
|
+ dibas.eq_operator as eqOperator,
|
|
|
+ dibas.eq_value as eqValue,
|
|
|
+ dibas.eq_unit as eqUnit
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ a.id,
|
|
|
+ a.description,
|
|
|
+ a.concept_id,
|
|
|
+ b.lib_name,
|
|
|
+ b.lib_type,
|
|
|
+ a.status,
|
|
|
+ c.name AS lename
|
|
|
+ FROM
|
|
|
+ kl_diagnose a,
|
|
|
+ kl_concept b,
|
|
|
+ kl_lexicon c
|
|
|
+ WHERE a.concept_id = b.id
|
|
|
+ AND b.lib_type = c.code
|
|
|
+ <if test="id != null">
|
|
|
+ AND a.id = #{id}
|
|
|
+ </if>
|
|
|
+ ) di
|
|
|
+ LEFT JOIN kl_diagnose_condition dico
|
|
|
+ ON di.id = dico.diagnose_id
|
|
|
+ LEFT JOIN
|
|
|
+ (SELECT
|
|
|
+ c.id AS basid,
|
|
|
+ c.description AS basDescription,
|
|
|
+ c.concept_id AS basConceptId,
|
|
|
+ d.lib_name AS basLibName,
|
|
|
+ d.lib_type AS baslibType,
|
|
|
+ f.name AS basLename,
|
|
|
+ c.type AS basType,
|
|
|
+ c.min_operator,
|
|
|
+ c.min_value,
|
|
|
+ c.min_unit,
|
|
|
+ c.max_value,
|
|
|
+ c.max_unit,
|
|
|
+ c.max_operator,
|
|
|
+ c.eq_operator,
|
|
|
+ c.eq_value,
|
|
|
+ c.eq_unit
|
|
|
+ FROM
|
|
|
+ kl_diagnose_base c LEFT JOIN
|
|
|
+ kl_concept d ON c.concept_id = d.id
|
|
|
+ LEFT JOIN kl_lexicon f ON d.lib_type = f.code
|
|
|
+ ) dibas
|
|
|
+ ON dibas.basid = dico.diagnose_base_id
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|