Create a new Order Type. (There is no way to do it from UI, need to be done directly in DataBase using this SQL.)
INSERT INTO `openmrs`.`order_type` (`name`, `description`, `creator`, `date_created`, `retired`, `uuid`, `java_class_name`) VALUES (<Name of Order Type>, <Order type Description>, '1', now(), '0', uuid(), 'org.openmrs.Order'); |
Create a mapping between created Order Type and the concept_class of Order Type.
INSERT INTO `openmrs`.`order_type_class_map` (`order_type_id`, `concept_class_id`) VALUES (<New Order Type ID>, <Concept Class ID of Concept Class>); |
In bahmni_apps/orders/extention.json add a config like below. It's an example for Procedure Orders.
"bahmni_clinical_patients_search_ProcedureOrder": { "id": "bahmni.clinical.patients.search.procedureOrder", "extensionPointId": "org.bahmni.patient.search", "type": "config", "extensionParams": { "searchHandler": "emrapi.sqlSearch.active.procedureOrder", "translationKey": "Procedures", "forwardUrl": "../orders/#/patient/{{patientUuid}}/fulfillment/Procedure Order", "forwardButtonTitle": "View", "view": "tabular" }, "label": "Procedure Order", "order": 1, "requiredPrivilege": "app:orders" } |
Add a global property in OpenmrsAdvance Setting same as the value of SearchHandler key in above config. In above case it will be emrapi.sqlSearch.active.procedureOrder with value below.
SELECT DISTINCT Concat(pn.given_name,' ', pn.family_name) AS name, pi.identifier, Concat("",p.uuid) AS uuid, Date_format(o.date_activated,'%b %d %Y %h:%i %p') AS 'Order Placed on' FROM orders o JOIN person_name pn ON o.patient_id = pn.person_id JOIN patient_identifier pi ON o.patient_id = pi.patient_id AND pi.identifier_type = (select patient_identifier_type_id from patient_identifier_type where name = 'Patient Identifier') JOIN person p ON o.patient_id = p.person_id LEFT OUTER JOIN obs ob ON o.order_id = ob.order_id JOIN concept c ON o.concept_id = c.concept_id JOIN concept_name cn ON c.concept_id = cn.concept_id AND cn.concept_name_type='FULLY_SPECIFIED' INNER JOIN order_type ot ON ot.order_type_id = o.order_type_id INNER JOIN encounter enc on o.encounter_id = enc.encounter_id AND enc.location_id in (select l.location_id from location l where l.location_id = <location_id of hospital> or l.parent_location = <location_id of hospital>) AND ot.NAME = <Name of Order Type> group by pi.identifier; |
The above SQL is used to fetch orders to be fulfilled on order fulfillment page.
To be able to upload these orders to SHR we should add a mapping for openmrs order type to FHIR Diagnostic Order Category.
goto Openmrs → Administration → Maintanence → Settings → SHR. Add a new mapping for property in bellow format
[ {"type":"Radiology Order","code":"RAD","display":"Radiology"}, {"type":"Custom Order","code":"CUST","display":"Custom"} ] |