2 /********************************************************************************\
3 * Copyright (C) ViCarePlus, Visolve (vicareplus_engg@visolve.com) *
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. *
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. *
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");
24 require_once("$srcdir/translation.inc.php");
29 <title
><?php
xl('De Identification','e'); ?
></title
>
30 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
31 <link rel
="stylesheet" href
='<?php echo $GLOBALS['webroot
'] ?>/library/dynarch_calendar.css' type
='text/css'>
32 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script
>
33 <style type
="text/css">
37 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script
>
38 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_en.js"></script
>
39 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script
>
40 <script language
="JavaScript">
41 //get value from popup window
42 function set_related(s
,type
) {
44 if(type
== "diagnosis")
45 list = "diagnosis_list";
46 else if(type
== "drugs")
48 else if(type
== "immunizations")
49 list = "immunization_list";
52 var elSel
= document
.getElementById(list);
54 for (i
=0;p
[i
]!=null;i++
)
56 for(k
=0;k
<elSel
.length
;k++
)
58 if((elSel
.options
[k
].value
)==p
[i
])
63 var elOptNew
= document
.createElement('option');
65 elOptNew
.value
= p
[i
];
67 elSel
.add(elOptNew
, null); // standards compliant; doesn't work in IE
70 elSel
.add(elOptNew
); // IE only
77 function get_values(type
)
79 if(type
== "diagnosis")
80 dlgopen('find_code_popup.php', '_blank', 500, 400);
81 else if(type
== "drugs")
82 dlgopen('find_drug_popup.php', '_blank', 500, 400);
83 else if(type
== "immunizations")
84 dlgopen('find_immunization_popup.php', '_blank', 500, 400);
87 //remove item selected from list
88 function remove_selected(type
)
91 if(type
== "diagnosis")
92 list = "diagnosis_list";
93 else if(type
== "drugs")
95 else if(type
== "immunizations")
96 list = "immunization_list";
97 var elSel
= document
.getElementById(list);
99 for (i
= elSel
.length
- 1; i
>=0; i
--) {
100 if (elSel
.options
[i
].selected
)
108 function show_value(type
)
111 if(type
== "diagnosis")
112 { radio
= "diagnosis"; list = "diagnosis_list"; text
="diagnosis_text"; }
113 else if(type
== "drugs")
114 { radio
= "drugs"; list = "drug_list"; text
="drug_text"; }
115 else if(type
== "immunizations")
116 { radio
= "immunizations"; list = "immunization_list"; text
="immunization_text"; }
117 if(document
.getElementById(radio
) == "all")
119 document
.getElementById(text
).value
="all";
124 var elSel
= document
.getElementById(list);
126 for (i
= elSel
.length
- 1; i
>=0; i
--)
129 str
= elSel
.options
[i
].value
;
131 str
= str +
"#"+elSel
.options
[i
].value
;
134 document
.getElementById(text
).value
=str
;
138 //disable - enable other checkbox when all checkbox is clicked
139 function disable_other_chkbox()
141 var value
= document
.forms
[0].all
.checked
;
144 document
.forms
[0].history_data
.disabled
= true;
145 document
.forms
[0].prescriptions
.disabled
= true;
146 document
.forms
[0].lists
.disabled
= true;
147 document
.forms
[0].immunization
.disabled
= true;
148 document
.forms
[0].transactions
.disabled
= true;
149 document
.forms
[0].billing_data
.disabled
= true;
150 document
.forms
[0].insurance_data
.disabled
= true;
154 document
.forms
[0].history_data
.disabled
= false;
155 document
.forms
[0].prescriptions
.disabled
= false;
156 document
.forms
[0].lists
.disabled
= false;
157 document
.forms
[0].immunization
.disabled
= false;
158 document
.forms
[0].transactions
.disabled
= false;
159 document
.forms
[0].billing_data
.disabled
= false;
160 document
.forms
[0].insurance_data
.disabled
= false;
164 //disable list,add button,remove button when all option is selected
165 function disable_controls(type
)
167 var list,button1
,button2
;
168 if(type
== "diagnosis")
169 { button1
= "add_diagnosis"; button2
= "remove_diagnosis"; list = "diagnosis_list"; text
="diagnosis_text"; }
170 else if(type
== "drugs")
171 { button1
= "add_drug"; button2
= "remove_drug"; list = "drug_list"; text
="drug_text";}
172 else if(type
== "immunizations")
173 { button1
= "add_immunization"; button2
= "remove_immunization"; list = "immunization_list"; text
="immunization_text"; }
174 document
.getElementById(button1
).disabled
= true;
175 document
.getElementById(button2
).disabled
= true;
176 document
.getElementById(list).disabled
= true;
177 document
.getElementById(text
).value
= "all";
180 function enable_controls(type
)
182 var list,button1
,button2
;
183 if(type
== "diagnosis")
184 { button1
= "add_diagnosis"; button2
= "remove_diagnosis"; list = "diagnosis_list"; }
185 else if(type
== "drugs")
186 { button1
= "add_drug"; button2
= "remove_drug"; list = "drug_list"; }
187 else if(type
== "immunizations")
188 { button1
= "add_immunization"; button2
= "remove_immunization"; list = "immunization_list";
190 document
.getElementById(button1
).disabled
= false;
191 document
.getElementById(button2
).disabled
= false;
192 document
.getElementById(list).disabled
= false;
197 function form_validate()
199 if(document
.forms
[0].begin_date
.value
>= document
.forms
[0].end_date
.value
)
201 alert("<?php echo xl('End date should be greater than Begin date');?>");
205 if(document
.forms
[0].all
.checked
== false &&
206 document
.forms
[0].history_data
.checked
== false &&
207 document
.forms
[0].prescriptions
.checked
== false &&
208 document
.forms
[0].immunization
.checked
== false &&
209 document
.forms
[0].lists
.checked
== false &&
210 document
.forms
[0].transactions
.checked
== false &&
211 document
.forms
[0].billing_data
.checked
== false &&
212 document
.forms
[0].insurance_data
.checked
== false)
214 alert("<?php echo xl('Select Data Required for De Identification');?>");
218 if(document
.forms
[0].diagnosis_text
.value
== "undefined" || document
.forms
[0].diagnosis_text
.value
== "")
220 alert("<?php echo xl('Select Diagnosis for De Identification request');?>");
223 if(document
.forms
[0].drug_text
.value
== "undefined" || document
.forms
[0].drug_text
.value
== "")
225 alert("<?php echo xl('Select Drugs for De Identification request');?>");
228 if(document
.forms
[0].immunization_text
.value
== "undefined" || document
.forms
[0].immunization_text
.value
== "")
230 alert("<?php echo xl('Select Immunizations for De Identification request');?>");
233 alert("<?php echo xl('De Identification process is started and running in background'); echo '\n'; echo xl('Please visit the screen after some time');?>");
234 top
.restoreSession();
238 function download_file()
240 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');?>");
241 document
.de_identification
.submit();
246 <body
class="body_top">
247 <form name
="de_identification" id
="de_identification" action
="de_identification_screen2.php" method
="post" onsubmit
="return form_validate();">
248 <strong
><?php
xl('De Identification','e'); ?
></strong
>
250 $row = sqlQuery("SHOW TABLES LIKE 'de_identification_status'");
254 <table
> <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
255 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
257 <table
class="de_identification_status_message" align
="center" >
262 <?php
echo xl('Please upgrade OpenEMR Database to include De Identification procedures, function, tables'); ?
>
263 </br
></br
><a target
="Blank" href
="../../contrib/util/de_identification_upgrade.php"><?php
echo xl('Click here');?
></a
>
264 <?php
echo xl('to run');
265 echo " de_identification_upgrade.php</br>";?
><br
>
281 $query = "select status from de_identification_status";
282 $res = sqlStatement($query);
283 if ($row = sqlFetchArray($res))
285 $deIdentificationStatus = addslashes($row['status']);
286 /* $deIdentificationStatus:
287 * 0 - There is no De Identification in progress. (start new De Identification process)
288 * 1 - A De Identification process is currently in progress.
289 * 2 - The De Identification process completed and xls file is ready to download
290 * 3 - The De Identification process completed with error
293 if($deIdentificationStatus == 1)
295 //1 - A De Identification process is currently in progress.
297 <table
> <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
298 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
300 <table
class="de_identification_status_message" align
="center" >
305 <?php
echo xl('De Identification Process is ongoing');
307 echo xl('Please visit De Identification screen after some time');
308 echo "</br>"; ?
> <br
>
323 else if($deIdentificationStatus == 2)
325 //2 - The De Identification process completed and xls file is ready to download
326 $query = "SELECT count(*) as count FROM de_identified_data ";
327 $res = sqlStatement($query);
328 if ($row = sqlFetchArray($res))
330 $no_of_items = addslashes($row['count']);
332 if($no_of_items <= 1)
334 //start new search - no patient record fount
335 $query = "update de_identification_status set status = 0";
336 $res = sqlStatement($query);
338 <table
> <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
339 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
341 <table
class="de_identification_status_message" align
="center" >
347 <?php
echo xl('No Patient record found for given Selection criteria');
349 echo xl('Please start new De Identification process');
350 echo "</br>"; ?
> </br
>
354 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
356 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
359 <table align
="center">
360 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
366 <table
> <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
367 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
369 <table
class="de_identification_status_message" align
="center" >
374 <?php
echo xl('De Identification Process is completed');
376 echo xl('Please Click download button to download the De Identified data');
377 echo "</br>"; ?
> <br
>
381 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
382 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
384 <table align
="center">
385 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
387 <td colspan
="2" class="style1">
388 <input type
="button" name
="Download" value
=<?php
echo xl("Download");?
> onclick
="download_file()" ></td
>
394 else if($deIdentificationStatus == 3)
396 //3 - The De Identification process completed with error
398 <table
> <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
399 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
401 <table
class="de_identification_status_message" align
="center" >
406 <?php
echo xl('Some error has occured during De Identification Process');
408 echo xl('De Identified data may not be complete');
410 ?
><span
class="text"><?php
echo xl('Please view De Identification error log table for more details');
411 echo "</br>"; ?
></span
> <br
>
415 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
416 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
418 <table align
="center">
419 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
421 <td colspan
="2" class="style1">
422 <input type
="button" name
="Download" value
=<?php
echo xl("Download Anyway");?
> onclick
="download_file()"></td
>
430 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;">
436 <table style
="width: 74%" border
=0>
439 <td
><span
class="text"><?php
xl('Begin Date','e'); ?
></span
>
440 <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)" />
441 <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'); ?>"> 
;
443 <td
><span
class="text"><?php
xl('End Date','e'); ?
></span
>
444 <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)" />
445 <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'); ?>">
451 <td
> 
;</td
> </tr
>
453 <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
>
458 <table
class="de_identification_input_controls_box">
460 <td
><span
class="text"><?php
xl('Select data to be included in De Identified data','e'); ?
></span
> <br
/>
461 <input type
="checkbox" name
="all" id
="all" value
='all' onclick
="disable_other_chkbox()"><span
class="text"><?php
xl('All','e'); ?
> </span
><br
/>
462 <input type
="checkbox" name
="history_data" id
="history_data" value
='history_data'><span
class="text"><?php
xl('History Data','e'); ?
></span
> <br
/>
463 <input type
="checkbox" name
="immunization" id
="immunization" value
="immunizations"><span
class="text"><?php
xl('Immunizations','e'); ?
></span
>
465 <input type
="checkbox" name
="prescriptions" id
="prescriptions" value
="prescriptions"><span
class="text"><?php
xl('Prescriptions','e'); ?
></span
>
469 <input type
="checkbox" name
="lists" id
="lists" value
="lists"><span
class="text"><?php
xl('Issues','e'); ?
> </span
><br
/>
470 <input type
="checkbox" name
="transactions" id
="transactions" value
="transactions"><span
class="text"><?php
xl('Transactions','e'); ?
></span
>
472 <input type
="checkbox" name
="insurance_data" id
="insurance_data" value
="insurance_data"><span
class="text"><?php
xl('Insurance Data','e'); ?
> </span
><br
/>
473 <input type
="checkbox" name
="billing_data" id
="billing_data" value
="billing_data"><span
class="text"><?php
xl('Billing Data','e'); ?
></span
> <br
/>
490 <table style
="width: 100%">
492 <!--diagnosis
--><td style
="width:50%;" class="style1"><span
class="text"><?php
xl('Enter Diagnosis','e'); ?
></span
>
493 <input type
="radio" id
="diagnosis" name
="diagnosis" value
="all" onclick
="disable_controls('diagnosis');" /><span
class="text"> <?php
xl('All','e'); ?
></span
>
494 <input type
="radio" id
="diagnosis" name
="diagnosis" value
="select_diagnosis" onclick
="enable_controls('diagnosis');" />
495 <span
class="text"><?php
xl('Select Diagnosis','e'); ?
></span
>
496 <select id
="diagnosis_list" name
="diagnosis_list" size
="10" style
="width: 60%">
500 <td style
="width:50%;" class="style1">
501 <!--drugs
--><span
class="text"><?php
xl('Enter Drugs','e'); ?
></span
>
502 <input type
="radio" id
="drugs" name
="drugs" value
="all"); onclick
="disable_controls('drugs')"/><span
class="text"> <?php
xl('All','e'); ?
></span
>
503 <input type
="radio" id
="drugs" name
="drugs" value
="select_drug" onclick
="enable_controls('drugs')" />
504 <span
class="text"><?php
xl('Select Drugs','e'); ?
> <br
></span
>
505 <select id
="drug_list" name
="drug_list" size
="10" style
="width: 60%">
510 <tr
> <td
class="style1">
511 <input type
="button" name
="add_diagnosis" id
= "add_diagnosis" value
=<?php
echo xl("Add Diagnosis"); ?
> onclick
="get_values('diagnosis')">
512 <input type
="button" name
="remove_diagnosis" id
="remove_diagnosis"value
=<?php
echo xl("Remove"); ?
> onclick
="remove_selected('diagnosis')"> 
; </td
> <td
class="style1">
513 <input type
="button" name
="add_drug" id
="add_drug" value
=<?php
echo xl("Add Drug"); ?
> onclick
="get_values('drugs')">
514 <input type
="button" name
="remove_drug" id
="remove_drug" value
=<?php
echo xl("Remove"); ?
> onclick
="remove_selected('drugs')">
522 <td colspan
="2" class="style1">
523 <!--immunizations
--><br
>
524 <span
class="text"><?php
xl('Enter Immunizations','e'); ?
></span
>
525 <input type
="radio" id
="immunizations" name
="immunizations" value
="all" onclick
="disable_controls('immunizations')"/><span
class="text"> <?php
xl('All','e'); ?
></span
>
526 <input type
="radio" id
="immunizations" name
="immunizations" value
="select_immunization" onclick
="enable_controls('immunizations')" />
527 <span
class="text"><?php
xl('Select Immunizations','e'); ?
></span
> <br
>
528 <select id
="immunization_list" name
="immunization_list" size
="10" width
="300" style
="width: 30%">
530 <input type
="button" name
="add_immunization" id
="add_immunization" value
=<?php
echo xl("Add Immunization"); ?
> onclick
="get_values('immunizations')">
531 <input type
="button" name
="remove_immunization" id
="remove_immunization" value
=<?php
echo xl("Remove"); ?
> onclick
="remove_selected('immunizations')">
538 <td colspan
="2" class="style1">
539 <input type
="submit" name
="Submit" value
=<?php
echo xl("Submit"); ?
> ></td
>
543 <input type
="hidden" name
="diagnosis_text" id
="diagnosis_text"><br
>
544 <input type
="hidden" name
="drug_text" id
="drug_text"><br
>
545 <input type
="hidden" name
="immunization_text" id
="immunization_text">
547 <script language
='JavaScript'>
548 /* required for popup calendar */
549 Calendar
.setup({inputField
:"begin_date", ifFormat
:"%Y-%m-%d", button
:"img_begin_date"});
550 Calendar
.setup({inputField
:"end_date", ifFormat
:"%Y-%m-%d", button
:"img_end_date"});