116 lines
2.9 KiB
PHP
116 lines
2.9 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
include('log_entry.php');
|
|
$noOfRows=$_POST['count_items'];
|
|
|
|
//error_log("rows: ".$noOfRows);
|
|
|
|
$patient_id = $_REQUEST['patient_id'];
|
|
$question_id = $_POST['question_id'];
|
|
$temperature = $_POST['temperature'];
|
|
$pulse = $_POST['pulse'];
|
|
$bp = $_POST['bp'];
|
|
$spo2 = $_POST['spo2'];
|
|
$others = $_POST['others'];
|
|
$total=$_POST['total'];
|
|
$date =$_POST['test_date'];
|
|
|
|
//error_log($pulse);
|
|
|
|
//$question_id = $_REQUEST['question_id'];
|
|
// $dis_agncy = $_POST['dis_agncy'];
|
|
//error_log('1');
|
|
//echo "hello".$noOfRows;
|
|
|
|
//
|
|
//echo $sql_ifexists;
|
|
|
|
// $result_ifexists = mysqli_query($conn,$sql_ifexists );
|
|
// echo "adarsh";
|
|
// $exists = @mysqli_num_rows($result_ifexists);
|
|
// echo "existing rows:".$exists;
|
|
// if($exists>0){
|
|
// $del_qry="delete from covid_questionaire where question_id = '".$question_id."'";
|
|
|
|
// echo $del_qry;
|
|
// mysqli_query($conn,$del_qry);
|
|
|
|
|
|
// }
|
|
|
|
$total_yes=array();
|
|
//$question_id = $_POST['question_id'];
|
|
for($i=0;$i<$noOfRows;$i++){
|
|
|
|
// $question_id_str="question_id".$i;
|
|
// $question_id=$_REQUEST[$question_id_str];
|
|
// echo $communication_id;
|
|
|
|
$xyz='answer_status'.$i;
|
|
//error_log("question_id".$question_id);
|
|
if(strcmp($_POST[$xyz],"y")===0){
|
|
|
|
$abc='question_id'.$i;
|
|
|
|
array_push($total_yes,$_POST[$abc]);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$yes=implode(",",$total_yes);
|
|
error_log($yes);
|
|
|
|
$count=getFieldFromTable('count(patient_id)','covid_screening_details','patient_id',$patient_id);
|
|
|
|
if($count !=0){
|
|
error_log('update query');
|
|
$query1="update covid_screening_details set question_id='$yes',test_date='$test_date',temperature='$temperature',pulse='$pulse',bp='$bp',spo2='$spo2', others ='$others',total='$total' WHERE patient_id='$patient_id'";
|
|
}
|
|
else{
|
|
$query1="insert into covid_screening_details set patient_id='$patient_id', question_id='$yes',test_date='$test_date',temperature='$temperature',pulse='$pulse',bp='$bp',spo2='$spo2', others ='$others',total='$total'";
|
|
}
|
|
|
|
error_log($query1);
|
|
if (!$result = @mysqli_query($conn,$query1)) {
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
// //echo $procurement_refno;
|
|
// $query_initial="insert into ";
|
|
// $endquery="";
|
|
|
|
|
|
|
|
// $query=$query_initial." covid_questionaire set question_id ='".${"question_id$i"}."',question_hindi ='".${"question_hindi$i"}."',answer_status ='".${"answer_status$i"}."',score ='".${"score$i"}."',modified_by = '".$_SESSION['user_id']."' ".$endquery;
|
|
|
|
// echo $query;
|
|
// error_log($query);
|
|
// if (!$result = @mysqli_query($conn,$query)) {
|
|
// rollback();
|
|
// exit(error_log(mysqli_error($conn)));
|
|
// }
|
|
// }
|
|
//commit();
|
|
|
|
?>
|
|
|