diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule.sql b/onprc_ehr/resources/queries/study/treatmentSchedule.sql index 2fc4bc5bd..7ca82b194 100644 --- a/onprc_ehr/resources/queries/study/treatmentSchedule.sql +++ b/onprc_ehr/resources/queries/study/treatmentSchedule.sql @@ -19,6 +19,7 @@ SELECT s.*, timestampadd('SQL_TSI_MINUTE', ((s.hours * 60) + s.minutes), s.origDate) as date, CASE + WHEN (stdtime = 'EXT') THEN 'EXT' WHEN (hours >= 6 AND hours < 20) THEN 'AM' WHEN (hours < 6 OR hours >= 20) THEN 'PM' ELSE 'Other' @@ -41,7 +42,7 @@ SELECT ELSE minute(t1.date) END as minutes, dr.date as origDate, - --ft.timedescription as timeOfDay, + ft.timedescription as stdtime, CASE WHEN (tt.time IS NULL) THEN 'Default' ELSE 'Custom' diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule/Clinical FAST Medications.qview.xml b/onprc_ehr/resources/queries/study/treatmentSchedule/Clinical FAST Medications.qview.xml new file mode 100644 index 000000000..01da710e8 --- /dev/null +++ b/onprc_ehr/resources/queries/study/treatmentSchedule/Clinical FAST Medications.qview.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/onprc_ehr/resources/views/printableReports.html b/onprc_ehr/resources/views/printableReports.html index 22890a565..6a1c45267 100644 --- a/onprc_ehr/resources/views/printableReports.html +++ b/onprc_ehr/resources/views/printableReports.html @@ -309,6 +309,90 @@ style: 'margin-left: 5px;', },{ + html: '
', + style: 'padding-top: 10px;', + colspan: 4 + },{ + + + html: 'Clinical NPO FAST Medications:' + },{ + style: 'padding-left: 10px;', + items: [{ + xtype: 'datefield', + fieldLabel: 'Date', + itemId: 'medicationDateField', + value: new Date(), + allowBlank: false + + }] + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Print Version', + border: true, + getUrlString: function(){ + var panel = this.up('#sheetPanel'); + var params = panel.getParams(true, true, ';'); + if (!params) + return; + + var date = panel.down('#medicationDateField').getValue(); + if (!date){ + Ext4.Msg.alert('Error', 'Must provide a date'); + return; + } + + params['TreatmentDate'] = Ext4.Date.format(date, LABKEY.extDefaultDateFormat); + params['NumDays'] = 2; + // Modified: 12-12-2023 R. Blasa + + params['Category'] = 'Clinical;Clinical on behalf of Research;Clinical on behalf of Surgical'; + + + params['TimeOfDay'] = 'EXT'; + + + return ONPRC.Utils.getSsrsReportUrl('Clinical/ActiveTreatments_NPO_FAST', + ONPRC.Utils.getSsrsParams(params, true, true)); + }, + menu: [{ + text: 'Print', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + + window.open(url); + } + },{ + text: 'Print To PDF', + handler: function(menu){ + var btn = menu.up('button'); + var url = btn.getUrlString(); + if (!url) + return; + + url += '&rs:Format=PDF'; + window.open(url); + } + }] + },{ + xtype: 'button', + style: 'margin-left: 5px;', + text: 'Online Version', + border: true, + handler: function(btn){ + var url = LABKEY.ActionURL.buildURL('ehr', 'animalHistory'); + url += btn.up('#sheetPanel').getAnimalHistoryHash('clinMedicationFASTSchedule'); + window.open(url); + } + },{ + style: 'margin-left: 5px;', + + },{ + html: '
', style: 'padding-top: 10px;', diff --git a/onprc_ehr/resources/web/onprc_ehr/Utils.js b/onprc_ehr/resources/web/onprc_ehr/Utils.js index c708e0d58..e423472bc 100644 --- a/onprc_ehr/resources/web/onprc_ehr/Utils.js +++ b/onprc_ehr/resources/web/onprc_ehr/Utils.js @@ -44,6 +44,12 @@ ONPRC.Utils = new function(){ return baseUrl + '/' + ssrsFolder + '/' + reportPath + '&' + LABKEY.ActionURL.queryString(params); }, + getSsrsReportUrlFAST: function(reportPath, params) { + const baseUrl = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL'); + const ssrsFolder = 'Prime Test/Misc Process'; + return baseUrl + '/' + ssrsFolder + '/' + reportPath + '&' + LABKEY.ActionURL.queryString(params); + }, + /** * Handles the SessionID and HostName parameters. * @param extraParams any extra parameters to add diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/TimeOfDayField.js b/onprc_ehr/resources/web/onprc_ehr/form/field/TimeOfDayField.js new file mode 100644 index 000000000..8b88ea6c2 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/TimeOfDayField.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +Ext4.define('ONPRC_EHR.field.TimeOfDayField', { + extend: 'Ext.form.ComboBox', + alias: 'widget.onprc_ehr-timeofdayfield', + + initComponent: function(){ + Ext4.apply(this, { + multiSelect: true, + fieldLabel: 'Time of Day', + value: 'both', + displayField: 'display', + valueField: 'time', + queryMode: 'local', + store: { type: 'array', + fields: ['time', 'display'], + data: [['both', 'Both'], ['AM', 'AM'],['PM', 'PM'],['EXT', 'ALL']] + }, + listeners: { + change: function(field, val, oldVal){ + val = (!val || Ext4.isArray(val)) ? val : [val]; + oldVal = (!oldVal || Ext4.isArray(oldVal)) ? oldVal : [oldVal]; + this.setValue(val); + + //if the previous selection was just 'both', and the user picks something else, we need to de-select 'both' +// if (oldVal && oldVal.indexOf('both') != -1 && oldVal.length == 1 && val.indexOf('both') != -1 && val.length > 1){ +// val = val.remove('both'); +// this.setValue(val); +// } +// else if (val && val.indexOf('both') != -1 && val.length > 1 && oldVal.indexOf('both') == -1){ +// this.setValue('EXT'); +// } +// // else if (val.indexOf('AM') > -1 && val.indexOf('PM') > -1){ +// // this.setValue('both'); +// // } + } + } + }); + + this.callParent(arguments); + }, + + getURLParam: function(){ + var val = this.getTimeValue(); + return val ? val.join(';') : null; + }, + + getTimeValue: function(){ + var timeOfDay = this.getValue(); + timeOfDay = (!timeOfDay || Ext4.isArray(timeOfDay)) ? timeOfDay : [timeOfDay]; + + if (timeOfDay && timeOfDay.indexOf('both') > -1){ + return null; + } + else if (timeOfDay && timeOfDay.indexOf('AM') > -1 && timeOfDay.indexOf('PM') > -1){ + return null; + } + + return timeOfDay; + } +}); diff --git a/onprc_ehr/resources/web/onprc_ehr/onprcReports.js b/onprc_ehr/resources/web/onprc_ehr/onprcReports.js index 74ed3025a..4f66eab1f 100644 --- a/onprc_ehr/resources/web/onprc_ehr/onprcReports.js +++ b/onprc_ehr/resources/web/onprc_ehr/onprcReports.js @@ -268,6 +268,11 @@ EHR.reports.clinMedicationSchedule = function(panel, tab){ EHR.reports.medicationSchedule(panel, tab, 'Clinical Medications'); }; +EHR.reports.clinMedicationFASTSchedule = function(panel, tab){ + EHR.reports.medicationSchedule(panel, tab, 'Clinical FAST Medications'); +}; + + EHR.reports.dietSchedule = function(panel, tab){ EHR.reports.medicationSchedule(panel, tab, 'Diets'); };