NINS_CODE/bahmni_config/openmrs/apps/customDisplayControl/js/customControl.js
travelershot 70dda814aa codepush
2024-12-12 22:37:39 +06:00

3095 lines
191 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
angular.module('bahmni.common.displaycontrol.custom')
.directive('commonPatientInfoHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/commonPatientInfoHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('commonPatientAdditionalInfoHeader', ['appService', '$http', '$q', '$sce', function (appService, $http, $q, $sce) {
var link = function ($scope) {
$q.all([getPatientInfo($scope.patient.uuid)]).then(function (response) {
$scope.address = response[0].data.results[0];
});
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/commonPatientAdditionalInfoHeader.html";
}
var getPatientInfo = function (patientIdentifier) {
return $http.get(`/openmrs/ws/rest/v1/person/${patientIdentifier}/address`, {
method: "GET",
withCredentials: true
});
};
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('admissionFormHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/admissionFormHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('admissionForm', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
$scope.curDate = new Date()
spinner.forPromise($q.all([bedService.getAssignedBedForPatient($scope.patient.uuid), visitService.getVisitSummary($scope.visitUuid)]).then(function (results) {
$scope.bedDetails = results[0];
$scope.wardText = results[0]
$scope.splitW = results[0]?.wardName?.split("(")[1]
$scope.DepartmentName = $scope.splitW?.split(")")[0]
if (results[1].length > 0) {
}
$scope.visitSummary = results[1].data;
if (results[1].data.admissionDetails !== null) {
$scope.providerName = results[1].data.admissionDetails.provider;
}
$scope.providerName = results[1].data?.admissionDetails?.provider;
$q.all([getPatientInfo($scope.patient.uuid)]).then(function (response) {
$scope.address = response[0].data.results[0];
});
var params = {
patientUuid: $scope.patient.uuid, visitUuid: $scope.visitUuid
};
var getDispositionProvider = function () {
return $http.get(`/openmrs/ws/rest/v1/obs?limit=1&concepts=Disposition&patient=${$scope.patient.uuid}`, {
method: "GET",
withCredentials: true
});
};
var getProviderDesignation = function (providerUuid) {
var params = {
q: "bahmni.sqlGet.providerDesignation2",
v: "full",
providerUuid: providerUuid
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
var getApiData = function (url) {
return $http.get(`/openmrs${url}`, {
method: "GET",
withCredentials: true
});
};
$q.all([getDispositionProvider()]).then(function (response) {
if (response[0].data.results.length > 0) {
$q.all([getApiData(response[0].data.results[0].links[0].uri.split('/openmrs')[1])]).then(function (response) {
$q.all([getApiData(response[0].data.encounter.links[0].uri.split('/openmrs')[1])]).then(function (response) {
$q.all([getApiData(response[0].data.encounterProviders[0].links[0].uri.split('/openmrs')[1])]).then(function (response) {
$q.all([getApiData(response[0].data.provider.links[0].uri.split('/openmrs')[1])]).then(function (response) {
$scope.providerName = response[0].data.person.display;
});
$q.all([getProviderDesignation(response[0].data.provider.uuid)]).then(function (response) {
if (response[0].data.length > 0) {
for (var i = 0; i < response[0].data.length; i++) {
if (response[0].data[i].name == 'Designation') {
$scope.providerDesignation = response[0].data[i].value_reference;
}
}
}
});
});
});
});
}
});
// $scope.curDate = new Date();
$http.get(Bahmni.Common.Constants.bahmniDiagnosisUrl, {
method: "GET",
params: params,
withCredentials: true
}).success(function (response) {
$scope.obsDiagnosis = response;
$scope.curDate = new Date();
});
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/admissionFormFormate.html";
}));
var getPatientInfo = function (patientIdentifier) {
return $http.get(`/openmrs/ws/rest/v1/person/${patientIdentifier}/address`, {
method: "GET",
withCredentials: true
});
};
var getProviderDesignation = function (providerUuid) {
var params = {
q: "bahmni.sqlGet.providerDesignation2",
v: "full",
providerUuid: providerUuid
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('birthCertificate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["HEIGHT"];
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/birthCertificate.html";
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
}));
};
return {
restrict: 'E',
template: '<ng-include src="contentUrl"/>',
link: link
}
}])
.directive('deathCertificate', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', function ($q, observationsService, visitService, bedService, appService, spinner, $sce) {
var link = function ($scope) {
$scope.displayStuff = false;
var conceptNames = ["Date of death", "Death Notes, Citizenship", "Death Notes, Religion"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
if ($scope.observations.length > 0) {
$scope.displayStuff = true;
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].concept.name == 'Date of death') {
$scope.dateOfDeath = response.data[i].value;
}
if (response.data[i].concept.name == 'Death Notes, Citizenship') {
$scope.deathNotesCitizenship = response.data[i].value;
}
if (response.data[i].concept.name == 'Death Notes, Religion') {
$scope.deathNotesReligion = response.data[i].value.shortName;
}
}
}
}));
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/deathCertificate.html";
spinner.forPromise($q.all([bedService.getAssignedBedForPatient($scope.patient.uuid), visitService.getVisitSummary($scope.visitUuid)]).then(function (results) {
$scope.bedDetails = results[0];
$scope.visitSummary = results[1].data;
}));
};
var controller = function ($scope) {
$scope.htmlLabel = function (label) {
return $sce.trustAsHtml(label)
}
}
return {
restrict: 'E',
link: link,
controller: controller,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('admissionDetailsInfo', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
$scope.displayStuff = false;
spinner.forPromise($q.all([bedService.getAssignedBedForPatient($scope.patient.identifier), visitService.getVisitSummary($scope.visitUuid)]).then(function (results) {
var patientIdentifier = $scope.patient.identifier.toString();
$q.all([getAdmissionInfo(patientIdentifier)]).then(function (response) {
if (response[0].data.length > 0) {
$scope.wardName = response[0].data[0].name;
$scope.bedNumber = response[0].data[0].bed_number;
$scope.admissionDate = response[0].data[0].date_created;
$scope.releaseDate = response[0].data[0].date_stopped;
var parentId = response[0].data[0].parent_location;
$q.all([getAdmissionRoomInfo(parentId)]).then(function (response) {
if (response[0].data.length > 0) {
$scope.roomName = response[0].data[0].name;
}
});
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/admissionForm.html";
}
});
}));
};
var controller = function ($scope) {
$scope.htmlLabel = function (label) {
return $sce.trustAsHtml(label)
}
};
var getAdmissionInfo = function (patientIdentifier) {
var params = {
q: "bahmni.sqlGet.bedMapInfo",
v: "full",
patientIdentifier: patientIdentifier
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
var getAdmissionRoomInfo = function (parentId) {
var params = {
q: "bahmni.sqlGet.bedMapRoomInfo",
v: "full",
parentId: parentId
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
return {
restrict: 'E',
link: link,
controller: controller,
// template: '<ng-include src="contentUrl"/>'
}
}])
.directive('deathFooter', ['observationsService', 'visitService', 'appService', 'spinner', function (observationsService, visitService, appService, spinner) {
var link = function ($scope) {
$scope.displayStuff = false;
var conceptNames = ["Date of death"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
if ($scope.observations.length > 0) {
$scope.displayStuff = true;
}
}));
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/deathFooter.html";
$scope.curDate = new Date();
};
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}])
.directive('dischargeSummary', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', function ($q, observationsService, visitService, bedService, appService, spinner) {
var link = function ($scope) {
$scope.displayStuff = false;
var conceptNames = ["Discharge Summary"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
if ($scope.observations.length > 0) {
$scope.displayStuff = true;
}
}));
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/dischargeSummary.html";
spinner.forPromise($q.all([bedService.getAssignedBedForPatient($scope.patient.uuid), visitService.getVisitSummary($scope.visitUuid)]).then(function (results) {
$scope.bedDetails = results[0];
$scope.visitSummary = results[1].data;
}));
};
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}]).directive('footerSummary', ['observationsService', 'visitService', 'appService', 'spinner', function (observationsService, visitService, appService, spinner) {
var link = function ($scope) {
$scope.displayStuff = false;
var conceptNames = ["Discharge Summary"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
if ($scope.observations.length > 0) {
$scope.displayStuff = true;
}
}));
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/footerSummary.html";
spinner.forPromise(visitService.getVisitSummary($scope.visitUuid).then(function (results) {
$scope.visitSummary = results.data;
$scope.curDate = new Date();
}));
};
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}]).directive('commonFooter', ['observationsService', 'visitService', 'appService', 'spinner', function (observationsService, visitService, appService, spinner) {
var link = function ($scope) {
$scope.displayStuff = false;
$scope.displayStuff = false;
var conceptNames = [$scope.conceptName];
spinner.forPromise(observationsService.fetch($scope.$parent.patient.uuid, conceptNames, "latest", undefined, $scope.$parent.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
if ($scope.observations.length > 0) {
$scope.displayStuff = true;
}
}));
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/commonFooter.html";
$scope.curDate = new Date();
};
return {
restrict: 'E',
link: link,
scope: {
conceptName: "@"
},
template: '<ng-include src="contentUrl"/>',
}
}]).directive('prescriptionFooter', ['observationsService', 'treatmentService', 'labOrderResultService', 'visitService', 'appService', 'spinner', '$q', '$http',
function (observationsService, treatmentService, labOrderResultService, visitService, appService, spinner, $q, $http) {
var link = function ($scope) {
spinner.forPromise(treatmentService.getPrescribedAndActiveDrugOrders($scope.patient.uuid, undefined, false, [$scope.visitUuid]).then(function (response) {
if (response.data.visitDrugOrders.length > 0) {
var visitDrugOrders = response.data.visitDrugOrders[0];
var provider = visitDrugOrders.provider;
$scope.providerName = provider.name;
var providerUuid = provider.uuid;
$q.all([getProviderDesignation(providerUuid)]).then(function (response) {
if (response[0].data.length > 0) {
for (var i = 0; i < response[0].data.length; i++) {
if (response[0].data[i].name == 'Designation') {
$scope.providerDesignation = response[0].data[i].value_reference;
}
if (response[0].data[i].name == 'Organization') {
$scope.providerOrganization = response[0].data[i].value_reference;
}
}
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/prescription.html";
$scope.curDate = new Date();
});
} else {
var params = {
visitUuids: $scope.$parent.visitUuid
};
$http.get(Bahmni.Common.Constants.bahmniLabOrderResultsUrl, {
method: "GET",
params: params,
withCredentials: true
}).success(function (response) {
if (response.results.length > 0) {
var orderUuid = response.results[0].orderUuid;
if (orderUuid) {
$q.all([getProviderUuid(orderUuid)]).then(function (response) {
if (response[0].data.length > 0) {
var providerUuid = response[0].data[0].uuid;
$scope.providerName = response[0].data[0].given_name + (response[0].data[0].middle_name ? (' ' + response[0].data[0].middle_name) : '') + ' ' + response[0].data[0].family_name;
if (providerUuid) {
$q.all([getProviderDesignation(providerUuid)]).then(function (response) {
if (response[0].data.length > 0) {
for (var i = 0; i < response[0].data.length; i++) {
if (response[0].data[i].name == 'Designation') {
$scope.providerDesignation = response[0].data[i].value_reference;
}
if (response[0].data[i].name == 'Organization') {
$scope.providerOrganization = response[0].data[i].value_reference;
}
}
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/prescription.html";
$scope.curDate = new Date();
});
}
}
});
}
} else {
var conceptNames = ["Consultation Note", "Common Chief Complaint", "Epilepsy Chief Complaint", "Stroke Chief Complaint"];
spinner.forPromise(observationsService.fetch($scope.$parent.patient.uuid, conceptNames, "latest", undefined, $scope.$parent.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
var providerUuid = response.data[0].providers[0].uuid;
$scope.providerName = response.data[0].providers[0].name;
$q.all([getProviderDesignation(providerUuid)]).then(function (response) {
if (response[0].data.length > 0) {
for (var i = 0; i < response[0].data.length; i++) {
if (response[0].data[i].name == 'Designation') {
$scope.providerDesignation = response[0].data[i].value_reference;
}
if (response[0].data[i].name == 'Organization') {
$scope.providerOrganization = response[0].data[i].value_reference;
}
}
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/prescription.html";
$scope.curDate = new Date();
});
}
}));
}
});
}
}));
var getProviderDesignation = function (providerUuid) {
var params = {
q: "bahmni.sqlGet.providerDesignation2",
v: "full",
providerUuid: providerUuid
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
var getProviderUuid = function (orderUuid) {
var params = {
q: "bahmni.sqlGet.orderUuid",
v: "full",
orderUuid: orderUuid
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
var referredInternalConcepts = ["Refer to Internal"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, referredInternalConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.referredInternalResult = response.data[0]?.value;
}
}));
var referredHospitalConcepts = ["Refer to Other Hospital"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, referredHospitalConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.referredHospitalResult = response.data[0]?.value;
}
}));
var followUpConcepts = ["Next Follow Up"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, followUpConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
$scope.followUpResult = response.data[0]?.value;
}
}));
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}]).directive('medicalFooter', ['observationsService', '$q', 'appService', 'spinner', '$http', function (observationsService, $q, appService, spinner, $http) {
var link = function ($scope) {
var conceptNames = ["Medical Certificate, Suffering From"];
spinner.forPromise(observationsService.fetch($scope.$parent.patient.uuid, conceptNames, "latest", undefined, $scope.$parent.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
var providerUuid = response.data[0].providers[0].uuid;
$scope.providerName = response.data[0].providers[0].name;
$q.all([getProviderDesignation(providerUuid)]).then(function (response) {
if (response[0].data.length > 0) {
for (var i = 0; i < response[0].data.length; i++) {
if (response[0].data[i].name == 'Designation') {
$scope.providerDesignation = response[0].data[i].value_reference;
}
if (response[0].data[i].name == 'Organization') {
$scope.providerOrganization = response[0].data[i].value_reference;
}
}
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/medicalFooter.html";
$scope.curDate = new Date();
});
}
}));
var getProviderDesignation = function (providerUuid) {
var params = {
q: "bahmni.sqlGet.providerDesignation2",
v: "full",
providerUuid: providerUuid
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: truenins - onexamination - template
});
};
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}])
.directive('dischargedFooter', ['observationsService', '$q', 'appService', 'spinner', '$http', function (observationsService, $q, appService, spinner, $http) {
var link = function ($scope) {
var conceptNames = ["Inpatient Outcome"];
spinner.forPromise(observationsService.fetch($scope.$parent.patient.uuid, conceptNames, "latest", undefined, $scope.$parent.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
var providerUuid = response.data[0].providers[0].uuid;
$scope.providerName = response.data[0].providers[0].name;
$q.all([getProviderDesignation(providerUuid)]).then(function (response) {
if (response[0].data.length > 0) {
for (var i = 0; i < response[0].data.length; i++) {
if (response[0].data[i].name == 'Designation') {
$scope.providerDesignation = response[0].data[i].value_reference;
}
if (response[0].data[i].name == 'Organization') {
$scope.providerOrganization = response[0].data[i].value_reference;
}
}
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/dischargedFooter.html";
$scope.curDate = new Date();
});
}
}));
var getProviderDesignation = function (providerUuid) {
var params = {
q: "bahmni.sqlGet.providerDesignation2",
v: "full",
providerUuid: providerUuid
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}])
.directive('endPrescription', ['treatmentService', 'visitService', 'appService', 'spinner', function (treatmentService, visitService, appService, spinner) {
var link = function ($scope) {
spinner.forPromise(treatmentService.getPrescribedAndActiveDrugOrders($scope.patient.uuid, undefined, false, [$scope.visitUuid]).then(function (response) {
$scope.drugOrders = response.data;
var audits = _.map($scope.drugOrders.visitDrugOrders, function (drugOrder) {
return _.pick(drugOrder, 'creatorName', 'provider');
});
var auditDisplay = _.map(audits, function (audit) {
return audit.creatorName == audit.provider.name ? audit.provider.name : audit.creatorName + " on behalf of " + audit.provider.name;
});
$scope.displayName = _.uniq(auditDisplay);
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/endprescription.html";
$scope.curDate = new Date();
}));
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}]).directive('headerPadWhiteSpace', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/headerPadWhiteSpace.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}]).directive('treatmentPrescription', ['appService', 'treatmentService', 'visitService', 'spinner', '$sce', function (appService, treatmentService, visitService, spinner, $sce) {
var link = function ($scope) {
spinner.forPromise(treatmentService.getPrescribedAndActiveDrugOrders($scope.patient.uuid, undefined, false, [$scope.visitUuid]).then(function (response) {
$scope.drugOrders = response.data;
$scope.frequencyList = [];
$scope.frequencyList["Once a day"] = "";
if ($scope.drugOrders.visitDrugOrders.length == 0) {
$scope.isDataAvailable = false;
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/treatmentPrescription.html";
$scope.curDate = new Date();
}));
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive("medicineDetails", function () {
let template = "";
var link = function ($scope) {
$scope.instruct = JSON.parse($scope.drugOrder.dosingInstructions.administrationInstructions);
let doseUnits = $scope.drugOrder.dosingInstructions.doseUnits.split(" ").length > 0 ?
$scope.drugOrder.dosingInstructions.doseUnits.split(" ")[0] : $scope.drugOrder.dosingInstructions.doseUnits;
let dose = $scope.drugOrder.dosingInstructions.dose;
function CheckDecimal(num) {
if (Number(num) === num && num % 1 !== 0) {
return true;
} else {
return false;
}
}
$scope.testNumber = "";
let numbersE = {
0: '',
1: '১',
2: '২',
3: '৩',
4: '',
5: '৫',
6: '৬',
7: '',
8: '৮',
9: '৯'
};
$scope.replaceNumbersE2B = function (input) {
var output = [];
for (var i = 0; i < input?.length; ++i) {
if (numbersE.hasOwnProperty(input[i])) {
output.push(numbersE[input[i]]);
} else {
output.push(input[i]);
}
}
return output.join('');
};
$scope.convertToBangla = function (num) {
let dose = num;
if (dose === 1) {
return dose = '<b>' + '১' + '</b>';
} else if (dose === 2) {
return dose = '<b>' + '২' + '</b>';
} else if (dose === 3) {
return dose = '<b>' + '৩' + '</b>';
} else if (dose === 4) {
return dose = '<b>' + '' + '</b>';
} else if (dose === 5) {
return dose = '<b>' + '৫' + '</b>';
} else if (dose === 6) {
return dose = '<b>' + '৬' + '</b>';
} else if (dose === 7) {
return dose = '<b>' + '' + '</b>';
} else if (dose === 8) {
return dose = '<b>' + '৮' + '</b>';
} else if (dose === 9) {
return dose = '<b>' + '৯' + '</b>';
} else if (dose === 0) {
return dose = '<b>' + '' + '</b>';
}
}
if (CheckDecimal(dose) === true) {
// ১ ২ ৩ ৫ ৬ ৮ ৯
let doseArray = new Array();
doseArray = dose.toString().split('.');
if (doseArray[0] === '1') {
doseArray[0] = '১';
} else if (doseArray[0] === '2') {
doseArray[0] = '২';
} else if (doseArray[0] === '3') {
doseArray[0] = '৩';
} else if (doseArray[0] === '4') {
doseArray[0] = '';
} else if (doseArray[0] === '5') {
doseArray[0] = '৫';
} else if (doseArray[0] === '6') {
doseArray[0] = '৬';
} else if (doseArray[0] === '7') {
doseArray[0] = '';
} else if (doseArray[0] === '8') {
doseArray[0] = '৮';
} else if (doseArray[0] === '9') {
doseArray[0] = '৯';
} else if (doseArray[0] === '0') {
doseArray[0] = '';
}
if (doseArray[1] === '25') {
dose = '<b>' + doseArray[0] + '</b>' + '<span><sup>১</sup>&frasl;<sub></sub></span>';
} else if (doseArray[1] === '33') {
dose = '<b>' + doseArray[0] + '</b>' + '<span><sup>১</sup>&frasl;<sub>৩</sub></span>';
} else if (doseArray[1] === '5') {
dose = '<b>' + doseArray[0] + '</b>' + '<span><sup>১</sup>&frasl;<sub>২</sub></span>';
} else if (doseArray[1] === '67') {
dose = '<b>' + doseArray[0] + '</b>' + '<span><sup>২</sup>&frasl;<sub>৩</sub></span>';
} else if (doseArray[1] === '75') {
dose = '<b>' + doseArray[0] + '</b>' + '<span><sup>৩</sup>&frasl;<sub></sub></span>';
}
} else {
if (dose === 1) {
dose = '<b>' + '১' + '</b>';
} else if (dose === 2) {
dose = '<b>' + '২' + '</b>';
} else if (dose === 3) {
dose = '<b>' + '৩' + '</b>';
} else if (dose === 4) {
dose = '<b>' + '' + '</b>';
} else if (dose === 5) {
dose = '<b>' + '৫' + '</b>';
} else if (dose === 6) {
dose = '<b>' + '৬' + '</b>';
} else if (dose === 7) {
dose = '<b>' + '' + '</b>';
} else if (dose === 8) {
dose = '<b>' + '৮' + '</b>';
} else if (dose === 9) {
dose = '<b>' + '৯' + '</b>';
} else if (dose === 0) {
dose = '<b>' + '' + '</b>';
}
}
let plusSign = ' + ';
let zeroSign = '<b>0</b>';
var instructionList = JSON.parse($scope.drugOrder.dosingInstructions.administrationInstructions);
$scope.instruction = (instructionList.instructions ? instructionList.instructions : '');
$scope.additionalInstruction = (instructionList.additionalInstructions ? instructionList.additionalInstructions : '');
$scope.durationHide = false;
if ($scope.additionalInstruction.toLowerCase() == 'go') {
$scope.durationHide = true;
$scope.additionalInstruction = 'চলবে';
}
if ($scope.drugOrder.dosingInstructions.frequency == 'Once when need') {
$scope.durationHide = true;
}
switch ($scope.drugOrder.dosingInstructions.frequency) {
case 'Once a day (Morning)':
$scope.dosageFrequency = dose + plusSign + zeroSign + plusSign + zeroSign + " (" + doseUnits + ")";
break;
case 'Once a day (Noon)':
$scope.dosageFrequency = zeroSign + plusSign + dose + plusSign + zeroSign + " (" + doseUnits + ")";
break;
case 'Once a day (Evening)':
$scope.dosageFrequency = zeroSign + plusSign + zeroSign + plusSign + dose + "(" + doseUnits + ")";
break;
case 'Twice a day':
$scope.dosageFrequency = dose + plusSign + zeroSign + plusSign + dose + " (" + doseUnits + ")";
break;
case 'Every 12 hours':
$scope.dosageFrequency = dose + plusSign + zeroSign + plusSign + dose + " (" + doseUnits + ")";
break;
case 'Thrice a day':
$scope.dosageFrequency = dose + plusSign + dose + plusSign + dose + " (" + doseUnits + ")";
break;
case 'Every 8 hours':
$scope.dosageFrequency = dose + plusSign + dose + plusSign + dose + " (" + doseUnits + ")";
break;
case 'Every 2 hours':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( প্রতি ২ ঘন্টা পরপর )");
break;
case 'Every 3 hours':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( প্রতি ৩ ঘন্টা পরপর )");
break;
case 'Every 4 hours':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( প্রতি ঘন্টা পরপর )");
break;
case 'Every 6 hours':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( প্রতি ৬ ঘন্টা পরপর )");
break;
case 'On alternate days':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( একদিন পরপর )");
break;
case 'Six days a week':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( সপ্তাহে ৬ দিন )");
break;
case 'Five days a week':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( সপ্তাহে ৫ দিন )");
break;
case 'Four days a week':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( সপ্তাহে দিন )");
break;
case 'Five times a day':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( দিনে ৫ বার )");
break;
case 'Once a month':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( মাসে ১ বার )");
break;
case 'Every 3 weeks':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( ৩ সপ্তাহ পরপর )");
break;
case 'Every 2 weeks':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( ২ সপ্তাহ পরপর )");
break;
case 'Thrice a week':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( সপ্তাহে ৩ দিন )");
break;
case 'Twice a week':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( সপ্তাহে ২ দিন )");
break;
case 'Once a week':
$scope.dosageFrequency = (" " + dose +
" " + doseUnits + " " + " ( সপ্তাহে ১ দিন )");
break;
case 'Every Hour':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( প্রতি ঘণ্টায় )");
break;
case 'Four times a day':
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " ( দিনে বার )");
break;
case 'Once when need':
$scope.dosageFrequency = ("" + dose +
"টা (" + doseUnits + ") ");
break;
default:
$scope.dosageFrequency = ("" + dose +
" " + doseUnits + " " + " (" + $scope.drugOrder.dosingInstructions.frequency + ")");
}
};
return {
scope: {
'drugOrder': '=',
'index': '='
},
link: link,
template: "<div style='padding-bottom: 5px'><b>{{index + 1}}.\n" +
"<span>{{drugOrder.drug != null ? (drugOrder.drug.form).substring(0,3)+'. ' : ''}}</span>" +
"<span>{{drugOrder.drugNonCoded ? drugOrder.drugNonCoded : (drugOrder.drug.name)}}</span>" +
"<span>{{drugOrder.drugNonCoded ? '' : (' ('+drugOrder.concept.name+')')}}</span>" +
"<br/></div>" +
"<span style='padding-left: 15px' ng-if='drugOrder.dosingInstructions.dose != null' ng-bind-html='dosageFrequency'></span> " +
"<span style='padding-left: 15px' ng-if='drugOrder.dosingInstructions.dose == null' >" +
"<span ng-bind-html='::replaceNumbersE2B((instruct.morningDose).toString())'></span> + " +
"<span ng-bind-html='::replaceNumbersE2B((instruct.afternoonDose).toString())'></span> + " +
"<span ng-bind-html='::replaceNumbersE2B((instruct.eveningDose).toString())'></span> " +
"<span>{{drugOrder.drug != null ? ('('+ drugOrder.drug.form + ') ') : ''}}</span></span>" +
"<span ng-if='instruction.length > 1'>({{instruction.trim()}})</span>" + " " +
"<span ng-if='additionalInstruction.length > 1'>({{additionalInstruction.trim()}})</span>" + " " +
"<span ng-hide='instruct.continue' ng-if='durationHide == false'> - " +
"<span ng-hide='instruct.continue' style='padding-left: 0px;font-weight: bolder;' > {{replaceNumbersE2B((drugOrder.duration).toString())}} </span>" +
"<span ng-hide='instruct.continue' ng-if = 'drugOrder.durationUnits == \"Day(s)\"'>দিন</span>" +
"<span ng-hide='instruct.continue' ng-if = 'drugOrder.durationUnits == \"Week(s)\"'>সপ্তাহ</span>" +
"<span ng-hide='instruct.continue' ng-if = 'drugOrder.durationUnits == \"Month(s)\"'>মাস</span>" + "</span>" +
"<span ng-if='instruct.continue'>(চলবে)</span>" +
"<br/><br/>"
};
})
.directive('labInvestigation', ['appService', 'labOrderResultService', 'treatmentService', 'visitService', 'spinner', '$http',
function (appService, labOrderResultService, treatmentService, visitService, spinner, $http) {
var link = function ($scope) {
var params = {
visitUuids: $scope.$parent.visitUuid
};
$http.get(Bahmni.Common.Constants.bahmniLabOrderResultsUrl, {
method: "GET",
params: params,
withCredentials: true
}).success(function (response) {
$scope.investigationResults = response.results;
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/labInvestigation.html";
$scope.curDate = new Date();
});
};
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}]).directive('dischargedAdvice', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["Advice on Discharge"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.adviceData = response.data;
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/dischargedAdvice.html";
}));
};
return {
restrict: 'E',
template: '<ng-include src="contentUrl"/>',
link: link
}
}]).directive('dischargedSurgicalNote', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["OT Surgery Notes", "Radiology Notes"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].concept.name == 'OT Surgery Notes') {
$scope.otSurgicalNote = response.data[i].value;
}
if (response.data[i].concept.name == 'Radiology Notes') {
$scope.radiologyNote = response.data[i].value;
}
}
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/dischargedSurgicalNote.html";
}));
};
return {
restrict: 'E',
template: '<ng-include src="contentUrl"/>',
link: link
}
}]).directive('dischargedFollowUpPlan', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["Follow up After", "Duration Coded Units"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].concept.name == 'Follow up After') {
$scope.followUpAfter = response.data[i].value;
}
if (response.data[i].concept.name == 'Duration Coded Units') {
$scope.durationUnits = response.data[i].value.shortName;
}
}
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/dischargedFollowUpPlan.html";
}));
};
return {
restrict: 'E',
template: '<ng-include src="contentUrl"/>',
link: link
}
}]).directive('medicalCertificate', ['observationsService', 'visitService', 'appService', 'spinner', function (observationsService, visitService, appService, spinner) {
var link = function ($scope) {
$scope.displayStuff = false;
var conceptNames = ["Medical Certificate, Suffering From", "Medical, For", "Medical Certificate, Duration Coded Units",
"Medical Certificate, Previous Complications", "Medical Certificate, Advice Name",
"Medical Certificate, From Date", "Medical Certificate, To Date", "Medical Certificate, General Complication Name"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
if (response.data.length > 0) {
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].concept.name == 'Medical Certificate, Suffering From') {
$scope.medicalSufferingFrom = response.data[i].value;
}
if (response.data[i].concept.name == 'Medical, For') {
$scope.medicalSufferingFor = response.data[i].value;
}
if (response.data[i].concept.name == 'Medical Certificate, Duration Coded Units') {
$scope.medicalDurationCodeUnit = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Medical Certificate, Previous Complications') {
$scope.medicalPreviousComplication = response.data[i].value;
}
if (response.data[i].concept.name == 'Medical Certificate, Advice Name') {
$scope.adviceName = response.data[i].value;
}
if (response.data[i].concept.name == 'Medical Certificate, From Date') {
$scope.medicalFromDate = response.data[i].value;
}
if (response.data[i].concept.name == 'Medical Certificate, To Date') {
$scope.medicalToDate = response.data[i].value;
}
if (response.data[i].concept.name == 'Medical Certificate, General Complication Name') {
$scope.medicalGeneralComplicationName = response.data[i].value.split(',');
}
}
}
if ($scope.observations.length > 0) {
$scope.displayStuff = true;
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/medicalCertificate.html";
$scope.curDate = new Date();
}));
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}])
.directive('commonHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/commonHeader.html";
};
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
};
}])
.directive('prescriptionHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/prescriptionHeader.html";
};
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
};
}]).directive('prescriptionBody', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/prescriptionBody.html";
};
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
};
}]).directive('chiefComplaintTemplate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["Condition Complaint Template"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data[0];
$scope.convertToUnits = function (minutes) {
var durationForDisplay = Bahmni.Common.Util.DateUtil.convertToUnits(minutes);
if (durationForDisplay["value"] && durationForDisplay["unitName"]) {
return "since " + durationForDisplay["value"] + " " + durationForDisplay["unitName"];
}
}
}));
};
return {
restrict: 'E',
template:
'<div ng-if="observations.groupMembers">' +
'<span class="section-title" style="font-size: 16px;" ><b>Chief Complaints</b></span> <br>' +
'<ul><li ng-repeat="chiefComplaint in observations.groupMembers" style="padding-bottom: 5px; padding-top: 3px;">' +
'<span style="padding-left: 5px"><b> {{$index + 1}}. </b>{{chiefComplaint.value.shortName? chiefComplaint.value.shortName : chiefComplaint.value}} ({{::convertToUnits(chiefComplaint.duration)}})</span>' +
'</li></ul></div>',
link: link
};
}]).directive('physicalExaminationTemplate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["Vitals"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.physicalExamObs = response.data[0];
}));
};
return {
restrict: 'E',
template:
'<div ng-if="physicalExamObs.groupMembers"><br>' +
'<span style="font-size: 18px;" ><b>Examination</b></span> <br>' +
'<ul><li ng-repeat="results in physicalExamObs.groupMembers" style="padding-bottom: 3px;padding-top: 3px;">' +
'<span style="padding-left: 5px"><b>{{results.concept.name}}</b> : {{ results.value }} {{ results.concept.units}}</span>' +
'</li></ul></div>',
link: link
};
}])
.directive('clinicalDiagnosisTemplate', ['$q', 'observationsService', 'appService', '$http',
function ($q, observationsService, appService, $http) {
var link = function ($scope) {
/* let conceptNames = ["Coded Diagnosis","Diagnosis Certainty","Diagnosis Order","Bahmni Diagnosis Status", "Visit Diagnoses"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
}));*/
var params = {
patientUuid: $scope.patient.uuid, visitUuid: $scope.visitUuid
};
$http.get(Bahmni.Common.Constants.bahmniDiagnosisUrl, {
method: "GET",
params: params,
withCredentials: true
}).success(function (response) {
$scope.obsDiagnosis = response.filter(data => data.certainty === "CONFIRMED")
});
};
return {
restrict: 'E',
link: link,
template: '<div style="padding-bottom: 10px" ng-if="obsDiagnosis.length>0"> <br>' +
'<span style="font-size: 18px; ; padding-bottom: 3px;" ><b>Diagnosis:</b></span><br>' +
'<span><ul style="padding-top: 5px;">\n' +
' <li ng-repeat="obsGroup in obsDiagnosis">\n' +
' <span style="padding-left: 5px;"><b> {{$index + 1}}. </b>{{obsGroup.codedAnswer.name? obsGroup.codedAnswer.name : obsGroup.latestDiagnosis.freeTextAnswer}}</span>\n' +
' </li>\n' +
' </ul></span></div>',
}
}])
.directive('medicationTemplate', ['appService', 'treatmentService', 'visitService', 'spinner', '$sce', function (appService, treatmentService, visitService, spinner, $sce) {
var link = function ($scope) {
spinner.forPromise(treatmentService.getPrescribedAndActiveDrugOrders($scope.patient.uuid, undefined, false, [$scope.visitUuid]).then(function (response) {
$scope.drugOrders = response.data;
$scope.frequencyList = [];
$scope.frequencyList["Once a day"] = "";
if ($scope.drugOrders.visitDrugOrders.length == 0) {
$scope.isDataAvailable = false;
}
$scope.curDate = new Date();
}));
}
return {
restrict: 'E',
link: link,
template: '<span style="font-size: 18px;; padding-bottom: 5px;" ng-if="drugOrders.visitDrugOrders.length>0"><b>Rx:</b></span><br>' +
'<div ng-repeat="drugOrder in drugOrders.visitDrugOrders" style="padding-top:2px; font-size: 15px">\n' +
'<span ng-if="drugOrder.dateStopped === null && drugOrder.action !== \'DISCONTINUE\'">\n' +
'<medicine-details drug-order="drugOrder" index="$index"></medicine-details>\n' +
'\n' +
' </span>\n' +
'\n' +
'</div>'
}
}])
.directive('investigationTemplate', ['appService', 'labOrderResultService', 'treatmentService', 'visitService', 'spinner', '$http',
function (appService, labOrderResultService, treatmentService, visitService, spinner, $http) {
var link = function ($scope) {
var params = {
visitUuids: $scope.$parent.visitUuid
};
$http.get(Bahmni.Common.Constants.bahmniLabOrderResultsUrl, {
method: "GET",
params: params,
withCredentials: true
}).success(function (response) {
$scope.investigationResults = response.results;
$scope.curDate = new Date();
});
};
return {
restrict: 'E',
link: link,
template: '<div ng-if="investigationResults.length>0">' +
' <span style="font-size: 18px; padding-bottom: 5px;" ><b>Investigations:</b></span>' +
'<ul style="padding-top: 2px;"><li ng-repeat="lab in investigationResults" style="padding-bottom: 3px;padding-top: 3px;">' +
'<span style="padding-left: 5px"><b> {{$index + 1}}. </b> {{lab.testName}}</span>' +
'</li></ul></div>'
}
}])
.directive('comorbidTemplate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["NINS Co-morbid Conditions"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data[0]) {
$scope.Comorbid = response.data[0].value.split(',');
}
}));
};
return {
restrict: 'E',
link: link,
template: '<div ng-if="investigationResults.length>0">' +
' <span style="font-size: 18px; padding-bottom: 5px;" ><b>Investigations:</b></span>' +
'<ul style="padding-top: 2px;"><li ng-repeat="lab in investigationResults" style="padding-bottom: 3px;padding-top: 3px;">' +
'<span style="padding-left: 5px"><b> {{$index + 1}}. </b> {{lab.testName}}</span>' +
'</li></ul></div>'
}
}])
.directive('adviceTemplate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["Consultation Note"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data[0]) {
$scope.obsAdvice = response.data[0].value.split(',');
}
}));
};
return {
restrict: 'E',
template: '<div style="padding-bottom: 5px" ng-if="obsAdvice"> <br>' +
'<span style="font-size: 18px" ><b>Advices</b></span> <br>' +
'<span style="padding-top: 5px;">' +
'<ul style="display: block; list-style-type: square; padding-left: 20px;">' +
'<li ng-repeat="advice in obsAdvice" style="padding-bottom: 5px; font-size: 13px;">{{advice}}</li></ul>' +
'</span></div>',
link: link
}
}])
.directive('radiologyTemplate', ['$q', 'observationsService', 'appService', 'orderService', 'treatmentService', 'visitService', 'spinner', '$http',
function ($q, observationsService, appService, orderService, treatmentService, visitService, spinner, $http) {
var link = function ($scope) {
$q.all([getOrderTypeUuid()]).then(function (response) {
if (response[0].data) {
$scope.orderTypeUUID = response[0].data[0].uuid;
var params = {
includeObs: true,
orderTypeUuid: $scope.orderTypeUUID,
patientUuid: $scope.patient.uuid,
visitUuid: $scope.$parent.visitUuid
};
$http.get(Bahmni.Common.Constants.bahmniOrderUrl, {
method: "GET",
params: params,
withCredentials: true
}).success(function (response) {
$scope.results = response;
$scope.curDate = new Date();
});
}
});
};
var getOrderTypeUuid = function () {
var params = {
q: "bahmni.sqlGet.orderTypeUuid",
v: "full"
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
return {
restrict: 'E',
link: link,
template: '<div ng-if="results.length>0">' +
' <span style="font-size: 16px; padding-bottom: 5px;" ><b> Imaging:</b></span>' +
'<ul style="padding-top: 2px;"><li ng-repeat="lab in results" style="padding-bottom: 3px;padding-top: 3px;">' +
'<span style="padding-left: 5px"><b> {{$index + 1}}. </b> {{lab.concept.name}}</span>' +
'</li></ul></div>'
}
}])
.directive('ninsChiefcomplaintsTemplate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["Epilepsy Chief Complaint", "Epilepsy Others CC Option", "Stroke Chief Complaint", "Stroke Others CC Option", "Chief Complaint of Common", "Migraine Chief Complaint", "Migraine Others CC Duration", "SAH Chief Complaint", "TTH Chief Complaint", "Dementia Chief Complaint", "SR Chief complaint"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
let filterCommon = response.data.filter(data => data.concept.name === 'Chief Complaint of Common')
let filterWithoutCommon = response.data.filter(data => data.concept.name !== 'Chief Complaint of Common')
let filterData = filterWithoutCommon.filter(data => data.value.shortName !== 'Others');
let durationData = filterData.map(data => ({ ...data, duration: null, notes: null }));
function dataAssign(data1, data2, concept1, concept2) {
let mainData = data1.filter(data => data.value.shortName === concept1)
if (mainData.length > 0) {
const conceptName = [concept2];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptName, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
data2.map(data => {
if (data.value.shortName === concept1) {
let value = response?.data[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration");
let unit = response?.data[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration Units");
if (value !== undefined) {
data.duration = {
value: value[0]?.value,
unit: unit[0]?.value.shortName,
}
}
}
})
}
}));
}
}
function dataAssignOthers(data1, data2, concept1, concept2, concept3, concept4) {
let filterData = data1.filter(data => data.concept.name === concept1)
if (filterData.length > 0) {
const conceptName = [concept2];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptName, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
response.data.map(data => {
let mainData = data.groupMembers.filter(data => data.concept.name === concept3);
let duration = data.groupMembers.filter(data => data.concept.name === concept4);
data2.map(data => {
if (data.value.name === mainData[0]?.value.name) {
let value = duration[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration");
let unit = duration[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration Units");
if (value !== undefined) {
data.duration = {
value: value[0]?.value,
unit: unit[0]?.value.shortName,
}
}
if (data.comment !== null) {
data.notes = data.comment
}
}
})
})
}
}));
}
}
function dataAssignNote(data1, data2, concept) {
let filterData = data1.filter(data => data.concept.name === concept);
if (filterData.length > 0) {
if (filterData[0].comment !== null) {
data2.push({
concept: {
name: ''
},
value: {
shortName: filterData[0].comment
},
duration: null, notes: null
})
}
}
}
dataAssign(filterWithoutCommon, durationData, 'Recurrence of convulsions that involve limbs', "Epilepsy Duration RCTIL")
dataAssign(filterWithoutCommon, durationData, 'Loss of consciousness', "Epilepsy Duration LC")
dataAssign(filterWithoutCommon, durationData, 'Tongue bite', "Epilepsy Duration TB")
dataAssign(filterWithoutCommon, durationData, 'Salivation', "Epilepsy Duration salivation")
dataAssign(filterWithoutCommon, durationData, 'Involuntarily micturition involved', "Epilepsy Duration IMI")
dataAssignOthers(filterWithoutCommon, durationData, 'Epilepsy Others CC Option', "Epilepcy Others Chief Complaint Data", 'Epilepsy Others CC Option', 'Epilepcy Others CC Duration')
dataAssign(filterWithoutCommon, durationData, 'Slurring of speech', "SD Slurring of speech")
dataAssign(filterWithoutCommon, durationData, 'Headache', "SD Headache")
dataAssign(filterWithoutCommon, durationData, 'Vertigo', "SD Vertigo")
dataAssign(filterWithoutCommon, durationData, 'Vomiting', "SD Vomiting")
dataAssign(filterWithoutCommon, durationData, 'Unsteadiness', "SD Unsteadiness")
dataAssign(filterWithoutCommon, durationData, 'Visual Disturbance', "SD Visual Disturbance")
dataAssign(filterWithoutCommon, durationData, 'Recurrent convulsion', "SD Recurrent convulsion")
dataAssign(filterWithoutCommon, durationData, 'Right sided weakness', "SD Right sided weakness")
dataAssign(filterWithoutCommon, durationData, 'Left sided weakness', "SD Left sided weakness")
dataAssignOthers(filterWithoutCommon, durationData, 'Stroke Others CC Option', "Stoke Others Chief Complaint Data", 'Stroke Others CC Option', 'SD Others Chief Complaint')
// Migraine Chief Complaint
dataAssign(filterWithoutCommon, durationData, 'Episodic, unilateral moderate to severe headache', "Migraine EUM SH Duration")
dataAssign(filterWithoutCommon, durationData, 'Nausea, vertigo dizziness', "Migraine NVD Duration")
dataAssign(filterWithoutCommon, durationData, 'Photophobia and Phonophobia', "Migraine PP Duration")
// IST Chief Complaint
// dataAssign(filterWithoutCommon, durationData, 'Sudden weakness of the body', "IST SWSB Duration")
// dataAssign(filterWithoutCommon, durationData, 'Slurring of speech', "IST SS Duration")
// SAH Chief Complaint
dataAssign(filterWithoutCommon, durationData, 'Sudden severe headache with vomiting', "SAH SSHV Duration")
dataAssign(filterWithoutCommon, durationData, 'Convulsion with loss of consciousness', "SAH CLC Duration")
// TTH Chief Complaint
dataAssign(filterWithoutCommon, durationData, 'Persistent global headache of mild to moderate intensity', "TTH PGHMMI Duration")
dataAssign(filterWithoutCommon, durationData, 'Nausea, vertigo dizziness', "TTH NVD Duration")
// Dementia Chief Complaint
dataAssign(filterWithoutCommon, durationData, 'Forgetfulness', "Dementia Forgetfulness Duration")
dataAssign(filterWithoutCommon, durationData, 'Change in Personality and mood/irritability', "Dementia CPMI Duration")
dataAssign(filterWithoutCommon, durationData, 'Insomnia/Wandering during night', "Dementia IWDN Duration")
// SR Chief Complaint
dataAssign(filterWithoutCommon, durationData, 'Low back pain that radiates to lower limb', "SR CC LBP RLL Duration")
dataAssign(filterWithoutCommon, durationData, 'Neck pain that radiates to upper limb', "SR CC NPRUL Duration")
dataAssign(filterWithoutCommon, durationData, 'Pain in both knee joint', "SR CC PBKJ Duration")
dataAssignNote(filterWithoutCommon, durationData, 'Epilepsy Chief Complaint')
dataAssignNote(filterWithoutCommon, durationData, 'Stroke Chief Complaint')
dataAssignNote(filterWithoutCommon, durationData, 'Migraine Chief Complaint')
dataAssignNote(filterWithoutCommon, durationData, 'IST Chief Complaint')
// dataAssignNote(filterWithoutCommon, durationData, 'SAH Chief Complaint')
if (filterCommon.length > 0) {
let commonData = filterCommon.map(cc => {
let mainData = cc?.groupMembers?.filter(data => data.concept.name === 'Common Chief Complaint');
mainData = mainData.map(data => ({ ...data, duration: null, notes: null }));
let duration = cc?.groupMembers?.filter(data => data.concept.name === 'Duration of Common');
mainData.map(data => {
let value = duration[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration");
let unit = duration[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration Units");
if (value?.length > 0) {
data.duration = {
value: value[0]?.value,
unit: unit[0]?.value.shortName,
}
}
if (data.comment !== null) {
data.notes = data.comment
}
})
return mainData[0];
})
$scope.chiefComplaints = [...durationData, ...commonData];
}
else {
$scope.chiefComplaints = durationData;
}
// IST Chief Complaint
let istConcept = "Chief Complaint of IST";
spinner.forPromise(observationsService.fetch($scope.patient.uuid, istConcept, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
let cc = response.data[0]?.groupMembers.filter(data => data.concept.name === "IST Chief Complaint").filter(data => data.value.shortName !== 'Others');
if (cc?.length > 0) {
let suddenWeakness = cc.filter(data => data.value.name === "IST Sudden weakness of the body");
if (suddenWeakness.length > 0) {
let suddenDuration = response.data[0]?.groupMembers.filter(data => data.concept.name === "IST SWSB Duration");
let ISTSudden = response.data[0]?.groupMembers.filter(data => data.concept.name === "IST Sudden weakness side");
if (ISTSudden.length > 0) {
suddenWeakness[0].value.shortName = `Sudden weakness ${ISTSudden[0].value.name} side of the body`
}
if (suddenDuration.length > 0) {
let value = suddenDuration[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration");
let unit = suddenDuration[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration Units");
if (value !== undefined) {
suddenWeakness[0].duration = {
value: value[0]?.value,
unit: unit[0]?.value.shortName,
}
}
else {
suddenWeakness[0].duration = null;
}
}
$scope.suddenWeakness = suddenWeakness;
}
let slurringSpeech = cc.filter(data => data.value.name === "IST Slurring of speech");
if (slurringSpeech.length > 0) {
let ssDuration = response.data[0]?.groupMembers.filter(data => data.concept.name === "IST SS Duration");
if (ssDuration.length > 0) {
let value = ssDuration[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration");
let unit = ssDuration[0]?.groupMembers.filter(data => data.conceptNameToDisplay === "Duration Units");
if (value !== undefined) {
slurringSpeech[0].duration = {
value: value[0]?.value,
unit: unit[0]?.value.shortName,
}
}
else {
slurringSpeech[0].duration = null;
}
}
$scope.slurringSpeech = slurringSpeech;
}
}
}
}));
}
}));
};
return {
restrict: 'E',
template: '<div style="padding-bottom: 5px" ng-if="chiefComplaints"> <br>' +
'<span style="font-size: 18px" ><b>Cheif Complaints:</b></span> <br>' +
'<span style="padding-top: 5px;">' +
'<ul style="display: block; list-style-type: square; padding-left: 20px; padding-top: 5px;">' +
'<li ng-repeat="cc in chiefComplaints" style="padding-bottom: 5px; font-size: 13px;">{{cc.value.shortName}} <span ng-if="cc.duration !== null">for {{cc.duration.value}} {{cc.duration.unit}}</span> <span ng-if="cc.notes !== null">({{cc.notes}})</span></li></ul>' +
'<ul style="display: block; list-style-type: square; padding-left: 20px;">' +
'<li ng-if="suddenWeakness" style="padding-bottom: 5px; font-size: 13px;">{{suddenWeakness[0].value.shortName}} <span ng-if="suddenWeakness[0].duration !== null">for {{suddenWeakness[0].duration.value}} {{suddenWeakness[0].duration.unit}}</span></li></ul>' +
'<ul style="display: block; list-style-type: square; padding-left: 20px;">' +
'<li ng-if="slurringSpeech" style="padding-bottom: 5px; font-size: 13px;">{{slurringSpeech[0].value.shortName}} <span ng-if="slurringSpeech[0].duration !== null">for {{slurringSpeech[0].duration.value}} {{slurringSpeech[0].duration.unit}}</span></li></ul>' +
'</span></div>',
link: link
}
}])
.directive('ninsOnexaminationTemplate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var pulseConcepts = ["OE Pulse", "OE Pulse Type"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, pulseConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.pulseResult = response.data;
}
}));
var bpConcepts = ["BP Systolic", "BP Diastolic"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, bpConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.bpResult = response.data;
}
}));
var gcsConcepts = ["GCS"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, gcsConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.gcsResult = response.data;
}
}));
var fundusConcepts = ["Fundus", "Fundus Abnormal Option"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, fundusConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.fundusResult = response.data;
}
}));
var reflexConcepts = ["OE Reflex", "OE Reflex Side"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, reflexConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.reflexResult = response.data;
}
}));
var speechConcepts = ["OE Speech"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, speechConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.speechResult = response.data;
}
}));
var powerConcepts = ["Power", "Power Side"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, powerConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.powerResult = response.data;
}
}));
var planterConcepts = ["Planter", "Planter Side"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, planterConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.planterResult = response.data;
}
}));
var slrConcepts = ["OE SLR"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, slrConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.slrResult = response.data;
}
}));
var precordiumConcepts = ["NINS Precordium"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, precordiumConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.precordiumResult = response.data;
}
}));
var psychicConcepts = ["Higher Psychic Function"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, psychicConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.psychicResult = response.data;
}
}));
var rigidityConcepts = ["Neck Rigidity"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, rigidityConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.rigidityResult = response.data;
}
}));
var cranialConcepts = ["Other Cranial Nerves"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, cranialConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.cranialResult = response.data;
}
}));
var parkinsonianConcepts = ["Parkinsonian Features", "Parkinsonian Features Option"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, parkinsonianConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.parkinsonianResult = response.data;
}
}));
var signsConcepts = ["OE Signs"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, signsConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.signsResult = response.data;
}
}));
var cerebellarConcepts = ["NINS Cerebellar Sign"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, cerebellarConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.cerebellarResult = response.data;
}
}));
var muscleConcepts = ["Muscle Power"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, muscleConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.muscleResult = response.data;
}
}));
var gaitConcepts = ["Gait", "Gait Abnormal"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, gaitConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.gaitResult = response.data;
}
}));
var mrsConcepts = ["MRS"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, mrsConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.mrsResult = response.data;
}
}));
var personalHisConcepts = ["Personal History"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, personalHisConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.personalHisResult = response.data;
}
}));
var mmseConcepts = ["MMSE Score"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, mmseConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.mmseResult = response.data;
}
}));
var epilepsyDurationConcepts = ["Epilepsy Duration", "For Duration"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, epilepsyDurationConcepts, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response) {
$scope.epilepsyDurationResult = response.data;
}
}));
//new data
var Anemia = ["Common Anemia"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Anemia, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
$scope.anemia = response.data;
}
}));
var Lymph = ["Common Lymph Node"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Lymph, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
$scope.lymph = response.data;
}
}));
var Jaundice = ["Common Jaundice"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Jaundice, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
$scope.jaundice = response.data;
}
}));
var Thyroid = ["Common Thyroid"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Thyroid, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
$scope.thyroid = response.data;
}
}));
var Clubbing = ["Common Clubbing"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Clubbing, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
$scope.clubbing = response.data;
}
}));
var Liver = ["Common Liver"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Liver, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
$scope.liver = response.data;
}
}));
var Spleen = ["Common Spleen"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Spleen, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
$scope.spleen = response.data;
}
}));
var Speech = ["C Speech OE"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Speech, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let filterMainData = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE Speech');
let filterOption = response.data[0].groupMembers.filter(data => data.concept.name !== 'Common NE Speech');
if (filterMainData[0]?.value.shortName === 'Others') {
filterMainData[0].notes = filterMainData[0].comment;
$scope.speechData = filterMainData;
$scope.speechOption = [];
}
else if (filterMainData[0]?.value.shortName === 'Aphonia') {
$scope.speechData = filterMainData;
$scope.speechOption = [];
}
else if (filterMainData[0]?.value.shortName === 'Dysarthria') {
$scope.speechData = filterMainData;
$scope.speechOption = filterOption?.filter(data => data.concept.name === 'Common NE Dysarthria Option');
}
else if (filterMainData[0]?.value.shortName === 'Aphasia') {
$scope.speechData = filterMainData;
$scope.speechOption = filterOption?.filter(data => data.concept.name === 'Common NE Aphasia Option');
}
}
}));
var Nerve = ["C Cranial Nerve OE"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Nerve, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let UMNLRight = response.data[0].groupMembers.filter(data => data.value.name === 'Common NE UMNL Right');
if (UMNLRight.length > 0) {
$scope.nerveData = true;
let option = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE CN UMNL Right Sided of Nerve Palsy');
let optionValue = [];
option.map(data => optionValue.push(data.value.shortName));
UMNLRight[0].option = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE CN UMNL Right Sided of Nerve Palsy');
UMNLRight[0].optionValue = optionValue.toString();
}
$scope.UMNLRight = UMNLRight;
let LMNLRight = response.data[0].groupMembers.filter(data => data.value.name === 'Common NE LMNL Right');
if (LMNLRight.length > 0) {
$scope.nerveData = true;
let option = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE CN LMNL Right Sided of Nerve Palsy');
let optionValue = [];
option.map(data => optionValue.push(data.value.shortName));
LMNLRight[0].option = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE CN LMNL Right Sided of Nerve Palsy');
LMNLRight[0].optionValue = optionValue.toString();
}
$scope.LMNLRight = LMNLRight;
let UMNLLeft = response.data[0].groupMembers.filter(data => data.value.name === 'Common NE UMNL Left');
if (UMNLLeft.length > 0) {
$scope.nerveData = true;
let option = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE CN UMNL Left Sided of Nerve Palsy');
let optionValue = [];
option.map(data => optionValue.push(data.value.shortName));
UMNLLeft[0].option = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE CN UMNL Left Sided of Nerve Palsy');
UMNLLeft[0].optionValue = optionValue.toString();
}
$scope.UMNLLeft = UMNLLeft;
let LMNLLeft = response.data[0].groupMembers.filter(data => data.value.name === 'Common NE LMNL Left');
if (LMNLLeft.length > 0) {
$scope.nerveData = true;
let option = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE CN LMNL Left Sided of Nerve Palsy');
let optionValue = [];
option.map(data => optionValue.push(data.value.shortName));
LMNLLeft[0].option = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE CN LMNL Left Sided of Nerve Palsy');
LMNLLeft[0].optionValue = optionValue.toString();
}
$scope.LMNLLeft = LMNLLeft;
}
}));
var Fundus = ["C Fundus OE"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Fundus, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let mainData = response.data[0].groupMembers.filter(data => data.concept.name === 'Common NE Fundus');
let option = response.data[0].groupMembers.filter(data => data.concept.name !== 'Common NE Fundus');
if (mainData[0]?.value.shortName === 'Papilledema') {
$scope.fundus = mainData;
$scope.fundusOption = option.filter(data => data.concept.name === 'Common NE Papilledema Option');
}
else if (mainData[0]?.value.shortName === 'Optic Atrophy') {
$scope.fundus = mainData;
$scope.fundusOption = option.filter(data => data.concept.name === 'Common NE F Optic Atrophy Option');
}
else {
$scope.fundus = mainData;
$scope.fundusOption = [];
}
}
}));
var Motor = ["C Motor OE"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Motor, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let mainData = response.data[0].groupMembers.filter(data => data.concept.name === 'Common Motor');
let option = response.data[0].groupMembers.filter(data => data.concept.name !== 'Common Motor');
if (mainData[0]?.value.name === 'Common Motor Bulk') {
$scope.motor = mainData;
$scope.motorOption1 = option.filter(data => data.concept.name === 'Common Motor Bulk Option');
$scope.motorOption2 = [];
}
else if (mainData[0]?.value.name === 'Common Motor Tone') {
$scope.motor = mainData;
$scope.motorOption1 = option.filter(data => data.concept.name === 'Common Motor Tone Option');
$scope.motorOption2 = [];
}
else if (mainData[0]?.value.name === 'Common Motor Power') {
$scope.motor = mainData;
$scope.motorOption1 = option.filter(data => data.concept.name === 'Common Motor Power Option');
$scope.motorOption2 = [];
}
else if (mainData[0]?.value.name === 'Common Motor Reflex or DTR') {
$scope.motor = mainData;
$scope.motorOption1 = option.filter(data => data.concept.name === 'Common Motor Reflex or DTR Option');
$scope.motorOption2 = [];
}
else if (mainData[0]?.value.name === 'Common Motor Planter') {
$scope.motor = mainData;
$scope.motorOption1 = option.filter(data => data.concept.name === 'Common Motor Planter Option');
$scope.motorOption2 = [];
}
else if (mainData[0]?.value.name === 'Common Motor Planter') {
$scope.motor = mainData;
$scope.motorOption1 = option.filter(data => data.concept.name === 'Common Motor Planter Option');
$scope.motorOption2 = [];
}
else if (mainData[0]?.value.name === 'Common Motor Co Ordination') {
$scope.motor = mainData;
let motorOption = option.filter(data => data.concept.name === 'Common Motor Co Ordination Option');
if (motorOption[0]?.value.name === 'Common Motor Co Ordination Impaired') {
$scope.motorOption1 = motorOption;
$scope.motorOption2 = option.filter(data => data.concept.name === 'Common Motor Impaired Option');
}
else {
$scope.motorOption1 = motorOption;
$scope.motorOption2 = [];
}
}
else if (mainData[0]?.value.name === 'Common Motor Gait') {
$scope.motor = mainData;
$scope.motorOption1 = option.filter(data => data.concept.name === 'Common Motor Gait Option');
$scope.motorOption2 = [];
}
}
}));
var Sensory = ["C Sensory OE"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Sensory, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let mainData = response.data[0].groupMembers.filter(data => data.concept.name === 'Common Sensory');
let option = response.data[0].groupMembers.filter(data => data.concept.name !== 'Common Sensory');
if (mainData[0]?.value.name === 'Common Sensory Pain and Touch and Temp') {
$scope.sensory = mainData;
$scope.sensoryOption1 = option.filter(data => data.concept.name === 'Common Sensory Pain and Touch and Temp Option');
if ($scope.sensoryOption1[0]?.value.name === 'Common Sensory Sensory Level') {
$scope.sensoryOption2 = option.filter(data => data.concept.name === 'Common SL Option');
}
else {
$scope.sensoryOption2 = [];
}
}
else if (mainData[0]?.value.name === 'Common Sensory Dorsal Column') {
$scope.sensory = mainData;
$scope.sensoryOption1 = option.filter(data => data.concept.name === 'Common DC Option');
if ($scope.sensoryOption1[0]?.value.name === 'Common DC Impaired') {
$scope.sensoryOption2 = option.filter(data => data.concept.name === 'Common DC Impaired Option');
}
else {
$scope.sensoryOption2 = [];
}
}
}
}));
var Rigidity = ["Common Neck Rigidity"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Rigidity, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
$scope.rigidity = response.data;
}
}));
var Cerebellar = ["C Cerebellar Sign OE"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, Cerebellar, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let mainData = response.data[0].groupMembers.filter(data => data.concept.name === 'Common Cerebellar Sign');
let option = response.data[0].groupMembers.filter(data => data.concept.name !== 'Common Cerebellar Sign');
$scope.cerebellar = mainData;
if (mainData[0]?.value.name === 'Common CS Present') {
$scope.cerebellarOption = option;
}
else {
$scope.cerebellarOption = [];
}
}
}));
};
return {
restrict: 'E',
template: '<div style="padding-bottom: 5px"><br>' +
'<span style="font-size: 18px" ><b>Clinical Examination:</b></span> <br>' +
'<span style="padding-top: 5px;">' +
'<ul style="display: block; list-style-type: square; padding-left: 20px; padding-top: 5px;">' +
'<li ng-if="pulseResult[0].concept.shortName ===\'Pulse\'" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{pulseResult[0].concept.shortName}}</span>: {{pulseResult[0].value}} <span ng-if="pulseResult[0].concept.units"></span><span ng-if="pulseResult[1].value">{{pulseResult[0].concept.units}}, {{pulseResult[1].value.shortName}}</span></li>' +
'<li ng-if="bpResult[0].value && bpResult[1].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">BP</span>: {{bpResult[0].value}}/{{bpResult[1].value}} <span ng-if="bpResult[0].concept.units">{{bpResult[0].concept.units}}</span></li>' +
'<li ng-if="anemia" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Anemia</span>: {{anemia[0].value.shortName}}<span ng-if="anemia[0].comment"> ({{anemia[0].comment}})</span> </li>' +
'<li ng-if="lymph" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Lymph Node</span>: {{lymph[0].value.shortName}}<span ng-if="lymph[0].comment"> ({{lymph[0].comment}})</span> </li>' +
'<li ng-if="jaundice" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Jaundice</span>: {{jaundice[0].value.shortName}}<span ng-if="jaundice[0].comment"> ({{jaundice[0].comment}})</span> </li>' +
'<li ng-if="thyroid" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Thyroid</span>: {{thyroid[0].value.shortName}}<span ng-if="thyroid[0].comment"> ({{thyroid[0].comment}})</span> </li>' +
'<li ng-if="clubbing" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Clubbing</span>: {{clubbing[0].value.shortName}}</li>' +
'<li ng-if="liver" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Liver</span>: {{liver[0].value.shortName}}<span ng-if="liver[0].comment"> ({{liver[0].comment}})</span></li>' +
'<li ng-if="spleen" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Spleen</span>: {{spleen[0].value.shortName}}<span ng-if="spleen[0].comment"> ({{spleen[0].comment}})</span></li>' +
'<li ng-if="gcsResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{gcsResult[0].concept.shortName}}</span>: <span>{{gcsResult[0].value}}/15</span></li>' +
'<li ng-if="speechData.length>0" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Speech</span>: <span ng-if="speechOption.length>0">{{speechOption[0].value.shortName}} </span> {{speechData[0].value.shortName}}<span ng-if="speechData[0].notes"> ({{speechData[0].notes}})</span></li>' +
'<li ng-if="nerveData" style="padding-bottom: 5px; font-size: 13px;"> <span style="font-weight: bold">Cranial Nerve</span>: </span><ul><li ng-if="UMNLRight.length>0" > &#10148; {{UMNLRight[0].value.shortName.split("(")[1].split(")")[0]}} sided {{UMNLRight[0].value.shortName.split("(")[0]}} <span ng-if="UMNLRight[0].optionValue">{{UMNLRight[0].optionValue}} </span>nerve palsy <span ng-if="UMNLRight[0].option[0].comment">({{UMNLRight[0].option[0].comment}})</span></li><li ng-if="LMNLRight.length>0" > &#10148; {{LMNLRight[0].value.shortName.split("(")[1].split(")")[0]}} sided {{LMNLRight[0].value.shortName.split("(")[0]}} <span ng-if="LMNLRight[0].optionValue">{{LMNLRight[0].optionValue}} </span>nerve palsy <span ng-if="LMNLRight[0].option[0].comment">({{LMNLRight[0].option[0].comment}})</span></li><li ng-if="UMNLLeft.length>0" > &#10148; {{UMNLLeft[0].value.shortName.split("(")[1].split(")")[0]}} sided {{UMNLLeft[0].value.shortName.split("(")[0]}} <span ng-if="UMNLLeft[0].optionValue">{{UMNLLeft[0].optionValue}} </span>nerve palsy <span ng-if="UMNLLeft[0].option[0].comment">({{UMNLLeft[0].option[0].comment}})</span></li><li ng-if="LMNLLeft.length>0" > &#10148; {{LMNLLeft[0].value.shortName.split("(")[1].split(")")[0]}} sided {{LMNLLeft[0].value.shortName.split("(")[0]}} <span ng-if="LMNLLeft[0].optionValue">{{LMNLLeft[0].optionValue}} </span>nerve palsy <span ng-if="LMNLLeft[0].option[0].comment">({{LMNLLeft[0].option[0].comment}})</span></li></ul></li>' +
'<li ng-if="fundus.length>0" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Fundus</span>: <span>{{fundus[0].value.shortName}}</span><span ng-if="fundusOption.length>0"> ({{fundusOption[0].value.shortName}})</span></li>' +
'<li ng-if="motor.length>0" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Motor</span>: <span>{{motor[0].value.shortName}}</span><span ng-if="motorOption1.length>0"> ({{motorOption1[0].value.shortName}}<span ng-if="motorOption2.length>0">-{{motorOption2[0].value.shortName}}</span>)</span></li>' +
'<li ng-if="sensory.length>0" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Sensory</span>: <span>{{sensory[0].value.shortName}}</span><span ng-if="sensoryOption1.length>0"> ({{sensoryOption1[0].value.shortName}}<span ng-if="sensoryOption2.length>0">-{{sensoryOption2[0].value.shortName}}</span>)</span></li>' +
'<li ng-if="rigidity" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Neck Rigidity</span>: {{rigidity[0].value.shortName}}<span ng-if="rigidity[0].comment"> ({{rigidity[0].comment}})</span></li>' +
'<li ng-if="cerebellar.length>0" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">Cerebellar Sign</span>: <span>{{cerebellar[0].value.shortName}}</span><span ng-if="cerebellarOption.length>0"> ({{cerebellarOption[0].value.shortName}})<span ng-if="cerebellarOption[0].comment"> ({{cerebellarOption[0].comment}})</span></span></li>' +
'<li ng-if="precordiumResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{precordiumResult[0].concept.shortName}}</span>: <span>{{precordiumResult[0].value}}</span></li>' +
'<li ng-if="psychicResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{psychicResult[0].concept.shortName}}</span>: <span>{{psychicResult[0].value.shortName}}</span></li>' +
'<li ng-if="rigidityResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{rigidityResult[0].concept.shortName}}</span>: <span>{{rigidityResult[0].value === true ? "YES":"NO"}}</span></li>' +
'<li ng-if="fundusResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{fundusResult[0].concept.shortName}}</span>: <span>{{fundusResult[0].value.shortName}}</span><span ng-if="fundusResult[1].value">, {{fundusResult[1].value.shortName}}</span></li>' +
'<li ng-if="cranialResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{cranialResult[0].concept.shortName}}</span>: <span>{{cranialResult[0].value}}</span></li>' +
'<li ng-if="parkinsonianResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{parkinsonianResult[0].concept.shortName}}</span>: <span>{{parkinsonianResult[0].value.shortName}}</span><span ng-if="fundusResult[1].value">, {{parkinsonianResult[1].value}}</span></li>' +
'<li ng-if="reflexResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{reflexResult[0].concept.shortName}}</span>: <span>{{reflexResult[0].value.shortName}}</span><span ng-if="reflexResult[1].value"> ({{reflexResult[1].value.shortName}})</span></li>' +
'<li ng-if="speechResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{speechResult[0].concept.shortName}}</span>: {{speechResult[0].value.shortName}}</li>' +
'<li ng-if="powerResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{powerResult[0].concept.shortName}}</span>: {{powerResult[0].value.shortName}}/5 <span ng-if="powerResult[1].value"> ({{powerResult[1].value.shortName}})</span></li>' +
'<li ng-if="planterResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{planterResult[0].concept.shortName}}</span>: {{planterResult[0].value.shortName}} <span ng-if="planterResult[1].value"> ({{planterResult[1].value.shortName}})</span></li>' +
'<li ng-if="signsResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{signsResult[0].concept.shortName}}</span>: <span>{{signsResult[0].value.shortName}}</span></li>' +
'<li ng-if="slrResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{slrResult[0].concept.shortName}}</span>: {{slrResult[0].value}}</li>' +
'<li ng-if="cerebellarResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{cerebellarResult[0].concept.shortName}}</span>: <span>{{cerebellarResult[0].value === true ? "YES":"NO"}}</span></li>' +
'<li ng-if="muscleResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{muscleResult[0].concept.shortName}}</span>: <span>{{muscleResult[0].value}}</span></li>' +
'<li ng-if="gaitResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{gaitResult[0].concept.shortName}}</span>: <span>{{gaitResult[0].value.shortName}}</span><span ng-if="gaitResult[1].value">, {{gaitResult[1].value}}</span></li>' +
'<li ng-if="mrsResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{mrsResult[0].concept.shortName}}</span>: <span>{{mrsResult[0].value}}</span></li>' +
'<li ng-if="personalHisResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{personalHisResult[0].concept.shortName}}</span>: <span>{{personalHisResult[0].value}}</span></li>' +
'<li ng-if="mmseResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{mmseResult[0].concept.shortName}}</span>: <span>{{mmseResult[0].value}}</span></li>' +
// '<li ng-if="comorbidResult[0].groupMembers[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{comorbidResult[0].concept.shortName}}</span>: <span>{{comorbidConditionValue.join(", ")}}</span></li>' +
// '<li ng-if="epllepsyChiefResults[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{epllepsyChiefResults[0].concept.shortName}}</span>: <span>{{epllepsyChiefResults[0].value.shortName}}</span><span ng-if="epllepsyChiefResults[1].value">, {{epllepsyChiefResults[1].value.shortName}}</span><span ng-if="epllepsyChiefResults[1].value">, {{epllepsyChiefResults[2].value.shortName}}</span><span ng-if="epllepsyChiefResults[3].value">, {{epllepsyChiefResults[3].value.shortName}}</span><span ng-if="epllepsyChiefResults[4].value">, {{epllepsyChiefResults[4].value.shortName}}</span><span ng-if="epllepsyChiefResults[5].value">, {{epllepsyChiefResults[5].value.shortName}}</span></li>' +
// '<li ng-if="epllepsyDurationResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{epllepsyDurationResult[0].concept.shortName}}</span>: {{epllepsyDurationResult[0].value}} <span ng-if="epllepsyDurationResult[1].value"> ({{epllepsyDurationResult[1].value.shortName}})</span></li>' +
// '<li ng-if="epilepsyDurationResult[0].value" style="padding-bottom: 5px; font-size: 13px;"><span style="font-weight: bold">{{epilepsyDurationResult[0].concept.shortName}}</span>: {{epilepsyDurationResult[0].value}} <span ng-repeat="epliepsyDuration in epilepsyDurationResult"> ({{epliepsyDuration.value.shortName}})</span></li>' +
'</ul>' +
'</span></div>', link: link
}
}])
.directive('coMorbidConditions', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["Stroke Co-morbid Conditions"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
$scope.Comorbid = response.data;
}
}));
};
return {
restrict: 'E',
template: '<div style="padding-bottom: 5px" ng-if="Comorbid.length>0"> <br>' +
'<span style="font-size: 18px" ><b>Co-morbid Conditions:</b></span> <br>' +
'<span style="padding-top: 5px;">' +
'<ul style="display: block; list-style-type: square; padding-left: 20px; padding-top: 5px;">' +
'<li ng-repeat="cbid in Comorbid" style="padding-bottom: 5px; font-size: 13px;">{{cbid.value.shortName}}</li></ul>' +
'</span></div>',
link: link
}
}])
.directive('ninsAdviceTemplate', ['observationsService', 'appService', 'spinner', function (observationsService, appService, spinner) {
var link = function ($scope) {
var conceptNames = ["Epilepsy Advice", "Stroke Advice", "Common Advice", "IST Advice", "Migraine Avice", "SAH Advice", "TTH Advice", "Dementia advice", "SR Advice"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
let filterData = response.data.filter(data => data.value.shortName !== 'Others');
let othersData = response.data.filter(data => data.value.shortName === 'Others');
if (othersData.length > 0) {
const conceptName = ['Epilepsy Note', 'Stroke Note', 'Advice of Common', 'ISt Note', 'Migraine Note', 'SAH Note', 'TTH Note', 'Dementia Note', 'SR Note'];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptName, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
response.data.map(data => {
filterData.push({
value: {
shortName: data.value
}
})
})
}
}));
}
$scope.obsAdvice = filterData;
}
}));
};
return {
restrict: 'E',
template: '<div style="padding-bottom: 5px" ng-if="obsAdvice.length>0"> <br>' +
'<span style="font-size: 18px" ><b>Advices:</b></span> <br>' +
'<span style="padding-top: 5px;">' +
'<ul style="display: block; list-style-type: square; padding-left: 20px; padding-top: 5px;">' +
'<li ng-repeat="advice in obsAdvice" style="padding-bottom: 5px; font-size: 13px;">{{advice.value.shortName}}</li></ul>' +
'</span></div>',
link: link
}
}])
.directive('dischargeHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/dischargeHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('dischargeDetailsInfo', ['observationsService', 'visitService', 'appService', 'spinner', function (observationsService, visitService, appService, spinner) {
var link = function ($scope) {
$scope.displayStuff = false;
var conceptNames = ["Presenting Complaints at Admission", "Clinical Status at Admission",
"Follow Up Schedule, Advice for follow up at local hospital",
"Relevant Investigation and Diagnostic Workup CSF Study, Cell count",
"Relevant Investigation and Diagnostic Workup CSF Study, Gram Staining",
"Relevant Investigation and Diagnostic Workup CSF Study, AFB",
"Relevant Investigation and Diagnostic Workup CSF Study, Protein",
"Relevant Investigation and Diagnostic Workup CSF Study, Sugar",
"Relevant Investigation and Diagnostic Workup CSF Study, C/S",
"Relevant Investigation and Diagnostic Workup CSF Study, ADA",
"Relevant Investigation and Diagnostic Workup CSF Study, Gene Xpert",
"Relevant Investigation and Diagnostic Workup CSF Study, Oligoclonal Band",
"Relevant Investigation and Diagnostic Workup CSF Study, Ncs of Crossed Limbs",
"Relevant Investigation and Diagnostic Workup CSF Study, EMG of Crossed Limbs",
"Relevant Investigation and Diagnostic Workup CSF Study, EMG of Crossed Limbs",
"Relevant Investigation and Diagnostic Workup CSF Study, EEG",
"Relevant Investigation and Diagnostic Workup CSF Study, RNG",
"Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, ANA",
"Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, Anti ds DNA",
"Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, Anti Ach receptor antibody",
"Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, c-ANCA",
"Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, PANCA",
"Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, NMO Antibody",
"Relevant Investigation and Diagnostic Workup CSF Study, Anti MOG Antibody",
"Relevant Investigation and Diagnostic Workup CSF Study, Anti MUSK Antibody",
"In Hospital Management", "Summary of Clinical Course",
"Clinical Status at Discharge", "Type of Discharge", "Advice on Discharge",
"Follow Up Schedule, Follow up after", "Follow Up Schedule, Duration",
"Follow Up Schedule, Laboratory Investigationns Prior to Follow up Visit",
"Stroke Intervention Investigations Routine, Blood Count",
"Stroke Intervention Investigations Routine, Blood Sugar",
"Stroke Intervention Investigations Routine, Lipid Profile",
"Stroke Intervention Investigations Routine, Renal Function",
"Stroke Intervention Investigations Routine, S Electrolyte",
"Stroke Intervention Investigations Routine, Urine",
"Stroke Intervention Investigations Routine Urine, Protein",
"Stroke Intervention Investigations Routine Urine, Sugar",
"Stroke Intervention Investigations Routine Urine, NB Cell",
"Stroke Intervention Investigations Routine Urine, RBC",
"Stroke Intervention Investigations Routine Urine, Cast",
"Stroke Intervention Investigations, Chest X Ray",
"Stroke Intervention Investigations, ECG",
"Stroke Intervention Investigations, Echocardiography",
"Stroke Intervention Investigations, Echocardiography EF",
"Stroke Intervention Investigations, USG of W/A",
"Stroke Intervention, Special Investigations"
];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.observations = response.data;
$scope.dischargeAdvice = response.data.filter(data => data.conceptNameToDisplay === "Advice on Discharge");
if (response.data.length > 0) {
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].concept.name == 'Presenting Complaints at Admission') {
$scope.admissionComplaints = response.data[i].value;
}
if (response.data[i].concept.name == 'Clinical Status at Admission') {
$scope.clinicalStatusAdmission = response.data[i].groupMembers;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Cell count') {
$scope.cellCount = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Gram Staining') {
$scope.gramStaining = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, AFB') {
$scope.afb = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Protein') {
$scope.protein = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Sugar') {
$scope.sugar = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, C/S') {
$scope.cs = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, ADA') {
$scope.ada = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Gene Xpert') {
$scope.geneXpert = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Oligoclonal Band') {
$scope.oligoclonalBand = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Ncs of Crossed Limbs') {
$scope.ncsCrossedLimbs = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, EMG of Crossed Limbs') {
$scope.emgCrossedLimbs = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, EEG') {
$scope.eeg = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, RNG') {
$scope.rng = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, ANA') {
$scope.ana = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, Anti ds DNA') {
$scope.antiDsDna = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, Anti Ach receptor antibody') {
$scope.receptorAntibody = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, c-ANCA') {
$scope.cAnca = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, PANCA') {
$scope.panca = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study ANTIBODIES, NMO Antibody') {
$scope.nmoAntibody = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Anti MOG Antibody') {
$scope.antiMogAntibody = response.data[i].value;
}
if (response.data[i].concept.name == 'Relevant Investigation and Diagnostic Workup CSF Study, Anti MUSK Antibody') {
$scope.antiMuskAntibody = response.data[i].value;
}
// discharge 2
if (response.data[i].concept.name == 'In Hospital Management') {
$scope.hospitalManagement = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Summary of Clinical Course') {
$scope.clinicalSummary = response.data[i].value;
}
if (response.data[i].concept.name == 'Clinical Status at Discharge') {
$scope.dischargeStatus = response.data[i].groupMembers;
}
if (response.data[i].concept.name == 'Type of Discharge') {
$scope.dischargeType = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Advice on Discharge') {
// $scope.dischargeAdvice = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Follow Up Schedule, Follow up after') {
$scope.followup = response.data[i].value;
}
if (response.data[i].concept.name == 'Follow Up Schedule, Duration') {
$scope.followupDuration = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Follow Up Schedule, Laboratory Investigationns Prior to Follow up Visit') {
$scope.followupInvestigation = response.data[i].value;
}
if (response.data[i].concept.name == 'Follow Up Schedule, Advice for follow up at local hospital') {
$scope.followupLocalHospital = response.data[i].value;
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine, Blood Count') {
$scope.routineBloodCount = response.data[i].groupMembers;
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine, Blood Sugar') {
$scope.routineBloodSugar = response.data[i].groupMembers;
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine, Lipid Profile') {
$scope.routineLipidProfile = response.data[i].groupMembers;
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine, Renal Function') {
$scope.routineRenalFunction = response.data[i].groupMembers;
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine, S Electrolyte') {
$scope.routineSElectrolyte = response.data[i].groupMembers;
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine Urine, Protein') {
$scope.routineUrineProtein = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine Urine, Sugar') {
$scope.routineUrineSugar = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine Urine, NB Cell') {
$scope.routineUrineNBCell = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine Urine, RBC') {
$scope.routineUrineRBC = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations Routine Urine, Cast') {
$scope.routineUrineCast = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations, Chest X Ray') {
$scope.chestXRay = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations, ECG') {
$scope.ECG = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations, Echocardiography') {
$scope.echocardiography = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations, Echocardiography EF') {
$scope.echocardiographyEF = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention Investigations, USG of W/A') {
$scope.USGofWA = response.data[i];
}
if (response.data[i].concept.name == 'Stroke Intervention, Special Investigations') {
$scope.specialInvestigations = response.data[i].groupMembers;
}
}
}
if ($scope.observations.length > 0) {
$scope.displayStuff = true;
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/dischargeDetailsInfo.html";
$scope.curDate = new Date();
}));
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}])
.directive('deathHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/deathHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('patientDetails', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/patientDetails.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('deathTimeInfo', ['observationsService', 'visitService', 'appService', 'spinner', function (observationsService, visitService, appService, spinner) {
var link = function ($scope) {
$scope.displayStuff = false;
var conceptNames = ["Date and Time of Death", "Deceased NID No", "Spouse NID No", "Parents NID No", "NID No", "NID of",
"Report disease or condition directly leading to death on line a", "A Time interval from onset to death",
"Reports chain of events in due to order if applicable b", "B Time interval from onset to death",
"State the underlying cause on the lowest use line c", "C Time interval from onset to death",
"D Due to", "D Time interval from onset to death",
"Other significant conditions contributing to death time intervals can be included in brackets after the condition",
"Was surgery performed within the last four weeks", "If yes please specify date of surgery", "If yes please specify reason for surgery disease or condition", "Was an autopsy requested", "If yes were the findings used in the certification",
"Manner", "If external poisoning",
"Date of Injury", "Please Describe How External Cause Occurred if poisoning please specify poisoning agent"
, "Place of occurrence", "Other place please specify",
"Multiple pregnancy", "Stillborn",
"If death within twenty four h specify number of hours survived", "Birth weight",
"Number of completed weeks of pregnancy", "Age of mother",
"If death was perinatal, please state condition of mother that affected the fetus and newborn",
"For women of reproductive age", "Bangladesh Form No"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
$scope.deathObs = response.data;
if (response.data.length > 0) {
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].concept.name == 'Report disease or condition directly leading to death on line a') {
$scope.lineA = response.data[i];
}
if (response.data[i].concept.name == 'A Time interval from onset to death') {
$scope.timeA = response.data[i];
}
if (response.data[i].concept.name == 'Reports chain of events in due to order if applicable b') {
$scope.applicableB = response.data[i];
}
if (response.data[i].concept.name == 'B Time interval from onset to death') {
$scope.timeB = response.data[i];
}
if (response.data[i].concept.name == 'State the underlying cause on the lowest use line c') {
$scope.lineC = response.data[i];
}
if (response.data[i].concept.name == 'C Time interval from onset to death') {
$scope.timeC = response.data[i];
}
if (response.data[i].concept.name == 'D Due to') {
$scope.dueD = response.data[i];
}
if (response.data[i].concept.name == 'D Time interval from onset to death') {
$scope.timeD = response.data[i];
}
if (response.data[i].concept.name == 'Other significant conditions contributing to death time intervals can be included in brackets after the condition') {
$scope.otherSignificantCondition = response.data[i];
}
if (response.data[i].concept.name == 'Date and Time of Death') {
$scope.dateAndTimeOfDeath = response.data[i].value;
}
if (response.data[i].concept.name == 'Deceased NID No') {
$scope.DeceasedNID = response.data[i].value;
}
if (response.data[i].concept.name == 'Spouse NID No') {
$scope.SpouseNID = response.data[i].value;
}
if (response.data[i].concept.name == 'Parents NID No') {
$scope.ParentsNID = response.data[i].value;
}
if (response.data[i].concept.name == 'NID No') {
$scope.NID = response.data[i].value;
}
if (response.data[i].concept.name == 'NID of') {
$scope.nidOf = response.data[i].value.name;
}
if (response.data[i].concept.name == 'Was surgery performed within the last four weeks') {
$scope.frameBSurgeryPerformedLastWeek = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'If yes please specify date of surgery') {
$scope.frameBSpecifyDate = response.data[i].value;
}
if (response.data[i].concept.name == 'If yes please specify reason for surgery disease or condition') {
$scope.frameBSpecifyReason = response.data[i].value;
}
if (response.data[i].concept.name == 'Was an autopsy requested') {
$scope.frameBAutopsyRequested = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'If yes were the findings used in the certification') {
$scope.frameBCertification = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Manner') {
$scope.mannerOfDeath = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'If external poisoning') {
$scope.externalPoisoning = response.data[i].value;
}
if (response.data[i].concept.name == 'Date of Injury') {
$scope.dateOfInjury = response.data[i].value;
}
if (response.data[i].concept.name == 'Please Describe How External Cause Occurred if poisoning please specify poisoning agent') {
$scope.describePoisoning = response.data[i].value;
}
if (response.data[i].concept.name == 'Place of occurrence') {
$scope.placeOfOccurrence = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Other place please specify') {
$scope.otherPlace = response.data[i].value;
}
if (response.data[i].concept.name == 'Multiple pregnancy') {
$scope.multiplePregnancy = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'Stillborn') {
$scope.stillBorn = response.data[i].value.shortName;
}
if (response.data[i].concept.name == 'If death within twenty four h specify number of hours survived') {
$scope.numberOfHour = response.data[i].value;
}
if (response.data[i].concept.name == 'Birth weight') {
$scope.birthWeight = response.data[i].value;
}
if (response.data[i].concept.name == 'Number of completed weeks of pregnancy') {
$scope.weeksOfPregnancy = response.data[i].value;
}
if (response.data[i].concept.name == 'Age of mother') {
$scope.ageOfMother = response.data[i].value;
}
if (response.data[i].concept.name == 'If death was perinatal, please state condition of mother that affected the fetus and newborn') {
$scope.newBorn = response.data[i].value;
}
if (response.data[i].concept.name == 'For women of reproductive age') {
$scope.womenReproductiveAge = response.data[i].groupMembers;
}
}
}
if ($scope.deathObs.length > 0) {
$scope.displayStuff = true;
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/deathTimeInfo.html";
$scope.curDate = new Date();
}));
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}])
.directive('deathInfoFooter', ['observationsService', '$q', 'appService', 'spinner', '$http', function (observationsService, $q, appService, spinner, $http) {
var link = function ($scope) {
var conceptNames = ["Date and Time of Death", "Bangladesh Form No"];
spinner.forPromise(observationsService.fetch($scope.$parent.patient.uuid, conceptNames, "latest", undefined, $scope.$parent.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
var providerUuid = response.data[0].providers[0].uuid;
$scope.providerName = response.data[0].providers[0].name;
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].concept.name == 'Bangladesh Form No') {
$scope.formNo = response.data[i].value;
}
}
$q.all([getProviderDesignation(providerUuid)]).then(function (response) {
if (response[0].data.length > 0) {
for (var i = 0; i < response[0].data.length; i++) {
if (response[0].data[i].name == 'Designation') {
$scope.providerDesignation = response[0].data[i].value_reference;
}
if (response[0].data[i].name == 'BMDC REG No') {
$scope.providerBMDCNumber = response[0].data[i].value_reference;
}
}
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/deathInfoFooter.html";
$scope.curDate = new Date();
});
}
})
)
;
var getProviderDesignation = function (providerUuid) {
var params = {
q: "bahmni.sqlGet.providerDesignation2",
v: "full",
providerUuid: providerUuid
};
return $http.get('/openmrs/ws/rest/v1/bahmnicore/sql', {
method: "GET",
params: params,
withCredentials: true
});
};
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>',
}
}])
.directive('anaesthesiaBody', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
let conceptNames = ["Vaporizing Agent","Weight Anaesthesia", "Pre operative Diagnosis", "Proposed Operation", "H O Previous Anesthesia", "H O Previous surgery", "Complications During That Surgery", "Preoperative condition of patient", "Aneasthesia BP Systolic", "Aneasthesia BP Diastolic", "Anesthesia Investigations", "Preoperative Advice and Rx", "Intraoperative Management and Monitoring Sheet", "Anesthesia Na", "Anesthesia k", "Anesthesia CL", "Thyroid TSH", "Thyroid Tthree", "Thyroid TFour", "Intraoperative Management and Monitoring Sheet"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let results = response.data
$scope.weightAnaesthesia = results?.filter(data => data.concept.name === "Weight Anaesthesia");
$scope.preoperativeDiagnosis = results?.filter(data => data.concept.name === "Pre operative Diagnosis");
$scope.proposedOperation = results?.filter(data => data.concept.name === "Proposed Operation");
$scope.hOPreviousAnesthesia = results?.filter(data => data.concept.name === "H O Previous Anesthesia");
$scope.hOPreviousSurgery = results?.filter(data => data.concept.name === "H O Previous surgery");
$scope.complicationsDuringThatSurgery = results?.filter(data => data.concept.name === "Complications During That Surgery");
$scope.aneasthesiaSystolic = results?.filter(data => data.concept.name === "Aneasthesia BP Systolic");
$scope.aneasthesiaDiastolic = results?.filter(data => data.concept.name === "Aneasthesia BP Diastolic");
$scope.anesthesiaNa = results?.filter(data => data.concept.name === "Anesthesia Na");
$scope.anesthesiak = results?.filter(data => data.concept.name === "Anesthesia k");
$scope.anesthesiaCL = results?.filter(data => data.concept.name === "Anesthesia CL");
$scope.thyroidTSH = results?.filter(data => data.concept.name === "Thyroid TSH");
$scope.thyroidTthree = results?.filter(data => data.concept.name === "Thyroid Tthree");
$scope.thyroidTFour = results?.filter(data => data.concept.name === "Thyroid TFour");
let resultsgroupPreoperativeconditionPatient = results.filter(data => data.concept.name === "Preoperative condition of patient")[0]?.groupMembers
$scope.aneasthesiaPulse = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Aneasthesia Pulse");
$scope.aneasthesiaHeart = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Aneasthesia Heart");
$scope.lungs = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Lungs");
$scope.allergy = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Allergy");
$scope.allergyNote = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Allergy Note");
$scope.anesthesiaChestPain = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Anesthesia Chest pain");
$scope.chestPainNote = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Chest pain Note");
$scope.anesthesiaAsthma = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Anesthesia Asthma");
$scope.asthmaNote = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Asthma Note");
$scope.anesthesiaTeeth = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Anesthesia Teeth");
$scope.difficultAirway = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Difficult airway");
$scope.aspirationRisk = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Aspiration Risk");
$scope.riskofBloodLoss = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Risk of Blood Loss");
$scope.aSAClass = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "ASA Class");
$scope.mallampatiGrading = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Mallampati Grading");
$scope.aneasthesiaGCS = resultsgroupPreoperativeconditionPatient?.filter(data => data.concept.name === "Aneasthesia GCS");
let resultsgroupAnesthesiaInvestigations = results?.filter(data => data.concept.name === "Anesthesia Investigations")[0]?.groupMembers
$scope.anesthesiaHB = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia HB");
$scope.anesthesiaRBS = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia RBS");
$scope.anesthesiaSCreatine = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia S Creatine");
$scope.anesthesiaSCortisol = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia S Cortisol");
$scope.anesthesiaACTH = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia ACTH");
$scope.anesthesiaTroponinI = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia Troponin I");
$scope.anesthesiaCXR = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia CXR");
$scope.anesthesiaECG = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia ECG");
$scope.anesthesiaBloodGroup = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia Blood Group");
$scope.anesthesiaEcho = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia Echo");
$scope.anesthesiaBUrea = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia B Urea");
$scope.anesthesiaOthers = resultsgroupAnesthesiaInvestigations?.filter(data => data.concept.name === "Anesthesia Others");
let resultsgroupPreoperativeAdviceAndRx = results.filter(data => data.concept.name === "Preoperative Advice and Rx")[0]?.groupMembers
$scope.maintenanceDrugs = resultsgroupPreoperativeAdviceAndRx?.filter(data => data.concept.name === "Maintenance drugs");
$scope.anaesthesiaAdvice = resultsgroupPreoperativeAdviceAndRx?.filter(data => data.concept.name === "Anaesthesia Advice");
$scope.acceptedFor = resultsgroupPreoperativeAdviceAndRx?.filter(data => data.concept.name === "Accepted For");
$scope.adviceAndRxOthers = resultsgroupPreoperativeAdviceAndRx?.filter(data => data.concept.name === "Advice and Rx Others");
let intraoperativeManagementAndMonitoringSheet = results?.filter(data => data.concept.name === "Intraoperative Management and Monitoring Sheet")[0]?.groupMembers
$scope.typesofOperation = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Types of Operation");
$scope.machineCheck = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Machine Check");
$scope.anesthesiaType = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Anesthesia type");
$scope.regionalOption = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Regional Option");
let incaseofGA = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "In case of GA")[0]?.groupMembers
$scope.gAOTwo = incaseofGA?.filter(data => data.concept.name === "GA OTwo");
$scope.gANTwoO = incaseofGA?.filter(data => data.concept.name === "GA NTwo O");
$scope.circuitUsed = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Circuit Used");
$scope.madeOfVentilation = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Made of Ventilation");
$scope.ventilatorOption = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Ventilator Option");
$scope.controlledOption = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Controlled Option");
$scope.anesthesiaVT = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Anesthesia VT");
$scope.rR = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "RR");
$scope.maintenanceOfAirway = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Maintenance of Airway");
$scope.supraglotticDevicesOption = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Supraglottic Devices Option");
$scope.eTTOption = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "ETT Option");
$scope.inCaseOfPlexusBlockTIVA = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "In case of Plexus Block TIVA");
$scope.inhalationalAnesthesiaOther = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Inhalational Anesthesia Other");
$scope.conditionOnLeavingOT = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Condition on Leaving OT");
$scope.drugAndVolume = intraoperativeManagementAndMonitoringSheet?.filter(data => data.concept.name === "Drug and Volume");
let resultsgroupVaporizingAgent = results.filter(data => data.concept.name === "Vaporizing Agent")[0]?.groupMembers
$scope.vaporizingAgentHalothane = resultsgroupVaporizingAgent?.filter(data => data.concept.name === "Vaporizing Agen Halothane");
$scope.vaporizingAgentISOFlanner = resultsgroupVaporizingAgent?.filter(data => data.concept.name === "Vaporizing Agen ISO Flanner");
$scope.vaporizingAgentSevoFlanner = resultsgroupVaporizingAgent?.filter(data => data.concept.name === "Vaporizing Agen Sevo Flanner");
}
var multiDataconceptNames = ["Co Existing Disease", "Monitoring", "Anaesthesia Corona Test"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, multiDataconceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
let results = response.data
let coExistingDisease = results?.filter(data => data.concept.name === "Co Existing Disease")
$scope.coExistingDiseaseNote = coExistingDisease[0]?.comment;
$scope.coExistingDisease = arrayToString(coExistingDisease);
let monitoring = results.filter(data => data.concept.name === "Monitoring" && getEncounterValidation(data.encounterDateTime))
$scope.monitoringNote = monitoring[0]?.comment;
$scope.monitoring = arrayToString(monitoring);
// $scope.anesthesiaAdvice = results?.filter(data => data.concept.name === "Anesthesia Advice" && getEncounterValidation(data.encounterDateTime));
$scope.anaesthesiaCoronaTest = results?.filter(data => data.concept.name === "Anaesthesia Corona Test");
$scope.anyReactionThen = results?.filter(data => data.concept.name === "If any Reaction Then" && getEncounterValidation(data.encounterDateTime));
}
}));
function arrayToString(data) {
let optionValue = [];
data.map(data => optionValue.push( data.value.shortName ));
return optionValue.join(', ');
}
function getEncounterValidation(date) {
var diff = new Date().getTime() - new Date(date).getTime();
return parseInt(diff / 60000) < 60;
}
}))
$scope.curDate = new Date()
spinner.forPromise($q.all([bedService.getAssignedBedForPatient($scope.patient.uuid), visitService.getVisitSummary($scope.visitUuid)]).then(function (results) {
$scope.bedDetails = results[0];
$scope.wardText = results[0]
$scope.splitW = results[0]?.wardName?.split("(")[1]
$scope.DepartmentName = $scope.splitW?.split(")")[0]
if (results.length > 1) {
$scope.admissionDetails = results[1].data.admissionDetails
}
}));
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/anaesthesiaBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('ipdInfo', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
var conceptNames = ["Weight Anaesthesia"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let result = response.data
$scope.weightAnaesthesia = result.filter(data => data.concept.name === "Weight Anaesthesia");
}
}))
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/ipdInfo.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('anaesthesiaHead', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/anaesthesiaHead.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('bloodTransfusionBody', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
$scope.curDate = new Date();
let conceptNames = ["BT Note", "Transfuse", "Unite of Whole", "If any Reaction Note"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let results = response.data
let result = response.data[0].groupMembers
$scope.bTDateAndTime = result?.filter(data => data.concept.name === "BT Date and Time");
$scope.bTBloodGroup = result?.filter(data => data.concept.name === "BT Blood Group");
$scope.donorName = result?.filter(data => data.concept.name === "Donor Name");
$scope.donorSex = result?.filter(data => data.concept.name === "Donor Sex");
$scope.donorBagNo = result?.filter(data => data.concept.name === "Donor Bag No");
$scope.bloodCllectionDate = result?.filter(data => data.concept.name === "Blood Cllection Date");
$scope.screening = result?.filter(data => data.concept.name === "Screening");
$scope.transfuse = results?.filter(data => data.concept.name === "Transfuse");
$scope.uniteOfWhole = results?.filter(data => data.concept.name === "Unite of Whole");
$scope.anyReactionNote = results?.filter(data => data.concept.name === "If any Reaction Note");
}
let multiDataconceptNames = ["If any Reaction Then"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, multiDataconceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
let results = response.data;
$scope.anyReactionThen = results?.filter(data => data.concept.name === "If any Reaction Then" && getEncounterValidation(data.encounterDateTime));
$scope.otherReaction = results?.filter(data => data.value.name === "Other Reaction");
}
}));
function getEncounterValidation(date) {
var diff = new Date().getTime() - new Date(date).getTime();
return parseInt(diff / 60000) < 60;
}
}))
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/bloodTransfusionBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('operationNote', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
var conceptNames = ["Operation Note"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let result = response.data[0]?.groupMembers
$scope.dateAndTime = result?.filter(data => data.concept.name === "OT Date and Time");
$scope.operationDuration = result?.filter(data => data.concept.name === 'Operation Duration');
$scope.operationIndication = result?.filter(data => data.concept.name === "Operation Indication");
$scope.indicationNote = result?.filter(data => data.concept.name === "Indication Note");
$scope.nameOfOperation = result?.filter(data => data.concept.name === "Name of Operation");
$scope.anesthesiaOfOperation = result?.filter(data => data.concept.name === "Anesthesia of Operation");
$scope.oTAnesthesiaNote = result?.filter(data => data.concept.name === "OT Anesthesia Note");
$scope.positionOfPatient = result?.filter(data => data.concept.name === "Position Of Patient");
$scope.incision = result?.filter(data => data.concept.name === "OT Incision");
$scope.procedureAndFindings = result?.filter(data => data.concept.name === "Procedure and Findings");
$scope.nameOfSurgeons = result?.filter(data => data.concept.name === "Name of Surgeons");
$scope.nameOfAnesthetist = result?.filter(data => data.concept.name === "Name of Anesthetist");
}
}))
let multiDataconceptNames = ["Operation Indication"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, multiDataconceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data) {
let results = response.data;
$scope.oprationIndication = results?.filter(data => data.concept.name === "Operation Indication" && getEncounterValidation(data.encounterDateTime));
$scope.indicationOthers = results?.filter(data => data.value.name === "Indication Others");
}
}));
function getEncounterValidation(date) {
var diff = new Date().getTime() - new Date(date).getTime();
return parseInt(diff / 60000) < 60;
}
$scope.curDate = new Date()
spinner.forPromise($q.all([bedService.getAssignedBedForPatient($scope.patient.uuid), visitService.getVisitSummary($scope.visitUuid)]).then(function (results) {
$scope.bedDetails = results[0];
$scope.wardText = results[0]
$scope.splitW = results[0]?.wardName?.split("(")[1]
$scope.DepartmentName = $scope.splitW?.split(")")[0]
if (results[1].length > 0) {
}
$scope.visitSummary = results[1]?.data;
if (results[1].data.admissionDetails !== null) {
$scope.providerName = results[1]?.data.admissionDetails.provider;
}
$scope.providerName = results[1].data?.admissionDetails?.provider;
$q.all([getPatientInfo($scope.patient.uuid)]).then(function (response) {
$scope.address = response[0]?.data.results[0];
});
}));
var getPatientInfo = function (patientIdentifier) {
return $http.get(`/openmrs/ws/rest/v1/person/${patientIdentifier}/address`, {
method: "GET",
withCredentials: true
});
};
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/operationNote.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('bloodTransfusionHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/bloodTransfusionHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('operationNoteHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/operationNoteHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('anesthesiaCosentBody', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/anesthesiaCosentBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('aneurysmBody', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/aneurysmBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('avmavfBody', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/avmavfBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('caroticocavernousBody', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/caroticocavernousBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('carotidArteryBody', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/carotidArteryBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('cerebralDigitalSubtractionAngiographyBody', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/cerebralDigitalSubtractionAngiographyBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('neurosurgeyConsentBody', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/neurosurgeyConsentBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('neurosurgeryConsentHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/neurosurgeryConsentHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('anesthesiaCosentHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/anesthesiaCosentHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('aneurysmHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/aneurysmHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('avmavfHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/avmavfHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('caroticocavernousHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/caroticocavernousHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('carotidArteryHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/carotidArteryHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('cerebralDigitalSubtractionAngiographyHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/cerebralDigitalSubtractionAngiographyHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('radiologyImaging', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/radiologyImaging.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('radiologyImagingHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/radiologyImagingHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('bloodRequsitionBody', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
var conceptNames = ["Blood Requisition"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, "latest", undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let result = response.data[0]?.groupMembers;
$scope.bloodAmountUnit = result?.filter(data => data.concept.name === "Blood Amount Unit");
$scope.requiredAmount = result?.filter(data => data.concept.name === "Required Amount");
$scope.dateofBloodTransfusion = result?.filter(data => data.concept.name === "Date of Blood Transfusion");
$scope.bloodRequsitionNote = result?.filter(data => data.concept.name === "Type of Blood Requsition Note");
$scope.typeOfBloodDraw = result?.filter(data => data.concept.name === "Type of Blood Draw");
$scope.bloodComponentNote = result?.filter(data => data.concept.name === "Need of Note");
$scope.causesAndDiscation = result?.filter(data => data.concept.name === "Causes and Discation of Blood Draw");
$scope.bloodGroupKnown = result?.filter(data => data.concept.name === "Blood Group if known");
$scope.typeOfTest = result?.filter(data => data.concept.name === "Type of Test");
var bloodTakenBefore = result?.filter(data => data.concept.name === "If blood has been taken before")[0]?.groupMembers;
$scope.previousBloodDraw = bloodTakenBefore?.filter(data => data.concept.name === "Details of Previous Blood Draw");
$scope.bloodReceivedDate = bloodTakenBefore?.filter(data => data.concept.name === "Blood Received Date");
$scope.hemoglobin = bloodTakenBefore?.filter(data => data.concept.name === "BR HB");
$scope.pulse = bloodTakenBefore?.filter(data => data.concept.name === "BR Pulse");
$scope.temperature = bloodTakenBefore?.filter(data => data.concept.name === "BR Temperature");
var bloodPressure = bloodTakenBefore?.filter(data => data.concept.name === "BR Blood Pressure")[0]?.groupMembers;
$scope.bloodPressure = bloodPressure;
$scope.bpDiastolic = bloodPressure?.filter(data => data.concept.name === "BR BP Diastolic");
$scope.bpSystolic = bloodPressure?.filter(data => data.concept.name === "BR BP Systolic");
}
}))
var multiDataConceptNames = ["Need of Blood Component", "Blood Receives Type", "Whether if any side effect", "In case of female patient"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, multiDataConceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
let result = response.data;
var component = result?.filter(data => data.concept.name === "Need of Blood Component" && getEncounterValidation(data.encounterDateTime));
var filterComponentValue = component?.map(data=> data.value.shortName);
$scope.componentOther = filterComponentValue?.filter(data=> data === 'Other');
$scope.component = filterComponentValue?.join('/');
var bloodType = result?.filter(data => data.concept.name === "Blood Receives Type" && getEncounterValidation(data.encounterDateTime));
var filterBloodType = bloodType?.map(data => data.value.shortName);
$scope.bloodTypeOther = filterBloodType?.filter(data => data === 'Other');
$scope.bloodType = filterComponentValue?.join('/');
var sideEffect = result?.filter(data => data.concept.name === "Whether if any side effect" && getEncounterValidation(data.encounterDateTime));
$scope.sideEffect = sideEffect?.map(data => data.value.shortName)?.join('/')
$scope.sideEffectNote = sideEffect[0]?.comment;
var femalePatientCase = result?.filter(data => data.concept.name === "In case of female patient" && getEncounterValidation(data.encounterDateTime));
$scope.femalePatientCase = femalePatientCase?.map(data => data.value.shortName)?.join('/')
$scope.femalePatientCaseNote = femalePatientCase[0]?.comment;
}
}))
$scope.curDate = new Date()
spinner.forPromise($q.all([bedService.getAssignedBedForPatient($scope.patient.uuid), visitService.getVisitSummary($scope.visitUuid)]).then(function (results) {
$scope.bedDetails = results[0];
$scope.wardText = results[0]
$scope.splitW = results[0]?.wardName?.split("(")[1]
$scope.DepartmentName = $scope.splitW?.split(")")[0]
if (results.length > 1) {
$scope.admissionDetails = results[1].data.admissionDetails
}
}));
function getEncounterValidation(date) {
var diff = new Date().getTime() - new Date(date).getTime();
return parseInt(diff / 60000) < 60;
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/bloodRequsitionBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('bloodRequsitionHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/bloodRequsitionHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('reflowChartBody', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
let conceptNames = ["Reflow Chart"];
spinner.forPromise(observationsService.fetch($scope.patient.uuid, conceptNames, undefined, undefined, $scope.visitUuid, undefined).then(function (response) {
if (response.data.length > 0) {
const reflowChartData = response.data?.map(data=> data?.groupMembers);
const mergeReflowChartData = [].concat(...reflowChartData);
$scope.reflowChartData = mergeReflowChartData.map(data => {
const result = data.groupMembers;
const resultsgroupBBeforeDiet = result?.filter(data => data.concept.name === "B Before Diet")[0]?.groupMembers;
const resultsgroupAAfterDiet = result?.filter(data => data.concept.name === "A After Diet")[0]?.groupMembers;
return {
dietDateTime: result?.filter(data => data.concept.name === "Diet Date Time")[0]?.value,
beforeBBFReflow: resultsgroupBBeforeDiet?.filter(data => data.concept.name === "Before BBF Reflow")[0]?.value,
beforeBBFDoseofInsulin: resultsgroupBBeforeDiet?.filter(data => data.concept.name === "Before BBF Dose of Insulin")[0]?.value,
beforeBLReflow: resultsgroupBBeforeDiet?.filter(data => data.concept.name === "Before BL Reflow")[0]?.value,
beforeBLDoseofInsulin: resultsgroupBBeforeDiet?.filter(data => data.concept.name === "Before BL Dose of Insulin")[0]?.value,
beforeBDReflow: resultsgroupBBeforeDiet?.filter(data => data.concept.name === "Before BD Reflow")[0]?.value,
beforeBDDoseofInsulin: resultsgroupBBeforeDiet?.filter(data => data.concept.name === "Before BD Dose of Insulin")[0]?.value,
afterABFReflow: resultsgroupAAfterDiet?.filter(data => data.concept.name === "After ABF Reflow")[0]?.value,
afterABFDoseofInsulin: resultsgroupAAfterDiet?.filter(data => data.concept.name === "After ABF Dose of Insulin")[0]?.value,
afterALReflow: resultsgroupAAfterDiet?.filter(data => data.concept.name === "After AL Reflow")[0]?.value,
afterALDoseofInsulin: resultsgroupAAfterDiet?.filter(data => data.concept.name === "After AL Dose of Insulin")[0]?.value,
afterADReflow: resultsgroupAAfterDiet?.filter(data => data.concept.name === "After AD Reflow")[0]?.value,
afterADDoseofInsulin: resultsgroupAAfterDiet?.filter(data => data.concept.name === "After AD Dose of Insulin")[0]?.value,
}
})
}
}))
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/reflowChartBody.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('reflowChartHeader', ['appService', '$sce', function (appService, $sce) {
var link = function ($scope) {
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/reflowChartHeader.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])
.directive('ipdInfoDetails', ['$q', 'observationsService', 'visitService', 'bedService', 'appService', 'spinner', '$sce', '$http', function ($q, observationsService, visitService, bedService, appService, spinner, $sce, $http) {
var link = function ($scope) {
$scope.curDate = new Date()
spinner.forPromise($q.all([bedService.getAssignedBedForPatient($scope.patient.uuid), visitService.getVisitSummary($scope.visitUuid)]).then(function (results) {
$scope.bedDetails = results[0];
$scope.wardText = results[0]
$scope.splitW = results[0]?.wardName?.split("(")[1]
$scope.DepartmentName = $scope.splitW?.split(")")[0]
if (results.length > 1) {
$scope.admissionDetails = results[1].data.admissionDetails
}
}));
function getEncounterValidation(date) {
var diff = new Date().getTime() - new Date(date).getTime();
return parseInt(diff / 60000) < 60;
}
$scope.contentUrl = appService.configBaseUrl() + "/customDisplayControl/views/ipdInfoDetails.html";
}
return {
restrict: 'E',
link: link,
template: '<ng-include src="contentUrl"/>'
}
}])