|
@@ -10,7 +10,6 @@
|
|
|
<result column="gmt_modified" property="gmtModified" />
|
|
|
<result column="creator" property="creator" />
|
|
|
<result column="modifier" property="modifier" />
|
|
|
- <result column="concept_id" property="conceptId" />
|
|
|
<result column="description" property="description" />
|
|
|
<result column="type" property="type" />
|
|
|
<result column="min_operator" property="minOperator" />
|
|
@@ -24,46 +23,26 @@
|
|
|
<result column="eq_unit" property="eqUnit" />
|
|
|
</resultMap>
|
|
|
|
|
|
- <select id="getAllBase" resultType="com.diagbot.dto.BaseRegulationDTO">
|
|
|
- SELECT DISTINCT
|
|
|
- CONCAT_WS(
|
|
|
- "_",
|
|
|
- t1.concept_id,
|
|
|
- t1.type,
|
|
|
- t1.max_operator,
|
|
|
- t1.max_value,
|
|
|
- t1.max_unit,
|
|
|
- t1.min_operator,
|
|
|
- t1.min_value,
|
|
|
- t1.min_unit,
|
|
|
- t1.eq_operator,
|
|
|
- t1.eq_value,
|
|
|
- t1.eq_unit
|
|
|
- ) AS baseKey,
|
|
|
- GROUP_CONCAT(t1.id) AS ids,
|
|
|
- IFNULL(t2.lib_name, "") AS baseLibName,
|
|
|
- IFNULL(t2.lib_type, 0) AS baseLibType,
|
|
|
- t1.concept_id,
|
|
|
- t1.type AS baseType,
|
|
|
- t1.max_operator AS baseMaxOperator,
|
|
|
- t1.max_value AS baseMaxValue,
|
|
|
- t1.max_unit AS baseMaxUnit,
|
|
|
- t1.min_operator AS baseMinOperator,
|
|
|
- t1.min_value AS baseMinValue,
|
|
|
- t1.min_unit AS baseMinUnit,
|
|
|
- t1.eq_operator AS baseEqOperator,
|
|
|
- t1.eq_value AS baseEqValue,
|
|
|
- t1.eq_unit AS baseEqUnit
|
|
|
+ <select id="getSelectBase" resultType="com.diagbot.dto.BaseRegulationDTO">
|
|
|
+ SELECT
|
|
|
+ t.type baseType,
|
|
|
+ t.max_operator baseMaxOperator,
|
|
|
+ t.max_value baseMaxValue,
|
|
|
+ t.max_unit baseMaxUnit,
|
|
|
+ t.min_operator baseMinOperator,
|
|
|
+ t.min_value baseMinValue,
|
|
|
+ t.min_unit baseMinUnit,
|
|
|
+ t.eq_operator baseEqOperator,
|
|
|
+ t.eq_value baseEqValue,
|
|
|
+ t.eq_unit baseEqUnit,
|
|
|
+ t.conceptids baseConceptids,
|
|
|
+ t.lib_name baseLibName,
|
|
|
+ t.lib_type baseLibType,
|
|
|
+ GROUP_CONCAT(t.id) ids
|
|
|
FROM
|
|
|
- kl_regulation_base t1
|
|
|
- LEFT JOIN kl_concept t2 ON t1.concept_id = t2.id
|
|
|
- AND t2.is_deleted = "N"
|
|
|
- AND t2.`status` = 1
|
|
|
- WHERE
|
|
|
- t1.is_deleted = "N"
|
|
|
- AND t1.`status` = 1
|
|
|
- GROUP BY
|
|
|
- t1.concept_id,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t1.id,
|
|
|
t1.type,
|
|
|
t1.max_operator,
|
|
|
t1.max_value,
|
|
@@ -73,77 +52,62 @@
|
|
|
t1.min_unit,
|
|
|
t1.eq_operator,
|
|
|
t1.eq_value,
|
|
|
- t1.eq_unit
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="getSelectBase" resultType="com.diagbot.dto.BaseRegulationDTO">
|
|
|
- SELECT DISTINCT
|
|
|
- CONCAT_WS(
|
|
|
- "_",
|
|
|
- t1.concept_id,
|
|
|
- t1.type,
|
|
|
- t1.max_operator,
|
|
|
- t1.max_value,
|
|
|
- t1.max_unit,
|
|
|
- t1.min_operator,
|
|
|
- t1.min_value,
|
|
|
- t1.min_unit,
|
|
|
- t1.eq_operator,
|
|
|
- t1.eq_value,
|
|
|
- t1.eq_unit
|
|
|
- ) AS baseKey,
|
|
|
- GROUP_CONCAT(t1.id) AS ids,
|
|
|
- IFNULL(t2.lib_name, "") AS baseLibName,
|
|
|
- IFNULL(t2.lib_type, 0) AS baseLibType,
|
|
|
- t1.concept_id,
|
|
|
- t1.type AS baseType,
|
|
|
- t1.max_operator AS baseMaxOperator,
|
|
|
- t1.max_value AS baseMaxValue,
|
|
|
- t1.max_unit AS baseMaxUnit,
|
|
|
- t1.min_operator AS baseMinOperator,
|
|
|
- t1.min_value AS baseMinValue,
|
|
|
- t1.min_unit AS baseMinUnit,
|
|
|
- t1.eq_operator AS baseEqOperator,
|
|
|
- t1.eq_value AS baseEqValue,
|
|
|
- t1.eq_unit AS baseEqUnit
|
|
|
- FROM
|
|
|
- kl_regulation_base t1
|
|
|
- LEFT JOIN kl_concept t2 ON t1.concept_id = t2.id
|
|
|
- AND t2.is_deleted = "N"
|
|
|
- AND t2.`status` = 1
|
|
|
- WHERE
|
|
|
- t1.is_deleted = "N"
|
|
|
- AND t1.`status` = 1
|
|
|
- AND t1.id in
|
|
|
- (
|
|
|
- SELECT
|
|
|
- b.regulation_base_id
|
|
|
+ t1.eq_unit,
|
|
|
+ IFNULL(t2.conceptids, 0) conceptids,
|
|
|
+ IFNULL(t2.lib_name, '') lib_name,
|
|
|
+ IFNULL(t2.lib_type, 0) lib_type
|
|
|
FROM
|
|
|
- `kl_regulation` a,
|
|
|
- kl_regulation_condition b
|
|
|
+ kl_regulation_base t1
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ regulation_base_id,
|
|
|
+ lib_type,
|
|
|
+ GROUP_CONCAT(concept_id ORDER BY concept_id) conceptids,
|
|
|
+ GROUP_CONCAT(lib_name ORDER BY concept_id SEPARATOR '#') lib_name
|
|
|
+ FROM
|
|
|
+ `kl_regulation_base_relation` m,
|
|
|
+ kl_concept c
|
|
|
+ WHERE
|
|
|
+ m.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND c. STATUS = 1
|
|
|
+ AND m.concept_id = c.id
|
|
|
+ GROUP BY m.regulation_base_id, c.lib_type
|
|
|
+ ) t2 ON t1.id = t2.regulation_base_id
|
|
|
WHERE
|
|
|
- a.id = b.regulation_id
|
|
|
+ t1.is_deleted = 'N'
|
|
|
<if test="list != null and list.size > 0">
|
|
|
+ AND t1.id in
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ b.regulation_base_id
|
|
|
+ FROM
|
|
|
+ `kl_regulation` a,
|
|
|
+ kl_regulation_condition b
|
|
|
+ WHERE
|
|
|
+ a.id = b.regulation_id
|
|
|
and a.`code` in
|
|
|
<foreach item="code" collection="list" open="(" separator="," close=")">
|
|
|
#{code}
|
|
|
</foreach>
|
|
|
+ AND a.`status` = 1
|
|
|
+ AND b.condition_type = 1
|
|
|
+ )
|
|
|
</if>
|
|
|
- AND a.`status` = 1
|
|
|
- AND b.condition_type = 1
|
|
|
- )
|
|
|
+ ) t
|
|
|
GROUP BY
|
|
|
- t1.concept_id,
|
|
|
- t1.type,
|
|
|
- t1.max_operator,
|
|
|
- t1.max_value,
|
|
|
- t1.max_unit,
|
|
|
- t1.min_operator,
|
|
|
- t1.min_value,
|
|
|
- t1.min_unit,
|
|
|
- t1.eq_operator,
|
|
|
- t1.eq_value,
|
|
|
- t1.eq_unit
|
|
|
+ t.type,
|
|
|
+ t.max_operator,
|
|
|
+ t.max_value,
|
|
|
+ t.max_unit,
|
|
|
+ t.min_operator,
|
|
|
+ t.min_value,
|
|
|
+ t.min_unit,
|
|
|
+ t.eq_operator,
|
|
|
+ t.eq_value,
|
|
|
+ t.eq_unit,
|
|
|
+ t.conceptids,
|
|
|
+ t.lib_name
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|