116 lines
2.8 KiB
PHP
116 lines
2.8 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
include('log_entry.php');
|
|
$noOfRows=$_POST['count_items'];
|
|
|
|
|
|
error_log("rows: ".$noOfRows);
|
|
|
|
$screening_date = $_REQUEST['comm_date'];
|
|
|
|
error_log($screening_date);
|
|
$patient_id = $_REQUEST['patient_id'];
|
|
$question_id = $_POST['question_id'];
|
|
|
|
// 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('----------');
|
|
error_log($_REQUEST['patient_id']);
|
|
|
|
$count=getFieldFromTable('count(patient_id)','work_at_height_details','patient_id',$patient_id);
|
|
|
|
if($count != 0){
|
|
error_log('update query');
|
|
$query1="update work_at_height_details set screen_date=STR_TO_DATE('".$screening_date."', '%d/%m/%Y %h:%i %p'),question_id='$yes' where patient_id = '$patient_id' ";
|
|
}
|
|
else{
|
|
$query1="insert into work_at_height_details set screen_date=STR_TO_DATE('".$screening_date."', '%d/%m/%Y %h:%i %p'),question_id='$yes',patient_id='$patient_id'";
|
|
}
|
|
|
|
// $query1="insert into work_at_height_details set question_id='$yes',patient_id='$patient_id'";
|
|
|
|
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();
|
|
|
|
?>
|
|
|