OEModule\OphCoCvi\models\Element_OphCoCvi_Demographics::initFromPatient PHP 메소드

initFromPatient() 공개 메소드

Initialises the element from the patient model.
public initFromPatient ( Patient $patient )
$patient Patient
    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;
            }
        }
    }

Usage Example

예제 #1
0
 /**
  * Sets the default values for the element from the patient
  *
  * @param models\Element_OphCoCvi_Demographics $element
  */
 protected function setElementDefaultOptions_Element_OphCoCvi_Demographics(models\Element_OphCoCvi_Demographics $element)
 {
     if ($element->isNewRecord) {
         $element->initFromPatient($this->patient);
     }
 }