From b44c8b95892863fe4f4fc86368999442ffdc15f0 Mon Sep 17 00:00:00 2001 From: Himabindu T Date: Thu, 13 Aug 2020 16:58:53 +0530 Subject: [PATCH] Bindu, Rakesh | MOBN-1423 | Error in bahmni-mart bed_management_locations_view (#32) --- src/main/resources/procedureSql/dischargeDateProc.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/procedureSql/dischargeDateProc.sql b/src/main/resources/procedureSql/dischargeDateProc.sql index 49e1931d..9261e87b 100644 --- a/src/main/resources/procedureSql/dischargeDateProc.sql +++ b/src/main/resources/procedureSql/dischargeDateProc.sql @@ -12,10 +12,10 @@ FROM bed_patient_assignment_default bpam WHERE bpam.location = locationName AND patient_id = patientId AND date_started = dateStopped LIMIT 1; -if current_patient = patientId AND curr_start_date = dateStopped THEN +if current_patient = patientId AND curr_start_date = dateStopped AND curr_start_date != curr_stop_date THEN RETURN discharge_date(current_patient, locationName, curr_stop_date); ELSE RETURN dateStopped; END IF ; END; -$$ LANGUAGE plpgsql; \ No newline at end of file +$$ LANGUAGE plpgsql;