diff --git a/db/migrations/20260322_add_nursing_notes_to_visits.sql b/db/migrations/20260322_add_nursing_notes_to_visits.sql new file mode 100644 index 0000000..ecc31fd --- /dev/null +++ b/db/migrations/20260322_add_nursing_notes_to_visits.sql @@ -0,0 +1 @@ +ALTER TABLE visits ADD COLUMN IF NOT EXISTS nursing_notes TEXT AFTER temperature; diff --git a/includes/actions.php b/includes/actions.php index 68d1337..c7e4b34 100644 --- a/includes/actions.php +++ b/includes/actions.php @@ -227,6 +227,7 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') $symptoms = $_POST['symptoms'] ?? ''; $diagnosis = $_POST['diagnosis'] ?? ''; $treatment = $_POST['treatment_plan'] ?? ''; + $nursing_notes = $_POST['nursing_notes'] ?? ''; if ($patient_id && ($doctor_id || $nurse_id)) { $db->beginTransaction(); @@ -241,8 +242,8 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') $address = $apt['address'] ?? null; } - $stmt = $db->prepare("INSERT INTO visits (patient_id, doctor_id, nurse_id, visit_type, address, appointment_id, weight, blood_pressure, heart_rate, temperature, symptoms, diagnosis, treatment_plan) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); - $stmt->execute([$patient_id, $doctor_id, $nurse_id, $visit_type, $address, $appointment_id, $weight, $bp, $hr, $temp, $symptoms, $diagnosis, $treatment]); + $stmt = $db->prepare("INSERT INTO visits (patient_id, doctor_id, nurse_id, visit_type, address, appointment_id, weight, blood_pressure, heart_rate, temperature, symptoms, diagnosis, treatment_plan, nursing_notes) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$patient_id, $doctor_id, $nurse_id, $visit_type, $address, $appointment_id, $weight, $bp, $hr, $temp, $symptoms, $diagnosis, $treatment, $nursing_notes]); $visit_id = $db->lastInsertId(); $token_message = ''; @@ -317,6 +318,7 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') $symptoms = $_POST['symptoms'] ?? ''; $diagnosis = $_POST['diagnosis'] ?? ''; $treatment = $_POST['treatment_plan'] ?? ''; + $nursing_notes = $_POST['nursing_notes'] ?? ''; // Check for 24h restriction $stmtSet = $db->prepare("SELECT setting_value FROM settings WHERE setting_key = 'disable_visit_edit_24h'"); @@ -343,8 +345,8 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') if ($id && $doctor_id) { // Removed patient_id from UPDATE - $stmt = $db->prepare("UPDATE visits SET doctor_id = ?, weight = ?, blood_pressure = ?, heart_rate = ?, temperature = ?, symptoms = ?, diagnosis = ?, treatment_plan = ? WHERE id = ?"); - $stmt->execute([$doctor_id, $weight, $bp, $hr, $temp, $symptoms, $diagnosis, $treatment, $id]); + $stmt = $db->prepare("UPDATE visits SET doctor_id = ?, weight = ?, blood_pressure = ?, heart_rate = ?, temperature = ?, symptoms = ?, diagnosis = ?, treatment_plan = ?, nursing_notes = ? WHERE id = ?"); + $stmt->execute([$doctor_id, $weight, $bp, $hr, $temp, $symptoms, $diagnosis, $treatment, $nursing_notes, $id]); $stmt = $db->prepare("DELETE FROM visit_prescriptions WHERE visit_id = ?"); $stmt->execute([$id]); if (isset($_POST['prescriptions']) && is_array($_POST['prescriptions'])) { diff --git a/includes/layout/footer.php b/includes/layout/footer.php index 2563002..36f542c 100644 --- a/includes/layout/footer.php +++ b/includes/layout/footer.php @@ -977,7 +977,7 @@ @@ -990,6 +990,18 @@ +