wangzl 1 місяць тому
батько
коміт
1050297848

+ 14 - 21
tr-modules/tr-module-smartFollowUp/src/main/resources/mapper/smart/BizReasearchQueueClinicMapper.xml

@@ -130,29 +130,22 @@
     </select>
     <select id="stdSelectClinicAndPatientList"
             resultType="cn.tr.module.smart.common.controller.vo.BizReasearchQueueClinicAndPatientVO">
-        SELECT
-        bp.id,
-        bcr.patient_name AS NAME,
-        bcr.patient_age AS age,
-        bcr.patient_gender AS gender,
-        bcr.clinic_name AS clinicName,
-        bcr.clinic_start_time AS clinicStartTime,
-        bp.current_clinic_id AS currentClinicId,
-        bp.create_by AS create_by,
-        bp.create_time AS create_time,
-        bp.update_time AS update_time,
-        bp.update_by AS update_by
-        FROM
-        biz_patient bp
-        LEFT JOIN biz_clinic_room bcr ON bp.current_clinic_id = bcr.id
-        LEFT JOIN biz_reasearch_queue_clinic bqc ON bcr.id = bqc.clinic_room_id
+        SELECT bcr.ID,
+               bcr.patient_name      AS name,
+               bcr.patient_age       AS age,
+               bcr.patient_gender    AS gender,
+               bcr.clinic_name       AS clinicName,
+               bcr.clinic_start_time AS clinicStartTime,
+               bcr.ID                AS currentClinicId,
+               bcr.create_by         AS create_by,
+               bcr.create_time       AS create_time,
+               bcr.update_time       AS update_time,
+               bcr.update_by         AS update_by
+        FROM biz_clinic_room bcr
         <where>
             bcr.deleted = 0
-            <if test="query.queueId != null and query.queueId != ''">
-                AND COALESCE ( bqc.queue_id, '' ) NOT IN ( #{query.queueId})
-            </if>
-            <if test="query.condition != null and query.condition != ''">
-                AND bcr.patient_name LIKE CONCAT('%', #{query.condition}, '%')
+            <if test="query.queueId != null and query.queueId != '' ">
+                AND NOT EXISTS (SELECT 1  FROM biz_reasearch_queue_clinic brqc WHERE brqc.queue_id = #{query.queueId}  AND brqc.clinic_room_id = bcr.id)
             </if>
         </where>
     </select>