Skip to content
Open
3 changes: 2 additions & 1 deletion onprc_ehr/resources/queries/study/treatmentSchedule.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
<sorts>
<sort column="date"/>
<sort column="Id/curLocation/room"/>
<sort column="Id/curLocation/cage"/>
</sorts>
<filters>
<filter column="calculated_status" operator="eq" value="Alive"/>
<filter column="category" operator="containsnoneof" value="Clinical on behalf of Research,Clinical on behalf of Surgical"/>
</filters>
</customView>
84 changes: 84 additions & 0 deletions onprc_ehr/resources/views/printableReports.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,90 @@
style: 'margin-left: 5px;',

},{
html: '<hr>',
style: 'padding-top: 10px;',
colspan: 4
},{


html: '<i>Clinical NPO FAST Medications:</i>'
},{
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: '<hr>',
style: 'padding-top: 10px;',
Expand Down
6 changes: 6 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 64 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/form/field/TimeOfDayField.js
Original file line number Diff line number Diff line change
@@ -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;
}
});
5 changes: 5 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/onprcReports.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};
Expand Down