Doctors can declare their availability in terms of slots for that day only. Patients can search available slots by speciality, book appointments, and cancel appointments.
Cardiologist, Dermatologist, Orthopedic, General Physician.HH:MM format.HH:MM-HH:MM (example: 09:00-10:00).09:00 through 20:00 (inclusive), and valid slot end times are 10:00 through 21:00 (inclusive).DoctorAppointmentSystem. void registerDoctor(String doctorName, String speciality, List<String> slots)
doctorName is non-empty and uniquely identifies the doctor.speciality must be one of: Cardiologist, Dermatologist, Orthopedic, General Physician.slots contains strings in time format as explained above. String bookAppointment(String bookingId, String patientId, String doctorName, String startTime, boolean addToWaitlistIfBooked)
patientId is a non-empty identifier.doctorName must be registered.startTime is a slot start time in HH:MM (example: 12:00).startTime.BOOKED.addToWaitlistIfBooked is true, add to waitlist and return: Added to the waitlist.addToWaitlistIfBooked is false, return: Slot already booked. List<String> showAvailabilityBySpeciality(String speciality)
speciality.Dr.<doctorName>: (<HH:MM-HH:MM>). List<String> cancelBooking(String bookingId)
bookingId, if bookingId is in waitlist then remove it.Booking Cancelled if cancellation succeeds.Booking confirmed for Booking id: <id>.bookingId does not exist or is not cancellable, return: ["Invalid booking id"]. List<String> showAppointmentsBooked(String userName)
userName can be a patient id or a doctor name.Booking id: <id>, Dr <doctorName> <startTime> (for patients), Booking id: <id>, <patientId> <startTime> for doctors.1 ≤ number of doctors(doctorName, startTime).registerDoctor(doctorName="Curious", speciality="Cardiologist", slots=List.of("12:00-13:00","16:00-17:00")) registerDoctor(doctorName="Alpha", speciality="Cardiologist", slots=List.of("09:00-10:00")) showAvailabilityBySpeciality(speciality="Cardiologist") List.of("Dr.Alpha: (09:00-10:00)","Dr.Curious: (12:00-13:00)","Dr.Curious: (16:00-17:00)")
bookAppointment(bookingId="b1", patientId="PatientA", doctorName="Alpha", startTime="09:00", addToWaitlistIfBooked=false) BOOKED showAvailabilityBySpeciality(speciality="Cardiologist") List.of("Dr.Curious: (12:00-13:00)","Dr.Curious: (16:00-17:00)") showAppointmentsBooked(userName="PatientA") List.of("Booking id: b1, Dr Alpha 09:00") showAppointmentsBooked(userName="Alpha") List.of("Booking id: b1, PatientA 09:00")
bookAppointment(bookingId="b2", patientId="PatientB", doctorName="Curious", startTime="12:00", addToWaitlistIfBooked=false) BOOKED bookAppointment(bookingId="b3", patientId="PatientC", doctorName="Curious", startTime="12:00", addToWaitlistIfBooked=true) Added to the waitlist cancelBooking(bookingId="b2") List.of("Booking Cancelled","Booking confirmed for Booking id: b3") showAppointmentsBooked(userName="PatientC") List.of("Booking id: b3, Dr Curious 12:00") showAppointmentsBooked(userName="Curious") List.of("Booking id: b3, PatientC 12:00")