Class Appointment

java.lang.Object
cz.cuni.kubinja.hospitalsystem.calendar.Appointment
All Implemented Interfaces:
Exportable, Comparable<Appointment>

public class Appointment extends Object implements Comparable<Appointment>, Exportable
Appointment of patient and doctor in specific time and length.
  • Field Details

    • id

      public final int id
      Identification number of appointment
    • patientId

      public final int patientId
      Identification number of the patient connected with this appointment.
    • doctorId

      public final int doctorId
      Identification number of the doctor connected with this appointment.
    • department

      public final String department
      Name of the department in which the appointment is taking place
    • startTime

      public final LocalDateTime startTime
      Starting time of the appointment
    • endTime

      public final LocalDateTime endTime
      Ending time of the appointment
    • minimumDepartmentDisplayNameLength

      public static final int minimumDepartmentDisplayNameLength
      Minimum length of the displayed department name
      See Also:
  • Constructor Details

    • Appointment

      public Appointment(int id, int patientId, int DoctorId, String department, LocalDateTime startTime, LocalDateTime endTime)
      Creates new appointment.
      Parameters:
      id - Identifier of appointment.
      patientId - Patients identifier.
      DoctorId - Doctors identifier.
      department - Department in which the appointment is taking place.
      startTime - Starting time of the appointment.
      endTime - Ending time of the appointment.
    • Appointment

      public Appointment(int id, Patient patient, Doctor doctor, LocalDateTime startTime, LocalDateTime endTime)
      Creates new appointment.
      Parameters:
      id - Identifier of appointment.
      patient - Patient connected to the appointment.
      doctor - Doctor connected to the appointment.
      startTime - Starting time of the appointment.
      endTime - Ending time of the appointment.
    • Appointment

      public Appointment(ResultSet result) throws SQLException
      Creates appointment from SQL result set.
      Parameters:
      result - SQL result set containing data for appointment creation.
      Throws:
      SQLException - Error connected with the invalid columns in result set or failure of retrieving data from result set.
  • Method Details

    • compareTo

      public int compareTo(Appointment o)
      Compares two appointments based on starting and ending time and id.
      Specified by:
      compareTo in interface Comparable<Appointment>
      Parameters:
      o - Other appointment.
      Returns:
      Integer which denotes whether this appointment is smaller, bigger or equal then the other one.
    • getStringForPart

      public String getStringForPart(Parts part)
      Returns info about appointment for the calendar diagram based on provided required part.
      Parameters:
      part - Part that is required for drawing calendar diagram.
      Returns:
      Info about appointment for the calendar diagram based on provided required part.
    • inConflict

      public boolean inConflict(LocalDateTime start, LocalDateTime end)
      Decided whether the time interval is in conflict, if the overlap.
      Parameters:
      start - Starting time of the interval.
      end - Ending time of the interval.
      Returns:
      Whether the time interval is overlapping with the appointment.
    • export

      public String export()
      Description copied from interface: Exportable
      Text format that will be used for exporting object.
      Specified by:
      export in interface Exportable
      Returns:
      text that will be used for exporting object.
    • toString

      public String toString()
      Overrides:
      toString in class Object