ESH/getProblemData.php

58 lines
2.0 KiB
PHP
Raw Permalink Normal View History

2024-10-23 18:28:06 +05:30
<?php
include('includes/config/config.php');
include('includes/functions.php');
$empId = $_REQUEST['emp_id'];
$p_id=getTableFieldValue('problem_master','pid','pcode','"'.$_REQUEST['prob_code'].'"');
$query = "select * from problem_response_details where rid in (select rid from problem_response where patient_id='".$empId."' and pid='".$p_id."') ";
if (!$result = @mysqli_query($conn,$query)) {
exit(mysqli_error($conn));
}
$data = array();
$rvalue=array();
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
array_push($rvalue,$row['rvalue']);
}
}
else
{
$data['status'] = 200;
$data['message'] = "Data not found!";
}
if($_REQUEST['prob_code']=='ADC'){
$advice=array();
for($i=0;$i<count($rvalue);$i++){
array_push($advice,getTableFieldValue('health_advice','health_advice_name','health_advice_id',$rvalue[$i]));
}
$rvalue=$advice;
}
if($_REQUEST['prob_code']=='RSK'){
$advice=array();
for($i=0;$i<count($rvalue);$i++){
array_push($advice,getTableFieldValue("health_risk", "health_risk_name", "health_risk_id",$rvalue[$i]));
}
$rvalue=$advice;
}
if($_REQUEST['prob_code']=='ABT' && $_REQUEST['form_type']=='checkup' ){
$advice=array();
for($i=0;$i<count($rvalue);$i++){
array_push($advice,getTableFieldValue("abnormality", "abnormality_name", "abnormality_id",$rvalue[$i]));
}
$rvalue=$advice;
}
if($_REQUEST['prob_code']=='PPI' && $_REQUEST['form_type']=='checkup' ){
$advice=array();
for($i=0;$i<count($rvalue);$i++){
array_push($advice,getTableFieldValue("history_parameter", "param_name", "param_id",$rvalue[$i]));
}
$rvalue=$advice;
}
$data['value']=$rvalue;
error_log("str problem_response_details ".print_r($data,true));
echo json_encode($data);
?>