protected function getData($nowPage, $pageSize)
    {/*{{{*/
        $options['filterKeys'] = array('huoluan','ruchongbing','zhiwushenjingjibing','mafeng','poshangfeng','yaozheshang','dongwuxingpifubing','wulixingpifubing',
                'baisekangzhen','tijian','nueji','shuyi','feidian','tianhua','bairike','xinghongre','jiyan','duoqiguangongnengbuquan','jiaoganshenjingyingyangbuliang',
                'baihou','biyingjiebing','bibunaomonaopengchu','chuanranxingdanhexibaozengduozheng','dongmailiuxinggunangzhong','dianji','ganjiqiuyoubing','hegugusuiyan',
                'houguanjieyan','yingyoueryindaoyan','jisuixueguanjibing','jingbuchuangshang','jingdongmaitiliu','yasuigaihua','yihejianxiganran','pifujiehebing',
                'qinliugan','sheyanshenjingtong','shenyouzheng','sihuansuya','xiaoerreyezonghezheng','xiaoerhoujingluan','xiaoerkouyan','xinshengerchanshangxingjibing',
                'xinzangsunshang','yanni','yanjianyanzheng','yizhiquefazheng','zhongshu','chixuxingzhiwuzhuangtai','wangyin','xiongmojianpiliu','xiongkuochukouzonghezheng',
                'jingnangyan','dixueya','zhichangxinliwenti','shixuexibaozonghezheng','tengtong'); 
        $diseaseList = DiseaseClient::getInstance()->getAllDiseaseList($nowPage, $pageSize, $options);

        $diseases = array();
        foreach ($diseaseList['list'] as $disease)
        {
            $diseaseNames = $this->getAllNames($disease);
            if (count($diseaseNames)>1)
            {
                foreach ($diseaseNames as $key => $diseaseName)
                {
                    $diseases[] = $this->getRealData($disease, $diseaseName);
                    unset($diseaseName);
                }
            }
            else
            {
                $diseases[] = $this->getRealData($disease);
            }
        }
        BeanFinder::get('LocalCache')->removeAll(); 
        return $diseases;
    }/*}}}*/
