Package DatabaseItems
Class MedicalRecord
java.lang.Object
DatabaseItems.MedicalRecord
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionMedicalRecord
(String... params) Constructs aMedicalRecord
instance by deserializing from an array of parameters.MedicalRecord
(String id, String name, String dob, Gender gender, String email, String phone, BloodType bloodType, List<String> diagnoses, List<String> treatments) Constructs aMedicalRecord
instance with specified attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
deserialise
(String... params) Deserializes parameters into aMedicalRecord
object.Returns the blood type of the patient.Returns a list of diagnoses associated with this medical record.getDob()
Returns the date of birth of the patient.getEmail()
Returns the email address of the patient.Returns the gender of the patient.getId()
Returns the unique identifier of the medical record.getName()
Returns the name of the patient.getPhone()
Returns the phone number of the patient.Returns a list of treatments associated with this medical record.void
Prints all diagnoses associated with this medical record.void
Prints details of the medical record to the console.void
Prints all treatments associated with this medical record.Serializes theMedicalRecord
object into a CSV format string.void
setBloodType
(BloodType bloodType) Sets a new blood type for the patient.void
setDiagnoses
(List<String> diagnoses) Sets new diagnoses for the patient's medical record.void
Sets a new email address for the patient.void
Sets a new phone number for the patient.void
setTreatments
(List<String> treatments) Sets new treatments for the patient's medical record.
-
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 aMedicalRecord
instance with specified attributes.- Parameters:
id
- the unique identifier for the medical recordname
- the name of the patientdob
- the date of birth of the patientgender
- the gender of the patientemail
- the email address of the patientphone
- the phone number of the patientbloodType
- the blood type of the patientdiagnoses
- a list of diagnoses for the patienttreatments
- a list of treatments for the patient
-
MedicalRecord
Constructs aMedicalRecord
instance by deserializing from an array of parameters.- Parameters:
params
- an array of strings containing serialized data for the medical record
-
-
Method Details
-
deserialise
Deserializes parameters into aMedicalRecord
object.- Specified by:
deserialise
in interfaceDatabaseItems
- Parameters:
params
- an array of strings containing serialized data for the medical record
-
serialise
Serializes theMedicalRecord
object into a CSV format string.- Specified by:
serialise
in interfaceDatabaseItems
- 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 interfaceDatabaseItems
-
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
Returns the unique identifier of the medical record.- Returns:
- the ID of the medical record
-
getName
Returns the name of the patient.- Returns:
- the name of the patient
-
getDob
Returns the date of birth of the patient.- Returns:
- the date of birth as a string
-
getGender
Returns the gender of the patient.- Returns:
- the gender as a
Gender
object
-
getEmail
Returns the email address of the patient.- Returns:
- the email address as a string
-
getPhone
Returns the phone number of the patient.- Returns:
- the phone number as a string
-
getBloodType
Returns the blood type of the patient.- Returns:
- the blood type as a
BloodType
object
-
getDiagnoses
Returns a list of diagnoses associated with this medical record.- Returns:
- a list of diagnoses as strings
-
getTreatments
Returns a list of treatments associated with this medical record.- Returns:
- a list of treatments as strings
-
setEmail
Sets a new email address for the patient.- Parameters:
email
- The new email address to set.
-
setPhone
Sets a new phone number for the patient.- Parameters:
phone
- The new phone number to set.
-
setBloodType
Sets a new blood type for the patient.- Parameters:
bloodType
- The new blood type to set.
-
setDiagnoses
Sets new diagnoses for the patient's medical record.- Parameters:
diagnoses
- The new list of diagnoses to set.
-
setTreatments
Sets new treatments for the patient's medical record.- Parameters:
treatments
- The new list of treatments to set.
-