public function indexAction() { $sort = $this->_getParam('sort'); $department = $this->_getParam('department'); $hospital = $this->_getParam('hospital'); $page = $this->_getParam('page', 1); $departmentRes = Application_Model_M_Doctor::fetchDepartment(); $hospitalRes = Application_Model_M_Doctor::fetchHospital(); $res = Application_Model_M_Doctor::fetchByDepartmentHospital($department, $hospital, $sort, $page); $doctors = $res['doctors']; $pages = $res['pages']; if (count($doctors) > 0) { $out['errno'] = '0'; if ($page < $pages) { $out['page'] = $page; } else { $out['page'] = $pages; } $out['pages'] = $pages; $out['departments'] = $departmentRes; $out['hospitals'] = $hospitalRes; $results = array(); foreach ($doctors as $doctor) { $result = array('id' => $doctor->getId(), 'name' => $doctor->getName(), 'department' => $doctor->getDepartment(), 'avatar' => Application_Model_M_Doctor::getAvatarUrl($doctor->getId()), 'number' => $doctor->getReservation_number(), 'special' => $doctor->getSpecial(), 'hospital' => $doctor->getHospital()); array_push($results, $result); } $out['doctors'] = $results; } else { $out['errno'] = '1'; } $out['msg'] = Yy_ErrMsg_Consult::getMsg('index', $out['errno']); Yy_Utils::jsonOut($out); }
public static function getNameAvatar($id = null, $role = null) { // if(!is_numeric($id) || !is_numeric($role)){ // return array( // 'name' => '', // 'avatar' => '', // ); // } if ($role == 1) { $user = Application_Model_M_Nuser::find($id); $avatarurl = Application_Model_M_Nuser::getAvatarUrl($id); } elseif ($role == 2) { $user = Application_Model_M_Doctor::find($id); $avatarurl = Application_Model_M_Doctor::getAvatarUrl($id); } elseif ($role == 3) { $user = Application_Model_M_Hospital::find($id); $avatarurl = Application_Model_M_Hospital::getAvatarUrl($id); } else { $user = NULL; } if ($user) { $res = array('name' => $user->getName(), 'avatar' => $avatarurl); } else { $res = array('name' => '', 'avatar' => ''); } return $res; }
public function infoAction() { $id = $this->_getParam('id'); $doctor = Application_Model_M_Doctor::find($id); if ($doctor && $doctor->getStatus() == 1) { $out['errno'] = '0'; $out['id'] = $doctor->getId(); $out['name'] = $doctor->getName(); $out['avatar'] = Application_Model_M_Doctor::getAvatarUrl($doctor->getId()); $out['sex'] = $doctor->getSex(); $out['birthday'] = $doctor->getBirthday(); //$out['phone'] = $doctor->getPhone(); $out['department'] = $doctor->getDepartment(); $out['city'] = $doctor->getCity(); $out['certified'] = $doctor->getCertified(); $out['special'] = $doctor->getSpecial(); $out['country'] = $doctor->getCountry(); $out['introduction'] = $doctor->getIntroduction(); $out['hospital'] = $doctor->getHospital(); $out['area'] = $doctor->getArea(); $out['qualification'] = $doctor->getQualification(); $out['reservation_fee'] = $doctor->getReservation_fee(); $out['reservation_number'] = $doctor->getReservation_number(); } else { $out['errno'] = '1'; } $out['msg'] = Yy_ErrMsg_Doctor::getMsg('info', $out['errno']); Yy_Utils::jsonOut($out); }