Skip to content

Commit a886812

Browse files
Clinical history tweaks (#656)
* Custom clinical history and snapshot panels * Drug report for behavior * Update performedby initialization
1 parent 79b2524 commit a886812

13 files changed

Lines changed: 333 additions & 7 deletions

File tree

nirc_ehr/resources/queries/study/drug/.qview.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
<column name="Id/curLocation/cage/room/floor/building"/>
99
<column name="Id/curLocation/cage"/>
1010
<column name="date"/>
11-
<column name="enddate"/>
1211
<column name="code"/>
13-
<column name="frequency"/>
1412
<column name="route"/>
1513
<column name="volume"/>
1614
<column name="vol_units"/>
@@ -22,7 +20,7 @@
2220
<column name="dosage_units"/>
2321
<column name="orderedby"/>
2422
<column name="performedBy"/>
25-
<column name="description"/>
23+
<column name="category"/>
2624
<column name="remark"/>
2725
</columns>
2826
</customView>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<customView xmlns="http://labkey.org/data/xml/queryCustomView" canOverride="true">
2+
<sorts>
3+
<sort column="date" descending="true"/>
4+
</sorts>
5+
<columns>
6+
<column name="Id"/>
7+
<column name="Id/Demographics/species"/>
8+
<column name="Id/curLocation/cage/room/floor/building"/>
9+
<column name="Id/curLocation/cage"/>
10+
<column name="date"/>
11+
<column name="code"/>
12+
<column name="route"/>
13+
<column name="volume"/>
14+
<column name="vol_units"/>
15+
<column name="amount"/>
16+
<column name="amount_units"/>
17+
<column name="concentration"/>
18+
<column name="conc_units"/>
19+
<column name="dosage"/>
20+
<column name="dosage_units"/>
21+
<column name="orderedby"/>
22+
<column name="performedBy"/>
23+
<column name="remark"/>
24+
</columns>
25+
<filters>
26+
<filter column="category" operator="eq" value="Behavior"/>
27+
</filters>
28+
</customView>

nirc_ehr/resources/reports/additionalReports.tsv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ notes Colony Management query Notes true study notes false false qcstate/pu
1313
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
1414
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
1515
allTreatments Clinical query All Treatment Orders true study treatment_order false false qcstate/publicdata This report shows all treatment orders
16-
behTreatments Behavior query All Behavior Medication Orders true study treatment_order behavior false false qcstate/publicdata This report shows all treatment orders
16+
behTreatments Behavior query All Behavior Medication Orders true study treatment_order behavior false false qcstate/publicdata This report shows all behavior treatment orders
17+
behDrug Behavior query Behavior Drug Administration true study drug Behavior false false qcstate/publicdata This report shows all behavior drug administrations
1718
FileRepository General js File Repository true study FileRepository false false qcstate/publicdata File Repository for uploading and viewing animal related files
1819
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
1920
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
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<script type="text/javascript" nonce="<%=scriptNonce%>">
2+
3+
Ext4.onReady(function (){
4+
var webpart = <%=webpartContext%>;
5+
6+
var subjects = LABKEY.ActionURL.getParameterArray('subjectId');
7+
if (!subjects || !subjects.length){
8+
Ext4.Msg.alert('Error', 'No IDs provided');
9+
return;
10+
}
11+
12+
subjects = subjects.sort();
13+
14+
var hideHistory = Ext4.data.Types.BOOLEAN.convert(LABKEY.ActionURL.getParameter('hideHistory'));
15+
16+
var toAdd = [];
17+
Ext4.each(subjects, function(s, idx){
18+
toAdd.push({
19+
html: '<span style="font-size: large;"><b>Animal: ' + s + '</b></span>',
20+
style: 'padding-bottom: 20px;',
21+
border: false
22+
});
23+
24+
25+
toAdd.push({
26+
xtype: 'nirc_ehr-narrowsnapshotpanel',
27+
redacted: Ext4.data.Types.BOOLEAN.convert(LABKEY.ActionURL.getParameter('redacted')),
28+
hrefTarget: '_blank',
29+
border: false,
30+
subjectId: s
31+
});
32+
33+
if (!hideHistory){
34+
toAdd.push({
35+
html: '<b>Chronological History:</b><hr>',
36+
style: 'padding-top: 5px;',
37+
border: false
38+
});
39+
40+
toAdd.push({
41+
xtype: LABKEY.ActionURL.getParameter('caseId') ? 'ehr-casehistorypanel' : 'ehr-clinicalhistorypanel',
42+
printMode: true,
43+
hideExportBtn: true,
44+
border: true,
45+
subjectId: s,
46+
autoLoadRecords: true,
47+
minDate: LABKEY.ActionURL.getParameter('minDate'),
48+
maxDate: LABKEY.ActionURL.getParameter('maxDate'),
49+
caseId: LABKEY.ActionURL.getParameter('caseId'),
50+
hideGridButtons: LABKEY.ActionURL.getParameter('hideGridButtons'),
51+
redacted: Ext4.data.Types.BOOLEAN.convert(LABKEY.ActionURL.getParameter('redacted')),
52+
sortMode: LABKEY.ActionURL.getParameter('sortMode'),
53+
checkedItems: LABKEY.ActionURL.getParameter('checkedItems') ? LABKEY.ActionURL.getParameter('checkedItems').split(';') : null,
54+
hrefTarget: '_blank',
55+
style: 'margin-bottom: 20px;'
56+
});
57+
}
58+
else {
59+
toAdd.push({
60+
height: 20,
61+
border: false
62+
});
63+
}
64+
65+
if (idx != (subjects.length - 1)){
66+
toAdd.push({
67+
tag: 'div',
68+
border: false,
69+
cls: 'page-break'
70+
});
71+
}
72+
}, this);
73+
74+
Ext4.create('Ext.panel.Panel', {
75+
border: false,
76+
style: 'width: 8in;',
77+
cls: 'clinical-history-print',
78+
bodyCls: 'clinical-history-print',
79+
items: toAdd
80+
}).render(webpart.wrapperDivId);
81+
});
82+
</script>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<view xmlns="http://labkey.org/data/xml/view" frame="none" template="print" title="Clinical History Export">
2+
<dependencies>
3+
<dependency path="ehr.context" />
4+
</dependencies>
5+
</view>

nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ EHR.model.DataModelManager.registerMetadata('Default', {
1414
allowBlank: true,
1515
defaultValue: LABKEY.Security.currentUser.id,
1616
getInitialValue: function (v, rec) {
17+
if (Number.isInteger(v)){
18+
return v;
19+
}
20+
1721
return LABKEY.Security.currentUser.id;
1822
},
1923
editorConfig: {
@@ -136,6 +140,10 @@ EHR.model.DataModelManager.registerMetadata('Default', {
136140
sort: 'Type,DisplayName'
137141
},
138142
getInitialValue: function (v, rec) {
143+
if (Number.isInteger(v)){
144+
return v;
145+
}
146+
139147
return LABKEY.Security.currentUser.id;
140148
},
141149
editorConfig: {

nirc_ehr/resources/web/nirc_ehr/nircReports.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ EHR.reports.clinicalHistory = function(panel, tab, showActionsBtn, includeAll){
181181
});
182182

183183
toAdd.push({
184-
xtype: 'ehr-clinicalhistorypanel',
184+
xtype: 'nirc_ehr-clinicalhistorypanel',
185185
border: true,
186186
subjectId: s,
187187
autoLoadRecords: true,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
/**
3+
* @cfg caseId
4+
* @cfg maxGridHeight
5+
* @cfg autoLoadRecords
6+
*/
7+
Ext4.define('NIRC_EHR.panel.CaseHistoryPanel', {
8+
extend: 'NIRC_EHR.panel.ClinicalHistoryPanel',
9+
alias: 'widget.nirc_ehr-casehistorypanel',
10+
11+
getStoreConfig: function(){
12+
return {
13+
type: 'ehr-clinicalhistorystore',
14+
containerPath: this.containerPath,
15+
actionName: 'getCaseHistory',
16+
sorters: [{property: 'group'}, {property: 'timeString'}]
17+
};
18+
}
19+
});
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
2+
/**
3+
* @cfg subjectId
4+
* @cfg minDate
5+
* @cfg maxDate
6+
* @cfg maxGridHeight
7+
* @cfg autoLoadRecords
8+
* @cfg hideExportBtn
9+
* @cfg sortMode
10+
* @cfg checkedItems
11+
* @cfg showMaxDate
12+
* @cfg redacted
13+
* @cfg printMode
14+
*/
15+
Ext4.define('NIRC_EHR.panel.ClinicalHistoryPanel', {
16+
extend: 'EHR.panel.ClinicalHistoryPanel',
17+
alias: 'widget.nirc_ehr-clinicalhistorypanel',
18+
19+
showMaxDate: false,
20+
21+
getGridConfig: function(){
22+
return {
23+
xtype: 'grid',
24+
border: this.printMode ? false : true,
25+
minHeight: 100,
26+
minWidth: this.width - 50,
27+
cls: 'ldk-grid',
28+
maxHeight: this.maxGridHeight,
29+
height: this.gridHeight,
30+
hideHeaders: true,
31+
deferEmptyText: true,
32+
viewConfig : {
33+
emptyText: this.minDate ? 'No records found since: ' + Ext4.util.Format.date(this.minDate, LABKEY.extDefaultDateFormat): 'There are no records to display',
34+
deferEmptyText: true,
35+
enableTextSelection: true,
36+
border: false,
37+
stripeRows : true
38+
},
39+
columns: this.getColumnConfig(),
40+
features: [this.getGroupingFeature()],
41+
store: this.getStoreConfig(),
42+
itemId: 'gridPanel',
43+
width: this.width,
44+
subjectId: this.subjectId,
45+
caseId: this.caseId,
46+
minDate: this.minDate,
47+
maxDate: this.maxDate,
48+
tbar: this.hideGridButtons ? null : {
49+
border: true,
50+
items: [{
51+
xtype: 'datefield',
52+
fieldLabel: 'Min Date',
53+
itemId: 'minDate',
54+
labelWidth: 80,
55+
width: 200,
56+
value: this.minDate
57+
},{
58+
xtype: 'datefield',
59+
fieldLabel: 'Max Date',
60+
itemId: 'maxDate',
61+
labelWidth: 80,
62+
width: 200,
63+
hidden: this.showMaxDate,
64+
value: this.maxDate
65+
},{
66+
xtype: 'button',
67+
text: 'Reload',
68+
handler: function(btn){
69+
var panel = btn.up('ehr-clinicalhistorypanel');
70+
panel.doReload();
71+
}
72+
},{
73+
text: 'Show/Hide Types',
74+
scope: this,
75+
handler: function(btn){
76+
this.showFilterPanel();
77+
}
78+
},{
79+
text: 'Collapse All',
80+
hidden: this.printMode,
81+
collapsed: false,
82+
handler: function(btn){
83+
var grid = btn.up('grid');
84+
var feature = grid.getView().getFeature('historyGrouping');
85+
86+
if (btn.collapsed){
87+
feature.expandAll();
88+
btn.setText('Collapse All');
89+
}
90+
else {
91+
feature.collapseAll();
92+
btn.setText('Expand All')
93+
}
94+
95+
btn.collapsed = !btn.collapsed;
96+
}
97+
},{
98+
hidden: this.printMode,
99+
text: (this.sortMode == 'type' ? 'Group By Date' : 'Group By Type'),
100+
sortMode: this.sortMode == 'type' ? 'date' : 'type',
101+
scope: this,
102+
handler: function(btn){
103+
//toggle the button
104+
if (btn.sortMode == 'type'){
105+
btn.setText('Group By Date');
106+
btn.sortMode = 'date';
107+
this.changeMode('type');
108+
}
109+
else {
110+
btn.setText('Group By Type');
111+
btn.sortMode = 'type';
112+
this.changeMode('date');
113+
}
114+
}
115+
},{
116+
text: 'Print Version',
117+
hidden: this.hideExportBtn || this.printMode,
118+
scope: this,
119+
handler: function(btn){
120+
var params = {
121+
hideGridButtons: true
122+
};
123+
if (this.subjectId)
124+
params.subjectId = [this.subjectId];
125+
if (this.caseId)
126+
params.caseId = this.caseId;
127+
if (this.minDate)
128+
params.minDate = Ext4.util.Format.date(this.minDate, LABKEY.extDefaultDateFormat);
129+
if (this.maxDate)
130+
params.maxDate = Ext4.util.Format.date(this.maxDate, LABKEY.extDefaultDateFormat);
131+
if (this.sortMode)
132+
params.sortMode = this.sortMode;
133+
if (this.checkedItems && this.checkedItems.length)
134+
params.checkedItems = this.checkedItems.join(';');
135+
136+
var url = LABKEY.ActionURL.buildURL('nirc_ehr', 'clinicalHistoryExport', null, params);
137+
window.open(url, '_blank');
138+
}
139+
}]
140+
}
141+
};
142+
}
143+
});
144+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Ext4.define('NIRC_EHR.panel.NarrowSnapshotPanel', {
3+
extend: 'NIRC_EHR.panel.SnapshotPanel',
4+
alias: 'widget.nirc_ehr-narrowsnapshotpanel',
5+
6+
showLocationDuration: false,
7+
showExtendedInformation: true,
8+
9+
minWidth: 800,
10+
11+
initComponent: function(){
12+
13+
this.defaultLabelWidth = 120;
14+
this.callParent();
15+
},
16+
17+
getItems: function() {
18+
var items = this.getBaseItems();
19+
20+
//combine the first and second columns
21+
var secondCol = items[0].items[1].items[1];
22+
var extended = this.getExtendedItems();
23+
24+
var index = items[0].items[1].items.indexOf(secondCol);
25+
if (index !== -1) {
26+
items[0].items[1].items = items[0].items[1].items.splice(index, 1);
27+
}
28+
29+
items[0].items[1].items = items[0].items[1].items.concat(extended[0].items[1].items[0]);
30+
items[0].items[1].items[1].items = items[0].items[1].items[1].items.concat(extended[0].items[1].items[1].items[0]);
31+
32+
items[0].items[1].items[0].columnWidth = 0.45;
33+
items[0].items[1].items[1].columnWidth = 0.55;
34+
35+
return items;
36+
}
37+
});

0 commit comments

Comments
 (0)