示例#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 hospitalAction()
 {
     $id = $this->_getParam('id');
     //destination_id
     $hospitalMaps = Application_Model_M_DestinationHospitalMap::fetchByDestinationID($id);
     if (count($hospitalMaps) > 0) {
         $hospitals = array();
         foreach ($hospitalMaps as $hospitalMap) {
             $hospitalID = $hospitalMap->getHospital_id();
             $hospitalModel = Application_Model_M_Hospital::find($hospitalID);
             if ($hospitalModel && $hospitalModel->getStatus() == 1) {
                 $hospital = array('id' => $hospitalModel->getId(), 'name' => $hospitalModel->getName(), 'avatar' => Application_Model_M_Hospital::getAvatarUrl($hospitalModel->getId()), 'type' => $hospitalModel->getType(), 'departments' => $hospitalModel->getDepartments(), 'longitude' => $hospitalModel->getLongitude(), 'latitude' => $hospitalModel->getLatitude());
                 array_push($hospitals, $hospital);
             }
         }
         if (count($hospitals) > 0) {
             $out['errno'] = '0';
             $out['hospitals'] = $hospitals;
         } else {
             $out['errno'] = '1';
         }
     } else {
         $out['errno'] = '1';
     }
     $out['msg'] = Yy_ErrMsg_Destination::getMsg('hospital', $out['errno']);
     Yy_Utils::jsonOut($out);
 }
 public function infoAction()
 {
     $id = $this->_getParam('id');
     $hospital = Application_Model_M_Hospital::find($id);
     if ($hospital && $hospital->getStatus() == 1) {
         $out['errno'] = '0';
         $out['id'] = $hospital->getId();
         $out['name'] = $hospital->getName();
         $out['avatar'] = Application_Model_M_Hospital::getAvatarUrl($hospital->getId());
         $out['departments'] = $hospital->getDepartments();
         $out['type'] = $hospital->getType();
         $out['certified'] = $hospital->getCertified();
         $out['city'] = $hospital->getCity();
         $out['label'] = $hospital->getLabel();
         $out['country'] = $hospital->getCountry();
         $out['area'] = $hospital->getArea();
         $out['introduction'] = $hospital->getIntroduction();
         $out['longitude'] = $hospital->getLongitude();
         $out['latitude'] = $hospital->getLatitude();
     } else {
         $out['errno'] = '1';
     }
     $out['msg'] = Yy_ErrMsg_Hospital::getMsg('info', $out['errno']);
     Yy_Utils::jsonOut($out);
 }