README - HospitalDB
وصف عام:
---------
هذا المشروع بيعرّف قاعدة بيانات لإدارة مستشفى (HospitalDB).
السكيمة بتوضح الجداول (Entities) وعلاقاتها (Relationships).
الجداول (Tables):
-----------------
1. Departments
- DepartmentID (PK)
- Name
- Location
2. Patients
- PatientID (PK)
- MedicalRecordNo (Unique)
- FirstName, LastName, Gender, DateOfBirth, Phone, Address
- CreatedAt (Default current date)
3. Doctors
- DoctorID (PK)
- LicenseNo (Unique)
- FirstName, LastName, Phone
- DepartmentID (FK -> Departments.DepartmentID)
- CreatedAt
4. Rooms
- RoomID (PK)
- RoomNumber (Unique)
- DepartmentID (FK -> Departments.DepartmentID)
- IsAvailable, Notes
5. Admissions
- AdmissionID (PK)
- PatientID (FK -> Patients.PatientID)
- RoomID (FK -> Rooms.RoomID)
- AdmissionDate, DischargeDate
6. Appointments
- AppointmentID (PK)
- PatientID (FK -> Patients.PatientID)
- DoctorID (FK -> Doctors.DoctorID)
- AppointmentDate, Reason, Status, CreatedAt, Notes
7. Payments
- PaymentID (PK)
- PatientID (FK -> Patients.PatientID)
- Amount, PaymentDate, Method
8. AuditLogs
- LogID (PK)
- TableName, Action, Username, ActionTime, Details
العلاقات (Relationships):
--------------------------
- قسم واحد (Department) يقدر يكون فيه دكاترة كتير (Doctors).
- قسم واحد يقدر يحتوي غرف كتير (Rooms).
- مريض واحد (Patient) يقدر يكون عنده أكتر من Admission.
- مريض واحد يقدر يحجز مواعيد كتير (Appointments).
- دكتور واحد يقدر يشوف مواعيد كتير (Appointments).
- مريض واحد يقدر يعمل مدفوعات كتير (Payments).
- Admissions بيربط المريض بالغرفة.
الاستخدام:
----------
1. نفّذ سكريبت SQL: `HospitalDB_Tables.sql` على SQL Server (أو DBMS مشابه).
2. استخدم الـ ERD (ERD.png) لفهم العلاقات بين الجداول.
3. ضيف بيانات تجريبية في الجداول لاختبار السكيمة.
ملاحظات:
---------
- كل الجداول فيها أعمدة ID بتزيد تلقائياً (IDENTITY).
- CreatedAt بينضاف أوتوماتيك بتاريخ التنفيذ.
- الـ Foreign Keys بتضمن سلامة البيانات بين الجداول.