示例#1
0
    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 hospitalList($request, $response)
    {/*{{{*/
        $prov = $request->getRequest('prov', 'all'); 
        $city = $request->getRequest('city', '');
        $mprov = isset($_COOKIE['b']['mprov'])?$_COOKIE['b']['mprov']:'';
        if($prov == 'all')
        {
            if($mprov)
            {
                $prov = $mprov;
            } else {
                $prov = 'beijing';
            }
        }

        $response->triage = $request->triage;
        $provInfo = array_merge(Area::provInfo(), Area::provInfoAppend());
        unset($provInfo['q']);

        //如果取得的城市是英文拼音,则寻找它的中文名称
        $city = Area::getNameByEnglishName($prov, $city, $city);
        $level = $request->getRequest('level', '');
        $hospitalLevel = array(6=>'三甲', 5=>'三级', 4=>'二甲', 3=>'二级', 2=>'一甲', 1=>'一级');

        $hospitalConfig = array();
        $hotHospitalIds = isset($hospitalConfig[$prov]) ? $hospitalConfig[$prov] : '';

        $citys = array();
        $proName = $provInfo[$prov]['Province'] ? $provInfo[$prov]['Province'] : '北京';
        $citys = HospitalClient::getInstance()->getHospitalCityList($proName);

        $provinceAry = $provInfo[$prov]['Province'];
        $provinceAry = (is_array($provinceAry) == false) ? array($provinceAry) : $provinceAry;
        $options = array();
        $options['city'] = $city;
        $options['level'] = $level;
        $hospitalList = HospitalClient::getInstance()->getListByProvinceAry($provinceAry, $options);
        $newHospitalList = array();
        foreach($hospitalList as $hospital)
        {
            if ($hospital->city == $hospital->province && '吉林' != $hospital->city)
                $newHospitalList[$hospital->province][$hospital->district][] = $hospital;
            else
                $newHospitalList[$hospital->province][$hospital->city][] = $hospital;
        }
        $hospitalList = &$newHospitalList;
        unset($newHospitalList);
        foreach ($hospitalList as $k => $province)
        {
            uasort($hospitalList[$k], 'sort_hospital');
        }

        $hotSearchWords = array(
            "上海华山医院","北京肿瘤医院","北京协和医院","上海瑞金医院","华西医院","浙二医院","广东省人民医院","北京同仁医院","上海红房子医院","南京军区总医院"
        );
        //随机选取搜索词
        $searchWords = array();
        $searchWordsLength = 0;
        $searchWordsLengthMax = 56;
        while ($searchWordsLength < $searchWordsLengthMax)
        {
            $randWord = $hotSearchWords[rand(0, count($hotSearchWords) - 1)];
            if (!in_array($randWord, $searchWords))
            {
                $searchWords[] = $randWord;
                $searchWordsLength += strlen($randWord);
            }
        }
        unset($hotSearchWords, $searchWordsLength, $searchWordsLengthMax, $randWord);

        //取地区域名
        $titleLevel = '';
        if ($level)
        {
            $titleLevel = $hospitalLevel[$level].'医院_';
        }
        $titleArea = $provInfo[$prov]['Name'];
        if ($city)
        {
            $titleArea .= '_'.$city;
        }

        $modifiedTriageCity = isset($_COOKIE['b']['mcity'])? $_COOKIE['b']['mcity']:'';
        $modifiedTriageCity = mb_convert_encoding($modifiedTriageCity, 'gbk', 'auto');
        $triageProvince = Area::getProvinceByCity($modifiedTriageCity);
        $triageProvinceName = Area::getProvKeyByName($triageProvince);

        $response->triageProvince = $triageProvinceName;
        $response->title_level = $titleLevel;
        $response->title_area = $titleArea;
        $response->citys = $citys;
        $response->distinct = $city;
        $response->level = $level;
        $response->hospitalLevel = $hospitalLevel;
        $response->hotHospitalIds = $hotHospitalIds;

        $response->prov = $prov;
        $response->provInfo = $provInfo;
        $response->hospitalList = $hospitalList;
        $sanjiaHospitalCount  =count($hospitalList);

        $hospitalCount = 0;
        if (isset($hospitalList[$proName][$city]) && $hospitalList[$proName][$city])
        {
            foreach ($hospitalList[$proName][$city] as $hospital)
            {
                $hospitalCount += count($hospital);
            }
        }
        elseif (isset($hospitalList[$proName]) && $hospitalList[$proName])
        {
            foreach ($hospitalList[$proName] as $hospital)
            {
                $hospitalCount += count($hospital);
            }
        }
        $response->hospitalCount = $hospitalCount;

        //SEO
        $areaName = $city?$city:$proName;
        $title = '';
        $keyword = '';
        $description = '';
        if ($_SERVER['HTTP_HOST'] == $prov . '.haodf.com')
        {
            $title = $titleLevel."_".$provInfo[$prov]['Name']."站_好大夫在线";
        }
        else
        {
            if ($titleLevel)
            {
                $title = $areaName.$titleLevel."_好大夫在线";	
                $keyword = $areaName.$titleLevel."医院大全,".$areaName.$titleLevel."医院排名,".$areaName.$titleLevel."医院名单";
                $description = $areaName.$titleLevel."医院,综合实力".$areaName.$titleLevel."医院排名,含全部"
                    .$areaName.$titleLevel."医院共".$hospitalCount."家。查询门诊时间、咨询专家、预约专家门诊,帮您找到".$areaName."的好医院和好大夫。";
            }
            else
            {
                $title = $areaName."医院_好大夫在线";
                $keyword = "{$areaName}医院,{$areaName}正规医院,{$areaName}医院排名";
                $description = "{$areaName}医院大全,综合实力{$areaName}医院排名,共{$hospitalCount}家正规医院,含全部{$areaName}三甲医院和重点医院。查询门诊时间、咨询专家、预约专家门诊,帮您找到{$areaName}的好医院和好大夫。";
            }
        }
        $response->areaName = $areaName;
        $response->title = $title;
        $response->keyword = $keyword;		
        $response->description = $description;
    }/*}}}*/
    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."地区医院_好大夫在线";
    }/*}}}*/