コード例 #1
0
 public function getTelOrderInfo($postId)
 {/*{{{*/
     $info = array();
     $tel = DAL::get()->find('proposal', $postId);
     if ($tel->isNull())
     {
         $tel = DAL::get()->find('telorder', $postId);
     }
     if ($tel->isNull())
     {
         $this->setErrorCode(313);
         return 0;
     }
     if ($tel instanceof Proposal)
     {
         $paymentDatabucket = new PaymentDataBucket();
         $status = $paymentDatabucket->getStatus($tel);
         $nIds = DAL::get()->find_id_by_proposalid('Notification', $tel->id);
         $executions = TelOrderClient::getInstance()->getExecutionsByNotificationIds($nIds);
         $execution = new NullEntity();
         if(false == empty($executions))
         {
             $execution = array_pop($executions);
         }
         $info['content'] = array(
             array('item'=>'提交时间', 'itemValue'=> $tel->ctime), 
             array('item'=>'预约时间','itemValue'=> $execution->isNull() ? "未确定" : $execution->confirmStartTime->toString()), 
             array('item'=>'服务费','itemValue'=> strip_tags(round($tel->product->salePrice).'元/次(最长'.$tel->product->duration.'分钟)')),
             array('item'=>'订单状态','itemValue'=> $status), 
             array('item'=>'病情信息','itemValue'=> BingLiDtoHelper::create($tel)->getLastConditionDesc()), 
         ); 
     }
     else
     {
         $telBingLiSource = $tel->getBingLiSource();
         $telProductName = strip_tags($tel->getProductName());
         $info['content'] = array(
             array('item'=>'提交时间', 'itemValue'=> $tel->ctime), 
             array('item'=>'预约时间','itemValue'=> $tel->confirmStartTime->toString()), 
             array('item'=>'服务费','itemValue'=> substr_replace($telProductName, "", strpos($telProductName, "."), 3)),
             array('item'=>'订单状态','itemValue'=> $tel->getFlowShowStatus()), 
             array('item'=>'病情信息','itemValue'=> BingLiDtoHelper::create($telBingLiSource)->getLastConditionDesc()), 
         ); 
     }
     $info['title'] = '电话咨询';
     $this->content = $info;
 }/*}}}*/
コード例 #2
0
    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;
    }/*}}}*/
コード例 #3
0
    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;
    }/*}}}*/