DGHS Project

Looking for help?
< All Topics
Print

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
    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.
    Create New Openmrs 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>);
  • 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
      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

    Mapping between order type to FHIR Diagnostic Category
    [
    {"type":"Radiology Order","code":"RAD","display":"Radiology"},
    {"type":"Custom Order","code":"CUST","display":"Custom"}
    ]
Table of Contents