|
@@ -51,31 +51,67 @@
|
|
|
|
|
|
<select id="getItemByDisease" resultType="com.diagbot.dto.DiseaseItemDTO" parameterType="com.diagbot.vo.DiseaseItemVO">
|
|
|
SELECT
|
|
|
- t1.lib_name AS diseaseName,
|
|
|
- t2.relation_id AS relationId,
|
|
|
- t3.lib_name AS itemName
|
|
|
+ t7.diseaseName,
|
|
|
+ t7.relationId,
|
|
|
+ t7.itemName
|
|
|
FROM
|
|
|
- kl_concept t1,
|
|
|
- kl_relation t2,
|
|
|
- kl_concept t3,
|
|
|
- kl_relation_order t4
|
|
|
- WHERE
|
|
|
- t1.is_deleted = "N"
|
|
|
- AND t2.is_deleted = "N"
|
|
|
- AND t3.is_deleted = "N"
|
|
|
- AND t4.is_deleted = "N"
|
|
|
- AND t1.lib_type = 100
|
|
|
- AND t1.id = t2.start_id
|
|
|
- AND t3.id = t2.end_id
|
|
|
- AND t2.id = t4.t_relation_id
|
|
|
- AND t2.relation_id IN (501,502,503,504,505,506,507,508)
|
|
|
- AND t1.`status` = 1
|
|
|
- AND t3.`status` = 1
|
|
|
- AND t1.lib_name = #{diseaseName}
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t5.diseaseId,
|
|
|
+ t5.diseaseName,
|
|
|
+ t5.relationId,
|
|
|
+ t5.itemName,
|
|
|
+ t5.itemId,
|
|
|
+ t5.order_no,
|
|
|
+ IFNULL(t6.min_age, 0) AS min_age,
|
|
|
+ IFNULL(t6.max_age, 200) AS max_age,
|
|
|
+ IFNULL(t6.sex_type, 3) AS sex_type
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t1.id AS diseaseId,
|
|
|
+ t1.lib_name AS diseaseName,
|
|
|
+ t2.relation_id AS relationId,
|
|
|
+ t3.lib_name AS itemName,
|
|
|
+ t3.id AS itemId,
|
|
|
+ t4.order_no
|
|
|
+ FROM
|
|
|
+ kl_concept t1,
|
|
|
+ kl_relation t2,
|
|
|
+ kl_concept t3,
|
|
|
+ kl_relation_order t4
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = "N"
|
|
|
+ AND t2.is_deleted = "N"
|
|
|
+ AND t3.is_deleted = "N"
|
|
|
+ AND t4.is_deleted = "N"
|
|
|
+ AND t1.lib_type = 100
|
|
|
+ AND t1.id = t2.start_id
|
|
|
+ AND t3.id = t2.end_id
|
|
|
+ AND t2.id = t4.t_relation_id
|
|
|
+ AND t2.relation_id IN (501,502,503,504,505,506,507,508)
|
|
|
+ AND t1.lib_name = #{diseaseName}
|
|
|
+ AND t1.`status` = 1
|
|
|
+ AND t3.`status` = 1
|
|
|
+ ) t5
|
|
|
+ LEFT JOIN kl_concept_common t6 ON t6.is_deleted = "N"
|
|
|
+ AND t5.itemId = t6.concept_id
|
|
|
+ ) t7
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="sexType == 3">
|
|
|
+ AND t7.sex_type in ('1','2','3')
|
|
|
+ </if>
|
|
|
+ <if test="sexType != 3">
|
|
|
+ AND t7.sex_type in ('3',#{sexType})
|
|
|
+ </if>
|
|
|
+ <if test="age != null and age != ''">
|
|
|
+ AND <![CDATA[ t7.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t7.max_age >= #{age} ]]>
|
|
|
+ </if>
|
|
|
ORDER BY
|
|
|
- t1.id,
|
|
|
- t2.relation_id,
|
|
|
- t4.order_no
|
|
|
+ t7.diseaseId,
|
|
|
+ t7.relationId,
|
|
|
+ t7.order_no
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|