Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a9cfbbc
MOdified BSu Rounds to allow duplication of an
Ohsudev Aug 20, 2025
9e5bfed
Merge remote-tracking branch 'origin/24.11_fb_BSURoundsDuplication' i…
Ohsudev Aug 30, 2025
55f610b
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev Sep 2, 2025
1902649
Modified BSU Rounds screen to allow user to add "Alopecia Grow" so th…
Ohsudev Sep 12, 2025
5cd622e
Modified BSU Rounds screen to allow user to add "Alopecia Grow" so th…
Ohsudev Sep 12, 2025
508c4d4
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev Jan 15, 2026
adad93c
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev Feb 1, 2026
1df746d
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev Feb 27, 2026
ec9c80d
Merge remote-tracking branch 'refs/remotes/origin/25.7_fb_BehaviorRou…
Ohsudev Mar 13, 2026
52cc2b5
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev Mar 19, 2026
4f00354
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev Mar 20, 2026
8a69e2a
Modified BSU Rounds loading open cases to provide
Ohsudev Mar 21, 2026
2757482
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev Mar 24, 2026
60b8697
Modified testing script codes to include Alopecia Regrowth.
Mar 31, 2026
b970dbd
Modified BSU Rounds test scripts
Apr 1, 2026
926b909
Modified BSU Rounds Test scripts to prevent testing errors.
Apr 7, 2026
31cd308
Modified BSU Rounds Test scripts to prevent testing errors.
Apr 7, 2026
87d6c04
Modified BSU Rounds syntex
Apr 10, 2026
3130578
Modified testing scripts
Apr 28, 2026
075f062
Modified testing scripts
Apr 29, 2026
e2fef39
Modified testing scripts
Apr 29, 2026
d9fc1a0
Modified testing scripts
Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ EHR.model.DataModelManager.registerMetadata('BehaviorRounds', {
columnConfig: {
editable: false
}
},
caseid: {
hidden: false,
columnConfig: {
width: 10,
editable: false
}
}
}
}
Expand Down
202 changes: 202 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/window/AddBehaviorCasesWindow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
/* Copyright (c) 2014-2019 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
/**
* This window will allow users to query open cases and add records to a task based on them
*/
Ext4.define('ONPRC_EHR.window.AddBehaviorCasesWindow', {
extend: 'EHR.window.AddSurgicalCasesWindow',
caseCategory: 'Behavior',
templateName: null,

allowNoSelection: true,
showAssignedVetCombo: false,
showAllowOpen: true,
defaultRemark: 'BSU Rounds Entered',

getCases: function(button){
Ext4.Msg.wait("Loading...");
this.hide();

var casesFilterArray = this.getCasesFilterArray();
var obsFilterArray = this.getBaseFilterArray();
obsFilterArray.push(LABKEY.Filter.create('caseCategory', this.caseCategory, LABKEY.Filter.Types.EQUAL));
var includeOpen = this.down('#includeOpen') ? this.down('#includeOpen').getValue() : false;
if (includeOpen){
obsFilterArray.push(LABKEY.Filter.create('caseIsOpen', true, LABKEY.Filter.Types.EQUAL));
}
else {
obsFilterArray.push(LABKEY.Filter.create('caseIsActive', true, LABKEY.Filter.Types.EQUAL));
}

//find distinct animals matching criteria
var multi = new LABKEY.MultiRequest();

multi.add(LABKEY.Query.selectRows, {
requiredVersion: 9.1,
schemaName: 'study',
queryName: 'latestObservationsForCase',
columns: 'Id,date,category,area,observation,remark,caseid',
filterArray: obsFilterArray,
scope: this,
success: function(results){
this.obsResults = results;
},
failure: LDK.Utils.getErrorCallback()
});

multi.add(LABKEY.Query.selectRows, {
requiredVersion: 9.1,
schemaName: 'study',
queryName: 'cases',
sort: 'Id/curLocation/location,Id,remark,allProblemCategories',
columns: 'Id,objectid,remark,allProblemCategories',
filterArray: casesFilterArray,
scope: this,
success: function(results){
this.casesResults = results;
},
failure: LDK.Utils.getErrorCallback()
});

multi.send(this.onSuccess, this);
},

//@Override. this is to skip the duplicate case check
addRecords: function(records){
this.doAddRecords(records);
},

//@Override. this is to skip the duplicate case check
doAddRecords: function(records){
this.processObservations(records);
},

//apply previous observations, or inser a blank obs record.
processObservations: function(caseRecords){
//find all distinct IDs with cases.
var distinctCaseIds = [];
if (caseRecords && caseRecords.length){
Ext4.Array.forEach(caseRecords, function(cr){
if (distinctCaseIds.indexOf(cr.get('caseid')) == -1){
distinctCaseIds.push(cr.get('caseid'));
}
}, this);
}

var previousObsMap = {};
if (this.obsResults && this.obsResults.rows && this.obsResults.rows.length){
Ext4.Array.forEach(this.obsResults.rows, function(sr){
//reset variable
var newobservation = '';
var newremark = '';
var row = new LDK.SelectRowsRow(sr);
newobservation = row.getValue('category');
newremark = row.getValue('remark');

//note: this has been changed to ensure 1 row per case
var key = row.getValue('caseid');
if (!previousObsMap[key])
previousObsMap[key] = [];

previousObsMap[key].push({
Id: row.getValue('Id'),
date: this.recordData.date,
performedby: this.recordData.performedby,
caseid: row.getValue('caseid'),
category: row.getValue('category'),
area: row.getValue('area'),
allProblemCategories:row.getValue('allProblemCategories'),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're calling this against this.obsResults, which doesn't have this column in the selectRows column list above.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I added that column to the query.

//dont copy value
//observation: row.getValue('observation'),
remark: row.getValue('remark')
});
if (newobservation == "Alopecia Score" && (newremark == null || newremark == "")) {
previousObsMap[key].push({
Id: row.getValue('Id'),
date: this.recordData.date,
performedby: this.recordData.performedby,
caseid: row.getValue('caseid'),
category: 'Alopecia Regrowth',
area: row.getValue('area'),
allProblemCategories:row.getValue('allProblemCategories')
//dont copy value
//observation: row.getValue('observation'),
//remark: row.getValue('remark')
});

}
}, this);
}

var obsRecords = [];
var obsStore = this.targetStore.storeCollection.getClientStoreByName('Clinical Observations');
LDK.Assert.assertNotEmpty('Unable to find Clinical Observations store', obsStore);

var treatmentRecords = [];
var treatmentStore = this.targetStore.storeCollection.getClientStoreByName('Drug Administration');
LDK.Assert.assertNotEmpty('Unable to find Drug Administration store', treatmentStore);

Ext4.Array.forEach(caseRecords, function(cr){
if (previousObsMap[cr.get('caseid')]){
Ext4.Array.forEach(previousObsMap[cr.get('caseid')], function(r){
r = Ext4.apply(r, {
'Id/curLocation/location': cr.get('Id/curLocation/location')
});

obsRecords.push(obsStore.createModel(r));
}, this);
}
else {
obsRecords.push(obsStore.createModel({
'Id/curLocation/location': cr.get('Id/curLocation/location'),
Id: cr.get('Id'),
date: this.recordData.date,
performedby: this.recordData.performedby,
caseid: cr.get('caseid')
}));
}

treatmentRecords.push(treatmentStore.createModel({
Id: cr.get('Id'),
caseid: cr.get('caseid'),
date: this.recordData.date,
performedby: this.recordData.performedby
}));
}, this);

if (obsRecords.length){
obsStore.add(obsRecords);
}

if (treatmentRecords.length){
treatmentStore.add(treatmentRecords);
}

Ext4.Msg.hide();
this.close();
}
});