Example #2
0
    private function checkDiseaseHospitalInfo4Baidu()
    {/*{{{*/
        $dir = "/home/avatar/system/webapps/openplatform/data/standard/diseasehospitalinfo4baidu/*";
        //一级
        $diseaseHospitalList = DAL::get()->queryDiseaseHospitalCountInfo('DiseaseHospital');
        foreach ($diseaseHospitalList as $diseaseHospital)
        {
            $dbCnt = $diseaseHospital['cnt'];
            $xmlCnt =exec('grep "\['.$diseaseHospital['diseasename'].'\]" '.$dir.' | grep diseaseName | wc -l');
            if ($xmlCnt > 0)
            {
                $this->content .= "DiseaseHospitalInfo4Baidu ".$diseaseHospital['diseasename']." DB ".$dbCnt." XML ".$xmlCnt."\n";
            }
        }

        //二级
        $diseaseHospitalList = DAL::get()->queryDiseaseHospitalCountInfo('DiseaseHospital', false);
        foreach ($diseaseHospitalList as $diseaseHospital)
        {
            $disease = DAL::get()->find('Disease', $diseaseHospital['diseaseid']);
            $res = DiseaseClient::getInstance()->getDiseaseHospitalByDisease($disease->getParentDisease()->id);
            $dbCnt = count($res['diseaseHospitalList']);
            $xmlCnt =exec('grep "\['.$diseaseHospital['diseasename'].'\]" '.$dir.' | grep diseaseName | wc -l');
            if ($xmlCnt > 0)
            {
                $this->content .= "DiseaseHospitalInfo4Baidu ".$diseaseHospital['diseasename']." DB ".$dbCnt." XML ".$xmlCnt."\n";
            }
        }
        echo "DiseaseHospitalInfo4Baidu数据源检查完毕\n";
    }/*}}}*/
    public function getRecommendHospitalsOfDiseaseName($request, $response)
    {/*{{{*/
        $diseaseName = mb_convert_encoding($request->diseaseName, "GBK", "auto");
        $disease = DAL::get()->find_similarDiseaseLimitName("disease", $diseaseName);    
        if($disease instanceof Disease)
        {
            $pageId = $request->pageId;
            $pageSize = $request->pageSize;

            $diseaseHospitalList = array();
            $bind = array();
            $binds['rank'] = 1;
            $binds['needPage'] = true;
            $this->_initPageInfo($pageId, $pageSize);

            $res = DiseaseClient::getInstance()->getDiseaseHospitalByDisease($disease->voteDisease->id, $binds, $pageId, $pageSize);
            $diseaseHospitalList = $res['diseaseHospitalList'];
            $pageInfo = $this->_renamePageInfoIndex($res['pageInfo']);
            $content = array();
            foreach($diseaseHospitalList as $diseaseHospital)
            {
                $hospital = $diseaseHospital->hospital;
                $hospitalInfo = array();
                $hospitalInfo['phone'] = $hospital->phone;
                $hospitalInfo['name'] = $hospital->name;
                $hospitalInfo['url'] = $hospital->getUrl(self::getHezuoDomin());
                $content[] = $hospitalInfo;
            }
            $response->content = array($content, $pageInfo);
        }
    }/*}}}*/
 public function delete($request, $response)
 {
     $result = DiseaseClient::getInstance()->deleteDiseaseFaculty($request->id);
     $response->result = $result;
     $response->actionDesc = "ɾ³ý";
     $response->id = $request->id;
     $response->_my_template = '/default/processmsg';
 }
    public function searchServiceDoctor($request, $response)
    {/*{{{*/
		header('Content-Type: text/html; charset=GBK');
        $facultyList = FacultyClient::getInstance()->getFacultyList4SearchPhoneDoctor();
        list($facultyId, $facultyName) = each ($facultyList);
		$response->facultyList = $facultyList;
		$diseaseList = DiseaseClient::getInstance()->getDiseaseListInDiseaseDoctor($facultyName);
		$response->diseaseList = $diseaseList;
    }/*}}}*/
    private function getDoctorInfo($disease, $province)
    {/*{{{*/
        $options = array();
        $options['limit'] = 20;
        $options['province'] = $province;
        $doctorList = DiseaseClient::getInstance()->getDieaseDoctorByDisease($disease->id, $options);
        $res = $result = array();
        foreach($doctorList as $diseaseDoctor)
        {
            if($diseaseDoctor->doctor->commentDoctor->voteCount>5)
            {
                $doctor = $diseaseDoctor->doctor;
                $res['doctor']['name'] = $doctor->name;
                $res['doctor']['zhicheng'] = trim($doctor->grade.' '.$doctor->educateGrade);
                $res['doctor']['url'] = $doctor->getUrl();
                $res['doctor']['homepage'] = $doctor->space->getUrl();
                $res['doctor']['hospitaltitle'] = $doctor->getHospitalName();
                $res['doctor']['hospitalurl'] = $doctor->hospitalfaculty->hospital->getUrl(); 

                $res['doctor']['keshititle'] = " ";
                if(false == empty($doctor->title)){
                    $res['doctor']['keshititle'] = $doctor->hospitalfaculty->faculty->name; 
                }

                $res['doctor']['keshiurl'] = $doctor->hospitalfaculty->faculty->getUrl();
                $res['doctor']['good_at'] = $doctor->specialize;
                $res['doctor']['description'] = strip_tags($doctor->intro);
                $res['doctor']['online'] = $doctor->getZiXunUrl();

                $res['doctor']['telephone'] = " ";
                if($doctor->hasSpace() && $doctor->space->isPhoneOpenedForFront())
                {
                    $res['doctor']['telephone'] = $doctor->space->getPhoneUrl();
                }
                $res['doctor']['yuyue'] = " ";
                if($doctor->space->isBookingOpened())
                {
                    $res['doctor']['yuyue'] = $doctor->space->getBookingUrl();
                }
                $res['doctor']['reply'] = 0;
                if($doctor->hasSpace())
                {
                    $res['doctor']['reply'] = $doctor->space->confirmedCaseCount;
                }
                $res['doctor']['vote_num'] = $doctor->commentDoctor->voteCount;
                $result[] = $res;
                if (count($result)>=3)
                {
                    break;
                }
            }
            BeanFinder::get('LocalCache')->removeAll(); 
        }
        return $result;
    }/*}}}*/
    public function index($request, $response)
    {
        $this->init($request, $response);
        if ($this->faculty->isVirtual) 
        {
			$facultyList = DAL::get()->find_all_by_condition('faculty', 
				"fld_FacultyIsVirtual=0 and fld_FacultyParentId={$this->faculty->id} order by fld_FacultyDoctorCount desc");
        }
        else 
        {
			$tmp = array_filter(explode(',', $this->faculty->related));
            foreach ($tmp as $tmpKey=>$tmpItem)
            {
				@list($tmpList[$tmpKey]['fld_FacultyName'], $tmpList[$tmpKey]['fld_FacultyId']) = explode('|', $tmpItem);
				$facultyIds[] = $tmpList[$tmpKey]['fld_FacultyId'];
			}
			if($facultyIds)
            {
				$facultyList = DAL::get()->find('faculty', $facultyIds);
            }
		}
		list($diseaseFacultyList, $dfPageInfo) =  array_values(
			DiseaseClient::getInstance()->getDiseaseFacultyBetweenFaculty(
				$this->facultyIdFrom, $this->facultyIdTo, array('nowPage' => 1, 'pageSize' => self::DISEASE_FACULTY_NUM))
		);
		list($doctorList, $dPageInfo) = array_values(
			DoctorClient::getInstance()->getDoctorBetweenFaculty($this->facultyIdFrom, $this->facultyIdTo, 
                array('province' => $this->provinceName),
                array('nowPage' => 1, 'pageSize' => self::INDEX_PAGE_SIZE))
		);
        foreach($doctorList as $doctor)
        {
            if ($doctor->hasSpace() == false || $doctor->isNull())
            {
                continue;
            }
            else
            {
                $spaceIds[] = $doctor->space->id;
            }
        }
		$tmpResults = array();
		if(empty($spaceIds) == false){
			$tmpResults = SpaceClient::getInstance()->getTmpSpacePostCnt($spaceIds);
		}
		$spacePostCntInfos = array();
		foreach($tmpResults as $tmpResult){
			$spacePostCntInfos[$tmpResult['userid']] = $tmpResult['postcount'];
		}
		$response->spacePostCntInfos = $spacePostCntInfos;
		$response->facultyList = $facultyList;
		$response->doctorList = $doctorList;
		$response->diseaseFacultyList = $diseaseFacultyList;
    }
    private function getLabsForDiseaseHospital(DiseaseHospital $dH)
    {/*{{{*/
		$facultyInfos = DiseaseClient::getInstance()->getDiseaseHospitalFacultyByHospitalWithDisease($dH->hospital->id, $dH->disease->id, 4);
        $labs = array();

        foreach ($facultyInfos as $facultyInfo)
        {
            $lab = array();
            $lab['name'] = $facultyInfo['facultyname'];
            $labs[] = array('lab' => $lab);
            unset($lab, $facultyInfo);
        }

        return $labs;
    }/*}}}*/
    protected function getData($nowPage, $pageSize)
    {/*{{{*/
        $option['filterKeys'] = BeanFinder::get('configs')->excludeDiseaseKeys;
        $diseaseList = DiseaseClient::getInstance()->getAllDiseaseList($nowPage, $pageSize, $option);
        $diseases = array();
        foreach ($diseaseList['list'] as $disease)
        {
            $tmpArr = array();
            $ddCnt = DiseaseClient::getInstance()->getDiseaseDoctorCnt($disease->getParentDisease()->id);
//             $articleList = articleClient::getInstance()->searchByDisease($disease->name, 10);
            $articleList = array(1); //todo by sjp 2014.06.25 今天又要恢复这个脚本,searchByDisease已经不存在了,所以直接赋值成1了。
            $zhuanTiList = $this->getZhuanTi($disease);
            $diseaseNames = $this->getAllNames($disease);

            if ($diseaseNames)
            {
                foreach ($diseaseNames as $diseaseName)
                {
                    $tmpArr['item']['content1'] = "{$diseaseName}好评专家{$ddCnt}位,可咨询{$diseaseName}问题,预约专家门诊,权威专家亲自介绍{$diseaseName}病因,症状,治疗,如何护理{$diseaseName}患者等.";
                    $tmpArr['item']['gap'] = ' ';
                    $tmpArr['item']['title'] =  $diseaseName.'症状_治疗_专家咨询_预约_好大夫在线';
                    $tmpArr['item']['url'] = 'http://www.haodf.com/jibing/'.$disease->key.'.htm';

                    $tmpArr['item']['link1'] = $tmpArr['item']['link2'] = '';
                    if ($articleList)
                    {
                        $tmpArr['item']['link1'] = 'http://www.haodf.com/jibing/'.$disease->key.'/wenzhang.htm';
                    }
                    if ($zhuanTiList)
                    {
                        $tmpArr['item']['link2'] = 'http://www.haodf.com/jibing/zhuanti/'.$disease->key.'.htm';
                    }
                    $tmpArr['item']['link3'] = 'http://www.haodf.com/jibing/'.$disease->key.'/yiyuan.htm';
                    $tmpArr['item']['link4'] = 'http://www.haodf.com/jibing/'.$disease->key.'/daifu.htm';
                    $tmpArr['item']['link5'] = 'http://www.haodf.com/jibing/'.$disease->key.'/zixun.htm';
                    //$tmpArr['item']['date'] = XDateTime::now()->toShortString();
                    $tmpArr['item']['key'] = $diseaseName;
                    error_log(mb_convert_encoding($diseaseName, 'utf8', 'auto')."\n", 3, "/home/avatar/system/webapps/openplatform/data/complete/disease4baidu/disease4baidu.txt");
                    $diseases[] = $tmpArr;
                }
            }
        }

        BeanFinder::get('LocalCache')->removeAll(); 
        return $diseases;
    }/*}}}*/
 protected function getData($nowPage, $pageSize)
 {/*{{{*/
     $res = array();
     $option['orderBy']['rank'] = true;
     $hospitalFacultys = HospitalFacultyClient::getInstance()->getHospitalFacultyByOption($nowPage, $pageSize, $option);
     if($nowPage <= $this->totalTimes && empty($hospitalFacultys))
     {
         throw new OpenPlatFormException("该次数据库取数据为空");
     }
     foreach ($hospitalFacultys as $hospitalFaculty)
     {
         $keshi = array();
         $keshi['hospitalname'] = $hospitalFaculty->hospital->name;
         $keshi['hospitalfaculty'] = $hospitalFaculty->name;
         $diseaseFacultys = HospitalFacultyClient::getInstance()->getDiseaseHospitalFacultyList($hospitalFaculty->id, array('limit' => 1000)); 
         if ($diseaseFacultys['list'])
         {
             foreach ($diseaseFacultys['list'] as $diseaseFaculty)
             {
                 if ($diseaseFaculty->disease instanceof Disease && $diseaseFaculty->hospitalFaculty instanceof HospitalFaculty)
                 {
                     $diseaseInfo = array();
                     $diseaseInfo['disease'] =  $diseaseFaculty->disease->name;
                     $diseaseInfo['item_num'] =  $diseaseFaculty->doctorCount;
                     $diseaseDoctors= DiseaseClient::getInstance()->getDiseaseDoctorByFaculty($diseaseFaculty->disease->id,$diseaseFaculty->hospitalFaculty->id, array('limit'=> 6));
                     foreach ($diseaseDoctors as $diseaseDoctor)
                     {
                         $doctor = $diseaseDoctor->doctor;
                         $doctorInfo['doctorname'] = $doctor->name;
                         $doctorInfo['doctorgrade'] = $doctor->getGrade4Display();
                         $doctorInfo['specialize'] = $doctor->specialize;
                         $doctorInfo['goodvotecnt'] = $diseaseDoctor->goodVoteCount;
                         $doctorInfo['doctorintrourl'] = $doctor->getUrl();
                         $diseaseInfo[] = array('item' => $doctorInfo);
                     }
                     $diseaseInfo['moredoctor'] = 'http://www.haodf.com/tuijian/'.$diseaseFaculty->hospitalFaculty->hospital->getEncodeId().'/'.$diseaseFaculty->hospitalFaculty->getEncodeId().'/'.$diseaseFaculty->disease->key.'.htm';
                     $keshi[] = array('disease' => $diseaseInfo);
                 }
                 BeanFinder::get('LocalCache')->removeAll(); 
             }
             $res[] = array('keshi' => $keshi);
         }
     }
     return $res;
 }/*}}}*/
 private function getDiseaseList($hospitalFacultyIds)
 {/*{{{*/
     $res = array();
     foreach ($hospitalFacultyIds as $hospitalFacultyId)
     {
         $diseaseData = DiseaseClient::getInstance()->getDiseaseHospitalFacultyListByHospitalFaculty($hospitalFacultyId, 10);
         foreach ($diseaseData as $diseaseHF)
         {
             if(false == isset($res[$diseaseHF->hospitalFaculty->id]))
             {
                 $res[$diseaseHF->hospitalFaculty->id] = array();
             }
             $resArray = array('name'=>$diseaseHF->disease->name,'voteCount'=>$diseaseHF->voteCount);
             array_push($res[$diseaseHF->hospitalFaculty->id],$resArray);
             unset($diseaseHF);
         }
         unset($hospitalFacultyId);
         BeanFinder::get('LocalCache')->removeAll();
     }
     return $res;
 }/*}}}*/
    private function getDiseaseContentList($diseaseList=array())
    {/*{{{*/
        $res = array();
        $diseaseKeys = array();
        if ($diseaseList && $diseaseList['list'])
        {
            foreach($diseaseList['list'] as $disease)
            {
                $diseaseKeys[] = $disease->key;
                unset($disease);
            }
        }

        $diseaseKeys = array_unique($diseaseKeys);
        if ($diseaseKeys)
        {
            $res = DiseaseClient::getInstance()->getContentiGroupByKey($diseaseKeys);
        }

        BeanFinder::get('LocalCache')->removeAll(); 
        return $res;
    }/*}}}*/
    private function getDoctorInfo($disease)
    {/*{{{*/
        $doctorList = DiseaseClient::getInstance()->getDieaseDoctorByDisease($disease->voteDisease->id, array());
        $result = array();
        foreach($doctorList as $diseaseDoctor)
        {
            $doctor = $diseaseDoctor->doctor;
            if($doctor->hospitalfaculty->hospital->isTestHospital() || $doctor->isDead() || empty($doctor->hospitalfaculty->hospital->commonName))
            {
                continue;
            }
            if (in_array($doctor->hospitalfaculty->hospital->id, DiseaseHospital4Sougou::$offlineHospitalIds)) continue;
            $province = $doctor->hospitalfaculty->hospital->province;
            $res = array();
            $res['name'] = $doctor->name;
            $res['url'] = $doctor->getUrl();
            $res['tagteach'] = $doctor->educateGrade;
            $res['tagclinic'] = $doctor->grade;
            $res['province'] = $province;
            $res['province_url'] = 'http://www.haodf.com/jibing/'.$disease->key.'/daifu.htm?province='. Area::getProvKeyByName($province); 
            $res['city'] = $doctor->hospitalfaculty->hospital->getDistrictStr(); 
            $res['seo_spelling'] = Area::getProvKeyByName($province);
            $res['hospital']['url'] = $doctor->hospitalfaculty->hospital->getUrl();
            $res['hospital']['name'] = $doctor->hospitalfaculty->hospital->commonName;
            $res['lab'] = $doctor->hospitalfaculty->name;
            $res['goodat'] = $doctor->specialize;
            if($doctor->space->isBookingOpened())
            {
                $res['registerurl'] = $doctor->space->getBookingUrl();
            }
            $result[] = array('doctor' => $res);

            unset($diseaseDoctor, $doctor, $province, $res);
        }

        unset($doctorList);
        BeanFinder::get('LocalCache')->removeAll(); 
        return $result;
    }/*}}}*/
 public function searchOne($request, $response)
 {
     /*{{{*/
     $doAction = $request->doAction;
     $diseaseList = array();
     if ($request->content && ($doAction == 'disease' || $doAction == 'diseaseList')) {
         $diseaseList = DiseaseClient::getInstance()->getDiseaseForSearch($request->content, 50);
         $response->resultList = $diseaseList;
     }
     if (($doAction == 'doctor' or $doAction == 'doctorinfo') && $request->content) {
         $doctorList = DoctorClient::getInstance()->getDoctorListByDoctorUserName($request->content);
         //首先按用户名找,找不到再按医生姓名找
         if (count($doctorList) < 1) {
             $doctorList = DoctorClient::getInstance()->getDoctorForSearch($request->content, 100);
         }
         $response->resultList = $doctorList;
     }
     $response->doAction = $request->doAction;
     $response->content = $request->content;
 }
 public function sitemapDiseaseList($request, $response)
 {/*{{{*/
     $facultyArray = array();
     $facultyIds = array();
     $facultyIds = FacultyClient::getInstance()->getSecondGradeFaculty();
     foreach ($facultyIds as $faculty)
     {
         $facultyArray[] = $faculty['facultyid'];
     }
     $diseaseList = DiseaseClient::getInstance()->getDiseaseFacultyListGroupByFacultyId($facultyArray);
     $facultyList = DAL::get()->find('faculty', $facultyArray);
     $response->facultyList = $facultyList;
     $response->diseaseList = $diseaseList;
 }/*}}}*/
 public function newSearchDisease($request, $response)
 {
     /*{{{*/
     $diseaseList = array();
     if ($request->diseaseName) {
         $diseaseList = DiseaseClient::getInstance()->getDiseaseForSearch($request->diseaseName, 50);
     }
     $response->checkedDiseaseList = $this->getCheckedDiseaseList($request->adwordId);
     $response->adwordId = $request->adwordId;
     $response->diseaseName = $request->diseaseName;
     $response->diseaseList = $diseaseList;
 }
	public function facultyExpertList($request, $response) {
		$facultyid = Codec::getInstance()->decodeId($request->faculty_id);
		if(!$facultyid){
			throw new BizException('科室id不可为空');
		}
		$response->hospital = $this->_hospital;
		$response->pageModule = 'disease';
		$response->disease = 1;
		$response->hospitalFacultyList = $this->_hospital->getHospitalFacultyList(HospitalFaculty::IS_SELECT_FACULTY_BY_VOTE_YES);
	
        $options = array();
        $options['limit'] = 200;
        $facultyDiseaseList = HospitalFacultyClient::getInstance()->getDiseaseHospitalFacultyList($facultyid, $options);
        $facultyDiseaseList = $facultyDiseaseList['list'];
		$diseaseRes = array();
		$facultyExperts = array();
		if(!empty($facultyDiseaseList)){
            foreach ($facultyDiseaseList as $facultyDisease){
                if (false == $facultyDisease->disease->isNull()) {
                    $diseaseRes[$facultyDisease->disease->id] = array( 
                                                'diseaseName' => $facultyDisease->disease->name,
                                                'key' => $facultyDisease->disease->key,
                                                'doctorCount' => $facultyDisease->doctorCount );
                    
                 	$facultyExpertList = DiseaseClient::getInstance()->getDiseaseDoctorByFaculty($facultyDisease->disease->id,$facultyid,array('limit'=> self::EXPERT_DISEASE_DOCTOR_NUM));;
                        foreach($facultyExpertList as $expert){
                            $facultyExperts[$facultyDisease->disease->id][] = array(
                                                'doctorid'=>$expert->doctor->id,
                                                'doctorName'=>$expert->doctor->name,
                                                'goodVoteCount'=>$expert->goodVoteCount );
                        }
                    }
                }
            }	         
		$response->diseaseRes = $diseaseRes;
		$response->facultyExperts = $facultyExperts;
        $hospitalFaculty = DAL::get()->find('HospitalFaculty',$facultyid);
		$response->faculty = $hospitalFaculty;
        if (false == $hospitalFaculty->isNull())
        {
            $this->getSidePhoneServiceListByHF($hospitalFaculty, $response, 6);
        }

		$pageTitleInfo = $this->getFacultyPageTitleinfo($response->faculty);
		$response->title = $pageTitleInfo['title'];
		$response->keywords = $pageTitleInfo['keywords'];
		$response->description = $pageTitleInfo['description'];
		$response->content = $pageTitleInfo['content'];
	}
	public function showDetail($request, $response)
	{/*{{{*/
		$id = $request->id;
		$id = (int)Codec::getInstance()->decodeId($id);
		if(empty($id))
		{
            throw new BizException('医生信息不存在.');
			exit();
		}
		$doctor = DAL::get()->find('doctor', $id);
		if($doctor == null || $doctor->isNull() || $doctor->hospitalfaculty instanceof NullEntity)
		{
            throw new BizException('医生信息不存在.');
			exit();	
		}

        $this->skipHospitals($doctor->hospitalfaculty->hospital->id, $response);
        $this->skipDoctors($doctor->id, $response);
   		$response->doctor = $doctor;
        $scheduleTable = array();
        $scheduleTables1 = DoctorClient::getInstance()->getFormatScheduleList($doctor->id);
   		if($doctor->id != $doctor->primaryId)
   		{
        	$scheduleTables = DoctorClient::getInstance()->getFormatScheduleList($doctor->primaryId);
	        $tmpInfos1 = $scheduleTables1[$doctor->id];
	        $tmpInfos2 = $scheduleTables[$doctor->primaryId];
	        foreach($tmpInfos1 as $i=>$infos)
	        {
                if(empty($infos) || false==is_array($infos))
	        		continue;
	        	$items = array();
	        	foreach($infos as $j=>$info)
	        	{
	        		$items[$j] = (false == empty($tmpInfos1[$i][$j])) ? $tmpInfos1[$i][$j] : ""; 
	        	}
	        	$scheduleTable[$i] = $items;
	        }
   		}
   		else
   		{
   			$scheduleTable = $scheduleTables1[$doctor->id];
   		}
        $options['doctor'] = $doctor->primaryId;
        $pageInfo['pageSize'] = 10;
		$commentList = DoctorCommentClient::getInstance()->getCommentList($options, $pageInfo);
		$commentList = $commentList['commentList'];
		$diseaseAry = DiseaseClient::getInstance()->getDiseaseDoctorList(array($doctor->primaryId), 50);
		$diseaseIds = array();
		foreach ($diseaseAry as $diseaseDorctor)
		{
			$diseaseIds[$diseaseDorctor->fld_diseaseid]['id'] = $diseaseDorctor->fld_diseaseid;
			$diseaseIds[$diseaseDorctor->fld_diseaseid]['name'] = $diseaseDorctor->disease->name;
			$diseaseIds[$diseaseDorctor->fld_diseaseid]['key'] = $diseaseDorctor->disease->key;
		}
		$sameDiseaseDoctorList = array();
		if(empty($diseaseIds) == false)
		{
			$sameDiseaseDoctorList = DoctorClient::getInstance()->getSameProfessionalDoctors($doctor->primaryId, array_keys($diseaseIds), $limit=4);	
		}
		
		$articleList = array();
		$spaceCaseList = array();
		if($doctor->hasSpace() && $doctor->space->isOpened())
		{
            $articleList = ArticleClient::getInstance()->getTitleListBySpace($doctor->space->id, 3);
			$spaceCaseList = DAL::get()->find_all_lastpost_by_space('doctorpatientref', $doctor->space, 10);
		}
		$response->articleList = $articleList;
		$response->spaceCaseList = $spaceCaseList;
		
		$response->hospitalfaculty = $doctor->hospitalfaculty;
        $response->hospital = $doctor->hospitalfaculty->hospital;
        $response->faculty = $doctor->hospitalfaculty->faculty;
		
		$response->scheduleTable = $scheduleTable ; 
		$response->commentList = $commentList ;
		
		$response->diseaseAry = $diseaseAry;
		$response->diseaseIds = $diseaseIds;
		$response->VOTE_DISPLAY_LIMIT = 4;
		$response->sameDiseaseDoctorList = $sameDiseaseDoctorList;

        if($doctor->space->isNull())
        {
            $spaceAskedThreadsCount = $spaceAskedFlowsCount = $spaceRepliedThreadsCount = $spaceRepliedFlowsCount; 
        }
        else
        {
            $spaceAskedThreadsCount = SpaceClient::getInstance()->getCountOfAskedThreadsCount($doctor->space->id, $this->_newUser->id); 
            $spaceAskedFlowsCount = SpaceClient::getInstance()->getCountOfAskedFlowsCount($doctor->space->id, $this->_newUser->id);
            $spaceRepliedThreadsCount = SpaceClient::getInstance()->getCountOfRepliedThreadsCount($doctor->space->id, $this->_newUser->id);
            $spaceRepliedFlowsCount = SpaceClient::getInstance()->getCountOfRepliedFlowsCount($doctor->space->id, $this->_newUser->id);
        }

        $response->spaceAskedCount = $spaceAskedThreadsCount + $spaceAskedFlowsCount;
        $response->spaceRepliedCount = $spaceRepliedThreadsCount + $spaceRepliedFlowsCount;

        $response->crumb = Crumb::create(DoctorCommentClient::getInstance()->genCommentCrumbKey(), self::TTL);
        $space = $doctor->space;
        $response->space = $space;
        $commonCaseNote = $doctor->getCommonCaseNote4Display();
        $response->commonCaseNote = $commonCaseNote;
        $response->successOrderCount = count(DAL::get()->find_id_finishStatus_and_maybeSuccessCallBackStatus('BookingOrder', $space));
        $bookingCondition = $space->getSpaceBusinessRequirement4Booking()->disease;
        $response->bookingCondition = empty($bookingCondition) ? '不限' : $bookingCondition;
        $response->token = Captcha::generate('comment', $doctor->id, ContentFactory::TYPE_ARITHMATIC, 4, XIpLocation::getIp(), 3);
	}/*}}}*/
 public function newIntro($request, $response)
 {
     /*{{{*/
     DBC::requireFalse($this->spaceIsLogin, '不允许自己提交给自己订单!');
     //对没有开通电话咨询医生的链接跳转,没有owner也会跳走.
     if (false == $this->space->isPhoneOpenedForFront($this->user->id)) {
         $response->setRedirect('http://' . URL_PREFIX . '400.haodf.com/index/prompt?doctorName=' . rawurlencode($this->space->host->name) . '&doctorFaculty=' . rawurlencode($this->space->host->hospitalfaculty->faculty->name));
         return;
     }
     $hospitalFacultyDoctorIds = DoctorClient::getInstance()->getHospitalFacultyDoctorLimit3($this->space->host);
     $facultyDoctorIds = DoctorClient::getInstance()->getFacultyDoctorLimit6($this->space->host);
     $facultyDoctorIds = array_diff($facultyDoctorIds, $hospitalFacultyDoctorIds);
     $response->num = count($facultyDoctorIds);
     $facultyDoctorIds = array_slice($facultyDoctorIds, 0, 3);
     $facultyDoctorList = DAL::get()->find('doctor', $facultyDoctorIds);
     $response->facultyDoctorList = $facultyDoctorList;
     $hospitalFacultyDoctorList = DAL::get()->find('doctor', $hospitalFacultyDoctorIds);
     $response->hospitalFacultyDoctorList = $hospitalFacultyDoctorList;
     $response->diseaseList = DiseaseClient::getInstance()->getDiseaseDoctorList(array($this->space->host->primaryId), 50);
     $response->casetotal = PaymentClient::getInstance()->getDoctorVoteCnt($this->space->id);
     $response->satisfactionLists = PaymentClient::getInstance()->getDoctorSatisfactionList($this->space->host->id);
     $serviceCharge = PaymentClient::getInstance()->getServiceChargeList($this->space->id);
     $preg = '#(\\d+.\\d+)(元)#';
     $replace = '<span class="fb orange1">\\1</span>\\2';
     $serviceCharge = preg_replace($preg, $replace, $serviceCharge);
     $response->serviceCharge = $serviceCharge;
     $response->doctor = $this->space->host;
     $owner = DAL::get()->find_by_relatedObjectid_and_relatedobjecttype('telowner', $this->space->id, TelOwner::TYPE_USER);
     $response->doctorWords = $owner->isNull() || $owner->getSpaceExt() == '' ? '' : $owner->getSpaceExt()->getDoctorWords();
     $response->wordLength = $owner->isNull() || $owner->getSpaceExt() == '' ? '' : strlen($owner->getSpaceExt()->getDoctorWords());
     $response->latestOpenCallServiceTitle = doctorOutline::getLatestOpenCallServiceTitle($owner->spaceExt->starttime4tel->toString());
     $response->owner = $owner;
     $goodCnt = PaymentClient::getInstance()->getPatientPhoneServiceCountByScore($this->space->id, TelVisit::SCORE_GOOD);
     $normalCnt = PaymentClient::getInstance()->getPatientPhoneServiceCountByScore($this->space->id, TelVisit::SCORE_SOSO);
     $badCnt = PaymentClient::getInstance()->getPatientPhoneServiceCountByScore($this->space->id, TelVisit::SCORE_BAD);
     $allCnt = $goodCnt + $normalCnt + $badCnt;
     $response->allCnt = $allCnt;
     $response->goodCnt = $allCnt > 0 ? floor($goodCnt / $allCnt * 100) : 0;
     $response->normalCnt = $allCnt > 0 ? ceil($normalCnt / $allCnt * 100) : 0;
     $response->badCnt = $response->goodCnt + $response->normalCnt != 0 ? 100 - $response->goodCnt - $response->normalCnt : 0;
     // 常见问题
     $response->commonQuestions = $owner->isNull() || $owner->getSpaceExt() == '' ? '' : $owner->getSpaceExt()->commonquestions;
     $options['status'] = array(TelOrder::STATUS_FINISHED, TelOrder::STATUS_CLOSED);
     $response->telOrderCount = TelOrderClient::getInstance()->getOrderCount4Space($this->space->id, $options);
     $response->productList = ProductClient::getInstance()->getProducts($this->space, array(serviceDef::TYPE_TELORDER));
 }
