diff --git a/Packages/worklist/client/components/worklistResult/worklistResult.html b/Packages/worklist/client/components/worklistResult/worklistResult.html index c92ffc86b..31ea706ef 100644 --- a/Packages/worklist/client/components/worklistResult/worklistResult.html +++ b/Packages/worklist/client/components/worklistResult/worklistResult.html @@ -3,40 +3,62 @@ -
Patient Name
+ + Patient Name + + -
Patient ID
+ + Patient ID + + {{#unless isTouchDevice}} -
Accession #
+ + Accession # + + {{/unless}} -
Study Date
- + + Study Date + + + + {{#unless isTouchDevice}} -
Modality
+ + Modality + + {{/unless}} -
Study Description
+ + Study Description + + {{#unless isTouchDevice}} -
# Images
+ + # Images + + {{/unless}} diff --git a/Packages/worklist/client/components/worklistResult/worklistResult.js b/Packages/worklist/client/components/worklistResult/worklistResult.js index 7604e62ee..6cc893dfe 100644 --- a/Packages/worklist/client/components/worklistResult/worklistResult.js +++ b/Packages/worklist/client/components/worklistResult/worklistResult.js @@ -6,6 +6,13 @@ Template.worklistResult.helpers({ * by Patient name and Study Date in Ascending order. */ studies: function() { + var sortOption = Template.instance().sortOption.get(); + if (sortOption) { + return WorklistStudies.find({}, { + sort: sortOption + }); + } + return WorklistStudies.find({}, { sort: { patientName: 1, @@ -20,7 +27,14 @@ Template.worklistResult.helpers({ showNotFoundMessage: function() { return Session.get("searchResults").showNotFoundMessage; + }, + sortingColumnsIcons: function() { + var sortingColumnsIcons = {}; + Object.keys(Template.instance().sortingColumns.keys).forEach(function(key) { + sortingColumnsIcons[key] = Template.instance().sortingColumns.get(key) === 1 ? "fa fa-sort-up": (Template.instance().sortingColumns.get(key) === -1 ? "fa fa-sort-down":""); + }); + return sortingColumnsIcons; } }); @@ -126,6 +140,10 @@ function search() { if (isIndexOf(study.modalities, modality) && (new Date(studyDateFrom).setHours(0, 0, 0, 0) <= convertStringToStudyDate(study.studyDate) || !studyDateFrom || studyDateFrom === "") && (convertStringToStudyDate(study.studyDate) <= new Date(studyDateTo).setHours(0, 0, 0, 0) || !studyDateTo || studyDateTo === "")) { + + // Convert numberOfStudyRelatedInstance string into integer + study.numberOfStudyRelatedInstances = parseInt(study.numberOfStudyRelatedInstances); + // Insert any matching studies into the WorklistStudies Collection WorklistStudies.insert(study); } @@ -143,6 +161,11 @@ function search() { } Template.worklistResult.onCreated(function() { + this.sortOption = new ReactiveVar(); + this.sortingColumns = new ReactiveDict(); + this.sortingColumns.set('patientName', 1); + this.sortingColumns.set('studyDate', 1); + var self = this; if (Worklist.subscriptions) { Worklist.subscriptions.forEach(function(collectionName) { @@ -162,6 +185,14 @@ Template.worklistResult.onRendered(function() { }); }); +function resetSortingColumns(template, sortingColumn) { + Object.keys(template.sortingColumns.keys).forEach(function(key) { + if (key !== sortingColumn) { + template.sortingColumns.set(key, null); + } + }); +} + Template.worklistResult.events({ 'keydown input': function(e) { if (e.which === 13) { // Enter @@ -184,6 +215,26 @@ Template.worklistResult.events({ if (dateRange !== "") { search(); } + }, + + 'click a.sortingCell': function(e, template) { + var elementId = e.currentTarget.id; + // Remove _ from id + var columnName = elementId.replace("_", ''); + + var sortOption= {}; + resetSortingColumns(template, columnName); + var columnObject = template.sortingColumns.get(columnName); + if (columnObject) { + template.sortingColumns.set(columnName, columnObject * -1); + sortOption[columnName] = columnObject * -1; + } else { + template.sortingColumns.set(columnName, 1); + sortOption[columnName] = 1; + } + + template.sortOption.set(sortOption); } + }); diff --git a/Packages/worklist/client/components/worklistResult/worklistResult.styl b/Packages/worklist/client/components/worklistResult/worklistResult.styl index 32a1bc298..a438012de 100644 --- a/Packages/worklist/client/components/worklistResult/worklistResult.styl +++ b/Packages/worklist/client/components/worklistResult/worklistResult.styl @@ -7,6 +7,27 @@ table#tblStudyList background-color: black white-space: nowrap + tr + th + a.sortingCell + display: inline-block + width: 100% + margin: 0 auto + color: white + text-decoration: none + padding-bottom: 5px + + span + font-size: 15px + float: left + + i + float: right + margin-left: 5px + + #studyDate + padding: 0 + &:hover color: #888888