Skip to content

Commit

Permalink
Kid icon and pre-patient flow revamp (#933)
Browse files Browse the repository at this point in the history
* BAH-3053 | add pre-patient attribute in registration page (#600) (#638)

* BAH-3053 | add pre-patient attribute in registration page (#600)

* BAH-3053 | add pre-patient attribute in registration page

* BAH-3053 | added check for pre-registration attribute

* BAH-3053 | refactored to drive by single config

* Kavitha | refactored pre-patient flow based on configs

* Kavitha | BAH-3065 | add additional search param for lucene search (#604)

* Update package.json (#884)

* [Rahul] | BAH-3710 | Fix. Remove Transifex Script

* [Bahmni Infra] | Add. Update Translation Resources

* Parvathy | BAH-2833 | Add. Display Error Message When Document Size Limit Exceed (#875)

* [Rahu] | BAH-3522 | Fix. Improve Test Coverage For DateUtils

* [Bahmni Infra] | Add. Update Translation Resources

* Parvathy | BAH-2833 | Fix. Handle Document Size Limit Error Message

* Revert "Update package.json (#884)"

This reverts commit 30091b3.

* Revert "[Rahul] | BAH-3710 | Fix. Remove Transifex Script"

This reverts commit bbc704d.

* Revert "Parvathy | BAH-2833 | Add. Display Error Message When Document Size Limit Exceed (#875)"

This reverts commit 67a004b.

* Revert "[Rahu] | BAH-3522 | Fix. Improve Test Coverage For DateUtils"

This reverts commit 1bf9ff7.

* Revert "[Bahmni Infra] | Add. Update Translation Resources"

This reverts commit 95d96c4.

* Revert "Parvathy | BAH-2833 | Fix. Handle Document Size Limit Error Message"

This reverts commit 95fdfac.

* Kavitha | refactor to accept grouped configs

* Revert unnecessary commit

* BAH-3053 | renamed configuration names

* BAH-3053 | renamed lables to related patient identifier

---------

* BAH-3742 | Add. Custom Patient Attribute Icon

* kid icon refactor

* Kavitha|BAH-3742| refactor for combined icon configs

* Kavitha|fix failed test cases

* BAH-3472| refactor icon config in patient context

* BAH-3742 | fix failed test cases

* [Rahul] | BAH-3742 | Fix. Broken Icon HTML

* [Rahul] | BAH-3742 | Refactor. Remove Whitespace

---------

Co-authored-by: Rahul Ramesh <rahul.ramesh@thoughtworks.com>

* add custom attr for lucene search

* Kavitha|add test cases to meet coverage

---------

Co-authored-by: Rahul Ramesh <rahul.ramesh@thoughtworks.com>
  • Loading branch information
kavitha-sundararajan and rahu1ramesh authored May 9, 2024
1 parent 82aab95 commit 9a5a03e
Show file tree
Hide file tree
Showing 22 changed files with 108 additions and 47 deletions.
9 changes: 3 additions & 6 deletions ui/app/adt/controllers/wardListController.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ angular.module('bahmni.adt')
};

$scope.searchText = '';

$scope.iconAttributeConfig = appService.getAppDescriptor().getConfigValue('iconAttribute') || {};
$scope.searchTextFilter = function (row) {
var searchText = $scope.searchText;
if (!searchText) {
Expand All @@ -39,12 +39,9 @@ angular.module('bahmni.adt')
v: "full",
location_name: $scope.ward.ward.name
};

return queryService.getResponseFromQuery(params).then(function (response) {
$scope.tableDetails = Bahmni.ADT.WardDetails.create(response.data, $rootScope.diagnosisStatus);
$scope.tableHeadings = $scope.tableDetails.length > 0 ?
Object.keys($scope.tableDetails[0]).filter(function (name) { return name !== 'kid'; })
: [];
$scope.tableDetails = Bahmni.ADT.WardDetails.create(response.data, $rootScope.diagnosisStatus, $scope.iconAttributeConfig.attrName);
$scope.tableHeadings = $scope.tableDetails.length > 0 ? Object.keys($scope.tableDetails[0]).filter(function (name) { return name !== $scope.iconAttributeConfig.attrName; }) : [];
});
};
spinner.forPromise(getTableDetails());
Expand Down
5 changes: 3 additions & 2 deletions ui/app/adt/models/wardDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

Bahmni.ADT.WardDetails = {};

Bahmni.ADT.WardDetails.create = function (details, diagnosisStatus) {
Bahmni.ADT.WardDetails.create = function (details, diagnosisStatus, iconAttribute) {
var detailsMap = {};
var attributesToCopy = ["Bed", "Ward", "Id", "Name", "Age", "Gender", "District", "Village", "Admission By", "Admission Time", "Disposition By", "Disposition Time", "ADT Notes", "kid"];
var attributesToCopy = ["Bed", "Ward", "Id", "Name", "Age", "Gender", "District", "Village", "Admission By", "Admission Time", "Disposition By", "Disposition Time", "ADT Notes"];
iconAttribute && attributesToCopy.push(iconAttribute);
var diagnosisProperties = ["Diagnosis", "Diagnosis Certainty", "Diagnosis Order", "Diagnosis Status", "Diagnosis Provider", "Diagnosis Datetime"];
var hiddenAttributesToCopy = ["Patient Uuid", "Visit Uuid"];

Expand Down
4 changes: 2 additions & 2 deletions ui/app/adt/views/wardList.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<td ng-repeat="heading in tableHeadings" ng-if="heading != 'hiddenAttributes'">
<div ng-if="heading != 'Diagnosis' && heading != 'Id'">
{{row[heading]}}
<span ng-if="::(row.kid === 'true' && heading === 'Name')" class="icons-container">
<i class="ipd-indication fa fa-solid fa-child" style="background-color: #F58C35;"></i>
<span ng-if="::(row[iconAttributeConfig.attrName] === iconAttributeConfig.attrValue && heading === 'Name')" class="icons-container">
<i class="ipd-indication" ng-class="iconAttributeConfig.icon" ng-style="{{iconAttributeConfig.iconStyle}}"></i>
</span>
</div>
<a ng-if="heading =='Id'" ng-click="gotoPatientDashboard(row['hiddenAttributes'].patientUuid, row['hiddenAttributes'].visitUuid)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
};
angular.module('bahmni.common.displaycontrol.patientprofile')
.directive('patientProfile', ['patientService', 'spinner', '$sce', '$rootScope', '$stateParams', '$window', '$translate',
'configurations', '$q', 'visitService',
function (patientService, spinner, $sce, $rootScope, $stateParams, $window, $translate, configurations, $q, visitService) {
'configurations', '$q', 'visitService', 'appService',
function (patientService, spinner, $sce, $rootScope, $stateParams, $window, $translate, configurations, $q, visitService, appService) {
var controller = function ($scope) {
$scope.isProviderRelationship = function (relationship) {
return _.includes($rootScope.relationshipTypeMap.provider, relationship.relationshipType.aIsToB);
Expand All @@ -41,6 +41,7 @@
var configName = $stateParams.configName || Bahmni.Common.Constants.defaultExtensionName;
$window.open("../clinical/#/" + configName + "/patient/" + patientUuid + "/dashboard");
};
$scope.iconAttributeConfig = appService.getAppDescriptor().getConfigValue('iconAttribute') || {};
var assignPatientDetails = function () {
var patientMapper = new Bahmni.PatientMapper(configurations.patientConfig(), $rootScope, $translate);
return patientService.getPatient($scope.patientUuid).then(function (response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
<div class="icons-container">
<i class="ipd-indication fa fa-bed" ng-if="::hasBeenAdmitted"></i>
<i class="ipd-indication fa fa-solid fa-child" style="background-color: #F58C35; padding: 4px 15.289px;" ng-if="::(patient.kid && patient.kid.value)"></i>
<i ng-if="::patient[iconAttributeConfig.attrName] && patient[iconAttributeConfig.attrName].value.toString() === iconAttributeConfig.attrValue" class="ipd-indication custom-icon-style" ng-class="iconAttributeConfig.icon" ng-style="{{iconAttributeConfig.iconStyle}}"></i>
</div>
</td>
</tr>
Expand Down
5 changes: 5 additions & 0 deletions ui/app/common/patient-context/directives/patientContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ angular.module('bahmni.common.patientContext')
$scope.allowNavigation = angular.isDefined($scope.isConsultation);
$scope.initPromise.then(function (response) {
$scope.patientContext = response.data;
$scope.iconAttributeConfig = appService.getAppDescriptor().getConfigValue('iconAttribute') || {};
$scope.showIcon = $scope.iconAttributeConfig && $scope.iconAttributeConfig.attrName && $scope.iconAttributeConfig.attrValue && $scope.patientContext.personAttributes && $scope.patientContext.personAttributes[$scope.iconAttributeConfig.attrName] && $scope.patientContext.personAttributes[$scope.iconAttributeConfig.attrName].value === $scope.iconAttributeConfig.attrValue;
if ($scope.patientContext.personAttributes && $scope.showIcon) {
delete $scope.patientContext.personAttributes[$scope.iconAttributeConfig.attrName];
}
var programAttributes = $scope.patientContext.programAttributes;
var personAttributes = $scope.patientContext.personAttributes;
convertBooleanValuesToEnglish(personAttributes);
Expand Down
4 changes: 2 additions & 2 deletions ui/app/common/patient-context/views/patientContext.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<span class="patient-name">
({{patientContext.identifier}})
</span>
<span class="kid-icon" ng-if="::(patientContext.kid && patientContext.kid.value === 'Yes')">
<i class="ipd-indication fa fa-solid fa-child" style="background-color: #F58C35; padding: 3.6px; border-radius: 4px"></i>
<span class="custom-attr-icon" ng-if="showIcon">
<i class="ipd-indication context-icon-style" ng-class="iconAttributeConfig.icon" ng-style="{{iconAttributeConfig.iconStyle}}"></i>
</span>
</li>
<li>{{'GENDER_KEY' | translate}} {{patientContext.gender}}</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ angular.module('bahmni.common.patientSearch')
}
};

$scope.iconAttributeConfig = appService.getAppDescriptor().getConfigValue('iconAttribute') || {};

var mapExtensionToSearchType = function (appExtn) {
return {
name: appExtn.label,
Expand Down
4 changes: 2 additions & 2 deletions ui/app/common/patient-search/views/patientsList.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</div>
<span class="icons-container">
<i class="ipd-indication fa fa-bed" ng-if="::(row.hasBeenAdmitted===true||row.hasBeenAdmitted==='true')"></i>
<i class="ipd-indication fa fa-solid fa-child" style="background-color: #F58C35; padding: 2px 12.289px;" ng-if="::row.kid === 'true'"></i>
<i ng-if="::iconAttributeConfig.attrName && (row[iconAttributeConfig.attrName] === iconAttributeConfig.attrValue || (row.customAttribute ? row.customAttribute[iconAttributeConfig.attrName] === iconAttributeConfig.attrValue : false))" class="ipd-indication list-icon-style" ng-class="iconAttributeConfig.icon" ng-style="{{iconAttributeConfig.iconStyle}}"></i>
</span>
</div>
<span ng-if="::(!isHeadingOfLinkColumn(heading.name) && !isHeadingOfName(heading.name))">
Expand All @@ -95,7 +95,7 @@
<div ng-if="preferExtraIdInSearchResults" class="patient-id">{{::patient.extraIdentifier}}</div>
<span class="icons-container">
<i class="ipd-indication fa fa-bed" ng-if="::(patient.hasBeenAdmitted===true||patient.hasBeenAdmitted==='true')"></i>
<i class="ipd-indication fa fa-solid fa-child" style="background-color: #F58C35;" ng-if="::((patient.kid === 'true') || (patient.customAttribute ? patient.customAttribute.kid === 'true' : false)) "></i>
<i ng-if="::iconAttributeConfig.attrName && patient[iconAttributeConfig.attrName] === iconAttributeConfig.attrValue || (patient.customAttribute ? patient.customAttribute[iconAttributeConfig.attrName] === iconAttributeConfig.attrValue : false)" class="ipd-indication" ng-class="iconAttributeConfig.icon" ng-style="{{iconAttributeConfig.iconStyle}}"></i>
</span>
</li>
</ul>
Expand Down
6 changes: 4 additions & 2 deletions ui/app/common/patient/services/patientService.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ angular.module('bahmni.common.patient')
loginLocationUuid: sessionService.getLoginLocationUuid(),
patientSearchResultsConfig: customAttribute
};
if (appService.getAppDescriptor().getConfigValue("filterAttributeForAllSearch")) {
searchParams.attributeToFilterOut = appService.getAppDescriptor().getConfigValue("filterAttributeForAllSearch");
var filterOutAttributeForAllSearch = appService.getAppDescriptor().getConfigValue("filterOutAttributeForAllSearch") || [];
if (filterOutAttributeForAllSearch && filterOutAttributeForAllSearch.length > 0) {
searchParams.attributeToFilterOut = filterOutAttributeForAllSearch[0].attrName;
searchParams.attributeValueToFilterOut = filterOutAttributeForAllSearch[0].attrValue;
}
return $http.get(Bahmni.Common.Constants.bahmniCommonsSearchUrl + "/patient/lucene", {
method: "GET",
Expand Down
2 changes: 1 addition & 1 deletion ui/app/i18n/registration/locale_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@
"PATIENT_ATTRIBUTE_GIVEN_NAME_LOCAL": "First Name in Arabic",
"PATIENT_ATTRIBUTE_FAMILY_NAME_LOCAL": "Last Name in Arabic",
"PATIENT_ATTRIBUTE_MIDDLE_NAME_LOCAL": "Middle Name in Arabic",
"PRE_REGISTRATION_LABEL": "Patient"
"RELATED_PATIENT_IDENTIFIER_LABEL": "Patient"
}
6 changes: 4 additions & 2 deletions ui/app/registration/controllers/createPatientController.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ angular.module('bahmni.registration')
$scope.addressHierarchyConfigs = appService.getAppDescriptor().getConfigValue("addressHierarchy");
$scope.disablePhotoCapture = appService.getAppDescriptor().getConfigValue("disablePhotoCapture");
$scope.showEnterID = configValueForEnterId === null ? true : configValueForEnterId;
$scope.preRegistrationAttribute = appService.getAppDescriptor().getConfigValue('preRegistrationAttribute');
$scope.relatedIdentifierAttribute = appService.getAppDescriptor().getConfigValue('relatedIdentifierAttribute');
$scope.today = Bahmni.Common.Util.DateTimeFormatter.getDateWithoutTime(dateUtil.now());
$scope.moduleName = appService.getAppDescriptor().getConfigValue('registrationModuleName');
var patientId;
Expand Down Expand Up @@ -99,7 +99,9 @@ angular.module('bahmni.registration')
_.chain(defaultsWithAnswers).filter(isConcept).each(setDefaultConcept).value();
_.chain(defaultsWithAnswers).filter(isLocation).each(setDefaultLocation).value();
_.chain(defaultsWithAnswers).filter(isDateType).each(setDefaultValue).value();
$scope.patient[$scope.preRegistrationAttribute] = false;
if ($scope.relatedIdentifierAttribute && $scope.relatedIdentifierAttribute.name) {
$scope.patient[$scope.relatedIdentifierAttribute.name] = false;
}
};

var expandSectionsWithDefaultValue = function () {
Expand Down
10 changes: 8 additions & 2 deletions ui/app/registration/controllers/editPatientController.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ angular.module('bahmni.registration')
expandDataFilledSections();
$scope.patientLoaded = true;
$scope.enableWhatsAppButton = (appService.getAppDescriptor().getConfigValue("enableWhatsAppButton") || Bahmni.Registration.Constants.enableWhatsAppButton) && ($scope.patient.phoneNumber != undefined);
$scope.preRegistrationAttribute = appService.getAppDescriptor().getConfigValue('preRegistrationAttribute');
$scope.showPreRegistrationOption = $scope.preRegistrationAttribute && $scope.patient[$scope.preRegistrationAttribute] == false;
$scope.relatedIdentifierAttribute = appService.getAppDescriptor().getConfigValue('relatedIdentifierAttribute');
if ($scope.relatedIdentifierAttribute && $scope.relatedIdentifierAttribute.name) {
const hideOrDisableAttr = $scope.relatedIdentifierAttribute.hideOrDisable;
const hideAttrOnValue = $scope.relatedIdentifierAttribute.hideOnValue;
$scope.showRelatedIdentifierOption = !(hideOrDisableAttr === "hide" && $scope.patient[$scope.relatedIdentifierAttribute.name] &&
$scope.patient[$scope.relatedIdentifierAttribute.name].toString() === hideAttrOnValue);
$scope.showDisabledAttrOption = hideOrDisableAttr === "disable" ? true : false;
}
};

var expandDataFilledSections = function () {
Expand Down
9 changes: 4 additions & 5 deletions ui/app/registration/views/editpatient.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@
<div class="field-value">
<span class="uneditable-input text-only">{{patient.registrationDate | bahmniDate}}</span>
</div>
<div ng-if="showPreRegistrationOption" class="field-value field-value-has-identifier">
<div ng-if="showRelatedIdentifierOption" class="field-value field-value-has-identifier">
<div class="fl">
<div class="field-attribute hasOldIdentifier-field-attribute">
<label for="pre-registration-attribute" class="control-label">{{::'PRE_REGISTRATION_LABEL' | translate}}</label>
<label for="related-identifier-attribute" class="control-label related-identifier-label">{{::'RELATED_PATIENT_IDENTIFIER_LABEL' | translate}}</label>
</div>
<div class="field-value">
<input class="input-label-inline" type="checkbox" id="pre-registration-attribute" ng-model="patient[preRegistrationAttribute]"
ng-change="patient[preRegistrationAttribute].handleUpdate()">
<input class="input-label-inline" type="checkbox" id="related-identifier-attribute" ng-model="patient[relatedIdentifierAttribute.name]"
ng-change="patient[relatedIdentifierAttribute.name].handleUpdate()" ng-disabled="showDisabledAttrOption" ng-style="{'opacity' : showDisabledAttrOption ? '0.4':'unset'}">
</div>
</div>
</div>
</article>
</div>
<ng-include src="'views/patientcommon.html'"></ng-include>
Expand Down
10 changes: 5 additions & 5 deletions ui/app/registration/views/newpatient.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
</div>
</div>
</div>
<div ng-show="::preRegistrationAttribute" class="field-value field-value-has-identifier">
<div ng-show="true" class="fl">
<div ng-show="::relatedIdentifierAttribute.name" class="field-value field-value-has-identifier">
<div class="fl">
<div class="field-attribute hasOldIdentifier-field-attribute">
<label for="pre-registration-attribute" class="control-label">{{::'PRE_REGISTRATION_LABEL' | translate}}</label>
<label for="related-identifier-attribute" class="control-label">{{::'RELATED_PATIENT_IDENTIFIER_LABEL' | translate}}</label>
</div>
<div class="field-value">
<input type="checkbox" class="input-label-inline" id="pre-registration-attribute" ng-model="patient[preRegistrationAttribute]"
ng-change="patient[preRegistrationAttribute].handleUpdate()">
<input type="checkbox" class="input-label-inline" id="related-identifier-attribute" ng-model="patient[relatedIdentifierAttribute.name]"
ng-change="patient[relatedIdentifierAttribute.name].handleUpdate()">
</div>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion ui/app/styles/clinical/_patientDashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ table.treatments-details-table {
padding-left: 10px;
}

.kid-icon {
.custom-attr-icon {
display: table-cell;
vertical-align: middle;
padding-left: 10px;
Expand All @@ -1435,6 +1435,10 @@ table.treatments-details-table {
padding: 2px 8px;
font-size: 18px;
}
i.context-icon-style {
padding: 3.6px;
border-radius: 4px
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions ui/app/styles/clinical/_patientSearch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
}
font-size: 18px;
}
i.list-icon-style {
padding: 2px 12.289px;
}

.ward-details-container {
display: flex;
Expand Down
3 changes: 3 additions & 0 deletions ui/app/styles/clinical/_visit.scss
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,9 @@ a.visit:before {
top: 0;
right: 0;
}
.custom-icon-style {
padding: 4px 15.289px;
}
}

.patient-img {
Expand Down
5 changes: 4 additions & 1 deletion ui/app/styles/registration/_patientCommonInformation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
margin:8px 5px 8px 5px;
}
&.uneditable-input{
width: 5.2em;
width: 5.7em;
}
}
.related-identifier-label{
width: 14em !important;
}
}

form .form-field{
Expand Down
18 changes: 9 additions & 9 deletions ui/test/unit/adt/controllers/wardListController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ describe('WardListController', function () {
module('bahmni.adt');

module(function ($provide) {
var realAppDescriptor = new Bahmni.Common.AppFramework.AppDescriptor();
realAppDescriptor.getConfigValue = function (config) {
if (config === 'enableIPDFeature') {
return false;
}
};

appService = jasmine.createSpyObj('appService', ['getAppDescriptor']);
appService.getAppDescriptor.and.returnValue(realAppDescriptor);
var realAppDescriptor = new Bahmni.Common.AppFramework.AppDescriptor();
realAppDescriptor.getConfigValue = function (config) {
if (config === 'enableIPDFeature') {
return false;
}
};

appService = jasmine.createSpyObj('appService', ['getAppDescriptor']);
appService.getAppDescriptor.and.returnValue(realAppDescriptor);
$provide.value('appService', {});
queryService = jasmine.createSpyObj('queryService', ['getResponseFromQuery']);
queryService.getResponseFromQuery.and.returnValue(specUtil.createServicePromise('queryService'));
Expand Down
Loading

0 comments on commit 9a5a03e

Please sign in to comment.