Class DoctorAM

java.lang.Object
Controllers.AMManagers.DoctorAM

public class DoctorAM extends Object
The DoctorAM class manages appointment-related functionalities for doctors. It provides methods for validating dates and times, generating appointment slots, and managing appointment requests.
  • Constructor Details

    • DoctorAM

      public DoctorAM(DoctorSchedule doctorSchedule)
      Constructs a DoctorAM with the specified doctor's schedule.
      Parameters:
      doctorSchedule - the DoctorSchedule associated with the doctor
  • Method Details

    • isValidDate

      public boolean isValidDate(int year, int month, int day)
      Checks if the provided date is valid.
      Parameters:
      year - the year of the date
      month - the month of the date
      day - the day of the date
      Returns:
      true if the date is valid; false otherwise
    • isValidHour

      public boolean isValidHour(int hours)
      Checks if the provided hour is within valid working hours (8 AM to 6 PM).
      Parameters:
      hours - the hour to check
      Returns:
      true if the hour is valid; false otherwise
    • isEndTimeAfterStart

      public boolean isEndTimeAfterStart(int startHours, int endHours)
      Checks if the end hour is after the start hour.
      Parameters:
      startHours - the starting hour
      endHours - the ending hour
      Returns:
      true if end hour is after start hour; false otherwise
    • convertHours

      public String convertHours(int hours)
      Converts an hour to a time format string (HH:00).
      Parameters:
      hours - the hour to convert
      Returns:
      a string representing the time in HH:00 format
    • isAppIDExist

      public boolean isAppIDExist(String slotID)
      Checks if an appointment ID exists in the doctor's schedule.
      Parameters:
      slotID - the unique identifier of the appointment slot
      Returns:
      true if the appointment ID exists; false otherwise
    • generateTimeSlot

      public void generateTimeSlot(String doctorID, LocalDate date, String startTime, String endTime)
      Generates hourly appointment slots for a doctor between specified start and end times.
      Parameters:
      doctorID - the unique identifier of the doctor
      date - the date for which to generate slots
      startTime - the starting time for generating slots (in HH:mm format)
      endTime - the ending time for generating slots (in HH:mm format)
    • acceptRequest

      public void acceptRequest(AppointmentSlot slot)
      Accepts an appointment slot request and updates its status to CONFIRMED.
      Parameters:
      slot - the AppointmentSlot to accept
    • rejectRequest

      public void rejectRequest(AppointmentSlot slot)
      Rejects an appointment slot request and updates its status to DECLINED.
      Parameters:
      slot - the AppointmentSlot to reject
    • getAvailableSlots

      public List<AppointmentSlot> getAvailableSlots()
      Retrieves all available appointment slots from the doctor's schedule.
      Returns:
      a list of available AppointmentSlot objects; null if no schedule found
    • getSlotWithAppID

      public AppointmentSlot getSlotWithAppID(String AppID)
      Retrieves a specific appointment slot by its ID.
      Parameters:
      AppID - the unique identifier of the appointment slot
      Returns:
      an AppointmentSlot object if found; null otherwise