|
@@ -18,4 +18,67 @@
|
|
|
<result column="msg" property="msg" />
|
|
|
</resultMap>
|
|
|
|
|
|
+ <select id="getRules" resultType="com.diagbot.dto.RuleDTO">
|
|
|
+ SELECT
|
|
|
+ t1.lib_type AS ruleLibType,
|
|
|
+ t1.lib_name AS ruleLibName,
|
|
|
+ t1.rule_id AS ruleId,
|
|
|
+ t1.concept_id AS ruleConceptId,
|
|
|
+ t1.description AS ruleDescription,
|
|
|
+ t1.has_sub_cond AS hasSubCond,
|
|
|
+ t1.msg AS ruleMsg,
|
|
|
+ t2.group_type AS groupType,
|
|
|
+ t2.rule_base_id AS ruleBaseId,
|
|
|
+ t3.description AS ruleBaseDescription,
|
|
|
+ t3.eq_operator AS ruleBaseEqOperator,
|
|
|
+ t3.eq_unit AS ruleBaseEqUnit,
|
|
|
+ t3.eq_value AS ruleBaseEqValue,
|
|
|
+ t3.max_operator AS ruleMaxOperator,
|
|
|
+ t3.max_unit AS ruleBaseMaxUnit,
|
|
|
+ t3.max_value AS ruleBaseMaxValue,
|
|
|
+ t3.min_operator AS ruleMinOperator,
|
|
|
+ t3.min_unit AS ruleBaseMinUnit,
|
|
|
+ t3.min_value AS ruleBaseMinValue,
|
|
|
+ t3.type AS ruleBaseType,
|
|
|
+ t3.concept_id AS ruleBaseConceptId,
|
|
|
+ t4.lib_name AS ruleBaseLibName,
|
|
|
+ t4.lib_type AS ruleBaseLibType
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.lib_type,
|
|
|
+ a.lib_name,
|
|
|
+ b.id AS rule_id,
|
|
|
+ b.concept_id,
|
|
|
+ b.description,
|
|
|
+ b.has_sub_cond,
|
|
|
+ b.msg,
|
|
|
+ b.`status`
|
|
|
+ FROM
|
|
|
+ kl_concept a,
|
|
|
+ kl_rule b
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND a.id = b.concept_id
|
|
|
+ <if test="libTypes != null and libTypes.size > 0">
|
|
|
+ <foreach item="libType" collection="libTypes" open="and(" separator="or" close=")" >
|
|
|
+ a.lib_type = #{typeId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="ruleType != null">
|
|
|
+ AND b.rule_type = #{ruleType}
|
|
|
+ </if>
|
|
|
+ AND a.`status` = 1
|
|
|
+ AND b.`status` = 1
|
|
|
+ ) t1
|
|
|
+ LEFT JOIN kl_rule_condition t2 ON t1.rule_id = t2.rule_id
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ LEFT JOIN kl_rule_base t3 ON t2.rule_base_id = t3.id
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ AND t3.`status` = 1
|
|
|
+ LEFT JOIN kl_concept t4 ON t3.concept_id = t4.id
|
|
|
+ AND t4.is_deleted = 'N'
|
|
|
+ AND t4.`status` = 1
|
|
|
+ </select>
|
|
|
</mapper>
|