-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5b56a5
commit f59e071
Showing
2 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<config> | ||
<globalProperties> | ||
<globalProperty> | ||
<property>emrapi.sqlSearch.opd</property> | ||
<value>select name, identifier,uuid, activeVisitUuid, hasBeenAdmitted from ( | ||
select distinct concat(pn.given_name,' ', ifnull(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, vt.visit_type_id as 'visitType', | ||
vt.name as 'visitTypeName' | ||
from visit v | ||
join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 | ||
join patient_identifier pi on v.patient_id = pi.patient_id | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property="bahmni.primaryIdentifierType" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id | ||
join location l on l.uuid = ${visit_location_uuid} and v.location_id = l.location_id | ||
join visit_type vt on v.visit_type_id = vt.visit_type_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 | ||
)tMOPDVisits where visitTypeName = 'OPD'</value> | ||
</globalProperty> | ||
<globalProperty> | ||
<property>emrapi.sqlSearch.ipd</property> | ||
<value>select name, identifier,uuid, activeVisitUuid, hasBeenAdmitted from ( | ||
select distinct concat(pn.given_name,' ', ifnull(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, vt.visit_type_id as 'visitType', | ||
vt.name as 'visitTypeName' | ||
from visit v | ||
join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 | ||
join patient_identifier pi on v.patient_id = pi.patient_id | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property="bahmni.primaryIdentifierType" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id | ||
join location l on l.uuid = ${visit_location_uuid} and v.location_id = l.location_id | ||
join visit_type vt on v.visit_type_id = vt.visit_type_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 | ||
)tMOPDVisits where visitTypeName = 'IPD'</value> | ||
</globalProperty> | ||
<globalProperty> | ||
<property>emrapi.sqlSearch.emergency</property> | ||
<value>select name, identifier,uuid, activeVisitUuid, hasBeenAdmitted from ( | ||
select distinct concat(pn.given_name,' ', ifnull(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, vt.visit_type_id as 'visitType', | ||
vt.name as 'visitTypeName' | ||
from visit v | ||
join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 | ||
join patient_identifier pi on v.patient_id = pi.patient_id | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property="bahmni.primaryIdentifierType" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id | ||
join location l on l.uuid = ${visit_location_uuid} and v.location_id = l.location_id | ||
join visit_type vt on v.visit_type_id = vt.visit_type_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 | ||
)tMOPDVisits where visitTypeName = 'EMERGENCY'</value> | ||
</globalProperty> | ||
<globalProperty> | ||
<property>emrapi.sqlSearch.opticalShop</property> | ||
<value>select name, identifier,uuid, activeVisitUuid, hasBeenAdmitted from ( | ||
select distinct concat(pn.given_name,' ', ifnull(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, vt.visit_type_id as 'visitType', | ||
vt.name as 'visitTypeName' | ||
from visit v | ||
join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 | ||
join patient_identifier pi on v.patient_id = pi.patient_id | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property="bahmni.primaryIdentifierType" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id | ||
join location l on l.uuid = ${visit_location_uuid} and v.location_id = l.location_id | ||
join visit_type vt on v.visit_type_id = vt.visit_type_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 | ||
)tMOPDVisits where visitTypeName = 'Optical shop'</value> | ||
</globalProperty> | ||
<globalProperty> | ||
<property>emrapi.sqlSearch.labVisit</property> | ||
<value>select name, identifier,uuid, activeVisitUuid, hasBeenAdmitted from ( | ||
select distinct concat(pn.given_name,' ', ifnull(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, vt.visit_type_id as 'visitType', | ||
vt.name as 'visitTypeName' | ||
from visit v | ||
join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 | ||
join patient_identifier pi on v.patient_id = pi.patient_id | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property="bahmni.primaryIdentifierType" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id | ||
join location l on l.uuid = ${visit_location_uuid} and v.location_id = l.location_id | ||
join visit_type vt on v.visit_type_id = vt.visit_type_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 | ||
)tMOPDVisits where visitTypeName = 'LAB VISIT'</value> | ||
</globalProperty> | ||
<globalProperty> | ||
<property>emrapi.sqlSearch.pharmacy</property> | ||
<value>select name, identifier,uuid, activeVisitUuid, hasBeenAdmitted from ( | ||
select distinct concat(pn.given_name,' ', ifnull(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, vt.visit_type_id as 'visitType', | ||
vt.name as 'visitTypeName' | ||
from visit v | ||
join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 | ||
join patient_identifier pi on v.patient_id = pi.patient_id | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property="bahmni.primaryIdentifierType" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id | ||
join location l on l.uuid = ${visit_location_uuid} and v.location_id = l.location_id | ||
join visit_type vt on v.visit_type_id = vt.visit_type_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 | ||
)tMOPDVisits where visitTypeName = 'Pharmacy'</value> | ||
</globalProperty> | ||
</globalProperties> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters