I would create a table with valid options. Let's say you can have patients between 9.00 am and 5.00 pm. A patient can book 30 mins appointments, therefore you need 30 mins intervals.
I'd call my table PossibleAppointments
:
=================
= id = time =
=================
- 1 - 9:00 -
-----------------
- 2 - 9:30 -
-----------------
- ... -
-----------------
- # - 4:30 -
-----------------
Add another table called BookedAppointments
, where you have an entry, such as:
================================
= id = date = time =
================================
- # - 2019-04-22 - 2 -
--------------------------------
Note that the column time
would represent the id of one row of PossibleAppointments
.
Now, whenever a patient wants to book an appointment, display a dropdown input
and filter out already booked appointments based on your tables.