private function mapGp(\Patient $patient)
{
if (property_exists($this, 'GpCode')) {
$code = $this->getAssignedProperty('GpCode');
if ($code) {
if ($gp = \Gp::model()->findByAttributes(array('nat_id' => $code))) {
$patient->gp_id = $gp->id;
} else {
$this->addWarning('Could not find GP for code ' . $code);
}
} else {
$patient->gp_id = null;
}
} else {
if (!$this->partial_record) {
$patient->gp_id = null;
}
}
}