added new datepicker to amendments gui
[openemr.git] / interface / de_identification_forms / de_identification_screen1.php
blobdbaecf81468851d74849e4c1d248b55d8510574a
1 <?php
2 /********************************************************************************\
3 * Copyright (C) ViCarePlus, Visolve (vicareplus_engg@visolve.com) *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 \********************************************************************************/
19 require_once("../globals.php");
20 require_once("$srcdir/lists.inc");
21 require_once("$srcdir/patient.inc");
22 require_once("$srcdir/acl.inc");
23 require_once("$srcdir/options.inc.php");
26 <html>
27 <head>
28 <title><?php xl('De Identification','e'); ?></title>
29 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
30 <link rel="stylesheet" href='<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.css' type='text/css'>
31 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
32 <style type="text/css">
33 .style1 {
34 text-align: center;
35 }</style>
36 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script>
37 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_en.js"></script>
38 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script>
39 <script language="JavaScript">
40 //get value from popup window
41 function set_related(s,type) {
42 var list;
43 if(type == "diagnosis")
44 list = "diagnosis_list";
45 else if(type == "drugs")
46 list = "drug_list";
47 else if(type == "immunizations")
48 list = "immunization_list";
50 var p=s.split("#");
51 var elSel = document.getElementById(list);
52 var i,k;
53 for (i=0;p[i]!=null;i++)
55 for(k=0;k<elSel.length;k++)
57 if((elSel.options[k].value)==p[i])
58 p[i]= " ";
60 if(p[i]!= " ")
62 var elOptNew = document.createElement('option');
63 elOptNew.text = p[i];
64 elOptNew.value = p[i];
65 try {
66 elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
68 catch(ex) {
69 elSel.add(elOptNew); // IE only
73 show_value(type);
76 function get_values(type)
78 if(type == "diagnosis")
79 dlgopen('find_code_popup.php', '_blank', 500, 400,true);
80 else if(type == "drugs")
81 dlgopen('find_drug_popup.php', '_blank', 500, 400,true);
82 else if(type == "immunizations")
83 dlgopen('find_immunization_popup.php', '_blank', 500, 400,true);
86 //remove item selected from list
87 function remove_selected(type)
89 var list;
90 if(type == "diagnosis")
91 list = "diagnosis_list";
92 else if(type == "drugs")
93 list = "drug_list";
94 else if(type == "immunizations")
95 list = "immunization_list";
96 var elSel = document.getElementById(list);
97 var i;
98 for (i = elSel.length - 1; i>=0; i--) {
99 if (elSel.options[i].selected)
101 elSel.remove(i);
104 show_value(type);
107 function show_value(type)
109 var list,text,radio;
110 if(type == "diagnosis")
111 { radio = "diagnosis"; list = "diagnosis_list"; text="diagnosis_text"; }
112 else if(type == "drugs")
113 { radio = "drugs"; list = "drug_list"; text="drug_text"; }
114 else if(type == "immunizations")
115 { radio = "immunizations"; list = "immunization_list"; text="immunization_text"; }
116 if(document.getElementById(radio) == "all")
118 document.getElementById(text).value="all";
120 else
122 var str;
123 var elSel = document.getElementById(list);
124 var i;
125 for (i = elSel.length - 1; i>=0; i--)
127 if(!str)
128 str = elSel.options[i].value;
129 else
130 str = str +"#"+elSel.options[i].value;
133 document.getElementById(text).value=str;
137 //disable - enable other checkbox when all checkbox is clicked
138 function disable_other_chkbox()
140 var value = document.forms[0].all.checked;
141 if(value == 1)
143 document.forms[0].history_data.disabled = true;
144 document.forms[0].prescriptions.disabled = true;
145 document.forms[0].lists.disabled = true;
146 document.forms[0].immunization.disabled = true;
147 document.forms[0].transactions.disabled = true;
148 document.forms[0].billing_data.disabled = true;
149 document.forms[0].insurance_data.disabled = true;
151 else
153 document.forms[0].history_data.disabled = false;
154 document.forms[0].prescriptions.disabled = false;
155 document.forms[0].lists.disabled = false;
156 document.forms[0].immunization.disabled = false;
157 document.forms[0].transactions.disabled = false;
158 document.forms[0].billing_data.disabled = false;
159 document.forms[0].insurance_data.disabled = false;
163 //disable list,add button,remove button when all option is selected
164 function disable_controls(type)
166 var list,button1,button2;
167 if(type == "diagnosis")
168 { button1 = "add_diagnosis"; button2 = "remove_diagnosis"; list = "diagnosis_list"; text="diagnosis_text"; }
169 else if(type == "drugs")
170 { button1 = "add_drug"; button2 = "remove_drug"; list = "drug_list"; text="drug_text";}
171 else if(type == "immunizations")
172 { button1 = "add_immunization"; button2 = "remove_immunization"; list = "immunization_list"; text="immunization_text"; }
173 document.getElementById(button1).disabled = true;
174 document.getElementById(button2).disabled = true;
175 document.getElementById(list).disabled = true;
176 document.getElementById(text).value = "all";
179 function enable_controls(type)
181 var list,button1,button2;
182 if(type == "diagnosis")
183 { button1 = "add_diagnosis"; button2 = "remove_diagnosis"; list = "diagnosis_list"; }
184 else if(type == "drugs")
185 { button1 = "add_drug"; button2 = "remove_drug"; list = "drug_list"; }
186 else if(type == "immunizations")
187 { button1 = "add_immunization"; button2 = "remove_immunization"; list = "immunization_list";
189 document.getElementById(button1).disabled = false;
190 document.getElementById(button2).disabled = false;
191 document.getElementById(list).disabled = false;
192 show_value(type);
196 function form_validate()
198 if(document.forms[0].begin_date.value >= document.forms[0].end_date.value)
200 alert("<?php echo xl('End date should be greater than Begin date');?>");
201 return false;
204 if(document.forms[0].all.checked == false &&
205 document.forms[0].history_data.checked == false &&
206 document.forms[0].prescriptions.checked == false &&
207 document.forms[0].immunization.checked == false &&
208 document.forms[0].lists.checked == false &&
209 document.forms[0].transactions.checked == false &&
210 document.forms[0].billing_data.checked == false &&
211 document.forms[0].insurance_data.checked == false)
213 alert("<?php echo xl('Select Data Required for De Identification');?>");
214 return false;
217 if(document.forms[0].diagnosis_text.value == "undefined" || document.forms[0].diagnosis_text.value == "")
219 alert("<?php echo xl('Select Diagnosis for De Identification request');?>");
220 return false;
222 if(document.forms[0].drug_text.value == "undefined" || document.forms[0].drug_text.value == "")
224 alert("<?php echo xl('Select Drugs for De Identification request');?>");
225 return false;
227 if(document.forms[0].immunization_text.value == "undefined" || document.forms[0].immunization_text.value == "")
229 alert("<?php echo xl('Select Immunizations for De Identification request');?>");
230 return false;
232 alert("<?php echo xl('De Identification process is started and running in background'); echo '\n'; echo xl('Please visit the screen after some time');?>");
233 top.restoreSession();
234 return true;
237 function download_file()
239 alert("<?php echo xl('De-identification files will be saved in'); echo ' `'.$GLOBALS['temporary_files_dir'].'` '; 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 </script>
244 </head>
245 <body class="body_top">
246 <form name="de_identification" id="de_identification" action="de_identification_screen2.php" method="post" onsubmit="return form_validate();">
247 <strong><?php xl('De Identification','e'); ?></strong>
248 <?php
249 $row = sqlQuery("SHOW TABLES LIKE 'de_identification_status'");
250 if (empty($row))
253 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
254 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
255 </table>
256 <table class="de_identification_status_message" align="center" >
257 <tr valign="top">
258 <td>&nbsp;</td>
259 <td rowspan="3">
260 <br>
261 <?php echo xl('Please upgrade OpenEMR Database to include De Identification procedures, function, tables'); ?>
262 </br></br><a target="Blank" href="../../contrib/util/de_identification_upgrade.php"><?php echo xl('Click here');?></a>
263 <?php echo xl('to run');
264 echo " de_identification_upgrade.php</br>";?><br>
265 </td>
266 <td>&nbsp;</td>
267 </tr>
268 <tr>
269 <td>&nbsp;</td>
270 <td>&nbsp;</td>
271 </tr>
272 <tr>
273 <td>&nbsp;</td>
274 <td>&nbsp;</td>
275 </tr>
276 </table>
277 <?php
279 else {
280 $query = "select status from de_identification_status";
281 $res = sqlStatement($query);
282 if ($row = sqlFetchArray($res))
284 $deIdentificationStatus = addslashes($row['status']);
285 /* $deIdentificationStatus:
286 * 0 - There is no De Identification in progress. (start new De Identification process)
287 * 1 - A De Identification process is currently in progress.
288 * 2 - The De Identification process completed and xls file is ready to download
289 * 3 - The De Identification process completed with error
292 if($deIdentificationStatus == 1)
294 //1 - A De Identification process is currently in progress.
296 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
297 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
298 </table>
299 <table class="de_identification_status_message" align="center" >
300 <tr valign="top">
301 <td>&nbsp;</td>
302 <td rowspan="3">
303 <br>
304 <?php echo xl('De Identification Process is ongoing');
305 echo "</br></br>";
306 echo xl('Please visit De Identification screen after some time');
307 echo "</br>"; ?> <br>
308 </td>
309 <td>&nbsp;</td>
310 </tr>
311 <tr>
312 <td>&nbsp;</td>
313 <td>&nbsp;</td>
314 </tr>
315 <tr>
316 <td>&nbsp;</td>
317 <td>&nbsp;</td>
318 </tr>
319 </table>
320 <?php
322 else if($deIdentificationStatus == 2)
324 //2 - The De Identification process completed and xls file is ready to download
325 $query = "SELECT count(*) as count FROM de_identified_data ";
326 $res = sqlStatement($query);
327 if ($row = sqlFetchArray($res))
329 $no_of_items = addslashes($row['count']);
331 if($no_of_items <= 1)
333 //start new search - no patient record fount
334 $query = "update de_identification_status set status = 0";
335 $res = sqlStatement($query);
337 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
338 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
339 </table>
340 <table class="de_identification_status_message" align="center" >
341 <tr valign="top">
343 <td>&nbsp;</td>
344 <td rowspan="3">
345 <br>
346 <?php echo xl('No Patient record found for given Selection criteria');
347 echo "</br></br>";
348 echo xl('Please start new De Identification process');
349 echo "</br>"; ?> </br>
350 </td>
351 <td>&nbsp;</td>
352 </tr>
353 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
355 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
356 </table>
358 <table align="center">
359 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
360 </table>
361 <?php
363 else {
365 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
366 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
367 </table>
368 <table class="de_identification_status_message" align="center" >
369 <tr valign="top">
370 <td>&nbsp;</td>
371 <td rowspan="3">
372 <br>
373 <?php echo xl('De Identification Process is completed');
374 echo "</br></br>";
375 echo xl('Please Click download button to download the De Identified data');
376 echo "</br>"; ?> <br>
377 </td>
378 <td>&nbsp;</td>
379 </tr>
380 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
381 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
382 </table>
383 <table align="center">
384 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
385 <tr>
386 <td colspan="2" class="style1">
387 <input type="button" name="Download" value=<?php echo xl("Download");?> onclick="download_file()" ></td>
388 </tr>
389 </table>
390 <?php
393 else if($deIdentificationStatus == 3)
395 //3 - The De Identification process completed with error
397 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
398 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
399 </table>
400 <table class="de_identification_status_message" align="center" >
401 <tr valign="top">
402 <td>&nbsp;</td>
403 <td rowspan="3">
404 <br>
405 <?php echo xl('Some error has occured during De Identification Process');
406 echo "</br></br>";
407 echo xl('De Identified data may not be complete');
408 echo "</br></br>";
409 ?><span class="text"><?php echo xl('Please view De Identification error log table for more details');
410 echo "</br>"; ?></span> <br>
411 </td>
412 <td>&nbsp;</td>
413 </tr>
414 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
415 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
416 </table>
417 <table align="center">
418 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
419 <tr>
420 <td colspan="2" class="style1">
421 <input type="button" name="Download" value=<?php echo xl("Download Anyway");?> onclick="download_file()"></td>
422 </tr>
423 </table>
424 </tr>
425 </table>
427 <?php
429 if($deIdentificationStatus == 0 )
431 //0 - There is no De Identification in progress. (start new De Identification process)
433 <div id="overDiv" style="position: absolute; visibility: hidden; z-index: 1000;">
434 </div>
435 <table style="width: 74%" border=0>
436 <tr rowspan=2>
437 <td>&nbsp;</td>
438 <td><span class="text"><?php xl('Begin Date','e'); ?></span>
439 <input type="text" size="10" 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'); ?>" onkeyup="datekeyup(this,mypcc)" onblur="dateblur(this,mypcc)" />
440 <img src="../pic/show_calendar.gif" align="absbottom" width="24" height="22" id="img_begin_date" border="0" alt="[?]" style="cursor: pointer; cursor: hand" title="<?php xl('Click here to choose a date','e'); ?>">&nbsp;
441 </td>
442 <td><span class="text"><?php xl('End Date','e'); ?></span>
443 <input type="text" size="10" 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'); ?>" onkeyup="datekeyup(this,mypcc)" onblur="dateblur(this,mypcc)" />
444 <img src="../pic/show_calendar.gif" align="absbottom" width="24" height="22" id="img_end_date" border="0" alt="[?]" style="cursor: pointer; cursor: hand" title="<?php xl('Click here to choose a date','e'); ?>">
445 </td>
446 <td>&nbsp;</td>
447 <td>&nbsp;</td>
448 </tr>
449 <tr>
450 <td>&nbsp;</td> </tr>
451 <tr><td>&nbsp;</td>
452 <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>
453 <td>&nbsp;</td></tr>
454 <tr>
455 <td>&nbsp;</td>
456 <td colspan="2">
457 <table class="de_identification_input_controls_box">
458 <tr>
459 <td><span class="text"><?php xl('Select data to be included in De Identified data','e'); ?></span> <br />
460 <input type="checkbox" name="all" id ="all" value='all' onclick="disable_other_chkbox()"><span class="text"><?php xl('All','e'); ?> </span><br />
461 <input type="checkbox" name="history_data" id="history_data" value='history_data'><span class="text"><?php xl('History Data','e'); ?></span> <br />
462 <input type="checkbox" name="immunization" id="immunization" value="immunizations"><span class="text"><?php xl('Immunizations','e'); ?></span>
463 <br />
464 <input type="checkbox" name="prescriptions" id="prescriptions" value="prescriptions"><span class="text"><?php xl('Prescriptions','e'); ?></span>
466 &nbsp;</td> <br />
467 <td><br>
468 <input type="checkbox" name="lists" id="lists" value="lists"><span class="text"><?php xl('Issues','e'); ?> </span><br />
469 <input type="checkbox" name="transactions" id="transactions" value="transactions"><span class="text"><?php xl('Transactions','e'); ?></span>
470 <br />
471 <input type="checkbox" name="insurance_data" id="insurance_data" value="insurance_data"><span class="text"><?php xl('Insurance Data','e'); ?> </span><br />
472 <input type="checkbox" name="billing_data" id="billing_data" value="billing_data"><span class="text"><?php xl('Billing Data','e'); ?></span> <br />
474 &nbsp;</td>
475 </tr>
476 </table>
477 </td>
478 <td>&nbsp;</td>
479 </tr>
480 <tr>
481 <td>&nbsp;</td>
482 <td colspan="2"><br>
483 </td>
484 <td>&nbsp;</td>
485 </tr>
486 <tr>
487 <td>&nbsp;</td>
488 <td colspan="3">
489 <table style="width: 100%">
490 <tr valign="top">
491 <!--diagnosis--><td style="width:50%;" class="style1"><span class="text"><?php xl('Enter Diagnosis','e'); ?></span>
492 <input type="radio" id="diagnosis" name="diagnosis" value="all" onclick="disable_controls('diagnosis');" /><span class="text"> <?php xl('All','e'); ?></span>
493 <input type="radio" id="diagnosis" name="diagnosis" value="select_diagnosis" onclick="enable_controls('diagnosis');" />
494 <span class="text"><?php xl('Select Diagnosis','e'); ?></span>
495 <select id="diagnosis_list" name="diagnosis_list" size="10" style="width: 60%">
496 </select>
498 </td>
499 <td style="width:50%;" class="style1">
500 <!--drugs--><span class="text"><?php xl('Enter Drugs','e'); ?></span>
501 <input type="radio" id="drugs" name="drugs" value="all"); onclick="disable_controls('drugs')"/><span class="text"> <?php xl('All','e'); ?></span>
502 <input type="radio" id="drugs" name="drugs" value="select_drug" onclick="enable_controls('drugs')" />
503 <span class="text"><?php xl('Select Drugs','e'); ?> <br></span>
504 <select id="drug_list" name="drug_list" size="10" style="width: 60%">
505 </select>
507 </td>
508 </tr>
509 <tr> <td class="style1">
510 <input type="button" name="add_diagnosis" id = "add_diagnosis" value=<?php echo xl("Add Diagnosis"); ?> onclick="get_values('diagnosis')">
511 <input type="button" name="remove_diagnosis" id="remove_diagnosis"value=<?php echo xl("Remove"); ?> onclick="remove_selected('diagnosis')">&nbsp; </td> <td class="style1">
512 <input type="button" name="add_drug" id="add_drug" value=<?php echo xl("Add Drug"); ?> onclick="get_values('drugs')">
513 <input type="button" name="remove_drug" id="remove_drug" value=<?php echo xl("Remove"); ?> onclick="remove_selected('drugs')">
514 </td> </tr>
515 </table>
516 </td>
517 <td>&nbsp;</td>
518 </tr>
519 <tr>
520 <td>&nbsp;</td>
521 <td colspan="2" class="style1">
522 <!--immunizations--><br>
523 <span class="text"><?php xl('Enter Immunizations','e'); ?></span>
524 <input type="radio" id="immunizations" name="immunizations" value="all" onclick="disable_controls('immunizations')"/><span class="text"> <?php xl('All','e'); ?></span>
525 <input type="radio" id="immunizations" name="immunizations" value="select_immunization" onclick="enable_controls('immunizations')" />
526 <span class="text"><?php xl('Select Immunizations','e'); ?></span> <br>
527 <select id="immunization_list" name="immunization_list" size="10" width="300" style="width: 30%">
528 </select> <br>
529 <input type="button" name="add_immunization" id="add_immunization" value=<?php echo xl("Add Immunization"); ?> onclick="get_values('immunizations')">
530 <input type="button" name="remove_immunization" id="remove_immunization" value=<?php echo xl("Remove"); ?> onclick="remove_selected('immunizations')">
531 <br>
532 &nbsp;</td>
533 <td>&nbsp;</td>
534 </tr>
535 <tr>
536 <td>&nbsp;</td>
537 <td colspan="2" class="style1">
538 <input type="submit" name="Submit" value=<?php echo xl("Submit"); ?> ></td>
539 <td>&nbsp;</td>
540 </tr>
542 <input type="hidden" name="diagnosis_text" id="diagnosis_text"><br>
543 <input type="hidden" name="drug_text" id="drug_text"><br>
544 <input type="hidden" name="immunization_text" id="immunization_text">
545 </table>
546 <script language='JavaScript'>
547 /* required for popup calendar */
548 Calendar.setup({inputField:"begin_date", ifFormat:"%Y-%m-%d", button:"img_begin_date"});
549 Calendar.setup({inputField:"end_date", ifFormat:"%Y-%m-%d", button:"img_end_date"});
550 </script>
551 <?php
556 </form>
557 </body>
558 </html>