public function actionGetPreviousIOPAverage()
{
if (!($patient = \Patient::model()->findByPk(@$_GET['patient_id']))) {
throw new \Exception('Patient not found: ' . @$_GET['patient_id']);
}
if (!in_array(@$_GET['side'], array('left', 'right'))) {
throw new \Exception('Invalid side: ' . @$_GET['side']);
}
$side = ucfirst(@$_GET['side']);
$api = new components\OphCiExamination_API();
$result = $api->{"getLastIOPReading{$side}"}($patient);
echo $result;
}