From 2e51b4e41de449fa01f5e8a0a2a541c981427524 Mon Sep 17 00:00:00 2001 From: Evren Ozkan Date: Wed, 11 Nov 2015 17:11:33 -0500 Subject: [PATCH] Getting studyDate from wordlist --- LesionTracker/client/components/viewer.html | 1 + .../compatibility/nonTargetTool.js | 2 +- .../studyDateList/studyDateList.css | 0 .../studyDateList/studyDateList.html | 9 +++ .../components/studyDateList/studyDateList.js | 78 +++++++++++++++++++ Packages/lesiontracker/package.js | 7 ++ .../studyBrowser/studyBrowser/studyBrowser.js | 1 + .../worklistResult/worklistResult.js | 1 + Packages/worklist/package.js | 1 + 9 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 Packages/lesiontracker/components/studyDateList/studyDateList.css create mode 100644 Packages/lesiontracker/components/studyDateList/studyDateList.html create mode 100644 Packages/lesiontracker/components/studyDateList/studyDateList.js diff --git a/LesionTracker/client/components/viewer.html b/LesionTracker/client/components/viewer.html index 92111a314..1ff89b18f 100644 --- a/LesionTracker/client/components/viewer.html +++ b/LesionTracker/client/components/viewer.html @@ -2,6 +2,7 @@
{{ >lesionLocationDialog }} {{ >nonTargetLesionDialog}} + {{ >studyDateList}} {{ >hidingPanel }}
diff --git a/Packages/lesiontracker/compatibility/nonTargetTool.js b/Packages/lesiontracker/compatibility/nonTargetTool.js index b609b6a22..0467f5812 100644 --- a/Packages/lesiontracker/compatibility/nonTargetTool.js +++ b/Packages/lesiontracker/compatibility/nonTargetTool.js @@ -487,4 +487,4 @@ }); -})($, cornerstone, cornerstoneMath, cornerstoneTools); +})($, cornerstone, cornerstoneMath, cornerstoneTools); \ No newline at end of file diff --git a/Packages/lesiontracker/components/studyDateList/studyDateList.css b/Packages/lesiontracker/components/studyDateList/studyDateList.css new file mode 100644 index 000000000..e69de29bb diff --git a/Packages/lesiontracker/components/studyDateList/studyDateList.html b/Packages/lesiontracker/components/studyDateList/studyDateList.html new file mode 100644 index 000000000..e8cd2612b --- /dev/null +++ b/Packages/lesiontracker/components/studyDateList/studyDateList.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/Packages/lesiontracker/components/studyDateList/studyDateList.js b/Packages/lesiontracker/components/studyDateList/studyDateList.js new file mode 100644 index 000000000..4335db020 --- /dev/null +++ b/Packages/lesiontracker/components/studyDateList/studyDateList.js @@ -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 + }); + }); + + + } +}); diff --git a/Packages/lesiontracker/package.js b/Packages/lesiontracker/package.js index 7dbac85e1..3b91af175 100644 --- a/Packages/lesiontracker/package.js +++ b/Packages/lesiontracker/package.js @@ -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'); diff --git a/Packages/viewerbase/components/studyBrowser/studyBrowser/studyBrowser.js b/Packages/viewerbase/components/studyBrowser/studyBrowser/studyBrowser.js index 6fc907987..7b756aff6 100644 --- a/Packages/viewerbase/components/studyBrowser/studyBrowser/studyBrowser.js +++ b/Packages/viewerbase/components/studyBrowser/studyBrowser/studyBrowser.js @@ -1,6 +1,7 @@ Template.studyBrowser.helpers({ studies : function() { var studies = Session.get('studies'); + console.log(studies); var array = []; studies.forEach(function(study, index) { diff --git a/Packages/worklist/components/worklistResult/worklistResult.js b/Packages/worklist/components/worklistResult/worklistResult.js index ab75de242..26cb5aa14 100644 --- a/Packages/worklist/components/worklistResult/worklistResult.js +++ b/Packages/worklist/components/worklistResult/worklistResult.js @@ -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({ /** diff --git a/Packages/worklist/package.js b/Packages/worklist/package.js index de7d3f7ba..918cd7558 100644 --- a/Packages/worklist/package.js +++ b/Packages/worklist/package.js @@ -59,5 +59,6 @@ Package.onUse(function (api) { // Export the WorklistTabs Collection api.export('WorklistTabs', 'client'); + api.export('Studies', 'client'); });