|
@@ -49,12 +49,91 @@
|
|
|
t3.id
|
|
|
</select>
|
|
|
|
|
|
+<!-- <select id="getItemByDisease" resultType="com.diagbot.dto.DiseaseItemDTO" parameterType="com.diagbot.vo.DiseaseItemVO">-->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- t7.diseaseName,-->
|
|
|
+<!-- t7.relationId,-->
|
|
|
+<!-- t7.itemName-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- (-->
|
|
|
+<!-- 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,509,510)-->
|
|
|
+<!-- 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-->
|
|
|
+<!-- t7.diseaseId,-->
|
|
|
+<!-- t7.relationId,-->
|
|
|
+<!-- t7.order_no-->
|
|
|
+<!-- </select>-->
|
|
|
+
|
|
|
+
|
|
|
<select id="getItemByDisease" resultType="com.diagbot.dto.DiseaseItemDTO" parameterType="com.diagbot.vo.DiseaseItemVO">
|
|
|
SELECT
|
|
|
- t7.diseaseName,
|
|
|
- t7.relationId,
|
|
|
- t7.itemName
|
|
|
+ t9.diseaseName,
|
|
|
+ t9.relationId,
|
|
|
+ t9.itemName,
|
|
|
+ t9.drug_c
|
|
|
FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t7.diseaseName,
|
|
|
+ t7.relationId,
|
|
|
+ t7.itemName,
|
|
|
+ t8.drug_c,
|
|
|
+ IFNULL(t7.min_age, 0) AS min_age,
|
|
|
+ IFNULL(t7.max_age, 200) AS max_age,
|
|
|
+ IFNULL(t7.sex_type, 3) AS sex_type,
|
|
|
+ t7.diseaseId as diseaseId,
|
|
|
+ t7.order_no as order_no
|
|
|
+ FROM
|
|
|
(
|
|
|
SELECT
|
|
|
t5.diseaseId,
|
|
@@ -65,53 +144,57 @@
|
|
|
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
|
|
|
+ IFNULL(t6.sex_type, 3) AS sex_type,
|
|
|
+ t6.concept_id as concept_id
|
|
|
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,509,510)
|
|
|
- AND t1.lib_name = #{diseaseName}
|
|
|
- AND t1.`status` = 1
|
|
|
- AND t3.`status` = 1
|
|
|
- ) t5
|
|
|
+ (
|
|
|
+ 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,509,510)
|
|
|
+ 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
|
|
|
+ LEFT JOIN kl_drug t8 ON t8.is_deleted = "N"
|
|
|
+ AND t8.concept_id = t7.concept_id
|
|
|
+ )t9
|
|
|
WHERE 1=1
|
|
|
<if test="sexType == 3">
|
|
|
- AND t7.sex_type in ('1','2','3')
|
|
|
+ AND t9.sex_type in ('1','2','3')
|
|
|
</if>
|
|
|
<if test="sexType != 3">
|
|
|
- AND t7.sex_type in ('3',#{sexType})
|
|
|
+ AND t9.sex_type in ('3',#{sexType})
|
|
|
</if>
|
|
|
<if test="age != null and age != ''">
|
|
|
- AND <![CDATA[ t7.min_age <= #{age} ]]>
|
|
|
- AND <![CDATA[ t7.max_age >= #{age} ]]>
|
|
|
+ AND <![CDATA[ t9.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t9.max_age >= #{age} ]]>
|
|
|
</if>
|
|
|
ORDER BY
|
|
|
- t7.diseaseId,
|
|
|
- t7.relationId,
|
|
|
- t7.order_no
|
|
|
+ t9.diseaseId,
|
|
|
+ t9.relationId,
|
|
|
+ t9.order_no,
|
|
|
+ t9.drug_c
|
|
|
</select>
|
|
|
-
|
|
|
</mapper>
|