Inline worklist query filtering (per Armin's feedback)
This commit is contained in:
parent
292edc11d3
commit
73a95b6e22
@ -10,7 +10,6 @@
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="worklistTab">
|
||||
<div id="worklistContainer" class="container">
|
||||
{{> worklistSearch }}
|
||||
{{> worklistResult }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -3,19 +3,62 @@
|
||||
<table id="tblStudyList" class="table table-striped noselect">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Patient Name</th>
|
||||
<th>Patient ID</th>
|
||||
{{#unless isTouchDevice}}
|
||||
<th>Accession #</th>
|
||||
{{/unless}}
|
||||
<th>Study Date</th>
|
||||
{{#unless isTouchDevice}}
|
||||
<th>Modality</th>
|
||||
{{/unless}}
|
||||
<th>Study Description</th>
|
||||
{{#unless isTouchDevice}}
|
||||
<th># Images</th>
|
||||
{{/unless}}
|
||||
<th>
|
||||
<div>
|
||||
Patient Name
|
||||
</div>
|
||||
<div class="patient-name-input">
|
||||
<input type="search" class="form-control worklist-search" id="patientName">
|
||||
</div>
|
||||
</th>
|
||||
<th>
|
||||
<div>
|
||||
Patient ID
|
||||
</div>
|
||||
<div class="patientid-input">
|
||||
<input type="search" class="form-control worklist-search" id="patientId">
|
||||
</div>
|
||||
</th>
|
||||
<th>
|
||||
<div>
|
||||
Accession #
|
||||
</div>
|
||||
<div class="worklist-input">
|
||||
<input type="search" class="form-control worklist-search" id="accessionNumber">
|
||||
</div>
|
||||
</th>
|
||||
<th>
|
||||
<div>
|
||||
Study Date
|
||||
</div>
|
||||
<div class="worklist-input">
|
||||
<input type="search" class="form-control worklist-search" id="studyDate">
|
||||
</div>
|
||||
</th>
|
||||
<th>
|
||||
<div>
|
||||
Modality
|
||||
</div>
|
||||
<div class="modality-input">
|
||||
<input type="search" class="form-control worklist-search" id="modality">
|
||||
</div>
|
||||
</th>
|
||||
<th>
|
||||
<div>
|
||||
StudyDescription
|
||||
</div>
|
||||
<div class="study-description-input">
|
||||
<input type="search" class="form-control worklist-search" id="studyDescription">
|
||||
</div>
|
||||
</th>
|
||||
<th>
|
||||
<div>
|
||||
# Images
|
||||
</div>
|
||||
<div class="worklist-input">
|
||||
<input type="search" class="form-control worklist-search" id="numberOfImages">
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="studyListData">
|
||||
|
||||
@ -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();
|
||||
}
|
||||
});
|
||||
@ -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');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user