From 2581a367809482d51fc64e2b5fd237bd077037de Mon Sep 17 00:00:00 2001 From: steliomo Date: Mon, 30 Dec 2019 13:05:25 +0200 Subject: [PATCH] Bug fix on getting previous next encounter --- .../eptsreports/reporting/library/queries/TxRttQueries.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/TxRttQueries.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/TxRttQueries.java index e35df98f6c..6a465f6cf8 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/TxRttQueries.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/TxRttQueries.java @@ -59,6 +59,7 @@ class QUERY { + "WHERE p.voided = 0 AND e.voided = 0 AND o.voided = 0 AND o.concept_id = 1410 " + "AND e.encounter_type IN (6,9) AND e.encounter_datetime < :encounterDate AND e.location_id = :location AND p.patient_id = :patientId " + "GROUP BY p.patient_id)max_encounter INNER JOIN obs o ON max_encounter.patient_id = o.person_id " - + "AND o.concept_id = 1410 AND o.voided = 0 AND max_encounter.encounter_datetime = o.obs_datetime "; + + "AND o.concept_id = 1410 AND o.voided = 0 AND max_encounter.encounter_datetime = o.obs_datetime " + + "AND o.value_datetime IS NOT NULL;"; } }