本文整理汇总了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));
}
示例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();
}
}
}
}