diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml index 71c63a34a..5443eff69 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml @@ -61,15 +61,14 @@ GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json, drf.requester_id, drf.create_time, ap.name - HAVING CASE MIN(wsr.status_enum) - WHEN 1 THEN 0 - WHEN 2 THEN 1 - WHEN 3 THEN 4 - WHEN 4 THEN 4 - WHEN 5 THEN 5 - WHEN 6 THEN 5 - WHEN 7 THEN 5 - WHEN 8 THEN 6 + HAVING CASE + WHEN MIN(wsr.status_enum) = 1 THEN 0 + WHEN MIN(wsr.status_enum) = 2 THEN 1 + WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2 + WHEN MIN(wsr.status_enum) = 3 THEN 4 + WHEN MIN(wsr.status_enum) = 4 THEN 3 + WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7 + WHEN MIN(wsr.status_enum) = 8 THEN 6 ELSE NULL END = #{status}::integer