Exemplo n.º 1
0
    public function search($request, $response)
    {/*{{{*/
        $key = $request->key;
        $this->addSearchLog($key);
        $diseaseList = $hospitalList = $doctorList = $articleList = $flowList = array();
        list($diseaseItems, $pageInfo, $mainAim) = WapClient::getInstance()->getSearchDataBySphinx($key, 'disease',  1, 1);
        if (false == empty($diseaseItems))
        {
            $diseaseItem = array_shift($diseaseItems);
            $diseaseList[] = DAL::get()->find('disease', $diseaseItem->id);
        }

        list($hospitalItems, $pageInfo, $mainAim) = WapClient::getInstance()->getSearchDataBySphinx($key, 'hospital',  1, 5);
        if (false == empty($hospitalItems))
        {
            foreach ($hospitalItems as $hospitalItem)
            {
                $hospitalList[] = DAL::get()->find('hospital', $hospitalItem->id);
            }
        }

        list($doctorItems, $pageInfo, $mainAim) = WapClient::getInstance()->getSearchDataBySphinx($key, 'doctor',  1, 15);
        if (false == empty($doctorItems))
        {
            foreach ($doctorItems as $doctorItem)
            {
                $doctorList[] = DAL::get()->find('doctor', $doctorItem->id);
            }
        }

        list($flowItems, $pageInfo, $mainAim) = WapClient::getInstance()->getSearchDataBySphinx($key, 'flow',  1, 5);
        if (false == empty($flowItems))
        {
            foreach ($flowItems as $flowItem)
            {
                $flowList[] = DAL::get()->find('doctorpatientref', $flowItem->id);
            }
        }

        list($articleItems, $pageInfo, $mainAim) = WapClient::getInstance()->getSearchDataBySphinx($key, 'article',  1, 5);
        if (false == empty($articleItems))
        {
            foreach ($articleItems as $articleItem)
            {
                $articleList[] = DAL::get()->find('article', $articleItem->id);
            }
        }

        $mainAimList = array();
        $dataList = array('disease' => $diseaseList, 'hospital' => $hospitalList, 'doctor' => $doctorList, 'article' => $articleList, 'flow' => $flowList);
        if ($mainAim && array_key_exists($mainAim, $dataList))
        {
            $mainAimList[$mainAim] = $dataList[$mainAim];
            unset($dataList[$mainAim]);
        }

        $response->dataList = array_merge($mainAimList, $dataList);
        $response->key = $key;
        $response->title = "搜索".$key."的结果_好大夫在线";
        $response->from = $request->from ? $request->from : false;
    }/*}}}*/
Exemplo n.º 2
0
 public function search($key, $targetType, $pageId, $pageSize)
 {/*{{{*/
     $this->_initPageInfo($pageId, $pageSize);
     $this->addSearchLog($key);
     list($items, $pageInfo, $mainAim) = WapClient::getInstance()->getSearchDataBySphinx($key, $targetType,  $pageId, $pageSize);
     $this->content = $this->getSearchResultInfos($items);
     $this->pageInfo = $pageInfo;
 }/*}}}*/
Exemplo n.º 3
0
 public function showBookedDisease($userId, $deviceToken, $type)
 {/*{{{*/
     $type = AppBookingRef::TYPE_DISEASE; 
     if(empty($deviceToken) && empty($userId))
     {
         $this->setErrorCode(327);
         return 0;
     }
     $diseaseList = array();
     $diseaseList = MobileBookingClient::getInstance()->showBookedDisease($userId, $deviceToken, $type);
     $infos = array();  
     if(false == empty($diseaseList))
     {
         foreach($diseaseList as $disease)
         {
             if(false == $disease->isNull())
             {
                 $info['diseaseId'] = $disease->id;
                 $info['diseaseName'] = $disease->name;
                 $info['diseaseKey'] = $disease->key;
                 //todo 优化
                 $info['diseaseArticleCnt'] = WapClient::getInstance()->getArticleCountByDiseaseId($disease->id);
                 $infos[] = $info;
             }
         }
     }
     $this->content = $infos;
 }/*}}}*/