Beispiel #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 updateAction()
 {
     $id = $this->_getParam('id');
     $doctor = Application_Model_M_Doctor::find($id);
     if ($doctor) {
         $this->view->doctor = $doctor;
     } else {
         $this->redirect('error');
     }
 }
 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);
 }
 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);
 }
Beispiel #5
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;
 }