adding nursing notes
This commit is contained in:
parent
e73384ddbc
commit
bcd593fb90
1
db/migrations/20260322_add_nursing_notes_to_visits.sql
Normal file
1
db/migrations/20260322_add_nursing_notes_to_visits.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE visits ADD COLUMN IF NOT EXISTS nursing_notes TEXT AFTER temperature;
|
||||||
@ -227,6 +227,7 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST')
|
|||||||
$symptoms = $_POST['symptoms'] ?? '';
|
$symptoms = $_POST['symptoms'] ?? '';
|
||||||
$diagnosis = $_POST['diagnosis'] ?? '';
|
$diagnosis = $_POST['diagnosis'] ?? '';
|
||||||
$treatment = $_POST['treatment_plan'] ?? '';
|
$treatment = $_POST['treatment_plan'] ?? '';
|
||||||
|
$nursing_notes = $_POST['nursing_notes'] ?? '';
|
||||||
|
|
||||||
if ($patient_id && ($doctor_id || $nurse_id)) {
|
if ($patient_id && ($doctor_id || $nurse_id)) {
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
@ -241,8 +242,8 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST')
|
|||||||
$address = $apt['address'] ?? null;
|
$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 = $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]);
|
$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();
|
$visit_id = $db->lastInsertId();
|
||||||
$token_message = '';
|
$token_message = '';
|
||||||
|
|
||||||
@ -317,6 +318,7 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST')
|
|||||||
$symptoms = $_POST['symptoms'] ?? '';
|
$symptoms = $_POST['symptoms'] ?? '';
|
||||||
$diagnosis = $_POST['diagnosis'] ?? '';
|
$diagnosis = $_POST['diagnosis'] ?? '';
|
||||||
$treatment = $_POST['treatment_plan'] ?? '';
|
$treatment = $_POST['treatment_plan'] ?? '';
|
||||||
|
$nursing_notes = $_POST['nursing_notes'] ?? '';
|
||||||
|
|
||||||
// Check for 24h restriction
|
// Check for 24h restriction
|
||||||
$stmtSet = $db->prepare("SELECT setting_value FROM settings WHERE setting_key = 'disable_visit_edit_24h'");
|
$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) {
|
if ($id && $doctor_id) {
|
||||||
// Removed patient_id from UPDATE
|
// 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 = $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, $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 = $db->prepare("DELETE FROM visit_prescriptions WHERE visit_id = ?");
|
||||||
$stmt->execute([$id]);
|
$stmt->execute([$id]);
|
||||||
if (isset($_POST['prescriptions']) && is_array($_POST['prescriptions'])) {
|
if (isset($_POST['prescriptions']) && is_array($_POST['prescriptions'])) {
|
||||||
|
|||||||
@ -977,7 +977,7 @@
|
|||||||
<select name="patient_id" id="visit_patient_id" class="form-select select2-modal" required>
|
<select name="patient_id" id="visit_patient_id" class="form-select select2-modal" required>
|
||||||
<option value=""><?php echo __('select'); ?>...</option>
|
<option value=""><?php echo __('select'); ?>...</option>
|
||||||
<?php foreach ($all_patients as $p): ?>
|
<?php foreach ($all_patients as $p): ?>
|
||||||
<option value="<?php echo $p['id']; ?>"><?php echo htmlspecialchars($p['name']); ?></option>
|
<option value="<?php echo $p['id']; ?>" data-dob="<?php echo $p['dob']; ?>" data-gender="<?php echo $p['gender']; ?>"><?php echo htmlspecialchars($p['name']); ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -990,6 +990,18 @@
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-4 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('gender'); ?></label>
|
||||||
|
<input type="text" id="visit_patient_gender" class="form-control" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('dob'); ?></label>
|
||||||
|
<input type="text" id="visit_patient_dob" class="form-control" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('age'); ?></label>
|
||||||
|
<input type="text" id="visit_patient_age" class="form-control" readonly>
|
||||||
|
</div>
|
||||||
<div class="col-md-12 mb-3">
|
<div class="col-md-12 mb-3">
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" id="generate_token" name="generate_token" value="1">
|
<input class="form-check-input" type="checkbox" id="generate_token" name="generate_token" value="1">
|
||||||
@ -1018,6 +1030,10 @@
|
|||||||
<label class="form-label"><?php echo __('temperature'); ?> (°C)</label>
|
<label class="form-label"><?php echo __('temperature'); ?> (°C)</label>
|
||||||
<input type="number" step="0.1" name="temperature" id="visit_temperature" class="form-control">
|
<input type="number" step="0.1" name="temperature" id="visit_temperature" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-12 mb-3">
|
||||||
|
<label class="form-label"><?php echo __("nursing_notes"); ?></label>
|
||||||
|
<textarea name="nursing_notes" id="visit_nursing_notes" class="form-control" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -1376,6 +1392,11 @@ function showRecordVisitModal(patientId = null) {
|
|||||||
document.querySelector('#prescriptionTable tbody').innerHTML = '';
|
document.querySelector('#prescriptionTable tbody').innerHTML = '';
|
||||||
addPrescriptionRow(); // Add one empty row
|
addPrescriptionRow(); // Add one empty row
|
||||||
|
|
||||||
|
// Clear patient info
|
||||||
|
$('#visit_patient_gender').val('');
|
||||||
|
$('#visit_patient_dob').val('');
|
||||||
|
$('#visit_patient_age').val('');
|
||||||
|
|
||||||
if (patientId) {
|
if (patientId) {
|
||||||
$('#visit_patient_id').val(patientId).trigger('change');
|
$('#visit_patient_id').val(patientId).trigger('change');
|
||||||
} else {
|
} else {
|
||||||
@ -1435,6 +1456,23 @@ function showEditVisitModal(data) {
|
|||||||
document.getElementById('visit_blood_pressure').value = data.blood_pressure || '';
|
document.getElementById('visit_blood_pressure').value = data.blood_pressure || '';
|
||||||
document.getElementById('visit_heart_rate').value = data.heart_rate || '';
|
document.getElementById('visit_heart_rate').value = data.heart_rate || '';
|
||||||
document.getElementById('visit_temperature').value = data.temperature || '';
|
document.getElementById('visit_temperature').value = data.temperature || '';
|
||||||
|
document.getElementById('visit_nursing_notes').value = data.nursing_notes || '';
|
||||||
|
|
||||||
|
// Populate new fields
|
||||||
|
$('#visit_patient_gender').val(data.patient_gender || '');
|
||||||
|
$('#visit_patient_dob').val(data.patient_dob || '');
|
||||||
|
if (data.patient_dob) {
|
||||||
|
const birthDate = new Date(data.patient_dob);
|
||||||
|
const today = new Date();
|
||||||
|
let age = today.getFullYear() - birthDate.getFullYear();
|
||||||
|
const m = today.getMonth() - birthDate.getMonth();
|
||||||
|
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
|
||||||
|
age--;
|
||||||
|
}
|
||||||
|
$('#visit_patient_age').val(age);
|
||||||
|
} else {
|
||||||
|
$('#visit_patient_age').val('');
|
||||||
|
}
|
||||||
|
|
||||||
// Populate Summernote fields
|
// Populate Summernote fields
|
||||||
$('#visit_symptoms').summernote('code', data.symptoms || '');
|
$('#visit_symptoms').summernote('code', data.symptoms || '');
|
||||||
@ -1815,6 +1853,29 @@ $(document).ready(function() {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Update patient details in Visit Modal
|
||||||
|
$('#visit_patient_id').on('change', function() {
|
||||||
|
const selected = $(this).find('option:selected');
|
||||||
|
const dob = selected.data('dob');
|
||||||
|
const gender = selected.data('gender');
|
||||||
|
|
||||||
|
$('#visit_patient_gender').val(gender || '');
|
||||||
|
$('#visit_patient_dob').val(dob || '');
|
||||||
|
|
||||||
|
if (dob) {
|
||||||
|
const birthDate = new Date(dob);
|
||||||
|
const today = new Date();
|
||||||
|
let age = today.getFullYear() - birthDate.getFullYear();
|
||||||
|
const m = today.getMonth() - birthDate.getMonth();
|
||||||
|
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
|
||||||
|
age--;
|
||||||
|
}
|
||||||
|
$('#visit_patient_age').val(age);
|
||||||
|
} else {
|
||||||
|
$('#visit_patient_age').val('');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
53
lang.php
53
lang.php
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$translations = [
|
$translations = array (
|
||||||
'en' => [
|
'en' =>
|
||||||
|
array (
|
||||||
'dashboard' => 'Dashboard',
|
'dashboard' => 'Dashboard',
|
||||||
'patients' => 'Patients',
|
'patients' => 'Patients',
|
||||||
'visits' => 'Visits',
|
'visits' => 'Visits',
|
||||||
@ -201,6 +202,7 @@ $translations = [
|
|||||||
'add_patient' => 'Add Patient',
|
'add_patient' => 'Add Patient',
|
||||||
'book_appointment' => 'Book Appointment',
|
'book_appointment' => 'Book Appointment',
|
||||||
'add_visit' => 'Add Visit',
|
'add_visit' => 'Add Visit',
|
||||||
|
'edit_visit' => 'Edit Visit',
|
||||||
'add_xray_inquiry' => 'Add X-Ray Inquiry',
|
'add_xray_inquiry' => 'Add X-Ray Inquiry',
|
||||||
'running_visits' => 'Running Visits',
|
'running_visits' => 'Running Visits',
|
||||||
'time' => 'Time',
|
'time' => 'Time',
|
||||||
@ -231,8 +233,6 @@ $translations = [
|
|||||||
'of' => 'of',
|
'of' => 'of',
|
||||||
'add_holiday' => 'Add Holiday',
|
'add_holiday' => 'Add Holiday',
|
||||||
'edit_holiday' => 'Edit Holiday',
|
'edit_holiday' => 'Edit Holiday',
|
||||||
'start_date' => 'Start Date',
|
|
||||||
'end_date' => 'End Date',
|
|
||||||
'note' => 'Note',
|
'note' => 'Note',
|
||||||
'delete_holiday' => 'Delete Holiday',
|
'delete_holiday' => 'Delete Holiday',
|
||||||
'are_you_sure_delete_holiday' => 'Are you sure you want to delete this holiday?',
|
'are_you_sure_delete_holiday' => 'Are you sure you want to delete this holiday?',
|
||||||
@ -352,8 +352,24 @@ $translations = [
|
|||||||
'visit_settings' => 'Visit Settings',
|
'visit_settings' => 'Visit Settings',
|
||||||
'disable_visit_edit_24h' => 'Disable editing visits after 24 hours',
|
'disable_visit_edit_24h' => 'Disable editing visits after 24 hours',
|
||||||
'disable_visit_edit_24h_desc' => 'If enabled, visits cannot be edited 24 hours after their creation.',
|
'disable_visit_edit_24h_desc' => 'If enabled, visits cannot be edited 24 hours after their creation.',
|
||||||
],
|
'details' => 'Details',
|
||||||
'ar' => [
|
'vitals' => 'Vitals',
|
||||||
|
'symptoms_diagnosis' => 'Symptoms & Diagnosis',
|
||||||
|
'treatment_plan' => 'Treatment Plan',
|
||||||
|
'prescriptions' => 'Prescriptions',
|
||||||
|
'weight' => 'Weight',
|
||||||
|
'blood_pressure' => 'Blood Pressure',
|
||||||
|
'heart_rate' => 'Heart Rate',
|
||||||
|
'temperature' => 'Temperature',
|
||||||
|
'symptoms' => 'Symptoms',
|
||||||
|
'diagnosis' => 'Diagnosis',
|
||||||
|
'drug_name' => 'Drug Name',
|
||||||
|
'dosage' => 'Dosage',
|
||||||
|
'instructions' => 'Instructions',
|
||||||
|
'add_drug' => 'Add Drug',
|
||||||
|
),
|
||||||
|
'ar' =>
|
||||||
|
array (
|
||||||
'dashboard' => 'لوحة التحكم',
|
'dashboard' => 'لوحة التحكم',
|
||||||
'patients' => 'المرضى',
|
'patients' => 'المرضى',
|
||||||
'visits' => 'الزيارات',
|
'visits' => 'الزيارات',
|
||||||
@ -554,6 +570,7 @@ $translations = [
|
|||||||
'add_patient' => 'إضافة مريض',
|
'add_patient' => 'إضافة مريض',
|
||||||
'book_appointment' => 'حجز موعد',
|
'book_appointment' => 'حجز موعد',
|
||||||
'add_visit' => 'إضافة زيارة',
|
'add_visit' => 'إضافة زيارة',
|
||||||
|
'edit_visit' => 'تعديل زيارة',
|
||||||
'add_xray_inquiry' => 'إضافة فحص أشعة',
|
'add_xray_inquiry' => 'إضافة فحص أشعة',
|
||||||
'running_visits' => 'الزيارات الجارية',
|
'running_visits' => 'الزيارات الجارية',
|
||||||
'time' => 'الوقت',
|
'time' => 'الوقت',
|
||||||
@ -584,8 +601,6 @@ $translations = [
|
|||||||
'of' => 'من',
|
'of' => 'من',
|
||||||
'add_holiday' => 'إضافة إجازة',
|
'add_holiday' => 'إضافة إجازة',
|
||||||
'edit_holiday' => 'تعديل إجازة',
|
'edit_holiday' => 'تعديل إجازة',
|
||||||
'start_date' => 'تاريخ البدء',
|
|
||||||
'end_date' => 'تاريخ الانتهاء',
|
|
||||||
'note' => 'ملاحظة',
|
'note' => 'ملاحظة',
|
||||||
'delete_holiday' => 'حذف إجازة',
|
'delete_holiday' => 'حذف إجازة',
|
||||||
'are_you_sure_delete_holiday' => 'هل أنت متأكد من حذف هذه الإجازة؟',
|
'are_you_sure_delete_holiday' => 'هل أنت متأكد من حذف هذه الإجازة؟',
|
||||||
@ -702,5 +717,23 @@ $translations = [
|
|||||||
'delete_employee' => 'حذف موظف',
|
'delete_employee' => 'حذف موظف',
|
||||||
'select_position' => 'اختر المسمى الوظيفي',
|
'select_position' => 'اختر المسمى الوظيفي',
|
||||||
'no_employees_found' => 'لم يتم العثور على موظفين',
|
'no_employees_found' => 'لم يتم العثور على موظفين',
|
||||||
]
|
'visit_settings' => 'Visit Settings',
|
||||||
];
|
'disable_visit_edit_24h' => 'Disable editing visits after 24 hours',
|
||||||
|
'disable_visit_edit_24h_desc' => 'If enabled, visits cannot be edited 24 hours after their creation.',
|
||||||
|
'details' => 'التفاصيل',
|
||||||
|
'vitals' => 'المؤشرات الحيوية',
|
||||||
|
'symptoms_diagnosis' => 'الأعراض والتشخيص',
|
||||||
|
'treatment_plan' => 'خطة العلاج',
|
||||||
|
'prescriptions' => 'الوصفات الطبية',
|
||||||
|
'weight' => 'الوزن',
|
||||||
|
'blood_pressure' => 'ضغط الدم',
|
||||||
|
'heart_rate' => 'معدل ضربات القلب',
|
||||||
|
'temperature' => 'درجة الحرارة',
|
||||||
|
'symptoms' => 'الأعراض',
|
||||||
|
'diagnosis' => 'التشخيص',
|
||||||
|
'drug_name' => 'اسم الدواء',
|
||||||
|
'dosage' => 'الجرعة',
|
||||||
|
'instructions' => 'التعليمات',
|
||||||
|
'add_drug' => 'إضافة دواء',
|
||||||
|
),
|
||||||
|
);
|
||||||
Loading…
x
Reference in New Issue
Block a user