public function index($request, $response) {/*{{{*/ $response->pendingcnt = TelOrderClient::getInstance()->getPendingCnt('TelOrder',''); $response->unconfirmTimeCnt = TelOrderClient::getInstance()->getUnconfirmTimeCnt('TelOrder'); $response->pendingcntforIswait = TelOrderClient::getInstance()->getPendingCnt('TelOrder',TelOrder::ISWAIT_YES); $response->pendingcntforIswaitToday = TelOrderClient::getInstance()->getPendingCnt('TelOrder',TelOrder::ISWAIT_NO,1); $response->unconfirmTimeCntforIswait = TelOrderClient::getInstance()->getUnconfirmTimeCnt('TelOrder',TelOrder::ISWAIT_YES); }/*}}}*/
public function addDiseaseDesc($request, $response) {/*{{{*/ $telOrder = DAL::get()->find('telOrder', $request->telOrderId); $attachmentIds = $request->attachIds; if(null == $attachmentIds) { $attachmentIds = $telOrder->attachmentIds; $diseaseDesc = $request->diseaseDesc; } else { $attachmentIds = $attachmentIds.$telOrder->attachmentIds; $diseaseDesc = $telOrder->diseaseDesc; } $telOrderId = $request->telOrderId; TelOrderClient::getInstance()->updateDiseaseDesc($telOrderId, $diseaseDesc, $this->user, $attachmentIds); //添加调用来源判断 从支付宝合作公共账号来在回到公共账号 $response->setRedirect($response->router->urlfor('telpayment/diseasedescription', array('telOrderId'=>$telOrderId))); }/*}}}*/
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; }/*}}}*/
private function dealAutoCreatedConfOrder($orderId, $teleConfOwnerId) {/*{{{*/ $lockName = "setconfowner{$orderId}"; try { $cacher= DAL::get()->getCache(Cacher::CACHETYPE_LOCKER); $locker = LockUtil::factory(LockUtil::LOCK_TYPE_MEMCACHE, array('memcache' => $cacher)); $locker->getLock($lockName); $confOwnerId = TelOrderClient::getInstance()->updateAdminUser4ConfOwner($teleConfOwnerId, $this->curUser); $locker->releaseLock($lockName); } catch(Exception $ex) { $locker->releaseLock($lockName); } return $teleConfOwnerId; }/*}}}*/
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; }/*}}}*/
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)); }
public function orderEventList($request, $response) {/*{{{*/ $request->page = $request->page?$request->page:1; $_pageSize = $request->pageSize?$request->pageSize:20; $response->type = $type = $request->type == null ? TelOrderEvent::TYPE_ALL : $request->type; $response->emergencytype = $emergencytype = $request->emergencytype == null ? TelOrderEvent::TYPE_EMERGENCY_ALL : $request->emergencytype; $response->status = $status = $request->status; $response->searchBeginTime = $request->searchBeginTime; $response->searchEndTime = $request->searchEndTime; $response->exeUserName = $exeUserName = $request->exeUserName; $searchBeginTime = $this->getSearchBeginTime($request); $searchEndTime = $this->getSearchEndTime($request); $params = array('searchBeginTime'=>$searchBeginTime, 'searchEndTime'=>$searchEndTime, 'status'=>$status, 'type'=>$type, 'emergencytype'=>$emergencytype, 'exeUserName'=>$exeUserName, 'paymentfront'=>true); if($request->spaceName) { $params['userIds'] = $this->searchSpace($request->spaceName); } $res = TelOrderClient::getInstance()->getOrderEventList($request->page, $_pageSize, $params); $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate("?spaceName={$request->spaceName}&searchBeginTime={$searchBeginTime}&searchEndTime={$searchEndTime}&type={$type}&status={$status}&emergencytype={$emergencytype}&exeUserName={$exeUserName}&page="), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']); $orderDetailCnt = array(); $patientInfoList = array(); if(false == empty($res['list'])) { $spaceIds = array(); foreach($res['list'] as $k=>$out) { $patientInfoList[$k]['patientName'] = ''; $patientInfoList[$k]['patientPhone'] = ''; $orderId = $this->getOrderIdFromRemark($out->remark); if(null != $orderId) { $order = DAL::get()->find('telorder', $orderId); $patientInfoList[$k]['patientName'] = $order->patient->userName; $patientInfoList[$k]['patientPhone'] = $order->patientPhone; } $spaceIds[] = $out->userid; } $orderDetailCnt = TelOrderClient::getInstance()->getSpaceListCnt('telorder', $spaceIds); } $response->offset = ($res['pageInfo']['nowpage']-1) * $res['pageInfo']['pagesize']; $response->pagelink = $pagelink; $response->orderEventList = $res['list']; $response->spaceName = $request->spaceName; $response->isWait = $this->getIsWait($request); $response->action = $request->action; $response->orderDetailCnt = $orderDetailCnt; $response->patientInfoList = $patientInfoList; }/*}}}*/
public function showTelOrderEventList($request, $response) { /*{{{*/ $currentUrl = "/spacebusinessrequirement/showtelordereventlist?"; foreach (self::$productApplyListParams as $p) { $response->{$p} = $request->{$p}; $currentUrl .= $p . '=' . $request->{$p} . '&'; } $currentUrl .= 'page='; $nowPage = $request->page > 1 ? $request->page : 1; $pageSize = 25; $options = array(); $options['searchBeginTime'] = $request->fromTime; $options['searchEndTime'] = $request->toTime; $options['status'] = $request->status; $spaceName = $request->spaceName; if (false == empty($spaceName)) { $spaceIds = SpaceClient::getInstance()->find_id_by_name_or_userName('Space', $request->spaceName); $options['userIds'] = $spaceIds; } $telorderEventList = TelOrderClient::getInstance()->getOrderEventList($nowPage, $pageSize, $options); $response->telorderEventList = $telorderEventList['list']; $response->pageLink = PageNav::getNavLink(PageNav::getPageNavTemplate($currentUrl), $telorderEventList['pageInfo']['nowpage'], $telorderEventList['pageInfo']['pagesize'], $telorderEventList['pageInfo']['total']); }
public function callPartner1($request, $response) {/*{{{*/ $orderid = $request->sId; $bindDoctorOwnerId = $request->bindDoctorOwnerId; $teleconfId = $request->teleconfId; $patientMobile = $request->patientmobile; TelOrderClient::getInstance()->modifyExcuteOrderPhone($this->curUser,$orderid,$patientMobile); MeetingClient::getInstance()->callPartner($teleconfId, $patientMobile, TeleconferencePartner::PARTNER1); $response->setRedirect('/paymentfront/telorder/orderexecutenew?orderid='. $orderid. '&bindDoctorOwnerId='. $bindDoctorOwnerId); }/*}}}*/
public function ajaxTelOrder4Space($request, $response) {/*{{{*/ $spaceId = $request->spaceId; $space = DAL::get()->find('space', $spaceId); $owner = DAL::get()->find_by_relatedObjectid('telowner',$space->id); DBC::requireFalse($owner->isNull(), 'telowner不存在'); $params = array('nowPage' => 0, 'pageSize' => 10, 'orderStatusType'=>$request->orderStatusType); //TelOrder::STATUS_CONFIRM $res = TelOrderClient::getInstance()->getOrderListForSpaceByType($owner->id, $params); $response->orderList = $res['telOrder']; }/*}}}*/
$openService = ''; if (false == $task->source->space->isNull()) { $showCaseMsg = ''; if (false == $task->source->space->isAsk()) { $showCaseMsg = '未开通/'; } $flowInfos = FlowClient::getInstance()->getSpaceReplyCountBySpaceIds(array($task->source->space->id)); $flowInfo = array_shift($flowInfos); $flowCount = empty($flowInfo['cnt']) ? 0 : $flowInfo['cnt']; $openService .= "网上咨询({$showCaseMsg}" . "{$flowCount})   "; $showPhoneMsg = ''; if (false == $task->source->space->isPhoneOpenedForFront()) { $showPhoneMsg = '未开通/'; } $options['status'] = array(TelOrder::STATUS_FINISHED, TelOrder::STATUS_CLOSED); $telOrderCount = TelOrderClient::getInstance()->getOrderCount4Space($task->source->space->id, $options); $openService .= "电话咨询({$showPhoneMsg}" . "{$telOrderCount})   "; $showBookMsg = ''; $spaceBusiness = DAL::get()->find_by_spaceid('spacebusinessrequirement', $task->source->space->id); if (false == $spaceBusiness->isBookingActuallyOpened()) { $showBookMsg = '未开通/'; } $bookingOrderInfo = PlussignChannelClient::getInstance()->getOrderCntOfSpaces(array($task->source->space->id)); $bookingOrderCount = $bookingOrderInfo[$task->source->space->id]; $openService .= "加号({$showBookMsg}" . "{$bookingOrderCount})   "; } ?> <td><span class="fl pl10"><?php echo $openService; ?> </span></td>
/** * updateTime 推迟时间 * * @param mixed $userId * @param mixed $orderId * @param mixed $time(-1,15,30,60) * @access public * @return void */ public function updateTime($userId, $orderId, $time) {/*{{{*/ $order = DAL::get()->find('TelOrder', $orderId); if($order->isNull()) { $this->setErrorCode(328); return 0; } $space = DAL::get()->find('space', $userId); $id = 0; if($time >0) { $confirmStartTime = XDateTime::valueOf($order->confirmStartTime)->addMinute($time); if($this->checkTime($confirmStartTime)) { $this->setErrorCode(328); return 0; } TelOrderClient::getInstance()->confirmTime($space->user, $orderId, $confirmStartTime, array('isSendSms' => false)); $remark = $time > 0 ? '订单: '.$this->getExecutionUrl($order).' 推迟'.$time.'分钟' : '订单: '.$this->getExecutionUrl($order).' 重新约时间'; $id = TelOrderTaskClient::getInstance()->createTelOrderTask4DoctorFromMobile($space->user, TelOrderTask::PRIORITY_URGENT, $remark, $order->id); } else { TelOrderClient::getInstance()->resetConfirmTime($space->user, $orderId); } $this->content = array('id'=>$id); }/*}}}*/
public function bindPatient($request, $response) {/*{{{*/ $order = DAL::get()->find('telorder', $request->orderId); DBC::requireTrue($order->owner->relatedObject->id == $this->_newUser->id, '无权访问此页'); $patientInfos = $request->patient; if (isset($patientInfos['id']) && $request->patient['id'] > 0) { $patient = DAL::get()->find('patient', $request->patient['id']); } else { $birthday = "{$request->dateyear}-{$request->datemonth}-{$request->dateday}"; $patientInfo['name'] = $request->patient['name']; $patientInfo['sex'] = $request->patient['sex']; $patientInfo['province'] = $request->patient['province']; $patientInfo['city'] = $request->patient['city']; $patientInfo['birthday'] = $birthday; $patientInfo['relation'] = $request->patient['relation']; $patientInfo['mobile'] = $request->patient['mobileOrEmail']; $patient = PatientClient::getInstance()->add($order->owner->relatedObject, $patientInfo); } TelOrderClient::getInstance()->bindPatient($order, $this->_newUser, $patient); $response->setRedirect($response->router->urlfor('payment/paymessage', array('orderId'=>$order->id))); return parent::DIRECT_OUTPUT; }/*}}}*/
{ $productList = ProductClient::getInstance()->getProducts($order->getSpace(), array(ServiceDef::TYPE_TELORDER)); } $price = array(); foreach($productList as $product) { $price[] = $product->salePrice."/".$product->duration; } $price = implode('; ', $price); $orderDetailCnt = TelOrderClient::getInstance()->getOrderDetailCnt('telorder', $order); //取电话的订单数目 $patientExt = $order->patient->getPatientExt(); $phone1 = isset($patientExt->phone1)?$patientExt->phone1:''; $phone2 = isset($patientExt->phone2)?$patientExt->phone2:''; $cntOfOrdersByPhone1 = TelOrderClient::getInstance()->getCntOfOrdersByPhone($phone1); $cntOfOrdersByPhone2 = TelOrderClient::getInstance()->getCntOfOrdersByPhone($phone2); $caseList = DAL::get()->find_all_by_userid('Thread', $order->user->id); $bookingOrderList = BookingClient::getInstance()->getUserBookingList($order->user->id); ?> <!-- start orderDetails--> <div class="orderDetails-t"> <div class="" style="background: none repeat scroll 0 0 #FFF8ED;"> <span class="red">订单号:</span> <span><a href="<?=$router->urlfor('telorder/orderdetail', array('orderId'=>$order->id))?>" target="_blank"><?=$order->id?></a></span> <span class="m5">下单时间:<?=$order->ctime->toString()?></span> <span class="ml5"> <?php if($order->getMinute()) {?> <?= $order->getMinute().'分钟 / '.$order->getPrice().'元' ?> <?php }?> <span class="ml5 fb"><?=$order->getStatusDesc() ?></span> </span>
} $flowInfos = FlowClient::getInstance()->getSpaceReplyCountBySpaceIds(array($space->id)); $flowInfo = array_shift($flowInfos); $flowCnt = empty($flowInfo['cnt']) ? 0 : $flowInfo['cnt']; if ($space->isAsk()) { $showCaseMsg = ''; } if ($space->isPhoneOpenedForFront()) { $showPhoneMsg = ''; } $spaceBusiness = DAL::get()->find_by_spaceid('spacebusinessrequirement', $space->id); if ($spaceBusiness->isBookingActuallyOpened()) { $showBookMsg = ''; } $options['status'] = array(TelOrder::STATUS_FINISHED, TelOrder::STATUS_CLOSED); $telOrderCnt = TelOrderClient::getInstance()->getOrderCount4Space($space->id, $options); $bookingOrderInfo = PlussignChannelClient::getInstance()->getOrderCntOfSpaces(array($space->id)); $bookingOrderCnt = $bookingOrderInfo[$space->id]; } if ($doctorOwner->isPreDoctor()) { $hospitalName = $doctorOwner->source->hospitalName; $hospitalFacultyName = $doctorOwner->source->facultyName; $doctorName = $doctorOwner->source->name; $doctorMsg = $hospitalName . '  ' . $hospitalFacultyName . '  ' . $doctorName; } else { if ($doctorOwner->isSpace()) { $hospitalName = $doctorOwner->source->host->hospitalfaculty->hospital->name; $hospitalFacultyName = $doctorOwner->source->host->hospitalfaculty->name; $doctorName = $doctorOwner->source->name; $doctorLevel = $doctorOwner->source->host->getAdminLevel2Show(); $doctorMsg = $hospitalName . '  ' . $hospitalFacultyName . '  ' . $doctorName . '  ' . $doctorLevel;
private function getTelOrder(Proposal $proposal) {/*{{{*/ $nIds = DAL::get()->find_id_by_proposalid('Notification', $proposal->id); $executions = TelOrderClient::getInstance()->getExecutionsByNotificationIds($nIds); $execution = new NullEntity(); if(false == empty($executions)) { $execution = array_pop($executions); } return $execution; }/*}}}*/
public function ajaxAgainSend($request, $response) {/*{{{*/ $id = $request->id; $invitelog = DAL::get()->find('invitelog', $id); SMSClient::getInstance()->sendSMS(array($invitelog->mobile), $invitelog->content, SMSLog::OPT_TYPE_TEL_ZIXUN); TelOrderClient::getInstance()->createInviteLog($invitelog->owner->id, $invitelog->mobile, $invitelog->content); return parent::DIRECT_OUTPUT; }/*}}}*/
public function loadMoreTelOrderList($request, $response) {/*{{{*/ $this->initialize($request, $response); $nowPage = $request->getRequest('p', 1); $pageSize = self::PAGESIZE_TEL; $telOwner = DAL::get()->find_by_relatedObject('telowner', $this->space->user); $res = TelOrderClient::getInstance()->getList(TelOrder::SEARCH_FINISHED_CLOSE, $nowPage, $pageSize, $telOwner->id); $response->telOrderList = $res['list']; $response->orderListNowPage = $nowPage; $response->orderListPages = $res['pageInfo']['pages']>5 ? 5 : $res['pageInfo']['pages']; $response->orderListLoadUrl = $response->touchUrl.'/doctor/loadmoretelorderlist?id='.$request->id.'&p='; }/*}}}*/
public function showOrderList($request, $response) { /*{{{*/ $orderId = $request->orderid; $status = $request->getRequest('type', 5); $page = $request->getRequest('page', 1); $pageSize = 20; $telOwner = DAL::get()->find_by_relatedObject('telowner', $this->space->user); $options = array(); $options['orderId'] = $orderId; if ($status != TelOrder::SEARCH_FINISHED_CLOSE) { $options['desc'] = 'asc'; } $res = TelOrderClient::getInstance()->getList($status, $page, $pageSize, $telOwner->id, $options); $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace("showorderlist?type={$status}&orderId={$orderId}&actionclass={$request->actionclass}&page="), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']); $telOrderList = array(); if (false == empty($res['list'])) { foreach ($res['list'] as $telOrderId => $telOrder) { if (false == $telOrder->notification->isPending()) { $telOrderList[$telOrderId] = $telOrder; } } } $response->telOrderList = $telOrderList; $response->orderId = $orderId; $response->pagelink = $pagelink; $response->type = $status; $response->actionClass = $request->getRequest('actionclass', 'telorder'); if ($status == 5) { $lastNotExeTelOrderId = $this->space->user->getTelOwner()->getLastNotExeTelOrder()->isNull() ? 0 : $this->space->user->getTelOwner()->getLastNotExeTelOrder()->id; setcookie("_telorder_lastview_id", $lastNotExeTelOrderId, time() + 3600 * 24 * 365, "/", ".haodf.com"); } }
public function doctordetail($request, $response) {/*{{{*/ if (is_numeric($request->id)) { $this->_exit404(); } $doctorId = (int)Codec::getInstance()->decodeId($request->id); if((int)$doctorId <= 0) { $this->_exit404(); } $doctor = DAL::get()->find('Doctor', $doctorId); if($doctor->isNull()) { $this->_exit404(); } $response->doctor = $doctor; $space = $doctor->space; $response->space = $space; $specialize = $doctor->specialize ? $doctor->specialize : "暂无医生擅长信息"; $specialize = str_replace("\n", '', $specialize); $specialize = strip_tags(str_replace("\r", '', $specialize)); $response->specialize = $specialize; $shortSpecialize = XString::truncate($specialize, 84); $shortSpecialize = str_replace("\n", '', $shortSpecialize); $shortSpecialize = strip_tags(str_replace("\r", '', $shortSpecialize)); $response->shortSpecialize = $shortSpecialize; $response->diseaseDoctorList = DiseaseClient::getInstance()->getDiseaseDoctorList(array($doctor->primaryId)); $response->thankLetterCount = $doctor->getCureThankLetterCount(); $response->processCount = $doctor->getCureExpCount(); $response->commentDoctor = $doctor->commentDoctor; $response->title =($doctor->hospitalfaculty->isNull()) ? $doctor->name."_好大夫在线" : $doctor->name."_".$doctor->hospitalfaculty->hospital->commonName.$doctor->hospitalfaculty->name."_好大夫在线"; $doctorSpaceIsOpened = $doctor->hasSpace() && $space->isOpened(); $response->doctorSpaceIsOpened = $doctorSpaceIsOpened; //电话咨询订单 $telOrderCnt = 0; if ($doctorSpaceIsOpened) { $telOwner = DAL::get()->find_by_relatedObject('telowner', $space->user); $res = TelOrderClient::getInstance()->getList(TelOrder::SEARCH_FINISHED_CLOSE, 1, 1, $telOwner->id); $telOrderCnt = $res['pageInfo']['total']; $response->telOrder = array_shift($res['list']); } $response->telOrderCnt = $telOrderCnt; $patientPhoneServiceRes = PaymentClient::getInstance()->getPatientPhoneServiceList($space->user->id, 1, 1, -1); $patientPhoneServiceList = $patientPhoneServiceRes['lists']; $ownerIds = array(); if (false == empty($patientPhoneServiceList)) { $patientPhoneService = reset($patientPhoneServiceList); $ownerIds[] = $patientPhoneService['ownerid']; } $response->phoneService = reset($patientPhoneServiceList); $response->ownerList = DAL::get()->find('telowner', $ownerIds); $response->goodDiseaseList = DiseaseClient::getInstance()->getDiseaseDoctorList(array($doctor->primaryId), 50); $response->VOTE_DISPLAY_LIMIT = self::VOTE_DISPLAY_LIMIT; }/*}}}*/
if ($schedule['type'] == '特需') { $scheduleStr .= $key1 . '特' . getHourStr($key2); } else { $scheduleStr .= $key1 . getHourStr($key2); } } } } $scheduleInfos[$doctorId] = $scheduleStr; } } $telOrderInfo = array(); $bookingOrderInfo = array(); $articleInfo = array(); if (false == empty($spaceIds)) { $telOrderInfo = TelOrderClient::getInstance()->getFinishedAndClosedOrderCnt('telorder', $spaceIds); $bookingOrderInfo = PlussignChannelClient::getInstance()->getOrderCntOfSpaces($spaceIds); $articleInfo = DAL::get()->queryValidArticleCnt('article', $spaceIds); } foreach ($searchIndex as $index) { $task = DAL::get()->find('hospitalcontactdoctortask', $index->id); $openService = ''; $articleCount = '无文章'; if (false == $task->source->space->isNull()) { $space = $task->source->space; $showCaseMsg = ''; if (false == $task->source->space->isAsk()) { $showCaseMsg = '未开通'; } else { $showCaseMsg = '开通'; }
public function showUpdateRelatedPod($request, $response) {/*{{{*/ $flowId = $request->flowid; $podId = $request->podid; if($podId) { $pod = DAL::get()->find('pod', $podId); } $flow = DAL::get()->find('doctorpatientref', $flowId); $disease = DAL::get()->find_by_fld_DiseaseName('disease', $flow->diseaseName); $birthdayInfo = array_filter(explode('-', $flow->patient->birthday)); if(empty($birthdayInfo) == false) { $response->year = isset($birthdayInfo[0]) ? $birthdayInfo[0] : ''; $response->month= isset($birthdayInfo[1]) ? $birthdayInfo[1] : ''; $response->day = isset($birthdayInfo[2]) ? $birthdayInfo[2] : ''; } $patientCaseNO = $this->getPatientHospitalCaseNo($flow); $telOrderCnt = TelOrderClient::getInstance()->getPhoneServiceCnt('telorder', $flow->patient->id, $flow->space->id, array('istreated'=>TelOrder::OUT_PATIENT_YES)); $isTreated = false; if($flow->isTreated || $telOrderCnt[0]['cnt']) { $isTreated = true; } //取默认疾病 $this->getRelatedDisease($flow, $response); //第一次就诊时间,服务类型 $this->getTreateTimeAndServiceType($flow, $response); $patientPhones = TelOwnerClient::getInstance()->getPatientPhones($flow->patient->id); $response->patientPhones = $patientPhones; $response->type = $request->type; $response->isTreated = $isTreated; $response->pod = isset($pod) ? $pod : '';; $response->flow = $flow; $response->patientCaseNO = $patientCaseNO; $response->disease = $disease; $response->space = $flow->space; }/*}}}*/
/** * @brief 用户反馈评价 * @author whd * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/telorder_addComment?userId=581662815&orderId=1262658043&score=1&content=abc&xdoc=1 * * @Param $userId 用户id * @Param $orderId 订单id * @Param $score 选项满意,一般,差的值 * @Param $content 内容 * * @Returns void */ public function addComment($userId, $orderId, $score, $content) {/*{{{*/ $user = DAL::get()->find('user', $userId); if ($user->isNull() || $user->id == 0) { $this->setErrorCode(107); return 0; } $tel = $this->getRightObj($orderId); if (false == $tel instanceof Proposal) { $this->setErrorCode(335); return 0; } $telOrder = $this->getTelOrder($tel); if ($telOrder->isNull()) { $this->setErrorCode(335); return 0; } if ($tel->user->id != $user->id) { $this->setErrorCode(314); return 0; } $params = array('score'=>$score, 'content'=>$content); TelOrderClient::getInstance()->updateVisitEvaluate($user, $telOrder->id, $params); }/*}}}*/
public function showDetail($request, $response) {/*{{{*/ $response->spaceModule = 'Case'; $ref = DAL::get()->find('DoctorPatientRef', $request->refid); $response->ref = $ref; if($ref->isNull()) { $response->exitJump($this->_newSpace->url, 301); } else if ($ref->isDeleted() || $ref->space->isHospitalFaculty()) { $response->setFor404(); $this->message('医患关系不存在!', $response); return false; } else if ($ref->isClosed()) { $this->message('医患关系已经关闭!', $response); return false; } else if ($ref->isPrivated() && $ref->isBrowser($this->_newUser)) { $response->setFor404(); $this->message('医患关系已经设为隐私!', $response); return false; } //设置标题 list($title, $flowTitle, $navigatorTitle) = FlowClient::getInstance()->getFlowTitle($ref, $ref->isBrowser($this->_newUser), $request->getRequest('p', 1)); $response->title = $title; $response->flowTitle = $flowTitle; $response->navigatorTitle = $navigatorTitle; $followupOwner = $ref->getFollowupOwner(); $response->followupOwner = $followupOwner; $canReplyFollowupOwner = ($followupOwner->isNull() == false && $followupOwner->isOpenFollowup()); $response->canReplyFollowupOwner = $canReplyFollowupOwner; if(false == $followupOwner->isNull()) { $medicineUserSchemes = MedicineClient::getInstance()->getUserCurrentMedicineScheme($followupOwner->user->id); $response->medicineUserSchemes = $medicineUserSchemes; } $response->ref = $ref; $chargeFlowList = FlowClient::getInstance()->getPaiedFlowListBySpace($ref->space, false, array($ref->id)); $response->canShowCharge = array_key_exists($ref->id, $chargeFlowList); if ($this->_newSpace->id != $this->_newUser->id) { $telOrderFlows = TelOrderClient::getInstance()->getTelOrderFlows($this->_newSpace->id); $response->canShowTel = (in_array($ref->id, $telOrderFlows)); $presentOrders = DAL::get()->find_by_spaceid_and_patientid_and_status('PresentOrder', $ref->space->id, $ref->patient->id, PresentOrder::STATUS_PAID_YES); $response->canShowPresent = !$presentOrders->isNull(); } if (false == $this->_newUser->isNull()) { if ($this->_newUser->id == $ref->space->user->id) { //医生本人视角 //先进行服务卡数据修复,给没有服务卡的老数据生成服务卡 ServiceCardClient::getInstance()->fixDataForNoServicecard($ref->space, $ref->patient); $this->detailForSpace($response, $request, $ref); $response->object = 'space'; } else if ($this->_newUser->id == $ref->user->id) { //患者本人视角 $this->detailForPatient($response, $request, $ref); $response->object = 'patient'; } else { //第三方视角 $this->detailForBrowser($response, $request, $ref); $response->object = 'browser'; } } else { // 非登陆视角 $response->isLogin = '******'; $this->detailForBrowser($response, $request, $ref); $response->object = 'browser'; } }/*}}}*/
public function showTelOrder($request, $response) { /*{{{*/ $phone = $request->getRequest('phone', ''); $telOrderList = array(); $pageSize = 20; $nowPage = $request->getRequest('pageId', 1); $response->pageLink = ''; $cashCoupons = array(); if ($phone) { $telOrderResult = TelOrderClient::getInstance()->getList(TelOrder::SEARCH_CLOSE, $nowPage, $pageSize, '', array('userPhone' => $phone)); $telOrderList = $telOrderResult['list']; $pageInfo = $telOrderResult['pageInfo']; $response->pageLink = PageNav::getNavLink(PageNav::getPageNavTemplate($response->router->urlfor('present/showtelorder', array('showContent' => 1, 'pageId' => ''))), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']); if (false == empty($telOrderList)) { foreach ($telOrderList as $telOrder) { $arr[] = $telOrder->patient->user->id; } $arr = array_unique($arr); $cashCoupons = PaymentClient::getInstance()->getCouponPriceByStatus('cashcoupon', $arr, CashCoupon::STATUS_CONFIRM); foreach ($cashCoupons as $key => $cashCoupon) { $cashCoupons[$cashCoupon['userid']][$cashCoupon['price']] = $cashCoupon['id']; unset($cashCoupons[$key]); } } } $response->cashCoupons = $cashCoupons; $response->telOrderList = $telOrderList; $response->phone = $phone; $response->message = $request->getRequest('message', ''); }
public function addResult4ExecuteInfo($request, $response) {/*{{{*/ foreach ($request->result as $id => $confirmresult) { $confirmresult = mb_convert_encoding($confirmresult, "gbk", "auto"); TelOrderClient::getInstance()->addResult4ExecuteInfo($id, $confirmresult); } return parent::DIRECT_OUTPUT; }/*}}}*/
private function dealDoneTelOrderCnt($request, $response, $doctorIds) { /*{{{*/ $doneTelOrderCnt = array(); if (false == empty($doctorIds)) { $spaceIds = DAL::get()->find_id_by_hostids_and_hosttype('Space', $doctorIds, 'Doctor'); $options['status'] = array(TelOrder::STATUS_FINISHED, TelOrder::STATUS_CLOSED); $doneTelOrderCnt = TelOrderClient::getInstance()->getOrderCount4Spaces($spaceIds, $options); } $response->doneTelOrderCnt = $doneTelOrderCnt; }
private function getFlowInfo($request, $response) { /*{{{*/ $res = FlowClient::getInstance()->getFlowAndThreadList($this->space, $this->user); $telOrderFlowIds = TelOrderClient::getInstance()->getTelOrderFlows($this->space->id); $chargeList = array(); if ($this->isSpaceLogin()) { $this->leftCaseDoctor($request, $response, $res); } else { $this->leftCaseBrowse($request, $response, $res, $telOrderFlowIds); $chargeList = FlowClient::getInstance()->getPaiedFlowListBySpace($this->space, false); } $response->lastPostList = $res['lastList']; $response->patientIdsOfFlower = $res['presentList']; $response->repliedCount = SpaceClient::getInstance()->getCountOfRepliedFlowsCount($this->space->id, $this->user->id); $response->chargeList = $chargeList; $response->telOrderFlowIds = $telOrderFlowIds; }
private function haveTelOrderFlows($response) {/*{{{*/ $response->telOrderFlows = TelOrderClient::getInstance()->getTelOrderFlows($this->_newSpace->id); }/*}}}*/
public function forward($request, $response) { /*{{{*/ $doctorId = $request->doctorId; $userName = $request->username; if (empty($doctorId) && empty($userName)) { $response->setRedirect("http://400.haodf.com"); } if (false == empty($doctorId)) { $doctorId = Codec::getInstance()->decodeId($doctorId); } else { $user = DAL::get()->find_by_name('user', $userName); $doctorId = $user->space->host->id; } $satisfactionLists = PaymentClient::getInstance()->getDoctorSatisfactionList($doctorId); $doctor = DAL::get()->find('doctor', $doctorId); //服务费 if (false == $doctor->isNull() && $doctor->hasSpace()) { $productList = ProductClient::getInstance()->getProductsBySpaceIds(array($doctor->space->id), array(ServiceDef::TYPE_TELORDER)); $productNames = array(); if (false == empty($productList[$doctor->space->id])) { foreach ($productList[$doctor->space->id] as $product) { $productNames[] = $product->getNameOfPriceDesc() . $product->getAppendNameOfRemark(); } } $serviceCharge = implode('、', $productNames); } else { $response->setRedirect('http://' . URL_PREFIX . '400.haodf.com'); return; } if ($doctor->hasSpace() && !$doctor->space->isPhoneOpenedForFront($this->_newUser->id)) { $response->setRedirect('http://' . URL_PREFIX . '400.haodf.com/index/prompt?doctorName=' . rawurlencode($doctor->name) . '&doctorFaculty=' . rawurlencode($doctor->hospitalfaculty->faculty->name)); return; } $this->skipHospitals($doctor->hospitalfaculty->hospital->id, $response); $this->skipDoctors($doctor->id, $response); $user = DAL::get()->find("user", $doctor->space->user->id); if ($doctor->isnull() == false) { $headImageUrl = $doctor->getLargeHeadImage(); } else { $headImageUrl = "http://i1.hdfimg.com/my/img/doctor_default_96.gif"; } //好评疾病 $diseaseList = DiseaseClient::getInstance()->getDiseaseDoctorList(array($doctor->primaryId), 50); $hospitalFacultyDoctorIds = array(); $facultyDoctorIds = array(); if ($doctor instanceof Doctor) { $hospitalFacultyDoctorIds = DoctorClient::getInstance()->getHospitalFacultyDoctorLimit3($doctor); $facultyDoctorIds = DoctorClient::getInstance()->getFacultyDoctorLimit6($doctor); } $facultyDoctorIds = array_diff($facultyDoctorIds, $hospitalFacultyDoctorIds); $num = count($facultyDoctorIds); $facultyDoctorIds = array_slice($facultyDoctorIds, 0, 3); $response->num = $num; $hospitalFacultyDoctorList = DAL::get()->find('doctor', $hospitalFacultyDoctorIds); $facultyDoctorList = DAL::get()->find('doctor', $facultyDoctorIds); $interestDoctor = count($facultyDoctorList); $response->interestDoctor = $interestDoctor; $doctorFaculty = $doctor->hospitalfaculty->name; $response->doctorFaculty = $doctorFaculty; $response->hospitalFacultyDoctorList = $hospitalFacultyDoctorList; $response->facultyDoctorList = $facultyDoctorList; $response->casetotal = PaymentClient::getInstance()->getDoctorVoteCnt($doctor->space->id); $response->diseaseList = $diseaseList; $response->doctor = $doctor; $response->doctorId = $doctor->id; $response->userId = $doctor->space->user->id; $response->satisfactionLists = $satisfactionLists; $response->headImageUrl = $headImageUrl; $response->user = $user; $response->serviceCharge = $serviceCharge; $response->ScoreDesc = TelVisit::$scoreDesc; $owner = DAL::get()->find_by_relatedObjectid_and_relatedobjecttype('telowner', $doctor->space->id, TelOwner::TYPE_USER); $response->owner = $owner; $response->doctorWords = $owner->isNull() || $owner->getSpaceExt() == '' ? '' : $owner->getSpaceExt()->getDoctorWords(); $response->wordLength = $owner->isNull() || $owner->getSpaceExt() == '' ? '' : strlen($owner->getSpaceExt()->getDoctorWords()); $goodCnt = PaymentClient::getInstance()->getPatientPhoneServiceCountByScore($doctor->space->id, TelVisit::SCORE_GOOD); $normalCnt = PaymentClient::getInstance()->getPatientPhoneServiceCountByScore($doctor->space->id, TelVisit::SCORE_SOSO); $badCnt = PaymentClient::getInstance()->getPatientPhoneServiceCountByScore($doctor->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; $latestOpenCallServiceTitle = doctorOutline::getLatestOpenCallServiceTitle($owner->spaceExt->starttime4tel->toString()); $response->latestOpenCallServiceTitle = $latestOpenCallServiceTitle; // 常见问题 $response->commonQuestions = $owner->isNull() || $owner->getSpaceExt() == '' ? '' : $owner->getSpaceExt()->commonquestions; $options['status'] = array(TelOrder::STATUS_FINISHED, TelOrder::STATUS_CLOSED); $response->telOrderCount = TelOrderClient::getInstance()->getOrderCount4Space($doctor->space->id, $options); }