public function gatherbedbez() { $dienstmodel = new keukendienstModel(); //$kamermodel = new keukenkamerModel(); $model = new keukenpatientModel(); $statmodel = new bedbezModel(); $diensten = $dienstmodel->get(); $adiensten = array(); $time = time(); foreach ($diensten as $dienst) { $adiensten[$dienst->getId()] = $dienst; } $outputdiensten = array(); $totalcond = array(); $totalmax = 0; foreach ($adiensten as $id => $dienst) { //$kamercond = array(); //$kamers = $kamermodel->getfromDienstid($id); // foreach($kamers as $kamer){ // $kamercond[] = array('kamer' => array('mode' => '=','value' => $kamer->getKamernr())); // } // // $totalcond = array_merge($totalcond,$kamercond); // if(count($kamercond) > 0){ // $kamercond = array('OR' => $kamercond); // } // else { // //Geen kamers, lege lijst voorzien // $kamercond = array('kamer' => array('mode' => '=','value' => '-1')); // } $cond = array('ve' => array('mode' => '=', 'value' => $dienst->getDienstnr())); $count = $model->getcount($cond); $statobject = new bedbezObject(); $statobject->setTime($time); $statobject->setVe($dienst->getDienstnr()); $statobject->setAantal($count); try { $statmodel->save($statobject); } catch (Exception $e) { } } }
if (count($dienstobj) > 0) { $dienstobj = $dienstobj[0]; $aantalbedden = $dienstobj->getAantalbedden(); $naam = $dienstobj->getName(); $model = new bedbezModel(); $cond = array('time' => array('mode' => 'BETWEEN', 'topvalue' => $endtime, 'value' => $starttime)); $condve = array('ve' => array('mode' => '=', 'value' => $dienstobj->getDienstnr())); $objects = $model->get(array('AND' => array($cond, $condve)), array('fields' => array('time'), 'type' => 'ASC')); foreach ($objects as $obj) { $ydata[] = $obj->getAantal(); $xdata[] = $obj->getTime(); } } } else { $naam = 'AZ Lokeren'; $dienstobjs = $dienstmodel->get(); foreach ($dienstobjs as $dienstobj) { $aantalbedden += $dienstobj->getAantalbedden(); } $model = new bedbezModel(); $cond = array('time' => array('mode' => 'BETWEEN', 'topvalue' => $endtime, 'value' => $starttime)); $objects = $model->get(array('AND' => array($cond)), array('fields' => array('time'), 'type' => 'ASC')); foreach ($objects as $obj) { $ydata[$obj->getTime()] += $obj->getAantal(); $xdata[$obj->getTime()] = $obj->getTime(); } $xdata = array_values($xdata); $ydata = array_values($ydata); } $width = 600; $height = 400;
public function showstatus($parameters = array()) { $view = new ui($this); $dienstmodel = new keukendienstModel(); $kamermodel = new keukenkamerModel(); $diensten = $dienstmodel->get(); $adiensten = array(); $kamercond = array(); foreach ($diensten as $dienst) { if (myacl::isAllowed(myauth::getCurrentuser(), $dienst, 'view')) { $adiensten[$dienst->getId()] = $dienst; } } if (count($adiensten > 1)) { $form = new form($parameters); $select = new selectField('dienst', 'Dienst', array('required'), true); $select->addOption(new selectoptionField('Alles', '_all_', true)); foreach ($adiensten as $id => $dienst) { $select->addOption(new selectoptionField($dienst->getName(), $id)); } $form->addField($select); $continue = true; if ($form->validate()) { $all = false; foreach ($form->getFieldvalue('dienst') as $id) { $chosendienst[$id] = $adiensten[$id]; if ($id == '_all_') { $all = true; break; } } if (!$all) { $adiensten = $chosendienst; } $view->assign('form', $form); } elseif (!$form->isSent()) { $view->assign('form', $form); } else { $continue = false; } } if ($continue) { foreach ($adiensten as $id => $dienst) { $kamers = $kamermodel->getfromDienstid($id); foreach ($kamers as $kamer) { $kamercond[] = array('kamer' => array('mode' => '=', 'value' => $kamer->getKamernr())); } } if (count($kamercond) > 0) { $kamercond = array('OR' => $kamercond); } else { //Geen kamers, lege lijst voorzien $kamercond = array('kamer' => array('mode' => '=', 'value' => '-1')); } $model = new keukenpatientModel(); $count = $model->getcount($kamercond); $view->assign('count', $count); $grid = new mygrid('keukenstatus'); $grid->setModel($model); $grid->setDefaultconditions($kamercond); $grid->setDefaultorder(array('fields' => array('kamer', 'bed'), 'type' => 'ASC')); $grid->registerEditrequest('keukenpakket', 'editPatient', array('title' => 'Maaltijdfiche aanpassen', 'id' => '{id}')); $grid->setPagesize(999); $view->assign('grid', $grid); $this->response->assign($this->self, 'innerHTML', $view->fetch('keukenpakket_showstatus.tpl')); } }
public function showbedbezbydoc($parameters = array()) { $view = new ui($this); $dienstmodel = new keukendienstModel(); $model = new keukenpatientModel(); $diensten = $dienstmodel->get(); $adiensten = array(); foreach ($diensten as $dienst) { //if(myacl::isAllowed(myauth::getCurrentuser(),$dienst,'countstats')){ $adiensten[$dienst->getId()] = $dienst->getDienstnr(); //} } asort($adiensten); $cond = array('ve' => array('mode' => 'IN', 'value' => $adiensten)); $all = $model->get($cond); $dokters = array(); $ve = array(); foreach ($all as $pat) { $dokters[$pat->getDokterognummer()]['naam'] = $pat->getDokternaam(); $dokters[$pat->getDokterognummer()][$pat->getVe()]++; $dokters[$pat->getDokterognummer()]['all']++; $ve[$pat->getVe()]++; $ve['all']++; } uasort($dokters, mystats_doktersort); $view->assign('diensten', $adiensten); $view->assign('stats', $dokters); $view->assign('ve', $ve); $this->response->assign($this->self, 'innerHTML', $view->fetch('mystats_showbedbezbydoc.tpl')); }