Esempio n. 1
0
 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 doctorAction()
 {
     $page = $this->_getParam('page', 1);
     $startTime = $this->_getParam('stime');
     $endTime = $this->_getParam('etime');
     $count = Application_Model_M_Doctor::getCount();
     if (!$startTime && !$endTime) {
         //按照时间倒序
         $res = Application_Model_M_Doctor::getCountByDay($page, 30);
         $this->view->count = $count;
         $this->view->res = $res;
         $this->render('stpl');
     } else {
     }
 }
Esempio n. 3
0
 public function delete()
 {
     $where = 'id=' . $this->getId();
     return Application_Model_M_Doctor::delete($where);
 }
Esempio n. 4
0
 public function im2userAction()
 {
     $id = $this->_getParam('id');
     $role = $this->_getParam('role');
     //get from doctorAction
     $msg = $this->_getParam('msg');
     if ($this->_auth->userid && $this->_auth->role == 2) {
         if ($role == 1) {
             //nuser
             $imuser = Application_Model_M_Nuser::find($id);
         } elseif ($role == 2) {
             //doctor
             $imuser = Application_Model_M_Doctor::find($id);
         } elseif ($role == 3) {
             //hospital
             $imuser = Application_Model_M_Hospital::find($id);
         }
         if ($imuser && $imuser->getStatus() == 1) {
             $dailog = new Application_Model_O_ConsultDialog();
             $dailog->setFrom_user($this->_auth->userid)->setFrom_role(2)->setTo_user($id)->setTo_role($role)->setMessage($msg)->setCtime(date('Y-m-d H:i:s'));
             try {
                 $out['errno'] = '0';
                 $dailog->save();
             } catch (Zend_Db_Exception $e) {
                 $out['errno'] = '1';
             }
         } else {
             $out['errno'] = '1';
         }
     } else {
         $out['errno'] = '200';
     }
     $out['msg'] = Yy_ErrMsg_Consult::getMsg('im2user', $out['errno']);
     Yy_Utils::jsonOut($out);
 }
Esempio n. 5
0
 public function searchAction()
 {
     $email = $this->_getParam('email', null);
     $name = $this->_getParam('name', null);
     if ($email) {
         //根据邮箱查找
         $doctors = Application_Model_M_Doctor::fetchByEmailLike($email);
     } elseif ($name) {
         $doctors = Application_Model_M_Doctor::fetchByNameLike($name);
     } else {
         $doctors = array();
     }
     $this->view->doctors = $doctors;
 }
Esempio n. 6
0
 public function imageAction()
 {
     $this->getResponse()->setHeader('Content-Type', 'image/png');
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->_getParam('id');
     $avatar = Application_Model_M_Doctor::getAvatar($id);
     echo $avatar;
 }
Esempio n. 7
0
 public static function getAccount($id, $role)
 {
     //role:1普通用户,2医生用户,3医院用户
     $account = "";
     if ($role == 1) {
         $nuser = Application_Model_M_Nuser::find($id);
         if ($nuser) {
             $account = $nuser->getMobile();
             if (!$account) {
                 $account = $nuser->getEmail();
             }
         }
     } elseif ($role == 2) {
         $doctor = Application_Model_M_Doctor::find($id);
         if ($doctor) {
             $account = $doctor->getEmail();
         }
     } elseif ($role == 3) {
         $hospital = Application_Model_M_Hospital::find($id);
         if ($hospital) {
             $account = $hospital->getEmail();
         }
     }
     return $account;
 }