public function getUserInfo4NewIndex($userId) {/*{{{*/ $doctorOwner = DAL::get()->find_by_userid('DoctorOwner', $userId); if($doctorOwner->isNull()) { $this->setErrorCode(819); return 0; } $infos = array(); $infos['userName'] = $doctorOwner->source->user->name; $infos['hostName'] = $doctorOwner->source->name; $infos['userRole'] = $this->getUserRole($doctorOwner->user); $infos['isFollowupOpened'] = 2; $infos['headImage'] = ($doctorOwner->isSpace()) ? $doctorOwner->source->getHeadImg4Modify() : $doctorOwner->source->getHeadImage(); $infos['bigHeadImage'] = ($doctorOwner->isSpace()) ? $doctorOwner->source->getHeadImg4Modify(2400) : $doctorOwner->source->getHeadImage(2400); if($doctorOwner->isSpace()) { $space = $doctorOwner->source; $infos['spaceId'] = $space->id; list($featAmount, $heartImgCnt) = ScoreClient::getInstance()->getHeartInfoById($space->id); $infos['featAmount'] = $featAmount; $infos['heartImgCnt'] = $this->getFlagCnt($heartImgCnt); $count = count(BookingClient::getInstance()->getOrderList4Doctor($space->id, self::STATUS_TODAY)); if(false == $space->isBookingOpened()) { $count = 0; } $infos['bookingCnt'] = $count; $telOwner = DAL::get()->find_by_relatedObject('telowner', $space->user); $needIllnessCnt = TelOrderClient::getInstance()->queryNeedIllnessTelOrderCnt('TelOrder', $telOwner->id); if(!PaymentDataBucket::isOpenPhone($space)) { $needIllnessCnt = 0; } $infos['needIllnessCnt'] = $needIllnessCnt; $waitTimeCnt = TelOrderClient::getInstance()->queryWaitTimeTelOrderCnt('TelOrder', $telOwner->id); $waitTelOrderCount = TelOrderClient::getInstance()->getLastNotExeTelOrderCnt($telOwner->id); $isShowFreeButton = MainDataBucket::isShowPhoneButton($space, $waitTimeCnt, $waitTelOrderCount); $infos['isShowFreeButton'] = $isShowFreeButton; $infos['isFollowupOpened'] = ($space->isConfirmed() && false == $space->isOpenFollowup()) ? 0 : 1; //患者报道和医生补贴 $infos['isOpenSubsidy'] = $space->isSignSubsidyOpen()?'1':'0'; $patientSignForToday = DAL::get()->querySubsidyCntByTimeSpan('SubsidyOrder', $space->id, XDateTime::now()->toShortString()); $patientSignForMonth = DAL::get()->querySubsidyCntByTimeSpan('SubsidyOrder', $space->id, XDateTime::now()->addDay(-29)->toShortString()); $subsidyAccountAmount = AccountClient::getInstance()->getSubsidyOrdersAmountInTimespan($space->id, XDateTime::now()->addDay(-29)->toShortString(), XDateTime::now()); $infos['patientSignForToday'] = $patientSignForToday; $infos['patientSignForMonth'] = $patientSignForMonth; $infos['subsidyAccountAmount'] = $subsidyAccountAmount; } $belongDoctors = DoctorClient::getInstance()->getDoctorList4spaceByNoCache($userId); if(empty($belongDoctors)) { if ($doctorOwner->isPreDoctor()) { $infos['hospital'][0]['hospitalName'] = $doctorOwner->source->hospitalName; $infos['hospital'][0]['hospitalFacultyName'] = $doctorOwner->source->facultyName; } else { $this->setErrorCode(840); return 0; } } else { $i = 0; foreach($belongDoctors as $doctor){ $infos['hospital'][$i]['hospitalName'] = $doctor->hospitalfaculty->hospital->name; $infos['hospital'][$i]['hospitalFacultyName'] = $doctor->hospitalfaculty->name; $i++; } } $this->content = $infos; }/*}}}*/
/** * getCntOfTelOrder 获取订单数 * * @param mixed $userId * @access public * @return void */ public function getCntOfTelOrder($userId) {/*{{{*/ $space = DAL::get()->find('space', $userId); $telOwner = DAL::get()->find_by_relatedObject('telowner', $space->user); $waitTelOrderCount = TelOrderClient::getInstance()->getLastNotExeTelOrderCnt($telOwner->id); $needIllnessCnt = TelOrderClient::getInstance()->queryNeedIllnessTelOrderCnt('TelOrder', $telOwner->id); $waitTimeCnt = TelOrderClient::getInstance()->queryWaitTimeTelOrderCnt('TelOrder', $telOwner->id); $finishCnt = TelOrderClient::getInstance()->queryFinishTelOrderCount('TelOrder', $telOwner->id); $isTip = ($needIllnessCnt + $waitTimeCnt + $waitTelOrderCount > 0) ? 1 : 0; $isShowFreeButton = MainDataBucket::isShowPhoneButton($space, $waitTimeCnt, $waitTelOrderCount); $out = array('isTip'=>$isTip, 'needIllnessCnt'=>$needIllnessCnt, 'waitCnt'=>$waitTelOrderCount, 'waitTimeCnt'=>$waitTimeCnt, 'finishCnt' => $finishCnt, 'isShowFreeButton'=>$isShowFreeButton); $this->content = $out; }/*}}}*/