public function actionGetMedications($id)
{
$patient = \Patient::model()->findByPk($id);
$medications = array_merge($patient->get_previous_medications(), $patient->get_medications());
//$medications = $this->sortMedications($medications);
$output = array();
foreach ($medications as $medication) {
$output[] = array((int) strtotime($medication->start_date) * 1000, (int) strtotime($medication->end_date) * 1000, (int) $medication->option_id, explode(' ', $medication->getDrugLabel())[0]);
}
echo json_encode($output);
}