Beispiel #1
0
                 $sql .= "' ";
             }
         }
     }
     $sql .= "WHERE PatientCode='" . $_GET['PatientCode'] . "'";
 } else {
     $sql = "";
     $sql .= " INSERT INTO `coinfections` ";
     $sql .= " ( `PatientCode`, `HCV`, `HCVDate`";
     if ($_GET['HCVGenotype1'] != "" || $_GET['HCVGenotype2'] != "" || $_GET['HCVGenotype_combination'] != "") {
         $sql .= ", `HCVGenotype`";
     }
     $sql .= ") VALUES ('";
     $sql .= $_GET['PatientCode'] . "', ";
     $sql .= "'" . $_GET['HCV'] . "', ";
     $sql .= "'" . join_date($_GET, 'HCVDate') . "' ";
     if ($_GET['HCVGenotype1'] != "" || $_GET['HCVGenotype2'] != "" || $_GET['HCVGenotype_combination'] != "") {
         if ($_GET['HCVGenotype_combination'] != "") {
             $sql .= ",'" . $_GET['HCVGenotype_combination'] . "' ";
         } else {
             $sql .= ",'" . $_GET['HCVGenotype1'] . "/" . $_GET['HCVGenotype2'] . "' ";
         }
     }
     $sql .= ");";
 }
 //		echo "<BR>".$sql."<BR><BR>";
 $what_happened = execute_query($sql);
 echo mysql_error();
 if ($what_happened == 1) {
     //	    	echo "<P>Τα δεδομένα αποθηκεύτηκαν με επιτυχία!</P>";
 } else {
    $sql = "INSERT INTO `hcv_clinical_status` ";
    switch ($_GET['State']) {
        case 1:
            $sql .= "(`PatientCode`, `XroniaHCV`) VALUES ('" . $_GET['PatientCode'] . "', '1')";
            break;
        case 2:
            $sql .= "(`PatientCode`, `KirosiDate`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'KirosiDate') . "')";
            break;
        case 3:
            $sql .= "(`PatientCode`, `NonKirosiDate`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'NonKirosiDate') . "')";
            break;
        case 4:
            $sql .= "(`PatientCode`, `HKKDate`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'HKKDate') . "')";
            break;
        case 5:
            $sql .= "(`PatientCode`, `TransplantDate`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'TransplantDate') . "')";
            break;
    }
}
// echo $sql;
$what_happened = execute_query($sql);
/*
if ($what_happened == 1)
    {
        echo "<script>alert('Τα δεδομένα τροποποιήθηκαν με επιτυχία!')</script>\n";
        //echo $data_array['PatientCode'];
    }
else 
	{
		echo "<script>alert('Τα δεδομένα ΔΕΝ τροποποιήθηκαν!')</script>\n";
		echo mysql_error();
<?php 
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
//if ($_GET['code'] == "" || !is_numeric($_GET['code']))
//{ die('Πρέπει να δωσετε ένα σωστό Κωδικό Ασθενή!'); }
check_patient($_GET['code']);
$sql = "UPDATE hbv_antiiikes_treatments_dosages SET EndDate='" . join_date($_GET, 'EndDate1') . "'";
$sql .= " WHERE PatientCode='" . $_GET['code'] . "' AND StartDate='" . $_GET['start1'] . "'";
$sql .= " AND Medicine='" . $_GET['Medicine'] . "' AND link_id='" . $_GET['link_id'] . "'";
execute_query($sql);
//echo "<pre>$sql";
//echo mysql_error();
$sql = "INSERT INTO hbv_antiiikes_treatments_dosages VALUES('" . $_GET['code'] . "', '" . $_GET['Medicine'] . "', ";
if ($_GET['dosage1'] != "") {
    $sql .= "'" . replacecomma($_GET['dosage1']) . "', '" . $_GET['dosage1type'] . "', '" . $_GET['dosage2type'] . "', '";
} else {
    $sql .= "NULL, NULL, NULL, '";
}
$sql .= join_date($_GET, 'StartDate2') . "', '" . $_GET['end2'] . "', '" . $_GET['link_id'] . "')";
execute_query($sql);
//echo "<pre>$sql";
//echo mysql_error();
mysql_close($dbconnection);
perform_post_insert_actions("", "hbv_show_antiiikes_data.php?code=" . $_GET['code'], "");
?>
</BODY></HTML>
Beispiel #4
0
    $exams[$i]['Unit3'] = $row['Unit3'];
    $exams[$i]['Upper3'] = $row['Upper3'];
    $exams[$i]['Lower3'] = $row['Lower3'];
    $exams[$i]['Unit4'] = $row['Unit4'];
    $exams[$i]['Upper4'] = $row['Upper4'];
    $exams[$i]['Lower4'] = $row['Lower4'];
    $exams[$i]['Unit5'] = $row['Unit5'];
    $exams[$i]['Upper5'] = $row['Upper5'];
    $exams[$i]['Lower5'] = $row['Lower5'];
}
mysql_free_result($result);
for ($i = 0; $i < count($exams); $i++) {
    if ($_GET[$exams[$i]['Code']] != "") {
        $sql = "";
        $sql .= "INSERT INTO exams_other VALUES (";
        $sql .= "'" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'ExamDate0') . "', '" . $exams[$i]['Code'] . "', ";
        $sql .= "'" . replacecomma($_GET[$exams[$i]['Code']]) . "', '" . replacecomma($_GET[$exams[$i]['Code'] . '_Lower']) . "', '" . replacecomma($_GET[$exams[$i]['Code'] . '_Upper']) . "', '" . $_GET[$exams[$i]['Code'] . '_Unit'] . "'";
        if ($exams[$i]['Code'] == "FIBRO") {
            $sql .= " , 'IQR', '" . replacecomma($_GET['IQR']) . "'";
        } else {
            $sql .= " , NULL, NULL ";
        }
        $sql .= ");";
        //		echo $sql."<BR>";
        execute_query($sql);
        $j = 0;
        if ($_GET[$exams[$i]['Code'] . '_Unit'] == $exams[$i]['Unit1']) {
            $j = 1;
        }
        if ($_GET[$exams[$i]['Code'] . '_Unit'] == $exams[$i]['Unit2']) {
            $j = 2;
            					else
                				{
                    				echo "<P>".mysql_error()."$what_happened</P>";
            	    			}
            */
        }
    }
}
// -- Category C Routines
if (isset($_GET['category_c']) && $_GET['category_c'] != "") {
    $sql = "";
    $sql .= " INSERT INTO `patients_category_c` ( `PatientCode` , `NososSyndrom`, `Diagnosis`, `NososSyndromDate` )";
    $symptom = $_GET['category_c'];
    $diagnosis = $_GET['Diagnosis'];
    if ($diagnosis != "") {
        $date = join_date($_GET, "CDate");
        $sql .= " VALUES ( '" . $_GET['code'] . "' , '" . $symptom . "', '" . $diagnosis . "', '" . $date . "' );";
        //		echo "<BR>".$sql."<BR><BR>";
        $what_happened = execute_query($sql);
        /*		if ($what_happened == 1)
            	{
            		echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
        		}
        		else
            	{
            		echo "<P>".mysql_error()."</P>";
        		} */
    }
}
if (isset($_GET['syndr'])) {
    for ($i = 0; $i < $_GET['syndr']; $i++) {
Beispiel #6
0
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
check_patient($_GET['PatientCode']);
//print_r($_GET);
//print_r($data_array2);
if ($_GET['EndDate_year'] == "") {
    $enddate = "0000-00-00";
} else {
    $enddate = join_date($_GET, 'EndDate');
}
$sql = "";
$sql = "INSERT INTO `iris` ( `PatientCode` , `StartDate` , `EndDate` , `What` , `Type` , `Antimetopisi`)";
$sql .= " VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'StartDate');
$sql .= "', '" . $enddate . "', '" . $_GET['What'] . "', '" . $_GET['Type'] . "', '" . $_GET['Antimetopisi'];
$sql .= "');";
echo $sql;
$what_happened = execute_query($sql);
if ($what_happened == 1) {
    echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
} else {
    echo "<P>{$what_happened}</P>";
}
echo mysql_error();
//form_data2table($_GET);
mysql_close($dbconnection);
perform_post_insert_actions("iris", "iris.php?code=" . $_GET['PatientCode'], "");
?>
Beispiel #7
0
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
$exams_sql = "SELECT * FROM orologikes_list";
$result = execute_query($exams_sql);
$exams = array();
for ($i = 0; $i < mysql_num_rows($result); $i++) {
    $row = mysql_fetch_assoc($result);
    $exams[$i] = $row['Code'];
}
mysql_free_result($result);
$jump2conifection = 0;
for ($i = 0; $i < count($exams); $i++) {
    if ($_GET[$exams[$i]] != "0") {
        $sql = "";
        $sql .= "INSERT INTO exams_orologikes VALUES (";
        $sql .= "'" . $_GET['PatientCode'] . "', '" . join_date($_GET, $exams[$i] . 'Date') . "', '" . $exams[$i] . "', ";
        $sql .= "'" . $_GET[$exams[$i]] . "');";
        //		echo $sql."<BR>";
        execute_query($sql);
        if (($exams[$i] == 'HBsAg' || $exams[$i] == 'Anti-HCV') && $_GET[$exams[$i]] == 1) {
            $jump2conifection = 1;
        }
    }
}
mysql_close($dbconnection);
if ($jump2conifection) {
    perform_post_insert_actions("exams_orologikes", "coinfection.php?code=" . $_GET['PatientCode'], "");
} else {
    perform_post_insert_actions("exams_orologikes", "orologikes.php?code=" . $_GET['PatientCode'], "");
}
?>
Beispiel #8
0
}
if ($now_days < $th_days + 168) {
    $_GET['Bioximiki_24'] = '-1';
    $_GET['Iologiki_24'] = '-1';
}
if ($enddate == "3000-01-01") {
    $_GET['Bioximiki_end'] = '-1';
    $_GET['Iologiki_end'] = '-1';
    $_GET['Info1'] = '';
    $_GET['Info2'] = '';
}
if ($enddate == "3000-01-01" || $now_days < $th_days_end + 182) {
    $_GET['Bioximiki_longterm'] = '-1';
    $_GET['Iologiki_longterm'] = '-1';
}
$sql = "INSERT INTO hcv_antiiikes_treatments_antapokrisi VALUES('" . $_GET['PatientCode'] . "', '" . $schema . "', '" . join_date($_GET, 'StartDate') . "', '" . $enddate . "', ";
$sql .= "'" . $_GET['Bioximiki_polu_prwimi'] . "', '" . $_GET['Bioximiki_prwimi'] . "', '" . $_GET['Bioximiki_24'] . "', '" . $_GET['Bioximiki_end'] . "', '" . $_GET['Bioximiki_longterm'] . "', ";
$sql .= "'" . $_GET['Iologiki_polu_prwimi'] . "', '" . $_GET['Iologiki_prwimi'] . "', '" . $_GET['Iologiki_24'] . "', '" . $_GET['Iologiki_end'] . "', '" . $_GET['Iologiki_longterm'] . "', '" . $_GET['Info1'] . "', ";
if ($_GET['Info1'] == 1) {
    $sql .= "NULL, ";
} else {
    $sql .= "'" . $_GET['Info2'] . "', ";
}
$sql .= "'" . $_GET['Note'] . "');";
$sql = replace2null($sql);
echo $sql;
$what_happened = execute_query($sql);
//	echo mysql_error();
mysql_close($dbconnection);
perform_post_insert_actions("hcv_antiiikes_treatments", "hcv_antiiikes.php?code=" . $_GET['code'], "");
?>
Beispiel #9
0
	}	
	$sql .= "Notes='".$_GET['Notes_death']."' WHERE `PatientCode`='".$_GET['PatientCode']."'";
