comparison 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
comparison
equal deleted inserted replaced
4750:56ed4c11fc2a 4760:b2417ac5055a
17 * You should have received a copy of the GNU General Public License 17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/ 19 **/
20 20
21 21
22 function IsoToDicomDate(s)
23 {
24 return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10);
25 }
26
22 function GenerateDicomDate(days) 27 function GenerateDicomDate(days)
23 { 28 {
24 var today = new Date(); 29 var today = new Date();
25 var utc = new Date(today); 30 var utc = new Date(today);
26 utc.setDate(today.getDate() + days); 31 utc.setDate(today.getDate() + days);
34 * https://groups.google.com/g/orthanc-users/c/dK7EEPVpedk/m/DPtMRFnKAgAJ 39 * https://groups.google.com/g/orthanc-users/c/dK7EEPVpedk/m/DPtMRFnKAgAJ
35 **/ 40 **/
36 var timezoneOffset = today.getTimezoneOffset() * 60 * 1000; 41 var timezoneOffset = today.getTimezoneOffset() * 60 * 1000;
37 var localDate = new Date(utc.getTime() - timezoneOffset); 42 var localDate = new Date(utc.getTime() - timezoneOffset);
38 43
39 var s = localDate.toISOString(); 44 return IsoToDicomDate(localDate.toISOString());
40 return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10);
41 } 45 }
42 46
43 47
44 $('#query-retrieve').live('pagebeforeshow', function() { 48 $('#query-retrieve').live('pagebeforeshow', function() {
45 var targetDate; 49 var targetDate;
71 targetDate.append($('<option>').attr('value', GenerateDicomDate(-1)).text('Yesterday')); 75 targetDate.append($('<option>').attr('value', GenerateDicomDate(-1)).text('Yesterday'));
72 targetDate.append($('<option>').attr('value', GenerateDicomDate(-7) + '-').text('Last 7 days')); 76 targetDate.append($('<option>').attr('value', GenerateDicomDate(-7) + '-').text('Last 7 days'));
73 targetDate.append($('<option>').attr('value', GenerateDicomDate(-31) + '-').text('Last 31 days')); 77 targetDate.append($('<option>').attr('value', GenerateDicomDate(-31) + '-').text('Last 31 days'));
74 targetDate.append($('<option>').attr('value', GenerateDicomDate(-31 * 3) + '-').text('Last 3 months')); 78 targetDate.append($('<option>').attr('value', GenerateDicomDate(-31 * 3) + '-').text('Last 3 months'));
75 targetDate.append($('<option>').attr('value', GenerateDicomDate(-365) + '-').text('Last year')); 79 targetDate.append($('<option>').attr('value', GenerateDicomDate(-365) + '-').text('Last year'));
80 targetDate.append($('<option>').attr('value', 'specific').text('Specific date'));
76 targetDate.selectmenu('refresh'); 81 targetDate.selectmenu('refresh');
82
83 $('#qr-date-specific').hide();
84 });
85
86
87 $('#qr-date').live('change', function() {
88 if ($(this).val() == 'specific') {
89 $('#qr-date-specific').show();
90 } else {
91 $('#qr-date-specific').hide();
92 }
77 }); 93 });
78 94
79 95
80 $('#qr-echo').live('click', function() { 96 $('#qr-echo').live('click', function() {
81 var server = $('#qr-server').val(); 97 var server = $('#qr-server').val();
106 return false; 122 return false;
107 }); 123 });
108 124
109 125
110 $('#qr-submit').live('click', function() { 126 $('#qr-submit').live('click', function() {
111 var query, server, modalities, field; 127 var query, server, modalities, field, studyDate;
128
129 studyDate = $('#qr-date').val();
130 if (studyDate == 'specific') {
131 studyDate = IsoToDicomDate($('#qr-date-specific').val());
132 }
112 133
113 query = { 134 query = {
114 'Level' : 'Study', 135 'Level' : 'Study',
115 'Query' : { 136 'Query' : {
116 'AccessionNumber' : '', 137 'AccessionNumber' : '',
117 'PatientBirthDate' : '', 138 'PatientBirthDate' : '',
118 'PatientID' : '', 139 'PatientID' : '',
119 'PatientName' : '', 140 'PatientName' : '',
120 'PatientSex' : '', 141 'PatientSex' : '',
121 'StudyDate' : $('#qr-date').val(), 142 'StudyDate' : studyDate,
122 'StudyDescription' : '' 143 'StudyDescription' : ''
123 } 144 }
124 }; 145 };
125 146
126 modalities = ''; 147 modalities = '';