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/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 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..0cb4b4f69 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/SurgicalAmendedRemarksFormSection.java @@ -0,0 +1,59 @@ +/* + * 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.ehr.dataentry.SimpleFormSection; +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 SimpleFormSection +{ + public SurgicalAmendedRemarksFormSection(String label, EHRService.FORM_SECTION_LOCATION location) + { + 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 + + + addClientDependency(ClientDependency.supplierFromPath("ehr/data/ClinicalObservationsClientStore.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/buttons/roundsButtons.js")); + addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/SurgeryEntryField.js")); + + setTemplateMode(TEMPLATE_MODE.NONE); + } + + @Override + public List getTbarButtons() + { + List defaultButtons = super.getTbarButtons(); + defaultButtons.add(0, "ADDSURGICALCASES"); + defaultButtons.add("BULK_CHANGE_CASES"); + + return defaultButtons; + } +}