public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Hospital'])) {
         $messages = $this->ValidateData(array(array($_POST['Hospital']['fullname'], 'emptyfullname', 'emptystring')));
         if ($messages == '') {
             if ((int) $_POST['Hospital']['addressbookid'] > 0) {
                 $model = $this->loadModel($_POST['Hospital']['addressbookid']);
                 $model->fullname = $_POST['Hospital']['fullname'];
                 $model->taxno = $_POST['Hospital']['taxno'];
                 $model->accpiutangid = $_POST['Hospital']['accpiutangid'];
                 $model->fullname = $_POST['Hospital']['fullname'];
                 $model->recordstatus = $_POST['Hospital']['recordstatus'];
             } else {
                 $model = new Hospital();
                 $model->ishospital = 1;
                 $model->attributes = $_POST['Hospital'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Hospital']['addressbookid']);
                     $this->GetSMessage('mmsinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }