diff --git a/Packages/worklist/components/worklist.html b/Packages/worklist/components/worklist.html index b7207fba3..2de587ab9 100644 --- a/Packages/worklist/components/worklist.html +++ b/Packages/worklist/components/worklist.html @@ -10,7 +10,6 @@
- {{> worklistSearch }} {{> worklistResult }}
diff --git a/Packages/worklist/components/worklist.styl b/Packages/worklist/components/worklist.styl index 140eef433..c3312062a 100644 --- a/Packages/worklist/components/worklist.styl +++ b/Packages/worklist/components/worklist.styl @@ -8,7 +8,32 @@ body -moz-user-select: none -ms-user-select: none user-select: none - + +input.worklist-search + height: 25px + background-color: #888888 + +// style="background-color: #444444; border-color:#444444;cursor:default;"> + +#tblStudyList + tr + height: 45px + +.patient-name-input + width: 130px + +.worklist-input + width: 80px + +.modality-input + width: 60px + +.patientid-input + width: 70px + +.study-description-input + width: 480px + #worklistTab background-color: #202020 diff --git a/Packages/worklist/components/worklistResult/worklistResult.html b/Packages/worklist/components/worklistResult/worklistResult.html index 14c59a4f1..aa9c4631b 100644 --- a/Packages/worklist/components/worklistResult/worklistResult.html +++ b/Packages/worklist/components/worklistResult/worklistResult.html @@ -3,19 +3,62 @@ - - - {{#unless isTouchDevice}} - - {{/unless}} - - {{#unless isTouchDevice}} - - {{/unless}} - - {{#unless isTouchDevice}} - - {{/unless}} + + + + + + + diff --git a/Packages/worklist/components/worklistResult/worklistResult.js b/Packages/worklist/components/worklistResult/worklistResult.js index d5933ee26..e0a2846b8 100644 --- a/Packages/worklist/components/worklistResult/worklistResult.js +++ b/Packages/worklist/components/worklistResult/worklistResult.js @@ -1,8 +1,6 @@ // Define the Studies Collection // 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({ /** @@ -11,9 +9,108 @@ Template.worklistResult.helpers({ */ studies : function() { return WorklistStudies.find({}, {sort: {patientName : 1, studyDate : 1}}); - }, - - isTouchDevice: function() { - return isTouchDevice(); } }); + +// Retrieve all studies +search(); + +var studyDateFrom; +var studyDateTo; +var checkFrom = false; +var checkTo = false; + +/** + * Transforms an input string into a search filter for + * the Worklist Search call + * + * @param filter The input string to be searched for + * @returns {*} + */ +function getFilter(filter) { + if(filter && filter.length && filter.substr(filter.length - 1) !== '*') { + filter += '*'; + } + return filter; +} + +/** + * Search for a value in a string + */ +function isIndexOf(mainVal, searchVal) { + if (mainVal === undefined || mainVal === '' || mainVal.indexOf(searchVal) > -1){ + return true; + } + return false; +} + +/** + * Replace object if undefined + */ +function replaceUndefinedColumnValue (text) { + if (text == undefined || text === "undefined") { + return ""; + } else { + return text; + } +} + +/** + * Convert string to study date + */ +function convertStringToStudyDate (dateStr) { + var y = dateStr.substring(0,4); + var m = dateStr.substring(4,6); + var d = dateStr.substring(6,8); + var newDateStr = y+"/"+m+"/"+d; + return new Date(newDateStr); +} + +/** + * Runs a search for studies matching the worklist query parameters + * Inserts the identified studies into the Studies Collection + */ +function search() { + // Create the filters to be used for the Worklist Search + var filter = { + patientName: getFilter($('#patientName').val()), + patientId: getFilter($('#patientId').val()), + accessionNumber: getFilter($('#patientAccessionNumber').val()) + }; + + // Make sure that modality has a reasonable value, since it is occasionally + // returned as 'undefined' + var modality = replaceUndefinedColumnValue($('#modality').val()); + + // Clear all current studies + WorklistStudies.remove({}); + + Meteor.call('WorklistSearch', filter, function(error, studies) { + if (!studies) { + return; + } + + // Loop through all identified studies + studies.forEach(function(study) { + + // Search the rest of the parameters that aren't done via the server call + if(isIndexOf(study.modalities, modality) && + (new Date(studyDateFrom).setHours(0,0,0,0) <= convertStringToStudyDate(study.studyDate) || !checkFrom) && + (convertStringToStudyDate(study.studyDate) <= new Date(studyDateTo).setHours(0,0,0,0) || !checkTo)) { + + // Insert any matching studies into the Studies Collection + WorklistStudies.insert(study); + } + }); + }); + +} + +Template.worklistResult.events({ + 'search': function(event) { + search(); + }, + 'onsearch': function(event) { + search(); + } +}); \ No newline at end of file diff --git a/Packages/worklist/package.js b/Packages/worklist/package.js index 6b6448573..10eecb5d1 100644 --- a/Packages/worklist/package.js +++ b/Packages/worklist/package.js @@ -42,10 +42,6 @@ Package.onUse(function (api) { api.addFiles('components/worklistResult/worklistResult.js', 'client'); api.addFiles('components/worklistResult/worklistResult.styl', 'client'); - api.addFiles('components/worklistSearch/worklistSearch.html', 'client'); - api.addFiles('components/worklistSearch/worklistSearch.js', 'client'); - api.addFiles('components/worklistSearch/worklistSearch.styl', 'client'); - api.addFiles('lib/generateUUID.js', 'client'); api.export('generateUUID', 'client');
Patient NamePatient IDAccession #Study DateModalityStudy Description# Images +
+ Patient Name +
+
+ +
+
+
+ Patient ID +
+
+ +
+
+
+ Accession # +
+
+ +
+
+
+ Study Date +
+
+ +
+
+
+ Modality +
+
+ +
+
+
+ StudyDescription +
+
+ +
+
+
+ # Images +
+
+ +
+