| Version 1 (modified by , 2 weeks ago) ( diff ) |
|---|
Logical and Physical Design, DB Creation (DDL)
Notation
- PK marked with [PK]
- FK marked with *(TABLE)
- UQ = unique constraint
Relation schema
USERS & ROLES
- users(user_id [PK], username [UQ], password, role, first_name, last_name, is_active, patient_id*(PATIENTS), doctor_id*(DOCTORS), admin_id*(ADMIN), technician_id*(LAB_TECHNICIAN))
STAFF
- doctor_level(level_id [PK], level [UQ])
- doctor_specialization(specialization_id [PK], specialization_name [UQ])
- departments(department_id [PK], department_name [UQ])
- doctors(doctor_id [PK], first_name, last_name, email_address [UQ], level_id*(DOCTOR_LEVEL), specialization_id*(DOCTOR_SPECIALIZATION), department_id*(DEPARTMENTS))
- admin(admin_id [PK], username [UQ], name, lastname, email [UQ])
- lab_technician(technician_id [PK], username [UQ], name, lastname, email [UQ])
PATIENTS
- patients(patient_id [PK], first_name, last_name, email_address [UQ], date_of_birth, blood_type, gender, phone_number, embg [UQ])
- patient_allergies(patient_id*(PATIENTS), allergy_id*(ALLERGIES))
- patient_symptoms(patient_id*(PATIENTS), symptom_id*(SYMPTOMS))
APPOINTMENTS
- appointments(appointment_id [PK], appointment_date, appointment_time, status, patient_id*(PATIENTS), doctor_id*(DOCTORS))
CLINICAL ENTITIES
- allergies(allergy_id [PK], name [UQ], allergy_severity)
- symptoms(symptom_id [PK], name [UQ], description)
- diagnosis(diagnosis_id [PK], name, description, patient_id*(PATIENTS), doctor_id*(DOCTORS))
- diagnosis_symptoms(diagnosis_id*(DIAGNOSIS), symptom_id*(SYMPTOMS))
PROCEDURES
- procedures(procedure_id [PK], procedure_type, procedure_date, description, cost, doctor_id*(DOCTORS), diagnosis_id*(DIAGNOSIS))
- procedure_results(result_id [PK], result_description, result_date, procedure_id*(PROCEDURES))
- performed_procedures(performed_id [PK], procedure_date, notes, procedure_id*(PROCEDURES), doctor_id*(DOCTORS), patient_id*(PATIENTS), diagnosis_id*(DIAGNOSIS))
- specialization_procedures(specialization_id*(DOCTOR_SPECIALIZATION), procedure_id*(PROCEDURES))
- diagnosis_procedures(diagnosis_id*(DIAGNOSIS), procedure_id*(PROCEDURES))
- department_procedures(department_id*(DEPARTMENTS), procedure_id*(PROCEDURES))
LAB TESTS
- lab_tests(test_id [PK], test_name, description, cost)
- lab_results(result_id [PK], results, result_date, test_id*(LAB_TESTS))
- performed_lab_tests(performed_test_id [PK], test_date, notes, test_id*(LAB_TESTS), patient_id*(PATIENTS), doctor_id*(DOCTORS), technician_id*(LAB_TECHNICIAN))
PRESCRIPTIONS
- prescriptions(prescription_id [PK], medication_name)
- prescription_restriction(restriction_id [PK], description, prescription_id*(PRESCRIPTIONS))
- allergy_prescription_restrictions(allergy_id*(ALLERGIES), restriction_id*(PRESCRIPTION_RESTRICTION))
MEDICAL RECORDS
- medical_records(record_id [PK], patient_id*(PATIENTS))
- doctor_medical_records(doctor_id*(DOCTORS), record_id*(MEDICAL_RECORDS))
- diagnosis_medical_records(diagnosis_id*(DIAGNOSIS), record_id*(MEDICAL_RECORDS))
- prescription_medical_records(prescription_id*(PRESCRIPTIONS), record_id*(MEDICAL_RECORDS), dosage, frequency, duration, notes)
- medical_record_lab_results(record_id*(MEDICAL_RECORDS), result_id*(LAB_RESULTS))
- medical_record_procedure_results(record_id*(MEDICAL_RECORDS), result_id*(PROCEDURE_RESULTS))
- medical_record_procedures(record_id*(MEDICAL_RECORDS), procedure_id*(PROCEDURES))
- medical_record_symptoms(record_id*(MEDICAL_RECORDS), symptom_id*(SYMPTOMS), severity)
- medical_record_allergies(record_id*(MEDICAL_RECORDS), allergy_id*(ALLERGIES), reaction, severity)
REPORTS & REFERRALS
- medical_report(report_id [PK], description, report_date, record_id*(MEDICAL_RECORDS), doctor_id*(DOCTORS))
- medical_report_lab_results(report_id*(MEDICAL_REPORT), result_id*(LAB_RESULTS))
- referrals(referral_id [PK], reason, referral_date, record_id*(MEDICAL_RECORDS), from_doctor_id*(DOCTORS), to_doctor_id*(DOCTORS))
BILLING
- billing(bill_id [PK], total_cost, payment_status, payment_date, record_id*(MEDICAL_RECORDS), admin_id*(ADMIN))
- billing_procedures(bill_id*(BILLING), procedure_id*(PROCEDURES))
- billing_lab_tests(bill_id*(BILLING), test_id*(LAB_TESTS))
DDL
DML
Relational Diagram
Attachments (3)
- ddl.sql (39.5 KB ) - added by 2 weeks ago.
- dml.sql (146.0 KB ) - added by 2 weeks ago.
- relational_diagram1.png (1.5 MB ) - added by 2 weeks ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.
