Class PatientAM

java.lang.Object
Controllers.AMManagers.PatientAM

public class PatientAM extends Object
The PatientAM class manages appointment-related functionalities for patients. It provides methods to retrieve doctor information, check appointment availability, and manage appointment slots.
  • Constructor Details

    • PatientAM

      public PatientAM(String id, AccountDatabase accountDatabase)
      Constructs a PatientAM with the specified patient ID and account database.
      Parameters:
      id - the unique identifier of the patient
      accountDatabase - the AccountDatabase used to manage accounts
  • Method Details

    • getDocList

      public List<Account> getDocList()
      Returns the list of doctors available to the patient.
      Returns:
      a list of Account objects representing doctors
    • checkDoctor

      public boolean checkDoctor(String id)
      Checks if a doctor exists in the database by their ID.
      Parameters:
      id - the unique identifier of the doctor
      Returns:
      true if the doctor exists; false otherwise
    • getDoctorSchedule

      public DoctorSchedule getDoctorSchedule(String id)
      Retrieves the schedule for a specific doctor by their ID.
      Parameters:
      id - the unique identifier of the doctor
      Returns:
      a DoctorSchedule object if found; null otherwise
    • getAvailableSlots

      public List<AppointmentSlot> getAvailableSlots(String id)
      Retrieves available appointment slots for a specific doctor by their ID.
      Parameters:
      id - the unique identifier of the doctor
      Returns:
      a list of available AppointmentSlot objects; null if no schedule found
    • getSlots

      public List<AppointmentSlot> getSlots(String id)
      Retrieves all appointment slots for a specific doctor by their ID.
      Parameters:
      id - the unique identifier of the doctor
      Returns:
      a list of all AppointmentSlot objects; null if no schedule found
    • cancelSlot

      public boolean cancelSlot(String appointmentId)
      Cancels an appointment slot by its ID.
      Parameters:
      appointmentId - the unique identifier of the appointment to cancel
      Returns:
      true if the slot was successfully canceled; false otherwise
    • requestSlot

      public boolean requestSlot(String appointmentId)
      Requests an appointment slot by its ID.
      Parameters:
      appointmentId - the unique identifier of the appointment to request
      Returns:
      true if the slot was successfully requested; false otherwise
    • getAppointments

      public List<AppointmentSlot> getAppointments()
      Retrieves all appointments associated with this patient across all doctors.
      Returns:
      a list of AppointmentSlot objects representing this patient's appointments
    • checkSlotAvailable

      public boolean checkSlotAvailable(String appointmentId)
      Checks whether a specific appointment slot is available.
      Parameters:
      appointmentId - the unique identifier of the appointment to check availability for
      Returns:
      true if the slot is available; false otherwise
    • checkSlotCancellable

      public boolean checkSlotCancellable(String appointmentId)
      Checks whether a specific appointment slot can be canceled by this patient.
      Parameters:
      appointmentId - the unique identifier of the appointment to check cancelability for
      Returns:
      true if the slot can be canceled; false otherwise