Custom Controls

Purpose

Bahmni allows implementers to create their own Custom Controls. The examples include:

Configuration

Where to Configure ?

Add to clinical/dashboard.json for it to appear on the patient dashboard or Add to clinical/visit.json for it to appear on the visit dashboard.


Sample Configuration

Config
"customControl": {
            "type": "custom",
            "config": {
                "title": "Title of the Control",
                "template": "<directive-name></directive-name>"
            }
       }

Key Field Table

KeyInformationMandatory
type

type of the section or control.

type should be "custom"

Yes
config

Configuration for the custom display control.

keyInformationMandatory
titletitle to be displayedYes
templatethe directive to be used to show the controlYes
Yes



Bahmni allows implementers to create their own custom display control.

Custom Control on Visit Dashboard

The following configuration needs to be added in visit.json (openmrs/apps/clinical/visit.json) to display the custom display control in different visit tabs.

Consider the following example to configure the birth certificate:

"birthCertificate": {
    "title": "Birth Certificate",
    "printing": {
        "title": "Bahmni",
        "header": "Certificate",
        "logo": "../images/bahmniLogo.png"
    },
    "sections": {
        "Birth Certificate": {
            "type": "custom",
            "config": {
                "title": "Birth Certificate",
                "template": "<birth-certificate></birth-certificate>"
            }
        }
    }
}
KeyInformation
titleTitle of the visit tab.Y

printing

Add printing section to enable the print button on visit page.Y

title - Title in print out.

header - Header in print out.

logo - Logo to display in print out.
type"custom" (Required and should always be custom)Y
configconfiguration for the custom display control.

title - title of the custom directive

Y

template - the directive which you want to show.Y


Custom control on Patient Dashboard

The following configuration needs to be added under sections in dashboard.json (openmrs/apps/clinical/dashboard.json) to display the custom display control in different dashboard tabs.

Consider the following example to configure the birth certificate:

"General": {
    "translationKey": "DASHBOARD_TAB_GENERAL_KEY",
    "sections": {
        "Birth Certificate": {
            "type": "custom",
            "config": {
                "title": "Birth Certificate",
                "template": "<birth-certificate></birth-certificate>"
            }
        }
    }
}
KeyInformationMandatory
type*"custom" (Required and should always be custom)Y
config

configuration for the custom display control.

keyInformation
titletitle of the custom directiveY
templatethe directive which you want to showY

Bahmni provides customDisplayControl module which provides basic connection between the application and configuration.

You can add new directives as per your requirement in the "openmrs/apps/customDisplayControl/js/customControl.js" file. (Make sure you can create new custom directives only in the existing file)

New directives should be under the same module. ("bahmni.common.displaycontrol.custom"). The scope of the new directive will have patient, visitUuid and config.


1. Make sure you don't create a different file for new directives (all custom directives should be in the same file.)
2. Don't forget to change the contentUrl to the html file you are referring to.

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)