Mercurial > hg > orthanc
diff OrthancExplorer/explorer.js @ 2594:7fbe3f024ac9
new screen in OrthancExplorer to list studies
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 16 May 2018 14:32:16 +0200 |
parents | a95beca72e99 |
children | ef7ba1b21d58 |
line wrap: on
line diff
--- a/OrthancExplorer/explorer.js Tue May 15 11:23:25 2018 +0200 +++ b/OrthancExplorer/explorer.js Wed May 16 14:32:16 2018 +0200 @@ -264,15 +264,29 @@ -function FormatStudy(study, link, isReverse) +function FormatStudy(study, link, isReverse, includePatient) { - var node = $('<div>').append($('<h3>').text(study.MainDicomTags.StudyDescription)); + var label; + + if (includePatient) { + label = study.Label; + } else { + label = study.MainDicomTags.StudyDescription; + } + var node = $('<div>').append($('<h3>').text(label)); + + if (includePatient) { + FormatMainDicomTags(node, study.PatientMainDicomTags, [ + 'PatientName' + ]); + } + FormatMainDicomTags(node, study.MainDicomTags, [ - "StudyDescription", - "StudyTime" + 'StudyDescription', + 'StudyTime' ]); - + return CompleteFormatting(node, link, isReverse, study.Series.length); } @@ -348,17 +362,55 @@ $('#find-patients').live('pagebeforeshow', function() { GetResource('/patients?expand', function(patients) { - var target = $('#all-patients'); - $('li', target).remove(); + var target = $('#all-patients'); + $('li', target).remove(); - SortOnDicomTag(patients, 'PatientName', false, false); + SortOnDicomTag(patients, 'PatientName', false, false); + + for (var i = 0; i < patients.length; i++) { + var p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID); + target.append(p); + } + + target.listview('refresh'); + }); +}); + + - for (var i = 0; i < patients.length; i++) { - var p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID); - target.append(p); +$('#find-studies').live('pagebeforeshow', function() { + GetResource('/studies?expand', function(studies) { + var target = $('#all-studies'); + $('li', target).remove(); + + for (var i = 0; i < studies.length; i++) { + var patient = studies[i].PatientMainDicomTags.PatientName; + var study = studies[i].MainDicomTags.StudyDescription; + + var s; + if (typeof patient === 'string') { + s = patient; } - target.listview('refresh'); + if (typeof study === 'string') { + if (s.length > 0) { + s += ' - '; + } + + s += study; + } + + studies[i]['Label'] = s; + } + + Sort(studies, function(a) { return a.Label }, false, false); + + for (var i = 0; i < studies.length; i++) { + var p = FormatStudy(studies[i], '#study?uuid=' + studies[i].ID, false, true); + target.append(p); + } + + target.listview('refresh'); }); });