/** * @brief 根据用户id电话订单列表 * @author whd * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/telorder_getTelOrderList?userId=581662815&pageId=1&pageSize=10&xdoc=1 * * @Param $userId 用户id * @Param $pageId 当前页码 * @Param $pageSize 每页显示数 * * @Returns array('id', 'sn', 'price', 'statusDesc', 'spaceId', 'doctorName', 'hospitalName', 'hospitalFacultyName', 'telTime', 'alertMsg', 'needPay', 'needComment', 'doctorAssistant', 'doctorAssistantTel'); */ public function getTelOrderList($userId, $pageId, $pageSize) {/*{{{*/ $this->_initPageInfo($pageId, $pageSize); $user = DAL::get()->find('user', $userId); if ($user->isNull() || $user->id == 0) { $this->setErrorCode(107); return 0; } $tmpTelList = TelDto::getList4UserMobile($user); $telList = array(); foreach ($tmpTelList as $tmpTel) { $telList[] = $tmpTel; } $start = ($pageId - 1) * $pageSize; $count = count($telList); $pageInfo = array('nowpage'=>$pageId, 'pagesize'=>$pageSize, 'total'=>$count, 'pages'=>ceil($count/$pageSize)); $this->pageInfo = $pageInfo; $telList = array_slice($telList, $start, $pageSize); $infos = array(); foreach($telList as $tel) { $info = array(); $info['id'] = $tel->id; $info['sn'] = $tel->id; $info['doctorAssistant'] = ''; $info['doctorAssistantTel'] = HdfPhoneNumber::PHONE_FENZHEN; $info['needPay'] = 0; if($tel instanceof Proposal) { $serviceOrder = DAL::get()->find_by_source('serviceorder', $tel); if(false == $serviceOrder->isNull()) { $info['id'] = $serviceOrder->id; $info['sn'] = $serviceOrder->id; if ($serviceOrder->isUnpaid() && $tel->isNormalStatus()) { $info['needPay'] = 1; } } $info['doctorAssistant'] = $tel->inspector->realName; } if ($tel instanceof Intention) { $info['telTime'] = '未确定'; if ($tel->isUnAudited() && false == $tel->isPaid()) { $info['needPay'] = 1; } } else { $serviceOrder = $this->getServiceOrder($tel); $telOrder = $this->getTelOrder($tel); if ($telOrder->isNull()) { $info['telTime'] = '未确定'; } else { $info['telTime'] = $telOrder->getTelTime(); if (false == $telOrder->isConfirmTime() && $serviceOrder->isPaid() && false == $tel->isCanceled() && false == $tel->isRefunded()) { $info['telTime'] = '医生助理正在努力为您联系医生'; } } } $info['alertMsg'] = ''; if ($tel->space instanceof Space) { $info['spaceId'] = $tel->space->id; $info['doctorName'] = $tel->space->host->name; $info['hospitalName'] = $tel->space->host->hospitalfaculty->hospital->commonName; $info['hospitalFacultyName'] = $tel->space->host->hospitalfaculty->name; } else { continue; } $info['price'] = round($tel->product->salePrice)."元/次(不超过".$tel->product->duration."分钟)"; $info['truePrice'] = round($tel->product->salePrice); $needComment = 0; $info['statusDesc'] = $this->getStatus($tel, $needComment); $info['needComment'] = $needComment; $infos[] = $info; } $this->content = $infos; }/*}}}*/
public function getPhoneCallOrderListByUserId($userId, $pageId, $pageSize) {/*{{{*/ $this->_initPageInfo($pageId, $pageSize); $user = DAL::get()->find('user', $userId); if ($user->isNull() || $user->id == 0) { $this->setErrorCode(107); return 0; } $telList = TelDto::getList4UserMobile($user); $start = ($pageId - 1) * $pageSize; $count = count($telList); $pageInfo = array('nowpage'=>$pageId, 'pagesize'=>$pageSize, 'total'=>$count, 'pages'=>ceil($count/$pageSize)); $this->pageInfo = $pageInfo; $telList = array_slice($telList, $start, $pageSize); $infos = array(); foreach($telList as $tel) { $info = array(); if($tel instanceof Proposal) { $serviceOrder = DAL::get()->find_by_source('serviceorder', $tel); if($serviceOrder->isNull()) { $info['id'] = $tel->id; $info['sn'] = $tel->id; } else { $info['id'] = $serviceOrder->id; $info['sn'] = $serviceOrder->id; } } else { $info['id'] = $tel->id; $info['sn'] = $tel->id; } $info['doctorName'] = $tel->space->name; $info['hospital'] = $tel->space->host->hospitalfaculty->hospital->commonName.$tel->space->host->hospitalfaculty->name; $needComment = 0; $info['status'] = $this->getStatus($tel, $needComment); $infos[] = $info; } $this->content = $infos; }/*}}}*/