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);
 }
Example #2
0
 public static function RDelByHospitalID($hid)
 {
     Application_Model_M_Hospital::delById($hid);
     Application_Model_M_DestinationHospitalMap::delByHid($hid);
     Application_Model_M_DepartmentsHospitalMap::delByHid($hid);
 }
 public function hospitalcancelAction()
 {
     $this->getResponse()->setHeader('Content-Type', 'application/json');
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $did = $this->_getParam('did');
     $hid = $this->_getParam('hid');
     try {
         Application_Model_M_DestinationHospitalMap::delByDidAndHid($did, $hid);
         $out['errno'] = "0";
     } catch (Zend_Db_Exception $e) {
         $out['errno'] = "1";
     }
     Yy_Utils::jsonOut($out);
 }
 public function delete()
 {
     $where = 'id=' . $this->getId();
     return Application_Model_M_DestinationHospitalMap::delete($where);
 }