Skip to content

Commit

Permalink
Merge pull request #182 from jembi/dev
Browse files Browse the repository at this point in the history
Release September 2022
  • Loading branch information
tmvumbi2 authored Oct 6, 2022
2 parents 5259deb + ea92826 commit 9af451e
Show file tree
Hide file tree
Showing 11 changed files with 10,489 additions and 26 deletions.
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ui/app/clinical/common/models/drugOrderViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ Bahmni.Clinical.DrugOrderViewModel = function (config, proto, encounterDate) {
var dose = self.variableDosingType;
self.quantity = (dose.morningDose + dose.afternoonDose + dose.eveningDose) * self.durationInDays;
}

if (self.quantity % 1 !== 0) {
self.quantity = self.quantity - (self.quantity % 1) + 1;
}
Expand Down
50 changes: 30 additions & 20 deletions ui/app/clinical/consultation/controllers/addTreatmentController.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';

angular.module('bahmni.clinical')
.controller('AddTreatmentController', ['$scope', '$rootScope', 'contextChangeHandler', 'treatmentConfig', 'drugService',
.controller('AddTreatmentController', ['$scope', '$rootScope', '$http', 'contextChangeHandler', 'treatmentConfig', 'drugService',
'$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) {
function ($scope, $rootScope, $http, contextChangeHandler, treatmentConfig, drugService, $timeout,
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);
Expand Down Expand Up @@ -179,7 +179,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;
Expand All @@ -201,11 +201,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();
});
}
});

Expand Down Expand Up @@ -348,10 +348,10 @@ 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;
}
Expand Down Expand Up @@ -466,16 +466,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) {
Expand All @@ -494,6 +494,15 @@ angular.module('bahmni.clinical')
var selectedItem;
$scope.onSelect = function (item) {
selectedItem = item;
$scope.id = selectedItem.drug.uuid;
var id = $scope.id;
$http.get(Bahmni.Common.Constants.getQuantity + id).then(function (response) {
$scope.available_drug = response.data[0].qty_available;
if ($scope.available_drug === 0) {
var errorMessage = "Out Of Stock";
$rootScope.$broadcast('event:serverError', errorMessage);
}
});
$scope.onChange();
};
$scope.onAccept = function () {
Expand Down Expand Up @@ -527,6 +536,7 @@ angular.module('bahmni.clinical')
$scope.clearForm = function () {
$scope.treatment = newTreatment();
$scope.formInvalid = false;
$scope.available_drug = null;
clearHighlights();
markVariable("startNewDrugEntry");
};
Expand Down Expand Up @@ -585,7 +595,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;
Expand Down Expand Up @@ -699,7 +709,7 @@ angular.module('bahmni.clinical')
});
ngDialog.open({
template: 'consultation/views/treatmentSections/conflictingOrderSet.html',
data: {'conflictingDrugOrders': conflictingDrugOrders}
data: { 'conflictingDrugOrders': conflictingDrugOrders }
});
$scope.popupActive = true;
};
Expand Down Expand Up @@ -730,7 +740,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;
}
Expand All @@ -740,7 +750,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);
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ <h2 class="section-title has-toggle" toggle="addTreatment">
</div>
</div>
</article>
<article class="form-field">
<div class="field-attribute">
<label class="dose-label">{{ ::treatmentConfig.translate('availableQuantities', 'MEDICATION_LABEL_AVAILABLE_QUANTITIES') }} </label>
</div>

<div class="field-value">
<input id="available-quantities" type="text" ng-value="available_drug" ng-readonly="true"
ng-model="available_drug" ng-disabled="treatment.previousOrderUuid"/>
</div>
</article>
<div class="unit-wrap clearfix">
<button ng-if="!treatmentConfig.isHiddenField('dosingTypeToggle')" type="button" class="icon-button exchange-btn fl"
tabindex="-1" ng-click="treatment.toggleFrequency()">
Expand Down
2 changes: 1 addition & 1 deletion ui/app/clinical/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@
<script src="consultation/controllers/customDrugOrderHistoryController.js"></script>
<script src="consultation/controllers/latestPrescriptionPrintController.js"></script>
<script src="consultation/controllers/bacteriologyController.js"></script>


