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");
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">
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
) {
43 if(type
== "diagnosis")
44 list = "diagnosis_list";
45 else if(type
== "drugs")
47 else if(type
== "immunizations")
48 list = "immunization_list";
51 var elSel
= document
.getElementById(list);
53 for (i
=0;p
[i
]!=null;i++
)
55 for(k
=0;k
<elSel
.length
;k++
)
57 if((elSel
.options
[k
].value
)==p
[i
])
62 var elOptNew
= document
.createElement('option');
64 elOptNew
.value
= p
[i
];
66 elSel
.add(elOptNew
, null); // standards compliant; doesn't work in IE
69 elSel
.add(elOptNew
); // IE only
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
)
90 if(type
== "diagnosis")
91 list = "diagnosis_list";
92 else if(type
== "drugs")
94 else if(type
== "immunizations")
95 list = "immunization_list";
96 var elSel
= document
.getElementById(list);
98 for (i
= elSel
.length
- 1; i
>=0; i
--) {
99 if (elSel
.options
[i
].selected
)
107 function show_value(type
)
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";
123 var elSel
= document
.getElementById(list);
125 for (i
= elSel
.length
- 1; i
>=0; i
--)
128 str
= elSel
.options
[i
].value
;
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
;
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;
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;
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');?>");
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');?>");
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');?>");
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');?>");
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');?>");
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();
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();
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
>
249 $row = sqlQuery("SHOW TABLES LIKE 'de_identification_status'");
253 <table
> <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
254 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
256 <table
class="de_identification_status_message" align
="center" >
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
>
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
> 
;</td
> <td
> 
;</td
> </tr
>
297 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
299 <table
class="de_identification_status_message" align
="center" >
304 <?php
echo xl('De Identification Process is ongoing');
306 echo xl('Please visit De Identification screen after some time');
307 echo "</br>"; ?
> <br
>
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
> 
;</td
> <td
> 
;</td
> </tr
>
338 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
340 <table
class="de_identification_status_message" align
="center" >
346 <?php
echo xl('No Patient record found for given Selection criteria');
348 echo xl('Please start new De Identification process');
349 echo "</br>"; ?
> </br
>
353 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
355 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
358 <table align
="center">
359 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
365 <table
> <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
366 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
368 <table
class="de_identification_status_message" align
="center" >
373 <?php
echo xl('De Identification Process is completed');
375 echo xl('Please Click download button to download the De Identified data');
376 echo "</br>"; ?
> <br
>
380 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
381 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
383 <table align
="center">
384 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
386 <td colspan
="2" class="style1">
387 <input type
="button" name
="Download" value
=<?php
echo xl("Download");?
> onclick
="download_file()" ></td
>
393 else if($deIdentificationStatus == 3)
395 //3 - The De Identification process completed with error
397 <table
> <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
398 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
400 <table
class="de_identification_status_message" align
="center" >
405 <?php
echo xl('Some error has occured during De Identification Process');
407 echo xl('De Identified data may not be complete');
409 ?
><span
class="text"><?php
echo xl('Please view De Identification error log table for more details');
410 echo "</br>"; ?
></span
> <br
>
414 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
415 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
417 <table align
="center">
418 <tr
> <td
> 
;</td
> <td
> 
;</td
> </tr
>
420 <td colspan
="2" class="style1">
421 <input type
="button" name
="Download" value
=<?php
echo xl("Download Anyway");?
> onclick
="download_file()"></td
>
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;">
435 <table style
="width: 74%" border
=0>
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'); ?>"> 
;
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'); ?>">
450 <td
> 
;</td
> </tr
>
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
>
457 <table
class="de_identification_input_controls_box">
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
>
464 <input type
="checkbox" name
="prescriptions" id
="prescriptions" value
="prescriptions"><span
class="text"><?php
xl('Prescriptions','e'); ?
></span
>
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
>
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
/>
489 <table style
="width: 100%">
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%">
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%">
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')"> 
; </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')">
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%">
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')">
537 <td colspan
="2" class="style1">
538 <input type
="submit" name
="Submit" value
=<?php
echo xl("Submit"); ?
> ></td
>
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">
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"});