Getting studyDate from wordlist

This commit is contained in:
Evren Ozkan 2015-11-11 17:11:33 -05:00 committed by Erik Ziegler
parent a073d03744
commit 2e51b4e41d
9 changed files with 99 additions and 1 deletions

View File

@ -2,6 +2,7 @@
<div id="viewer">
{{ >lesionLocationDialog }}
{{ >nonTargetLesionDialog}}
{{ >studyDateList}}
{{ >hidingPanel }}
<div id="viewportAndLesionTable">

View File

@ -487,4 +487,4 @@
});
})($, cornerstone, cornerstoneMath, cornerstoneTools);
})($, cornerstone, cornerstoneMath, cornerstoneTools);

View File

@ -0,0 +1,9 @@
<template name="studyDateList">
<select id="selectStudyDate">
{{#each patientStudies}}
<option value="{{studyDate}}">{{studyDate}}</option>
{{/each}}
</select>
</template>

View File

@ -0,0 +1,78 @@
Template.studyDateList.onCreated(function(){
// All studies of this patient at different dates
this.patientStudies = [];
this.selectedDate = "";
});
function cleanTimepoints() {
var timepoints = Timepoints.find();
timepoints.forEach(function (timepoint) {
Timepoints.remove({_id: timepoint._id});
});
}
Template.studyDateList.onRendered(function(){
//cleanTimepoints();
// Add Study dates to Timepoints
this.patientStudies.forEach(function(study) {
Timepoints.insert({
timepointID: uuid.v4(),
timepointName: study.studyDate
});
});
// Selected date option
$('#selectStudyDate option[value="'+this.selectedDate+'"]').prop('selected', true);
});
Template.studyDateList.helpers({
patientStudies: function(){
var self = Template.instance();
var studyData = this.studies[0]; // study which is loaded in tab
self.selectedDate = studyData.studyDate;
var studies = Studies.find().fetch(); // All studies list
var patientStudies = []; // Holds studies of patient
// Get all studies of patient with patientID
studies.forEach(function(study) {
if (studyData.patientId === study.patientId) {
patientStudies.push(study);
}
});
self.patientStudies = patientStudies;
return patientStudies;
}
});
Template.studyDateList.events({
'change select#selectStudyDate': function(e, template) {
var selector = e.currentTarget;
var selectedStudyDate = $(selector).val();
var patientStudies = template.patientStudies;
var studies = []; // all studies that has the same date and get with studyInstanceUId
patientStudies.forEach(function(study) {
if(study.studyDate === selectedStudyDate) {
studies.push(study);
}
});
studies.forEach(function(studyData) {
var studyInstanceUid = studyData.studyInstanceUid;
Meteor.call('GetStudyMetadata', studyInstanceUid, function(error, study) {
sortStudy(study);
// TODO:
Session.set('studies', [study]);
// TODO: Change thumbnails only
});
});
}
});

View File

@ -39,6 +39,13 @@ Package.onUse(function (api) {
api.addFiles('components/nonTargetLesionDialog/nonTargetLesionDialog.css', 'client');
api.addFiles('components/nonTargetLesionDialog/nonTargetLesionDialog.js', 'client');
api.addFiles('components/studyDateList/studyDateList.html', 'client');
api.addFiles('components/studyDateList/studyDateList.css', 'client');
api.addFiles('components/studyDateList/studyDateList.js', 'client');
// Library functions
api.addFiles('lib/uuid.js', 'client');

View File

@ -1,6 +1,7 @@
Template.studyBrowser.helpers({
studies : function() {
var studies = Session.get('studies');
console.log(studies);
var array = [];
studies.forEach(function(study, index) {

View File

@ -2,6 +2,7 @@
// This is a client-side only Collection which
// Stores the list of studies in the Worklist
Studies = new Mongo.Collection(null);
PatientStudies = new Mongo.Collection(null);
Template.worklistResult.helpers({
/**

View File

@ -59,5 +59,6 @@ Package.onUse(function (api) {
// Export the WorklistTabs Collection
api.export('WorklistTabs', 'client');
api.export('Studies', 'client');
});