Skip to content

Instantly share code, notes, and snippets.

@iaditya
Created March 16, 2017 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaditya/3733577a51527ac1c43fc1e5b43688ea to your computer and use it in GitHub Desktop.
Save iaditya/3733577a51527ac1c43fc1e5b43688ea to your computer and use it in GitHub Desktop.
public function bmiGraphApi($patient_id) {
if(!empty($patient_id)) {
$query = $this->Encounters->find()
->join(['Patients']);
$time = $query->func()->date_format([
'Encounters.visitdate' => 'identifier',
"'%m-%d-%y'" => 'literal'
]);
$data = $query->select([ 'visitdate' => $time, 'bmi' => 'Patients.bmi'])
->where(['Encounters.patient_id' => $patient_id])
->order(['Encounters.id' => 'DESC'])
->limit(15);
//debug($data); exit;
}
$this->set(compact('data'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment