diff --git a/configuration/globalproperties/gp_patient_queues.xml b/configuration/globalproperties/gp_patient_queues.xml new file mode 100644 index 0000000..b47cc55 --- /dev/null +++ b/configuration/globalproperties/gp_patient_queues.xml @@ -0,0 +1,124 @@ + + + + emrapi.sqlSearch.opd + 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' + + + emrapi.sqlSearch.ipd + 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' + + + emrapi.sqlSearch.emergency + 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' + + + emrapi.sqlSearch.opticalShop + 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' + + + emrapi.sqlSearch.labVisit + 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' + + + emrapi.sqlSearch.pharmacy + 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' + + + diff --git a/configuration/visittypes/visittypesBdsec.csv b/configuration/visittypes/visittypesBdsec.csv index df49674..330641c 100644 --- a/configuration/visittypes/visittypesBdsec.csv +++ b/configuration/visittypes/visittypesBdsec.csv @@ -1,6 +1,6 @@ Uuid,Void/Retire,Name,Description,_version:2 ,,OPD,Visit for Out patient, -,True,IPD,Visit for patients being admitted, +,,IPD,Visit for patients being admitted, ,,EMERGENCY,Visit for emergency patients, ,True,Special OPD,Visit for retrospective data entry, ,True,Follow Up,Visit for patients coming for a follow up,