50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
include('log_entry.php');
|
|
|
|
|
|
$EmployeeOpd = "SELECT * FROM employee_appointment where health_index is null";
|
|
|
|
error_log("OPD HEALTH SCORE : " . $EmployeeOpd);
|
|
|
|
$ResultOfOPd = mysqli_query($conn, $EmployeeOpd);
|
|
|
|
while ($fetch = mysqli_fetch_assoc($ResultOfOPd)) {
|
|
|
|
$emp_id = $fetch['emp_id'];
|
|
|
|
$sbp = $fetch['bp_sbp'];
|
|
$dbp = $fetch['bp_dbp'];
|
|
$bmi = $fetch['bmi'];
|
|
$height = $fetch['height'];
|
|
$weight = $fetch['weight'];
|
|
$ppbs = $fetch['blood_sugar_ppbs'];
|
|
|
|
$fbs = $fetch['blood_sugar_fbs'];
|
|
$cholesterol = $fetch['total_cholesterol'];
|
|
$AppointDate = date('Y-m-d', strtotime($fetch['appointment_date']));
|
|
$Type = $fetch['appointment_type'];
|
|
$AppointId = $fetch['appointment_id'];
|
|
|
|
|
|
$hdl = $fetch['hdl'];
|
|
$ldl = $fetch['ldl'];
|
|
$triglyceride = $fetch['triglyceride'];
|
|
|
|
if($sbp == '' && $dbp =='' && $bmi == '' && $fbs == '' && $total_cholesterol == ''){
|
|
continue;
|
|
}
|
|
|
|
$health_score = calculateHealthIndex($sbp, $dbp, $bmi, $fbs, $cholesterol, $height, $weight, $ppbs, $hdl, $ldl, $triglyceride);
|
|
|
|
|
|
StoreHealthIndex($AppointDate, $health_score, $emp_id, $Type);
|
|
|
|
$UpdateOpd = "UPDATE employee_appointment SET health_index = '$health_score' WHERE appointment_id = '$AppointId'";
|
|
|
|
|
|
$UpdateOfOPd = mysqli_query($conn, $UpdateOpd);
|
|
}
|