EHR.DataEntryUtils.registerGridButton('ADDBEHAVIORCASESAMENDED', function(config){
return Ext4.Object.merge({
text: 'Add Open Cases',
tooltip: 'Click to automatically add animals with open cases',
handler: function(btn){
var grid = btn.up('gridpanel');
if(!grid.store || !grid.store.hasLoaded()){
console.log('no store or store hasnt loaded');
return;
}

var cellEditing = grid.getPlugin('cellediting');
if(cellEditing)
cellEditing.completeEdit();

Ext4.create('ONPRC_EHR.window.AddBehaviorCasesWindow', {
targetStore: grid.store
}).show();
}
}, config);
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public BehaviorRoundsObservationsFormSection()

addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddClinicalCasesWindow.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddSurgicalCasesWindow.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddBehaviorCasesWindow.js"));
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/AddBehaviorCasesWindow.js"));
}

@Override
public List<String> getTbarButtons()
{
List<String> defaultButtons = super.getTbarButtons();
defaultButtons.add(0, "ADDBEHAVIORCASES");
defaultButtons.add(0, "ADDBEHAVIORCASESAMENDED");

return defaultButtons;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1810,13 +1810,17 @@ public void testBehaviorRounds() throws Exception
//just load all behavior cases
waitAndClick(Ext4Helper.Locators.windowButton("Add Open Behavior Cases", "Submit"));
waitForElementToDisappear(caseWindow);
obsGrid.waitForRowCount(1);
obsGrid.waitForRowCount(2);
Assert.assertEquals("Alopecia Score", obsGrid.getFieldValue(1, "category"));
Assert.assertEquals("Alopecia Regrowth", obsGrid.getFieldValue(2, "category"));
Assert.assertEquals("Id field should not be editable.", "on", obsGrid.getCell(1, "Id")
.findElement(getDriver()).findElement(By.tagName("div")).getDomAttribute("unselectable"));
String observation = (String)obsGrid.getFieldValue(1, "observation");
String observation2 = (String)obsGrid.getFieldValue(2, "observation");
Assert.assertTrue("Expected \"Observation/Score\" to be empty (blank or null) but was \"" + observation + "\"", StringUtils.isEmpty(observation));
Assert.assertTrue("Expected \"Observation/Score\" to be empty (blank or null) but was \"" + observation2 + "\"", StringUtils.isEmpty(observation));
Assert.assertEquals(SUBJECTS[0], obsGrid.getFieldValue(1, "Id"));
Assert.assertEquals(SUBJECTS[0], obsGrid.getFieldValue(2, "Id"));

_ext4Helper.clickExt4Tab("Treatments Given");
waitForElement(Locator.tagWithText("div", "No Charge"));
Expand Down
Loading