Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions nirc_ehr/resources/queries/study/drug/.qview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
<column name="Id/curLocation/cage/room/floor/building"/>
<column name="Id/curLocation/cage"/>
<column name="date"/>
<column name="enddate"/>
<column name="code"/>
<column name="frequency"/>
<column name="route"/>
<column name="volume"/>
<column name="vol_units"/>
Expand All @@ -22,7 +20,7 @@
<column name="dosage_units"/>
<column name="orderedby"/>
<column name="performedBy"/>
<column name="description"/>
<column name="category"/>
<column name="remark"/>
</columns>
</customView>
28 changes: 28 additions & 0 deletions nirc_ehr/resources/queries/study/drug/Behavior.qview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView" canOverride="true">
<sorts>
<sort column="date" descending="true"/>
</sorts>
<columns>
<column name="Id"/>
<column name="Id/Demographics/species"/>
<column name="Id/curLocation/cage/room/floor/building"/>
<column name="Id/curLocation/cage"/>
<column name="date"/>
<column name="code"/>
<column name="route"/>
<column name="volume"/>
<column name="vol_units"/>
<column name="amount"/>
<column name="amount_units"/>
<column name="concentration"/>
<column name="conc_units"/>
<column name="dosage"/>
<column name="dosage_units"/>
<column name="orderedby"/>
<column name="performedBy"/>
<column name="remark"/>
</columns>
<filters>
<filter column="category" operator="eq" value="Behavior"/>
</filters>
</customView>
3 changes: 2 additions & 1 deletion nirc_ehr/resources/reports/additionalReports.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ notes Colony Management query Notes true study notes false false qcstate/pu
activeClinTreatmentOrders Clinical query Active Clinical Medication Orders true study treatment_order Clinical Active Treatment Orders date false false qcstate/publicdata This report contains the treatment orders entered for each animal
activeBehaviorTreatmentOrders Behavior query Active Behavior Medication Orders true study treatment_order Behavior Active Treatment Orders date false false qcstate/publicdata This report contains the treatment orders entered for each animal
allTreatments Clinical query All Treatment Orders true study treatment_order false false qcstate/publicdata This report shows all treatment orders
behTreatments Behavior query All Behavior Medication Orders true study treatment_order behavior false false qcstate/publicdata This report shows all treatment orders
behTreatments Behavior query All Behavior Medication Orders true study treatment_order behavior false false qcstate/publicdata This report shows all behavior treatment orders
behDrug Behavior query Behavior Drug Administration true study drug Behavior false false qcstate/publicdata This report shows all behavior drug administrations
FileRepository General js File Repository true study FileRepository false false qcstate/publicdata File Repository for uploading and viewing animal related files
observationSchedule Daily Reports js Today's Observation Schedule true study observationSchedule date false false qcstate/publicdata This report contains a list of today's treatments to be administered
activeClinicalObservationOrders Clinical query Active Clinical Observation Orders true study observation_order Active Clinical Orders date false false qcstate/publicdata This report contains a list of today's treatments to be administered
Expand Down
82 changes: 82 additions & 0 deletions nirc_ehr/resources/views/clinicalHistoryExport.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<script type="text/javascript" nonce="<%=scriptNonce%>">

