96 lines
3.9 KiB
PHP
96 lines
3.9 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('log_entry.php');
|
|
include ('includes/functions.php');
|
|
$id = $_POST['covid_monitoring_id'];
|
|
$patient_id = $_POST['patient_id'];
|
|
$date_added = date('Y-m-d');
|
|
$covid_contact_id =$_POST['covid_contact_type'];
|
|
$staying_id =$_POST['covid_patient_staying'];
|
|
$remarks =$_POST['remarks'];
|
|
$rat_result =$_POST['rat_test_result'];
|
|
$spo2_basis =$_POST['spo2_basis'];
|
|
$covid_test_result_id =$_POST['test_result'];
|
|
$resumed_duties_from =$_POST['resume_duties_from'];
|
|
$tested_positive_on =$_POST['positive_on'];
|
|
$discharge_on =$_POST['discharge_on'];
|
|
$health_problems = $_POST['health_problem'];
|
|
$travel_history = $_POST['travel_history'];
|
|
$hq_fromdate = $_POST['hq_fromdate'];
|
|
$hq_todate = $_POST['hq_todate'];
|
|
$prest_fromdate = $_POST['prest_fromdate'];
|
|
$prest_todate = $_POST['prest_todate'];
|
|
$sample_date = $_POST['sample_date'];
|
|
$admission_on = $_POST['admission_on'];
|
|
error_log ( "Start Printing Request Attributes" );
|
|
$requestStr="";
|
|
foreach ( $_REQUEST as $key => $value ) {
|
|
$requestStr.=$key . " : " . $value . "\n";
|
|
error_log ( $key . " : " . $value . "<br />\r\n" );
|
|
}
|
|
error_log ( "End Printing Request Attributes" );
|
|
save_log($requestStr,'Save Covid monitoring','Save','save_covid_monitoring.php');
|
|
// echo "patient_id".$patient_id;
|
|
// echo "date_added".$date_added;
|
|
// echo "covid_contact_id".$covid_contact_id;
|
|
// echo "staying_id".$staying_id;
|
|
// echo "spo2_basis".$spo2_basis;
|
|
// echo "remarks".$remarks;
|
|
// echo "covid_test_result_id".$covid_test_result_id;
|
|
// echo "resumed_duties_from".$resumed_duties_from;
|
|
// echo "tested_positive_on".$tested_positive_on;
|
|
// echo "discharge_on".$discharge_on;
|
|
|
|
// error_log("id: ".$patient_id."contact id: ".$covid_contact_id." remarks: ".$remarks." positive_on: ".$tested_positive_on);
|
|
|
|
if(!empty($id)){
|
|
$query = "update covid_monitoring set date_added = '$date_added', emp_id = '$patient_id', covid_contact_id = '$covid_contact_id', staying_id = '$staying_id', spo2_basis = '$spo2_basis', remarks = '$remarks',health_problems='$health_problems',travel_history='$travel_history' ,covid_test_result_id = '$covid_test_result_id',resumed_duties_from = '$resumed_duties_from',sample_date='$sample_date',tested_positive_on = '$tested_positive_on', discharge_on = '$discharge_on',hq_fromdate='$hq_fromdate',hq_todate='$hq_todate',prest_fromdate='$prest_fromdate',prest_todate='$prest_todate',admission_on='$admission_on', modified_by = '".$_SESSION['user_id']."' where id = '".$id."' ";
|
|
}
|
|
else {
|
|
$query = "insert into covid_monitoring(date_added, emp_id, covid_contact_id, staying_id, spo2_basis, remarks,health_problems,travel_history, covid_test_result_id, resumed_duties_from,sample_date ,tested_positive_on, discharge_on,hq_fromdate,hq_todate,prest_fromdate,prest_todate,admission_on,modified_by) values ('$date_added','$patient_id','$covid_contact_id','$staying_id', '$spo2_basis', '$remarks','$health_problems','$travel_history','$covid_test_result_id','$resumed_duties_from','$sample_date','$tested_positive_on','$discharge_on','$hq_fromdate','$hq_todate','$prest_fromdate','$prest_todate', '$admission_on','".$_SESSION['user_id']."' ); ";
|
|
}
|
|
|
|
|
|
error_log("executed covid query: ".$query);
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
else{
|
|
|
|
|
|
$query = "select max(id) id from covid_monitoring ";
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result) > 0) {
|
|
while ($row = @mysqli_fetch_assoc($result)) {
|
|
|
|
$id_max = $row['id'];
|
|
}
|
|
}
|
|
|
|
|
|
$query = "select * from covid_monitoring where id='".$id_max."'";
|
|
//echo $query;
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result) > 0) {
|
|
while ($row = @mysqli_fetch_assoc($result)) {
|
|
|
|
$data=$row;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
if($data==null)
|
|
{
|
|
$data['status'] = 200;
|
|
$data['message'] = "Data not found!";
|
|
}
|
|
echo json_encode($data);
|
|
?>
|