Skip to content

Commit

Permalink
Added Sustained Release Medication information to the remarks editor … (
Browse files Browse the repository at this point in the history
#939)

* 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.
  • Loading branch information
Ohsudev authored Mar 12, 2024
1 parent 1bde381 commit dc9d2ba
Show file tree
Hide file tree
Showing 5 changed files with 438 additions and 1 deletion.
109 changes: 109 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/grid/RoundsRemarksGridPanel.js
Original file line number Diff line number Diff line change
@@ -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 = '<span style="margin-top: 2px;background-color: yellow;line-height: 1.2;">';
suffix = '</span>';
}
else if (r.get('category') == 'Reviewed'){
prefix = '<span style="margin-top: 2px;background-color: green;line-height: 1.2;">';
suffix = '</span>';
}
}

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 += '<span style="margin-top: 2px;background-color: red;line-height: 1.2;">&nbsp;&nbsp;</span>';
}

if (line){
lines.push(prefix + line + suffix);
}
}, this);

return lines.join('<br>');
}

return '';
}
});
}
});
142 changes: 142 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/panel/AnimalDetailsExtendedPanel.js
Original file line number Diff line number Diff line change
@@ -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);
}
}];
}
});
Original file line number Diff line number Diff line change
@@ -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);
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Date: 7/7/13
* Time: 10:36 AM
*/
public class ClinicalRoundsRemarksFormSection extends RoundsRemarksFormSection
public class ClinicalRoundsRemarksFormSection extends RoundsClinicalRemarksFormSection
{
public ClinicalRoundsRemarksFormSection()
{
Expand Down
Loading

0 comments on commit dc9d2ba

Please sign in to comment.