Example #20
0
 public function hospitalExperienceDetail($request, $response)
 {/*{{{*/
     $this->hospitalInit($request, $response);
     $doctor = $response->doctor;
     $key = $request->key;
     $commentId = $request->commentid;
     $comment = DoctorCommentClient::getInstance()->getDoctorCommentSubClass($commentId);
     $response->comment = $comment;
     $response->key = $key;
     if ($comment->userId > 0 && $doctor->hasSpace())
     {
         $commentExtendInfo = DoctorClient::getInstance()->getUserCommentexpandInfo($comment->userId, $doctor->space->id);
     }
     else
     {
         $commentExtendInfo = array();
     }
     if ($key != 'all')
     {
         $disease = DiseaseClient::getInstance()->getByDiseaseKey($key);
         $diseaseId = $disease->voteDisease->id;
         $options['diseaseid'] = $diseaseId;
     }
     $options['orderby'] = 'orderbytime';
     $options['noNewest'] = 1;
     $allRes = DoctorCommentClient::getInstance()->getDoctorCommentList4Doctor($doctor->getPrimaryDoctor(), 1, 1000, $options);
     $commentOrders = array_keys($allRes['commentList']);
     $diseaseCommentCount = $allRes['pageInfo']['total'];
     $current = array_search($commentId, $commentOrders);
     $urlOptions = array();
     $urlOptions['diseasekey'] = $response->key;
     if ($current > 0)
     {
         $prev = $current - 1;
         $prevComment = DoctorCommentClient::getInstance()->getDoctorComment($commentOrders[$prev]);
         $response->prevCommentUrl = $prevComment->getCommentUrl4BaiduApp($urlOptions);        
     }
     if ($current < $diseaseCommentCount - 1)
     {
         $next = $current + 1;
         $nextComment = DoctorCommentClient::getInstance()->getDoctorComment($commentOrders[$next]);
         $response->nextCommentUrl = $nextComment->getCommentUrl4BaiduApp($urlOptions);
     }
     $urlOptions['page'] = 'experience';
     $response->backUrl = $doctor->getUrl4BaiduApp($urlOptions);
 }/*}}}*/
		public function deleteSimple($request,$response){
			$id = $request->id;
			if(!empty($id))
			{
				$flagvalue=1;
				$param=array('id' => $request->id,'flag'=>$flagvalue);
				ZhuantiClient::getInstance()->update($param);
				DiseaseClient::getInstance()->deleteDiseaseLableByObj($id);
			}
			$url = $response->router->urlfor('zhuanti/showlist');
			$response->setRedirect($url);
		}
