function lipid_profile($sample_id) { //echo '111'; $cho = get_examination_result('CHO', $sample_id); $choh = get_examination_result('CHOH', $sample_id); $chol = get_examination_result('CHOL', $sample_id); $chov = get_examination_result('CHOV', $sample_id); $tg = get_examination_result('TG', $sample_id); if ($cho != FALSE && $choh != FALSE && $tg != FALSE) { //echo '222'; if (is_str_num($cho) != FALSE && is_str_num($choh) != FALSE && is_str_num($tg) != FALSE) { //echo '333'; if ($tg <= 400) { //echo '444'; save_single_examination_code($sample_id, 'CHOV', $tg / 5); save_single_examination_code($sample_id, 'CHOL', $cho - $choh - $tg / 5); } else { //echo '555'; save_single_examination_code($sample_id, 'CHOV', 'see remark'); save_single_examination_code($sample_id, 'CHOL', 'see remark'); insert_single_examination($sample_id, 1007); $str = 'if TG>400 mg/dl then LDL can not be calculated. Direct-LDL assay is advised'; append_if_not($str, $sample_id, 1007); } } } //both(TandD) are not done, both are not number, dbil>tbil }
$equipment_name = $file_info['equipment_name']; $repeat_id_field = $file_info['repeat_id_field']; $date_field = $file_info['date_field']; $code_field = $file_info['code_field']; $result_field = $file_info['result_field']; $date_str = $file_info['date_str']; $link = start_nchsls(); $uploaddir = '/'; $uploadfile = $uploaddir . basename($_FILES['import_file']['name']); echo 'uploading from:' . $uploadfile . '<br>'; echo '<pre>'; if ($handle = fopen($_FILES['import_file']['tmp_name'], "r")) { while (($data = fgetcsv($handle, 0, $delimiter)) !== FALSE) { print_r($data); if (isset($data[$sample_id_field]) && isset($data[$code_field]) && isset($data[$result_field]) && isset($data[$repeat_id_field]) && isset($data[$date_field])) { if (is_str_interger($data[$sample_id_field]) && is_str_num($data[$result_field]) && $data[$result_field] > 0) { if ($data[$sample_id_field] > 500000000 && $data[$sample_id_field] < 599999999 || $data[$sample_id_field] > 800000000 && $data[$sample_id_field] < 899999999) { $qc_value = get_target($data[$sample_id_field], $equipment_name, $data[$code_field]); $sql = 'insert into qc (equipment_name,sample_id,repeat_id,time_data,code,result,target,sd,lot,comment) values ( \'' . $equipment_name . '\' , \'' . $data[$sample_id_field] . '\' , \'' . $data[$repeat_id_field] . '\' , str_to_date(\'' . $data[$date_field] . '\',\'' . $date_str . '\'), \'' . $data[$code_field] . '\' , \'' . $data[$result_field] . '\' , \'' . $qc_value['target'] . '\' , \'' . $qc_value['sd'] . '\' , \'' . $qc_value['lot'] . '\' , \'1\')'; echo '<br>' . $sql; if (!($result = mysql_query($sql, $link))) {
$sqln = 'INSERT INTO qc (`equipment_name`, `sample_id`, `repeat_id`, `time_data`, `code`, `result`, `target`, `sd`,lot, `comment`) VALUES ( \'' . $_POST['equipment_name'] . '\', \'' . $sample_id_normal . '\', 0, \'' . strftime('%Y-%m-%d %H:%M:%S') . '\', \'' . $_POST['code'] . '\', \'' . $_POST['qc_normal'] . '\', \'' . $qc_data['target'] . '\', \'' . $qc_data['sd'] . '\', \'' . $qc_data['lot'] . '\' , \'1\')'; //echo $sqln; $result = mysql_query($sqln, $link); echo mysql_error(); } if (is_str_num($_POST['qc_abnormal'])) { $qc_data = get_target($sample_id_abnormal, $_POST['equipment_name'], $_POST['code']); $sqla = 'INSERT INTO qc (`equipment_name`, `sample_id`, `repeat_id`, `time_data`, `code`, `result`, `target`, `sd`,lot, `comment`) VALUES ( \'' . $_POST['equipment_name'] . '\', \'' . $sample_id_abnormal . '\', 0, \'' . strftime('%Y-%m-%d %H:%M:%S') . '\', \'' . $_POST['code'] . '\', \'' . $_POST['qc_abnormal'] . '\', \'' . $qc_data['target'] . '\', \'' . $qc_data['sd'] . '\', \'' . $qc_data['lot'] . '\' , \'\')'; //echo $sqla; $result = mysql_query($sqla, $link); echo mysql_error();