/** * getOrderDetail 订单详情 * * @param mixed $userId * @param mixed $orderId * @access public * @return void */ public function getOrderDetail($userId, $orderId) {/*{{{*/ $order = DAL::get()->find('TelOrder', $orderId); if($order->isNull()) { $this->setErrorCode(328); return 0; } $out = $this->getOrder($order, array()); $attachmentIds = array(); $infos = BingLiDtoClient::getInstance()->getBingLiByRelatedObj($order->notification->proposal); if(false == $order->getBingLiSource()->isNull()) { $out += $this->getBingliDetail($order->getBingLiSource()->id, get_class($order->getBingLiSource())); } if (false == empty($infos->patientAttachment)) { foreach ($infos->patientAttachment as $pa) { $attachmentIds[] = $pa->patientAttachmentId; $patientAttachment = DAL::get()->find('PatientAttachment', $pa->patientAttachmentId); $typeDesc = PatientAttachment::$typeList[$patientAttachment->type]; $out['checkProject'] = $patientAttachment->itemName ? $patientAttachment->itemName : ''; $out['bingliType'] = $typeDesc['name']; $out['checkTime'] = substr($patientAttachment->checkTime,0,11); } } foreach($attachmentIds as $attachmentId) { $out['attachments'][] = MainDataBucket::getAttachmentInfoByAttachId($attachmentId); } if(false == isset($out['attachments'])) { $out['attachments'] = array(); } $this->content = $out; }/*}}}*/
/** * getBookingOrder 医生查看订单详情 * @exampleUrl http://dev.mobile-api.haodf.com/doctorapi/bookingorder_getbookingorder?userId=105133781&bookingOrderId=1518927615&xdebug=1 * @param mixed $userId * @param mixed $bookingOrderId * @access public * @return void */ public function getBookingOrder($userId, $bookingOrderId) {/*{{{*/ $goals = array(1=>"检查/诊断", 2=>"治疗/手术", 3=>"检查/诊断 治疗/手术", 4=>"复诊", 5=>"检查/诊断 复诊", 6=>"治疗/手术 复诊", 7=>"检查/诊断 治疗/手术 复诊"); $space = DAL::get()->find('space', $userId); if($space->isNull()) { $this->setErrorCode(328); return 0; } $bookingOrder = DAL::get()->find('bookingorder', $bookingOrderId, true); if ($bookingOrder->isNull()) { $this->setErrorCode(158); return 0; } if($bookingOrder->space->id != $userId) { $this->setErrorCode(159); return 0; } $flow = DAL::get()->find_by_patientid_and_spaceid('DoctorPatientRef', $bookingOrder->patient->id, $bookingOrder->space->id); $attachmentIds = BingLiDtoHelper::create($bookingOrder->getBingLiSource())->patientAttachment->makeArray()->patientAttachmentId; $result = array(); $result['id'] = $bookingOrder->id; $result['schedule'] = date('Y-m-d H:i',strtotime($bookingOrder->schedule->toString())); $patient = $bookingOrder->patient; $result += $this->getBookingOrderPatientMessage($patient); $result += $this->getBingliDetail($bookingOrder->getBingLiSource()->id, get_class($bookingOrder->getBingLiSource())); $result['time'] = $bookingOrder->schedule; $result['address'] = $bookingOrder->getAddressFromBusinessRequireIfNone(); $helper = BingLiDtoHelper::create($bookingOrder->getBingLiSource()); $result['disease'] = $helper->getDiseasesStr(); $result['treatmentStatus'] = $helper->getLastUserCategory();//是否得到过该医生的诊治1是,0否 $result['purpose'] = isset($goals[$helper->getLastGoal()]) ? $goals[$helper->getLastGoal()] : '';//本次预约的目的 1诊察/诊断 2治疗/手术 3复诊 $result['lastTreatmentTitle'] = $helper->getLastUserCategoryDescription();//上次在大夫处就诊时间,最后一次就诊医院 两种情况 $lastTreatmentInfo = str_replace("•", "", $helper->getLastHospitalOrLastTreatedTime()); $result['lastTreatmentInfo'] = $lastTreatmentInfo; $result['recentTreatment'] = XString::getContentWithOutHtml($helper->getLastConditionDesc()); //病情描述 $result['status'] = $this->getBookingOrderStatus($bookingOrder); $result['buttonstatus'] = $this->getBookingOrderStatus4Doctor($bookingOrder); $result['flowtitle'] = ''; $result['flowId'] = ''; if(false == empty($attachmentIds)) { foreach($attachmentIds as $attachmentId) { $result['attachments'][] = MainDataBucket::getAttachmentInfoByAttachId($attachmentId); } } if(false == isset($result['attachments'])) { $result['attachments'] = array(); } if(false == $flow->isNull()) { $result['flowtitle'] = $flow->title; $result['flowId'] = $flow->id; $result['userId'] = $flow->space->user->id; $result['patientId'] = $flow->patient->id; } $this->content = $result; }/*}}}*/
private function _getFlowFollowupPostInfos($post, $key, $finalId) {/*{{{*/ $postInfo['postId'] = $post->id; $postInfo['title'] = ''; $postInfo['userId'] = $post->followupOwner->user->id; $postInfo['checkupInfo']['title'] = '患者: '.$post->followupOwner->patient->name.'('.$post->followupOwner->user->name.') 于'.$post->ctime->toShortString().'完成了---复查报告结果'; $postInfo['content'] = $post->content; $postInfo['postTime'] = substr($post->getSourceCtime4Flow(), 0, 16); $postInfo['adminComment'] = '请您查看患者检查结果,如果需要处理,请及时给予患者合理指导。'; $postInfo['latestId'] = $key; $postInfo['type'] = 'followuppost'; $postInfo['attachmentIds'] = implode($post->attachmentIds,","); foreach ($post->attachmentIds as $attachmentId) { $postInfo['attachments'][] = MainDataBucket::getAttachmentInfoByAttachId($attachmentId); } if(false == isset($postInfo['attachments'])) { $postInfo['attachments'] = array(); } $postInfo['presentImgUrl'] = ''; $postInfo['isFinal'] = 0; $postInfo['detailContent'] = ''; if($key == $finalId) { $postInfo['isFinal'] = 1; } $checkupInfos = $this->_getFollowupPost($post); $postInfo['checkupInfo']['infos'] = $checkupInfos; return $postInfo; }/*}}}*/