diff --git a/nirc_ehr/resources/queries/study/drug/.qview.xml b/nirc_ehr/resources/queries/study/drug/.qview.xml index 032e214c..3b722685 100644 --- a/nirc_ehr/resources/queries/study/drug/.qview.xml +++ b/nirc_ehr/resources/queries/study/drug/.qview.xml @@ -8,9 +8,7 @@ - - @@ -22,7 +20,7 @@ - + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/drug/Behavior.qview.xml b/nirc_ehr/resources/queries/study/drug/Behavior.qview.xml new file mode 100644 index 00000000..a9769cb8 --- /dev/null +++ b/nirc_ehr/resources/queries/study/drug/Behavior.qview.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nirc_ehr/resources/reports/additionalReports.tsv b/nirc_ehr/resources/reports/additionalReports.tsv index af1b5ab5..98acfbe0 100644 --- a/nirc_ehr/resources/reports/additionalReports.tsv +++ b/nirc_ehr/resources/reports/additionalReports.tsv @@ -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 diff --git a/nirc_ehr/resources/views/clinicalHistoryExport.html b/nirc_ehr/resources/views/clinicalHistoryExport.html new file mode 100644 index 00000000..8e15e246 --- /dev/null +++ b/nirc_ehr/resources/views/clinicalHistoryExport.html @@ -0,0 +1,82 @@ + \ No newline at end of file diff --git a/nirc_ehr/resources/views/clinicalHistoryExport.view.xml b/nirc_ehr/resources/views/clinicalHistoryExport.view.xml new file mode 100644 index 00000000..35f09e39 --- /dev/null +++ b/nirc_ehr/resources/views/clinicalHistoryExport.view.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js index 15cdd8bd..eee4923b 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js @@ -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: { @@ -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: { diff --git a/nirc_ehr/resources/web/nirc_ehr/nircReports.js b/nirc_ehr/resources/web/nirc_ehr/nircReports.js index ad3f1e12..9a7aab31 100644 --- a/nirc_ehr/resources/web/nirc_ehr/nircReports.js +++ b/nirc_ehr/resources/web/nirc_ehr/nircReports.js @@ -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, diff --git a/nirc_ehr/resources/web/nirc_ehr/panel/CaseHistoryPanel.js b/nirc_ehr/resources/web/nirc_ehr/panel/CaseHistoryPanel.js new file mode 100644 index 00000000..517352c6 --- /dev/null +++ b/nirc_ehr/resources/web/nirc_ehr/panel/CaseHistoryPanel.js @@ -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'}] + }; + } +}); diff --git a/nirc_ehr/resources/web/nirc_ehr/panel/ClinicalHistoryPanel.js b/nirc_ehr/resources/web/nirc_ehr/panel/ClinicalHistoryPanel.js new file mode 100644 index 00000000..50f151d9 --- /dev/null +++ b/nirc_ehr/resources/web/nirc_ehr/panel/ClinicalHistoryPanel.js @@ -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'); + } + }] + } + }; + } +}); + diff --git a/nirc_ehr/resources/web/nirc_ehr/panel/NarrowSnapshotPanel.js b/nirc_ehr/resources/web/nirc_ehr/panel/NarrowSnapshotPanel.js new file mode 100644 index 00000000..15d1f4c3 --- /dev/null +++ b/nirc_ehr/resources/web/nirc_ehr/panel/NarrowSnapshotPanel.js @@ -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; + } +}); \ No newline at end of file diff --git a/nirc_ehr/resources/web/nirc_ehr/window/NIRCCaseHistoryWindow.js b/nirc_ehr/resources/web/nirc_ehr/window/NIRCCaseHistoryWindow.js index 16e82a21..b95e5db7 100644 --- a/nirc_ehr/resources/web/nirc_ehr/window/NIRCCaseHistoryWindow.js +++ b/nirc_ehr/resources/web/nirc_ehr/window/NIRCCaseHistoryWindow.js @@ -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, diff --git a/nirc_ehr/resources/web/nirc_ehr/window/NIRCClinicalHistoryWindow.js b/nirc_ehr/resources/web/nirc_ehr/window/NIRCClinicalHistoryWindow.js index e2974882..76c53870 100644 --- a/nirc_ehr/resources/web/nirc_ehr/window/NIRCClinicalHistoryWindow.js +++ b/nirc_ehr/resources/web/nirc_ehr/window/NIRCClinicalHistoryWindow.js @@ -45,7 +45,7 @@ Ext4.define('NIRC_EHR.window.ClinicalHistoryWindow', { },{ xtype: 'tabpanel', items: [{ - xtype: 'ehr-clinicalhistorypanel', + xtype: 'nirc_ehr-clinicalhistorypanel', title: 'History', border: true, width: 1230, diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java index badf9d5a..f2413357 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java @@ -101,10 +101,14 @@ protected void init() ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/NIRCRecentRemarksWindow.js"), this); ehrService.registerClientDependency(ClientDependency.supplierFromPath("ehr/sharedReports.js"), this); ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/panel/SnapshotPanel.js"), this); + ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/panel/NarrowSnapshotPanel.js"), this); ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/panel/BloodSummaryPanel.js"), this); ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/panel/AnimalDetailsPanel.js"), this); ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/NIRCClinicalHistoryWindow.js"), this); ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/NIRCCaseHistoryWindow.js"), this); + ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/panel/ClinicalHistoryPanel.js"), this); + ehrService.registerClientDependency(ClientDependency.supplierFromPath("nirc_ehr/panel/CaseHistoryPanel.js"), this); + } @Override