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 include_once("../../library/sql.inc");
25 $query = "SELECT status FROM re_identification_status";
26 $res = sqlStatement($query);
27 if ($row = sqlFetchArray($res))
29 $status = addslashes($row['status']);
31 * 0 - There is no Re Identification in progress. (start new Re Identification process)
32 * 1 - A Re Identification process is currently in progress.
33 * 2 - The Re Identification process completed and xls file is ready to download
38 //0 - There is no Re Identification in progress. (start new Re Identification process)
42 <title
><?php
xl('Re Identification','e'); ?
></title
>
43 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
44 <link rel
="stylesheet"
45 href
='<?php echo $GLOBALS['webroot
'] ?>/library/dynarch_calendar.css'
48 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
50 <style type
="text/css">
56 <body
class="body_top">
57 <strong
><?php
xl('Re Identification','e'); ?
></strong
>
59 style
="position: absolute; visibility: hidden; z-index: 1000;"></div
>
61 <form enctype
="Re_identification_output" method
="POST"><?php
62 if ($_POST["re_id_code"]) { $reIdCode = formData('re_id_code','P',true); }
64 //to store input for re-idenitification
65 $query = "DROP TABLE IF EXISTS temp_re_identification_code_table";
66 $res = sqlStatement($query);
68 $query = "create table temp_re_identification_code_table (re_identification_code varchar(50))";
69 $res = sqlStatement($query);
71 $query = "insert into temp_re_identification_code_table values ('$reIdCode')";
72 $res = sqlStatement($query);
74 $query = "update re_identification_status set status = 1;";
75 $res = sqlStatement($query);
77 //call procedure - execute in background
78 $sh_cmd='./re_identification_procedure.sh '.$sqlconf["host"].' '.$sqlconf["login"].' '.$sqlconf["pass"].' '.$sqlconf["dbase"].' &';
92 <table
class="de_identification_status_message" align
="center">
97 <?php
echo xl('Re Identification Process is ongoing');
99 echo xl('Please visit Re Identification screen after some time');
100 echo "</br>"; ?
> </br
>
113 <table align
="center">
122 else if($status == 2)
124 //2 - The Re Identification process completed and xls file is ready to download
125 $query = "update re_identification_status set status = 0";
126 $res = sqlStatement($query);
127 $query = "SELECT count(*) as count FROM re_identified_data";
128 $res = sqlStatement($query);
130 if ($row = sqlFetchArray($res))
132 $no_of_items = addslashes($row['count']);
134 if($no_of_items <= 1)
147 <table
class="de_identification_status_message" align
="center">
151 <?php
echo xl('No match Patient record found for the given Re Idenitification code');
153 echo xl('Please enter correct Re Identification code');
154 echo "</br>"; ?
> </br
>
167 <table align
="center">
177 //delete old re_identified_data.xls file
179 $query = "select now() as timestamp";
180 $res = sqlStatement($query);
181 if ($row = sqlFetchArray($res))
183 $timestamp = addslashes($row['timestamp']);
185 $timestamp = str_replace(" ","_",$timestamp);
186 $filename = $GLOBALS['temporary_files_dir']."/re_identified_data".$timestamp.".xls";
187 $query = "select * from re_identified_data into outfile '$filename' ";
188 $res = sqlStatement($query);
190 //download Re Identification .xls file
191 if (file_exists($filename)) {
192 header('Content-Description: File Transfer');
193 header('Content-Type: application/octet-stream');
194 header('Content-Disposition: attachment; filename='.basename($filename));
195 header('Content-Transfer-Encoding: none');
196 header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
197 header("Content-type: application/x-msexcel"); // This should work for the rest
198 header('Expires: 0');
199 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
200 header('Pragma: public');
201 header('Content-Length: ' . filesize($filename));
206 //xls file downloaded complete