This project is a fully designed SQL database for managing a dental practice. The database covers patient records, appointment scheduling, billing and payments, treatments, follow-ups, and reporting. It provides efficient data organization and simplifies operations for the practice.
- Stores patient records, including first name, last name, birth date, contact details, email, and gender.
- Prevents duplicate patient records using constraints on full name and birth date.
- Manages patient addresses through a dedicated table with unique constraints on Eircode to avoid duplication.
- Allows booking new appointments during business hours (08:00 AM to 03:30 PM).
- Prevents scheduling if a patient has overdue bills:
- Bills unpaid for over 30 days.
- Outstanding balances exceeding €50.
- Provides a view (
Open Appointments) to display available time slots. - Automatically assigns default values like
status(“active”) anddate createdto new appointments.
- Tracks payments with options for:
- Cheque Payments: Stores cheque details such as cheque number, IBAN, and sort code.
- Card Payments: Stores cardholder name, card type, number, and expiry date.
- Cash Payments: Recorded directly in the payment method table.
- Links payments to invoices and calculates remaining balances automatically.
- Provides refund functionality by marking payments as “cancelled,” which adjusts the outstanding balance.
- Tracks overdue bills using the
Unpaid Billsview, which lists unpaid invoices and outstanding amounts.
- Maintains a catalog of treatments, each identified by a unique treatment ID, name, fee, and duration.
- Associates treatments with appointments, generating itemized invoices and total fees.
- Supports adding, updating, and removing treatments from appointments as required.
- Automatically adds a default “consultation” treatment for new patients.
- Handles follow-up appointments for specialist treatments not provided in-house.
- Links follow-ups to the original appointments and tracks their status (“pending” or “complete”).
- Organizes referrals based on specialty codes, assigning the correct dentist for external procedures.
- Stores dentist and clinic contact details for efficient referral management.
- Supports rescheduling or cancellation of appointments by updating their status.
- Automatically removes associated procedures when an appointment is cancelled.
- Tracks cancellation types with specific codes:
- General Cancellation (Code 102): No additional charges.
- Late Cancellation (Code 103): Adds a €10 fee to the invoice.
- Generates weekly views of upcoming appointments, including patient contact details.
- Allows filtering appointments by custom date ranges for scheduling and reminders.
- Provides views to track overdue and unpaid bills.
- Displays itemized treatments and fees associated with each appointment.
- Supports various queries and views to simplify data access:
Open Appointments: Displays available appointment slots.Overdue Bills: Tracks unpaid bills with outstanding balances.Weekly Appointments: Lists appointments for the week for reminder purposes.Itemized Treatments: Provides detailed breakdowns of treatments per appointment.
patients: Stores patient details.appointments: Manages appointment records.invoice: Tracks billing and payment statuses.treatment_details: Stores treatment catalog.payment_method: Tracks payments (cheque, card, cash).
Open_Appointments: Displays available slots.Unpaid_Bills: Tracks overdue bills.Weekly_Appointments: Lists appointments for the week.
- MySQL or any compatible SQL database system.
- SQL client (e.g., MySQL Workbench, DBeaver, or command-line tools).
- Clone this repository or download the SQL file.
git clone https://github.com/your-username/dental-practice-database.git
- Open your SQL client and connect to your database server.
- Execute the SQL file to set up the database:
SOURCE path/to/SQLExportDentistDB.sql;
- Verify that the database (
DentistDB) and its tables have been created successfully.
- Patient Records: View all patients and their details.
SELECT * FROM patients;
- Check Open Appointment Slots:
SELECT * FROM Open_Appointments;
- Track Overdue Bills:
SELECT * FROM Unpaid_Bills;
- Generate Weekly Appointment Reminders:
SELECT * FROM Weekly_Appointments WHERE week_start_date = 'YYYY-MM-DD';
- Add new treatments or update treatment fees:
INSERT INTO treatment_details (treatment_id, treatment_name, fee, duration) VALUES (211, 'Cyst Removal', 200, 60);
- Cancel an appointment:
UPDATE appointments SET status = 'cancelled' WHERE appointment_id = 101;
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
For questions or feedback, please contact:
- Name: pj-oboyle
- GitHub: pj-oboyle
Thank you for exploring this project! If you found it helpful, please give it a star on GitHub!
