当前位置: 首页>>代码示例>>PHP>>正文


PHP Patient::getIterator方法代码示例

本文整理汇总了PHP中Patient::getIterator方法的典型用法代码示例。如果您正苦于以下问题:PHP Patient::getIterator方法的具体用法?PHP Patient::getIterator怎么用?PHP Patient::getIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Patient的用法示例。


在下文中一共展示了Patient::getIterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listTeamJsonAction

 public function listTeamJsonAction()
 {
     $this->_helper->autoCompleteDojo(array());
     $patientId = (int) $this->_getParam("patientId");
     $patient = new Patient();
     $patient->personId = $patientId;
     $patient->populate();
     $patient->person->populate();
     $db = Zend_Registry::get("dbAdapter");
     $dbSelect = $db->select()->from("patient")->where("teamId = ?", $patient->teamId);
     $patientIterator = $patient->getIterator($dbSelect);
     foreach ($patientIterator as $pat) {
         $tmp = array();
         $tmp['id'] = $pat->person_id;
         $tmp['data'][] = $pat->person->getDisplayName();
         $tmp['data'][] = $pat->email;
         $tmp['data'][] = $pat->phone_number;
         $rows[] = $tmp;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
开发者ID:jakedorst,项目名称:ch3-dev-preview,代码行数:23,代码来源:TeamManagerController.php

示例2: _generateAppointments

 protected function _generateAppointments()
 {
     $patients = array();
     $patient = new Patient();
     $patientIterator = $patient->getIterator();
     foreach ($patientIterator as $row) {
         $patients[] = $row->personId;
     }
     $patientLen = count($patients) - 1;
     $startingDate = strtotime(date('Y-m-d'));
     $endingDate = strtotime('+1 month', $startingDate);
     $titles = array('Sick', 'Followup', 'Cough', 'Runny Nose', 'Lab Only', 'Annual');
     $titleLen = count($titles) - 1;
     $dates = $this->_generateDays();
     $providerIterator = new ProviderIterator();
     foreach ($providerIterator as $provider) {
         $providerId = $provider->personId;
         foreach ($dates as $date) {
             $timeSlots = array();
             echo 'current:' . $date . ' time:' . calcTS() . ' memory:' . memory_get_usage() / 1024 / 1024 . '<br/>';
             $hour = 8;
             while ($hour < 18) {
                 if (rand(0, 1) == 1) {
                     continue;
                 }
                 $plus = rand(0, 2) * 0.25;
                 $length = rand(1, 4) * 0.25;
                 if ($hour >= 12 && $hour < 13) {
                     // lunch time
                     $hour = 13;
                 }
                 $start = $date . ' ' . formatTime($hour);
                 $hour += $length;
                 if ($hour >= 12 && $hour < 13) {
                     // lunch time
                     $hour = 12;
                 }
                 $end = $date . ' ' . formatTime($hour);
                 $timeSlots[] = array('start' => $start, 'end' => $end);
             }
             $rows = array();
             $timeSlotLen = count($timeSlots) - 1;
             if ($timeSlotLen > $patientLen) {
                 // patients are less than time slots
                 $slots = $timeSlots;
                 foreach ($patients as $patientId) {
                     $row = array();
                     shuffle($slots);
                     $slot = array_shift($slots);
                     $row['start'] = $slot['start'];
                     $row['end'] = $slot['end'];
                     $row['patientId'] = $patientId;
                     $rows[] = $row;
                 }
             } else {
                 // patients are greater than time slots
                 $patientIds = $patients;
                 foreach ($timeSlots as $slot) {
                     $row = array();
                     $row['start'] = $slot['start'];
                     $row['end'] = $slot['end'];
                     shuffle($patientIds);
                     $patientId = array_shift($patientIds);
                     $row['patientId'] = $patientId;
                     $rows[] = $row;
                 }
             }
             foreach ($rows as $row) {
                 $app = new Appointment();
                 // disable cascadePersist, we only generate appointments
                 $this->_setORMPersistMode($app);
                 $app->patientId = $row['patientId'];
                 $app->start = $row['start'];
                 $app->end = $row['end'];
                 $title = $titles[rand(0, $titleLen)];
                 $app->title = $title;
                 $app->providerId = $providerId;
                 $app->createdDate = date('Y-m-d H:i:s');
                 $app->persist();
             }
         }
     }
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:83,代码来源:TestDataController.php


注:本文中的Patient::getIterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。