$chronic) { if ($chronic != 'ALL') { $chronic_illness_str .= $chronic . ","; } } $chronic_illness_str .= "0)"; } error_log("chronics " . $chronic_illness_str); $start = date('d-m-Y', strtotime($_POST['opdDate1'])); $end = date('d-m-Y', strtotime($_POST['opdDate2'])); $from_date1 = date('Y-m-d', strtotime($_POST['opdDate1'])); $from_date = date('d-m-Y', strtotime($from_date1)); $from_date2 = date('Y-m-d', strtotime($_POST['opdDate2'])); $to_date = date('d-m-Y', strtotime($from_date2)); ?>
Pending Chronic Medication Medicine Report
From Date:    To Date:

$chronic_illness) { if ($chronic_illness == 'ALL') { $query = "SELECT distinct(p.emp_id) as emp FROM `prescription_master` p left join view_patient_master v on p.emp_id=v.id where v.status='Active' and p.remission_date is null and p.medicine_name is not null and p.medicine_name!='' and p.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' "; } else { $query = "SELECT distinct(p.emp_id) as emp FROM `prescription_master` p left join view_patient_master v on p.emp_id=v.id where v.status='Active' and p.diseases = '" . $chronic_illness . "' and p.remission_date is null and p.medicine_name is not null and p.medicine_name!='' and p.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' "; } // echo $query; $result_query = mysqli_query($conn, $query); while ($row_query = mysqli_fetch_assoc($result_query)) { if (!in_array($row_query["emp"], $chronic_patient_arr)) { array_push($chronic_patient_arr, $row_query["emp"]); $sql = "SELECT count(*) as apps FROM employee_appointment a JOIN patient_master b on a.emp_id=b.id WHERE a.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' and a.appointment_date BETWEEN STR_TO_DATE('$from_date1','%Y-%m-%d') and STR_TO_DATE('$from_date2','%Y-%m-%d') and emp_id='" . $row_query["emp"] . "' and chronic_day >0 order by a.appointment_date ASC"; // echo($sql); $result = mysqli_query($conn, $sql); while ($row_app = mysqli_fetch_assoc($result)) { if ($row_app["apps"] == 0) { $q_pres = "SELECT * FROM `prescription_master` a left join patient_master b on a.emp_id=b.id where remission_date is null and emp_id='" . $row_query["emp"] . "' and `medicine_name` is not null and `medicine_name`!='' and a.ohc_type_id='" . $_SESSION['current_ohcttype'] . "' " . $chronic_illness_str; // echo ($q_pres); $result_pres = mysqli_query($conn, $q_pres); while ($prescription = mysqli_fetch_assoc($result_pres)) { if (!in_array($prescription["prescription_id"], $prescription_id)) { array_push($prescription_id, $prescription["prescription_id"]); // echo $prescription["emp_id"]; if ($prescription['diagnosis_date'] != null && $prescription['diagnosis_date'] != '' && $prescription['diagnosis_date'] != '1970-01-01' && $prescription['diagnosis_date'] != '0000-00-00') { $date = DateTime::createFromFormat('Y-m-d', $prescription['diagnosis_date']); // Format the date in "d/m/Y" format $newDateFormat = $date->format('d/m/Y'); $diagnosis_date = $newDateFormat; } else { $diagnosis_date = "Not Present"; } ?>
Sr. Chronic Illness Patient Name Emp. No. Diagnosis Date Age Sex Mobile No. Plant Employer Designation Division Department Section Medicine Frequency Timing Admin.Route Duration
diff($to)->y; ?>