public function introasyncajaxAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $params = $this->_getAllParams(); $intro = new Application_Model_O_GlobalConsultation(); $validate = new Yy_Validate_Value(); if ($validate->isValid($params['id'])) { $intro->setId($params['id']); } else { $intro->setCtime(date('Y-m-d H:i:s')); } if ($validate->isValid($params['title'])) { $intro->setTitle($params['title']); } if ($validate->isValid($params['content'])) { $intro->setContent($params['content']); } if ($validate->isValid($params['sort'])) { $intro->setSort($params['sort']); } if ($validate->isValid($params['status'])) { $intro->setStatus($params['status']); } try { $intro->save(); $id = $intro->getId(); $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'); $img = addslashes(fread($handle, filesize($filename))); fclose($handle); Application_Model_M_GlobalConsultation::updateImage($id, $img); } $url = '/diagnosis/introview?id=' . $id; $this->redirect($url); } catch (Zend_Db_Exception $e) { //$this->redirect('/error'); $this->redirect('/error?message=' . $e->getMessage()); } }
public function updateAction() { $mobile = $this->_getParam('mobile'); $email = $this->_getParam('email'); $phone = $this->_getParam('phone'); $passwd = $this->_getParam('passwd'); $name = $this->_getParam('name'); $avatar = $this->_getParam('avatar'); $sex = $this->_getParam('sex'); $job = $this->_getParam('job'); $postcode = $this->_getParam('postcode'); $idcard = $this->_getParam('idcard'); $country = $this->_getParam('country'); $address = $this->_getParam('address'); $birthday = $this->_getParam('birthday'); $auth = new Zend_Session_Namespace('auth'); if ($this->_auth->userid && $this->_auth->role == 1) { $nuser = Application_Model_M_Nuser::find($this->_auth->userid); if ($nuser) { if (!$nuser->getMobile()) { $validatorMobile = new Yy_Validate_Mobile(); if ($validatorMobile->isValid($mobile)) { $bool = Application_Model_M_Nuser::fetchByMobile($mobile); if (!$bool) { $nuser->setMobile($mobile); } else { //将更新的手机号已经被注册 $out['errno'] = '2'; $out['msg'] = Yy_ErrMsg_User::getMsg('update', $out['errno']); Yy_Utils::jsonOut($out); return; } } } if (!$nuser->getEmail()) { $validatorEmail = new Zend_Validate_EmailAddress(); if ($validatorEmail->isValid($email)) { $bool = Application_Model_M_Nuser::fetchByEmail($email); if (!$bool) { $nuser->setEmail($email); } else { //将更新的邮箱已经被别人注册 $out['errno'] = '3'; $out['msg'] = Yy_ErrMsg_User::getMsg('update', $out['errno']); Yy_Utils::jsonOut($out); return; } } } if ($phone) { $nuser->setPhone($phone); } if ($passwd) { $nuser->setPasswd(md5($passwd)); } if ($name) { $nuser->setName($name); } // if($avatar){ // $nuser->setAvatar($avatar); // } if ($sex) { $nuser->setSex($sex); } if ($job) { $nuser->setJob($job); } if ($postcode) { $nuser->setPostcode($postcode); } if ($idcard) { $nuser->setIdcard($idcard); } if ($country) { $nuser->setCountry($country); } if ($address) { $nuser->setAddress($address); } if ($birthday) { $nuser->setBirthday($birthday); } try { $out['errno'] = '0'; $nuser->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'); $avatar = addslashes(fread($handle, filesize($filename))); fclose($handle); Application_Model_M_Nuser::updateAvatar($nuser->getId(), $avatar); } } catch (Zend_Db_Exception $e) { $out['errno'] = '1'; } } else { $out['errno'] = '1'; } } else { $out['errno'] = '200'; } $out['msg'] = Yy_ErrMsg_User::getMsg('update', $out['errno']); Yy_Utils::jsonOut($out); }
public function asyncajaxAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $params = $this->_getAllParams(); $hospital = new Application_Model_O_Hospital(); $validate = new Yy_Validate_Value(); if ($validate->isValid($params['id'])) { $hospital->setId($params['id']); } else { $hospital->setCtime(date('Y-m-d H:i:s')); } if ($validate->isValid($params['name'])) { $hospital->setName($params['name']); } if ($validate->isValid($params['email'])) { $hospital->setEmail($params['email']); } if ($validate->isValid($params['departments'])) { $hospital->setDepartments($params['departments']); } if ($validate->isValid($params['passwd'])) { $hospital->setPasswd(md5($params['passwd'])); } if ($validate->isValid($params['type'])) { $hospital->setType($params['type']); } if ($validate->isValid($params['certified'])) { $hospital->setCertified($params['certified']); } if ($validate->isValid($params['city'])) { $hospital->setCity($params['city']); } if ($validate->isValid($params['label'])) { $hospital->setLabel($params['label']); } if ($validate->isValid($params['country'])) { $hospital->setCountry($params['country']); } if ($validate->isValid($params['point'])) { $hospital->setPoint($params['point']); } if ($validate->isValid($params['area'])) { $hospital->setArea($params['area']); } if ($validate->isValid($params['introduction'])) { $hospital->setIntroduction($params['introduction']); } if ($validate->isValid($params['longitude'])) { $hospital->setLongitude($params['longitude']); } if ($validate->isValid($params['latitude'])) { $hospital->setLatitude($params['latitude']); } if ($validate->isValid($params['status'])) { $hospital->setStatus($params['status']); } try { $hospital->save(); $id = $hospital->getId(); //保存医院头像 $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'); $avatar = addslashes(fread($handle, filesize($filename))); fclose($handle); Application_Model_M_Hospital::updateAvatar($id, $avatar); } $url = '/hospital/view?id=' . $id . '&from=update'; $this->redirect($url); } catch (Zend_Db_Exception $e) { //$this->redirect('/error'); $this->redirect('/error?message=' . $e->getMessage()); } }
public function updateajaxAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $params = $this->_getAllParams(); // unset($params['controller']); // unset($params['action']); // unset($params['module']); //$id = $params['id']; $doctor = new Application_Model_O_Doctor(); $validate = new Yy_Validate_Value(); if ($validate->isValid($params['id'])) { $doctor->setId($params['id']); } else { $doctor->setCtime(date('Y-m-d H:i:s')); } if ($validate->isValid($params['name'])) { $doctor->setName($params['name']); } if ($validate->isValid($params['sex'])) { $doctor->setSex($params['sex']); } if ($validate->isValid($params['birthday'])) { $doctor->setBirthday($params['birthday']); } if ($validate->isValid($params['email'])) { $doctor->setEmail($params['email']); } if ($validate->isValid($params['passwd'])) { $doctor->setPasswd(md5($params['passwd'])); } if ($validate->isValid($params['department'])) { $doctor->setDepartment($params['department']); } if ($validate->isValid($params['point'])) { $doctor->setPoint($params['point']); } if ($validate->isValid($params['city'])) { $doctor->setCity($params['city']); } if ($validate->isValid($params['certified'])) { $doctor->setCertified($params['certified']); } if ($validate->isValid($params['special'])) { $doctor->setSpecial($params['special']); } if ($validate->isValid($params['country'])) { $doctor->setCountry($params['country']); } if ($validate->isValid($params['introduction'])) { $doctor->setIntroduction($params['introduction']); } if ($validate->isValid($params['hospital'])) { $doctor->setHospital($params['hospital']); } if ($validate->isValid($params['area'])) { $doctor->setArea($params['area']); } if ($validate->isValid($params['qualification'])) { $doctor->setQualification($params['qualification']); } if ($validate->isValid($params['reservation_fee'])) { $doctor->setReservation_fee($params['reservation_fee']); } if ($validate->isValid($params['reservation_number'])) { $doctor->setReservation_number($params['reservation_number']); } if ($validate->isValid($params['status'])) { $doctor->setStatus($params['status']); } try { $doctor->save(); $id = $doctor->getId(); //保存医生头像 $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'); $avatar = addslashes(fread($handle, filesize($filename))); fclose($handle); Application_Model_M_Doctor::updateAvatar($id, $avatar); } $url = '/doctor/view?id=' . $id; $this->redirect($url); } catch (Zend_Db_Exception $e) { //$this->redirect('/error'); $this->redirect('/error?message=' . $e->getMessage()); } }
public function updateAction() { $name = $this->_getParam('name'); $avatar = $this->_getParam('avatar'); $departments = $this->_getParam('departments'); $type = $this->_getParam('type'); $city = $this->_getParam('city'); $label = $this->_getParam('label'); $country = $this->_getParam('country'); $area = $this->_getParam('area'); $passwd = $this->_getParam('passwd'); $phone = $this->_getParam('phone'); $introduction = $this->_getParam('introduction'); $longitude = $this->_getParam('longitude'); $latitude = $this->_getParam('latitude'); if ($this->_auth->userid && $this->_auth->role == 3) { $hospital = Application_Model_M_Hospital::find($this->_auth->userid); if ($hospital) { if ($name) { $hospital->setName($name); } // if($avatar){ // $hospital->setAvatar($avatar); // } if ($departments) { $hospital->setDepartments($departments); } if ($type) { $hospital->setType($type); } if ($city) { $hospital->setCity($city); } if ($label) { $hospital->setLabel($label); } if ($country) { $hospital->setCountry($country); } if ($area) { $hospital->setArea($area); } if ($passwd) { $hospital->setPasswd(md5($passwd)); } if ($phone) { $hospital->setPhone($phone); } if ($introduction) { $hospital->setIntroduction($introduction); } if ($longitude) { $hospital->setLongitude($longitude); } if ($latitude) { $hospital->setLatitude($latitude); } try { $out['errno'] = '0'; $hospital->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'); $avatar = addslashes(fread($handle, filesize($filename))); fclose($handle); Application_Model_M_Hospital::updateAvatar($hospital->getId(), $avatar); } } catch (Zend_Db_Exception $e) { $out['errno'] = '1'; } } else { $out['errno'] = '1'; } } else { $out['errno'] = '200'; } $out['msg'] = Yy_ErrMsg_Hospital::getMsg('update', $out['errno']); Yy_Utils::jsonOut($out); }
public function updateajaxAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $params = $this->_getAllParams(); //$id = $params['id']; //$nuser = Application_Model_M_Nuser::find($id); $nuser = new Application_Model_O_Nuser(); $validate = new Yy_Validate_Value(); if ($validate->isValid($params['id'])) { $nuser->setId($params['id']); } else { $nuser->setCtime(date('Y-m-d H:i:s')); } if ($validate->isValid($params['mobile'])) { $nuser->setMobile($params['mobile']); } if ($validate->isValid($params['email'])) { $nuser->setEmail($params['email']); } if ($validate->isValid($params['phone'])) { $nuser->setPhone($params['phone']); } if ($validate->isValid($params['passwd'])) { $nuser->setPasswd(md5($params['passwd'])); } if ($validate->isValid($params['name'])) { $nuser->setName($params['name']); } if ($validate->isValid($params['sex'])) { $nuser->setSex($params['sex']); } if ($validate->isValid($params['job'])) { $nuser->setJob($params['job']); } if ($validate->isValid($params['postcode'])) { $nuser->setPostcode($params['postcode']); } if ($validate->isValid($params['idcard'])) { $nuser->setIdcard($params['idcard']); } if ($validate->isValid($params['point'])) { $nuser->setPoint($params['point']); } if ($validate->isValid($params['country'])) { $nuser->setCountry($params['country']); } if ($validate->isValid($params['address'])) { $nuser->setAddress($params['address']); } if ($validate->isValid($params['birthday'])) { $nuser->setBirthday($params['birthday']); } if ($validate->isValid($params['status'])) { $nuser->setStatus($params['status']); } try { $nuser->save(); $id = $nuser->getId(); //保存用户头像 $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'); $avatar = addslashes(fread($handle, filesize($filename))); fclose($handle); Application_Model_M_Nuser::updateAvatar($id, $avatar); } $url = '/nuser/view?id=' . $id . '&from=update'; $this->redirect($url); } catch (Zend_Db_Exception $e) { //echo $e->getMessage();exit; $this->redirect('/error?message=' . $e->getMessage()); //$this->redirect('/error'); } }
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 updateAction() { $name = $this->_getParam('name'); $avatar = $this->_getParam('avatar'); $sex = $this->_getParam('sex'); $birthday = $this->_getParam('birthday'); $passwd = $this->_getParam('passwd'); $phone = $this->_getParam('phone'); $department = $this->_getParam('department'); $city = $this->_getParam('city'); $special = $this->_getParam('special'); $country = $this->_getParam('country'); $introduction = $this->_getParam('introduction'); $hospital = $this->_getParam('hospital'); $area = $this->_getParam('area'); $qualification = $this->_getParam('qualification'); if ($this->_auth->userid && $this->_auth->role == 2) { $doctor = Application_Model_M_Doctor::find($this->_auth->userid); if ($doctor) { if ($name) { $doctor->setName($name); } // if($avatar){ // //$doctor->setAvatar($avatar); // Application_Model_M_Doctor::updateAvatar($this->_auth->userid, addslashes($avatar)); // } if ($sex) { $doctor->setSex($sex); } if ($birthday) { $doctor->setBirthday($birthday); } if ($passwd) { $doctor->setPasswd(md5($passwd)); } if ($phone) { $doctor->setPhone($phone); } if ($department) { $doctor->setDepartment($department); } if ($city) { $doctor->setCity($city); } if ($special) { $doctor->setSpecial($special); } if ($country) { $doctor->setCountry($country); } if ($introduction) { $doctor->setIntroduction($introduction); } if ($hospital) { $doctor->setHospital($hospital); } if ($area) { $doctor->setArea($area); } if ($qualification) { $doctor->setQualification($qualification); } try { $out['errno'] = '0'; $doctor->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'); $avatar = addslashes(fread($handle, filesize($filename))); fclose($handle); Application_Model_M_Doctor::updateAvatar($doctor->getId(), $avatar); } } catch (Zend_Db_Exception $e) { $out['errno'] = '1'; } } else { $out['errno'] = '1'; } } else { $out['errno'] = '200'; } $out['msg'] = Yy_ErrMsg_Doctor::getMsg('update', $out['errno']); Yy_Utils::jsonOut($out); }
public function addiasyncajaxAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $params = $this->_getAllParams(); $hmsg = $this->_getParam('hmsg'); // echo "<pre>";var_dump($params);exit; $addi = new Application_Model_O_DepartmentsAdditional(); $validate = new Yy_Validate_Value(); if ($validate->isValid($params['id'])) { $addi->setId($params['id']); } else { $addi->setCtime(date('Y-m-d H:i:s')); } if ($validate->isValid($params['did'])) { $addi->setDepartment_id($params['did']); } if ($validate->isValid($params['title'])) { $addi->setTitle($params['title']); } if ($validate->isValid($params['content'])) { $addi->setContent($params['content']); } if ($validate->isValid($params['sort'])) { $addi->setSort($params['sort']); } if ($validate->isValid($params['type'])) { $addi->setType($params['type']); } if ($validate->isValid($params['status'])) { $addi->setStatus($params['status']); } try { $addi->save(); $id = $addi->getId(); //保存热门项目附件信息图片 $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'); $img = addslashes(fread($handle, filesize($filename))); fclose($handle); Application_Model_M_DepartmentsAdditional::updateImage($id, $img); } $url = '/costperf/addiview?id=' . $id . '&from=add&did=' . $params['did'] . '&hmsg=' . $hmsg; $this->redirect($url); } catch (Zend_Db_Exception $e) { $this->redirect('/error?message=' . $e->getMessage()); } }
public function importAction() { $adapter = new Zend_File_Transfer_Adapter_Http(); $wrdir = Yy_Utils::getWriteDir(); $adapter->setDestination($wrdir); if (!$adapter->receive()) { $messages = $adapter->getMessages(); //echo implode("\n", $messages); } //echo APPLICATION_PATH;exit; $filename = $adapter->getFileName(); if (is_string($filename)) { //上传文件后的处理 require_once APPLICATION_PATH . '/../library/Yy/Excel/PHPExcel/IOFactory.php'; if (PHP_OS == 'WINNT') { $filename = iconv('UTF-8', 'gb2312', $filename); } $inputFileType = PHPExcel_IOFactory::identify($filename); if (stristr($inputFileType, 'excel') || stristr($inputFileType, 'csv')) { $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($filename); $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); array_shift($sheetData); if (count($sheetData) > 0) { $destinations = array(); foreach ($sheetData as $record) { $destination = new Application_Model_O_Destination(); $destination->setCity($record['A']); if ($record['B'] == '国内') { $type = 1; } elseif ($record['B'] == '国外') { $type = 2; } else { continue; } $destination->setType($type); $destination->setLongitude($record['C'])->setLatitude($record['D'])->setSort($record['E']); if ($record['F'] == '正常') { $status = 1; } elseif ($record['F'] == '禁用') { $status = 0; } else { continue; } $destination->setStatus($status); try { $destination->setCtime(date('Y-m-d H:i:s')); $destination->save(); array_push($destinations, $destination); $this->view->destinations = $destinations; } catch (Zend_Db_Exception $e) { } } } } else { echo "<script type='text/javascript'>alert('请上传正确的文件类型')</script>"; } } }