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

This commit is contained in:
Erik Ziegler 2016-03-08 13:10:26 +01:00
parent 52286136ab
commit f53bfcc05c
5 changed files with 77 additions and 8 deletions

View File

@ -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"

View File

@ -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);
}

View File

@ -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,

View File

@ -3,12 +3,9 @@
*/
UI.registerHelper('formatTM', function(context, format) {
if (!context) {
return undefined;
return;
}
var dateAsMoment = moment(context);
var strFormat = "HH:mm:ss";
if (options) {
strFormat = format;
}
return dateAsMoment.format(strFormat);
var dateTime = moment(context);
return dateTime.format(format || "HH:mm:ss");
});

View File

@ -69,6 +69,20 @@ switchToTab = function(contentId) {
data.studies = ViewerData[contentId].studies;
}
// Add additional metadata to our study from the worklist
data.studies.forEach(function(study) {
var worklistStudy = WorklistStudies.findOne({
studyInstanceUid: study.studyInstanceUid
});
if (!worklistStudy) {
return;
}
$.extend(study, worklistStudy);
});
// Get tab content container given the contentId string
// If no such container exists, stop here because something is wrong
var container = $('.tab-content').find('#' + contentId).get(0);