public function delete()
 {
     $where = 'id=' . $this->getId();
     return Application_Model_M_GlobalConsultationApply::delete($where);
 }
 public function applyAction()
 {
     $category = $this->_getParam('category');
     $department = $this->_getParam('department');
     $email = $this->_getParam('email');
     $mobile = $this->_getParam('mobile');
     $age = $this->_getParam('age');
     $sex = $this->_getParam('sex');
     $location = $this->_getParam('location');
     $treatment_time = $this->_getParam('treatment_time');
     $opinion = $this->_getParam('opinion');
     $report = $this->_getParam('report');
     $apply = new Application_Model_O_GlobalConsultationApply();
     $apply->setDepartment_category_id($category)->setDepartment_id($department)->setEmail($email)->setMobile($mobile)->setAge($age)->setSex($sex)->setLocation($location)->setTreatment_time($treatment_time)->setOpinion($opinion)->setCtime(date('Y-m-d H:i:s'));
     try {
         $out['errno'] = '0';
         $apply->save();
         //保存病例报告
         $adapter = new Zend_File_Transfer_Adapter_Http();
         $wrdir = Yy_Utils::getWriteDir();
         $adapter->setDestination($wrdir);
         if (!$adapter->receive()) {
             $messages = $adapter->getMessages();
             //echo implode("\n", $messages);
         }
         $filename = $adapter->getFileName();
         if (is_string($filename)) {
             $handle = fopen($filename, 'rb');
             $report = addslashes(fread($handle, filesize($filename)));
             fclose($handle);
             Application_Model_M_GlobalConsultationApply::updateReport($apply->getId(), $report);
         }
     } catch (Zend_Db_Exception $e) {
         $out['errno'] = '1';
         //echo $e->getMessage();
     }
     $out['msg'] = Yy_ErrMsg_Diagnosis::getMsg('apply', $out['errno']);
     Yy_Utils::jsonOut($out);
 }
 public function applydelAction()
 {
     $this->getResponse()->setHeader('Content-Type', 'application/json');
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $id = $this->_getParam('id');
     try {
         Application_Model_M_GlobalConsultationApply::delById($id);
         $out['errno'] = "0";
     } catch (Zend_Db_Exception $e) {
         $out['errno'] = "1";
     }
     Yy_Utils::jsonOut($out);
 }