Skip to content

Commit

Permalink
BAH-3743 | Add. Display Controls In Medications Tab
Browse files Browse the repository at this point in the history
* Phani | A-1205559175340255 | Adds ability to show display controls in medication page (#734)

* Add display controls to treatments Controller

* Fix build

* Handle error for no allergies

* Fix order of allergies severity

* Update config name for display controls

* Refactor

* Phani | Refactor logic to fetch the display controls config in Medication tab

* Phani | Fix test

* Bindu | Remove rootscope as its not required as parameter in the directive

* [Rahul] | BAH-3743 | Refactor. Allergy Service

---------

Co-authored-by: Phanindra-tw <[email protected]>
Co-authored-by: Rahul Ramesh <[email protected]>
  • Loading branch information
3 people authored May 23, 2024
1 parent e2ce8c0 commit 248e993
Show file tree
Hide file tree
Showing 9 changed files with 860 additions and 19 deletions.
2 changes: 2 additions & 0 deletions ui/app/clinical/common/controllers/visitController.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ angular.module('bahmni.clinical')
});
promises.push(promise);
}
$scope.allergies = allergyService.fetchAndProcessAllergies($scope.patient.uuid);
promises.push(allergyPromise);

Promise.all(promises).then(function () {
$scope.additionalInfo = {};
Expand Down
16 changes: 15 additions & 1 deletion ui/app/clinical/common/services/allergyService.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@ angular.module('bahmni.clinical')
cache: false
});
};
var fetchAndProcessAllergies = function (patientUuid) {
var allergies = getAllergyForPatient(patientUuid);
var allergiesList = [];
if (allergies.status === 200 && allergies.data.entry.length > 0) {
allergies.data.entry.forEach(function (allergy) {
if (allergy.resource.code.coding) {
allergiesList.push(allergy.resource.code.coding[0].display);
}
});
}
return allergiesList.join(", ");
};

return {
getAllergyForPatient: getAllergyForPatient
getAllergyForPatient: getAllergyForPatient,
fetchAndProcessAllergies: fetchAndProcessAllergies
};
}]);
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,7 @@ angular.module('bahmni.clinical')
});
promises.push(promise);
}
$scope.allergies = "";
var allergyPromise = allergyService.getAllergyForPatient($scope.patient.uuid).then(function (response) {
var allergies = response.data;
var allergiesList = [];
if (response.status === 200 && allergies.length > 0) {
allergies.entry.forEach(function (allergy) {
if (allergy.resource.code.coding) {
allergiesList.push(allergy.resource.code.coding[0].display);
}
});
}
$scope.allergies = allergiesList.join(", ");
});
$scope.allergies = allergyService.fetchAndProcessAllergies($scope.patient.uuid);
promises.push(allergyPromise);
Promise.all(promises).then(function () {
var additionalInfo = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
'use strict';

angular.module('bahmni.clinical')
.controller('TreatmentController', ['$scope', 'clinicalAppConfigService', 'treatmentConfig', '$stateParams', '$rootScope', 'cdssService',
function ($scope, clinicalAppConfigService, treatmentConfig, $stateParams, $rootScope, cdssService) {
.controller('TreatmentController', ['$scope', 'clinicalAppConfigService', 'treatmentConfig', '$stateParams', '$rootScope', 'cdssService', 'appService', '$filter',
function ($scope, clinicalAppConfigService, treatmentConfig, $stateParams, $rootScope, cdssService, appService, $filter) {
var init = function () {
var drugOrderHistoryConfig = treatmentConfig.drugOrderHistoryConfig || {};
$scope.drugOrderHistoryView = drugOrderHistoryConfig.view || 'default';
$scope.tabConfigName = $stateParams.tabConfigName || 'default';
var extensionParams = appService.getAppDescriptor().getExtensionById("bahmni.clinical.billing.treatment").extensionParams;
$scope.medicationTabDisplayControls = extensionParams && extensionParams.sections ? extensionParams : {sections: {}};
var dashboard = Bahmni.Common.DisplayControl.Dashboard.create($scope.medicationTabDisplayControls || {}, $filter);
$scope.sectionGroups = dashboard.getSections([]);

var initializeTreatments = function () {
$scope.consultation.newlyAddedTabTreatments = $scope.consultation.newlyAddedTabTreatments || {};
Expand Down
1 change: 1 addition & 0 deletions ui/app/clinical/consultation/views/treatment.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<div ui-view="addTreatment"></div>
</section>
<section class="treatment-section-right clearfix">
<dashboard patient="::patient" config="::medicationTabDisplayControls" section-groups="sectionGroups"></dashboard>
<new-drug-orders treatments="treatments"
treatment-config="treatmentConfig"></new-drug-orders>
<new-order-group treatments="orderSetTreatments" order-set-name="newOrderSet.name"></new-order-group>
Expand Down
4 changes: 2 additions & 2 deletions ui/app/common/displaycontrols/dashboard/views/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<article class="patient-dashboard visit">
<div class="pgContainer">
<article ng-class="tabConfigName === 'allMedicationTabConfig' ? '' :'patient-dashboard visit'">
<div ng-class="tabConfigName === 'allMedicationTabConfig' ? '' :'pgContainer'">
<article>
<div ng-repeat="sections in sectionGroups" class="dashboard-sections-wrapper">
<div ng-if="::isFullPageSection(sections)" ng-repeat="section in sections" class="dashboard-sections fullpage-container">
Expand Down
2 changes: 1 addition & 1 deletion ui/app/styles/clinical/treatment/_treatment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
}

.order-set-container {
margin-top: 20px;
margin: 20px 0;
}

.order-section-container {
Expand Down
Loading

0 comments on commit 248e993

Please sign in to comment.