$dir = dirname(__FILE__);
include_once($dir.'/../script/init.php');
$dir = "/home/avatar/system/webapps/openplatform/data/standard/diseasehospitalinfo4baidu/*";
//$dir = "/home/dev/data/openplatform/standard/diseasehospitalinfo4baidu/*";

//Ò»¼¶
$diseaseHospitalList = DAL::get()->queryDiseaseHospitalCountInfo('DiseaseHospital');
foreach ($diseaseHospitalList as $diseaseHospital)
{
    $dbCnt = $diseaseHospital['cnt'];
    $xmlCnt =exec('grep "\['.$diseaseHospital['diseasename'].'\]" '.$dir.' | grep diseaseName | wc -l');
    if ($xmlCnt - $dbCnt < 0)
    {
        echo $diseaseHospital['diseasename']." DB ".$dbCnt." XML ".$xmlCnt."\n";
    }
}

//¶þ¼¶
$diseaseHospitalList = DAL::get()->queryDiseaseHospitalCountInfo('DiseaseHospital', false);
foreach ($diseaseHospitalList as $diseaseHospital)
{
    $disease = DAL::get()->find('Disease', $diseaseHospital['diseaseid']);
    $res = DiseaseClient::getInstance()->getDiseaseHospitalByDisease($disease->getParentDisease()->id);
    $dbCnt = count($res['diseaseHospitalList']);
    $xmlCnt =exec('grep "\['.$diseaseHospital['diseasename'].'\]" '.$dir.' | grep diseaseName | wc -l');
    if ($xmlCnt - $dbCnt < 0)
    {
        echo $diseaseHospital['diseasename']." DB ".$dbCnt." XML ".$xmlCnt."\n";
    }
}
 public function searchDisease($request, $response)
 {/*{{{*/
     $diseaseList = array();
     if($request->diseaseName){
         $diseaseList = DiseaseClient::getInstance()->getDiseaseForSearch($request->diseaseName, 50);
     }
     $response->type = $request->type;
     $response->diseaseName = $request->diseaseName;
     $response->diseaseList = $diseaseList;
 }/*}}}*/
 private function statistics($request, $response)
 {
     /*{{{*/
     $thankLetterCount = 0;
     if ($this->space->isDoctor()) {
         $thankLetterCount = $this->space->host->getCureThankLetterCount();
     }
     $response->thankLetterCount = $thankLetterCount;
     $spaceRepliedCount = SpaceClient::getInstance()->getCountOfRepliedFlowsCount($this->space->id, $this->user->id);
     $response->spaceRepliedCount = $spaceRepliedCount != 0 ? $spaceRepliedCount : $this->space->caseCount;
     $doctorVoteCnt = 0;
     $diseaseList = DiseaseClient::getInstance()->getDiseaseDoctorList(array($this->space->host->primaryId));
     foreach ($diseaseList as $idx => $diseaseDoctor) {
         if ($diseaseDoctor->goodVoteCount > 0) {
             $doctorVoteCnt += $diseaseDoctor->goodVoteCount;
         }
     }
     $response->doctorVoteCnt = $doctorVoteCnt;
     //礼物数
     $response->presentCnt = PresentClient::getInstance()->getCntOfPresent($this->space->id);
     //昨日诊后报到
     $time = XDateTime::yesterday();
     $startTime = $time->toShortString();
     $endTime = $startTime . ' 23:59:59';
     $yesterdaySigninCnt = DAL::get()->querySubsidyCntByTimeSpan('SubsidyOrder', $this->space->id, $startTime, $endTime);
     $totalSigninCnt = DAL::get()->queryCntByTimeSpan('PatientSignin', $this->space->id);
     $response->totalSigninCnt = $totalSigninCnt;
     $response->yesterdaySigninCnt = $yesterdaySigninCnt;
     //诊后报到患者
     $response->yesterdayCnt = DZoneClient::getInstance()->getYesterdayHits('spacehit', $this->space->id);
     $response->yesterdayDate = date("y-m-d", time() - 3600 * 24);
     $response->docLastOnlineTime = $this->space->getLastOnlineTimeStr();
     $response->openSpaceTime = date("Y-m-d H:i", $this->space->ctime->getTime());
 }
 private function _searchDisease5($result, $confirm, $key, $nowPage, $t, $type, $url, $frame)
 {
     $targetdesc = "疾病";
     $pageLink = '';
     if ($confirm) {
         $diseaseList = DiseaseClient::getInstance()->getDisease4Search($key);
         $result['pageInfo']['total'] = 0;
         if (!empty($diseaseList)) {
             foreach ($diseaseList as $x => $item) {
                 $result['info'][$x]['id'] = $item->key;
                 $result['info'][$x]['name'] = $item->name;
             }
             $result['pageInfo']['total'] = count($result['info']);
         }
     }
     return array($targetdesc, $result, $pageLink);
 }
