Skip to content

Commit

Permalink
BAH-3052 | Refactored query to contain all extraIdentifier values
Browse files Browse the repository at this point in the history
  • Loading branch information
SanoferSameera committed Jun 12, 2023
1 parent 49a2e7a commit fc8218f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions masterdata/configuration/globalproperties/gp_registration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<property>emrapi.sqlSearch.activePatients</property>
<value>select distinct concat(pn.given_name," ", ifnull(pn.family_name,"")) as name,
primaryIdentifier.identifier as identifier,
IF(extraIdentifier.identifier IS NULL OR extraIdentifier.identifier = '', primaryIdentifier.identifier, extraIdentifier.identifier) as "extraIdentifierVal",
group_concat(extraIdentifier.identifier) as extraIdentifierVal,
group_concat(extraIdentifier.name) as extraIdentifiers,
concat("",p.uuid) as uuid,
concat("",v.uuid) as activeVisitUuid,
IF(va.value_reference = "Admitted", "true", "false") as hasBeenAdmitted
Expand All @@ -24,15 +25,15 @@ from visit v
join patient_identifier_type pit on pri.identifier_type = pit.patient_identifier_type_id
join global_property gp on gp.property="bahmni.primaryIdentifierType" and gp.property_value=pit.uuid) primaryIdentifier
ON v.patient_id = primaryIdentifier.patient_id
left outer JOIN (SELECT ei.patient_id, ei.identifier
left outer JOIN (SELECT ei.patient_id, ei.identifier, pit.name
FROM patient_identifier ei
join patient_identifier_type pit on ei.identifier_type = pit.patient_identifier_type_id
join global_property gp on gp.property="bahmni.extraPatientIdentifierTypes" and pit.uuid=left(gp.property_value, 36)) extraIdentifier
ON v.patient_id = extraIdentifier.patient_id
join global_property gp on gp.property="bahmni.extraPatientIdentifierTypes" and locate(pit.uuid,gp.property_value) != 0) extraIdentifier
ON v.patient_id = extraIdentifier.patient_id
join location l on l.uuid = ${visit_location_uuid} and v.location_id = l.location_id
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") and va.voided = 0
where v.date_stopped is null AND v.voided = 0;</value>
where v.date_stopped is null AND v.voided = 0 group by identifier;</value>
</globalProperty>
<globalProperty>
<property>order.durationUnitsConceptUuid</property>
Expand Down
2 changes: 1 addition & 1 deletion openmrs/apps/clinical/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
],
"config": {
"preferExtraIdInSearchResults": true,
"preferredExtraIdInSearchResults": "ABHA Number",
"allowAdhocTeleConsultation": true,
"defaultVisitType":"OPD",
"teleConsultationDomain": "meet.jit.si",
Expand Down

0 comments on commit fc8218f

Please sign in to comment.