From 400cb9cda53e0856a8986fb41f6f472073a9ae3a Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:11:22 -0800 Subject: [PATCH 1/3] MOdifed xSurgical Rounds input form to include two new input fields. --- .../study/clinical_observations.query.xml | 58 ++++++ .../study/datasets/datasets_metadata.xml | 12 ++ .../grid/ObservationsRowEditorGridPanel.js | 185 ++++++++++++++++++ .../SurgicalAmendedRemarksFormSection.java | 57 ++++++ 4 files changed, 312 insertions(+) create mode 100644 onprc_ehr/resources/queries/study/clinical_observations.query.xml create mode 100644 onprc_ehr/resources/web/onprc_ehr/grid/ObservationsRowEditorGridPanel.js create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java diff --git a/onprc_ehr/resources/queries/study/clinical_observations.query.xml b/onprc_ehr/resources/queries/study/clinical_observations.query.xml new file mode 100644 index 000000000..406f75e9e --- /dev/null +++ b/onprc_ehr/resources/queries/study/clinical_observations.query.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + Category + + + Area + + ehr_lookups + observation_areas + value + + + + + Observation/Score + + + + study + encountersParent + objectid + + + + true + + + true + + + true + + + Code + true + + + Type + + + Observation Remarks + + +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml b/onprc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml index df144a565..ab2ca4648 100644 --- a/onprc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml +++ b/onprc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml @@ -840,6 +840,12 @@ integer + + varchar + + + varchar + Clinical Observations @@ -911,6 +917,12 @@ varchar + + varchar + + + varchar + Clinical Remarks diff --git a/onprc_ehr/resources/web/onprc_ehr/grid/ObservationsRowEditorGridPanel.js b/onprc_ehr/resources/web/onprc_ehr/grid/ObservationsRowEditorGridPanel.js new file mode 100644 index 000000000..7e275894a --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/grid/ObservationsRowEditorGridPanel.js @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2014-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +/** + * This is used within the RowEditor in the clinical rounds form + * + * @cfg observationFilterArray + * + */ +Ext4.define('ONPRC_EHR.grid.ObservationsRowEditorGridPanel', { + extend: 'Ext.grid.Panel', + alias: 'widget.onprc_ehr-observationsroweditorgridpanel', + + initComponent: function(){ + Ext4.apply(this, { + columns: this.getColumns(), + boundRecord: null, + boundRecordId: null, + selModel: { + mode: 'MULTI' + }, + plugins: [{ + ptype: 'clinicalobservationscellediting', + pluginId: 'cellediting', + clicksToEdit: 1 + }], + dockedItems: [{ + xtype: 'toolbar', + position: 'top', + items: [{ + text: 'Add', + scope: this, + handler: function(btn){ + var rec = this.createModel(); + if (!rec) + return; + + this.store.add(rec); + this.getPlugin('cellediting').startEdit(rec, 0); + } + },{ + text: 'Remove', + scope: this, + handler: function(btn){ + var recs = this.getSelectionModel().getSelection(); + this.store.remove(recs); + } + }] + }] + }); + + this.callParent(); + + this.mon(this.remarkStore, 'update', this.onRecordUpdate, this); + }, + + createModel: function(data){ + var form = this.up('window').down('ehr-formpanel'); + var br = form.getRecord(); + LDK.Assert.assertNotEmpty('No bound record in ObservationsRowEditorGridPanel', br); + if (!br){ + Ext4.Msg.alert('Error', 'Unable to find record'); + return; + } + + LDK.Assert.assertNotEmpty('No animal Id in ObservationsRowEditorGridPanel', br.get('Id')); + if (!br.get('Id')){ + Ext4.Msg.alert('Error', 'No animal Id provided'); + return; + } + + return this.store.createModel(Ext4.apply({ + Id: br.get('Id'), + date: new Date(), + caseid: br.get('caseid') + }, data)); + }, + + getColumns: function(){ + return [{ + header: 'Category', + dataIndex: 'category', + editable: true, + renderer: function(value, cellMetaData, record){ + if (Ext4.isEmpty(value)){ + cellMetaData.tdCls = 'labkey-grid-cell-invalid'; + } + + return value; + }, + editor: { + xtype: 'labkey-combo', + editable: true, + displayField: 'value', + valueField: 'value', + forceSelection: true, + queryMode: 'local', + anyMaych: true, + store: { + type: 'labkey-store', + schemaName: 'ehr', + queryName: 'observation_types', + filterArray: this.observationFilterArray, + columns: 'value,editorconfig', + autoLoad: true + } + } + },{ + header: 'Area', + width: 200, + editable: true, + dataIndex: 'area', + editor: { + xtype: 'labkey-combo', + displayField: 'value', + valueField: 'value', + forceSelection: true, + queryMode: 'local', + anyMaych: true, + value: 'N/A', + store: { + type: 'labkey-store', + schemaName: 'ehr_lookups', + queryName: 'observation_areas', + autoLoad: true + } + } + },{ + header: 'Obs Remarks', + width: 130, + dataIndex: 'obs_remark', + editor: { + xtype: 'textarea', + width:280, + height:50 + } + },{ + header: 'Observation/Score', + width: 200, + editable: true, + dataIndex: 'observation', + renderer: function(value, cellMetaData, record){ + if (Ext4.isEmpty(value) && ['Vet Attention'].indexOf(record.get('category')) == -1){ + cellMetaData.tdCls = 'labkey-grid-cell-invalid'; + } + + return value; + }, + editor: { + xtype: 'textfield' + } + }] + }, + + onRecordUpdate: function(store, rec){ + if (rec === this.boundRecord){ + var newId = rec.get('Id'); + var newDate = rec.get('date'); + + if (rec.get('Id') != this.boundRecordId){ + this.store.each(function(r){ + //update any record from the bound animal + if (r.get('Id') === this.boundRecordId){ + r.set({ + Id: newId, + date: newDate + }); + } + }, this); + } + } + }, + + loadRecord: function(rec){ + var id = rec.get('Id'); + + this.boundRecord = rec; + this.boundRecordId = rec.get('Id'); + + this.store.clearFilter(); + this.store.filter('Id', id); + } +}); \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java new file mode 100644 index 000000000..29d797299 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java @@ -0,0 +1,57 @@ +/* + * 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.labkey.api.ehr.EHRService; +import org.labkey.api.view.template.ClientDependency; + +import java.util.Collections; +import java.util.List; + +/** + * User: bimber + * Date: 7/7/13 + * Time: 10:36 AM + */ +public class SurgicalAmendedRemarksFormSection extends RoundsRemarksFormSection +{ + public SurgicalAmendedRemarksFormSection() + { + this(EHRService.FORM_SECTION_LOCATION.Body); + } + + public SurgicalAmendedRemarksFormSection(EHRService.FORM_SECTION_LOCATION location) + { + super("Remarks", location); + setConfigSources(Collections.singletonList("Task")); + + addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddClinicalCasesWindow.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddSurgicalCasesWindow.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/BulkChangeCasesWindow.js")); + + _showLocation = true; + } + + @Override + public List getTbarButtons() + { + List defaultButtons = super.getTbarButtons(); + defaultButtons.add(0, "ADDSURGICALCASES"); + defaultButtons.add("BULK_CHANGE_CASES"); + + return defaultButtons; + } +} From 9ce7439fb8b58bf0316ed5186c2fcbf89b497d9c Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:14:40 -0800 Subject: [PATCH 2/3] Modified Surgical Rounds input form to include two new input fields. --- .../SurgicalAmendedRemarksFormSection.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java index 29d797299..0cb4b4f69 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java @@ -16,6 +16,7 @@ package org.labkey.onprc_ehr.dataentry; import org.labkey.api.ehr.EHRService; +import org.labkey.api.ehr.dataentry.SimpleFormSection; import org.labkey.api.view.template.ClientDependency; import java.util.Collections; @@ -26,23 +27,24 @@ * Date: 7/7/13 * Time: 10:36 AM */ -public class SurgicalAmendedRemarksFormSection extends RoundsRemarksFormSection +public class SurgicalAmendedRemarksFormSection extends SimpleFormSection { - public SurgicalAmendedRemarksFormSection() + public SurgicalAmendedRemarksFormSection(String label, EHRService.FORM_SECTION_LOCATION location) { - this(EHRService.FORM_SECTION_LOCATION.Body); - } + super("study", "Clinical Remarks", label, "onprc_ehr-surgroundsremarksgridpanel", location); + addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalObservationsCellEditing.js")); //No changes here. Not important + addClientDependency(ClientDependency.supplierFromPath("ehr/panel/ClinicalRemarkPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/grid/SurgicalRoundsRemarksGridPanel.js")); //points to ONPRC_EHR.plugin.SurgicalRemarksRowEditor + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/grid/ObservationsRowEditorGridPanel.js")); //Modified //Modified from ehr to onprc_ehr added new clinical observation columns +// MOdified: 8-1-2024 so that contents reset as ehr control types + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/plugin/SurgicalRemarksRowEditor.js")); //edited //edited points to onprc_ehr.ObservationRowEditorGridPanel.js - public SurgicalAmendedRemarksFormSection(EHRService.FORM_SECTION_LOCATION location) - { - super("Remarks", location); - setConfigSources(Collections.singletonList("Task")); - addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddClinicalCasesWindow.js")); - addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddSurgicalCasesWindow.js")); - addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/BulkChangeCasesWindow.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/data/ClinicalObservationsClientStore.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/buttons/roundsButtons.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/SurgeryEntryField.js")); - _showLocation = true; + setTemplateMode(TEMPLATE_MODE.NONE); } @Override From 43c754060d9bc285a4105b0974e9f1efb9f6ca09 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:29:04 -0800 Subject: [PATCH 3/3] Modified Surgical Rounds input form to include two new input fields. --- .../onprc_ehr/model/sources/SurgicalRounds.js | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js new file mode 100644 index 000000000..d15c66c66 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +EHR.model.DataModelManager.registerMetadata('SurgicalRoundsExt', { + allQueries: { + Id: { + editable: false, + columnConfig: { + editable: false + } + } + }, + byQuery: { + 'study.clinremarks': { + category: { + defaultValue: 'Surgery', + hidden: true + }, + hx: { + hidden: true + }, + s: { + hidden: true + }, + o: { + hidden: true + }, + a: { + hidden: true + }, + p: { + hidden: true + }, + p2: { + hidden: true + } + }, + + 'study.clinical_observations': { + type: { + defaultValue: 'surgery', + hidden: true + } + }, + 'study.blood': { + reason: { + defaultValue: 'Clinical' + } + } + } +}); \ No newline at end of file