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; }/*}}}*/
public static function isShowPhoneButton($space, $waitTimeCnt, $waitTelOrderCount) {/*{{{*/ $isHoliday = self::isShowPhoneButtonByHoliday(); $isWorkDay = self::isShowPhoneButtonByWorkTime(); if($isHoliday || !$isWorkDay) { return 0; } $spaceMark = DAL::get()->find_by_spaceid('SpaceMark', $space->id); $isOpenedPhone = PaymentDataBucket::isOpenPhone($space); if($isOpenedPhone) //必须开通且有合同和产品 { //必须4级医生且 有待执行订单或待确认时间订单 if($space->host->isAdminLevel4() && ( $waitTimeCnt >0 || $waitTelOrderCount >0 )) { $isShowFreeButton = 1; }//标注预约困难且 有待执行订单或待确认时间订单 else if(($waitTimeCnt >0 || $waitTelOrderCount >0 )&& false == $spaceMark->isNull() && $spaceMark->bookingDifficulty == SpaceMark::BOOKING_HARD) { $isShowFreeButton = 1; } else { $isShowFreeButton = 0; } } else { $isShowFreeButton = 0; } return $isShowFreeButton; }/*}}}*/