public function index($request, $response) {/*{{{*/ $this->initialize($request, $response); $response->topTitle = $this->disease->name; $response->needZepto = 1; //筛选列表 $allArea = Area::provInfo(); unset($allArea['q']);//不要“其它”省 $response->provinceList = $allArea; $diseaseId = $this->diseaseParent->id; if ($this->disease->isTopLevel || $this->disease->isVoteSelf) { $diseaseId = $this->disease->id; } $this->getDoctorCounts($request, $response); $from = $request->getRequest('from', ''); $response->from = $from; if ($request->condition == 'thread' && $from == 'diseaselist' && $response->openCaseOrPhoneCount == 0) { $response->setRedirect($response->router->urlfor('disease/index', array('key'=>$this->disease->key))); return; } $this->loadMoreDoctor($request, $response); $response->title = $this->disease->name.'专家_好大夫在线'; }/*}}}*/
public static function echoChangeCity() { return false; if (isset($_COOKIE['b']['switch'])) { return $_COOKIE['b']['switch']; } else { $usercity = Area::getIpCity(); $province = Area::getProvinceByCity($usercity); $province = Area::getProvKeyByName($province); $province_all = Area::provInfo(); return isset($province_all[$province]['Triage']) && $province_all[$province]['Triage'] ? true : false; } }
private function initialize($request, $response) {/*{{{*/ $key = $this->key = $request->key; $response->urlDiseaseKey = $request->key; $this->nowPage = $request->getRequest('p', 1); if (empty($key)) { $this->_exit404(); } $this->province = $request->province; $allArea = Area::provInfo(); unset($allArea['q']);//不要“其它”省份 $this->provinceList = $allArea; if (isset($this->provinceList[$this->province])){ $this->provinceName = $this->provinceList[$this->province]['Province']; } $this->disease = DiseaseClient::getInstance()->getByDiseaseKey($key); if($this->disease == null || $this->disease->isNull()){ $this->_exit404(); } $this->diseaseParent = new NullEntity(); if(empty($this->disease->parentKey) == false){ $this->diseaseParent = DiseaseClient::getInstance()->getByDiseaseKey($this->disease->parentKey); } $this->modules = $this->getModule($key); $diseasePage = DiseasePage::getByDiseaseId($this->disease->id); $res = $diseasePage->getPaperAndZhuantiList4ZhuantiPage($page=0, $pageSize=10, $options=array('queryType' => self::ZHUANTI_QUERYTYPE_LABLE, 'diseaseId' => $this->disease->id)); $response->id2Types = $res['id2Types']; $response->key = $this->key; $response->province = $this->province; $response->provinceList = $this->provinceList; $response->modules = $this->modules; $response->disease = $this->disease; $response->diseaseName = $this->disease->name; $response->isecho = HdfCookie::echoChangeCity(); }/*}}}*/
public function index($request, $response) {/*{{{*/ $this->init($request, $response); $provInfo = Area::provInfo(); unset($provInfo['q']); $diseaseLableInfo = $this->doDetail4LableList(); $diseaseDoctorList = DiseaseClient::getInstance() ->getDieaseDoctor($this->disease->id, array(), self::INDEX_DOCTOR_NUM, array()); $diseaseHospitalInfo = DiseaseClient::getInstance() ->getDiseaseHospitalByDisease($this->disease->id, array('limit'=>self::INDEX_HOSPITAL_NUM)); $response->disease = $this->disease; $response->selection = 'all'; $response->areaList = $provInfo; $response->doctorList = $this->prepareDoctorInfo($diseaseDoctorList); $response->diseaseKey = ($this->disease->isTopLevel) ? $this->disease->key : $this->disease->parentKey; $response->diseaseIntro = $this->disease->getDiseaseIntro(); $response->diseaseLableList = $diseaseLableInfo; $response->relatedDiseaseList = $this->disease->getRelatedDiseaseList(); $response->diseaseHospitalList = $diseaseHospitalInfo['diseaseHospitalList']; }/*}}}*/
public function getData($nowPage, $pageSize) {/*{{{*/ $option['topLevel'] = 1; $diseases = DiseaseClient::getInstance()->getDiseaseByOption($option, $nowPage, $pageSize); $provinceList = Area::provInfo(); unset($provinceList['q']);//不要“其它”省份 $doctors = array(); foreach($diseases as $diseaseKey => $disease) { $res = $diseaseNames = array(); $diseaseNames = $this->getAllNames($disease->thesaurus, $disease->name); foreach($provinceList as $provinceKey => $province) { $doctorList = $this->getDoctorInfo($disease, $province['Province']); if (false == empty($doctorList)) { foreach ($diseaseNames as $diseaseNameKey => $diseaseName) { $res = array(); $res['key'] = $diseaseName; $res['province'] = $province['Province']; $res['provincemoreurl'] = 'http://www.haodf.com/jibing/'.$disease->key.'/daifu.htm?province='. Area::getProvKeyByName($province['Province']); $res['showurl'] = 'www.haodf.com/'; $res = array_merge($res, $doctorList); $doctors[] = array('item' => $res); unset($diseaseNames[$diseaseNameKey]); } } unset($provinceList[$provinceKey]); } unset($diseases[$diseaseKey]); BeanFinder::get('LocalCache')->removeAll(); } return $doctors; }/*}}}*/
public function recommendfaculty($request, $response) { /*{{{*/ $response->patientClassfy = array_keys(IntentionRecord::$recommendFacultyDesc); $response->symptonClassfy = array_keys(current(IntentionRecord::$recommendFacultyDesc)); $response->facultyClassfy = current(current(IntentionRecord::$recommendFacultyDesc)); $provInfo = array_merge(Area::provInfo(), Area::provInfoAppend()); unset($provInfo['q']); $city = Area::cityInfo(); $hospitalList = HospitalClient::getInstance()->getHospitalByProvinceAndCity(current($provInfo)['Name'], current(current($city)['Cities'])['Name']); $questionSheet = DAL::get()->find_by_title('QuestionSheet', IntentionRecord::QUESTIONSHEET_TITLE); $response->questionSheet = $questionSheet; $response->questions = $questionSheet->getQuestions(); $response->provInfo = $provInfo; $response->city = $city; $response->hospitalList = $hospitalList; }
public function ajaxgetcitybyip($request, $response) {/*{{{*/ $callback = $request->callback; $usercity = $request->city; if(true == empty($usercity)){ $usercity = Area::getIpCity(); } $usercity = mb_convert_encoding(($usercity),'GBK','auto'); $province = Area::getProvinceByCity($usercity); $province = Area::getProvKeyByName($province); $province_all = Area::provInfo(); $py = (isset($province_all[$province]['Triage'])&&$province_all[$province]['Triage'])?$province:""; $usercity = mb_convert_encoding(($usercity),'utf8','auto'); $response->callback = $request->callback?$request->callback:''; $response->usercity = $usercity; $response->province = $province; $response->py = $py; }/*}}}*/
public function threadCategoryMessageTplShowAdd($request, $response) { $id = (int) $request->id; $messageTpl = null; if (empty($id) == false) { $messageTpl = DAL::get()->find('ThreadCategoryMessageTpl', $id); } $area = new Area(); $response->provInfo = $area->provInfo(); $response->messageTpl = $messageTpl; $response->provinceList = $messageTpl != null ? explode(',', $messageTpl->province) : array(); }
public function hospitalList($request, $response) {/*{{{*/ $nowPage = $request->getRequest('p',1); $pageSize = 6; $prov = $request->prov; $city = $request->getRequest('city',''); $cityName = Area::getNameByEnglishName($prov, $city, $city); $provInfo = array_merge(Area::provInfo(), Area::provInfoAppend()); $proName = $provInfo[$prov]['Province']; $cities = HospitalClient::getInstance()->getHospitalCityList($proName); $options = array(); $options['city'] = $cityName; $options['prov'] = $proName; $options['isActivated'] = true; $options['noTestData'] = true; $options['orderBy'] = ' fld_HospitalDoctorCount desc '; $res = HospitalClient::getInstance()->getList($nowPage, $pageSize, $options); $response->total = $res['pageInfo']['total']; if (false == empty($city)) { $pageLink = PageNav::getNavLink(PageNav::getBaiduappPageNavTemplate("/baiduapp/hospital/".$prov."/".$city."/list.htm?p=", 1, 5, 1, true, false, false, ''),$res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']); } else { $pageLink = PageNav::getNavLink(PageNav::getBaiduappPageNavTemplate("/baiduapp/hospital/".$prov."/list.htm?p=", 1, 5, 1, true, false, false, ''),$res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']); } $hospitalList = $res['list']; $hospitalIds = array_keys($hospitalList); if(empty($hospitalIds) == false) { $openBookingCount = HospitalClient::getInstance()->getHospitalPlussignCount($hospitalIds); $response->openBookingCount = $openBookingCount; } $response->proName = $proName; $response->cities = $cities; $response->hospitalList = $hospitalList; $response->prov = $prov; $response->city = $city; $response->pageLink = $pageLink; }/*}}}*/
public function schedule($request, $response) {/*{{{*/ $this->initialize($request, $response); $p = $request->getRequest('p', 1); $hf_name = $this->hospitalFaculty->hospital->commonName . $this->hospitalFaculty->name; $title = $hf_name."专家_".$hf_name."专家门诊时间_好大夫在线"; $keywords = $hf_name."专家,".$hf_name."门诊时间,".$hf_name."门诊表"; $descString = $hf_name.$this->hospitalFaculty->doctorCount."位专家,".$hf_name."专家门诊时间,免费咨询" .$hf_name."在线专家,免费预约".$hf_name."专家门诊。"; $res = HospitalClient::getInstance()->getHospitalAnnounces($this->hospitalFaculty->hospital->id, 1); $hospitalAnnouce = new NullEntity(); if(empty($res) == false){ $hospitalAnnouce = array_shift($res); } if($hospitalAnnouce->isNull() == false && in_array($this->hospitalFaculty->id, $this->dailyUpdateHospitalIds)) $descString .= ',于' . date('m月d日更新', $hospitalAnnouce->utime->getTime()); // get doctor list $this->getDoctorList($request, $response); $this->getSidePhoneServiceListByHF($this->hospitalFaculty, $response, 10); //同地区同科室推荐医院 $hospitalFacultyList = DoctorClient::getInstance()->getHospitalFacultyListByAreaFaculty($this->hospitalFaculty, 6); $response->provinceList = Area::provInfo(); $response->commendHospitalFacultyList = $hospitalFacultyList['list']; $response->commendHospitalFacultyCnt = $hospitalFacultyList['cnt']; $response->title = $title; $response->keywords = $keywords; $response->pageModule = 'schedule'; $response->currentSite = '专家列表/门诊时间'; $response->descString = $descString; $response->p = $p; $response->spaceList = SpaceClient::getInstance()->getListByHostIdsAndTypeWithDoctorIndex($response->doctorList); }/*}}}*/
public function hospitalList($request, $response) {/*{{{*/ $provInfo = array_merge(Area::provInfo(), Area::provInfoAppend()); $provinceKey = $request->getRequest('provinceKey', self::ALL_PROVINCE_KEY); $provinceName = $provInfo[$provinceKey]['Name']; $cityKey = $request->getRequest('cityKey', self::ALL_CITY_KEY); $cityName = Area::getNameByEnglishName($provinceKey, $cityKey, ''); $hospitalList = HospitalClient::getInstance()->getHospitalByProvinceAndCity($provinceName, $cityName); $hospitalInfos = HospitalClient::getInstance()->groupHospitalByCategory($hospitalList); $featuredFaculty = $request->getRequest('featuredFaculty', ''); foreach ($hospitalInfos as $key => $hospitalInfo) { if ($featuredFaculty && $featuredFaculty != $key) { unset($hospitalInfos[$key]); } } $response->featuredFaculty = $featuredFaculty; $response->provinceKey = $provinceKey; $response->provinceName = $provinceName; $response->cityName = ($cityName)?$cityName:'全部'; $response->cityKey = $cityKey; $response->hospitalInfos = $hospitalInfos; $response->title = $provinceName.$cityName."地区医院_好大夫在线"; }/*}}}*/
public function index($request, $response) {/*{{{*/ if (empty($_SERVER['HTTP_HOST'])) { $provs = 'beijing'; } else { $tmps = explode('.', $_SERVER['HTTP_HOST']); array_pop($tmps); //com array_pop($tmps); //haodf $provs = array_pop($tmps); } $provs = ($provs == 'sh') ? 'shanghai' : $provs; $provs = ($provs == 'gz') ? 'guangdong' : $provs; $areaName = ''; $area = new Area(); $provinceInfo = $area->provInfo(); if (empty($provinceInfo[$provs])){ header("HTTP/1.1 301 Moved Permanently"); header('Location: http://www.haodf.com'); exit; } else { $areaName = $provinceInfo[$provs]['Name']; } //最新回复咨询 $threads = FlowClient::getInstance()->getZixunListOfProvince($areaName, 20); $response->threads = $threads; $provs = explode(',', $provs); $provCount = count($provs); foreach ($provs as $item) { $provinceList[] = @$provinceInfo[$item]['Province']; } //以下一行代码不能动 $provinceList = explode(',', implode(',', $provinceList)); $hospitalList = HospitalClient::getInstance()->getListByProvinceAry($provinceList); $areaList1 = array(); $areaList2 = array(); foreach ($provinceList as $province) { foreach ($hospitalList as $hospital) { if (in_array($hospital->province, $provinceList)) { if ($hospital->province == $province) { if ($hospital->city == $hospital->province && '吉林' != $hospital->province) { if ($provCount > 1 && @count($areaList1[$hospital->province][$hospital->district]) >= COUNT_LIMIT) { continue; } $areaList1[$hospital->province][$hospital->district][] = $hospital; } else { if ($provCount > 1 && @count($areaList1[$hospital->province][$hospital->city]) >= COUNT_LIMIT) { continue; } $areaList1[$hospital->province][$hospital->city][] = $hospital; } } } else { if ($hospital->city == $hospital->province) { if ($provCount > 1 && @count($areaList2[$hospital->province][$hospital->district]) >= COUNT_LIMIT) { continue; } $areaList2[$hospital->province][$hospital->district][] = $hospital; } else { if ($provCount > 1 && @count($areaList2[$hospital->province][$hospital->city]) >= COUNT_LIMIT) { continue; } $areaList2[$hospital->province][$hospital->city][] = $hospital; } } } } $areaList = array_merge($areaList1, $areaList2); unset($areaList1); unset($areaList2); $count = 0; foreach ($areaList as $k => $p) { uasort($areaList[$k], 'ProvinceController::sort_hospital'); $count += 3; foreach ($p as $j => $city) { $count += floor((count($city) + 2) / 3) + 1; usort($areaList[$k][$j], 'ProvinceController::sort_hospital2'); } } $response->areaList = $areaList; $response->announceList = HospitalClient::getInstance()->getAnnounceList4Province($provinceList, 3); $options['commentType'] = DoctorComment::COMMENT_TYPE_PROCESS; $options['prov'] = $provinceList; $pageInfo['pageSize'] = 4; $commentList = DoctorCommentClient::getInstance()->getCommentList($options, $pageInfo); $response->commentList = $commentList['commentList']; $option = array(); $option['province'] = $provinceList; $option['limit'] = 5; $option['postcount'] = 0; //2周内最小回复数 $rightSpaceList = SpaceClient::getInstance()->getCaseOpenedSpaceList($option); $rightSpaceList = $rightSpaceList['spaceList']; $response->rightSpaceList = $rightSpaceList; //两周内回复数 $spacePostCntInfos = $this->getspacePostCntInfo($rightSpaceList); $response->spacePostCntInfos = $spacePostCntInfos; $response->title = $areaName.'站_好大夫在线'; $response->keywords = "{$areaName}好大夫,{$areaName}医院,.{$areaName}医生,{$areaName}看病,{$areaName}就医,{$areaName}医院, {$areaName}好大夫在线,分享{$areaName}看病好经验,推荐{$areaName}心中好大夫"; $response->description = "提供{$areaName}医院最新的门诊信息查询。汇总患者就医经验,帮您选择合适的医院、大夫。 为大夫提供网站服务:更新个人信息,发布专业文章,引导目标患者,跟踪目标患者。"; $response->areaName = $areaName; $response->randomFlows = FlowClient::getInstance()->getFlowList4SEO($num = 20, $provs); }/*}}}*/
private function dataForCitySwitch() {/*{{{*/ $recommendArea = Area::provInfo(); unset($recommendArea['q']); return array('provincePinyin'=>'', 'provinceName'=>'', 'recommendCities'=>array(), 'recommendArea'=>array(), 'recommendProvince'=>$recommendArea, 'filteredProvince'=>array()); }/*}}}*/