From 4472d092324101021651148a90e07f81524958c7 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 22 Mar 2026 10:15:48 +0000 Subject: [PATCH] Autosave: 20260322-101548 --- check_data.php | 26 ++++++++++++++++---------- print_insurance_statement.php | 2 +- print_xray_inquiry.php | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/check_data.php b/check_data.php index 8126ab5..e234a30 100644 --- a/check_data.php +++ b/check_data.php @@ -1,14 +1,20 @@ query("SELECT id, name FROM patients LIMIT 1")->fetch(PDO::FETCH_ASSOC); - $doctor = $db->query("SELECT id, name_en FROM doctors LIMIT 1")->fetch(PDO::FETCH_ASSOC); - - echo "Patient: " . ($patient ? "ID=" . $patient['id'] . ", Name=" . $patient['name'] : "None") . "\n"; - echo "Doctor: " . ($doctor ? "ID=" . $doctor['id'] . ", Name=" . $doctor['name_en'] : "None") . "\n"; -} catch (PDOException $e) { - echo "Error: " . $e->getMessage() . "\n"; -} +// Fetch one patient +$patient = $db->query("SELECT id, name FROM patients LIMIT 1")->fetch(PDO::FETCH_ASSOC); +// Fetch one doctor (employee with position 'Doctor') +$doctor = $db->query(" + SELECT e.id, e.name_en + FROM employees e + JOIN positions p ON e.position_id = p.id + WHERE UPPER(p.name_en) = 'DOCTOR' + LIMIT 1")->fetch(PDO::FETCH_ASSOC); +if ($patient && $doctor) { + echo "Found Patient: " . $patient['name'] . " (ID: " . $patient['id'] . ")\n"; + echo "Found Doctor: " . $doctor['name_en'] . " (ID: " . $doctor['id'] . ")\n"; +} else { + echo "Could not find patient or doctor.\n"; +} \ No newline at end of file diff --git a/print_insurance_statement.php b/print_insurance_statement.php index 05e189e..a8369a8 100644 --- a/print_insurance_statement.php +++ b/print_insurance_statement.php @@ -41,7 +41,7 @@ try { FROM bills b JOIN patients p ON b.patient_id = p.id LEFT JOIN visits v ON b.visit_id = v.id - LEFT JOIN doctors d ON v.doctor_id = d.id + LEFT JOIN employees d ON v.doctor_id = d.id WHERE p.insurance_company_id = ? AND b.insurance_covered > 0 AND DATE(b.created_at) BETWEEN ? AND ? diff --git a/print_xray_inquiry.php b/print_xray_inquiry.php index 76193e6..0663e8f 100644 --- a/print_xray_inquiry.php +++ b/print_xray_inquiry.php @@ -19,7 +19,7 @@ $stmt = $db->prepare(" FROM xray_inquiries xi LEFT JOIN patients p ON xi.patient_id = p.id LEFT JOIN visits v ON xi.visit_id = v.id - LEFT JOIN doctors d ON v.doctor_id = d.id + LEFT JOIN employees d ON v.doctor_id = d.id WHERE xi.id = ? "); $stmt->execute([$id]);