Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPA Question #1011

Open
wants to merge 9 commits into
base: release23.11-SNAPSHOT
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Ext4.define('ONPRC_EHR.panel.AnimalDetailsCasePanel', {
xtype: 'ldk-linkbutton',
style: 'margin-top: 10px;',
scope: this,
text: '[Show Full Hx]',
text: '[Show Full Hx show]',
handler: function(){
if (this.subjectId){
EHR.window.ClinicalHistoryWindow.showClinicalHistory(null, this.subjectId, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Ext4.define('ONPRC_EHR.panel.AnimalDetailsExtendedPanel', {
xtype: 'ldk-linkbutton',
style: 'margin-top: 10px;',
scope: this,
text: '[Show Full Hx]',
text: '[Show Full Hx show]',
handler: function(){
if (this.subjectId){
EHR.window.ClinicalHistoryWindow.showClinicalHistory(null, this.subjectId, null);
Expand Down Expand Up @@ -92,7 +92,8 @@ Ext4.define('ONPRC_EHR.panel.AnimalDetailsExtendedPanel', {
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();
//Changed the container to onprc_ehr by Kollil, 11/13/24
Ext4.create('onprc_ehr.window.ManageTreatmentsWindow', {animalId: this.subjectId}).show();
}
else {
console.log('no id');
Expand Down
5 changes: 3 additions & 2 deletions onprc_ehr/resources/web/onprc_ehr/panel/AnimalDetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Ext4.define('ONPRC_EHR.panel.AnimalDetailsPanel', {
xtype: 'ldk-linkbutton',
style: 'margin-top: 10px;',
scope: this,
text: '[Show Full Hx]',
text: '[Show Full Hx show]',
handler: function(){
if (this.subjectId){
EHR.window.ClinicalHistoryWindow.showClinicalHistory(null, this.subjectId, null);
Expand Down Expand Up @@ -170,7 +170,8 @@ Ext4.define('ONPRC_EHR.panel.AnimalDetailsPanel', {
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();
//Changed the container to onprc_ehr by Kollil, 6/26/24
Ext4.create('onprc_ehr.window.ManageTreatmentsWindow', {animalId: this.subjectId}).show();
}
else {
console.log('no id');
Expand Down
46 changes: 46 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/panel/ManageTreatmentsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,52 @@ Ext4.define('onprc_ehr.panel.ManageTreatmentsPanel', {
}, (owner ? owner.animalId : null), category);
},

onSubmit: function(btn) {
var form = this.down('#formPanel');
var rec = form.getRecord();
if (!rec)
return;
//Added by Kollil, 6/26/24
//Refer to the ticket #9669
//This code snippet is added to show a pop-up question box when the user selects MPA medication on animal details panel
if (rec.get('Id') && rec.get('code')=='E-85760')
{
Ext4.Msg.confirm('Medication Question', 'Have you confirmed MPA start date on CMU Calendar?', function(val){
if (val == 'yes') {
if (!rec.get('taskid')) {
var tsk = LABKEY.Utils.generateUUID().toUpperCase();
LABKEY.Query.insertRows({
schemaName: 'ehr',
queryName: 'tasks',
rows: [{
taskid: tsk,
formtype: 'treatments',
title: 'Medication Order',
assignedto: LABKEY.Security.currentUser.userid,
qcstate: EHR.Security.getQCStateByLabel('Completed').RowId,
datecompleted: new Date(),
category: 'Task'
}],
scope: this,
failure: EHR.Utils.onError,
success: function () {
Ext4.Msg.hide();
}
});
rec.set('taskid', tsk);
}
this.down('#dataEntryPanel').onSubmit(btn);
}
else {

}
}, this)
}
else {
this.down('#dataEntryPanel').onSubmit(btn);
}
},

createTreatmentWindow: function(btn, config, animalId, category){
var cfg = Ext4.apply({
schemaName: 'study',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Created: 3-12-2024 by Kollil and Raymond
This script is added to create a pop-up message box when MPA injection is selected in the medication order form.
Refer to the ticket #9669
Modified: Kollil, 6/26/24
*/
Ext4.define('ONPRC_EHR.panel.TreatmentOrdersDataEntryPanel', {
extend: 'EHR.panel.TaskDataEntryPanel',

onBeforeSubmit: function(btn){
if (!btn || !btn.targetQC || ['Completed'].indexOf(btn.targetQC) == -1){
return;
}
var store = this.storeCollection.getClientStoreByName('Treatment Orders');
LDK.Assert.assertNotEmpty('Unable to find Treatment Orders store', store);

var ids = [];
store.each(function(r){
if (r.get('Id') && r.get('code')=='E-85760') // && r.get('category') == 'Clinical' ) // Removed the category filter, as the medication requires the validation whenever its ordered
ids.push(r.get('Id'))
}, this);
ids = Ext4.unique(ids);

if (!ids.length)
return;

if (ids.length){
Ext4.Msg.confirm('Medication Question', 'Have you confirmed MPA start date on CMU Calendar?', function(val){
if (val == 'yes'){
this.onSubmit(btn, true);
}
else {

}
}, this);
}
else {
this.onSubmit(btn, true);
}
return false;
}
});
72 changes: 72 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/plugin/onprc_RowEditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2013-2019 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*
* Created by Kollil on 11/12/24 in efforts to create the MPA pop up message display
*/
Ext4.onReady(function(){
Ext4.define('ONPRC_EHR.plugin.RowEditor', {
extend: 'EHR.plugin.RowEditor',

getDetailsPanelCfg: function () {
return {
xtype: 'onprc_ehr-animaldetailspanels',
itemId: 'detailsPanel',
showDisableButton: false
}
},

getWindowCfg: function(){
return {
modal: true,
width: 900,
border: false,
items: [{
items: [this.getDetailsPanelCfg(), this.getFormPanelCfg()]
}],
buttons: this.getWindowButtons(),
closeAction: 'destroy',
listeners: {
scope: this,
close: this.onWindowClose,
destroy: this.onWindowClose,
beforerender: function(win){
var cols = win.down('#formPanel').items.get(0).items.getCount();
if (cols > 1){
var newWidth = cols * (EHR.form.Panel.defaultFieldWidth + 20);
if (newWidth > win.width) {
win.setWidth(newWidth);
}
}
},
afterrender: function(editorWin){
this.keyNav = new Ext4.util.KeyNav({
target: editorWin.getId(),
scope: this,
up: function(e){
if (e.ctrlKey){
this.loadPreviousRecord();
}
},
down: function (e){
if (e.ctrlKey){
this.loadNextRecord();
}
}
});
},
animalchange: {
fn: function(id){
this.getEditorWindow().down('#detailsPanel').loadAnimal(id);
},
scope: this,
buffer: 200
}
}
}
},

});
EHR.Utils.rowEditorPlugin = 'ONPRC_EHR.plugin.RowEditor';
});
59 changes: 38 additions & 21 deletions onprc_ehr/resources/web/onprc_ehr/window/ManageRecordWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,47 @@ Ext4.define('ONPRC_EHR.window.ManageRecordWindow', {
var rec = form.getRecord();
if (!rec)
return;
if (!rec.get('taskid')) {
var tsk = LABKEY.Utils.generateUUID().toUpperCase();
LABKEY.Query.insertRows({
schemaName: 'ehr',
queryName: 'tasks',
rows: [{
taskid: tsk,
formtype: 'treatments',
title: 'Medication/Diet',
assignedto: LABKEY.Security.currentUser.userid,
qcstate: EHR.Security.getQCStateByLabel('Completed').RowId,
datecompleted: new Date(),
category: 'Task'
}],
scope: this,
failure: EHR.Utils.onError,
success: function () {
Ext4.Msg.hide();
//Added by Kollil, 6/26/24
//Refer to the ticket #9669
//This code snippet is added to show a pop-up question box when the user selects MPA medication on animal history snapshot screen - > Manage Treatments link.
if (rec.get('Id') && rec.get('code')=='E-85760')
{
Ext4.Msg.confirm('Medication Question', 'Have you confirmed MPA start date on CMU Calendar?', function(val){
if (val == 'yes') {
if (!rec.get('taskid')) {
var tsk = LABKEY.Utils.generateUUID().toUpperCase();
LABKEY.Query.insertRows({
schemaName: 'ehr',
queryName: 'tasks',
rows: [{
taskid: tsk,
formtype: 'treatments',
title: 'Medication/Diet',
assignedto: LABKEY.Security.currentUser.userid,
qcstate: EHR.Security.getQCStateByLabel('Completed').RowId,
datecompleted: new Date(),
category: 'Task'
}],
scope: this,
failure: EHR.Utils.onError,
success: function () {
Ext4.Msg.hide();
}
});
rec.set('taskid', tsk);
}
this.down('#dataEntryPanel').onSubmit(btn);
}
else {

}
});
rec.set('taskid', tsk);
}, this)
}
else {
this.down('#dataEntryPanel').onSubmit(btn);
}
this.down('#dataEntryPanel').onSubmit(btn);
},

onFormLoad: function(results){
this.formResults = results;
this.setTitle(this.formResults.formConfig.label);
Expand Down
9 changes: 5 additions & 4 deletions onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@
import org.labkey.onprc_ehr.security.ONPRC_EHRCMUAdministrationRole;
import org.labkey.onprc_ehr.security.ONPRC_EHRCustomerEditPermission;
import org.labkey.onprc_ehr.security.ONPRC_EHRCustomerEditRole;
import org.labkey.onprc_ehr.security.ONPRC_EHREnvironmentalPermission;
import org.labkey.onprc_ehr.security.ONPRC_EHREnvironmentalRole;
//import org.labkey.onprc_ehr.security.ONPRC_EHRPMICEditRole;
import org.labkey.onprc_ehr.security.ONPRC_EHRTransferRequestRole;
import org.labkey.onprc_ehr.table.ONPRC_EHRCustomizer;

Expand Down Expand Up @@ -285,14 +283,17 @@ private void registerEHRResources()
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/ManageTreatmentsPanel.js"), this);
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/SmallFormSnapShotPanel.js"), this);

// Consider creating a base FormType to include these dependencies instead of blasting them on every page
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("ehr/plugin/RowEditor.js"), this);
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/plugin/onprc_RowEditor.js"), this);
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/AnimalDetailsPanel.js"), this);

//Added: 8-24-2016 R.Blasa
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/DemographicsRecord.js"), this);

//Added: 2-22-2017 R.Blasa
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/NarrowSnapshotPanel.js"), this);



//Added: 10-25-2017 R.Blasa References new Xtype
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/CEG_PlantextArea.js"), this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ public AnimalDetailsRoundsFormSection()

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
*/
package org.labkey.onprc_ehr.dataentry;

import org.labkey.onprc_ehr.dataentry.AnimalDetailsFormSection;
import org.labkey.api.ehr.dataentry.BloodDrawFormSection;
import org.labkey.api.ehr.dataentry.DataEntryFormContext;
import org.labkey.api.ehr.dataentry.FormSection;
import org.labkey.api.ehr.dataentry.NonStoreFormSection;
import org.labkey.api.ehr.dataentry.TaskForm;
import org.labkey.api.ehr.dataentry.TaskFormSection;
import org.labkey.api.ehr.dataentry.WeightFormSection;
import org.labkey.onprc_ehr.dataentry.DrugAdministrationFormSection;
import org.labkey.api.module.Module;
import org.labkey.api.view.template.ClientDependency;

Expand All @@ -47,7 +45,7 @@ public AuxProcedureFormType(DataEntryFormContext ctx, Module owner)


new TaskFormSection(),
new AnimalDetailsFormSection(),
new ONPRCAnimalDetailsFormSection(),
// new SimpleGridPanel("study", "encounters", "Procedures" ),
new ClinicalEncountersFormSection(), //Added 5-4-2015 Blasa
new BloodDrawFormSection(false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
package org.labkey.onprc_ehr.dataentry;

import org.labkey.api.ehr.EHRService;
import org.labkey.onprc_ehr.dataentry.AnimalDetailsFormSection;
import org.labkey.api.ehr.dataentry.DataEntryFormContext;
import org.labkey.api.ehr.dataentry.FormSection;
import org.labkey.api.ehr.dataentry.SimpleGridPanel;
import org.labkey.api.ehr.dataentry.TaskForm;
import org.labkey.api.ehr.dataentry.TaskFormSection;
import org.labkey.api.ehr.dataentry.WeightFormSection;
import org.labkey.onprc_ehr.dataentry.DrugAdministrationFormSection;
import org.labkey.api.ehr.security.EHRClinicalEntryPermission;
import org.labkey.api.module.Module;
import org.labkey.api.view.template.ClientDependency;
Expand All @@ -45,7 +43,7 @@ public BulkClinicalEntryFormType(DataEntryFormContext ctx, Module owner)
{
super(ctx, owner, NAME, "Bulk Clinical Entry", "Clinical", Arrays.asList(
new TaskFormSection(),
new AnimalDetailsFormSection(),
new ONPRCAnimalDetailsFormSection(),

//Added 6-5-2015 Blasa
new ClinicalEncountersFormSection(),
Expand Down Expand Up @@ -79,6 +77,11 @@ public BulkClinicalEntryFormType(DataEntryFormContext ctx, Module owner)
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/ExamCasesDataEntryPanel.js"));
setDisplayReviewRequired(true);
setJavascriptClass("ONPRC_EHR.panel.ExamCasesDataEntryPanel");

//Added by Kollil, 6/26/24
//This script was added to show a pop-up question box when the user selects MPA medication on the Medication order form.
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/TreatmentOrdersDataEntryPanel.js"));
setJavascriptClass("ONPRC_EHR.panel.TreatmentOrdersDataEntryPanel");
}

@Override
Expand Down
Loading