LT-64: Study list shall have click-to-sort column headings (ascending, descending)
This commit is contained in:
parent
efa236f4cd
commit
57c645a6c8
@ -3,40 +3,62 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<h5>Patient Name</h5>
|
||||
<a id="_patientName" class="sortingCell" href="#">
|
||||
<span>Patient Name</span>
|
||||
<i class="{{sortingColumnsIcons.patientName}}"></i>
|
||||
</a>
|
||||
<input type="text" class="form-control worklist-search" id="patientName">
|
||||
</th>
|
||||
<th>
|
||||
<h5>Patient ID</h5>
|
||||
<a id="_patientId" class="sortingCell" href="#">
|
||||
<span>Patient ID</span>
|
||||
<i class="{{sortingColumnsIcons.patientId}}"></i>
|
||||
</a>
|
||||
<input type="text" class="form-control worklist-search" id="patientId">
|
||||
</th>
|
||||
|
||||
{{#unless isTouchDevice}}
|
||||
<th>
|
||||
<h5>Accession #</h5>
|
||||
<a id="_accessionNumber" class="sortingCell" href="#">
|
||||
<span>Accession #</span>
|
||||
<i class="{{sortingColumnsIcons.accessionNumber}}"></i>
|
||||
</a>
|
||||
<input type="text" class="form-control worklist-search" id="accessionNumber">
|
||||
</th>
|
||||
{{/unless}}
|
||||
|
||||
<th>
|
||||
<h5>Study Date</h5>
|
||||
<input type="text" class="form-control worklist-search" name="daterange" id="studyDate" style="padding: 0;">
|
||||
<a id="_studyDate" class="sortingCell" href="#">
|
||||
<span>Study Date</span>
|
||||
<i class="{{sortingColumnsIcons.studyDate}}"></i>
|
||||
</a>
|
||||
<input type="text" class="form-control worklist-search" name="daterange" id="studyDate">
|
||||
|
||||
</th>
|
||||
|
||||
{{#unless isTouchDevice}}
|
||||
<th>
|
||||
<h5>Modality</h5>
|
||||
<a id="_modalities" class="sortingCell" href="#">
|
||||
<span>Modality</span>
|
||||
<i class="{{sortingColumnsIcons.modalities}}"></i>
|
||||
</a>
|
||||
<input type="text" class="form-control worklist-search" id="modality">
|
||||
</th>
|
||||
{{/unless}}
|
||||
<th>
|
||||
<h5>Study Description</h5>
|
||||
<a id="_studyDescription" class="sortingCell" href="#">
|
||||
<span>Study Description</span>
|
||||
<i class="{{sortingColumnsIcons.studyDescription}}"></i>
|
||||
</a>
|
||||
<input type="text" class="form-control worklist-search" id="studyDescription">
|
||||
</th>
|
||||
|
||||
{{#unless isTouchDevice}}
|
||||
<th>
|
||||
<h5># Images</h5>
|
||||
<a id="_numberOfStudyRelatedInstances" class="sortingCell" href="#">
|
||||
<span># Images</span>
|
||||
<i class="{{sortingColumnsIcons.numberOfStudyRelatedInstances}}"></i>
|
||||
</a>
|
||||
<input type="text" class="form-control worklist-search" id="numImages">
|
||||
</th>
|
||||
{{/unless}}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user