Example #26
0
	protected static function getLinkData() {
		if (!self::$linkdata) {
            self::$linkdata = array();
			self::$linkdata = DiseaseClient::getInstance()->getSeoLinkList();
		}
	}
 public function ajaxDeleteLable($request, $response)
 {
     $tag = mb_convert_encoding($request->tag, 'gbk', 'utf-8');
     $objId = $request->objid;
     $type = $request->type;
     $tmp = explode(':', $tag);
     $lableId = LableDefine::getLableIdByTitle($tmp['0']);
     $diseaseName = $tmp['1'];
     DiseaseClient::getInstance()->deleteDiseaseLable($diseaseName, $lableId, $objId, $type);
     //        $disease = DAL::get()->find_by_name('disease', $diseaseName);
     //		ThesisClient::getInstance()->deleteDiseaseTag($disease->id, $objId , $type);
     echo json_encode(true);
     exit;
 }
 public function showRankWarningDetail($request, $response)
 {
     $commentDoctor = null;
     $ticket = new NullEntity();
     list($commentDoctor, $ticket) = $this->getDoctor4Inspect($request->ticketid);
     $commentDoctorExt = $ticket->getSource()->commentDoctor;
     $response->commentDoctorExt = $commentDoctorExt;
     $response->ticket = $ticket;
     $diseaseDoctorList = DiseaseClient::getInstance()->getDiseaseDoctorList(array($commentDoctorExt->doctor->primaryId));
     $response->diseaseDoctorList = array_slice($diseaseDoctorList, 0, 50);
 }
	public function ajaxGetLatestOnlineDiseaseDoctors($request, $response)
	{/*{{{*/
		$diseaseId = Codec::getInstance()->decodeId($request->diseaseId);
		$limit = $request->getRequest('limit', 10);
		
		$latestOnlineDiseaseDoctors = array();

		$response->latestOnlineDiseaseDoctors = DiseaseClient::getInstance()->getDieaseDoctor($diseaseId, array(), $limit);
		
		$response->callback = $request->callback?$request->callback:'';
		$response->disease = DAL::get()->find('disease', $diseaseId);
		$response->isAjax = true;
	}/*}}}*/
   public function modifyDiseaseOk($request, $response)
   {/*{{{*/
       $diseaseId =$request->diseaseid;
       $userId = $request->userid;
       $suggestion = $request->suggestion;
       $modifyReason = $request->modifyreason;
       $disease = DAL::get()->find('disease', $diseaseId);
       $doctor = DoctorClient::getInstance()->getPrimaryDoctorByUserId($userId);
       if($disease->isNull() || $doctor->isNull())
       {
           MsgHtml::msg("操作数据不存在");exit;
       }

       $result = 0;
       $title = "医生修改疾病 (".date("y-m-d H:i").")";
       $content = "";
       $content .= "来自 ".$_SERVER['REMOTE_ADDR']." 的用户发送了一条意见或建议, 内容如下:\n";
       $content .= "----------------------------------------------------------------------------\n";
       $content .= "疾病名称:" . $disease->name . "(" . $disease->key. ")\n";
       $content .= "内容:$suggestion\n\n";
       $content .= "修改原因:$modifyReason\n";
       $content .= "医生ID: " . $doctor->id. "\n";
       $content .= "医生姓名: " . $doctor->name . "\n";
       $content .= "医院科室:" . $doctor->hospitalfaculty->hospital->name . $doctor->hospitalfaculty->faculty->name. "\n";
       $content .= "医生个人网站:<a herf='http://" . $user->name . ".haodf.com'>http://" . $user->name . ".haodf.com</a>\n";
       $content .= "医生邮箱:".$doctor->space->user->email."\n";
       $content .= "----------------------------------------------------------------------------\n";
       $content .= "发送时间: ".date("y-m-d H:i");
       $result = UserClient::getInstance()->addUserAdvice('医生修改疾病', $content, $userId); $diseasesDoctors = DiseaseClient::getInstance()->getDiseaseDoctorList(array($doctor->id));
       $diseasesFacultys = DiseaseClient::getInstance()->getDiseaseFacultyListByFacultyId($doctor->hospitalfaculty->faculty->id, 30);
       $diseases = array();
       foreach($diseasesDoctors as $diseasesDoctor){
           $diseases1[] = array('name' =>$diseasesDoctor->disease->name, 'key'=>$diseasesDoctor->disease->key);
       }
       foreach($diseasesFacultys as $diseasesFaculty){
           $diseases[] = array('name' =>$diseasesFaculty->disease->name, 'key'=>$diseasesFaculty->disease->key);
       }
       $diseases = array_merge($diseases1, $diseases);
       $response->diseases= $diseases; 
   }/*}}}*/