diff --git a/db/migrations/20260305_add_details_to_patients.sql b/db/migrations/20260305_add_details_to_patients.sql new file mode 100644 index 0000000..3c87490 --- /dev/null +++ b/db/migrations/20260305_add_details_to_patients.sql @@ -0,0 +1,5 @@ +-- Add civil_id, nationality, city to patients +ALTER TABLE patients +ADD COLUMN civil_id VARCHAR(50) DEFAULT NULL, +ADD COLUMN nationality VARCHAR(100) DEFAULT NULL, +ADD COLUMN city VARCHAR(100) DEFAULT NULL; diff --git a/includes/actions.php b/includes/actions.php index cca04ec..a4a745f 100644 --- a/includes/actions.php +++ b/includes/actions.php @@ -83,10 +83,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $insurance_company_id = $_POST['insurance_company_id'] ?: null; $policy_number = $_POST['policy_number'] ?? ''; $address = $_POST['address'] ?? ''; + $civil_id = $_POST['civil_id'] ?? ''; + $nationality = $_POST['nationality'] ?? ''; + $city = $_POST['city'] ?? ''; if ($name) { - $stmt = $db->prepare("INSERT INTO patients (name, phone, dob, gender, blood_group, insurance_company_id, policy_number, address) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); - $stmt->execute([$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address]); + $stmt = $db->prepare("INSERT INTO patients (name, phone, dob, gender, blood_group, insurance_company_id, policy_number, address, civil_id, nationality, city) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $civil_id, $nationality, $city]); $_SESSION['flash_message'] = __('add_patient') . ' ' . __('successfully'); $redirect = true; } @@ -100,10 +103,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $insurance_company_id = $_POST['insurance_company_id'] ?: null; $policy_number = $_POST['policy_number'] ?? ''; $address = $_POST['address'] ?? ''; + $civil_id = $_POST['civil_id'] ?? ''; + $nationality = $_POST['nationality'] ?? ''; + $city = $_POST['city'] ?? ''; if ($id && $name) { - $stmt = $db->prepare("UPDATE patients SET name = ?, phone = ?, dob = ?, gender = ?, blood_group = ?, insurance_company_id = ?, policy_number = ?, address = ? WHERE id = ?"); - $stmt->execute([$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $id]); + $stmt = $db->prepare("UPDATE patients SET name = ?, phone = ?, dob = ?, gender = ?, blood_group = ?, insurance_company_id = ?, policy_number = ?, address = ?, civil_id = ?, nationality = ?, city = ? WHERE id = ?"); + $stmt->execute([$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $civil_id, $nationality, $city, $id]); $_SESSION['flash_message'] = __('edit_patient') . ' ' . __('successfully'); $redirect = true; } @@ -758,6 +764,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $phone = $_POST['phone'] ?? ''; $email = $_POST['email'] ?? ''; $address = $_POST['address'] ?? ''; + $civil_id = $_POST['civil_id'] ?? ''; + $nationality = $_POST['nationality'] ?? ''; + $city = $_POST['city'] ?? ''; if ($name_en && $name_ar) { $stmt = $db->prepare("INSERT INTO suppliers (name_en, name_ar, contact_person, phone, email, address) VALUES (?, ?, ?, ?, ?, ?)"); @@ -773,6 +782,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $phone = $_POST['phone'] ?? ''; $email = $_POST['email'] ?? ''; $address = $_POST['address'] ?? ''; + $civil_id = $_POST['civil_id'] ?? ''; + $nationality = $_POST['nationality'] ?? ''; + $city = $_POST['city'] ?? ''; if ($id && $name_en && $name_ar) { $stmt = $db->prepare("UPDATE suppliers SET name_en = ?, name_ar = ?, contact_person = ?, phone = ?, email = ?, address = ? WHERE id = ?"); diff --git a/includes/common_data.php b/includes/common_data.php index 68011b5..4bbc484 100644 --- a/includes/common_data.php +++ b/includes/common_data.php @@ -19,4 +19,4 @@ $scheduled_appointments = $db->query(" FROM appointments a JOIN patients p ON a.patient_id = p.id WHERE a.status = 'Scheduled' - ORDER BY a.start_time ASC")->fetchAll(); \ No newline at end of file + ORDER BY a.start_time ASC")->fetchAll();$all_countries = require __DIR__ . "/countries.php"; diff --git a/includes/countries.php b/includes/countries.php new file mode 100644 index 0000000..afce9d3 --- /dev/null +++ b/includes/countries.php @@ -0,0 +1,28 @@ + + \1\n
No medications prescribed.
-| + + - - + | + + + ++ + |