ESH/select_chronic_illness.php

53 lines
1.8 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');
include('log_entry.php');
$id = $_REQUEST['id'];
$query = "SELECT * from prescription_master where prescription_id = '" . $id . "'";
error_log($query);
if (!$result = @mysqli_query($conn, $query)) {
exit(mysqli_error($conn));
}
$data = array();
if (mysqli_num_rows($result) > 0) {
$row = @mysqli_fetch_assoc($result);
// $exist_sql = "select b.diagnosis_date from problem_response a inner join problem_response_details b on a.rid = b.rid where a.pid=(select pid from problem_master where pcode='ABT') and a.patient_id = '" . $row['emp_id'] . "' and b.rvalue = '" . $row['diseases'] . "'";
// error_log("problem response checking sql " . $exist_sql);
// $result_sql = mysqli_query($conn, $exist_sql);
// $row_res = mysqli_fetch_assoc($result_sql);
$diagnosis_date = $row['diagnosis_date'];
$data = [
'prescription_id' => $row['prescription_id'],
'diseases' => $row['diseases'],
'emp_id' => $row['emp_id'],
'patient_name' => getTableFieldValue('patient_master', 'patient_name', 'id', $row['emp_id']),
'medicine_name' => $row['medicine_name'],
'medicine_frequency' => $row['medicine_frequency'],
'medicine_timing' => $row['medicine_timing'],
'admin_route' => $row['admin_route'],
'duration' => $row['duration'],
'dose_qty' => $row['dose_qty'],
'health_advices' => $row['health_advices'],
'diagnosis_date' => $diagnosis_date,
'remission_date' =>$row['remission_date'],
];
} else {
$data['status'] = 200;
$data['message'] = "Data not found!";
error_log($data['message']);
}
error_log('data '.print_r($data,true));
echo json_encode($data);