Add back popup dialogs for tabs U.I. (#1434)
[openemr.git] / interface / de_identification_forms / de_identification_screen1.php
blob69d09724319d2c0b38d74a6b360c786a2829d8d3
1 <?php
2 /**
3 * de_identification script
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author ViCarePlus, Visolve <vicareplus_engg@visolve.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2010 ViCarePlus, Visolve <vicareplus_engg@visolve.com>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("$srcdir/lists.inc");
16 require_once("$srcdir/patient.inc");
17 require_once("$srcdir/acl.inc");
18 require_once("$srcdir/options.inc.php");
21 <html>
22 <head>
23 <title><?php xl('De Identification', 'e'); ?></title>
24 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
25 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
27 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
28 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
29 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
30 <style type="text/css">
31 .style1 {
32 text-align: center;
33 }</style>
35 <script language="JavaScript">
36 //get value from popup window
37 function set_related(s,type) {
38 var list;
39 if(type == "diagnosis")
40 list = "diagnosis_list";
41 else if(type == "drugs")
42 list = "drug_list";
43 else if(type == "immunizations")
44 list = "immunization_list";
46 var p=s.split("#");
47 var elSel = document.getElementById(list);
48 var i,k;
49 for (i=0;p[i]!=null;i++)
51 for(k=0;k<elSel.length;k++)
53 if((elSel.options[k].value)==p[i])
54 p[i]= " ";
56 if(p[i]!= " ")
58 var elOptNew = document.createElement('option');
59 elOptNew.text = p[i];
60 elOptNew.value = p[i];
61 try {
62 elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
64 catch(ex) {
65 elSel.add(elOptNew); // IE only
69 show_value(type);
72 function get_values(type)
74 if(type == "diagnosis")
75 dlgopen('find_code_popup.php', '_blank', 500, 400,true);
76 else if(type == "drugs")
77 dlgopen('find_drug_popup.php', '_blank', 500, 400,true);
78 else if(type == "immunizations")
79 dlgopen('find_immunization_popup.php', '_blank', 500, 400,true);
82 //remove item selected from list
83 function remove_selected(type)
85 var list;
86 if(type == "diagnosis")
87 list = "diagnosis_list";
88 else if(type == "drugs")
89 list = "drug_list";
90 else if(type == "immunizations")
91 list = "immunization_list";
92 var elSel = document.getElementById(list);
93 var i;
94 for (i = elSel.length - 1; i>=0; i--) {
95 if (elSel.options[i].selected)
97 elSel.remove(i);
100 show_value(type);
103 function show_value(type)
105 var list,text,radio;
106 if(type == "diagnosis")
107 { radio = "diagnosis"; list = "diagnosis_list"; text="diagnosis_text"; }
108 else if(type == "drugs")
109 { radio = "drugs"; list = "drug_list"; text="drug_text"; }
110 else if(type == "immunizations")
111 { radio = "immunizations"; list = "immunization_list"; text="immunization_text"; }
112 if(document.getElementById(radio) == "all")
114 document.getElementById(text).value="all";
116 else
118 var str;
119 var elSel = document.getElementById(list);
120 var i;
121 for (i = elSel.length - 1; i>=0; i--)
123 if(!str)
124 str = elSel.options[i].value;
125 else
126 str = str +"#"+elSel.options[i].value;
129 document.getElementById(text).value=str;
133 //disable - enable other checkbox when all checkbox is clicked
134 function disable_other_chkbox()
136 var value = document.forms[0].all.checked;
137 if(value == 1)
139 document.forms[0].history_data.disabled = true;
140 document.forms[0].prescriptions.disabled = true;
141 document.forms[0].lists.disabled = true;
142 document.forms[0].immunization.disabled = true;
143 document.forms[0].transactions.disabled = true;
144 document.forms[0].billing_data.disabled = true;
145 document.forms[0].insurance_data.disabled = true;
147 else
149 document.forms[0].history_data.disabled = false;
150 document.forms[0].prescriptions.disabled = false;
151 document.forms[0].lists.disabled = false;
152 document.forms[0].immunization.disabled = false;
153 document.forms[0].transactions.disabled = false;
154 document.forms[0].billing_data.disabled = false;
155 document.forms[0].insurance_data.disabled = false;
159 //disable list,add button,remove button when all option is selected
160 function disable_controls(type)
162 var list,button1,button2;
163 if(type == "diagnosis")
164 { button1 = "add_diagnosis"; button2 = "remove_diagnosis"; list = "diagnosis_list"; text="diagnosis_text"; }
165 else if(type == "drugs")
166 { button1 = "add_drug"; button2 = "remove_drug"; list = "drug_list"; text="drug_text";}
167 else if(type == "immunizations")
168 { button1 = "add_immunization"; button2 = "remove_immunization"; list = "immunization_list"; text="immunization_text"; }
169 document.getElementById(button1).disabled = true;
170 document.getElementById(button2).disabled = true;
171 document.getElementById(list).disabled = true;
172 document.getElementById(text).value = "all";
175 function enable_controls(type)
177 var list,button1,button2;
178 if(type == "diagnosis")
179 { button1 = "add_diagnosis"; button2 = "remove_diagnosis"; list = "diagnosis_list"; }
180 else if(type == "drugs")
181 { button1 = "add_drug"; button2 = "remove_drug"; list = "drug_list"; }
182 else if(type == "immunizations")
183 { button1 = "add_immunization"; button2 = "remove_immunization"; list = "immunization_list";
185 document.getElementById(button1).disabled = false;
186 document.getElementById(button2).disabled = false;
187 document.getElementById(list).disabled = false;
188 show_value(type);
192 function form_validate()
194 if(document.forms[0].begin_date.value >= document.forms[0].end_date.value)
196 alert("<?php echo xl('End date should be greater than Begin date');?>");
197 return false;
200 if(document.forms[0].all.checked == false &&
201 document.forms[0].history_data.checked == false &&
202 document.forms[0].prescriptions.checked == false &&
203 document.forms[0].immunization.checked == false &&
204 document.forms[0].lists.checked == false &&
205 document.forms[0].transactions.checked == false &&
206 document.forms[0].billing_data.checked == false &&
207 document.forms[0].insurance_data.checked == false)
209 alert("<?php echo xl('Select Data Required for De Identification');?>");
210 return false;
213 if(document.forms[0].diagnosis_text.value == "undefined" || document.forms[0].diagnosis_text.value == "")
215 alert("<?php echo xl('Select Diagnosis for De Identification request');?>");
216 return false;
218 if(document.forms[0].drug_text.value == "undefined" || document.forms[0].drug_text.value == "")
220 alert("<?php echo xl('Select Drugs for De Identification request');?>");
221 return false;
223 if(document.forms[0].immunization_text.value == "undefined" || document.forms[0].immunization_text.value == "")
225 alert("<?php echo xl('Select Immunizations for De Identification request');?>");
226 return false;
228 alert("<?php echo xl('De Identification process is started and running in background');
229 echo '\n';
230 echo xl('Please visit the screen after some time');?>");
231 top.restoreSession();
232 return true;
235 function download_file()
237 alert("<?php echo xl('De-identification files will be saved in');
238 echo ' `'.$GLOBALS['temporary_files_dir'].'` ';
239 echo xl('location of the openemr machine and may contain sensitive data, so it is recommended to manually delete the files after its use');?>");
240 document.de_identification.submit();
243 $(document).ready(function(){
244 $('.datepicker').datetimepicker({
245 <?php $datetimepicker_timepicker = false; ?>
246 <?php $datetimepicker_showseconds = false; ?>
247 <?php $datetimepicker_formatInput = false; ?>
248 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
249 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
253 </script>
254 </head>
255 <body class="body_top">
256 <form name="de_identification" id="de_identification" action="de_identification_screen2.php" method="post" onsubmit="return form_validate();">
257 <strong><?php xl('De Identification', 'e'); ?></strong>
258 <?php
259 $row = sqlQuery("SHOW TABLES LIKE 'de_identification_status'");
260 if (empty($row)) {
262 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
263 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
264 </table>
265 <table class="de_identification_status_message" align="center" >
266 <tr valign="top">
267 <td>&nbsp;</td>
268 <td rowspan="3">
269 <br>
270 <?php echo xl('Please upgrade OpenEMR Database to include De Identification procedures, function, tables'); ?>
271 </br></br><a target="Blank" href="../../contrib/util/de_identification_upgrade.php"><?php echo xl('Click here');?></a>
272 <?php echo xl('to run');
273 echo " de_identification_upgrade.php</br>";?><br>
274 </td>
275 <td>&nbsp;</td>
276 </tr>
277 <tr>
278 <td>&nbsp;</td>
279 <td>&nbsp;</td>
280 </tr>
281 <tr>
282 <td>&nbsp;</td>
283 <td>&nbsp;</td>
284 </tr>
285 </table>
286 <?php
287 } else {
288 $query = "select status from de_identification_status";
289 $res = sqlStatement($query);
290 if ($row = sqlFetchArray($res)) {
291 $deIdentificationStatus = addslashes($row['status']);
292 /* $deIdentificationStatus:
293 * 0 - There is no De Identification in progress. (start new De Identification process)
294 * 1 - A De Identification process is currently in progress.
295 * 2 - The De Identification process completed and xls file is ready to download
296 * 3 - The De Identification process completed with error
300 if ($deIdentificationStatus == 1) {
301 //1 - A De Identification process is currently in progress.
303 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
304 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
305 </table>
306 <table class="de_identification_status_message" align="center" >
307 <tr valign="top">
308 <td>&nbsp;</td>
309 <td rowspan="3">
310 <br>
311 <?php echo xl('De Identification Process is ongoing');
312 echo "</br></br>";
313 echo xl('Please visit De Identification screen after some time');
314 echo "</br>"; ?> <br>
315 </td>
316 <td>&nbsp;</td>
317 </tr>
318 <tr>
319 <td>&nbsp;</td>
320 <td>&nbsp;</td>
321 </tr>
322 <tr>
323 <td>&nbsp;</td>
324 <td>&nbsp;</td>
325 </tr>
326 </table>
327 <?php
328 } else if ($deIdentificationStatus == 2) {
329 //2 - The De Identification process completed and xls file is ready to download
330 $query = "SELECT count(*) as count FROM de_identified_data ";
331 $res = sqlStatement($query);
332 if ($row = sqlFetchArray($res)) {
333 $no_of_items = addslashes($row['count']);
336 if ($no_of_items <= 1) {
337 //start new search - no patient record fount
338 $query = "update de_identification_status set status = 0";
339 $res = sqlStatement($query);
341 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
342 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
343 </table>
344 <table class="de_identification_status_message" align="center" >
345 <tr valign="top">
347 <td>&nbsp;</td>
348 <td rowspan="3">
349 <br>
350 <?php echo xl('No Patient record found for given Selection criteria');
351 echo "</br></br>";
352 echo xl('Please start new De Identification process');
353 echo "</br>"; ?> </br>
354 </td>
355 <td>&nbsp;</td>
356 </tr>
357 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
359 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
360 </table>
362 <table align="center">
363 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
364 </table>
365 <?php
366 } else {
368 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
369 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
370 </table>
371 <table class="de_identification_status_message" align="center" >
372 <tr valign="top">
373 <td>&nbsp;</td>
374 <td rowspan="3">
375 <br>
376 <?php echo xl('De Identification Process is completed');
377 echo "</br></br>";
378 echo xl('Please Click download button to download the De Identified data');
379 echo "</br>"; ?> <br>
380 </td>
381 <td>&nbsp;</td>
382 </tr>
383 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
384 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
385 </table>
386 <table align="center">
387 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
388 <tr>
389 <td colspan="2" class="style1">
390 <input type="button" name="Download" value=<?php echo xl("Download");?> onclick="download_file()" ></td>
391 </tr>
392 </table>
393 <?php
395 } else if ($deIdentificationStatus == 3) {
396 //3 - The De Identification process completed with error
398 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
399 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
400 </table>
401 <table class="de_identification_status_message" align="center" >
402 <tr valign="top">
403 <td>&nbsp;</td>
404 <td rowspan="3">
405 <br>
406 <?php echo xl('Some error has occured during De Identification Process');
407 echo "</br></br>";
408 echo xl('De Identified data may not be complete');
409 echo "</br></br>";
410 ?><span class="text"><?php echo xl('Please view De Identification error log table for more details');
411 echo "</br>"; ?></span> <br>
412 </td>
413 <td>&nbsp;</td>
414 </tr>
415 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
416 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
417 </table>
418 <table align="center">
419 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
420 <tr>
421 <td colspan="2" class="style1">
422 <input type="button" name="Download" value=<?php echo xl("Download Anyway");?> onclick="download_file()"></td>
423 </tr>
424 </table>
425 </tr>
426 </table>
428 <?php
431 if ($deIdentificationStatus == 0) {
432 //0 - There is no De Identification in progress. (start new De Identification process)
434 <div id="overDiv" style="position: absolute; visibility: hidden; z-index: 1000;">
435 </div>
436 <table style="width: 74%" border=0>
437 <tr rowspan=2>
438 <td>&nbsp;</td>
439 <td><span class="text"><?php xl('Begin Date', 'e'); ?></span>
440 <input type="text" size="10" class="datepicker" name="begin_date" id="begin_date" value="<?php echo $viewmode ? substr($result['date'], 0, 10) : date('Y-m-d'); ?>" title="<?php xl('yyyy-mm-dd Date of service', 'e'); ?>" />
441 </td>
442 <td><span class="text"><?php xl('End Date', 'e'); ?></span>
443 <input type="text" size="10" class="datepicker" name="end_date" id="end_date" value="<?php echo $viewmode ? substr($result['date'], 0, 10) : date('Y-m-d'); ?>" title="<?php xl('yyyy-mm-dd Date of service', 'e'); ?>" />
444 </td>
445 <td>&nbsp;</td>
446 <td>&nbsp;</td>
447 </tr>
448 <tr>
449 <td>&nbsp;</td> </tr>
450 <tr><td>&nbsp;</td>
451 <td colspan=2 class="de_identification_input_controls_box"><input type="checkbox" name="unstructured" id="unstructured" value=<?php echo xl("unstructured");?>><span class="text"><?php xl('Include Unstructured data', 'e'); ?></span></td>
452 <td>&nbsp;</td></tr>
453 <tr>
454 <td>&nbsp;</td>
455 <td colspan="2">
456 <table class="de_identification_input_controls_box">
457 <tr>
458 <td><span class="text"><?php xl('Select data to be included in De Identified data', 'e'); ?></span> <br />
459 <input type="checkbox" name="all" id ="all" value='all' onclick="disable_other_chkbox()"><span class="text"><?php xl('All', 'e'); ?> </span><br />
460 <input type="checkbox" name="history_data" id="history_data" value='history_data'><span class="text"><?php xl('History Data', 'e'); ?></span> <br />
461 <input type="checkbox" name="immunization" id="immunization" value="immunizations"><span class="text"><?php xl('Immunizations', 'e'); ?></span>
462 <br />
463 <input type="checkbox" name="prescriptions" id="prescriptions" value="prescriptions"><span class="text"><?php xl('Prescriptions', 'e'); ?></span>
465 &nbsp;</td> <br />
466 <td><br>
467 <input type="checkbox" name="lists" id="lists" value="lists"><span class="text"><?php xl('Issues', 'e'); ?> </span><br />
468 <input type="checkbox" name="transactions" id="transactions" value="transactions"><span class="text"><?php xl('Transactions', 'e'); ?></span>
469 <br />
470 <input type="checkbox" name="insurance_data" id="insurance_data" value="insurance_data"><span class="text"><?php xl('Insurance Data', 'e'); ?> </span><br />
471 <input type="checkbox" name="billing_data" id="billing_data" value="billing_data"><span class="text"><?php xl('Billing Data', 'e'); ?></span> <br />
473 &nbsp;</td>
474 </tr>
475 </table>
476 </td>
477 <td>&nbsp;</td>
478 </tr>
479 <tr>
480 <td>&nbsp;</td>
481 <td colspan="2"><br>
482 </td>
483 <td>&nbsp;</td>
484 </tr>
485 <tr>
486 <td>&nbsp;</td>
487 <td colspan="3">
488 <table style="width: 100%">
489 <tr valign="top">
490 <!--diagnosis--><td style="width:50%;" class="style1"><span class="text"><?php xl('Enter Diagnosis', 'e'); ?></span>
491 <input type="radio" id="diagnosis" name="diagnosis" value="all" onclick="disable_controls('diagnosis');" /><span class="text"> <?php xl('All', 'e'); ?></span>
492 <input type="radio" id="diagnosis" name="diagnosis" value="select_diagnosis" onclick="enable_controls('diagnosis');" />
493 <span class="text"><?php xl('Select Diagnosis', 'e'); ?></span>
494 <select id="diagnosis_list" name="diagnosis_list" size="10" style="width: 60%">
495 </select>
497 </td>
498 <td style="width:50%;" class="style1">
499 <!--drugs--><span class="text"><?php xl('Enter Drugs', 'e'); ?></span>
500 <input type="radio" id="drugs" name="drugs" value="all"); onclick="disable_controls('drugs')"/><span class="text"> <?php xl('All', 'e'); ?></span>
501 <input type="radio" id="drugs" name="drugs" value="select_drug" onclick="enable_controls('drugs')" />
502 <span class="text"><?php xl('Select Drugs', 'e'); ?> <br></span>
503 <select id="drug_list" name="drug_list" size="10" style="width: 60%">
504 </select>
506 </td>
507 </tr>
508 <tr> <td class="style1">
509 <input type="button" name="add_diagnosis" id = "add_diagnosis" value=<?php echo xl("Add Diagnosis"); ?> onclick="get_values('diagnosis')">
510 <input type="button" name="remove_diagnosis" id="remove_diagnosis"value=<?php echo xl("Remove"); ?> onclick="remove_selected('diagnosis')">&nbsp; </td> <td class="style1">
511 <input type="button" name="add_drug" id="add_drug" value=<?php echo xl("Add Drug"); ?> onclick="get_values('drugs')">
512 <input type="button" name="remove_drug" id="remove_drug" value=<?php echo xl("Remove"); ?> onclick="remove_selected('drugs')">
513 </td> </tr>
514 </table>
515 </td>
516 <td>&nbsp;</td>
517 </tr>
518 <tr>
519 <td>&nbsp;</td>
520 <td colspan="2" class="style1">
521 <!--immunizations--><br>
522 <span class="text"><?php xl('Enter Immunizations', 'e'); ?></span>
523 <input type="radio" id="immunizations" name="immunizations" value="all" onclick="disable_controls('immunizations')"/><span class="text"> <?php xl('All', 'e'); ?></span>
524 <input type="radio" id="immunizations" name="immunizations" value="select_immunization" onclick="enable_controls('immunizations')" />
525 <span class="text"><?php xl('Select Immunizations', 'e'); ?></span> <br>
526 <select id="immunization_list" name="immunization_list" size="10" width="300" style="width: 30%">
527 </select> <br>
528 <input type="button" name="add_immunization" id="add_immunization" value=<?php echo xl("Add Immunization"); ?> onclick="get_values('immunizations')">
529 <input type="button" name="remove_immunization" id="remove_immunization" value=<?php echo xl("Remove"); ?> onclick="remove_selected('immunizations')">
530 <br>
531 &nbsp;</td>
532 <td>&nbsp;</td>
533 </tr>
534 <tr>
535 <td>&nbsp;</td>
536 <td colspan="2" class="style1">
537 <input type="submit" name="Submit" value=<?php echo xl("Submit"); ?> ></td>
538 <td>&nbsp;</td>
539 </tr>
541 <input type="hidden" name="diagnosis_text" id="diagnosis_text"><br>
542 <input type="hidden" name="drug_text" id="drug_text"><br>
543 <input type="hidden" name="immunization_text" id="immunization_text">
544 </table>
545 <?php
550 </form>
551 </body>
552 </html>