<!--All displaycontrols includes-->
<script src="displaycontrols/investigationresults/models/tabularLabOrderResults.js"></script>
Expand Down
1 change: 1 addition & 0 deletions ui/app/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Bahmni.Common = Bahmni.Common || {};
relationshipTypesUrl: RESTWS_V1 + "/relationshiptype",
personAttributeTypeUrl: RESTWS_V1 + "/personattributetype",
diseaseSummaryPivotUrl: BAHMNI_CORE + "/diseaseSummaryData",
getQuantity: RESTWS_V1 + "/odooapi/getquantity/",
allTestsAndPanelsConceptName: 'All_Tests_and_Panels',
dosageFrequencyConceptName: 'Dosage Frequency',
dosageInstructionConceptName: 'Dosage Instructions',
Expand Down
2 changes: 1 addition & 1 deletion ui/app/common/orders/services/orderSetService.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

'use strict';

angular.module('bahmni.common.orders')
Expand All @@ -11,7 +12,6 @@ angular.module('bahmni.common.orders')
}
});
};

this.getCalculatedDose = function (patientUuid, drugName, baseDose, doseUnit, orderSetName, dosingRule, visitUuid) {
if (typeof dosingRule !== 'undefined' && dosingRule != '' && dosingRule != null) {
var requestString = JSON.stringify({
Expand Down
7 changes: 6 additions & 1 deletion ui/app/i18n/clinical/locale_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@
"PROGRAM_DISPLAY_CONTROL_TREATMENT_START_DATE_KEY":"Treatment Start Date",
"PROGRAM_DISPLAY_CONTROL_TREATMENT_STOP_DATE_KEY" : "Treatment Stop Date",
"PROGRAM_DISPLAY_CONTROL_FACILITY_OF_ENROLLMENT_KEY" : "Facility of Enrollment",

"PMTCT_PROGRAM_KEY": "PMTCT Program",
"PMTCT_PROGRAM_MANAGEMENT_ANC_CODE": "ANC Code",
"PMTCT_PROGRAM_MANAGEMENT_FP_METHOD": "Family Planning Method",
"PMTCT_PROGRAM_MANAGEMENT_APS_NAME": "APS Name",
"PMTCT_PROGRAM_MANAGEMENT_TRACKING_OUTCOME": "Tracking outcome",
"TREATMENTS_SUMMARY_PRESCRIPTION_KEY": "Prescriptions",
"INVESTIGATION_CHART_KEY": "Investigation Chart",
"ALL_VISITS_KEY": "All Visits",
Expand Down Expand Up @@ -175,6 +179,7 @@
"MEDICATION_DRUG_NAME_TITLE": "Drug Name",
"MEDICATION_ADD_DRUG_FORM_TITLE": "Order Drug",
"MEDICATION_ADD_ORDERSET_FORM_TITLE": "Order an Order Set",
"MEDICATION_LABEL_AVAILABLE_QUANTITIES": "Available Quantities",
"MEDICATION_LABEL_DOSE" :"Dose",
"MEDICATION_LABEL_UNITS" :"Units",
"MEDICATION_LABEL_FREQUENCY" :"Frequency",
Expand Down
5 changes: 5 additions & 0 deletions ui/app/i18n/clinical/locale_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
"PROGRAM_DISPLAY_CONTROL_TREATMENT_START_DATE_KEY": "Treatment Start Date",
"PROGRAM_DISPLAY_CONTROL_TREATMENT_STOP_DATE_KEY": "Treatment Stop Date",
"PROGRAM_DISPLAY_CONTROL_FACILITY_OF_ENROLLMENT_KEY": "Facility of Enrollment",
"PMTCT_PROGRAM_KEY": "Programme PTME",
"PMTCT_PROGRAM_MANAGEMENT_ANC_CODE": "ID Grossesse",
"PMTCT_PROGRAM_MANAGEMENT_FP_METHOD": "Méthode de Planification Familiale",
"PMTCT_PROGRAM_MANAGEMENT_APS_NAME": "Nom de l'APS",
"PMTCT_PROGRAM_MANAGEMENT_TRACKING_OUTCOME": "Résultat de l'appel",
"TREATMENTS_SUMMARY_PRESCRIPTION_KEY": "Prescriptions",
"INVESTIGATION_CHART_KEY": "tableau enquête",
"ALL_VISITS_KEY": "Tous les visites",
Expand Down
Loading

0 comments on commit 9af451e

Please sign in to comment.