-
Notifications
You must be signed in to change notification settings - Fork 3
25.11 fb bsu rounds template #1654
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
Open
Ohsudev
wants to merge
22
commits into
release25.11-SNAPSHOT
Choose a base branch
from
25.11_fb_BSURoundsTemplate
base: release25.11-SNAPSHOT
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 9e5bfed
Merge remote-tracking branch 'origin/24.11_fb_BSURoundsDuplication' i…
Ohsudev 55f610b
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev 1902649
Modified BSU Rounds screen to allow user to add "Alopecia Grow" so th…
Ohsudev 5cd622e
Modified BSU Rounds screen to allow user to add "Alopecia Grow" so th…
Ohsudev 508c4d4
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev adad93c
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev 1df746d
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev ec9c80d
Merge remote-tracking branch 'refs/remotes/origin/25.7_fb_BehaviorRou…
Ohsudev 52cc2b5
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev 4f00354
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev 8a69e2a
Modified BSU Rounds loading open cases to provide
Ohsudev 2757482
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev 60b8697
Modified testing script codes to include Alopecia Regrowth.
b970dbd
Modified BSU Rounds test scripts
926b909
Modified BSU Rounds Test scripts to prevent testing errors.
31cd308
Modified BSU Rounds Test scripts to prevent testing errors.
87d6c04
Modified BSU Rounds syntex
3130578
Modified testing scripts
075f062
Modified testing scripts
e2fef39
Modified testing scripts
d9fc1a0
Modified testing scripts
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
202 changes: 202 additions & 0 deletions
202
onprc_ehr/resources/web/onprc_ehr/window/AddBehaviorCasesWindow.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'), | ||
| //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); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.