Bahmni allows implementers to design their own Custom Display Controls. The Custom Display Control can be styled in a way to give requisite Custom Prints. This is unlike other implementation specific Display Controls. Bahmni provides this functionality to avoid the hassle of multiple types of styling and because it is much easier to design a display control that can be used to display Custom Prints.
Hence the terms Custom Display Controls and Custom prints are used interchangeably.
Steps
General Guidelines for Custom Prints
A different file should not be created for new directives. All custom directives should be in the same file.
The contentUrl should be changed to point to the html file that is being referred to.
Consider configuring a "Birth Certificate" that is to be displayed in the Visit tab and that will be printed as a Custom Print. Similar steps can be used to configure other Custom Prints.
1) Configure "Birth certificate" as a Custom Display Control.
4) New directives should be under the same module "bahmni.common.displaycontrol.custom". The scope of the new directive should have patient, visitUuid and config.
5) "birthCertificate" is added as new a directive in the following example:
'use strict';
angular.module('bahmni.common.displaycontrol.custom')
.directive('birthCertificate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["HEIGHT"];
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/birthCertificate.html";
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
}));
};
return {
restrict: 'E',
template: '<ng-include src="contentUrl"/>',
link: link
}
}])
In the above example, new concept names are configured in the variable conceptNames.