Looking for help?
Steps to setup new Openmrs Order Type
- Create a new Order Type. (There is no way to do it from UI, need to be done directly in DataBase using this SQL.)
Create New Openmrs Order Type
INSERTINTO`openmrs`.`order_type` (`name`, `description`, `creator`, `date_created`, `retired`, `uuid`,`java_class_name`)VALUES(<NameofOrderType>, <Ordertype Description>,'1', now(),'0',uuid(),'org.openmrs.Order'); - Create a mapping between created Order Type and the concept_class of Order Type.
Create New Openmrs Order Type
INSERTINTO`openmrs`.`order_type_class_map` (`order_type_id`, `concept_class_id`)VALUES(<NewOrderType ID>, <Concept Class IDofConcept Class>); - To show this orders of this type of orders inBahmni Orders tab you need to do the following
- Create a new Concept as class ConvSet and datatype NA. Add it to All Orderable. This will appear as a separate type of order.
- Create new concepts(class ConvSet, datatype NA) and add it to above concept as set member to classify orders in different groups like blood, stool etc.
- Add Orders as set members to concepts created above according to their class.
- To show these orders to orders app
- Create a concept(class ConvSet, datatype NA) called <Name of Order Type> + ‘ Fulfillment Form‘. E.g. :- Procedure Order Fulfillment Form.
- Add the templated to be fulfilled as a member of above concept.
- In bahmni_apps/orders/extention.json add a config like below. It’s an example for Procedure Orders.
Config to show the order fulfilment in orders tab
"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.
Create New Openmrs Order Type
SELECTDISTINCTConcat(pn.given_name,' ', pn.family_name)ASname,pi.identifier,Concat("",p.uuid)ASuuid,Date_format(o.date_activated,'%b %d %Y %h:%i %p')AS'Order Placed on'FROMorders oJOINperson_name pnONo.patient_id = pn.person_idJOINpatient_identifier piONo.patient_id = pi.patient_idANDpi.identifier_type = (selectpatient_identifier_type_idfrompatient_identifier_typewherename='Patient Identifier')JOINperson pONo.patient_id = p.person_idLEFTOUTERJOINobs obONo.order_id = ob.order_idJOINconcept cONo.concept_id = c.concept_idJOINconcept_name cnONc.concept_id = cn.concept_idANDcn.concept_name_type='FULLY_SPECIFIED'INNERJOINorder_type otONot.order_type_id = o.order_type_idINNERJOINencounter encono.encounter_id = enc.encounter_idANDenc.location_idin(selectl.location_idfromlocation lwherel.location_id = <location_idofhospital>orl.parent_location = <location_idofhospital>)ANDot.NAME= <NameofOrderType>groupbypi.identifier;The above SQL is used to fetch orders to be fulfilled on order fulfillment page.
- 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.
- 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
Mapping between order type to FHIR Diagnostic Category[{"type":"Radiology Order","code":"RAD","display":"Radiology"},{"type":"Custom Order","code":"CUST","display":"Custom"}]