Added View option to explicitly load unassociated studies in the lesion tracker (LT-183)

This commit is contained in:
Erik Ziegler committed 2016-03-08 13:11:43 +01:00
1 parent 52286136ab
commit f53bfcc05c
5 files changed
+77 -8

No files matched your search

@@ -5,6 +5,11 @@
onselectstart='return false;'>
<ul>
<li>
<a id="viewStudies" type="button"
title="View Studies">
<i class="fa fa-desktop fa-lg"></i>
View
</a>
<!-- TODO: Make this dynamically accept options-->
<a id="launchStudyAssociation" type="button"
data-toggle="modal"
@@ -6,6 +6,7 @@ Template.lesionTrackerWorklistContextMenu.replaces(defaultTemplate);
Worklist.functions['removeTimepointAssociations'] = removeTimepointAssociations;
Worklist.functions['exportSelectedStudies'] = exportSelectedStudies;
Worklist.functions['viewStudies'] = viewStudies;
/**
* Removes all present study / timepoint associations from the Clinical Trial
@@ -83,7 +84,53 @@ function exportSelectedStudies() {
sort: {
studyDate: 1
}
}).fetch() || [];
}).fetch();
if (!selectedStudies) {
return;
}
exportStudies(selectedStudies);
}
/**
* Loads multiple unassociated studies in the Viewer
*/
function viewStudies() {
var selectedStudies = WorklistSelectedStudies.find({}, {
sort: {
studyDate: 1
}
}).fetch();
if (!selectedStudies) {
return;
}
var title = selectedStudies[0].patientName;
var studyInstanceUids = selectedStudies.map(function(study) {
return study.studyInstanceUid;
});
// Generate a unique ID to represent this tab
// We can't just use the Mongo entry ID because
// then it will change after hot-reloading.
var contentid = uuid.new();
// Create a new entry in the WorklistTabs Collection
WorklistTabs.insert({
title: title,
contentid: contentid,
active: false
});
// Update the ViewerData global object
ViewerData[contentid] = {
title: title,
contentid: contentid,
studyInstanceUids: studyInstanceUids
};
// Switch to the new tab
switchToTab(contentid);
}
@@ -21,6 +21,12 @@ Template.studyDateList.helpers({
}
}).fetch();
// If no Study / Timepoint associated studies exist, just
// return the list of loaded studies
if (!relatedStudies.length) {
return ViewerStudies.find();
}
// Modify the array of related studies so the default option is the currently selected study
relatedStudies.forEach(function(study, index) {
// If the studyInstanceUid matches that of the current study in the browser,