Skip to content

Commit

Permalink
BAH-3092 | added configurable param for primary diagnosis in OT module (
Browse files Browse the repository at this point in the history
  • Loading branch information
kavitha-sundararajan authored Aug 18, 2023
1 parent b4efd4e commit f3db896
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ui/app/ot/services/surgicalAppointmentService.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

angular.module('bahmni.ot')
.service('surgicalAppointmentService', ['$http', function ($http) {
.service('surgicalAppointmentService', ['$http', 'appService', function ($http, appService) {
this.getSurgeons = function () {
return $http.get(Bahmni.Common.Constants.providerUrl, {
method: "GET",
Expand Down Expand Up @@ -51,6 +51,7 @@ angular.module('bahmni.ot')
};

this.getSurgicalBlocksInDateRange = function (startDatetime, endDatetime, includeVoided, activeBlocks) {
var additionalCustomParam = appService.getAppDescriptor().getConfigValue("additionalCustomParam");
return $http.get(Bahmni.OT.Constants.addSurgicalBlockUrl, {
method: "GET",
params: {
Expand All @@ -61,7 +62,8 @@ angular.module('bahmni.ot')
v: "custom:(id,uuid," +
"provider:(uuid,person:(uuid,display),attributes:(attributeType:(display),value,voided))," +
"location:(uuid,name),startDatetime,endDatetime,surgicalAppointments:(id,uuid,patient:(uuid,display,person:(age))," +
"actualStartDatetime,actualEndDatetime,status,notes,sortWeight,bedNumber,bedLocation,surgicalAppointmentAttributes))"
"actualStartDatetime,actualEndDatetime,status,notes,sortWeight,bedNumber,bedLocation,surgicalAppointmentAttributes" +
(additionalCustomParam ? "," + additionalCustomParam : "") + "))"
},
withCredentials: true
});
Expand Down
9 changes: 8 additions & 1 deletion ui/test/unit/ot/services/surgicalAppointmentService.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
describe('surgicalAppointmentService', function () {
var surgicalAppointmentService;
var mockHttp = jasmine.createSpyObj('$http', ['get', 'post']);
var appService = jasmine.createSpyObj('appService', ['getAppDescriptor']);
var appDescriptor = jasmine.createSpyObj('appDescriptor', ['getConfigValue']);
appDescriptor.getConfigValue.and.returnValue({additionalCustomParam: ""});
appService.getAppDescriptor.and.returnValue(appDescriptor);

beforeEach(function () {
module('bahmni.ot');
module(function ($provide) {
$provide.value('$http', mockHttp);
$provide.value('appService', appService);
});

inject(['surgicalAppointmentService', function (surgicalAppointmentServiceInjected) {
Expand Down Expand Up @@ -87,6 +92,7 @@ describe('surgicalAppointmentService', function () {
startDatetime: toDateString("2039-08-26 12:00:00"), endDatetime: toDateString("2039-08-26 15:00:00"), surgicalAppointments: []}};
var startDatetime = toDateString("2039-08-26 12:00:00");
var endDatetime = toDateString("2039-08-26 15:00:00");
var additionalCustomParam = appService.getAppDescriptor().getConfigValue("additionalCustomParam");

mockHttp.get.and.returnValue(specUtil.respondWith(data));

Expand All @@ -100,7 +106,8 @@ describe('surgicalAppointmentService', function () {
expect(mockHttp.get.calls.mostRecent().args[1].params).toEqual({ startDatetime : '2039-08-26T12:00:00.000', endDatetime : '2039-08-26T15:00:00.000',includeVoided: false, activeBlocks: true, v: "custom:(id,uuid," +
"provider:(uuid,person:(uuid,display),attributes:(attributeType:(display),value,voided))," +
"location:(uuid,name),startDatetime,endDatetime,surgicalAppointments:(id,uuid,patient:(uuid,display,person:(age))," +
"actualStartDatetime,actualEndDatetime,status,notes,sortWeight,bedNumber,bedLocation,surgicalAppointmentAttributes))"});
"actualStartDatetime,actualEndDatetime,status,notes,sortWeight,bedNumber,bedLocation,surgicalAppointmentAttributes" +
(additionalCustomParam ? "," + additionalCustomParam : "") + "))"});
expect(mockHttp.get.calls.mostRecent().args[1].withCredentials).toBeTruthy();
});

Expand Down

0 comments on commit f3db896

Please sign in to comment.