From 86839b2f04f78d537c7a085cfcd33f6534bf5885 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Wed, 6 Aug 2025 16:31:48 -0700 Subject: [PATCH 1/8] Modified Treatmentschedule to include std_time values as variable to display medication times. --- onprc_ehr/resources/queries/study/treatmentSchedule.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule.sql b/onprc_ehr/resources/queries/study/treatmentSchedule.sql index 2fc4bc5bd..2df0849da 100644 --- a/onprc_ehr/resources/queries/study/treatmentSchedule.sql +++ b/onprc_ehr/resources/queries/study/treatmentSchedule.sql @@ -41,7 +41,7 @@ SELECT ELSE minute(t1.date) END as minutes, dr.date as origDate, - --ft.timedescription as timeOfDay, + ft.timedescription as std_time, //Modified: 8-6-2025 required value to the ssrs reports CASE WHEN (tt.time IS NULL) THEN 'Default' ELSE 'Custom' From 35eea4a9fa0954c2853538d9a671f37b8a40b8d7 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:15:12 -0700 Subject: [PATCH 2/8] Modified Treatmentschedule to include std_time values as variable to display medication times. --- onprc_ehr/resources/queries/study/treatmentSchedule.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule.sql b/onprc_ehr/resources/queries/study/treatmentSchedule.sql index 2df0849da..8779d5250 100644 --- a/onprc_ehr/resources/queries/study/treatmentSchedule.sql +++ b/onprc_ehr/resources/queries/study/treatmentSchedule.sql @@ -41,7 +41,7 @@ SELECT ELSE minute(t1.date) END as minutes, dr.date as origDate, - ft.timedescription as std_time, //Modified: 8-6-2025 required value to the ssrs reports + ft.timedescription as stdtime, //Modified: 8-6-2025 required value to the ssrs reports CASE WHEN (tt.time IS NULL) THEN 'Default' ELSE 'Custom' From 705a74c0af0fd8ee83bc52d9260adf6b6c692f2e Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:41:32 -0700 Subject: [PATCH 3/8] Modified Treatmentschedule to include std_time values as variable to display medication times. --- onprc_ehr/resources/queries/study/treatmentSchedule.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule.sql b/onprc_ehr/resources/queries/study/treatmentSchedule.sql index 8779d5250..e56d5de15 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 (s.stdtime = 'EVENING') THEN 'PM' WHEN (hours >= 6 AND hours < 20) THEN 'AM' WHEN (hours < 6 OR hours >= 20) THEN 'PM' ELSE 'Other' From d45641177dabad9553bfc1559bd610f0205d785b Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:51:58 -0700 Subject: [PATCH 4/8] Modified Treatmentschedule to include std_time values as variable to display medication times. --- onprc_ehr/resources/queries/study/treatmentSchedule.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule.sql b/onprc_ehr/resources/queries/study/treatmentSchedule.sql index e56d5de15..dcd335702 100644 --- a/onprc_ehr/resources/queries/study/treatmentSchedule.sql +++ b/onprc_ehr/resources/queries/study/treatmentSchedule.sql @@ -19,7 +19,7 @@ SELECT s.*, timestampadd('SQL_TSI_MINUTE', ((s.hours * 60) + s.minutes), s.origDate) as date, CASE - WHEN (s.stdtime = 'EVENING') THEN 'PM' + WHEN (stdtime = 'EVENING') THEN 'AM' WHEN (hours >= 6 AND hours < 20) THEN 'AM' WHEN (hours < 6 OR hours >= 20) THEN 'PM' ELSE 'Other' @@ -42,7 +42,7 @@ SELECT ELSE minute(t1.date) END as minutes, dr.date as origDate, - ft.timedescription as stdtime, //Modified: 8-6-2025 required value to the ssrs reports + ft.timedescription as stdtime, ----Modified: 8-6-2025 required field for SSRS reports CASE WHEN (tt.time IS NULL) THEN 'Default' ELSE 'Custom' From 98afdba085fb851fd21dd0316ff275a7bd4d7a85 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:52:27 -0700 Subject: [PATCH 5/8] Modified Treatmentschedule to include std_time values as variable to display medication times. --- onprc_ehr/resources/queries/study/treatmentSchedule.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule.sql b/onprc_ehr/resources/queries/study/treatmentSchedule.sql index dcd335702..2e5cd9308 100644 --- a/onprc_ehr/resources/queries/study/treatmentSchedule.sql +++ b/onprc_ehr/resources/queries/study/treatmentSchedule.sql @@ -19,7 +19,7 @@ SELECT s.*, timestampadd('SQL_TSI_MINUTE', ((s.hours * 60) + s.minutes), s.origDate) as date, CASE - WHEN (stdtime = 'EVENING') THEN 'AM' + WHEN (stdtime = 'EVENING') THEN 'PM' WHEN (hours >= 6 AND hours < 20) THEN 'AM' WHEN (hours < 6 OR hours >= 20) THEN 'PM' ELSE 'Other' From 28d2b8c6af310f834109985cf3abcb17ce9b9658 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Fri, 19 Sep 2025 09:25:17 -0700 Subject: [PATCH 6/8] Created a new reporting process to allow NPO Fast medications to be displayed using a different set of Clinical Reports. --- .../queries/study/treatmentSchedule.sql | 4 +- .../Clinical FAST Medications.qview.xml | 11 +++ .../resources/views/printableReports.html | 86 +++++++++++++++++++ onprc_ehr/resources/web/onprc_ehr/Utils.js | 6 ++ .../onprc_ehr/form/field/TimeOfDayField.js | 64 ++++++++++++++ .../resources/web/onprc_ehr/onprcReports.js | 5 ++ 6 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 onprc_ehr/resources/queries/study/treatmentSchedule/Clinical FAST Medications.qview.xml create mode 100644 onprc_ehr/resources/web/onprc_ehr/form/field/TimeOfDayField.js diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule.sql b/onprc_ehr/resources/queries/study/treatmentSchedule.sql index 2e5cd9308..f2ceabadc 100644 --- a/onprc_ehr/resources/queries/study/treatmentSchedule.sql +++ b/onprc_ehr/resources/queries/study/treatmentSchedule.sql @@ -19,7 +19,7 @@ SELECT s.*, timestampadd('SQL_TSI_MINUTE', ((s.hours * 60) + s.minutes), s.origDate) as date, CASE - WHEN (stdtime = 'EVENING') THEN 'PM' + WHEN (stdtime = 'EXT') THEN 'EXT' WHEN (hours >= 6 AND hours < 20) THEN 'AM' WHEN (hours < 6 OR hours >= 20) THEN 'PM' ELSE 'Other' @@ -42,7 +42,7 @@ SELECT ELSE minute(t1.date) END as minutes, dr.date as origDate, - ft.timedescription as stdtime, ----Modified: 8-6-2025 required field for SSRS reports + --ft.timedescription as timeOfDay, 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..fca5c1825 100644 --- a/onprc_ehr/resources/views/printableReports.html +++ b/onprc_ehr/resources/views/printableReports.html @@ -309,6 +309,92 @@ 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: 'ehr-timeofdayfield', + // itemId: 'medicationTimeOfDayField' + }] + },{ + 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'); }; From 4098811e1bcbbebcf2d0a0fec80da53ef457dc15 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Fri, 19 Sep 2025 09:52:45 -0700 Subject: [PATCH 7/8] Created a new reporting process to allow NPO Fast medications to be displayed using a different set of Clinical Reports. --- onprc_ehr/resources/queries/study/treatmentSchedule.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/study/treatmentSchedule.sql b/onprc_ehr/resources/queries/study/treatmentSchedule.sql index f2ceabadc..7ca82b194 100644 --- a/onprc_ehr/resources/queries/study/treatmentSchedule.sql +++ b/onprc_ehr/resources/queries/study/treatmentSchedule.sql @@ -42,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' From 9b63fd8e1cffa2cd29b75058324a400c8e31ab82 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Fri, 19 Sep 2025 10:41:36 -0700 Subject: [PATCH 8/8] Created a new reporting process to allow NPO Fast medications to be displayed using a different set of Clinical Reports. --- onprc_ehr/resources/views/printableReports.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/onprc_ehr/resources/views/printableReports.html b/onprc_ehr/resources/views/printableReports.html index fca5c1825..6a1c45267 100644 --- a/onprc_ehr/resources/views/printableReports.html +++ b/onprc_ehr/resources/views/printableReports.html @@ -324,9 +324,7 @@ itemId: 'medicationDateField', value: new Date(), allowBlank: false - },{ - // xtype: 'ehr-timeofdayfield', - // itemId: 'medicationTimeOfDayField' + }] },{ xtype: 'button',