Skip to content

Commit

Permalink
Phani | A - 1205069439065526 | Add template options for notes in lab/…
Browse files Browse the repository at this point in the history
…radiology orders (#656)

* Add options for adding notes in radiology/lab orders

* Remove kid column from patient list

* Fix pipe not coming in order module

* Add CSS classes

* Fix test
  • Loading branch information
Phanindra-tw authored Aug 2, 2023
1 parent 585af0b commit 6bc382a
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 14 deletions.
18 changes: 18 additions & 0 deletions ui/app/clinical/consultation/controllers/orderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module('bahmni.clinical')
$scope.enableLabOrderOptions = LabOrderOptionsConfig ? LabOrderOptionsConfig.value : null;
var testConceptToParentsMapping = {}; // A child concept could be part of multiple parent panels
$scope.hideLabTests = true;
$scope.noteOptions = appService.getAppDescriptor().getConfigValue("orderNotes");

var collapseExistingActiveSection = function (section) {
if (section) {
Expand Down Expand Up @@ -228,6 +229,23 @@ angular.module('bahmni.clinical')
}
};

$scope.shouldShowNoteOptions = function (orderId, noteName) {
var configuredOptions = $scope.noteOptions;
return _.some(configuredOptions, function (option) {
return option.label.toLowerCase() === noteName.toLowerCase();
})
&& !orderId;
};

$scope.appendNotes = function (order, noteKey) {
const notesToAppend = $translate.instant(noteKey);
if (order.previousNote && !order.previousNote.includes(notesToAppend)) {
$scope.orderNoteText = ((order.previousNote + '\n') || '') + notesToAppend;
} else if (!($scope.orderNoteText || '').includes(notesToAppend)) {
$scope.orderNoteText = ($scope.orderNoteText ? $scope.orderNoteText + '\n' : '') + notesToAppend;
}
};

$scope.isPrintShown = function (isOrderSaved) {
var configuredOptions = getConfiguredOptions();
return _.some(configuredOptions, function (option) {
Expand Down
6 changes: 6 additions & 0 deletions ui/app/clinical/consultation/views/orderNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

<textarea ng-model="$parent.orderNoteText" focus-on="true" rows="4" ng-disabled="ngDialogData.uuid">{{ngDialogData.previousNote}}</textarea>
<button ng-click="appendPrintNotes(ngDialogData)" class="fl btn-group" ng-show="isPrintShown(ngDialogData.uuid)">{{ 'CLINICAL_ORDER_RADIOLOGY_NEED_PRINT_BUTTON' | translate}}</button>
<div style="width: 80%">
<div ng-repeat=" note in noteOptions">
<button ng-click="appendNotes(ngDialogData, note.translationKey)" ng-show="shouldShowNoteOptions(ngDialogData.uuid, note.label)" class="fl btn-group order-notes-button">{{note.label}}</button>
</div>
</div>

<div class="btn-group fr">
<span ng-if="ngDialogData.uuid">
{{ 'ORDER_CAN_NOT_EDIT_AFTER_SAVE_MESSAGE'|translate }}
Expand Down
6 changes: 3 additions & 3 deletions ui/app/common/concept-set/directives/conceptSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ angular.module('bahmni.common.conceptSet')
};

var updateObservationsOnRootScope = function () {
if ($scope.rootObservation) {
if ($scope.rootObservation && $scope.observations) {
for (var i = 0; i < $scope.observations.length; i++) {
if ($scope.observations[i].concept.uuid === $scope.rootObservation.concept.uuid) {
$scope.observations[i] = $scope.rootObservation;
Expand Down Expand Up @@ -290,10 +290,10 @@ angular.module('bahmni.common.conceptSet')
$scope.rootObservation.conceptSetName = $scope.conceptSetName;
focusFirstObs();
updateObservationsOnRootScope();
var groupMembers = getObservationsOfCurrentTemplate()[0].groupMembers;
var observations = getObservationsOfCurrentTemplate();
var defaults = getDefaults();
addDummyImage();
setDefaultsForGroupMembers(groupMembers, defaults);
setDefaultsForGroupMembers(observations && observations[0] && observations[0].groupMembers, defaults);
var observationsOfCurrentTemplate = getObservationsOfCurrentTemplate();
updateFormConditions(observationsOfCurrentTemplate, $scope.rootObservation);
} else {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/common/patient-search/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bahmni.Common.PatientSearch = Bahmni.Common.PatientSearch || {};
Bahmni.Common.PatientSearch.Constants = {
searchExtensionTileViewType: "tile",
searchExtensionTabularViewType: "tabular",
tabularViewIgnoreHeadingsList: ["display", "uuid", "image", "$$hashKey", "activeVisitUuid", "hasBeenAdmitted", "forwardUrl", "programUuid", "enrollment", "extraIdentifier"],
tabularViewIgnoreHeadingsList: ["display", "uuid", "image", "$$hashKey", "activeVisitUuid", "hasBeenAdmitted", "forwardUrl", "programUuid", "enrollment", "extraIdentifier", "kid"],
identifierHeading: ["ID", "Id", "id", "identifier", "DQ_COLUMN_TITLE_ACTION", "Patient ID"],
nameHeading: ["NAME", "Name", "name"],
patientTileHeight: 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,11 @@ angular.module('bahmni.common.patientSearch')

var setActiveHeadings = function (headings) {
headings.map(function (heading) {
if (heading !== personAttributeForPatientSearch) {
var newHeading = { name: heading, sortInfo: heading };
if (!$scope.activeHeaders.find(function (activeHeader) {
return activeHeader.name == newHeading.name && activeHeader.sortInfo == newHeading.sortInfo;
})) {
$scope.activeHeaders.push(newHeading);
}
var newHeading = { name: heading, sortInfo: heading };
if (!$scope.activeHeaders.find(function (activeHeader) {
return activeHeader.name == newHeading.name && activeHeader.sortInfo == newHeading.sortInfo;
})) {
$scope.activeHeaders.push(newHeading);
}
});
};
Expand Down
8 changes: 7 additions & 1 deletion ui/app/i18n/clinical/locale_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,5 +376,11 @@
"SIGN_SYMPTOM_DURATION_KEY": "Sign/symptom duration",
"CHIEF_COMPLAINT_DURATION_UNIT_KEY": "Chief Complaint Duration",
"DASHBOARD_IPD_DRUG_CHART_TAB_KEY": "Drug Chart",
"DASHBOARD_NEXT_UI_ALLERGIES_KEY": "Allergies"
"DASHBOARD_NEXT_UI_ALLERGIES_KEY": "Allergies",
"PRE_OP": "Pre-operative X-ray for diagnostic or planning purposes",
"POST_OP": "Post-operative X-ray for assessing healing or implant position",
"MONITORING": "Monitoring of progress for alignment / comparative purposes",
"FROM_CLINIC": "Request from clinic",
"FROM_WARD": "Request from ward",
"HIGH_RISK": "High Risk"
}
1 change: 1 addition & 0 deletions ui/app/orders/controllers/orderFulfillmentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ angular.module('bahmni.orders').controller('OrderFulfillmentController', ['$scop
var data = response.data;
$scope.orders.push.apply($scope.orders, data);
$scope.orders.forEach(function (order) {
order.commentToFulfiller = order.commentToFulfiller && order.commentToFulfiller.replaceAll('\n', ' | ');
order.bahmniObservations = _.filter($scope.encounter.observations, function (observation) {
return observation.orderUuid === order.orderUuid;
});
Expand Down
6 changes: 4 additions & 2 deletions ui/app/orders/views/orderFulfillment.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ <h2 class="section-title">
<div ng-if="order.showForm">
<orders-control patient="patient" order-uuid="order.orderUuid" config="config" message="message"
show-title="false"></orders-control>
<div>
<div class="order-note">
<i ng-if="::(order.urgency === 'STAT')" class="fa fa-exclamation-triangle fa-orange show-before-active"></i>
<i ng-if="::order.commentToFulfiller" class="fa fa-comments"></i>
<span>{{order.commentToFulfiller}}</span>
<span ng-if="::order.commentToFulfiller" class="note">{{order.commentToFulfiller}}<br><br></span>
<span>Provider: {{order.provider}}</span>
</div>
<concept-set patient="patient" ng-if="order.showForm"
concept-set-name="formName"
Expand Down
11 changes: 11 additions & 0 deletions ui/app/styles/clinical/_orders.scss
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,17 @@
border-left: #ddd 1px solid !important;
}
}
.order-notes-button{
margin-right: 2px;
width: 115px
}

.order-note{
margin: 0 10px;
.note{
line-height: 20px;
}
}

.hierarchy ul li.image-preview {
display: inline-block;
Expand Down
6 changes: 6 additions & 0 deletions ui/test/unit/clinical/controllers/orderController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ describe("OrderController", function () {
};
}
};
appDescriptor.getConfigValue = function (param) {
return [{
"label": "OP",
"translationKey": "OP_KEY"
}]
}
appServiceMock.getAppDescriptor = function() { return appDescriptor };

var translate = jasmine.createSpyObj('$translate',['instant']);
Expand Down

0 comments on commit 6bc382a

Please sign in to comment.