diff OrthancServer/OrthancExplorer/query-retrieve.js @ 4760:b2417ac5055a openssl-3.x

integration mainline->openssl-3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 21 Jul 2021 10:48:14 +0200
parents f0038043fb97 72a850947b11
children 2e71a08eea15
line wrap: on
line diff
--- a/OrthancServer/OrthancExplorer/query-retrieve.js	Thu Jul 08 14:58:18 2021 +0200
+++ b/OrthancServer/OrthancExplorer/query-retrieve.js	Wed Jul 21 10:48:14 2021 +0200
@@ -19,6 +19,11 @@
  **/
 
 
+function IsoToDicomDate(s)
+{
+  return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10);
+}
+
 function GenerateDicomDate(days)
 {
   var today = new Date();
@@ -36,8 +41,7 @@
   var timezoneOffset = today.getTimezoneOffset() * 60 * 1000;
   var localDate = new Date(utc.getTime() - timezoneOffset);
   
-  var s = localDate.toISOString();
-  return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10);
+  return IsoToDicomDate(localDate.toISOString());
 }
 
 
@@ -73,7 +77,19 @@
   targetDate.append($('<option>').attr('value', GenerateDicomDate(-31) + '-').text('Last 31 days'));
   targetDate.append($('<option>').attr('value', GenerateDicomDate(-31 * 3) + '-').text('Last 3 months'));
   targetDate.append($('<option>').attr('value', GenerateDicomDate(-365) + '-').text('Last year'));
+  targetDate.append($('<option>').attr('value', 'specific').text('Specific date'));
   targetDate.selectmenu('refresh');
+
+  $('#qr-date-specific').hide();
+});
+
+
+$('#qr-date').live('change', function() {
+  if ($(this).val() == 'specific') {
+    $('#qr-date-specific').show();
+  } else {
+    $('#qr-date-specific').hide();
+  }
 });
 
 
@@ -108,7 +124,12 @@
 
 
 $('#qr-submit').live('click', function() {
-  var query, server, modalities, field;
+  var query, server, modalities, field, studyDate;
+
+  studyDate = $('#qr-date').val();
+  if (studyDate == 'specific') {
+    studyDate = IsoToDicomDate($('#qr-date-specific').val());
+  }
 
   query = {
     'Level' : 'Study',
@@ -118,7 +139,7 @@
       'PatientID' : '',
       'PatientName' : '',
       'PatientSex' : '',
-      'StudyDate' : $('#qr-date').val(),
+      'StudyDate' : studyDate,
       'StudyDescription' : ''
     }
   };