private function mapPractice(\Patient $patient)
{
if ($code = $this->getAssignedProperty('PracticeCode')) {
if ($practice = \Practice::model()->findByAttributes(array('code' => $code))) {
$patient->practice_id = $practice->id;
} else {
$this->addWarning("Could not find Practice for code " . $code);
}
} else {
if (!$this->partial_record) {
$patient->practice_id = null;
}
}
}