Advanced Setting Query Not Working after Upgrading Bahmni / OpenMRS

I have the following query which was working fine in Bahmni 0.88. The purpose of this query is to return list of patients for a particular visit.

select distinct concat(pn.given_name," ", pn.family_name) as name,  pi.identifier as identifier,  concat("",p.uuid) as uuid,  concat("",v.uuid) as activeVisitUuid,  IF(va.value_reference = "Admitted", "true", "false") as hasBeenAdmitted  
from  visit v join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 and v.voided=0    join patient_identifier pi on v.patient_id = pi.patient_id and pi.voided=0    join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id    join global_property gp on"emr.primaryIdentifierType" and gp.property_value=pit.uuid    join person p on p.person_id = v.patient_id  and p.voided=0    join encounter en on en.visit_id = v.visit_id and en.voided=0    left outer join location loc on en.location_id = loc.location_id    join encounter_provider ep on ep.encounter_id = en.encounter_id  and ep.voided=0    join provider pr on ep.provider_id=pr.provider_id and pr.retired=0    join person per on pr.person_id=per.person_id and per.voided=0    left outer join visit_attribute va on va.visit_id = v.visit_id and va.attribute_type_id = (                 select visit_attribute_type_id from visit_attribute_type where name="Admission Status"             )  where    v.date_stopped is null and    v.visit_type_id = 19 order by en.encounter_datetime desc

As soon as I upgraded to 0.89 the query returns 0 result.

Any idea what might have changed in the new version ? How can I solved this ?


Instead of emr.primaryIdentifierType try using bahmni.primaryIdentifierType in the query. Till 0.88 bahmni.primaryIdentifierType was called as emr.primaryIdentifierType

1 Like