104 lines
5.6 KiB
PHP
104 lines
5.6 KiB
PHP
<?php
|
|
include ('includes/config/config.php');
|
|
include ('includes/functions.php');
|
|
error_reporting ( E_ALL & ~ E_NOTICE & ~ E_DEPRECATED & ~ E_WARNING );
|
|
|
|
// include log entry header file
|
|
include ('log_entry.php');
|
|
|
|
$appointment_id = $_REQUEST ['appointment_id'];
|
|
$examinar_id = $_REQUEST ['examinar_id'];
|
|
$ticket_no = $_REQUEST ['ticket_no'];
|
|
$data = array ();
|
|
$appointment_date = $_POST ['appointment_date'];
|
|
$spoc2_percent = $_POST ['spo2_percent'];
|
|
$chest_examination = $_POST ['chest_examination'];
|
|
$temperature = $_POST ['temperature'];
|
|
$entry_med_test = $_POST ['entry_med_test'];
|
|
|
|
$entry_med_epilepsy = $_POST ['entry_med_epilepsy'];
|
|
$entry_med_ill = $_POST ['entry_med_ill'];
|
|
$entry_med_ill_comment = $_POST ['entry_med_ill_comment'];
|
|
$entry_med_aller = $_POST ['entry_med_aller'];
|
|
$entry_med_aller_comment = $_POST ['entry_med_aller_comment'];
|
|
$entry_med_medi = $_POST ['entry_med_medi'];
|
|
$entry_med_medi_comment = $_POST ['entry_med_medi_comment'];
|
|
$entry_med_reac = $_POST ['entry_med_reac'];
|
|
$entry_med_reac_comment = $_POST ['entry_med_reac_comment'];
|
|
|
|
$role_id = getFieldFromTable ( 'role_id', 'tbl_users', 'user_id', $_SESSION ['user_id'] );
|
|
$role = getFieldFromTable ( 'role_code', 'role_master', 'role_id', $role_id );
|
|
|
|
$query = "";
|
|
$query_initial = "";
|
|
$query_end = " ";
|
|
begin ();
|
|
if (! empty ( $_REQUEST ['appointment_id'] )) {
|
|
|
|
$data ['message'] = "update";
|
|
$query_initial = " update visitors_employee_appointment ";
|
|
$query_end = " where appointment_id = '" . $_REQUEST ['appointment_id'] . "'";
|
|
} else {
|
|
$query_initial = "insert into visitors_employee_appointment ";
|
|
$data ['message'] = "save";
|
|
}
|
|
|
|
if ($role != 'DOC') {
|
|
$query = " SET emp_id='" . addslashes ( $_REQUEST ['emp_id'] ) . "', ticket_no='$ticket_no', chest_examination ='" . $_REQUEST ['chest_examination'] . "',
|
|
bp_sbp ='" . $_REQUEST ['sbp'] . "',heart_rate='" . $_POST ['heart_rate'] . "',bp_dbp ='" . $_REQUEST ['dbp'] . "',
|
|
appointment_date =STR_TO_DATE('" . $_POST ['appointment_date'] . "','%d/%m/%Y %h:%i %p'), remarks='" . $_REQUEST ['remarks'] . "',
|
|
token_no='" . addslashes ( $_REQUEST ['token_no'] ) . "', temperature='" . addslashes ( $temperature ) . "',
|
|
spo2_percent='" . addslashes ( $spoc2_percent ) . "', entry_med_test='" . addslashes ( $entry_med_test ) . "' ,
|
|
entry_med_epilepsy='" . addslashes ( $entry_med_epilepsy ) . "' , entry_med_diabetes='" . addslashes ( $_REQUEST ['entry_med_diabetes'] ) . "' ,
|
|
entry_med_ill='" . addslashes ( $entry_med_ill ) . "' ,entry_med_ill_comment='" . addslashes ( $entry_med_ill_comment ) . "' ,
|
|
entry_med_aller='" . addslashes ( $entry_med_aller ) . "' ,entry_med_aller_comment='" . addslashes ( $entry_med_aller_comment ) . "' ,
|
|
entry_med_medi='" . addslashes ( $entry_med_medi ) . "' , entry_med_medi_comment='" . addslashes ( $entry_med_medi_comment ) . "' ,
|
|
entry_med_reac='" . addslashes ( $entry_med_reac ) . "' , entry_med_reac_comment='" . addslashes ( $entry_med_reac_comment ) . "' ,
|
|
ohc_type_id = '" . $_SESSION ['current_ohcttype'] . "', examinar_id='" . addslashes ( $_SESSION ['user_id'] ) . "',
|
|
modified_by='" . addslashes ( $_SESSION ['user_id'] ) . "'";
|
|
} else {
|
|
$query = " SET emp_id='" . addslashes ( $_REQUEST ['emp_id'] ) . "', ticket_no='$ticket_no', chest_examination ='" . $_REQUEST ['chest_examination'] . "',
|
|
bp_sbp ='" . $_REQUEST ['sbp'] . "',heart_rate='" . $_POST ['heart_rate'] . "',bp_dbp ='" . $_REQUEST ['dbp'] . "',
|
|
appointment_date =STR_TO_DATE('" . $_POST ['appointment_date'] . "','%d/%m/%Y %h:%i %p'), remarks='" . $_REQUEST ['remarks'] . "',
|
|
token_no='" . addslashes ( $_REQUEST ['token_no'] ) . "', temperature='" . addslashes ( $temperature ) . "',
|
|
spo2_percent='" . addslashes ( $spoc2_percent ) . "',entry_med_test='" . addslashes ( $entry_med_test ) . "',
|
|
entry_med_epilepsy='" . addslashes ( $entry_med_epilepsy ) . "' , entry_med_diabetes='" . addslashes ( $_REQUEST ['entry_med_diabetes'] ) . "' ,
|
|
entry_med_ill='" . addslashes ( $entry_med_ill ) . "' ,entry_med_ill_comment='" . addslashes ( $entry_med_ill_comment ) . "' ,
|
|
entry_med_aller='" . addslashes ( $entry_med_aller ) . "' ,entry_med_aller_comment='" . addslashes ( $entry_med_aller_comment ) . "' ,
|
|
entry_med_medi='" . addslashes ( $entry_med_medi ) . "' , entry_med_medi_comment='" . addslashes ( $entry_med_medi_comment ) . "' ,
|
|
entry_med_reac='" . addslashes ( $entry_med_reac ) . "' , entry_med_reac_comment='" . addslashes ( $entry_med_reac_comment ) . "',
|
|
ohc_type_id = '" . $_SESSION ['current_ohcttype'] . "', reviewer_id='" . addslashes ( $_SESSION ['user_id'] ) . "',
|
|
reviewer_comment='" . addslashes ( $_REQUEST ['reviewer_comment'] ) . "', modified_by='" . addslashes ( $_SESSION ['user_id'] ) . "'";
|
|
}
|
|
|
|
$query = $query_initial . " " . $query . " " . $query_end;
|
|
|
|
error_log ( "query: " . $query );
|
|
|
|
if (! $result = @mysqli_query($conn,$query )) {
|
|
rollback ();
|
|
exit ( error_log ( mysqli_error($conn) ) );
|
|
} else {
|
|
|
|
if (empty ( $_REQUEST ['appointment_id'] )) {
|
|
$query = "select max(appointment_id) as appointment_id from visitors_employee_appointment where emp_id = '" . addslashes ( $_REQUEST ['emp_id'] ) . "' ";
|
|
error_log ( "max appointment_id query: " . $query );
|
|
if (! $result = @mysqli_query($conn,$query )) {
|
|
rollback ();
|
|
exit ( error_log ( mysqli_error($conn) ) );
|
|
}
|
|
if (mysqli_num_rows ( $result ) > 0) {
|
|
while ( $row = mysqli_fetch_assoc ( $result ) ) {
|
|
$appointment_id = $row ['appointment_id'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
commit ();
|
|
$data ['appointment_id'] = $appointment_id;
|
|
error_log ( $appointment_id . " id: " . $data ['appointment_id'] );
|
|
echo json_encode ( $data );
|
|
|
|
?>
|