public function modelToResource($patient)
 {
     $res = parent::modelToResource($patient);
     $res->nhs_num = $patient->nhs_num;
     $res->hos_num = $patient->hos_num;
     $res->title = $patient->contact->title;
     $res->family_name = $patient->contact->last_name;
     $res->given_name = $patient->contact->first_name;
     $res->gender = $patient->gender;
     $res->birth_date = $patient->dob;
     $res->date_of_death = $patient->date_of_death;
     $res->primary_phone = $patient->contact->primary_phone;
     $res->addresses = array_map(array('services\\PatientAddress', 'fromModel'), $patient->contact->addresses);
     if ($patient->gp_id) {
         $res->gp_ref = new InternalReference('Gp', $patient->gp_id);
     }
     if ($patient->practice_id) {
         $res->prac_ref = new InternalReference('Practice', $patient->practice_id);
     }
     foreach ($patient->commissioningbodies as $cb) {
         $res->cb_refs[] = new InternalReference('CommissioningBody', $cb->id);
     }
     $res->care_providers = array_merge(array_filter(array($res->gp_ref, $res->prac_ref)), $res->cb_refs);
     return $res;
 }
Beispiel #2
0
 public function modelToResource($practice)
 {
     $res = parent::modelToResource($practice);
     $res->code = $practice->code;
     $res->primary_phone = $practice->phone;
     if ($practice->contact->address) {
         $res->address = Address::fromModel($practice->contact->address);
     }
     return $res;
 }
 public function modelToResource($cb)
 {
     $res = parent::modelToResource($cb);
     $res->code = $cb->code;
     $res->name = $cb->name;
     if ($cb->contact->address) {
         $res->address = Address::fromModel($cb->contact->address);
     }
     return $res;
 }
Beispiel #4
0
 public function modelToResource($gp)
 {
     $res = parent::modelToResource($gp);
     $res->gnc = $gp->nat_id;
     $res->title = $gp->contact->title;
     $res->family_name = $gp->contact->last_name;
     $res->given_name = $gp->contact->first_name;
     $res->primary_phone = $gp->contact->primary_phone ?: null;
     if ($gp->contact->address) {
         $resouce->address = Address::fromModel($gp->contact->address);
     }
     return $res;
 }