From dc9d2ba14bf4b6dc89eb26c895266d0abb7cad0c Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Tue, 12 Mar 2024 10:03:27 -0700 Subject: [PATCH] =?UTF-8?q?Added=20Sustained=20Release=20Medication=20info?= =?UTF-8?q?rmation=20to=20the=20remarks=20editor=20=E2=80=A6=20(#939)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added Sustained Release Medication information to the remarks editor pop-up window * Modified Clinical Rounds edit process. * Modified Clinical Rounds edit process. * Modified Clinical Rounds edit process. * Modified Clinical Rounds edit process. * Modified Clinical Rounds edit process. --- .../onprc_ehr/grid/RoundsRemarksGridPanel.js | 109 ++++++++++++++ .../panel/AnimalDetailsExtendedPanel.js | 142 ++++++++++++++++++ .../plugin/ClinicalRemarksRowEditor.js | 98 ++++++++++++ .../ClinicalRoundsRemarksFormSection.java | 2 +- .../RoundsClinicalRemarksFormSection.java | 88 +++++++++++ 5 files changed, 438 insertions(+), 1 deletion(-) create mode 100644 onprc_ehr/resources/web/onprc_ehr/grid/RoundsRemarksGridPanel.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/panel/AnimalDetailsExtendedPanel.js create mode 100644 onprc_ehr/resources/web/onprc_ehr/plugin/ClinicalRemarksRowEditor.js create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsClinicalRemarksFormSection.java diff --git a/onprc_ehr/resources/web/onprc_ehr/grid/RoundsRemarksGridPanel.js b/onprc_ehr/resources/web/onprc_ehr/grid/RoundsRemarksGridPanel.js new file mode 100644 index 000000000..930460b80 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/grid/RoundsRemarksGridPanel.js @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2014-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +/** + * Created to allow a custom row editor plugin and column that summarize observations + */ +Ext4.define('ONPRC_EHR.grid.RoundsRemarksGridPanel', { + extend: 'EHR.grid.Panel', + alias: 'widget.onprc_ehr-roundsremarksgridpanel', + + + initComponent: function(){ + this.callParent(arguments); + + this.obsStore = this.store.storeCollection.getClientStoreByName('Clinical Observations'); + LDK.Assert.assertNotEmpty('Unable to find clinical observations store', this.obsStore); + + this.mon(this.obsStore, 'update', this.onObsStoreChange, this, {buffer: 400}); + this.mon(this.obsStore, 'remove', this.onObsStoreChange, this, {buffer: 400}); + this.mon(this.obsStore, 'add', this.onObsStoreChange, this, {buffer: 400}); + }, + + onObsStoreChange: function(store, rec){ + console.log('refresh remark grid'); + this.getView().refresh(); + }, + + getRowEditorPlugin: function(){ + if (this.rowEditorPlugin) + return this.rowEditorPlugin; + + this.rowEditorPlugin = Ext4.create('ONPRC_EHR.plugin.ClinicalRemarksRowEditor', { + cmp: this + }); + + return this.rowEditorPlugin; + }, + + configureColumns: function(){ + this.callParent(arguments); + + this.columns.push({ + name: 'observations', + header: 'Observations', + width: 400, + renderer: function(value, cellMetaData, record, rowIndex, colIndex, store){ + if (!this.obsStore){ + this.obsStore = store.storeCollection.getClientStoreByName('Clinical Observations'); + } + LDK.Assert.assertNotEmpty('Unable to find clinical observations store', this.obsStore); + + if (this.obsStore){ + var id = record.get('Id'); + var caseid = record.get('caseid'); + var date = record.get('date') ? Ext4.util.Format.date(record.get('date'),LABKEY.extDefaultDateFormat) : null; + var data = this.obsStore.snapshot || this.obsStore.data; + + var lines = []; + data.each(function(r){ + var rowDate = r.get('date') ? Ext4.util.Format.date(r.get('date'), LABKEY.extDefaultDateFormat) : null; + if (id !== r.get('Id') || rowDate !== date || caseid != r.get('caseid')){ + return; + } + + var line = ''; + var prefix = ''; + var suffix = ''; + + if (r.get('category')){ + line += r.get('category') + ': '; + + if (r.get('category') == 'Vet Attention'){ + prefix = ''; + suffix = ''; + } + else if (r.get('category') == 'Reviewed'){ + prefix = ''; + suffix = ''; + } + } + + if (!Ext4.isEmpty(r.get('observation'))){ + line += r.get('observation'); + } + + if (r.get('remark')){ + line += '. ' + r.get('remark'); + } + + if (!r.get('remark') && Ext4.isEmpty(r.get('observation'))){ + if (['Vet Attention', 'Reviewed'].indexOf(r.get('category')) == -1) + line += '  '; + } + + if (line){ + lines.push(prefix + line + suffix); + } + }, this); + + return lines.join('
'); + } + + return ''; + } + }); + } +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/panel/AnimalDetailsExtendedPanel.js b/onprc_ehr/resources/web/onprc_ehr/panel/AnimalDetailsExtendedPanel.js new file mode 100644 index 000000000..9eb35842b --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/panel/AnimalDetailsExtendedPanel.js @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2014-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + * + * @param subjectId + */ +Ext4.define('ONPRC_EHR.panel.AnimalDetailsExtendedPanel', { + extend: 'ONPRC_EHR.panel.AnimalDetailsCasePanel', + alias: 'widget.onprc_ehr-animaldetailsextendedpanel', + + getItems: function(){ + return [{ + layout: 'column', + defaults: { + border: false, + bodyStyle: 'padding-right: 20px;' + }, + items: [{ + xtype: 'container', + width: 380, + defaults: { + xtype: 'displayfield', + labelWidth: this.defaultLabelWidth + }, + items: [{ + fieldLabel: 'Id', + name: 'animalId' + },{ + fieldLabel: 'Location', + name: 'location' + },{ + fieldLabel: 'Gender', + name: 'gender' + },{ + fieldLabel: 'Species', + name: 'species' + },{ + fieldLabel: 'Age', + name: 'age' + },{ + fieldLabel: 'Projects / Groups', + name: 'assignmentsAndGroups' + + }] + },{ + xtype: 'container', + width: 350, + defaults: { + xtype: 'displayfield' + }, + items: [{ + fieldLabel: 'Status', + name: 'calculated_status' + },{ + fieldLabel: 'Flags', + name: 'flags' + },{ + fieldLabel: 'Weight', + name: 'weights' + },{ + xtype: 'ldk-linkbutton', + style: 'margin-top: 10px;', + scope: this, + text: '[Show Full Hx]', + handler: function(){ + if (this.subjectId){ + EHR.window.ClinicalHistoryWindow.showClinicalHistory(null, this.subjectId, null); + } + else { + console.log('no id'); + } + } + },{ + xtype: 'ldk-linkbutton', + style: 'margin-top: 5px;', + scope: this, + text: '[Show Recent SOAPs]', + handler: function(){ + if (this.subjectId){ + EHR.window.RecentRemarksWindow.showRecentRemarks(this.subjectId); + } + else { + console.log('no id'); + } + } + },{ + xtype: 'ldk-linkbutton', + style: 'margin-top: 5px;', + scope: this, + text: '[Manage Treatments]', + hidden: EHR.Security.hasClinicalEntryPermission() && !EHR.Security.hasPermission(EHR.QCStates.COMPLETED, 'update', [{schemaName: 'study', queryName: 'Treatment Orders'}]), + handler: function(){ + if (this.subjectId){ + Ext4.create('EHR.window.ManageTreatmentsWindow', {animalId: this.subjectId}).show(); + } + else { + console.log('no id'); + } + } + },{ + xtype: 'ldk-linkbutton', + style: 'margin-top: 5px;margin-bottom:10px;', + scope: this, + text: '[Manage Cases]', + hidden: EHR.Security.hasClinicalEntryPermission() && !EHR.Security.hasPermission(EHR.QCStates.COMPLETED, 'update', [{schemaName: 'study', queryName: 'Cases'}]), + handler: function(){ + if (this.subjectId){ + Ext4.create('EHR.window.ManageCasesWindow', {animalId: this.subjectId}).show(); + } + else { + console.log('no id'); + } + } + }] + }] + },{ + name: 'treatments', + xtype: 'ehr-snapshotchildpanel', + headerLabel: 'Current Medications / Prescribed Diets', + emptyText: 'There are no active medications' + },{ + name: 'caseSummary', + xtype: 'ehr-snapshotchildpanel', + headerLabel: 'Case Summary', + emptyText: 'There are no active cases' + },{ + name: 'sdrug', + xtype: 'ehr-snapshotchildpanel', + headerLabel: 'Sustained Release Medication', + emptyText: 'There are no active medications' + },{ + xtype: 'button', + border: true, + text: 'Reload', + scope: this, + handler: function(btn){ + this.loadAnimal(this.subjectId, true); + } + }]; + } +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/plugin/ClinicalRemarksRowEditor.js b/onprc_ehr/resources/web/onprc_ehr/plugin/ClinicalRemarksRowEditor.js new file mode 100644 index 000000000..758c8d1ad --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/plugin/ClinicalRemarksRowEditor.js @@ -0,0 +1,98 @@ +/* + * 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.plugin.ClinicalRemarksRowEditor', { + extend: 'EHR.plugin.RowEditor', + + getObservationPanelCfg: function(){ + var store = this.cmp.dataEntryPanel.storeCollection.getClientStoreByName('Clinical Observations'); + LDK.Assert.assertNotEmpty('Observations store not found', store); + + return { + xtype: 'ehr-observationsroweditorgridpanel', + itemId: 'observationsPanel', + remarkStore: this.cmp.store, + width: 500, + store: store + }; + }, + + getDetailsPanelCfg: function(){ + return { + xtype: 'onprc_ehr-animaldetailsextendedpanel', + itemId: 'detailsPanel' + } + }, + + onWindowClose: function(){ + this.callParent(arguments); + this.getEditorWindow().down('#observationsPanel').store.clearFilter(); + + }, + + getFormPanelCfg: function(){ + var ret = this.callParent(arguments); + ret.maxFieldWidth = 500; + + return ret; + }, + + getWindowCfg: function(){ + var ret = this.callParent(arguments); + + var formCfg = ret.items[0].items[1]; + //NOTE: added to avoid splitting form into 2 columns + formCfg.maxItemsPerCol = 100; + ret.items[0].items[1] = { + xtype: 'panel', + layout: 'column', + defaults: { + border: false + }, + border: false, + items: [formCfg, this.getObservationPanelCfg()] + }; + + ret.width = 1050; + return ret; + }, + + getWindowButtons: function(){ + var buttons = this.callParent(arguments); + + buttons.unshift({ + text: 'Mark Reviewed', + handler: function(btn){ + var win = btn.up('window'); + var form = win.down('#formPanel'); + var record = form.getBoundRecord(); + if (!record){ + return; + } + + var obsStore = record.store.storeCollection.getClientStoreByName('Clinical Observations'); + LDK.Assert.assertNotEmpty('Unable to find clinical_observations store in ClinicalRemarksRowEditor', obsStore); + LDK.Assert.assertNotEmpty('No caseid in bound record in ClinicalRemarksRowEditor', form.getRecord().get('caseid')); + + obsStore.add(obsStore.createModel({ + Id: form.getRecord().get('Id'), + date: new Date(), + caseid: form.getRecord().get('caseid'), + category: 'Reviewed', + area: 'N/A', + observation: LABKEY.Security.currentUser.displayName + })); + }, + scope: this + }); + + return buttons; + }, + + loadRecord: function(record){ + this.callParent(arguments); + this.getEditorWindow().down('#observationsPanel').loadRecord(record); + } +}); \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalRoundsRemarksFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalRoundsRemarksFormSection.java index 66ddaa5fa..072575fdd 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalRoundsRemarksFormSection.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalRoundsRemarksFormSection.java @@ -26,7 +26,7 @@ * Date: 7/7/13 * Time: 10:36 AM */ -public class ClinicalRoundsRemarksFormSection extends RoundsRemarksFormSection +public class ClinicalRoundsRemarksFormSection extends RoundsClinicalRemarksFormSection { public ClinicalRoundsRemarksFormSection() { diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsClinicalRemarksFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsClinicalRemarksFormSection.java new file mode 100644 index 000000000..d904a382d --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsClinicalRemarksFormSection.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2013-2014 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.labkey.onprc_ehr.dataentry; + +import org.json.JSONObject; +import org.labkey.api.ehr.EHRService; +import org.labkey.api.ehr.dataentry.DataEntryFormContext; +import org.labkey.api.ehr.dataentry.SimpleFormSection; +import org.labkey.api.view.template.ClientDependency; + +import java.util.List; + +//Modified : 3-5-2024 R. Blasa +public class RoundsClinicalRemarksFormSection extends SimpleFormSection +{ + public RoundsClinicalRemarksFormSection(String label, EHRService.FORM_SECTION_LOCATION location) + { +// super("study", "Clinical Remarks", label, "onprc_ehr-roundsremarksgridpanel", location); + super("study", "Clinical Remarks", label, "onprc_ehr-roundsremarksgridpanel", location); + addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalObservationsCellEditing.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/panel/ClinicalRemarkPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/grid/RoundsRemarksGridPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/grid/ObservationsRowEditorGridPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/plugin/ClinicalRemarksRowEditor.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/data/ClinicalObservationsClientStore.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/buttons/roundsButtons.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/AnimalDetailsExtendedPanel.js")); + + + setTemplateMode(TEMPLATE_MODE.NONE); + } + + @Override + public List getTbarButtons() + { + List defaultButtons = super.getTbarButtons(); + defaultButtons.remove("COPYFROMSECTION"); + defaultButtons.remove("ADDRECORD"); + defaultButtons.remove("ADDANIMALS"); + + if (defaultButtons.contains("DELETERECORD")) + { + int idx = defaultButtons.indexOf("DELETERECORD"); + defaultButtons.remove("DELETERECORD"); + defaultButtons.add(idx, "ROUNDSDELETE"); + } + + defaultButtons.add("MARK_ROUNDS_REVIEWED"); + + return defaultButtons; + } + + @Override + public List getTbarMoreActionButtons() + { + List defaultButtons = super.getTbarMoreActionButtons(); + defaultButtons.remove("DUPLICATE"); + + return defaultButtons; + } + + @Override + public JSONObject toJSON(DataEntryFormContext ctx, boolean includeFormElements) + { + JSONObject ret = super.toJSON(ctx, includeFormElements); + + return ret; + } + + @Override + protected String getServerSort() + { + return "Id/curLocation/room,Id/curLocation/cage,Id"; + } +}