changeset 2597:ef7ba1b21d58 jobs

integration mainline->jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 May 2018 14:40:05 +0200
parents 56770d54d13a (current diff) 42ac291f7b3f (diff)
children 34dc57f4a7d2
files NEWS OrthancExplorer/explorer.html OrthancExplorer/explorer.js
diffstat 3 files changed, 138 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed May 16 14:34:06 2018 +0200
+++ b/NEWS	Wed May 16 14:40:05 2018 +0200
@@ -6,6 +6,11 @@
 
 * New advanced job engine
 
+Orthanc Explorer
+----------------
+
+* New screen listing all the available studies
+
 REST API
 --------
 
--- a/OrthancExplorer/explorer.html	Wed May 16 14:34:06 2018 +0200
+++ b/OrthancExplorer/explorer.html	Wed May 16 14:40:05 2018 +0200
@@ -37,8 +37,9 @@
     <div data-role="page" id="find-patients" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>Find a patient</h1>
-        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left"> 
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
           <a href="#plugins" data-icon="grid" data-role="button" data-direction="reverse">Plugins</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
         </div>
         <div data-type="horizontal" data-role="controlgroup" class="ui-btn-right"> 
           <a href="#upload" data-icon="gear" data-role="button">Upload</a>
@@ -52,10 +53,31 @@
       </div>
     </div>
 
-    <div data-role="page" id="upload" >
+    <div data-role="page" id="find-studies" >
+      <div data-role="header" >
+	<h1><span class="orthanc-name"></span>Find a study</h1>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#plugins" data-icon="grid" data-role="button" data-direction="reverse">Plugins</a>
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+        </div>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-right"> 
+          <a href="#upload" data-icon="gear" data-role="button">Upload</a>
+          <a href="#query-retrieve" data-icon="search" data-role="button">Query/Retrieve</a>
+        </div>
+      </div>
+      <div data-role="content">
+        <ul id="all-studies" data-role="listview" data-inset="true" data-filter="true">
+        </ul>
+      </div>
+    </div>
+
+    <div data-role="page" id="upload">
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>Upload DICOM files</h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
       </div>
       <div data-role="content">
         <div style="display:none">
@@ -81,7 +103,10 @@
     <div data-role="page" id="patient" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>Patient</h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
         <div data-type="horizontal" data-role="controlgroup" class="ui-btn-right"> 
           <a href="#upload" data-icon="gear" data-role="button">Upload</a>
           <a href="#query-retrieve" data-icon="search" data-role="button">Query/Retrieve</a>
@@ -138,7 +163,10 @@
           <a href="#" class="patient-link">Patient</a> &raquo; 
           Study
         </h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
         <div data-type="horizontal" data-role="controlgroup" class="ui-btn-right"> 
           <a href="#upload" data-icon="gear" data-role="button">Upload</a>
           <a href="#query-retrieve" data-icon="search" data-role="button">Query/Retrieve</a>
@@ -189,8 +217,10 @@
           <a href="#" class="study-link">Study</a> &raquo; 
           Series
         </h1>
-
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
         <div data-type="horizontal" data-role="controlgroup" class="ui-btn-right"> 
           <a href="#upload" data-icon="gear" data-role="button">Upload</a>
           <a href="#query-retrieve" data-icon="search" data-role="button">Query/Retrieve</a>
@@ -243,7 +273,10 @@
           <a href="#" class="series-link">Series</a> &raquo; 
           Instance
         </h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
         <div data-type="horizontal" data-role="controlgroup" class="ui-btn-right"> 
           <a href="#upload" data-icon="gear" data-role="button">Upload</a>
           <a href="#query-retrieve" data-icon="search" data-role="button">Query/Retrieve</a>
@@ -295,7 +328,10 @@
     <div data-role="page" id="plugins" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>Plugins</h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
       </div>
       <div data-role="content">
         <ul id="all-plugins" data-role="listview" data-inset="true" data-filter="true">
@@ -306,7 +342,10 @@
     <div data-role="page" id="query-retrieve" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>DICOM Query/Retrieve (1/4)</h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
       </div>
       <div data-role="content">
         <form data-ajax="false">
@@ -373,7 +412,10 @@
     <div data-role="page" id="query-retrieve-2" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>DICOM Query/Retrieve (2/4)</h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
         <a href="#query-retrieve" data-icon="search" class="ui-btn-right" data-direction="reverse">Query/Retrieve</a>
       </div>
       <div data-role="content">
@@ -386,7 +428,10 @@
     <div data-role="page" id="query-retrieve-3" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>DICOM Query/Retrieve (3/4)</h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
         <a href="#query-retrieve" data-icon="search" class="ui-btn-right" data-direction="reverse">Query/Retrieve</a>
       </div>
       <div data-role="content">
@@ -399,7 +444,10 @@
     <div data-role="page" id="query-retrieve-4" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>DICOM Query/Retrieve (4/4)</h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
         <a href="#query-retrieve" data-icon="search" class="ui-btn-right" data-direction="reverse">Query/Retrieve</a>
       </div>
 
@@ -425,7 +473,10 @@
     <div data-role="page" id="jobs" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>Jobs</h1>
-        <a href="#find-patients" data-icon="home" class="ui-btn-left" data-direction="reverse">Patients</a>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
+          <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
       </div>
       <div data-role="content">
         <ul id="all-jobs" data-role="listview" data-inset="true" data-filter="true">
@@ -436,8 +487,11 @@
     <div data-role="page" id="job" >
       <div data-role="header" >
 	<h1><span class="orthanc-name"></span>Job</h1>
-        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left"> 
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-left">
           <a href="#find-patients" data-icon="home" data-role="button" data-direction="reverse">Patients</a>
+          <a href="#find-studies" data-icon="arrow-r" data-role="button" data-direction="reverse">Studies</a>
+        </div>
+        <div data-type="horizontal" data-role="controlgroup" class="ui-btn-right"> 
           <a href="#jobs" data-icon="refresh" data-role="button" data-direction="reverse">Jobs</a>
         </div>
       </div>
--- a/OrthancExplorer/explorer.js	Wed May 16 14:34:06 2018 +0200
+++ b/OrthancExplorer/explorer.js	Wed May 16 14:40:05 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');
   });
 });