public function initFromPatient(\Patient $patient)
{
$this->date_of_birth = $patient->dob;
$this->nhs_number = $patient->getNhsnum();
$this->address = $patient->getSummaryAddress(",\n");
if ($patient->contact && $patient->contact->address) {
$this->postcode = substr($patient->contact->address->postcode, 0, 4);
}
$this->email = $patient->getEmail();
$this->telephone = $patient->getPrimary_phone();
$this->mapNamesFromPatient($patient);
$this->mapGenderFromPatient($patient);
$this->ethnic_group_id = $patient->ethnic_group_id;
if ($patient->gp) {
$this->gp_name = $patient->gp->getFullName();
$this->gp_address = $patient->gp->getLetterAddress(array('delimiter' => ",\n", 'patient' => $patient));
if ($practice = $patient->practice) {
$this->gp_telephone = $practice->phone;
}
}
}