Package DatabaseItems

Class MedicalRecord

java.lang.Object
DatabaseItems.MedicalRecord
All Implemented Interfaces:
DatabaseItems

public class MedicalRecord extends Object implements DatabaseItems
The MedicalRecord class represents a patient's medical record. It implements the DatabaseItems interface and provides methods for serialization, deserialization, and displaying medical record details.
  • Constructor Details

    • MedicalRecord

      public MedicalRecord(String id, String name, String dob, Gender gender, String email, String phone, BloodType bloodType, List<String> diagnoses, List<String> treatments)
      Constructs a MedicalRecord instance with specified attributes.
      Parameters:
      id - the unique identifier for the medical record
      name - the name of the patient
      dob - the date of birth of the patient
      gender - the gender of the patient
      email - the email address of the patient
      phone - the phone number of the patient
      bloodType - the blood type of the patient
      diagnoses - a list of diagnoses for the patient
      treatments - a list of treatments for the patient
    • MedicalRecord

      public MedicalRecord(String... params)
      Constructs a MedicalRecord instance by deserializing from an array of parameters.
      Parameters:
      params - an array of strings containing serialized data for the medical record
  • Method Details

    • deserialise

      public void deserialise(String... params)
      Deserializes parameters into a MedicalRecord object.
      Specified by:
      deserialise in interface DatabaseItems
      Parameters:
      params - an array of strings containing serialized data for the medical record
    • serialise

      public String serialise()
      Serializes the MedicalRecord object into a CSV format string.
      Specified by:
      serialise in interface DatabaseItems
      Returns:
      a string representing the serialized data of the medical record
    • printItem

      public void printItem()
      Prints details of the medical record to the console.
      Specified by:
      printItem in interface DatabaseItems
    • printDiagnoses

      public void printDiagnoses()
      Prints all diagnoses associated with this medical record.
    • printTreatments

      public void printTreatments()
      Prints all treatments associated with this medical record.
    • getId

      public String getId()
      Returns the unique identifier of the medical record.
      Returns:
      the ID of the medical record
    • getName

      public String getName()
      Returns the name of the patient.
      Returns:
      the name of the patient
    • getDob

      public String getDob()
      Returns the date of birth of the patient.
      Returns:
      the date of birth as a string
    • getGender

      public Gender getGender()
      Returns the gender of the patient.
      Returns:
      the gender as a Gender object
    • getEmail

      public String getEmail()
      Returns the email address of the patient.
      Returns:
      the email address as a string
    • getPhone

      public String getPhone()
      Returns the phone number of the patient.
      Returns:
      the phone number as a string
    • getBloodType

      public BloodType getBloodType()
      Returns the blood type of the patient.
      Returns:
      the blood type as a BloodType object
    • getDiagnoses

      public List<String> getDiagnoses()
      Returns a list of diagnoses associated with this medical record.
      Returns:
      a list of diagnoses as strings
    • getTreatments

      public List<String> getTreatments()
      Returns a list of treatments associated with this medical record.
      Returns:
      a list of treatments as strings
    • setEmail

      public void setEmail(String email)
      Sets a new email address for the patient.
      Parameters:
      email - The new email address to set.
    • setPhone

      public void setPhone(String phone)
      Sets a new phone number for the patient.
      Parameters:
      phone - The new phone number to set.
    • setBloodType

      public void setBloodType(BloodType bloodType)
      Sets a new blood type for the patient.
      Parameters:
      bloodType - The new blood type to set.
    • setDiagnoses

      public void setDiagnoses(List<String> diagnoses)
      Sets new diagnoses for the patient's medical record.
      Parameters:
      diagnoses - The new list of diagnoses to set.
    • setTreatments

      public void setTreatments(List<String> treatments)
      Sets new treatments for the patient's medical record.
      Parameters:
      treatments - The new list of treatments to set.