Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-3049| Samridhi | Put default dates in Report screen to save time #663

Closed
wants to merge 8 commits into from
3 changes: 2 additions & 1 deletion ui/app/admin/controllers/auditLogController.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ angular.module('bahmni.admin')
return;
}
var params = {
username: $scope.username, patientId: $scope.patientId,
username: $scope.username,
patientId: $scope.patientId,
startFrom: $scope.startDate
};
var promise = auditLogService.getLogs(mapParamsForRequest(params)).then(function (logs) {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/adt/controllers/adtController.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ angular.module('bahmni.adt')
};

$scope.visitExists = function () {
return $scope.visitSummary ? true : false;
return !!$scope.visitSummary;
};

var getEncounterData = function (encounterTypeUuid, visitTypeUuid) {
Expand Down
3 changes: 1 addition & 2 deletions ui/app/bedmanagement/controllers/roomController.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ angular.module('bahmni.ipd')
$scope.getTagName = function (tag) {
if (tag === 'AVAILABLE') {
return $translate.instant("KEY_AVAILABLE");
}
else if (tag === 'OCCUPIED') {
} else if (tag === 'OCCUPIED') {
return $translate.instant("KEY_OCCUPIED");
}
};
Expand Down
3 changes: 1 addition & 2 deletions ui/app/bedmanagement/controllers/roomGridController.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ angular.module('bahmni.ipd')
$rootScope.selectedBedInfo.bed = bed;
var options = {bedId: bed.bedId};
$state.go("bedManagement.bed", options);
}
else if ($state.current.name === "bedManagement.patient") {
} else if ($state.current.name === "bedManagement.patient") {
$rootScope.selectedBedInfo.bed = bed;
if (bed.patient) {
$scope.$emit("event:updateSelectedBedInfoForCurrentPatientVisit", bed.patient.uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ angular.module('bahmni.clinical')
};

$scope.popUpHandler = function () {
$scope.dialog = ngDialog.open({ template: 'consultation/views/defaultDataPopUp.html', className: 'test ngdialog-theme-default',
$scope.dialog = ngDialog.open({ template: 'consultation/views/defaultDataPopUp.html',
className: 'test ngdialog-theme-default',
controller: 'PatientListHeaderController'});
$('body').addClass('show-controller-back');
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Bahmni.Clinical.PatientFileObservationsMapper = function () {
});
});
patientFileRecords.sort(function (record1, record2) {
return record1.imageObservation.observationDateTime !== record2.imageObservation.observationDateTime ?
DateUtil.parse(record1.imageObservation.observationDateTime) - DateUtil.parse(record2.imageObservation.observationDateTime) :
record1.id - record2.id;
return record1.imageObservation.observationDateTime !== record2.imageObservation.observationDateTime
? DateUtil.parse(record1.imageObservation.observationDateTime) - DateUtil.parse(record2.imageObservation.observationDateTime)
: record1.id - record2.id;
});
return patientFileRecords;
};
Expand Down
8 changes: 4 additions & 4 deletions ui/app/clinical/common/models/drugOrderViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Bahmni.Clinical.DrugOrderViewModel = function (config, proto, encounterDate) {
return response;
};

this.encounterDate = encounterDate ? encounterDate : now;
this.encounterDate = encounterDate || now;
this.asNeeded = this.asNeeded || false;
this.route = this.route || undefined;
this.durationUnit = this.durationUnit || inputOptionsConfig.defaultDurationUnit;
Expand All @@ -121,7 +121,7 @@ Bahmni.Clinical.DrugOrderViewModel = function (config, proto, encounterDate) {
this.isBeingEdited = this.isBeingEdited || false;
this.orderAttributes = [];
this.isNonCodedDrug = this.isNonCodedDrug || false;
this.isDurationRequired = inputOptionsConfig.duration && inputOptionsConfig.duration.required == false ? false : true;
this.isDurationRequired = !(inputOptionsConfig.duration && inputOptionsConfig.duration.required == false);

if (inputOptionsConfig.defaultStartDate === false && !this.effectiveStartDate) {
this.effectiveStartDate = null;
Expand Down Expand Up @@ -620,7 +620,7 @@ Bahmni.Clinical.DrugOrderViewModel = function (config, proto, encounterDate) {
return orderAttributesWithValues.map(function (orderAttribute) {
return {
uuid: orderAttribute.obsUuid,
value: orderAttribute.value ? true : false,
value: !!orderAttribute.value,
orderUuid: self.uuid,
concept: {uuid: orderAttribute.conceptUuid }
};
Expand Down Expand Up @@ -727,7 +727,7 @@ Bahmni.Clinical.DrugOrderViewModel.createFromContract = function (drugOrderRespo
viewModel.orderReasonText = drugOrderResponse.orderReasonText;
viewModel.orderNumber = drugOrderResponse.orderNumber && parseInt(drugOrderResponse.orderNumber.replace("ORD-", ""));
viewModel.drugNonCoded = drugOrderResponse.drugNonCoded;
viewModel.isNonCodedDrug = drugOrderResponse.drugNonCoded ? true : false;
viewModel.isNonCodedDrug = !!drugOrderResponse.drugNonCoded;
viewModel.drugNameDisplay = viewModel.drugNonCoded || constructDrugNameDisplayWithConcept(viewModel.drug, viewModel.concept) || _.get(viewModel, 'concept.name');
if (config) {
viewModel.loadOrderAttributes(drugOrderResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ angular.module('bahmni.clinical')
});
var isValidConditionForm = ($scope.consultation.condition.isEmpty() || $scope.consultation.condition.isValid());
return {
allow: invalidnewlyAddedDiagnoses.length === 0 && invalidPastDiagnoses.length === 0
&& invalidSavedDiagnosesFromCurrentEncounter.length === 0 && isValidConditionForm,
allow: invalidnewlyAddedDiagnoses.length === 0 && invalidPastDiagnoses.length === 0 &&
invalidSavedDiagnosesFromCurrentEncounter.length === 0 && isValidConditionForm,
errorMessage: $scope.errorMessage
};
};
Expand Down Expand Up @@ -313,8 +313,8 @@ angular.module('bahmni.clinical')
spinner.forPromise(
diagnosisService.deleteDiagnosis(obsUUid).then(function () {
messagingService.showMessage('info', 'DELETED_MESSAGE');
var currentUuid = $scope.consultation.savedDiagnosesFromCurrentEncounter.length > 0 ?
$scope.consultation.savedDiagnosesFromCurrentEncounter[0].encounterUuid : "";
var currentUuid = $scope.consultation.savedDiagnosesFromCurrentEncounter.length > 0
? $scope.consultation.savedDiagnosesFromCurrentEncounter[0].encounterUuid : "";
return reloadDiagnosesSection(currentUuid);
}))
.then(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ angular.module('bahmni.clinical')
var previousDispositionNotes = getPreviousDispositionNote();
if (getSelectedConceptName($scope.dispositionCode, $scope.dispositionActions)) {
return _.cloneDeep(previousDispositionNotes) || {concept: {uuid: $scope.dispositionNoteConceptUuid}};
}
else {
} else {
return {concept: {uuid: $scope.dispositionNoteConceptUuid}};
}
};
Expand Down Expand Up @@ -52,12 +51,10 @@ angular.module('bahmni.clinical')
var isVisitOpen = visitSummary ? _.isEmpty(visitSummary.stopDateTime) : false;
if (visitSummary && visitSummary.isDischarged() && isVisitOpen) {
finalDispositionActions = getDispositionActions(finalDispositionActions, dispositions, { code: defaultDispositions[0]});
}
else if (visitSummary && visitSummary.isAdmitted() && isVisitOpen) {
} else if (visitSummary && visitSummary.isAdmitted() && isVisitOpen) {
finalDispositionActions = getDispositionActions(finalDispositionActions, dispositions, { code: defaultDispositions[2]});
finalDispositionActions = getDispositionActions(finalDispositionActions, dispositions, { code: defaultDispositions[3]});
}
else {
} else {
finalDispositionActions = getDispositionActions(finalDispositionActions, dispositions, { code: defaultDispositions[1]});
}
return finalDispositionActions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ angular.module('bahmni.clinical')

$scope.updateAllOrderAttributesByName = function (orderAttribute, drugOrderGroup) {
drugOrderGroup[orderAttribute.name] = drugOrderGroup[orderAttribute.name] || {};
drugOrderGroup[orderAttribute.name].selected = drugOrderGroup[orderAttribute.name].selected ? false : true;
drugOrderGroup[orderAttribute.name].selected = !drugOrderGroup[orderAttribute.name].selected;

drugOrderGroup.drugOrders.forEach(function (drugOrder) {
var selectedOrderAttribute = getAttribute(drugOrder, orderAttribute.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ angular.module('bahmni.clinical')
$scope.activateTab($scope.tabs[0]);

$scope.toggleNote = function () {
$scope.noteState = $scope.noteState ? false : true;
$scope.noteState = !$scope.noteState;
};

var init = function () {
$scope.noteState = $scope.consultation.labOrderNote && $scope.consultation.labOrderNote.value ? true : false;
$scope.noteState = !!($scope.consultation.labOrderNote && $scope.consultation.labOrderNote.value);
};

$scope.onNoteChanged = function () {
Expand Down
6 changes: 3 additions & 3 deletions ui/app/clinical/consultation/controllers/orderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ angular.module('bahmni.clinical')
$scope.tabs = [];
_.forEach($scope.allOrdersTemplates, function (item) {
var conceptName = $scope.getName(item);
$scope.tabs.push({name: conceptName ? conceptName : item.name.name, topLevelConcept: item.name.name});
$scope.tabs.push({name: conceptName || item.name.name, topLevelConcept: item.name.name});
});
if ($scope.tabs) {
$scope.activateTab($scope.tabs[0]);
Expand Down Expand Up @@ -232,8 +232,8 @@ angular.module('bahmni.clinical')
var configuredOptions = getConfiguredOptions();
return _.some(configuredOptions, function (option) {
return option.toLowerCase() === 'needsprint';
})
&& !isOrderSaved;
}) &&
!isOrderSaved;
};
$scope.isUrgent = function () {
var configuredOptions = getConfiguredOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ Bahmni.Clinical.EncounterTransactionMapper = function () {
} else if (order.isDiscontinued) {
return Bahmni.Clinical.Order.discontinue(order);
}
return { uuid: order.uuid, concept: {name: order.concept.name, uuid: order.concept.uuid },
commentToFulfiller: order.commentToFulfiller, urgency: order.urgency};
return { uuid: order.uuid,
concept: {name: order.concept.name, uuid: order.concept.uuid },
commentToFulfiller: order.commentToFulfiller,
urgency: order.urgency};
});
encounterData.orders = encounterData.orders.concat(tempOrders);
};
Expand Down
4 changes: 2 additions & 2 deletions ui/app/clinical/consultation/models/Specimen.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Bahmni.Clinical.Specimen = function (specimen, allSamples) {
};

self.isDirty = function () {
return (self.dateCollected && !self.type) ||
return !!((self.dateCollected && !self.type) ||
(!self.dateCollected && !self.type && self.isAdditionalAttriburtesFilled()) ||
(!self.dateCollected && self.type) ||
(!self.dateCollected && !self.type && self.identifier) || isDirtyRuleForFreeText() ? true : false;
(!self.dateCollected && !self.type && self.identifier) || isDirtyRuleForFreeText());
};

self.isEmpty = function () {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/clinical/consultation/services/treatmentConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ angular.module('bahmni.clinical').factory('treatmentConfig',

tabConfig.orderSet = tabConfig.orderSet || {};
var showDoseFractions = tabConfig.inputOptionsConfig.showDoseFractions;
tabConfig.inputOptionsConfig.showDoseFractions = showDoseFractions ? showDoseFractions : false;
tabConfig.inputOptionsConfig.showDoseFractions = showDoseFractions || false;
tabConfig.drugOrderHistoryConfig = tabConfig.drugOrderHistoryConfig || {};
angular.extend(medicationTabConfig, commonConfig, tabConfig);
drugOrderOptions = new Bahmni.Clinical.DrugOrderOptions(medicationTabConfig.inputOptionsConfig, medicationTabConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ angular.module('bahmni.clinical')
$scope.diseaseTemplates = diseaseTemplate;
$scope.sectionGroups = dashboardModel.getSections($scope.diseaseTemplates);
});
$scope.currentDashboardTemplateUrl = $state.current.views['dashboard-content'] ?
$state.current.views['dashboard-content'].templateUrl : $state.current.views['dashboard-content'];
$scope.currentDashboardTemplateUrl = $state.current.views['dashboard-content']
? $state.current.views['dashboard-content'].templateUrl : $state.current.views['dashboard-content'];
};

$scope.init(getCurrentTab());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ angular.module('bahmni.clinical')
.controller('PatientDashboardTreatmentController', ['$scope', '$rootScope', 'ngDialog', 'visitActionsService', 'treatmentService',
function ($scope, $rootScope, ngDialog, visitActionsService, treatmentService) {
var treatmentConfigParams = $scope.dashboard.getSectionByType("treatment") || {};
$scope.isEmailPresent = $scope.patient.email ? true : false;
$scope.isEmailPresent = !!$scope.patient.email;
var patientParams = {"patientUuid": $scope.patient.uuid, "isEmailPresent": $scope.isEmailPresent};
var sharePrescriptionToggles = {"prescriptionEmailToggle": $rootScope.prescriptionEmailToggle};
var printParams = treatmentConfigParams.prescriptionPrint || {};
Expand Down
6 changes: 3 additions & 3 deletions ui/app/clinical/dashboard/mappers/recordsMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Bahmni.Clinical.RecordsMapper = function () {
var DateUtil = Bahmni.Common.Util.DateUtil;

var sortByDateTimeOrId = function (record1, record2) {
return record2.imageObservation.observationDateTime !== record1.imageObservation.observationDateTime ?
DateUtil.parse(record2.imageObservation.observationDateTime) - DateUtil.parse(record1.imageObservation.observationDateTime) :
record2.id - record1.id;
return record2.imageObservation.observationDateTime !== record1.imageObservation.observationDateTime
? DateUtil.parse(record2.imageObservation.observationDateTime) - DateUtil.parse(record1.imageObservation.observationDateTime)
: record2.id - record1.id;
};

this.map = function (records) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ angular.module('bahmni.clinical')
$scope.params = angular.extend(defaultParams, $scope.params);

$scope.hasNotes = function () {
return $scope.test.notes || $scope.test.showNotes ? true : false;
return !!($scope.test.notes || $scope.test.showNotes);
};
$scope.getFormattedRange = function (test) {
if (test.minNormal && test.maxNormal) {
Expand Down
3 changes: 1 addition & 2 deletions ui/app/common/concept-set/directives/conceptSetGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ angular.module('bahmni.common.conceptSet')
});
if (anotherTemplate) {
$scope.allTemplates.splice(index, 1);
}
else {
} else {
$scope.allTemplates[index].isAdded = false;
var clonedObj = $scope.allTemplates[index].clone();
$scope.allTemplates[index] = clonedObj;
Expand Down
8 changes: 4 additions & 4 deletions ui/app/common/concept-set/models/observationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Bahmni.ObservationForm = function (formUuid, user, formName, formVersion, observ
self.alwaysShow = user.isFavouriteObsTemplate(self.conceptName);
self.observations = [];
_.each(observations, function (observation) {
var observationFormField = observation.formFieldPath ?
Bahmni.Common.Util.FormFieldPathUtil.getFormNameAndVersion(observation.formFieldPath) : null;
if (observationFormField && observationFormField.formName === formName
&& observationFormField.formVersion == formVersion) {
var observationFormField = observation.formFieldPath
? Bahmni.Common.Util.FormFieldPathUtil.getFormNameAndVersion(observation.formFieldPath) : null;
if (observationFormField && observationFormField.formName === formName &&
observationFormField.formVersion == formVersion) {
self.observations.push(observation);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ angular.module('bahmni.common.displaycontrol.forms')
return displayName;
};
var getLocaleSpecificConceptName = function (concept, locale, conceptNameType) {
conceptNameType = conceptNameType ? conceptNameType : "SHORT";
conceptNameType = conceptNameType || "SHORT";
var localeSpecificName = _.filter(concept.names, function (name) {
return ((name.locale === locale) && (name.conceptNameType === conceptNameType));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ angular.module('bahmni.common.displaycontrol.observation')
$scope.showGroupDateTime = $scope.config.showGroupDateTime !== false;

var mapObservation = function (observations) {
var conceptsConfig = $scope.config.formType === Bahmni.Common.Constants.forms2Type ? {} :
appService.getAppDescriptor().getConfigValue("conceptSetUI") || {};
var conceptsConfig = $scope.config.formType === Bahmni.Common.Constants.forms2Type ? {}
: appService.getAppDescriptor().getConfigValue("conceptSetUI") || {};

observations = new Bahmni.Common.Obs.ObservationMapper().map(observations, conceptsConfig, null, $translate);

Expand Down
Loading
Loading