diff --git a/ui/app/clinical/common/services/treatmentService.js b/ui/app/clinical/common/services/treatmentService.js index dc867bc140..85797e9fa1 100644 --- a/ui/app/clinical/common/services/treatmentService.js +++ b/ui/app/clinical/common/services/treatmentService.js @@ -36,6 +36,16 @@ angular.module('bahmni.clinical') }); }; + var getMedicationSchedulesForOrders = function (patientUuid, orderUuids) { + return $http.get(Bahmni.Common.Constants.medicationSchedulesForOrders, { + params: { + patientUuid: patientUuid, + orderUuids: orderUuids + }, + withCredentials: true + }); + }; + var getConfig = function () { return $http.get(Bahmni.Common.Constants.drugOrderConfigurationUrl, { withCredentials: true @@ -102,7 +112,7 @@ angular.module('bahmni.clinical') var getAllDrugOrdersFor = function (patientUuid, conceptSetToBeIncluded, conceptSetToBeExcluded, isActive, patientProgramUuid) { var deferred = $q.defer(); - var params = {patientUuid: patientUuid}; + var params = { patientUuid: patientUuid }; if (conceptSetToBeIncluded) { params.includeConceptSet = conceptSetToBeIncluded; } @@ -155,7 +165,7 @@ angular.module('bahmni.clinical') }]; var subject = "Prescription for consultation at " + $rootScope.facilityLocation.name + " on " + $filter("bahmniDate")(prescriptionDetails.visitDate); var body = transmissionService.getSharePrescriptionMailContent(prescriptionDetails); - var emailUrl = appService.getAppDescriptor().formatUrl(Bahmni.Common.Constants.sendViaEmailUrl, {'patientUuid': prescriptionDetails.patient.uuid}); + var emailUrl = appService.getAppDescriptor().formatUrl(Bahmni.Common.Constants.sendViaEmailUrl, { 'patientUuid': prescriptionDetails.patient.uuid }); transmissionService.sendEmail(attachments, subject, body, emailUrl, [], []); }); renderAndSendPromise.resolve(); @@ -195,7 +205,7 @@ angular.module('bahmni.clinical') var printParams = appService.getAppDescriptor().getConfigValue("prescriptionPrint") || {}; var templateUrl = appService.getAppDescriptor().getConfigValue("prescriptionPrintTemplateUrl") || '../common/displaycontrols/prescription/views/prescription.html'; var fileName = patient.givenName + patient.familyName + "_" + patient.identifier + "_Prescription"; - printer.print(templateUrl, {patient: patient, encounterDrugOrderMap: encounterDrugOrderMap, printParams: printParams, additionalInfo: additionalInfo }, fileName); + printer.print(templateUrl, { patient: patient, encounterDrugOrderMap: encounterDrugOrderMap, printParams: printParams, additionalInfo: additionalInfo }, fileName); } }; @@ -204,6 +214,7 @@ angular.module('bahmni.clinical') getConfig: getConfig, getPrescribedDrugOrders: getPrescribedDrugOrders, getPrescribedAndActiveDrugOrders: getPrescribedAndActiveDrugOrders, + getMedicationSchedulesForOrders: getMedicationSchedulesForOrders, getNonCodedDrugConcept: getNonCodedDrugConcept, getAllDrugOrdersFor: getAllDrugOrdersFor, voidDrugOrder: voidDrugOrder, diff --git a/ui/app/clinical/consultation/controllers/addTreatmentController.js b/ui/app/clinical/consultation/controllers/addTreatmentController.js index ddaf74d53e..8dee1bcf66 100644 --- a/ui/app/clinical/consultation/controllers/addTreatmentController.js +++ b/ui/app/clinical/consultation/controllers/addTreatmentController.js @@ -5,8 +5,8 @@ angular.module('bahmni.clinical') '$timeout', 'clinicalAppConfigService', 'ngDialog', '$window', 'messagingService', 'appService', 'activeDrugOrders', 'orderSetService', '$q', 'locationService', 'spinner', '$translate', function ($scope, $rootScope, contextChangeHandler, treatmentConfig, drugService, $timeout, - clinicalAppConfigService, ngDialog, $window, messagingService, appService, activeDrugOrders, - orderSetService, $q, locationService, spinner, $translate) { + clinicalAppConfigService, ngDialog, $window, messagingService, appService, activeDrugOrders, + orderSetService, $q, locationService, spinner, $translate) { var DateUtil = Bahmni.Common.Util.DateUtil; var DrugOrderViewModel = Bahmni.Clinical.DrugOrderViewModel; var scrollTop = _.partial($window.scrollTo, 0, 0); @@ -139,7 +139,7 @@ angular.module('bahmni.clinical') var existingTreatment = false; angular.forEach($scope.consultation.discontinuedDrugs, function (drugOrder) { existingTreatment = _.some($scope.treatments, function (treatment) { - return treatment.getDisplayName() === drugOrder.getDisplayName(); + return treatment.getDisplayName() === drugOrder.getDisplayName() && treatment.careSetting === drugOrder.careSetting; }) && drugOrder.isMarkedForDiscontinue; }); return existingTreatment; @@ -186,7 +186,7 @@ angular.module('bahmni.clinical') setSortWeightForOrderSetDrugs(refilledOrderGroupOrders); // Fetch the orderSet for the drugOrder - var matchedOrderSet = _.find(orderSets, {uuid: drugOrder.orderSetUuid}); + var matchedOrderSet = _.find(orderSets, { uuid: drugOrder.orderSetUuid }); // Find the drugs in ordered DrugOrderSet which matches with the matchedOrderSet SetMembers var orderSetMembersOfMatchedOrderSet = matchedOrderSet.orderSetMembers; @@ -208,11 +208,11 @@ angular.module('bahmni.clinical') var baseDose = eachMember.orderTemplate.dosingInstructions.dose; var drugName = eachMember.orderTemplate.concept.name; return orderSetService.getCalculatedDose($scope.patient.uuid, drugName, baseDose, doseUnits, $scope.newOrderSet.name) - .then(function (calculatedDosage) { - refilledOrderGroupOrders[index].uniformDosingType.dose = calculatedDosage.dose; - refilledOrderGroupOrders[index].uniformDosingType.doseUnits = calculatedDosage.doseUnit; - refilledOrderGroupOrders[index].calculateQuantityAndUnit(); - }); + .then(function (calculatedDosage) { + refilledOrderGroupOrders[index].uniformDosingType.dose = calculatedDosage.dose; + refilledOrderGroupOrders[index].uniformDosingType.doseUnits = calculatedDosage.doseUnit; + refilledOrderGroupOrders[index].calculateQuantityAndUnit(); + }); } }); @@ -261,6 +261,10 @@ angular.module('bahmni.clinical') refillDrugOrders(drugOrders); }); + $scope.$on("event:updateDrugOrderType", function (event, drugOrder) { + $scope.treatments.push(drugOrder); + }); + $scope.$on("event:discontinueDrugOrder", function (event, drugOrder) { drugOrder.isMarkedForDiscontinue = true; drugOrder.isEditAllowed = false; @@ -370,23 +374,23 @@ angular.module('bahmni.clinical') var getConflictingDrugOrder = function (newDrugOrder) { var allDrugOrders = $scope.treatments.concat($scope.orderSetTreatments); allDrugOrders = _.reject(allDrugOrders, newDrugOrder); - var unsavedNotBeingEditedOrders = _.filter(allDrugOrders, {isBeingEdited: false}); + var unsavedNotBeingEditedOrders = _.filter(allDrugOrders, { isBeingEdited: false }); var existingDrugOrders; if (newDrugOrder.isBeingEdited) { - existingDrugOrders = _.reject($scope.consultation.activeAndScheduledDrugOrders, {uuid: newDrugOrder.previousOrderUuid}); + existingDrugOrders = _.reject($scope.consultation.activeAndScheduledDrugOrders, { uuid: newDrugOrder.previousOrderUuid }); } else { existingDrugOrders = $scope.consultation.activeAndScheduledDrugOrders; } existingDrugOrders = existingDrugOrders.concat(unsavedNotBeingEditedOrders); var potentiallyOverlappingOrders = existingDrugOrders.filter(function (drugOrder) { - return (drugOrder.getDisplayName() === newDrugOrder.getDisplayName() && drugOrder.overlappingScheduledWith(newDrugOrder)); + return (drugOrder.getDisplayName() === newDrugOrder.getDisplayName() && drugOrder.overlappingScheduledWith(newDrugOrder) && newDrugOrder.careSetting === drugOrder.careSetting); }); setEffectiveDates(newDrugOrder, potentiallyOverlappingOrders); var alreadyActiveSimilarOrders = existingDrugOrders.filter(function (drugOrder) { - return (drugOrder.getDisplayName() === newDrugOrder.getDisplayName() && drugOrder.overlappingScheduledWith(newDrugOrder)); + return (drugOrder.getDisplayName() === newDrugOrder.getDisplayName() && drugOrder.overlappingScheduledWith(newDrugOrder) && newDrugOrder.careSetting === drugOrder.careSetting); }); if (alreadyActiveSimilarOrders.length > 0) { @@ -488,16 +492,16 @@ angular.module('bahmni.clinical') var contextChange = function () { var errorMessages = Bahmni.Clinical.Constants.errorMessages; if (isSameDrugBeingDiscontinuedAndOrdered()) { - return {allow: false, errorMessage: $translate.instant(errorMessages.discontinuingAndOrderingSameDrug)}; + return { allow: false, errorMessage: $translate.instant(errorMessages.discontinuingAndOrderingSameDrug) }; } if ($scope.incompleteDrugOrders()) { $scope.formInvalid = true; - return {allow: false}; + return { allow: false }; } if ($scope.unaddedDrugOrders()) { - return {allow: false, errorMessage: $translate.instant(errorMessages.incompleteForm)}; + return { allow: false, errorMessage: $translate.instant(errorMessages.incompleteForm) }; } - return {allow: true}; + return { allow: true }; }; var setIsNotBeingEdited = function (treatment) { @@ -607,7 +611,7 @@ angular.module('bahmni.clinical') $scope.consultation.newlyAddedTreatments = allTreatmentsAcrossTabs.concat(includedOrderSetTreatments); if ($scope.consultation.discontinuedDrugs) { $scope.consultation.discontinuedDrugs.forEach(function (discontinuedDrug) { - var removableOrder = _.find(activeDrugOrders, {uuid: discontinuedDrug.uuid}); + var removableOrder = _.find(activeDrugOrders, { uuid: discontinuedDrug.uuid }); if (discontinuedDrug) { removableOrder.orderReasonText = discontinuedDrug.orderReasonText; removableOrder.dateActivated = null; @@ -721,7 +725,7 @@ angular.module('bahmni.clinical') }); ngDialog.open({ template: 'consultation/views/treatmentSections/conflictingOrderSet.html', - data: {'conflictingDrugOrders': conflictingDrugOrders} + data: { 'conflictingDrugOrders': conflictingDrugOrders } }); $scope.popupActive = true; }; @@ -752,7 +756,7 @@ angular.module('bahmni.clinical') drugOrder.include = false; ngDialog.open({ template: 'consultation/views/treatmentSections/conflictingOrderSet.html', - data: {'conflictingDrugOrders': [conflictingDrugOrder]} + data: { 'conflictingDrugOrders': [conflictingDrugOrder] } }); $scope.popupActive = true; } @@ -762,7 +766,7 @@ angular.module('bahmni.clinical') var mergeActiveAndScheduledWithDiscontinuedOrders = function () { _.each($scope.consultation.discontinuedDrugs, function (discontinuedDrug) { - _.remove($scope.consultation.activeAndScheduledDrugOrders, {'uuid': discontinuedDrug.uuid}); + _.remove($scope.consultation.activeAndScheduledDrugOrders, { 'uuid': discontinuedDrug.uuid }); $scope.consultation.activeAndScheduledDrugOrders.push(discontinuedDrug); }); }; @@ -770,7 +774,7 @@ angular.module('bahmni.clinical') var showRulesInMedication = function (medicationConfig) { $scope.showRulesInMedication = false; if (medicationConfig !== 'undefined' && medicationConfig.tabConfig !== 'undefined' && medicationConfig.tabConfig.allMedicationTabConfig - !== 'undefined' && medicationConfig.tabConfig.allMedicationTabConfig.orderSet !== 'undefined') { + !== 'undefined' && medicationConfig.tabConfig.allMedicationTabConfig.orderSet !== 'undefined') { if (medicationConfig.tabConfig.allMedicationTabConfig.orderSet.showRulesInMedication) { $scope.showRulesInMedication = true; } diff --git a/ui/app/clinical/consultation/controllers/drugOrderHistoryController.js b/ui/app/clinical/consultation/controllers/drugOrderHistoryController.js index 27ba7e7948..3e3f9f45f6 100644 --- a/ui/app/clinical/consultation/controllers/drugOrderHistoryController.js +++ b/ui/app/clinical/consultation/controllers/drugOrderHistoryController.js @@ -4,7 +4,7 @@ angular.module('bahmni.clinical') .controller('DrugOrderHistoryController', ['$scope', '$filter', '$stateParams', 'activeDrugOrders', 'appService', 'treatmentConfig', 'treatmentService', 'spinner', 'drugOrderHistoryHelper', 'visitHistory', '$translate', '$rootScope', 'providerService', function ($scope, $filter, $stateParams, activeDrugOrders, appService, treatmentConfig, treatmentService, spinner, - drugOrderHistoryHelper, visitHistory, $translate, $rootScope, providerService) { + drugOrderHistoryHelper, visitHistory, $translate, $rootScope, providerService) { var DrugOrderViewModel = Bahmni.Clinical.DrugOrderViewModel; var DateUtil = Bahmni.Common.Util.DateUtil; var currentVisit = visitHistory.activeVisit; @@ -17,8 +17,24 @@ angular.module('bahmni.clinical') $scope.selectedDrugs = {}; if ($scope.enableIPDFeature) { - $scope.toggleCareSetting = function (drugOrder) { - drugOrder.careSetting = drugOrder.careSetting === Bahmni.Clinical.Constants.careSetting.inPatient ? Bahmni.Clinical.Constants.careSetting.outPatient : Bahmni.Clinical.Constants.careSetting.inPatient; + $scope.updateOrderType = function (drugOrder) { + var updatedDrugOrder = angular.copy(drugOrder); + updatedDrugOrder.careSetting = updatedDrugOrder.careSetting === Bahmni.Clinical.Constants.careSetting.outPatient ? Bahmni.Clinical.Constants.careSetting.inPatient : Bahmni.Clinical.Constants.careSetting.outPatient; + if (updatedDrugOrder.previousOrderUuid !== undefined) { + updatedDrugOrder.previousOrderUuid = null; + updatedDrugOrder.scheduledDate = null; + } + $rootScope.$broadcast("event:updateDrugOrderType", updatedDrugOrder); + $rootScope.$broadcast("event:discontinueDrugOrder", drugOrder); + }; + + $scope.disableIPDButton = function (drugOrder) { + return ($scope.medicationSchedules && + $scope.medicationSchedules.some(function (schedule) { + return schedule.order.uuid === drugOrder.uuid; + })) || + !drugOrder.isActive() || !drugOrder.isDiscontinuedAllowed || + $scope.consultation.encounterUuid !== drugOrder.encounterUuid; }; } @@ -64,6 +80,7 @@ angular.module('bahmni.clinical') if (treatmentConfig.drugOrderHistoryConfig.numberOfVisits !== undefined && treatmentConfig.drugOrderHistoryConfig.numberOfVisits !== null && treatmentConfig.drugOrderHistoryConfig.numberOfVisits === 0) { $scope.consultation.drugOrderGroups = [$scope.consultation.drugOrderGroups[0]]; } + $rootScope.$broadcast("event:setEncounterId", $scope.consultation.encounterUuid); }; $scope.isAnyDrugSelected = function () { @@ -144,6 +161,17 @@ angular.module('bahmni.clinical') createPrescriptionGroups($scope.consultation.activeAndScheduledDrugOrders); })); }; + + const getActiveAndPrescribedDrugOrdersUuids = function () { + return $scope.consultation.activeAndScheduledDrugOrders.map(function (drugOrder) { + return drugOrder.uuid; + }); + }; + + $scope.enableIPDFeature && spinner.forPromise(treatmentService.getMedicationSchedulesForOrders($stateParams.patientUuid, getActiveAndPrescribedDrugOrdersUuids()).then(function (response) { + $scope.medicationSchedules = response.data; + })); + $scope.getOrderReasonConcept = function (drugOrder) { if (drugOrder.orderReasonConcept) { return drugOrder.orderReasonConcept.display || drugOrder.orderReasonConcept.name; @@ -280,7 +308,7 @@ angular.module('bahmni.clinical') }; var getAttribute = function (drugOrder, attributeName) { - return _.find(drugOrder.orderAttributes, {name: attributeName}); + return _.find(drugOrder.orderAttributes, { name: attributeName }); }; init(); diff --git a/ui/app/clinical/consultation/directives/newDrugOrders.js b/ui/app/clinical/consultation/directives/newDrugOrders.js index 1e6122b417..a8071f603b 100644 --- a/ui/app/clinical/consultation/directives/newDrugOrders.js +++ b/ui/app/clinical/consultation/directives/newDrugOrders.js @@ -5,9 +5,17 @@ angular.module('bahmni.clinical') var controller = function ($scope, $rootScope, appService) { $scope.enableIPDFeature = appService.getAppDescriptor().getConfigValue("enableIPDFeature"); if ($scope.enableIPDFeature) { + $rootScope.$on("event:setEncounterId", function (event, encounterId) { + $scope.encounterId = encounterId; + }); + $scope.toggleCareSetting = function (newTreatment) { newTreatment.careSetting = newTreatment.careSetting === Bahmni.Clinical.Constants.careSetting.inPatient ? Bahmni.Clinical.Constants.careSetting.outPatient : Bahmni.Clinical.Constants.careSetting.inPatient; }; + + $scope.shouldDisableIPDButton = function (treatment) { + return $scope.encounterId !== treatment.encounterUuid && treatment.encounterUuid !== undefined; + }; } $scope.edit = function (drugOrder, index) { $rootScope.$broadcast("event:editDrugOrder", drugOrder, index); diff --git a/ui/app/clinical/consultation/views/newDrugOrders.html b/ui/app/clinical/consultation/views/newDrugOrders.html index 03451659d4..df78304f6b 100644 --- a/ui/app/clinical/consultation/views/newDrugOrders.html +++ b/ui/app/clinical/consultation/views/newDrugOrders.html @@ -41,7 +41,7 @@

{{ ::'MEDICATION_NEW_PRESCRIPTION' | translate}}
- diff --git a/ui/app/clinical/consultation/views/treatmentSections/drugOrderHistory.html b/ui/app/clinical/consultation/views/treatmentSections/drugOrderHistory.html index 8bccebff0b..f3e1417e96 100644 --- a/ui/app/clinical/consultation/views/treatmentSections/drugOrderHistory.html +++ b/ui/app/clinical/consultation/views/treatmentSections/drugOrderHistory.html @@ -34,7 +34,7 @@
- diff --git a/ui/app/clinical/displaycontrols/treatmentData/directives/treatmentData.js b/ui/app/clinical/displaycontrols/treatmentData/directives/treatmentData.js index 95c045f63e..cfa39892ae 100644 --- a/ui/app/clinical/displaycontrols/treatmentData/directives/treatmentData.js +++ b/ui/app/clinical/displaycontrols/treatmentData/directives/treatmentData.js @@ -48,7 +48,7 @@ angular.module('bahmni.clinical') for (var key in groupedByVisit) { var values = Bahmni.Clinical.DrugOrder.Util.mergeContinuousTreatments(groupedByVisit[key]); - treatmentSections.push({visitDate: key, drugOrders: values}); + treatmentSections.push({ visitDate: key, drugOrders: values }); } if (!_.isEmpty(drugOrderResponse[Constants.otherActiveDrugOrders])) { var mergedOtherActiveDrugOrders = Bahmni.Clinical.DrugOrder.Util.mergeContinuousTreatments(drugOrderResponse[Constants.otherActiveDrugOrders]); diff --git a/ui/app/clinical/displaycontrols/treatmentData/views/treatmentTableRow.html b/ui/app/clinical/displaycontrols/treatmentData/views/treatmentTableRow.html index 20841ba6d8..0517c61f31 100644 --- a/ui/app/clinical/displaycontrols/treatmentData/views/treatmentTableRow.html +++ b/ui/app/clinical/displaycontrols/treatmentData/views/treatmentTableRow.html @@ -8,7 +8,7 @@ {{::drugOrder.getDescriptionWithoutDuration()}} {{::drugOrder.getDescriptionWithoutRouteAndDuration()}} - {{::drugOrder.getSpanDetails()}} + {{::drugOrder.getSpanDetails()}} {{'MEDICATION_STOPPED_ON'|translate}} {{::drugOrder.effectiveStopDate | bahmniDate}} diff --git a/ui/app/common/constants.js b/ui/app/common/constants.js index d79aa3ee33..375af16ded 100644 --- a/ui/app/common/constants.js +++ b/ui/app/common/constants.js @@ -15,6 +15,7 @@ Bahmni.Common = Bahmni.Common || {}; var BASE_URL = hostUrl + "/bahmni_config/openmrs/apps/"; var CUSTOM_URL = hostUrl + "/implementation_config/openmrs/apps/"; var IE_APPS_API = RESTWS_V1 + "/bahmniie"; + var IPD = RESTWS_V1 + "/ipd"; var serverErrorMessages = [ { @@ -225,6 +226,7 @@ Bahmni.Common = Bahmni.Common || {}; passwordUrl: RESTWS_V1 + "/password", formUrl: RESTWS_V1 + "/form", allFormsUrl: RESTWS_V1 + "/bahmniie/form/allForms", + medicationSchedulesForOrders: IPD + "/schedule/type/medication", latestPublishedForms: RESTWS_V1 + "/bahmniie/form/latestPublishedForms", formTranslationsUrl: RESTWS_V1 + "/bahmniie/form/translations", sqlUrl: BAHMNI_CORE + "/sql", diff --git a/ui/test/unit/clinical/controllers/drugOrderHistoryController.spec.js b/ui/test/unit/clinical/controllers/drugOrderHistoryController.spec.js index 8033e25c83..804259c5e5 100644 --- a/ui/test/unit/clinical/controllers/drugOrderHistoryController.spec.js +++ b/ui/test/unit/clinical/controllers/drugOrderHistoryController.spec.js @@ -24,10 +24,13 @@ describe("DrugOrderHistoryController", function () { beforeEach(inject(function (_$controller_, $rootScope, _$q_) { $q = _$q_; $controller = _$controller_; - _treatmentService = jasmine.createSpyObj('treatmentService', ['getPrescribedDrugOrders']); + _treatmentService = jasmine.createSpyObj('treatmentService', ['getPrescribedDrugOrders', 'getMedicationSchedulesForOrders']); _treatmentService.getPrescribedDrugOrders.and.callFake(function () { return specUtil.respondWithPromise($q, prescribedDrugOrders); }); + _treatmentService.getMedicationSchedulesForOrders.and.callFake(function () { + return specUtil.respondWithPromise($q, []); + }); appService = jasmine.createSpyObj('appService', ['getAppDescriptor']); appService.getAppDescriptor.and.returnValue({ getConfigValue: function (config) { @@ -37,13 +40,13 @@ describe("DrugOrderHistoryController", function () { rootScope = $rootScope; spyOn($rootScope, '$broadcast'); - $rootScope.visit = {startDate: 1410322624000}; + $rootScope.visit = { startDate: 1410322624000 }; scope = $rootScope.$new(); scope.consultation = { preSaveHandler: new Bahmni.Clinical.Notifier(), discontinuedDrugs: [], activeAndScheduledDrugOrders: [Bahmni.Clinical.DrugOrderViewModel.createFromContract(scheduledOrder), Bahmni.Clinical.DrugOrderViewModel.createFromContract(activeDrugOrder)] }; - scope.currentBoard = {extensionParams: {}}; + scope.currentBoard = { extensionParams: {} }; var retrospectiveEntry = Bahmni.Common.Domain.RetrospectiveEntry.createFrom(Date.now()); retrospectiveEntryService = jasmine.createSpyObj('retrospectiveEntryService', ['getRetrospectiveEntry']); @@ -59,7 +62,7 @@ describe("DrugOrderHistoryController", function () { activeDrugOrders: [activeDrugOrder, scheduledOrder], treatmentService: _treatmentService, retrospectiveEntryService: retrospectiveEntryService, - $stateParams: {patientUuid: "patientUuid"}, + $stateParams: { patientUuid: "patientUuid" }, visitContext: {}, spinner: spinner, visitHistory: visitHistory, @@ -100,7 +103,7 @@ describe("DrugOrderHistoryController", function () { it("should enable reason text for all concepts when nothing is configured", function () { var drugOrder = Bahmni.Clinical.DrugOrderViewModel.createFromContract(prescribedDrugOrders[0]); - drugOrder.orderReasonConcept = {name: {name: "Other"}}; + drugOrder.orderReasonConcept = { name: { name: "Other" } }; scope.discontinue(drugOrder); expect(drugOrder.orderReasonNotesEnabled).toBe(true); @@ -119,7 +122,7 @@ describe("DrugOrderHistoryController", function () { return false; } }; - drugOrder.orderReasonConcept = {name: {name: "Adverse event"}}; + drugOrder.orderReasonConcept = { name: { name: "Adverse event" } }; scope.discontinue(drugOrder); expect(drugOrder.orderReasonNotesEnabled).toBe(true); @@ -137,11 +140,11 @@ describe("DrugOrderHistoryController", function () { return false; } }; - drugOrder.orderReasonConcept = {name: {name: "Adverse event"}}; + drugOrder.orderReasonConcept = { name: { name: "Adverse event" } }; scope.updateFormConditions(drugOrder); expect(drugOrder.orderReasonNotesEnabled).toBe(true); - drugOrder.orderReasonConcept = {name: {name: "other event"}}; + drugOrder.orderReasonConcept = { name: { name: "other event" } }; scope.updateFormConditions(drugOrder); expect(drugOrder.orderReasonNotesEnabled).toBe(false); @@ -201,7 +204,7 @@ describe("DrugOrderHistoryController", function () { "strength": null, "name": "Methylprednisolone 2ml" }, - "concept": { + "concept": { "shortName": "Methylprednisolone 2ml" } }; @@ -267,7 +270,7 @@ describe("DrugOrderHistoryController", function () { "concept": { "shortName": "Methylprednisolone 2ml" }, - "provider": {name: "superman"} + "provider": { name: "superman" } }; var scheduledOrder = { @@ -314,7 +317,7 @@ describe("DrugOrderHistoryController", function () { "concept": { "shortName": "Methylprednisolone 200ml" }, - "provider": {name: "superman"} + "provider": { name: "superman" } }; prescribedDrugOrders = [ @@ -364,6 +367,6 @@ describe("DrugOrderHistoryController", function () { "concept": { "shortName": "Methylprednisolone 2ml" }, - "provider": {name: "superman"} + "provider": { name: "superman" } }]; });