From 78a37e23b86e4d665f0ae32398a9a76d1a7c4a7d Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 5 Mar 2026 13:37:35 -0800 Subject: [PATCH 01/10] Modified Surgical Rounds form to now include a "P2" input field. --- .../onprc_ehr/model/sources/SurgicalRounds.js | 46 +++++++++++++++++++ .../dataentry/SurgicalRoundsFormType.java | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) 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..5286feef8 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js @@ -0,0 +1,46 @@ +/* + * 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('SurgicalRounds', { + 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: false + } + }, + 'study.blood': { + reason: { + defaultValue: 'Clinical' + } + } + } +}); \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsFormType.java index 9dd6206d3..6a6f3f0f4 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsFormType.java @@ -58,7 +58,7 @@ public SurgicalRoundsFormType(DataEntryFormContext ctx, Module owner) } } - addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/SurgicalRounds.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/SurgicalRounds.js")); setDisplayReviewRequired(true); } From 54b6beead9b5a9687be484e985ba30a0e7997205 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 12 Mar 2026 00:54:40 -0700 Subject: [PATCH 02/10] Modified Surgical Rounds so that P2 input loads data as soon as the form opens. --- .../resources/web/onprc_ehr/model/sources/SurgicalRounds.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js index 5286feef8..6da8ad0c7 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js @@ -34,6 +34,10 @@ EHR.model.DataModelManager.registerMetadata('SurgicalRounds', { hidden: true }, p2: { + formEditorConfig: { + xtype: 'textarea' + }, + height: 100, hidden: false } }, From b8e3c9f4db20f4ab65a542e70677e82537f04657 Mon Sep 17 00:00:00 2001 From: ohsudev Date: Thu, 12 Mar 2026 10:16:41 -0700 Subject: [PATCH 03/10] Modified Surgical Rounds so that P2 input loads data as soon as the form opens. --- .../resources/web/onprc_ehr/model/sources/SurgicalRounds.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js index 6da8ad0c7..5286feef8 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js @@ -34,10 +34,6 @@ EHR.model.DataModelManager.registerMetadata('SurgicalRounds', { hidden: true }, p2: { - formEditorConfig: { - xtype: 'textarea' - }, - height: 100, hidden: false } }, From f350409a9c6adcd6ee60c361e15327edff49fe84 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:01:29 -0700 Subject: [PATCH 04/10] Modified Surgical Rounds to accommodate a new "P2" remarks exclusively for the Surgery module. --- .../form/field/Surgery_PlantextArea.js | 199 ++++++++++++++++++ .../onprc_ehr/model/sources/SurgicalRounds.js | 2 + .../org/labkey/onprc_ehr/ONPRC_EHRModule.java | 4 + 3 files changed, 205 insertions(+) create mode 100644 onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js b/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js new file mode 100644 index 000000000..03e3ebe4f --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2014-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { + extend: 'Ext.form.field.TextArea', + alias: 'widget.onprc_ehr-Surg_plantextarea', + + onAnimalChange: function(){ + this.updateDisplayEl(); + }, + + onRender : function(ct, position){ + this.callParent(arguments); + + this.wrap = this.inputEl.wrap({ + tag: 'div', + cls: 'x4-form-field-wrap' + }); + + this.linkDiv = this.wrap.createChild({ + tag: 'div', + style: 'vertical-align:top;' + }, this.inputEl); + + this.linkEl = this.linkDiv.createChild({ + tag: 'a', + cls: 'labkey-text-link', + html: (this.getValue() ? 'Copy Latest P2' : 'Edit P2') + }); + + var panel = this.up('ehr-formpanel'); + if (panel){ + this.mon(panel, 'bindrecord', this.onAnimalChange, this, {buffer: 100}); + } + else { + LDK.Utils.logToServer({ + message: 'Unable to find ehr-formpanel in Surg_PlantextArea' + }) + } + + var dataEntryPanel = this.up('ehr-dataentrypanel'); + if (dataEntryPanel){ + this.mon(dataEntryPanel, 'animalchange', this.onAnimalChange, this, {buffer: 100}); + } + else { + LDK.Utils.logToServer({ + message: 'Unable to find ehr-dataentrypanel in Surg_PlanTextArea' + }) + } + + this.linkEl.on('click', this.copyMostRecentP2, this); + this.setupMask(); + }, + + setupMask: function(){ + if (this.getValue()){ + this.showTextArea(); + return; + } + + this.inputEl.setVisibilityMode(Ext4.dom.AbstractElement.DISPLAY); + this.inputEl.setVisible(false); + + this.displayEl = this.wrap.createChild({ + tag: 'div', + style: 'vertical-align:top;', + html: '' + }); + + this.displayEl.setWidth(this.width - this.labelWidth); + this.displayEl.setHeight(this.getHeight()); + + this.updateDisplayEl(); + }, + + showTextArea: function(){ + if (!this.rendered){ + return; + } + + if (this.displayEl){ + this.displayEl.remove(); + delete this.displayEl; + } + + if (this.linkEl){ + this.linkEl.update('Copy Latest P2'); + } + + if (this.inputEl) + this.inputEl.setVisible(true); + }, + + updateDisplayEl: function(){ + if (!this.displayEl){ + return; + } + + var rec = EHR.DataEntryUtils.getBoundRecord(this); + if (rec && rec.get('Id')){ + this.getMostRecentP2(rec, function(ret, Id){ + if (!ret || !this.displayEl){ + this.displayEl.update('Either no active case or no P2 for ' + (Id || rec.get('Id'))); + return; + } + + if (ret.mostRecentP2 && ret.isActive){ + this.displayEl.update(ret.mostRecentP2); + } + else { + this.displayEl.update('Either no active case or no P2 for ' + (Id || rec.get('Id'))); + } + }); + } + else { + this.displayEl.update('No animal entered'); + } + }, + + copyMostRecentP2: function(){ + var rec = EHR.DataEntryUtils.getBoundRecord(this); + if (!rec || !rec.get('Id')){ + Ext4.Msg.alert('Error', 'No Id Entered'); + return; + } + + Ext4.Msg.wait('Loading...'); + this.showTextArea(); + + this.getMostRecentP2(rec, function(ret){ + Ext4.Msg.hide(); + + if (ret && ret.mostRecentP2){ + this.setValue(ret.mostRecentP2); + this.linkEl.update('Refresh P2'); + } + }, true); + }, + + getMostRecentP2: function(rec, cb, alwaysUseCallback){ + var date = rec.get('date') || new Date(); + var id = rec.get('Id'); + this.pendingIdRequest = id; + + LABKEY.Query.executeSql({ + schemaName: 'study', + sql: 'SELECT c.Id, c.p2 as mostRecentP2, c.caseid, as caseCategory, c.caseid.isActive as isActive FROM study.clinRemarks c WHERE (c.category != \'Replaced SOAP\' OR c.category IS NULL) AND c.caseid.category= \'Surgery\' AND c.p2 IS NOT NULL AND c.Id = \'' + rec.get('Id') + '\' ORDER BY c.date DESC LIMIT 1', + failure: LDK.Utils.getErrorCallback(), + scope: this, + success: function(results){ + if (!alwaysUseCallback && id != this.pendingIdRequest){ + console.log('more recent request, aborting'); + return; + } + + if (results && results.rows && results.rows.length){ + cb.call(this, results.rows[0], results.rows[0].Id); + } + else { + cb.call(this, null, id); + } + } + }); + }, + + onDestroy : function(){ + if (this.linkEl){ + this.linkEl.removeAllListeners(); + this.linkEl.remove(); + } + + if (this.linkDiv){ + this.linkDiv.removeAllListeners(); + this.linkDiv.remove(); + } + + if (this.displayEl){ + //NOTE: no listeners were added + //this.displayEl.removeAllListeners(); + this.displayEl.remove(); + } + + if (this.wrap){ + this.wrap.remove(); + } + + this.callParent(this); + }, + + setValue: function(){ + this.callParent(arguments); + + if (this.getValue()){ + this.showTextArea(); + } + } +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js index 5286feef8..7a74b4df4 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js @@ -34,6 +34,8 @@ EHR.model.DataModelManager.registerMetadata('SurgicalRounds', { hidden: true }, p2: { + xtype: 'onprc_ehr-Surg_plantextarea', + header: 'S2', hidden: false } }, diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java index d18c157d4..81adfe858 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java @@ -333,6 +333,10 @@ private void registerEHRResources() //Added: 10-12-2023 R.Blasa EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/EnvironmentalField.js"), this); + //Added: 3-24-2026 R.Blasa References new Xtype + EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/Surgery_PlantextArea.js"), this); + + EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.housing, "List Single Housed Animals", this, DetailsURL.fromString("/query/executeQuery.view?schemaName=study&query.queryName=demographicsPaired&query.viewName=Single Housed"), "Commonly Used Queries"); EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.housing, "Find Animals Housed In A Given Room/Cage At A Specific Time", this, DetailsURL.fromString("/ehr/housingOverlaps.view?groupById=1"), "Commonly Used Queries"); From 77cd4877a3e18e647ac5f951480da7231556bc8f Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:15:11 -0700 Subject: [PATCH 05/10] Modified Surgical Rounds to accommodate a new "P2" remarks exclusively for the Surgery module. --- .../web/onprc_ehr/form/field/PlanTextArea.js | 199 ++++++++++++++++++ .../org/labkey/onprc_ehr/ONPRC_EHRModule.java | 3 +- 2 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 onprc_ehr/resources/web/onprc_ehr/form/field/PlanTextArea.js diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/PlanTextArea.js b/onprc_ehr/resources/web/onprc_ehr/form/field/PlanTextArea.js new file mode 100644 index 000000000..3781bb74a --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/PlanTextArea.js @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2014-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +Ext4.define('ONPRC_EHR.form.field.PlanTextArea', { + extend: 'Ext.form.field.TextArea', + alias: 'widget.onprc_ehr-plantextarea', + + onAnimalChange: function(){ + this.updateDisplayEl(); + }, + + onRender : function(ct, position){ + this.callParent(arguments); + + this.wrap = this.inputEl.wrap({ + tag: 'div', + cls: 'x4-form-field-wrap' + }); + + this.linkDiv = this.wrap.createChild({ + tag: 'div', + style: 'vertical-align:top;' + }, this.inputEl); + + this.linkEl = this.linkDiv.createChild({ + tag: 'a', + cls: 'labkey-text-link', + html: (this.getValue() ? 'Copy Latest P2' : 'Edit P2') + }); + + var panel = this.up('ehr-formpanel'); + if (panel){ + this.mon(panel, 'bindrecord', this.onAnimalChange, this, {buffer: 100}); + } + else { + LDK.Utils.logToServer({ + message: 'Unable to find ehr-formpanel in PlanTextArea' + }) + } + + var dataEntryPanel = this.up('ehr-dataentrypanel'); + if (dataEntryPanel){ + this.mon(dataEntryPanel, 'animalchange', this.onAnimalChange, this, {buffer: 100}); + } + else { + LDK.Utils.logToServer({ + message: 'Unable to find ehr-dataentrypanel in PlanTextArea' + }) + } + + this.linkEl.on('click', this.copyMostRecentP2, this); + this.setupMask(); + }, + + setupMask: function(){ + if (this.getValue()){ + this.showTextArea(); + return; + } + + this.inputEl.setVisibilityMode(Ext4.dom.AbstractElement.DISPLAY); + this.inputEl.setVisible(false); + + this.displayEl = this.wrap.createChild({ + tag: 'div', + style: 'vertical-align:top;', + html: '' + }); + + this.displayEl.setWidth(this.width - this.labelWidth); + this.displayEl.setHeight(this.getHeight()); + + this.updateDisplayEl(); + }, + + showTextArea: function(){ + if (!this.rendered){ + return; + } + + if (this.displayEl){ + this.displayEl.remove(); + delete this.displayEl; + } + + if (this.linkEl){ + this.linkEl.update('Copy Latest P2'); + } + + if (this.inputEl) + this.inputEl.setVisible(true); + }, + + updateDisplayEl: function(){ + if (!this.displayEl){ + return; + } + + var rec = EHR.DataEntryUtils.getBoundRecord(this); + if (rec && rec.get('Id')){ + this.getMostRecentP2(rec, function(ret, Id){ + if (!ret || !this.displayEl){ + this.displayEl.update('Either no active case or no P2 for ' + (Id || rec.get('Id'))); + return; + } + + if (ret.mostRecentP2 && ret.isActive){ + this.displayEl.update(ret.mostRecentP2); + } + else { + this.displayEl.update('Either no active case or no P2 for ' + (Id || rec.get('Id'))); + } + }); + } + else { + this.displayEl.update('No animal entered'); + } + }, + + copyMostRecentP2: function(){ + var rec = EHR.DataEntryUtils.getBoundRecord(this); + if (!rec || !rec.get('Id')){ + Ext4.Msg.alert('Error', 'No Id Entered'); + return; + } + + Ext4.Msg.wait('Loading...'); + this.showTextArea(); + + this.getMostRecentP2(rec, function(ret){ + Ext4.Msg.hide(); + + if (ret && ret.mostRecentP2){ + this.setValue(ret.mostRecentP2); + this.linkEl.update('Refresh P2'); + } + }, true); + }, + + getMostRecentP2: function(rec, cb, alwaysUseCallback){ + var date = rec.get('date') || new Date(); + var id = rec.get('Id'); + this.pendingIdRequest = id; + + LABKEY.Query.executeSql({ + schemaName: 'study', + sql: 'SELECT c.Id, c.p2 as mostRecentP2, c.caseid, c.caseid.category as caseCategory, c.caseid.isActive as isActive FROM study.clinRemarks c WHERE (c.category != \'Replaced SOAP\' OR c.category IS NULL) AND c.caseid.category= \'Clinical\' AND c.p2 IS NOT NULL AND c.Id = \'' + rec.get('Id') + '\' ORDER BY c.date DESC LIMIT 1', + failure: LDK.Utils.getErrorCallback(), + scope: this, + success: function(results){ + if (!alwaysUseCallback && id != this.pendingIdRequest){ + console.log('more recent request, aborting'); + return; + } + + if (results && results.rows && results.rows.length){ + cb.call(this, results.rows[0], results.rows[0].Id); + } + else { + cb.call(this, null, id); + } + } + }); + }, + + onDestroy : function(){ + if (this.linkEl){ + this.linkEl.removeAllListeners(); + this.linkEl.remove(); + } + + if (this.linkDiv){ + this.linkDiv.removeAllListeners(); + this.linkDiv.remove(); + } + + if (this.displayEl){ + //NOTE: no listeners were added + //this.displayEl.removeAllListeners(); + this.displayEl.remove(); + } + + if (this.wrap){ + this.wrap.remove(); + } + + this.callParent(this); + }, + + setValue: function(){ + this.callParent(arguments); + + if (this.getValue()){ + this.showTextArea(); + } + } +}); \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java index 81adfe858..f4ff09917 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java @@ -336,7 +336,8 @@ private void registerEHRResources() //Added: 3-24-2026 R.Blasa References new Xtype EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/Surgery_PlantextArea.js"), this); - + //Added: 3-24-2026 R.Blasa References new Xtype from ehr + EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/PlanTextArea.js"), this); EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.housing, "List Single Housed Animals", this, DetailsURL.fromString("/query/executeQuery.view?schemaName=study&query.queryName=demographicsPaired&query.viewName=Single Housed"), "Commonly Used Queries"); EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.housing, "Find Animals Housed In A Given Room/Cage At A Specific Time", this, DetailsURL.fromString("/ehr/housingOverlaps.view?groupById=1"), "Commonly Used Queries"); From ce259064bcf621fe6f95cdd48cb3d33a94655778 Mon Sep 17 00:00:00 2001 From: Ohsudev <76500320+Ohsudev@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:35:43 -0700 Subject: [PATCH 06/10] Modified Surgical Rounds to accommodate a new "P2" remarks exclusively for the Surgery module. --- .../onprc_ehr/panel/ClinicalRemarkPanel.js | 100 ++++++++++++++++++ .../dataentry/RoundsRemarksFormSection.java | 2 +- 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 onprc_ehr/resources/web/onprc_ehr/panel/ClinicalRemarkPanel.js diff --git a/onprc_ehr/resources/web/onprc_ehr/panel/ClinicalRemarkPanel.js b/onprc_ehr/resources/web/onprc_ehr/panel/ClinicalRemarkPanel.js new file mode 100644 index 000000000..6ec997600 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/panel/ClinicalRemarkPanel.js @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +/** + * @cfg remarkFormat + */ +Ext4.define('ONPRC_EHR.panel.ClinicalRemarkPanel', { + extend: 'Ext.form.Panel', + alias: 'widget.onprc_ehr-clinicalremarkpanel', + + initComponent: function(){ + Ext4.apply(this, { + bodyStyle: 'padding: 5px;', + defaults: { + labelWidth: 140, + width: 550 + }, + items: [{ + xtype: 'xdatetime', + itemId: 'dateField', + fieldLabel: 'Date', + allowBlank: false, + name: 'date', + value: new Date() + },{ + xtype: 'combo', + fieldLabel: 'Remark Format', + isFormField: false, + itemId: 'remarkFormat', + displayField: 'label', + valueField: 'label', + store: { + type: 'store', + fields: ['label', 'fields', 'fieldLabels'], + data: [ + {label: 'SOAP', fields: ['s', 'o', 'a', 'p'], fieldLabels: ['S', 'O', 'A', 'P']}, + {label: 'S2', fields: ['p2'], fieldLabels: ['S2']}, + {label: 'Hx', fields: ['hx'], fieldLabels: ['Hx']}, + {label: 'Simple Remark', fields: ['remark'], fieldLabels: ['Remark']} + ] + }, + value: this.remarkFormat, + editable: false, + listeners: { + scope: this, + change: function(field){ + var panel = this.down('#remarkPanel'); + panel.removeAll(); + panel.add(this.getItems(field.store.findRecord('label', field.getValue()))); + }, + beforerender: function(field){ + if (field.getValue()){ + field.fireEvent('change', field, field.getValue()); + } + } + } + },{ + xtype: 'container', + itemId: 'remarkPanel' + }] + }); + + this.store = this.getStoreCfg(); + + this.callParent(); + }, + + getItems: function(rec){ + var fields = rec.get('fields'); + var labels = rec.get('fieldLabels'); + + var toAdd = []; + Ext4.each(fields, function(field, idx){ + toAdd.push({ + xtype: 'textarea', + fieldLabel: labels[idx], + labelWidth: 140, + name: field, + width: 550, + height: 60 + }); + }); + + return toAdd; + }, + + getStoreCfg: function(){ + return { + type: 'labkey-store', + schemaName: 'study', + queryName: 'Clinical Remarks', + filterArray: [LABKEY.Filter.create('caseId/category', 'Surgery', LABKEY.Filter.Types.EQUAL)], + columns: 'Id,date,caseid,s,o,a,p,p2,hx,remark', + maxRows: 0, + autoLoad: true + } + } +}); \ No newline at end of file diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsRemarksFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsRemarksFormSection.java index d46d02bfd..c48594d2e 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsRemarksFormSection.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsRemarksFormSection.java @@ -34,7 +34,7 @@ public RoundsRemarksFormSection(String label, EHRService.FORM_SECTION_LOCATION l { super("study", "Clinical Remarks", label, "ehr-roundsremarksgridpanel", location); addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalObservationsCellEditing.js")); - addClientDependency(ClientDependency.supplierFromPath("ehr/panel/ClinicalRemarkPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/ClinicalRemarkPanel.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/grid/RoundsRemarksGridPanel.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/grid/ObservationsRowEditorGridPanel.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalRemarksRowEditor.js")); From 747e76a2d7deebc717f2b1b1f6ab00bb3b6eb682 Mon Sep 17 00:00:00 2001 From: blasar Date: Fri, 3 Apr 2026 00:51:15 -0700 Subject: [PATCH 07/10] Modified Surgical Rounds configurations --- .../form/field/Surgery_PlantextArea.js | 28 +++--- .../onprc_ehr/model/sources/SurgicalRounds.js | 8 +- .../org/labkey/onprc_ehr/ONPRC_EHRModule.java | 5 -- .../dataentry/RoundsRemarksFormSection.java | 2 +- .../SurgeryRoundsRemarksFormSection.java | 87 +++++++++++++++++++ .../dataentry/SurgicalRoundsFormType.java | 5 ++ .../SurgicalRoundsRemarksFormSection.java | 2 +- 7 files changed, 114 insertions(+), 23 deletions(-) create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgeryRoundsRemarksFormSection.java diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js b/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js index 03e3ebe4f..3601f5a38 100644 --- a/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js @@ -27,7 +27,7 @@ Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { this.linkEl = this.linkDiv.createChild({ tag: 'a', cls: 'labkey-text-link', - html: (this.getValue() ? 'Copy Latest P2' : 'Edit P2') + html: (this.getValue() ? 'Copy Latest S2' : 'Edit S2') }); var panel = this.up('ehr-formpanel'); @@ -50,7 +50,7 @@ Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { }) } - this.linkEl.on('click', this.copyMostRecentP2, this); + this.linkEl.on('click', this.copyMostRecentS2, this); this.setupMask(); }, @@ -86,7 +86,7 @@ Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { } if (this.linkEl){ - this.linkEl.update('Copy Latest P2'); + this.linkEl.update('Copy Latest S2'); } if (this.inputEl) @@ -100,17 +100,17 @@ Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { var rec = EHR.DataEntryUtils.getBoundRecord(this); if (rec && rec.get('Id')){ - this.getMostRecentP2(rec, function(ret, Id){ + this.getMostRecentS2(rec, function(ret, Id){ if (!ret || !this.displayEl){ - this.displayEl.update('Either no active case or no P2 for ' + (Id || rec.get('Id'))); + this.displayEl.update('Either no active case or no S2 for ' + (Id || rec.get('Id'))); return; } - if (ret.mostRecentP2 && ret.isActive){ - this.displayEl.update(ret.mostRecentP2); + if (ret.mostRecentS2 && ret.isActive){ + this.displayEl.update(ret.mostRecentS2); } else { - this.displayEl.update('Either no active case or no P2 for ' + (Id || rec.get('Id'))); + this.displayEl.update('Either no active case or no S2 for ' + (Id || rec.get('Id'))); } }); } @@ -129,24 +129,24 @@ Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { Ext4.Msg.wait('Loading...'); this.showTextArea(); - this.getMostRecentP2(rec, function(ret){ + this.getMostRecentS2(rec, function(ret){ Ext4.Msg.hide(); - if (ret && ret.mostRecentP2){ - this.setValue(ret.mostRecentP2); - this.linkEl.update('Refresh P2'); + if (ret && ret.mostRecentS2){ + this.setValue(ret.mostRecentS2); + this.linkEl.update('Refresh S2'); } }, true); }, - getMostRecentP2: function(rec, cb, alwaysUseCallback){ + getMostRecentS2: function(rec, cb, alwaysUseCallback){ var date = rec.get('date') || new Date(); var id = rec.get('Id'); this.pendingIdRequest = id; LABKEY.Query.executeSql({ schemaName: 'study', - sql: 'SELECT c.Id, c.p2 as mostRecentP2, c.caseid, as caseCategory, c.caseid.isActive as isActive FROM study.clinRemarks c WHERE (c.category != \'Replaced SOAP\' OR c.category IS NULL) AND c.caseid.category= \'Surgery\' AND c.p2 IS NOT NULL AND c.Id = \'' + rec.get('Id') + '\' ORDER BY c.date DESC LIMIT 1', + sql: 'SELECT c.Id, c.p2 as mostRecentS2, c.caseid, c.caseid.category as caseCategory, c.caseid.isActive as isActive FROM study.clinRemarks c WHERE (c.category != \'Replaced SOAP\' OR c.category IS NULL) AND c.caseid.category= \'Surgery\' AND c.p2 IS NOT NULL AND c.Id = \'' + rec.get('Id') + '\' ORDER BY c.date DESC LIMIT 1', failure: LDK.Utils.getErrorCallback(), scope: this, success: function(results){ diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js index 7a74b4df4..6b334659a 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js @@ -34,10 +34,14 @@ EHR.model.DataModelManager.registerMetadata('SurgicalRounds', { hidden: true }, p2: { - xtype: 'onprc_ehr-Surg_plantextarea', + formEditorConfig: { + xtype: 'onprc_ehr-Surg_plantextarea', + }, header: 'S2', - hidden: false + hidden: false, + height: 75 } + }, 'study.blood': { reason: { diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java index f4ff09917..d18c157d4 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java @@ -333,11 +333,6 @@ private void registerEHRResources() //Added: 10-12-2023 R.Blasa EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/EnvironmentalField.js"), this); - //Added: 3-24-2026 R.Blasa References new Xtype - EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/Surgery_PlantextArea.js"), this); - - //Added: 3-24-2026 R.Blasa References new Xtype from ehr - EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/PlanTextArea.js"), this); EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.housing, "List Single Housed Animals", this, DetailsURL.fromString("/query/executeQuery.view?schemaName=study&query.queryName=demographicsPaired&query.viewName=Single Housed"), "Commonly Used Queries"); EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.housing, "Find Animals Housed In A Given Room/Cage At A Specific Time", this, DetailsURL.fromString("/ehr/housingOverlaps.view?groupById=1"), "Commonly Used Queries"); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsRemarksFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsRemarksFormSection.java index c48594d2e..d46d02bfd 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsRemarksFormSection.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/RoundsRemarksFormSection.java @@ -34,7 +34,7 @@ public RoundsRemarksFormSection(String label, EHRService.FORM_SECTION_LOCATION l { super("study", "Clinical Remarks", label, "ehr-roundsremarksgridpanel", location); addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalObservationsCellEditing.js")); - addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/ClinicalRemarkPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/panel/ClinicalRemarkPanel.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/grid/RoundsRemarksGridPanel.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/grid/ObservationsRowEditorGridPanel.js")); addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalRemarksRowEditor.js")); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgeryRoundsRemarksFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgeryRoundsRemarksFormSection.java new file mode 100644 index 000000000..5b2b3792a --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgeryRoundsRemarksFormSection.java @@ -0,0 +1,87 @@ +/* + * 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; + + +public class SurgeryRoundsRemarksFormSection extends SimpleFormSection +{ + public SurgeryRoundsRemarksFormSection(String label, EHRService.FORM_SECTION_LOCATION location) + { + super("study", "Clinical Remarks", label, "ehr-roundsremarksgridpanel", location); + addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalObservationsCellEditing.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/ClinicalRemarkPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/grid/RoundsRemarksGridPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/grid/ObservationsRowEditorGridPanel.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalRemarksRowEditor.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/data/ClinicalObservationsClientStore.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/buttons/roundsButtons.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"; + } +} diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsFormType.java index 6a6f3f0f4..0c1f87fed 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsFormType.java @@ -59,6 +59,11 @@ public SurgicalRoundsFormType(DataEntryFormContext ctx, Module owner) } addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/SurgicalRounds.js")); + + // Added: 4-3-2026 R. Blasa + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/Surgery_PlantextArea.js")); + + setDisplayReviewRequired(true); } diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsRemarksFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsRemarksFormSection.java index 68608d813..7ac93eace 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsRemarksFormSection.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalRoundsRemarksFormSection.java @@ -26,7 +26,7 @@ * Date: 7/7/13 * Time: 10:36 AM */ -public class SurgicalRoundsRemarksFormSection extends RoundsRemarksFormSection +public class SurgicalRoundsRemarksFormSection extends SurgeryRoundsRemarksFormSection { public SurgicalRoundsRemarksFormSection() { From d73c8d34536e57c4eb58ac5b6ba67d9bf6ce3ffc Mon Sep 17 00:00:00 2001 From: blasar Date: Fri, 3 Apr 2026 12:52:21 -0700 Subject: [PATCH 08/10] Modified Surgery Rounds report to include P2 surgery exclusive entries. --- .../web/onprc_ehr/form/field/Surgery_PlantextArea.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js b/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js index 3601f5a38..d7b351c30 100644 --- a/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js @@ -119,7 +119,7 @@ Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { } }, - copyMostRecentP2: function(){ + copyMostRecentS2: function(){ var rec = EHR.DataEntryUtils.getBoundRecord(this); if (!rec || !rec.get('Id')){ Ext4.Msg.alert('Error', 'No Id Entered'); @@ -146,7 +146,7 @@ Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { LABKEY.Query.executeSql({ schemaName: 'study', - sql: 'SELECT c.Id, c.p2 as mostRecentS2, c.caseid, c.caseid.category as caseCategory, c.caseid.isActive as isActive FROM study.clinRemarks c WHERE (c.category != \'Replaced SOAP\' OR c.category IS NULL) AND c.caseid.category= \'Surgery\' AND c.p2 IS NOT NULL AND c.Id = \'' + rec.get('Id') + '\' ORDER BY c.date DESC LIMIT 1', + sql: 'SELECT c.Id, c.p2 as mostRecentS2, c.caseid, c.category as caseCategory, c.caseid.isActive as isActive FROM study.clinRemarks c WHERE (c.category = \'Surgery\' OR c.category is null) AND c.p2 IS NOT NULL AND c.Id = \'' + rec.get('Id') + '\' ORDER BY c.date DESC LIMIT 1', failure: LDK.Utils.getErrorCallback(), scope: this, success: function(results){ From b8254dc4952f6b726005b5654bb826165182f7b7 Mon Sep 17 00:00:00 2001 From: blasar Date: Fri, 3 Apr 2026 14:31:02 -0700 Subject: [PATCH 09/10] Modified Surgery Rounds report to include P2 surgery exclusive entries. --- .../resources/web/onprc_ehr/model/sources/SurgicalRounds.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js index 6b334659a..c871145a5 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/SurgicalRounds.js @@ -33,7 +33,10 @@ EHR.model.DataModelManager.registerMetadata('SurgicalRounds', { p: { hidden: true }, - p2: { + CEG_Plan: { + hidden: true + }, + P2: { formEditorConfig: { xtype: 'onprc_ehr-Surg_plantextarea', }, From c8d89e57ed883a84a5326f2549915a9dc5ac66d4 Mon Sep 17 00:00:00 2001 From: blasar Date: Mon, 6 Apr 2026 14:34:33 -0700 Subject: [PATCH 10/10] Modified Surgery Rounds report to include P2 surgery exclusive entries. --- .../resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js b/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js index d7b351c30..6ce5dd7be 100644 --- a/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/Surgery_PlantextArea.js @@ -146,7 +146,7 @@ Ext4.define('ONPRC_EHR.form.field.Surg_PlanTextArea', { LABKEY.Query.executeSql({ schemaName: 'study', - sql: 'SELECT c.Id, c.p2 as mostRecentS2, c.caseid, c.category as caseCategory, c.caseid.isActive as isActive FROM study.clinRemarks c WHERE (c.category = \'Surgery\' OR c.category is null) AND c.p2 IS NOT NULL AND c.Id = \'' + rec.get('Id') + '\' ORDER BY c.date DESC LIMIT 1', + sql: 'SELECT c.Id, c.p2 as mostRecentS2, c.caseid, c.category as caseCategory, c.caseid.isActive as isActive FROM study.clinRemarks c WHERE (c.category = \'Surgery\' ) AND c.p2 IS NOT NULL AND c.Id = \'' + rec.get('Id') + '\' ORDER BY c.date DESC LIMIT 1', failure: LDK.Utils.getErrorCallback(), scope: this, success: function(results){