function import_results_XL_640() { global $batch_of_sample; //07/06/2011 09:41:27 XL //2011-07-06 12:23:51 ideal $link = start_nchsls(); echo '<H4>Importing Results from Erba XL-640</H4>'; $counter = 0; $uploaddir = '/'; $uploadfile = $uploaddir . basename($_FILES['import_file']['name']); if ($handle = fopen($_FILES['import_file']['tmp_name'], "r")) { while (($data = fgetcsv($handle, 0, chr(9))) !== FALSE) { if (isset($data[2]) && isset($data[5]) && isset($data[4])) { if (ctype_digit($data[2]) && is_numeric($data[5]) && $data[5] > 0) { $batch_of_sample[$data[2]] = ''; ///////autoverify with no action //autoverify($data[2],'','no'); //////////////////////////////// $sql = 'update examination set result=\'' . $data[5] . '\' , details=concat(str_to_date(\'' . $data[8] . '\',\'%m/%d/%Y %H:%i:%S\'),\'|Erba-XL-640\') where sample_id=\'' . $data[2] . '\' and code=\'' . $data[4] . '\' and strcmp(substr(result,1,1),\'(\')'; //echo '<br>'.$sql; if (!mysql_query($sql, $link)) { echo mysql_error(); } else { $affected = mysql_affected_rows($link); $counter = $counter + mysql_affected_rows($link); if (get_sample_status($data[2]) != 'verified') { //echo '<br><font color=red>['.$affected.']->'.$data[2].'->'.$data[4].'->'.$data[5].'</font>'; change_sample_status($data[2], 'analysed'); } } } else { //echo '<br>'.$data[2].':sample_id is not digits or '.$data[5].':result is not-numeric/0 or less'; } } } fclose($handle); echo '<h4>Updated data=' . $counter . '</h4>'; } else { echo 'can not fopen'; } }
foreach ($where as $key => $value) { if ($key != 'from_sample_id' && $key != 'to_sample_id') { $other_wheree = $other_wheree . ' ' . $key . ' like \'' . $value . '\' and'; } } $other_where = substr($other_wheree, 0, -3); if (strlen($sample_id_where) > 0 && strlen($other_where) > 0) { $search_str = $search_str . ' where ' . $sample_id_where . ' and ' . $other_where; } elseif (strlen($sample_id_where) > 0 && strlen($other_where) == 0) { $search_str = $search_str . ' where ' . $sample_id_where; } elseif (strlen($sample_id_where) == 0 && strlen($other_where) > 0) { $search_str = $search_str . ' where ' . $other_where; } $printed = array(); if (isset($_POST['submit']) && substr($search_str, -7) != 'sample ') { $link = start_nchsls(); if (!($search_result = mysql_query($search_str, $link))) { echo mysql_error(); } while ($ar = mysql_fetch_assoc($search_result)) { if (get_sample_status($ar['sample_id']) == 'verified') { print_sample($ar['sample_id'], 'eReport, not signed', 'eReport, not signed'); echo '<h2 style="page-break-before: always;"></h2>'; } else { echo '<h2 style="page-break-before: always; color:red; ">Sample ID ' . $ar['sample_id'] . ' is not verified(Call the lab)</h2>'; } } } else { echo '<h1>No coditions are given for selecting records</h1>'; } view_data(15);
$other_wheree = $other_wheree . ' ' . $key . ' like \'' . $value . '\' and'; } } $other_where = substr($other_wheree, 0, -3); if (strlen($sample_id_where) > 0 && strlen($other_where) > 0) { $search_str = $search_str . ' where ' . $sample_id_where . ' and ' . $other_where; } elseif (strlen($sample_id_where) > 0 && strlen($other_where) == 0) { $search_str = $search_str . ' where ' . $sample_id_where; } elseif (strlen($sample_id_where) == 0 && strlen($other_where) > 0) { $search_str = $search_str . ' where ' . $other_where; } $printed = array(); if (isset($_POST['submit']) && substr($search_str, -7) != 'sample ') { $link = start_nchsls(); if (!($search_result = mysql_query($search_str, $link))) { echo mysql_error(); } while ($ar = mysql_fetch_assoc($search_result)) { $printed[] = $ar['sample_id']; } foreach ($printed as $value) { if (get_sample_status($value) != 'verified') { echo $value . ' is not verified. PDF report can not be printed<br>'; } } print_report_pdf_A4($printed, $_POST['authorized_signatory']); } else { main_menu(); search_form('print_report_pdf_A4.php'); echo '<h1>No coditions are given for selecting records</h1>'; }
function autoverify($sample_id, $filename, $action) { global $reflex; if (get_sample_status($sample_id) == 'verified') { return; } if (!($all_details = get_all_details_of_a_sample($sample_id))) { return FALSE; } $verified = 0; foreach ($all_details as $key => $value) { $error_code_array = array(); //CSF and Blood(Serum,Plasma) have no diff //$acr_code=check_critical_abnormal_reportable($value['sample_id'],$value['code']); $acr_code = check_critical_abnormal_reportable($value['sample_type'], $value['code'], $value['result']); //////////empty if ($acr_code == -2) { $error_code_array[] = $acr_code; } //-2 if empty //////////////critical 3,4 if ($acr_code == 3 || $acr_code == 4) { $error_code_array[] = check_critical_reporting($sample_id); //8 if incomplate } //////////////absurd 1,2 if ($acr_code == 1 || $acr_code == 2) { insert_single_examination($value['sample_id'], 1007); append_if_not('Send new sample to resolve absurd values.', $sample_id, 1007); $error_code_array[] = $acr_code; //1,2 } //////////reflax if abnormal high(2,4,6) //cholesterol=13 if ($acr_code == 2 || $acr_code == 4 || $acr_code == 6 || $acr_code == 1 || $acr_code == 3 || $acr_code == 5) { if ($value['location'] == 'F3N(503)' && $value['code'] == 'TBIL') { } else { if ($reflex == 'yes') { $any_ex_inserted = reflex_testing($sample_id, $value['id'], $acr_code); if ($any_ex_inserted > 0) { $verified = 1; } // if any is inserted, verification require next round of autoverification } } } ///////////////ibil if ($value['code'] == 'IBIL') { $ibil = indirect_bilirubin($value['sample_id']); if ($ibil == '11') { $error_code_array[] = 11; //11 if >10% diff } } ///////////////LDL if ($value['code'] == 'CHOL') { lipid_profile($value['sample_id']); } //////total of error to decide if verified(=0) foreach ($error_code_array as $error_value) { $verified = $verified + abs($error_value); } if ($action == 'yes') { ///////action error_action($value['sample_id'], $value['code'], $error_code_array, $filename); /////// } } ////update status if ($verified != 0) { change_sample_status($sample_id, 'verification failed'); } else { change_sample_status($sample_id, 'verified'); } }