52 lines
2.3 KiB
PHP
52 lines
2.3 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
// $agencyId = $_REQUEST['agencyId'];
|
|
|
|
$section_id = implode(",", $_REQUEST['section_id']);
|
|
$appointment_lab_id = trim($_REQUEST['appointment_lab_id']);
|
|
$followup_lab_id = trim($_REQUEST['followup_lab_id']);
|
|
|
|
error_log("appointment id for lab " . $appointment_lab_id . " followup lab id " . $followup_lab_id);
|
|
|
|
$query = "";
|
|
|
|
if ($appointment_lab_id != '' && $appointment_lab_id > 0 && $followup_lab_id == 0) {
|
|
$test_param_ids = getFieldFromTable('recommended_test_param_new', 'employee_appointment', 'appointment_id', $appointment_lab_id);
|
|
} else if ($appointment_lab_id != '' && $followup_lab_id != '' && $appointment_lab_id > 0 && $followup_lab_id > 0) {
|
|
$test_param_ids = getFieldFromTable('recommended_test_param_new', 'followup_details', 'followup_id', $followup_lab_id);
|
|
}
|
|
|
|
if ($test_param_ids != null && $test_param_ids != '' && !empty($test_param_ids)) {
|
|
|
|
$query = "select a.checkup_parameter_id,b.device_param_code,b.device_id from checkup_parameter a left join device_param_map b on a.checkup_parameter_id=b.checkup_parameter_id where checkup_form_section_id in ($section_id) and b.device_param_code!='' and b.device_id!='' and a.checkup_parameter_id in ($test_param_ids)";
|
|
} else {
|
|
$query = "select a.checkup_parameter_id,b.device_param_code,b.device_id from checkup_parameter a left join device_param_map b on a.checkup_parameter_id=b.checkup_parameter_id where checkup_form_section_id in ($section_id) and b.device_param_code!='' and b.device_id!='' ";
|
|
}
|
|
$paras = array();
|
|
error_log("CHECKUP PARAMETERS::" . $query);
|
|
if (!$result = @mysqli_query($conn, $query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
$data = array();
|
|
$count = mysqli_num_rows($result);
|
|
if (mysqli_num_rows($result) > 0) {
|
|
$i = 0;
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
$data[$i]['checkup_parameter_id'] = $row['checkup_parameter_id'];
|
|
$data[$i]['device_param_code'] = $row['device_param_code'];
|
|
$data[$i]['device_id'] = $row['device_id'];
|
|
array_push($paras, $row['checkup_parameter_id']);
|
|
$i++;
|
|
}
|
|
|
|
$data['paras'] = $paras;
|
|
$data['count'] = $count;
|
|
} else {
|
|
$data['status'] = 200;
|
|
$data['message'] = "Data not found!";
|
|
}
|
|
|
|
error_log('paras' . print_r($data, true));
|
|
echo json_encode($data);
|