sql server - Doctor scheduling database design -


i got below user interface scheduling functionality.

enter image description here

i need setup doctors available time days each week of month.

how should create table handling this.

i thought can create table structure below columns

  1. doctorid
  2. date
  3. avalablefrom
  4. avalilableto

but here problem adding 2 rows same doctor if visit 2 different timings in same day.

is there issue in database schema or better table design me simple?

with table should able detect doctor available or not particular day , time

how best can improve table design?

edit: screen working is, hospital staff know when visiting doctor available, can book appointment patient time or inform other available time

i go dividing day segments of 15 or 30 minutes, , creating record every doctor each slot available. takes care of uniqueness well.

an appointment can single record , time slots covers can reference appointment record.

because records non-appointment availability time in same way appointment time, queries against method simple -- example, query available time slots of given length, or calculate how of doctor's time not used appointments, or average length of appointments, etc..

the table like:

create table staff_time(   staff_id  integer,   time_slot date,   allocation_id) 

allocation_id references appointment or training time or other allocation, or nothing if slot free.

the date data type includes time component on oracle.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

php - Dynamic url re-writing using htaccess -

java - Multi-Label Document Classification -