public function indexAction() { $str = 'welcom to hqimt'; $out['errno'] = '0'; $out['wel'] = $str; Yy_Utils::jsonOut($out); }
public function orderAction() { $id = $this->_getParam('id'); if ($this->_auth->userid && $this->_auth->role) { $card = Application_Model_M_MemberCard::find($id); if ($card) { $orderid = Application_Model_M_MemberCardOrder::getOrderID($this->_auth->userid, $this->_auth->role); $total_price = $card->getDprice(); $payment_status = 0; $cardOrder = new Application_Model_O_MemberCardOrder(); $cardOrder->setOrder_id($orderid)->setUid($this->_auth->userid)->setUrole($this->_auth->role)->setMember_card_id($id)->setTotal_price($total_price)->setPayment_status($payment_status)->setCtime(date('Y-m-d H:i:s')); try { $out['errno'] = '0'; $mer_front_end_url = ""; $deadtime = 0; $notify_url = "http://" . $_SERVER['HTTP_HOST'] . "/card/notify"; $tn = Yy_Upmp_Upmp::getUpmpTn($orderid, $id, $total_price, $mer_front_end_url, $deadtime, $notify_url); $cardOrder->setRemark($tn); $cardOrder->save(); $out['tn'] = $tn; } catch (Zend_Db_Exception $e) { $out['errno'] = '255'; } } else { $out['errno'] = '1'; } } else { $out['errno'] = '200'; } $out['msg'] = Yy_ErrMsg_Card::getMsg('order', $out['errno']); Yy_Utils::jsonOut($out); }
public function orderdelAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $id = $this->_getParam('id'); try { Application_Model_M_ConsultOrder::delById($id); $out['errno'] = "0"; } catch (Zend_Db_Exception $e) { $out['errno'] = "1"; } Yy_Utils::jsonOut($out); }
public function changepasswdAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $account = $this->_getParam('account'); $passwd = $this->_getParam('passwd'); $status = Application_Model_M_Admin::changePasswdByAccount($account, $passwd); if ($status) { $out['errno'] = '0'; } else { $out['errno'] = '1'; } Yy_Utils::jsonOut($out); }
public function indexAction() { $data = Application_Model_M_Banner::fetchByStatus(1); if (count($data) > 0) { $out['errno'] = '0'; $records = array(); foreach ($data as $k => $Application_Model_O_Banner) { $record = array('img' => '/banner/image?id=' . $Application_Model_O_Banner->getId(), 'title' => $Application_Model_O_Banner->getTitle(), 'content' => $Application_Model_O_Banner->getContent(), 'link' => $Application_Model_O_Banner->getLink()); $records[] = $record; } $out['banner'] = $records; } else { $out['errno'] = '1'; } $out['msg'] = Yy_ErrMsg_Banner::getMsg('index', $out['errno']); Yy_Utils::jsonOut($out); }
public function departmentAction() { $id = $this->_getParam('id'); $departments = Application_Model_M_ConsultationDepartments::fetchByCID($id); if (count($departments) > 0) { $out['errno'] = '0'; $results = array(); foreach ($departments as $department) { $result = array('id' => $department->getId(), 'name' => $department->getName()); array_push($results, $result); } $out['departments'] = $results; } else { $out['errno'] = '1'; } $out['msg'] = Yy_ErrMsg_Department::getMsg('department', $out['errno']); Yy_Utils::jsonOut($out); }
public static function fetchConsultDoctorsByUserIDRole($id, $role) { if (!is_numeric($id) || !is_numeric($role)) { return array(); } $sql = "SELECT DISTINCT to_user,to_role FROM yy_consult_dialog WHERE from_user={$id} AND from_role={$role} AND to_role=2 AND status=1"; $data = self::getDb()->query($sql)->fetchAll(); $results = array(); if (count($data) > 0) { foreach ($data as $da) { $result = array('id' => $da['to_user']); $na = Yy_Utils::getNameAvatar($da['to_user'], 2); $result['name'] = $na['name']; $result['avatar'] = $na['avatar']; array_push($results, $result); } } return $results; }
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>"; } } }
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); }
public function dhistoryAction() { $id = $this->_getParam('id'); //userid $role = $this->_getParam('role'); //get from doctorAction if ($this->_auth->userid && $this->_auth->role == 2) { $una = Yy_Utils::getNameAvatar($id, $role); $out['uid'] = $id; $out['uname'] = $una['name']; $out['uavatar'] = $una['avatar']; $dna = Yy_Utils::getNameAvatar($this->_auth->userid, 2); $out['did'] = $this->_auth->userid; $out['dname'] = $dna['name']; $out['davatar'] = $dna['avatar']; $historys = Application_Model_M_ConsultDialog::fetchHistoryByUserIdRoleAndDoctorId($id, $role, $this->_auth->userid); if (count($historys) > 0) { $historys = array_reverse($historys); $out['errno'] = '0'; $results = array(); foreach ($historys as $history) { $result = array('id' => $history->getFrom_user(), 'msg' => $history->getMessage(), 'time' => $history->getCtime()); array_push($results, $result); } $out['historys'] = $results; } else { $out['errno'] = '1'; } } else { $out['errno'] = '200'; } $out['msg'] = Yy_ErrMsg_Consult::getMsg('dhistory', $out['errno']); Yy_Utils::jsonOut($out); }
public function travelAction() { $id = $this->_getParam('id'); //destination_id $travelMaps = Application_Model_M_DestinationTravelMap::fetchByDestinationID($id); if (count($travelMaps) > 0) { $travels = array(); foreach ($travelMaps as $travelMap) { $travelID = $travelMap->getTravel_id(); $travel = Application_Model_M_Travel::find($travelID); if ($travel && $travel->getStatus() == 1) { $result = array('id' => $travel->getId(), 'title' => $travel->getTitle(), 'subtitle' => $travel->getSubtitle(), 'img' => Application_Model_M_Travel::getImageUrl($travel->getId()), 'adult_oprice' => $travel->getAdult_oprice(), 'adult_dprice' => $travel->getAdult_dprice(), 'child_oprice' => $travel->getChild_oprice(), 'child_dprice' => $travel->getChild_dprice(), 'area' => $travel->getArea(), 'sales' => $travel->getSales()); array_push($travels, $result); } } if (count($travels) > 0) { $out['errno'] = '0'; $out['travels'] = $travels; } else { $out['errno'] = '1'; } } else { $out['errno'] = '1'; } $out['msg'] = Yy_ErrMsg_Destination::getMsg('travel', $out['errno']); Yy_Utils::jsonOut($out); }
public function articleAction() { $type = $this->_getParam('type', 1); //类型:1帮助中心,2法律问题,3关于我们 $data = Application_Model_M_Article::fetchByType(1); if (count($data) > 0) { $out['errno'] = '0'; $records = array(); foreach ($data as $k => $Application_Model_O_Article) { $record = array('title' => $Application_Model_O_Article->getTitle(), 'content' => $Application_Model_O_Article->getContent(), 'img' => Application_Model_M_Article::getImageUrl($Application_Model_O_Article->getId())); $records[] = $record; } $out['article'] = $records; } else { $out['errno'] = '1'; $out['msg'] = Yy_ErrMsg_More::getMsg('article', $out['errno']); } Yy_Utils::jsonOut($out); }
public function traveladdajaxAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $did = $this->_getParam('did'); $tid = $this->_getParam('tid'); $map = new Application_Model_O_DepartmentsTravelMap(); if ($did && $tid) { $map->setDepartment_id($did)->setTravel_id($tid)->setCtime(date('Y-m-d H:i:s')); } try { $out['errno'] = "0"; $map->save(); } catch (Zend_Db_Exception $e) { $out['errno'] = "1"; } 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 pointAction() { if ($this->_auth->userid && $this->_auth->role == 1) { $nuser = Application_Model_M_Nuser::find($this->_auth->userid); if ($nuser) { $out['errno'] = '0'; $out['point'] = $nuser->getPoint(); } else { $out['errno'] = '1'; } } else { $out['errno'] = '200'; } $out['msg'] = Yy_ErrMsg_User::getMsg('point', $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(); // 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 asyncajaxAction() { $this->getResponse()->setHeader('Content-Type', 'application/json'); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $params = $this->_getAllParams(); $article = new Application_Model_O_Article(); $validate = new Yy_Validate_Value(); if ($validate->isValid($params['id'])) { $article->setId($params['id']); } else { $article->setCtime(date('Y-m-d H:i:s')); } if ($validate->isValid($params['title'])) { $article->setTitle($params['title']); } if ($validate->isValid($params['content'])) { $article->setContent($params['content']); } if ($validate->isValid($params['sort'])) { $article->setSort($params['sort']); } if ($validate->isValid($params['type'])) { $article->setType($params['type']); } if ($validate->isValid($params['status'])) { $article->setStatus($params['status']); } try { $article->save(); $id = $article->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_Article::updateImage($id, $img); } $url = '/article/view?id=' . $id; $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(); //$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 infoAction() { $id = $this->_getParam('id'); $doctor = Application_Model_M_Doctor::find($id); if ($doctor && $doctor->getStatus() == 1) { $out['errno'] = '0'; $out['id'] = $doctor->getId(); $out['name'] = $doctor->getName(); $out['avatar'] = Application_Model_M_Doctor::getAvatarUrl($doctor->getId()); $out['sex'] = $doctor->getSex(); $out['birthday'] = $doctor->getBirthday(); //$out['phone'] = $doctor->getPhone(); $out['department'] = $doctor->getDepartment(); $out['city'] = $doctor->getCity(); $out['certified'] = $doctor->getCertified(); $out['special'] = $doctor->getSpecial(); $out['country'] = $doctor->getCountry(); $out['introduction'] = $doctor->getIntroduction(); $out['hospital'] = $doctor->getHospital(); $out['area'] = $doctor->getArea(); $out['qualification'] = $doctor->getQualification(); $out['reservation_fee'] = $doctor->getReservation_fee(); $out['reservation_number'] = $doctor->getReservation_number(); } else { $out['errno'] = '1'; } $out['msg'] = Yy_ErrMsg_Doctor::getMsg('info', $out['errno']); Yy_Utils::jsonOut($out); }