Ext4.onReady(function (){
var webpart = <%=webpartContext%>;

var subjects = LABKEY.ActionURL.getParameterArray('subjectId');
if (!subjects || !subjects.length){
Ext4.Msg.alert('Error', 'No IDs provided');
return;
}

subjects = subjects.sort();

var hideHistory = Ext4.data.Types.BOOLEAN.convert(LABKEY.ActionURL.getParameter('hideHistory'));

var toAdd = [];
Ext4.each(subjects, function(s, idx){
toAdd.push({
html: '<span style="font-size: large;"><b>Animal: ' + s + '</b></span>',
style: 'padding-bottom: 20px;',
border: false
});


toAdd.push({
xtype: 'nirc_ehr-narrowsnapshotpanel',
redacted: Ext4.data.Types.BOOLEAN.convert(LABKEY.ActionURL.getParameter('redacted')),
hrefTarget: '_blank',
border: false,
subjectId: s
});

if (!hideHistory){
toAdd.push({
html: '<b>Chronological History:</b><hr>',
style: 'padding-top: 5px;',
border: false
});

toAdd.push({
xtype: LABKEY.ActionURL.getParameter('caseId') ? 'ehr-casehistorypanel' : 'ehr-clinicalhistorypanel',
printMode: true,
hideExportBtn: true,
border: true,
subjectId: s,
autoLoadRecords: true,
minDate: LABKEY.ActionURL.getParameter('minDate'),
maxDate: LABKEY.ActionURL.getParameter('maxDate'),
caseId: LABKEY.ActionURL.getParameter('caseId'),
hideGridButtons: LABKEY.ActionURL.getParameter('hideGridButtons'),
redacted: Ext4.data.Types.BOOLEAN.convert(LABKEY.ActionURL.getParameter('redacted')),
sortMode: LABKEY.ActionURL.getParameter('sortMode'),
checkedItems: LABKEY.ActionURL.getParameter('checkedItems') ? LABKEY.ActionURL.getParameter('checkedItems').split(';') : null,
hrefTarget: '_blank',
style: 'margin-bottom: 20px;'
});
}
else {
toAdd.push({
height: 20,
border: false
});
}

if (idx != (subjects.length - 1)){
toAdd.push({
tag: 'div',
border: false,
cls: 'page-break'
});
}
}, this);

Ext4.create('Ext.panel.Panel', {
border: false,
style: 'width: 8in;',
cls: 'clinical-history-print',
bodyCls: 'clinical-history-print',
items: toAdd
}).render(webpart.wrapperDivId);
});
</script>
5 changes: 5 additions & 0 deletions nirc_ehr/resources/views/clinicalHistoryExport.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<view xmlns="http://labkey.org/data/xml/view" frame="none" template="print" title="Clinical History Export">
<dependencies>
<dependency path="ehr.context" />
</dependencies>
</view>
8 changes: 8 additions & 0 deletions nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ EHR.model.DataModelManager.registerMetadata('Default', {
allowBlank: true,
defaultValue: LABKEY.Security.currentUser.id,
getInitialValue: function (v, rec) {
if (Number.isInteger(v)){
return v;
}

return LABKEY.Security.currentUser.id;
},
editorConfig: {
Expand Down Expand Up @@ -136,6 +140,10 @@ EHR.model.DataModelManager.registerMetadata('Default', {
sort: 'Type,DisplayName'
},
getInitialValue: function (v, rec) {
if (Number.isInteger(v)){
return v;
}

return LABKEY.Security.currentUser.id;
},
editorConfig: {
Expand Down
2 changes: 1 addition & 1 deletion nirc_ehr/resources/web/nirc_ehr/nircReports.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ EHR.reports.clinicalHistory = function(panel, tab, showActionsBtn, includeAll){
});

toAdd.push({
xtype: 'ehr-clinicalhistorypanel',
xtype: 'nirc_ehr-clinicalhistorypanel',
border: true,
subjectId: s,
autoLoadRecords: true,
Expand Down
19 changes: 19 additions & 0 deletions nirc_ehr/resources/web/nirc_ehr/panel/CaseHistoryPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

/**
* @cfg caseId
* @cfg maxGridHeight
* @cfg autoLoadRecords
*/
Ext4.define('NIRC_EHR.panel.CaseHistoryPanel', {
extend: 'NIRC_EHR.panel.ClinicalHistoryPanel',
alias: 'widget.nirc_ehr-casehistorypanel',

getStoreConfig: function(){
return {
type: 'ehr-clinicalhistorystore',
containerPath: this.containerPath,
actionName: 'getCaseHistory',
sorters: [{property: 'group'}, {property: 'timeString'}]
};
}
});
144 changes: 144 additions & 0 deletions nirc_ehr/resources/web/nirc_ehr/panel/ClinicalHistoryPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@

/**
* @cfg subjectId
* @cfg minDate
* @cfg maxDate
* @cfg maxGridHeight
* @cfg autoLoadRecords
* @cfg hideExportBtn
* @cfg sortMode
* @cfg checkedItems
* @cfg showMaxDate
* @cfg redacted
* @cfg printMode
*/
Ext4.define('NIRC_EHR.panel.ClinicalHistoryPanel', {
extend: 'EHR.panel.ClinicalHistoryPanel',
alias: 'widget.nirc_ehr-clinicalhistorypanel',

showMaxDate: false,

getGridConfig: function(){
return {
xtype: 'grid',
border: this.printMode ? false : true,
minHeight: 100,
minWidth: this.width - 50,
cls: 'ldk-grid',
maxHeight: this.maxGridHeight,
height: this.gridHeight,
hideHeaders: true,
deferEmptyText: true,
viewConfig : {
emptyText: this.minDate ? 'No records found since: ' + Ext4.util.Format.date(this.minDate, LABKEY.extDefaultDateFormat): 'There are no records to display',
deferEmptyText: true,
enableTextSelection: true,
border: false,
stripeRows : true
},
columns: this.getColumnConfig(),
features: [this.getGroupingFeature()],
store: this.getStoreConfig(),
itemId: 'gridPanel',
width: this.width,
subjectId: this.subjectId,
caseId: this.caseId,
minDate: this.minDate,
maxDate: this.maxDate,
tbar: this.hideGridButtons ? null : {
border: true,
items: [{
xtype: 'datefield',
fieldLabel: 'Min Date',
itemId: 'minDate',
labelWidth: 80,
width: 200,
value: this.minDate
},{
xtype: 'datefield',
fieldLabel: 'Max Date',
itemId: 'maxDate',
labelWidth: 80,
width: 200,
hidden: this.showMaxDate,
value: this.maxDate
},{
xtype: 'button',
text: 'Reload',
handler: function(btn){
var panel = btn.up('ehr-clinicalhistorypanel');
panel.doReload();
}
},{
text: 'Show/Hide Types',
scope: this,
handler: function(btn){
this.showFilterPanel();
}
},{
text: 'Collapse All',
hidden: this.printMode,
collapsed: false,
handler: function(btn){
var grid = btn.up('grid');
var feature = grid.getView().getFeature('historyGrouping');

if (btn.collapsed){
feature.expandAll();
btn.setText('Collapse All');
}
else {
feature.collapseAll();
btn.setText('Expand All')
}

btn.collapsed = !btn.collapsed;
}
},{
hidden: this.printMode,
text: (this.sortMode == 'type' ? 'Group By Date' : 'Group By Type'),
sortMode: this.sortMode == 'type' ? 'date' : 'type',
scope: this,
handler: function(btn){
//toggle the button
if (btn.sortMode == 'type'){
btn.setText('Group By Date');
btn.sortMode = 'date';
this.changeMode('type');
}
else {
btn.setText('Group By Type');
btn.sortMode = 'type';
this.changeMode('date');
}
}
},{
text: 'Print Version',
hidden: this.hideExportBtn || this.printMode,
scope: this,
handler: function(btn){
var params = {
hideGridButtons: true
};
if (this.subjectId)
params.subjectId = [this.subjectId];
if (this.caseId)
params.caseId = this.caseId;
if (this.minDate)
params.minDate = Ext4.util.Format.date(this.minDate, LABKEY.extDefaultDateFormat);
if (this.maxDate)
params.maxDate = Ext4.util.Format.date(this.maxDate, LABKEY.extDefaultDateFormat);
if (this.sortMode)
params.sortMode = this.sortMode;
if (this.checkedItems && this.checkedItems.length)
params.checkedItems = this.checkedItems.join(';');

var url = LABKEY.ActionURL.buildURL('nirc_ehr', 'clinicalHistoryExport', null, params);
window.open(url, '_blank');
}
}]
}
};
}
});

37 changes: 37 additions & 0 deletions nirc_ehr/resources/web/nirc_ehr/panel/NarrowSnapshotPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Ext4.define('NIRC_EHR.panel.NarrowSnapshotPanel', {
extend: 'NIRC_EHR.panel.SnapshotPanel',
alias: 'widget.nirc_ehr-narrowsnapshotpanel',

showLocationDuration: false,
showExtendedInformation: true,

minWidth: 800,

initComponent: function(){

this.defaultLabelWidth = 120;
this.callParent();
},

getItems: function() {
var items = this.getBaseItems();

//combine the first and second columns
var secondCol = items[0].items[1].items[1];
var extended = this.getExtendedItems();

var index = items[0].items[1].items.indexOf(secondCol);
if (index !== -1) {
items[0].items[1].items = items[0].items[1].items.splice(index, 1);
}

items[0].items[1].items = items[0].items[1].items.concat(extended[0].items[1].items[0]);
items[0].items[1].items[1].items = items[0].items[1].items[1].items.concat(extended[0].items[1].items[1].items[0]);

items[0].items[1].items[0].columnWidth = 0.45;
items[0].items[1].items[1].columnWidth = 0.55;

return items;
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Ext4.define('NIRC_EHR.window.CaseHistoryWindow', {
items[1].items[0].title = 'Entire History';
items[1].items.splice(1, 0, {
title: 'Case History',
xtype: 'ehr-casehistorypanel',
xtype: 'nirc_ehr-casehistorypanel',
containerPath: this.containerPath,
border: true,
width: 1180,
Expand Down
Loading