//	echo $sql;
	execute_query($sql);
	echo mysql_error();
}
*/
if ($_GET['LastState'] == 3) {
    // Delete previous entry
    execute_query("DELETE FROM last_state WHERE PatientCode=" . $_GET['PatientCode']);
    // Lost to Follow-Up State
    $sql = "INSERT INTO last_state (`PatientCode`, `LastState`, `Lost2FollowUp`, `LastKnownToBeAlive`, `WithdrawalDate`, `NewClinic`, `Notes`) VALUES (";
    $sql .= "'" . $_GET['PatientCode'] . "', '3', '" . $_GET['Lost2FollowUp'] . "', ";
    $sql .= "'" . join_date($_GET, 'LastKnownToBeAlive') . "', ";
    if ($_GET['Lost2FollowUp'] == 5) {
        $sql .= "'" . join_date($_GET, 'WithdrawalDate') . "', ";
    } else {
        $sql .= "NULL, ";
    }
    if ($_GET['Lost2FollowUp'] == 3) {
        $sql .= "'" . $_GET['NewClinic'] . "', ";
    } else {
        $sql .= "NULL, ";
    }
    $sql .= "'" . $_GET['Notes_lost'] . "')";
    //	echo $sql;
    execute_query($sql);
    echo mysql_error();
}
/*
if (($_GET['LastState'] == 3) & ($_GET['has_entry'] == 1))
<?php 
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
//form_data2table($_GET);
$data_array2 = $_GET;
$names = array_keys($data_array2);
if ($_GET['Diagnosis'] == "XX99") {
    $data_array2['Diagnosis'] = $_GET['DiagnosisICD'];
    $_GET['Diagnosis'] = $_GET['DiagnosisICD'];
}
$sql = "";
$sql = "INSERT INTO `hospitalization` ( `PatientCode` , `EntryDate` , `ExitDate` , `Diagnosis` , `Ekbasi`)";
$sql .= " VALUES ('" . $data_array2['PatientCode'] . "', '" . join_date($data_array2, 'EntryDate') . "', '" . join_date($data_array2, 'ExitDate') . "'";
$sql .= ", '" . $data_array2['Diagnosis'] . "', '" . $data_array2['Ekbasi'] . "');";
//echo $sql;
$what_happened = execute_query($sql);
if ($what_happened == 1) {
    //   	echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
} else {
    //   	echo "<P>$what_happened</P>";
}
//form_data2table($_GET);
/*
$what_happened = execute_query($sql);
if ($what_happened == 1)
    {
        echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
    }
Beispiel #11
0
$schema = substr($schema, 0, strlen($schema) - 3);
$new_therapy['schema'] = $schema;
$new_therapy['descr'] = $list[$_GET['Schema']];
if ($_GET['StartDate_year'] == "") {
    $new_therapy['end'] = join_date($_GET, 'EndDate');
    $new_therapy['start'] = "0000-00-00";
} else {
    if ($_GET['EndDate_year'] == "") {
        $new_therapy['start'] = join_date($_GET, 'StartDate');
        $new_therapy['end'] = "3000-01-01";
    } else {
        if (!check_dates($_GET, 'StartDate', 'EndDate')) {
            die("Η ημερομηνία έναρξης σχήματος " . $_GET['Schema'] . " πρέπει να είναι τουλάχιστον μια μέρα πριν την ημερομηνία λήξης του");
        }
        $new_therapy['start'] = join_date($_GET, 'StartDate');
        $new_therapy['end'] = join_date($_GET, 'EndDate');
    }
}
$new_therapy['reason'] = $_GET['Reason'];
//print_r($new_therapy);
//die;
if ($new_therapy['start'] == "0000-00-00") {
    $start_query = "SELECT * FROM hcv_other_treatments WHERE PatientCode='" . $_GET['code'] . "' AND EndDate='3000-01-01' AND Sxima='" . $new_therapy['schema'] . "'";
    $result = execute_query($start_query);
    $num_rows = mysql_num_rows($result);
    if ($num_rows == 0) {
        die("<div class='img-shadow'><p style='display: block; border: 1px solid red'>Για τον ασθενή " . $_GET['code'] . " δεν υπάρχει καταχωρημένο φαρμακευτικό σχήμα <b>" . $new_therapy['schema'] . "</b> και ανοιχτή την ημερομηνία τέλους!</p></div>");
    } else {
        $row = mysql_fetch_assoc($result);
        $start_date = $row['StartDate'];
        if ($new_therapy['end'] >= $start_date) {
Beispiel #12
0
    echo "<div class='img-shadow'>";
    echo "<p style='display: block; border: 1px solid red'>";
    echo "<BR> <b>Πρόβλημα</b> στην καταχώρηση <b>" . $schema . "</b><BR>";
    echo "Υπάρχει ήδη εγγραφή των φαρμάκων <b>{$eschema}</b> με ημερομηνία έναρξης " . $start2;
    if ($end2 == '3000-01-01') {
        echo " και ανοιχτή ημερομηνία λήξης";
    } else {
        echo " και ημερομηνία λήξης " . $end2;
    }
    echo "<BR> και θέλετε να καταχωρήσετε <b>{$schema}</b> με ημερομηνία έναρξης " . $start;
    if ($enddate == '3000-01-01') {
        echo " και ανοιχτή ημερομηνία λήξης";
    } else {
        echo " και ημερομηνία λήξης " . $enddate;
    }
    echo "</div></p>";
    echo "<br><br><br><br><br><br>";
    echo "<div class='img-shadow'>";
    show_errormsg("");
    echo "</div>";
}
mysql_free_result($result);
$sql = "UPDATE antiretro_treatments_compliance SET Compliance='" . $_GET['Compliance'] . "', Reason1='" . $_GET['Reason1'] . "', Reason2='" . $_GET['Reason2'] . "', Notes='" . $_GET['Notes'] . "', EndDate='{$enddate}', StartDate='" . join_date($_GET, 'StartDate') . "' ";
$sql .= "WHERE PatientCode='" . $_GET['code'] . "' AND StartDate='" . $_GET['start'] . "' AND EndDate='" . $_GET['end'] . "'";
execute_query($sql);
execute_query("UPDATE antiretro_treatments SET EndDate='{$enddate}', StartDate='" . join_date($_GET, 'StartDate') . "' WHERE PatientCode='" . $_GET['code'] . "' AND StartDate='" . $_GET['start'] . "'");
perform_post_insert_actions("", "show_antiretro_data?code=" . $_GET['code'], "");
mysql_close($dbconnection);
?>
</BODY></HTML>
Beispiel #13
0
 }
 $newschema = substr($newschema, 0, strlen($newschema) - 3);
 $new_therapy_aa['schema'] = $newschema;
 if ($_GET['StartDate_aa_year'] == "") {
     $new_therapy_aa['end'] = join_date($_GET, 'EndDate_aa');
     $new_therapy_aa['start'] = "0000-00-00";
 } else {
     if ($_GET['EndDate_aa_year'] == "") {
         $new_therapy_aa['start'] = join_date($_GET, 'StartDate_aa');
         $new_therapy_aa['end'] = "3000-01-01";
     } else {
         if (!check_dates($_GET, 'StartDate_aa', 'EndDate_aa')) {
             die("Η ημερομηνία έναρξης του σχήματος πρέπει να είναι τουλάχιστον μια μέρα πριν την ημερομηνία λήξης του");
         }
         $new_therapy_aa['start'] = join_date($_GET, 'StartDate_aa');
         $new_therapy_aa['end'] = join_date($_GET, 'EndDate_aa');
     }
 }
 $new_therapy_aa['reason'] = $_GET['Reason_aa'];
 //	print_r($new_therapy_aa);
 if ($newschema == "") {
     perform_post_insert_actions("", "hbv_other_treatments.php?code=" . $_GET['PatientCode'], "");
 }
 $query = "SELECT Schema, StartDate, EndDate FROM hbv_other_treatments_after_art WHERE PatientCode=" . $_GET['code'];
 $result = execute_query($query);
 $num_rows = mysql_num_rows($result);
 if ($num_rows == 0) {
     $has_therapy_aa = 0;
 } else {
     $has_therapy_aa = 1;
     for ($j = 0; $j < $num_rows; $j++) {
Beispiel #14
0
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
//validate_data("exams_iologikes", $_GET);
$data_array2 = $_GET;
$names = array_keys($data_array2);
$data_array2['Value'] = replacecomma($data_array2['Value']);
if ($_GET['Result'] == "-1") {
    $data_array2['Operator'] = $_GET['Operator1'];
} else {
    $data_array2['Operator'] = $_GET['Operator2'];
}
$sql = "";
$sql = "INSERT INTO `hcv_iologikes` ( `PatientCode` , `ExamDate` , `Result` , `Value` , `Units`, `Operator`, `Method`)";
$sql .= " VALUES ( '" . $_GET['PatientCode'] . "', '" . join_date($data_array2, 'ExamDate') . "', '" . $data_array2['Result'] . "', ";
//if (is_numeric($data_array2['Value']))
//{
$sql .= "'" . $data_array2['Value'] . "', '" . $data_array2['Units'] . "', '" . $data_array2['Operator'] . "', ";
//}
//else
//{
//	$sql .= "NULL, NULL, NULL, ";
//}
$sql .= " '" . $data_array2['Method'] . "')";
$sql = replace2null($sql);
//echo $sql;
$what_happened = execute_query($sql);
if ($what_happened == 1) {
    //        echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
} else {
Beispiel #15
0
        $new_therapies[$i]['therapy'] = $kk;
        $new_therapies[$i]['descr'] = $list[$kk];
        $new_therapies[$i]['type'] = $_GET['Type' . $k];
        if ($_GET['StartDate' . $k . '_year'] == "") {
            $new_therapies[$i]['end'] = join_date($_GET, 'EndDate' . $k);
            $new_therapies[$i]['start'] = "0000-00-00";
        } else {
            if ($_GET['EndDate' . $k . '_year'] == "") {
                $new_therapies[$i]['start'] = join_date($_GET, 'StartDate' . $k);
                $new_therapies[$i]['end'] = "3000-01-01";
            } else {
                if (!check_dates($_GET, 'StartDate' . $k, 'EndDate' . $k)) {
                    die("Η ημερομηνία έναρξης της θεραπείας για " . $new_therapies[$i]['descr'] . " πρέπει να είναι τουλάχιστον μια μέρα πριν την ημερομηνία λήξης της");
                }
                $new_therapies[$i]['start'] = join_date($_GET, 'StartDate' . $k);
                $new_therapies[$i]['end'] = join_date($_GET, 'EndDate' . $k);
            }
        }
        $new_therapies[$i]['reason'] = $_GET['Reason' . $k];
        $new_therapies[$i]['note'] = $_GET['Note' . $k];
        $i++;
    }
}
for ($i = 0; $i < count($new_therapies); $i++) {
    if ($new_therapies[$i]['start'] == "0000-00-00") {
        $start_query = "SELECT * FROM prophylactic_therapies WHERE PatientCode='" . $_GET['code'] . "' AND EndDate='3000-01-01' AND Therapy='" . $new_therapies[$i]['therapy'] . "'";
        $result = execute_query($start_query);
        $num_rows = mysql_num_rows($result);
        if ($num_rows == 0) {
            die("Για τον ασθενή " . $_GET['code'] . " δεν υπάρχει καταχωρημένη προφυλακτική θεραπεία για " . $new_therapies[$i]['descr'] . " και ανοιχτή την ημερομηνία τέλους!");
        } else {
Beispiel #16
0
?>

<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

<?php 
//form_data2table($_GET);
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
check_patient($_GET['PatientCode']);
check_hcv_coinfection($_GET['PatientCode']);
$sql = "INSERT INTO `hcv_lab` VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'ExamDate') . "', '" . $_GET['ALT'] . "', '" . $_GET['AST'] . "', '" . $_GET['gammaGT'] . "')";
$what_happened = execute_query($sql);
if ($what_happened == 1) {
    echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
    //       echo "<p><a href='orologikes.php?code=".$_GET['PatientCode']."'>Κάντε click εδώ για να καταχωρήσετε και άλλη εξέταση</a></p>";
    //       echo "<p><a href='antiretro.php?code=".$_GET['PatientCode']."'>Κάντε click εδώ για να καταχωρήσετε αντιρετροϊκές θεραπείες</a></p>";
} else {
    echo "<P>{$what_happened}</P>";
    echo mysql_error();
}
echo "<p><a href='hcv_lab.php?code=" . $_GET['PatientCode'] . "'>Καντε click εδώ για να καταχωρήσετε κι άλλη εξέταση</a></p>";
mysql_close($dbconnection);
?>

</BODY></HTML>
Beispiel #17
0
    if ($_GET['GP120_' . $i . '_1'] != "") {
        execute_query($sql);
    }
}
// INSERT Medicine Resistance
for ($i = 0; $i < count($atccodes); $i++) {
    if ($_GET['Score_' . $atccodes[$i]] != "-") {
        $score = $_GET['Score_' . $atccodes[$i]];
        if (isset($_GET['Boosting_' . $atccodes[$i]]) && $_GET['Boosting_' . $atccodes[$i]] == "on") {
            $boosting = '1';
        } else {
            $boosting = '0';
        }
        $sql = "INSERT INTO `hiv_resistance_meds` VALUES('" . $_GET['PatientCode'] . "', '" . $_GET['SampleID'] . "', ";
        $sql .= "'" . join_date($_GET, 'SeqDate') . "', '" . $atccodes[$i] . "', '" . $boosting . "', '" . $_GET['Score_' . $atccodes[$i]] . "')";
        execute_query($sql);
    }
}
// INSERT Extra Data
$sql = "INSERT INTO `hiv_resistance` VALUES('" . $_GET['PatientCode'] . "', '" . $_GET['SampleID'] . "', ";
$sql .= "'" . join_date($_GET, 'SampleDate') . "', '" . join_date($_GET, 'SeqDate') . "', '" . $_GET['Lab'] . "', '" . $_GET['Algorithm'] . "',  ";
$sql .= "'" . $_GET['TestType'] . "')";
//echo $sql;
$what_happened = execute_query($sql);
echo mysql_error();
mysql_close($dbconnection);
perform_post_insert_actions("hiv_subtype", "hiv_resistance.php?code=" . $_GET['PatientCode'], "");
?>

</BODY></HTML>
Beispiel #18
0
}
$sql .= " Alcohol='" . $_GET['Alcohol'] . "', ";
$sql .= " DrugUser='******'DrugUser'] . "', ";
if ($_GET['DrugUser'] == '1') {
    $sql .= " Heroin='" . $_GET['heroin'] . "',  Hash='" . $_GET['hash'] . "',  Cocaine='" . $_GET['cocain'] . "', ";
    $sql .= " OtherDrugName='" . $_GET['other_drug_name'] . "',  OtherDrugValue='" . $_GET['otherdrug'] . "', ";
} else {
    $sql .= " Heroin='-1',  Hash='-1',  Cocaine='-1', ";
    $sql .= " OtherDrugName='',  OtherDrugValue='-1', ";
}
if ($lipoatrofia != 0 && join_date($_GET, 'DateOfVisit') > $lipoatrofia) {
    $sql .= " Lipoatrofia='" . $_GET['Lipoatrofia'] . "', ";
} else {
    $sql .= " Lipoatrofia=NULL, ";
}
if ($enapothesi != 0 && join_date($_GET, 'DateOfVisit') > $enapothesi) {
    $sql .= " Enapothesi='" . $_GET['Enapothesi'] . "', ";
} else {
    $sql .= " Enapothesi=NULL, ";
}
$sql .= " PressureSystolic='" . $_GET['sad'] . "',  PressureDiastolic='" . $_GET['dap'] . "' ";
$sql .= " WHERE PatientCode='" . $_GET['PatientCode'] . "' AND Clinic='" . $_GET['clinicid'] . "' AND DateofVisit='" . $_GET['visitdate'] . "';";
//    echo $sql;
//echo "<BR><BR>";
$what_happened = execute_query($sql);
if ($what_happened == 1) {
    //        echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
    //       echo "<P><a href='clinical_status.php?code=".$data_array2['PatientCode']."'>Κάντε click εδώ για να εισάγετε την κλινική κατάσταση του ασθενή</a></P>";
} else {
    echo mysql_error();
}
<link href="./include/cohort.css" rel="stylesheet" type="text/css">
</HEAD>
<?php 
PrintMenu();
?>

<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

<?php 
$code = $_GET['code'];
$category = $_GET['category'];
if (isset($_GET['changeto']) && isset($_GET['changedate_year'])) {
    $changeto = $_GET['changeto'];
    $changedate = join_date($_GET, "changedate");
    if ($category == "A") {
        $sql = "UPDATE `aids_clinical_status` SET StatusChange1 = '{$changeto}', StatusChange1Date = '{$changedate}'";
        $sql .= " WHERE `PatientCode` = '{$code}' LIMIT 1";
    }
    if ($category == "B") {
        $result = execute_query("SELECT StatusChange1 FROM aids_clinical_status WHERE PatientCode = '{$code}'");
        $row = mysql_fetch_array($result);
        if ($row[0] == "") {
            $sql = "UPDATE `aids_clinical_status` SET StatusChange1 = '{$changeto}', StatusChange1Date = '{$changedate}'";
            $sql .= " WHERE `PatientCode` = '{$code}' LIMIT 1";
        } else {
            $sql = "UPDATE `aids_clinical_status` SET StatusChange2 = '{$changeto}', StatusChange2Date = '{$changedate}'";
            $sql .= " WHERE `PatientCode` = '{$code}' LIMIT 1";
        }
    }
if ($_GET['Info1'] == 1) {
    $sql .= "Info2=NULL, ";
} else {
    $sql .= "Info2='" . $_GET['Info2'] . "', ";
}
$sql .= " Notes='" . $_GET['Notes'] . "', StartDate='" . join_date($_GET, 'StartDate') . "'";
//if ((isset($_GET['EndDate_year'])) && ($_GET['EndDate_year'] != ''))
//{
$sql .= ", EndDate='{$enddate}' WHERE PatientCode='" . $_GET['code'] . "' AND StartDate='" . $_GET['start'] . "'";
//}
//else
//{
//	$sql .= " WHERE PatientCode='".$_GET['code']."' AND StartDate='".$_GET['start']."' AND EndDate='".$_GET['end']."'";
//}
$sql = replace2null($sql);
// form_data2table($_GET);
// echo "<pre>";
// echo $sql;
execute_query($sql);
// echo mysql_error();
// die;
execute_query("UPDATE hbv_antiiikes_treatments SET EndDate='{$enddate}', StartDate='" . join_date($_GET, 'StartDate') . "' WHERE PatientCode='" . $_GET['code'] . "' AND StartDate='" . $_GET['start'] . "'");
// UPDATE StartDate Change in Dosages
execute_query("UPDATE hbv_antiiikes_treatments_dosages SET StartDate='" . join_date($_GET, 'StartDate') . "' WHERE PatientCode='" . $_GET['code'] . "' AND StartDate='" . $_GET['start'] . "'");
// UPDATE EndDate Change in Dosages
execute_query("UPDATE hbv_antiiikes_treatments_dosages SET EndDate='{$enddate}' WHERE PatientCode='" . $_GET['code'] . "' AND EndDate='" . $_GET['end'] . "'");
perform_post_insert_actions("", "hbv_show_antiiikes_data.php?code=" . $_GET['code'], "");
mysql_close($dbconnection);
?>
</BODY></HTML>
Beispiel #21
0
    $sql .= "'" . $Iologiki_arxiki_value . "', '" . $Iologiki_arxikiUnits . "', '" . $Iologiki_arxiki_method . "', '" . join_date($_GET, 'Iologiki_arxikiDate') . "', ";
} else {
    $sql .= "NULL, NULL, NULL, NULL, ";
}
if ($Iologiki_diafugi_value != "") {
    $sql .= "'" . $Iologiki_diafugi_value . "', '" . $Iologiki_diafugiUnits . "', '" . $Iologiki_diafugi_method . "', '" . join_date($_GET, 'Iologiki_diafugiDate') . "', ";
} else {
    $sql .= "NULL, NULL, NULL, NULL, ";
}
if ($Iologiki_end_value != "") {
    $sql .= "'" . $Iologiki_end_value . "', '" . $Iologiki_endUnits . "', '" . $Iologiki_end_method . "', '" . join_date($_GET, 'Iologiki_endDate') . "', ";
} else {
    $sql .= "NULL, NULL, NULL, NULL, ";
}
if ($Iologiki_longterm_value != "") {
    $sql .= "'" . $Iologiki_longterm_value . "', '" . $Iologiki_longtermUnits . "', '" . $Iologiki_longterm_method . "', '" . join_date($_GET, 'Iologiki_longtermDate') . "', ";
} else {
    $sql .= "NULL, NULL, NULL, NULL, ";
}
if ($_GET['Orologiki_end'] != "") {
    $sql .= "'" . $_GET['Orologiki_end'] . "', ";
} else {
    $sql .= "'-1', ";
}
if ($_GET['Orologiki_longterm'] != "") {
    $sql .= "'" . $_GET['Orologiki_longterm'] . "', ";
} else {
    $sql .= "'-1', ";
}
$sql .= " '" . $_GET['Info1'] . "', ";
if ($_GET['Info1'] == 1) {
            $sql .= "(`PatientCode`, `Emboliasmos`) VALUES ('" . $_GET['PatientCode'] . "', '1')";
            break;
        case 8:
            $sql .= "(`PatientCode`, `Askitis`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'NonKirosiDate') . "')";
            break;
        case 9:
            $sql .= "(`PatientCode`, `Kirsoi`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'NonKirosiDate') . "')";
            break;
        case 10:
            $sql .= "(`PatientCode`, `Egkefalopatheia`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'NonKirosiDate') . "')";
            break;
        case 11:
            $sql .= "(`PatientCode`, `Nefriki`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'NonKirosiDate') . "')";
            break;
        case 12:
            $sql .= "(`PatientCode`, `Peritonitis`) VALUES ('" . $_GET['PatientCode'] . "', '" . join_date($_GET, 'NonKirosiDate') . "')";
            break;
    }
}
//echo $sql;
$what_happened = execute_query($sql);
/*
if ($what_happened == 1)
    {
        echo "<script>alert('Τα δεδομένα τροποποιήθηκαν με επιτυχία!')</script>\n";
        //echo $data_array['PatientCode'];
    }
else 
	{
		echo "<script>alert('Τα δεδομένα ΔΕΝ τροποποιήθηκαν!')</script>\n";
		echo mysql_error();
Beispiel #23
0
                		{
                			echo "<P>Τα δεδομένα διαγράφτηκαν με επιτυχία!</P>";
            			}
            			else
                		{
                			echo "<P>$what_happened</P>";
            			}   */
        }
    }
}
if ($_GET['HasOtherClinicalState'] == 1) {
    for ($i = 0; $i < $_GET['num_states']; $i++) {
        if ($_GET['ClinicalStatusID' . $i] != "") {
            $clinic_state_sql = "";
            $clinic_state_sql .= " INSERT INTO `patient_other_clinical_state` ( `PatientCode` , `ClinicalStatusID`, `ClinicalStatusDate` )";
            $date = join_date($_GET, 'ClinicalStatusDate' . $i);
            $clinic_state_sql .= " VALUES ( '" . $_GET['PatientCode'] . "' , '" . $_GET['ClinicalStatusID' . $i] . "', '" . $date . "' );";
            //		echo $clinic_state_sql;
            $what_happened = execute_query($clinic_state_sql);
            /*		if ($what_happened == 1)
               	{
                    echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
               	} */
        }
    }
}
if (isset($_GET['state'])) {
    for ($i = 0; $i < $_GET['state']; $i++) {
        if (isset($_GET['del_state_sw_' . $i])) {
            $sql = "";
            $sql .= " DELETE FROM `patient_other_clinical_state` ";
Beispiel #24
0
<HTML><HEAD>
<TITLE>Προβολή-Αλλαγή Αντιρετροϊκών Θεραπειών</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1253">
<link href="./include/cohort.css" rel="stylesheet" type="text/css">
</HEAD>
<?php 
PrintMenu();
?>

<P>&nbsp;</P>
<P>&nbsp;</P>

<?php 
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
//if ($_GET['code'] == "" || !is_numeric($_GET['code']))
//{ die('Πρέπει να δωσετε ένα σωστό Κωδικό Ασθενή!'); }
check_patient($_GET['code']);
$sql = "UPDATE iris SET EndDate='" . join_date($_GET, 'EndDate') . "' ";
$sql .= "WHERE PatientCode='" . $_GET['code'] . "' AND StartDate='" . $_GET['start'] . "' AND Type='" . $_GET['type'] . "'";
$sql .= " AND What='" . $_GET['what'] . "' AND Antimetopisi='" . $_GET['ant'] . "'";
execute_query($sql);
//echo $sql;
perform_post_insert_actions("", "iris.php?code=" . $_GET['code'], "");
mysql_close($dbconnection);
?>
</BODY></HTML>
Beispiel #25
0
PrintMenu();
?>

<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

<?php 
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
check_patient($_GET['PatientCode']);
$data_array2['PatientCode'] = $_GET['PatientCode'];
$data_array2['ExamDate'] = join_date($_GET, 'ExamDate');
$data_array2['System1'] = $_GET['System1'];
$data_array2['System2'] = $_GET['System2'];
if ($_GET['System1'] == 1) {
    $data_array2['Score1'] = $_GET['Grade1_1'];
} else {
    $data_array2['Score1'] = $_GET['Grade1_2'];
}
if ($_GET['System2'] == 1) {
    $data_array2['Score2'] = $_GET['Grade2_1'];
} else {
    $data_array2['Score2'] = $_GET['Grade2_2'];
}
$sql = "INSERT INTO `" . $_GET['table'] . "` ( `PatientCode` , `ExamDate` , `System1` , `Score1` , `System2` , `Score2`)";
$sql .= " VALUES ('" . $data_array2['PatientCode'] . "', '" . $data_array2['ExamDate'];
$sql .= "', '" . $data_array2['System1'] . "', '" . $data_array2['Score1'] . "', '" . $data_array2['System2'] . "', '" . $data_array2['Score2'];
Beispiel #26
0
    } else {
        echo " και ημερομηνία λήξης " . $end2;
    }
    echo "<BR> και θέλετε να καταχωρήσετε <b>{$schema}</b> με ημερομηνία έναρξης " . $start;
    if ($enddate == '3000-01-01') {
        echo " και ανοιχτή ημερομηνία λήξης";
    } else {
        echo " και ημερομηνία λήξης " . $enddate;
    }
    echo "</div></p>";
    echo "<br><br><br><br><br><br>";
    echo "<div class='img-shadow'>";
    show_errormsg("");
    echo "</div>";
}
mysql_free_result($result);
// Insert Medicines
$sql = "";
for ($i = 0; $i < count($meds); $i++) {
    $sql = "INSERT INTO antiretro_treatments VALUES('" . $_GET['PatientCode'] . "', '" . $meds[$i]['id'] . "', '" . join_date($_GET, 'StartDate') . "', '" . $enddate . "')";
    //	echo $sql."<BR>";
    $what_happened = execute_query($sql);
}
// Insert Compliance, Discontinuation Reasons and Notes
$sql = "INSERT INTO antiretro_treatments_compliance VALUES('" . $_GET['PatientCode'] . "', '" . $schema . "', '" . join_date($_GET, 'StartDate') . "', '" . $enddate . "', '" . $_GET['comp'] . "', '" . $_GET['Reason1'] . "', '" . $_GET['Reason2'] . "', '" . $_GET['Notes'] . "')";
execute_query($sql);
mysql_close($dbconnection);
perform_post_insert_actions("", "antiretro.php?code=" . $_GET['PatientCode'], "");
?>

Beispiel #27
0
function prepare_data($table, $data_array)
{
    if ($table == 'patients') {
        if ($data_array['PatientCode'] == "") {
            $corrected_data_array['PatientCode'] = $data_array['MELCode'];
        } else {
            $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        }
        if ($data_array['MELCode'] == "") {
            $corrected_data_array['MELCode'] = -1;
        } else {
            $corrected_data_array['MELCode'] = $data_array['MELCode'];
        }
        $corrected_data_array['Name'] = $data_array['Name'];
        $corrected_data_array['Surname'] = $data_array['Surname'];
        $corrected_data_array['BirthDate'] = join_date($data_array, 'BirthDate');
    }
    if ($table == 'demographic_data') {
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        //		$dbconnection2 = cohortdb_connect2();
        //		$dbselected2 = cohortdb_select($dbconnection2);
        //		mysql_close($dbconnection2);
        $corrected_data_array['FirstVisit'] = join_date($data_array, 'FirstVisit');
        $corrected_data_array['EnrollDate'] = join_date($data_array, 'EnrollDate');
        $corrected_data_array['Race'] = $data_array['Race'];
        $corrected_data_array['Sex'] = $data_array['Sex'];
        $corrected_data_array['BirthDate'] = join_date($data_array, 'BirthDate');
        //        $corrected_data_array['RecentWeight'] = $data_array['RecentWeight'];
        //        $corrected_data_array['RecentWeightDate'] = join_date($data_array, 'RecentWeightDate');
        //        $corrected_data_array['RecentHeight'] = $data_array['RecentHeight'];
        //        $corrected_data_array['RecentHeightDate'] = join_date($data_array, 'RecentHeightDate');
        $corrected_data_array['Origin'] = $data_array['Origin'];
        $corrected_data_array['EnrollDate'] = join_date($data_array, 'EnrollDate');
        $corrected_data_array['Education'] = $data_array['Education'];
        $corrected_data_array['ClinicDuringRecord'] = $data_array['ClinicDuringRecord'];
        //        $corrected_data_array['PreviousClinic'] = $data_array['PreviousClinic'];
        $corrected_data_array['PossibleSourceInfection'] = $data_array['PossibleSourceInfection'];
        if ($data_array['PossibleSourceInfection'] == "6") {
            $corrected_data_array['PossibleSourceExtradata'] = '1';
            $corrected_data_array['TransfusionPlace'] = $data_array['TransfusionPlace'];
            $corrected_data_array['TransfusionDate'] = join_date($data_array, 'TransfusionDate');
        } else {
            if ($data_array['PossibleSourceInfection'] == "7") {
                $corrected_data_array['PossibleSourceExtradata'] = '1';
                $corrected_data_array['Country'] = $data_array['Country'];
                $corrected_data_array['Sailor'] = $data_array['Sailor'];
                $corrected_data_array['PartnerCountry'] = $data_array['PartnerCountry'];
                $corrected_data_array['PartnerDrugs'] = $data_array['PartnerDrugs'];
                $corrected_data_array['PartnerBi'] = $data_array['PartnerBi'];
                $corrected_data_array['PartnerTransfusion'] = $data_array['PartnerTransfusion'];
                $corrected_data_array['PartnerTransfusionAfter78'] = $data_array['PartnerTransfusionAfter78'];
                $corrected_data_array['PartnerHIVPlus'] = $data_array['PartnerHIVPlus'];
                $corrected_data_array['Undefined'] = $data_array['Undefined'];
            } else {
                $corrected_data_array['PossibleSourceExtradata'] = '0';
            }
        }
        $corrected_data_array['KnownDateOrometatropi'] = $data_array['KnownDateOrometatropi'];
        $corrected_data_array['FirstPositiveSample'] = join_date($data_array, 'FirstPositiveSample');
        if ($data_array['KnownDateOrometatropi'] == "1") {
            $corrected_data_array['LastNegativeSample'] = join_date($data_array, 'LastNegativeSample');
            $corrected_data_array['SeroconversionDate'] = join_date($data_array, 'SeroconversionDate');
        }
        $corrected_data_array['FirstPositiveSample'] = join_date($data_array, 'FirstPositiveSample');
        //        $corrected_data_array['FirstEntryAtClinic'] = join_date($data_array, 'FirstEntryAtClinic');
    }
    if ($table == 'atomiko_anamnistiko') {
        $corrected_data_array['PatientCode'] = $data_array['code'];
        $corrected_data_array['Hypertension'] = $data_array['Hypertension'];
        if ($data_array['Hypertension'] == 1) {
            $corrected_data_array['HypertensionDate'] = join_date($data_array, 'HypertensionDate');
        }
        $corrected_data_array['Stefaniaia'] = $data_array['Stefaniaia'];
        if ($data_array['Stefaniaia'] == 1) {
            $corrected_data_array['StefaniaiaDate'] = join_date($data_array, 'StefaniaiaDate');
        }
        /*        if ($data_array['Emfragma'] == 1)
                {        
                $corrected_data_array['Emfragma'] = $data_array['Emfragma'];
                $corrected_data_array['EmfragmaDate'] = join_date($data_array, 'EmfragmaDate');     
                }   */
        $corrected_data_array['Diabitis'] = $data_array['Diabitis'];
        if ($data_array['Diabitis'] == 1) {
            $corrected_data_array['DiabitisDate'] = join_date($data_array, 'DiabitisDate');
        }
        $corrected_data_array['Yperlipidaimia'] = $data_array['Yperlipidaimia'];
        if ($data_array['Yperlipidaimia'] == 1) {
            $corrected_data_array['YperlipidaimiaDate'] = join_date($data_array, 'YperlipidaimiaDate');
        }
        $corrected_data_array['Lipoatrofia'] = $data_array['Lipoatrofia'];
        if ($data_array['Lipoatrofia'] == 1) {
            $corrected_data_array['LipoatrofiaDate'] = join_date($data_array, 'LipoatrofiaDate');
        }
        $corrected_data_array['Enapothesi'] = $data_array['Enapothesi'];
        if ($data_array['Enapothesi'] == 1) {
            $corrected_data_array['EnapothesiDate'] = join_date($data_array, 'EnapothesiDate');
        }
        //        $corrected_data_array['Smoking'] = $data_array['Smoking'];
        /*        if ($data_array['Smoking'] == 1)
                {
                	$corrected_data_array['AgeStart'] = $data_array['AgeStart'];
                	$corrected_data_array['AgeFullStart'] = $data_array['AgeFullStart'];
                	$corrected_data_array['CigarretesPerDay'] = $data_array['CigarretesPerDay'];
                	$corrected_data_array['CigarsPerDay'] = $data_array['CigarsPerDay'];
                	$corrected_data_array['KapnosPipasPerDay'] = $data_array['KapnosPipasPerDay'];
                	$corrected_data_array['AgeStop'] = $data_array['AgeStop'];
                }
                if ($data_array['Smoking'] == 2)
                {
                	$corrected_data_array['AgeStart'] = $data_array['AgeStart'];
                	$corrected_data_array['AgeFullStart'] = $data_array['AgeFullStart'];
                	$corrected_data_array['CigarretesPerDay'] = $data_array['CigarretesPerDay'];
                	$corrected_data_array['CigarsPerDay'] = $data_array['CigarsPerDay'];
                	$corrected_data_array['KapnosPipasPerDay'] = $data_array['KapnosPipasPerDay'];
                } */
    }
    if ($table == 'exams_orologikes') {
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        check_patient($data_array['PatientCode']);
        $corrected_data_array['FTA'] = $data_array['FTA'];
        $corrected_data_array['FTADate'] = join_date($data_array, 'FTADate');
        $corrected_data_array['VDRL'] = $data_array['VDRL'];
        $corrected_data_array['VDRLDate'] = join_date($data_array, 'VDRLDate');
        $corrected_data_array['ToxoIgG'] = $data_array['ToxoIgG'];
        $corrected_data_array['ToxoIgGDate'] = join_date($data_array, 'ToxoIgGDate');
        $corrected_data_array['ToxoIgM'] = $data_array['ToxoIgM'];
        $corrected_data_array['ToxoIgMDate'] = join_date($data_array, 'ToxoIgMDate');
        $corrected_data_array['Anti-CMVIgG'] = $data_array['Anti-CMVIgG'];
        $corrected_data_array['Anti-CMVIgGDate'] = join_date($data_array, 'Anti-CMVIgGDate');
        $corrected_data_array['Anti-CMVIgM'] = $data_array['Anti-CMVIgG'];
        $corrected_data_array['Anti-CMVIgMDate'] = join_date($data_array, 'Anti-CMVIgMDate');
        $corrected_data_array['HBsAg'] = $data_array['HBsAg'];
        $corrected_data_array['HBsAgDate'] = join_date($data_array, 'HBsAgDate');
        $corrected_data_array['Anti-HBs'] = $data_array['Anti-HBs'];
        $corrected_data_array['Anti-HBsDate'] = join_date($data_array, 'Anti-HBsDate');
        $corrected_data_array['Anti-HBc'] = $data_array['Anti-HBc'];
        $corrected_data_array['Anti-HBcDate'] = join_date($data_array, 'Anti-HBcDate');
        $corrected_data_array['HBeAg'] = $data_array['HBeAg'];
        $corrected_data_array['HBeAgDate'] = join_date($data_array, 'HBeAgDate');
        $corrected_data_array['Anti-HBe'] = $data_array['Anti-HBe'];
        $corrected_data_array['Anti-HBeDate'] = join_date($data_array, 'Anti-HBeDate');
        $corrected_data_array['Anti-HCV'] = $data_array['Anti-HCV'];
        $corrected_data_array['Anti-HCVDate'] = join_date($data_array, 'Anti-HCVDate');
        $corrected_data_array['Anti-HDV'] = $data_array['Anti-HDV'];
        $corrected_data_array['Anti-HDVDate'] = join_date($data_array, 'Anti-HDVDate');
        $corrected_data_array['Mantoux'] = $data_array['Mantoux'];
        $corrected_data_array['MantouxDate'] = join_date($data_array, 'MantouxDate');
    }
    if ($table == 'exams_bioximikes') {
        $exams = $data_array['exams'];
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        check_patient($data_array['PatientCode']);
        for ($i = 0; $i < $exams; $i++) {
            $j = $i + 1;
            //	       $corrected_data_array['ExamNumber'.$i] = $j;
            $corrected_data_array['ExamDate' . $i] = join_date($data_array, 'ExamDate' . $i);
            $corrected_data_array['Sakxaro' . $i] = $data_array['Sakxaro' . $i];
            $corrected_data_array['HDL' . $i] = $data_array['HDL' . $i];
            $corrected_data_array['LDL' . $i] = $data_array['LDL' . $i];
            $corrected_data_array['Xolusterini' . $i] = $data_array['Xolusterini' . $i];
            $corrected_data_array['Triglukeridia' . $i] = $data_array['Triglukeridia' . $i];
        }
    }
    if ($table == 'prophylactic_therapies') {
        $therapies = $data_array['therapies'];
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        check_patient($data_array['PatientCode']);
        for ($i = 0; $i < $therapies; $i++) {
            $j = $i + 1;
            //	       $corrected_data_array['ExamNumber'.$i] = $j;
            if ($data_array['Therapy' . $i] == "on") {
                $corrected_data_array['Therapy' . $i] = $i + 1;
            }
            $corrected_data_array['Type' . $i] = $data_array['Type' . $i];
            $corrected_data_array['Reason' . $i] = $data_array['Reason' . $i];
            $corrected_data_array['EndDate' . $i] = join_date($data_array, 'EndDate' . $i);
            $corrected_data_array['StartDate' . $i] = join_date($data_array, 'StartDate' . $i);
        }
    }
    if ($table == 'exams_iologikes') {
        $exams = $data_array['exams'];
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        check_patient($data_array['PatientCode']);
        for ($i = 0; $i < $exams; $i++) {
            $j = $i + 1;
            //	       $corrected_data_array['ExamNumber'.$i] = $j;
            $corrected_data_array['Result' . $i] = $data_array['Result' . $i];
            if ($data_array['Result' . $i] == "-1") {
                $corrected_data_array['Operator' . $i] = $data_array['Operator1'];
            } else {
                $corrected_data_array['Operator' . $i] = $data_array['Operator2'];
            }
            $corrected_data_array['Value' . $i] = $data_array['Value' . $i];
            $corrected_data_array['Units' . $i] = $data_array['Units'];
            $corrected_data_array['Method' . $i] = $data_array['Method' . $i];
            $corrected_data_array['ExamDate' . $i] = join_date($data_array, 'ExamDate' . $i);
        }
    }
    if ($table == 'exams_iologikes_hep') {
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        check_patient($data_array['PatientCode']);
        $corrected_data_array['Result'] = $data_array['Result'];
        if ($data_array['Result'] == "-1") {
            $corrected_data_array['Operator'] = $data_array['Operator1'];
        } else {
            $corrected_data_array['Operator'] = $data_array['Operator2'];
        }
        $corrected_data_array['Value'] = $data_array['Value'];
        $corrected_data_array['Method'] = $data_array['Method'];
        $corrected_data_array['ExamDate'] = join_date($data_array, 'ExamDate');
    }
    if ($table == 'exams_anosologikes') {
        $exams = $data_array['exams'];
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        for ($i = 0; $i < $exams; $i++) {
            $j = $i + 1;
            //	       $corrected_data_array['ExamNumber'.$i] = $j;
            $corrected_data_array['ExamDate' . $i] = join_date($data_array, 'ExamDate' . $i);
            $corrected_data_array['AbsoluteLemf' . $i] = $data_array['AbsoluteLemf' . $i];
            $corrected_data_array['AbsoluteCD4' . $i] = $data_array['AbsoluteCD4' . $i];
            $corrected_data_array['PercentCD4' . $i] = $data_array['PercentCD4' . $i];
            $corrected_data_array['AbsoluteCD8' . $i] = $data_array['AbsoluteCD8' . $i];
            $corrected_data_array['PercentCD8' . $i] = $data_array['PercentCD8' . $i];
            //	       $corrected_data_array['Ratio'.$i] = $data_array['Ratio'.$i];
        }
    }
    if ($table == 'exams_ourwn') {
        $exams = $data_array['exams'];
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        for ($i = 0; $i < $exams; $i++) {
            $j = $i + 1;
            $corrected_data_array['ExamDate' . $i] = join_date($data_array, 'ExamDate' . $i);
            $corrected_data_array['EB' . $i] = $data_array['EB' . $i];
            $corrected_data_array['Leukwma' . $i] = $data_array['Leukwma' . $i];
            if ($corrected_data_array['Leukwma' . $i] == 3) {
                $corrected_data_array['Leukwma_extra' . $i] = $data_array['extra' . $i];
            } else {
                $corrected_data_array['Leukwma_extra' . $i] = null;
            }
            $corrected_data_array['Puosfairia' . $i] = $data_array['Puosfairia' . $i];
            $corrected_data_array['Eruthra' . $i] = $data_array['Eruthra' . $i];
            $corrected_data_array['Kulindroi' . $i] = $data_array['Kulindroi' . $i];
        }
    }
    if ($table == 'exams_aimatologikes') {
        $exams = $data_array['exams'];
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        for ($i = 0; $i < $exams; $i++) {
            $j = $i + 1;
            $corrected_data_array['ExamDate' . $i] = join_date($data_array, 'ExamDate' . $i);
            $corrected_data_array['AbsoluteLemf' . $i] = $data_array['AbsoluteLemf' . $i];
            $corrected_data_array['Leuka' . $i] = $data_array['Leuka' . $i];
            $corrected_data_array['Aimosfairini' . $i] = $data_array['Aimosfairini' . $i];
            $corrected_data_array['Aimopetalia' . $i] = $data_array['Aimopetalia' . $i];
            $corrected_data_array['Aimatokritis' . $i] = $data_array['Aimatokritis' . $i];
            $corrected_data_array['WhiteType' . $i] = $data_array['WhiteType' . $i];
        }
    }
    if ($table == 'antiretro_treatments') {
        $exams = $data_array['exams'];
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        $corrected_data_array['MELCode'] = $data_array['MELCode'];
        $corrected_data_array['OtherReason'] = $data_array['OtherReason'];
        $corrected_data_array['OtherUnwanted'] = $data_array['OtherUnwanted'];
        for ($i = 0; $i < $exams; $i++) {
            $j = $i + 1;
            $corrected_data_array['Schema' . $i] = $data_array['Schema' . $i];
            $corrected_data_array['StartDate' . $i] = join_date($data_array, 'StartDate' . $i);
            $corrected_data_array['EndDate' . $i] = join_date($data_array, 'EndDate' . $i);
            $corrected_data_array['Reason' . $i] = $data_array['Reason' . $i];
            $corrected_data_array['Unwanted1_' . $i] = $data_array['Unwanted1_' . $i];
            $corrected_data_array['Unwanted2_' . $i] = $data_array['Unwanted2_' . $i];
            $corrected_data_array['Unwanted3_' . $i] = $data_array['Unwanted3_' . $i];
            $corrected_data_array['Drugs1_' . $i] = $data_array['Drugs1_' . $i];
            $corrected_data_array['Drugs2_' . $i] = $data_array['Drugs2_' . $i];
        }
    }
    if ($table == 'aids_clinical_status') {
        $corrected_data_array['code'] = $data_array['code'];
        $corrected_data_array['HasAIDS'] = $data_array['HasAIDS'];
        $corrected_data_array['CategoryB'] = $data_array['CategoryB'];
        if ($data_array['Asymptotic'] == 1 || $data_array['Lemfadenopatheia'] == 1 || $data_array['Protoloimoksi'] == 1) {
            $corrected_data_array['CategoryA'] = 1;
        } else {
            $corrected_data_array['CategoryA'] = 0;
        }
    }
    if ($table == 'patients_category_a') {
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        $corrected_data_array['code'] = $data_array['code'];
        if (isset($data_array['Asymptotic'])) {
            $corrected_data_array['Asymptotic'] = $data_array['Asymptotic'];
        }
        if (isset($data_array['Lemfadenopatheia'])) {
            $corrected_data_array['Lemfadenopatheia'] = $data_array['Lemfadenopatheia'];
        }
        if (isset($data_array['Protoloimoksi'])) {
            $corrected_data_array['Protoloimoksi'] = $data_array['Protoloimoksi'];
        }
    }
    if ($table == 'patients_category_c_reappearances') {
        $nosoi = $data_array['num_nosoi_reappear'];
        $corrected_data_array['code'] = $data_array['code'];
        for ($i = 0; $i < $nosoi; $i++) {
            $j = $i + 1;
            $corrected_data_array['NososSymptDate' . $i] = join_date($data_array, 'NososSymptDate' . $i);
            $corrected_data_array['NososSymptID' . $i] = $data_array['NososSymptID' . $i];
            $corrected_data_array['NososSymptDiagnosis' . $i] = $data_array['NososSymptDiagnosis' . $i];
        }
    }
    if ($table == 'patients_category_b_reappearances') {
        $syndroms = $data_array['num_syndrom_reappear'];
        $corrected_data_array['code'] = $data_array['code'];
        for ($i = 0; $i < $syndroms; $i++) {
            $j = $i + 1;
            $corrected_data_array['ReccurenceDate' . $i] = join_date($data_array, 'ReccurenceDate' . $i);
            $corrected_data_array['ReccurenceSymptom' . $i] = $data_array['ReccurenceSymptom' . $i];
        }
    }
    if ($table == 'patients_category_b') {
        $corrected_data_array['code'] = $data_array['code'];
        for ($i = 0; $i < $data_array['symptoms']; $i++) {
            if (isset($data_array['ClinicSymptom' . $i])) {
                $corrected_data_array['ClinicSymptomDate' . $i] = join_date($data_array, 'ClinicSymptomDate' . $i);
                $corrected_data_array['ClinicSymptom' . $i] = $data_array['ClinicSymptom' . $i];
            }
        }
    }
    if ($table == 'patients_category_c') {
        $corrected_data_array['PatientCode'] = $data_array['code'];
        //		$corrected_data_array['HasReappearance'] = $data_array['HasReappearance'];
        if ($data_array['Kantintiasi'] != "") {
            $corrected_data_array['Kantintiasi'] = $data_array['Kantintiasi'];
            $corrected_data_array['Kantintiasi' . 'Date'] = join_date($data_array, 'Kantintiasi' . 'Date');
        }
        if ($data_array['KantintiasiOiso'] != "") {
            $corrected_data_array['KantintiasiOiso'] = $data_array['KantintiasiOiso'];
            $corrected_data_array['KantintiasiOiso' . 'Date'] = join_date($data_array, 'KantintiasiOiso' . 'Date');
        }
        if ($data_array['Kokkidioeidomukosi'] != "") {
            $corrected_data_array['Kokkidioeidomukosi'] = $data_array['Kokkidioeidomukosi'];
            $corrected_data_array['Kokkidioeidomukosi' . 'Date'] = join_date($data_array, 'Kokkidioeidomukosi' . 'Date');
        }
        if ($data_array['Kryptokokkosi'] != "") {
            $corrected_data_array['Kryptokokkosi'] = $data_array['Kryptokokkosi'];
            $corrected_data_array['Kryptokokkosi' . 'Date'] = join_date($data_array, 'Kryptokokkosi' . 'Date');
        }
        if ($data_array['Kryptosporidiosi'] != "") {
            $corrected_data_array['Kryptosporidiosi'] = $data_array['Kryptosporidiosi'];
            $corrected_data_array['Kryptosporidiosi' . 'Date'] = join_date($data_array, 'Kryptosporidiosi' . 'Date');
        }
        if ($data_array['CMV'] != "") {
            $corrected_data_array['CMV'] = $data_array['CMV'];
            $corrected_data_array['CMV' . 'Date'] = join_date($data_array, 'CMV' . 'Date');
        }
        if ($data_array['Amfiblistro'] != "") {
            $corrected_data_array['Amfiblistro'] = $data_array['Amfiblistro'];
            $corrected_data_array['Amfiblistro' . 'Date'] = join_date($data_array, 'Amfiblistro' . 'Date');
        }
        if ($data_array['AplosErpis'] != "") {
            $corrected_data_array['AplosErpis'] = $data_array['AplosErpis'];
            $corrected_data_array['AplosErpis' . 'Date'] = join_date($data_array, 'AplosErpis' . 'Date');
        }
        if ($data_array['Istoplasmosi'] != "") {
            $corrected_data_array['Istoplasmosi'] = $data_array['Istoplasmosi'];
            $corrected_data_array['Istoplasmosi' . 'Date'] = join_date($data_array, 'Istoplasmosi' . 'Date');
        }
        if ($data_array['Isosporidiosi'] != "") {
            $corrected_data_array['Isosporidiosi'] = $data_array['Isosporidiosi'];
            $corrected_data_array['Isosporidiosi' . 'Date'] = join_date($data_array, 'Isosporidiosi' . 'Date');
        }
        if ($data_array['Avium'] != "") {
            $corrected_data_array['Avium'] = $data_array['Avium'];
            $corrected_data_array['Avium' . 'Date'] = join_date($data_array, 'Avium' . 'Date');
        }
        if ($data_array['Fumatiosi'] != "") {
            $corrected_data_array['Fumatiosi'] = $data_array['Fumatiosi'];
            $corrected_data_array['Fumatiosi' . 'Date'] = join_date($data_array, 'Fumatiosi' . 'Date');
        }
        if ($data_array['ExoFumatiosi'] != "") {
            $corrected_data_array['ExoFumatiosi'] = $data_array['ExoFumatiosi'];
            $corrected_data_array['ExoFumatiosi' . 'Date'] = join_date($data_array, 'ExoFumatiosi' . 'Date');
        }
        if ($data_array['Mukobacteria'] != "") {
            $corrected_data_array['Mukobacteria'] = $data_array['Mukobacteria'];
            $corrected_data_array['Mukobacteria' . 'Date'] = join_date($data_array, 'Mukobacteria' . 'Date');
        }
        if ($data_array['Carinii'] != "") {
            $corrected_data_array['Carinii'] = $data_array['Carinii'];
            $corrected_data_array['Carinii' . 'Date'] = join_date($data_array, 'Carinii' . 'Date');
        }
        if ($data_array['Pneumonia12'] != "") {
            $corrected_data_array['Pneumonia12'] = $data_array['Pneumonia12'];
            $corrected_data_array['Pneumonia12' . 'Date'] = join_date($data_array, 'Pneumonia12' . 'Date');
        }
        if ($data_array['Poluestiaki'] != "") {
            $corrected_data_array['Poluestiaki'] = $data_array['Poluestiaki'];
            $corrected_data_array['Poluestiaki' . 'Date'] = join_date($data_array, 'Poluestiaki' . 'Date');
        }
        if ($data_array['Salmonela'] != "") {
            $corrected_data_array['Salmonela'] = $data_array['Salmonela'];
            $corrected_data_array['Salmonela' . 'Date'] = join_date($data_array, 'Salmonela' . 'Date');
        }
        if ($data_array['Toksoplasmosi'] != "") {
            $corrected_data_array['Toksoplasmosi'] = $data_array['Toksoplasmosi'];
            $corrected_data_array['Toksoplasmosi' . 'Date'] = join_date($data_array, 'Toksoplasmosi' . 'Date');
        }
        if ($data_array['WombCancer'] != "") {
            $corrected_data_array['WombCancer'] = $data_array['WombCancer'];
            $corrected_data_array['WombCancer' . 'Date'] = join_date($data_array, 'WombCancer' . 'Date');
        }
        if ($data_array['Anoia'] != "") {
            $corrected_data_array['Anoia'] = $data_array['Anoia'];
            $corrected_data_array['Anoia' . 'Date'] = join_date($data_array, 'Anoia' . 'Date');
        }
        if ($data_array['Kaposi'] != "") {
            $corrected_data_array['Kaposi'] = $data_array['Kaposi'];
            $corrected_data_array['Kaposi' . 'Date'] = join_date($data_array, 'Kaposi' . 'Date');
        }
        if ($data_array['Burkitt'] != "") {
            $corrected_data_array['Burkitt'] = $data_array['Burkitt'];
            $corrected_data_array['Burkitt' . 'Date'] = join_date($data_array, 'Burkitt' . 'Date');
        }
        if ($data_array['Anosoblastiko'] != "") {
            $corrected_data_array['Anosoblastiko'] = $data_array['Anosoblastiko'];
            $corrected_data_array['Anosoblastiko' . 'Date'] = join_date($data_array, 'Anosoblastiko' . 'Date');
        }
        if ($data_array['Protopathes'] != "") {
            $corrected_data_array['Protopathes'] = $data_array['Protopathes'];
            $corrected_data_array['Protopathes' . 'Date'] = join_date($data_array, 'Protopathes' . 'Date');
        }
        if ($data_array['Apisxniasi'] != "") {
            $corrected_data_array['Apisxniasi'] = $data_array['Apisxniasi'];
            $corrected_data_array['Apisxniasi' . 'Date'] = join_date($data_array, 'Apisxniasi' . 'Date');
        }
    }
    if ($table == 'other_treatments') {
        $therapies = $data_array['therapies'];
        $corrected_data_array['PatientCode'] = $data_array['PatientCode'];
        check_patient($data_array['PatientCode']);
        for ($i = 0; $i < $therapies; $i++) {
            $j = $i + 1;
            if ($data_array['Therapy' . $i] == "on") {
                $corrected_data_array['Therapy' . $i] = $i + 1;
            }
            $corrected_data_array['EndDate' . $i] = join_date($data_array, 'EndDate' . $i);
            $corrected_data_array['StartDate' . $i] = join_date($data_array, 'StartDate' . $i);
        }
    }
    //    print_r($corrected_data_array);
    return $corrected_data_array;
}