public function loadMoreCaseList($request, $response) {/*{{{*/ $caseStatus = $request->getRequest('status', ''); $response->caseStatus = $caseStatus; $nowPage = $request->getRequest('p', 1); $response->nowPage = $nowPage; $pager = new XPager($nowPage, self::PAGESIZE_CASE); list($caseList, $pageInfo) = ProposalClient::getInstance()->getProposalAndFlowList($this->user, $pager, $caseStatus); $response->caseList = $caseList; $response->pages = $pageInfo['pages']; $response->totalCaseCnt = $pageInfo['total']; $response->loadUrl = $response->touchUrl.'/mycase/loadmorecaselist?status='.$caseStatus.'&p='; }/*}}}*/
public function ajaxGenProposal($request, $response) { /*{{{*/ $tmpProposal = DAL::get()->mustFind('TemporaryProposal', $request->tmpid); $proposals = ProposalClient::getInstance()->createProposals(array($tmpProposal), $this->curInspector); foreach ($proposals as $proposal) { S3LogClient::getInstance()->add($this->curInspector, $proposal->getLogable()->action($this->getBuGroup($proposal->inspectGroup->id), $proposal->remark)); } ProposalClient::getInstance()->sellNewProposals($proposals, array(), $this->curInspector); return parent::DIRECT_OUTPUT; }
public function cancelPhoneCallOrder($userId, $orderId) {/*{{{*/ $proposal = $this->getRightObj($orderId); $user = DAL::get()->find('user', $userId); if ($user->isNull() || $user->id == 0) { $this->setErrorCode(107); return 0; } if($proposal->isNull()) { $this->setErrorCode(313); return 0; } if($proposal->user->id != $user->id) { $this->setErrorCode('314'); return 0; } if (false == $proposal instanceof Proposal || false == $proposal->isNormalStatus()) { $this->setErrorCode(315); return 0; } $serviceOrder = $this->getServiceOrder($proposal); if($serviceOrder->isNull() || false == $serviceOrder->isUnpaid()) { $this->setErrorCode('315'); return 0; } ProposalClient::getInstance()->activeCancel($proposal, $user); }/*}}}*/
private function checkFirstProposal($ref) { /*{{{*/ $firstProposal = ProposalClient::getInstance()->getFirstProposalOfFlow($ref->space->id, $ref->patient->id); if ($firstProposal instanceof Proposal && $firstProposal->isComplicatedToPickup() == false) { return true; } return false; }
private function unDispatchPost($weixUser, $proposalId) {/*{{{*/ $proposal = DAL::get()->find("Proposal", $proposalId); ProposalClient::getInstance()->releaseFirstFlowProductBySpace($weixUser->getSpace(), $proposal); }/*}}}*/
public function cancelBookingProposal($request,$response) {/*{{{*/ $proposal = DAL::get()->find('proposal', $request->proposalid); DBC::requireEquals($proposal->patient->user->id, $this->user->id, '您无权操作别人的订单!'); $bookingDto = BookingDto::createByProposalId($proposal->id); DBC::requireTrue($bookingDto->canCancel(), "您不能取消当前订单!"); ProposalClient::getInstance()->activeCancel($proposal, $this->user); $response->setRedirect($response->router->urlfor('proposal/showdetail', array('proposalid' => $request->proposalid) )); }/*}}}*/
<?php if (false == $space->isNull()) { $userCnt = ProposalClient::getInstance()->getUserProposalAndFlowCnt($user, $space); ?> <span class="f14 mb10"> <span class="tb">用户名:</span> <a href="/message/showsendsitemessage?userIds=<?php echo $user->id; ?> " target="_blank"><img src="http://i1.hdf img.com/msg/msg.gif"/></a> <a href="<?php echo $router->urlfor('intention/patient', array('c' => 'intention', 'a' => 'patient', 'userId ' => $user->id)); ?> " target="_blank" title="查看患者资料"><?php echo $user->name; ?> </a> (<a href="/?c=proposal&a=proposallist&userName=<?php echo $user->name; ?> &spaceName=<?php echo $space->user->name; ?> " target="_blank">方案<?php echo $userCnt['userProposalCnt']; ?>
/** * firstReply * 医生首次回复咨询方案,生成流 * * @param mixed $request * @param mixed $response * @author mq <*****@*****.**> * @access public * @return void */ public function firstReply($request, $response) { /*{{{*/ $proposal = DAL::get()->find('proposal', $request->id); if (false == $this->isSpaceLogin() || $this->_refuseNotIsUserCase($response, $proposal)) { throw new BizException('这条咨询已经不存在了!'); } $data = $this->getCasePostData($request); $flowId = ''; if ($this->checkPostContent($data)) { list($flowId, $postId) = ProposalClient::getInstance()->firstReply($proposal, $proposal->space, $data['content']); //加点 回复 根据角色加减积分 ScoreClient::getInstance()->reply($this->user, $proposal); } $nextUnreadUrl = rawurldecode($request->nextUnreadUrl); if (false == empty($nextUnreadUrl)) { $spaceAttr = DAL::get()->find_by_fld_spaceuserid_and_name('spaceAttribute', $this->space->id, Space::ATTR_FLOW_PROCESS); $flowProcess = $spaceAttr->isNull() ? SpaceAttribute::FLOW_PROCESS_FORWARD : $spaceAttr->value; if (SpaceAttribute::FLOW_PROCESS_FORWARD == $flowProcess) { $response->setRedirect($nextUnreadUrl); return; } } $flow = DAL::get()->find('DoctorPatientRef', $flowId); $response->setRedirect($flow->getUrl()); }
public function cancelBookingOrder($userId, $bookingOrderId) {/*{{{*/ $user = DAL::get()->find('user', $userId); if ($user->isNull()) { $this->setErrorCode(107); return 0; } $proposal = DAL::get()->find('proposal', $bookingOrderId); if ($proposal->isNull()) { $bookingOrder = DAL::get()->find('bookingOrder', $bookingOrderId); if ($bookingOrder->isNull()) { $this->setErrorCode(158); return 0; } $proposal = $bookingOrder->getBingLiSource(); } if($proposal->user->id != $userId) { $this->setErrorCode(159); return 0; } $bookingDto = BookingDto::createByProposalId($proposal->id); if (false == $bookingDto->canCancel()) { $this->setErrorCode(315); return 0; } ProposalClient::getInstance()->activeCancel($proposal, $user); }/*}}}*/
public function ajaxGetNextRecommendThread($request, $response) { /*{{{*/ $response->setHeader('Content-Type: application/json; charset=UTF-8'); $this->getLogger(); $canRecommend = $this->canRecommend(); $this->log->addDebug('canRecommend:' . (int) $canRecommend); if ($canRecommend) { $proposalIds = ProposalClient::getInstance()->autoPullRecommends($this->space); $this->log->addDebug('autoPullRecommends:', $proposalIds); if (false == empty($proposalIds)) { $cookie = new HdfCookie(); $cookie->set('firstlogintime', XDateTime::now(), 7 * 24 * 3600); $this->log->addDebug('firstlogintime:' . XDateTime::now() . '7*24*3600'); SpaceExpClient::getInstance()->createSpaceExp($this->user->id, XDateTime::now()); } } $unReadCount = FlowClient::getInstance()->getUnReadCount($this->space->id); echo "\n" . $request->callback . '(' . Json::encode($unReadCount) . ');'; return parent::DIRECT_OUTPUT; }
<a href="javascript:;" onclick="getRecommendByCategory(this)" id="<?php echo RecommendThreadController::RECOMMEND_THREADCATEGORY_ALL; ?> " <?php if (RecommendThreadController::RECOMMEND_THREADCATEGORY_ALL == $threadCategoryId) { ?> class="rec_change" <?php } ?> > <span class="blue4">全部</span> </a> </li> <?php foreach ($threadCategories as $category) { $pickupCount = ProposalClient::getInstance()->getPickupCountBySpace('proposal', $space, $category); ?> <li> <a href="javascript:;" onclick="getRecommendByCategory(this)" id="<?php echo $category->id; ?> " <?php if ($threadCategoryId == $category->id) { ?> class="rec_change" <?php } ?> > <span class="blue4"><?php echo $category->name; ?>
/** 显示方案的详细内容 */ public function caseDetail($request, $response) {/*{{{*/ $proposal = DAL::get()->find('Proposal', $request->case_id); $response->proposal = $proposal; $ref = FlowClient::getInstance()->getValidFlowRef($proposal->space->id, $proposal->patient->id); if ($proposal->isNormalStatus() && $ref instanceof DoctorPatientRef) { if (false == $proposal->isFinish()) { ProposalClient::getInstance()->markFinish($proposal); FlowClient::getInstance()->generateFlowOrAddItemToFlow($proposal->space, $proposal->patient, $proposal); } if($this->user->id != $ref->user->id) { DBC::requireFalse($ref->isPrivated(), '隐私数据您不能查看'); } $response->setRedirect($ref->getTouchUrl(), 301); return; } DBC::requireTrue(false == $proposal->isNull() && $proposal->user->id == $this->user->id, '隐私数据您不能查看'); $response->userSelfIsLogin = true; //space被删除后。原咨询逻辑 if ($proposal->hasSpace() && $proposal->space->isNull()) { $response->setRedirect($response->touchUrl, 301); } $response->doctor = $proposal->space->host; $diseaseTitle = implode('_', $proposal->getDiseases()); $response->title = (empty($diseaseTitle)? $diseaseTitle: $proposal->title)."_好大夫在线"; $response->topTitle = XString::truncate($diseaseTitle, 10); $response->caseSubTitle= $proposal->title; $response->userPrivateName = str_replace('*', '', $proposal->user->privateName); $response->bingliSet = $proposal->getBingLiSet(); //欲加到新意向上面的附件 $attachIds = array_filter(explode(',', $request->getRequest('attachIds', ''))); $response->currentAttachments = DAL::get()->find('PatientAttachment', $attachIds); $response->patient = $proposal->patient; }/*}}}*/
public function index($request, $response) { /*{{{*/ //about search $response->districtList = $this->districtList; $response->type = 'index'; $facultyList = array(); $secFacultyList = array(); $faculties = DAL::get()->find_all_by_mask('faculty', Faculty::ROOT_FACULTY_MASK); $secLevfaculties = DAL::get()->find_all_by_mask('faculty', '1000'); foreach ($faculties as $facultyId => $facutly) { $facultyList[$facultyId] = $facutly->name; } foreach ($secLevfaculties as $secLevFacultyId => $secLevFaculty) { $secFacultyList[$facultyList[$secLevFaculty->parentId]][] = $secLevFaculty->name; } $response->facultyList = $facultyList; $response->secFacultyList = $secFacultyList; //最新动态 $lastestProposals = ProposalClient::getInstance()->getValidProposalsOfTel(self::LATEST_STATUS_COUNT); $lastestOrders = array(); if (false == empty($lastestProposals)) { $lastestOrders = TelOrderClient::getInstance()->queryByProposalIds(array_keys($lastestProposals)); } $response->lastestProposals = $lastestProposals; $response->lastestOrders = $lastestOrders; //------------------------------------ //最近开通 $recentOpen = DoctorClient::getInstance()->getLatestOpenPhoneServiceInfo(self::RECENT_OPEN_DOC_COUNT); //最新服务列表 $response->recentOpen = $recentOpen; //----------------------------------- //右上方 $statistics = SpaceClient::getInstance()->getStatistics(); // 1. 成功通话的人数 $response->successCallPatientNum = $statistics['successtelserviceorders']; //2. 开通电话咨询的医生人数 $response->openCallDoctorNum = $statistics['opentelservicedoctors']; //----------------------------------------------- //热门疾病 $hotDiseaseList = PaymentClient::getInstance()->getHotDiseaseList(self::HOT_DISEASE_COUNT); //咱设置为显示8个标签 $hotDiseaseNameList = array(); $hotDiseaseUrl = array(); foreach ($hotDiseaseList as $k => $v) { $hotDiseaseNameList[] = $v->name; } $response->hotDiseaseNameList = $hotDiseaseNameList; //------------------------------------------- //拿到推荐专家那一块的所有数据 //$totalOpenNumsOfFaculty= array();//虚科室下开通电话咨询人数 数组 $otherFacultyDoctors = PaymentClient::getInstance()->getOtherFacultyDoctors(); $doctorList = array(); $recommendFacultyList = PaymentClient::getInstance()->getAll_by_sort('RecommendFaculty', 10); $facultyNames = array(); $doctorIds = $doctorObjects = array(); $tmpUserids = array(); $recommendDoctorList = PaymentClient::getInstance()->getAll_by_recommendfacultyid_sort('RecommendDoctor', array_keys($recommendFacultyList), 50); $otherDoctorList = PaymentClient::getInstance()->getAll_by_recommendfacultyid_sort('RecommendDoctor', array_keys($otherFacultyDoctors), 60); foreach ($recommendFacultyList as $key => $recommendFaculty) { foreach ($recommendDoctorList as $recommendDoctorId => $recommendDoctor) { if ($key == $recommendDoctor->recommendfaculty->id) { $doctorList[$key][] = $recommendDoctor->doctor; } $doctorIds[] = $recommendDoctor->doctor->primaryId; $doctorObjects[$recommendDoctor->doctor->id] = $recommendDoctor->doctor; $tmpUserids[] = $recommendDoctor->doctor->space->user->id; } $facultyNames[$recommendFaculty->faculty->id] = $recommendFaculty->faculty->name; } $doctorIds = array_unique($doctorIds); $tmpDoctorIds = array_flip($doctorIds); foreach ($otherDoctorList as $tmpDoctorId => $tmpDoctor) { if (count($doctorIds) >= 55) { break; } if (isset($tmpDoctorIds[$tmpDoctor->doctor->primaryId])) { continue; } $doctorList[0][] = $tmpDoctor->doctor; $doctorIds[] = $tmpDoctor->doctor->primaryId; $doctorObjects[$tmpDoctor->doctor->id] = $tmpDoctor->doctor; $tmpUserids[] = $tmpDoctor->doctor->space->user->id; } foreach ($facultyNames as $facultyId => $name) { $names[$facultyId] = DoctorClient::getInstance()->redirectFacultyname($name); } $response->openPhoneServiceCount = SpaceClient::getInstance()->getOpenPhoneServiceCount($names); $orderArray = PaymentClient::getInstance()->getLatestServiceList($doctorIds); $response->doctorListUrl0 = DoctorClient::getInstance()->getDoctorListUrl($doctorObjects, 60, 60); $response->orderArray = $orderArray; $response->recommendFacultyList = $recommendFacultyList + array(0 => '其它科室'); $response->doctorList = $doctorList; $response->flows = $this->orders2Flows($orderArray); $response->productList = ProductClient::getInstance()->getProductsBySpaceIds($tmpUserids, array(ServiceDef::TYPE_TELORDER)); //--------------------------------------- //患者反馈 $lastVisitOrders = PaymentClient::getInstance()->getLastVisitOrders(); $lastOrders = array(); foreach ($lastVisitOrders as $a) { $lastOrders[] = $a->order; } $lastFlows = $this->orders2Flows($lastOrders); $response->lastVisitOrders = $lastVisitOrders; $response->lastFlows = $lastFlows; //$returnVisits = PaymentClient::getInstance()->getReturnVisits(); // $response->returnVisits = $returnVisits; //医生分享 $shareDoctors = SpaceClient::getInstance()->getShareDoctorLists(); $recommendShareDoctors = PaymentClient::getInstance()->getDoctorSatisfactionList(array_keys($shareDoctors)); $response->doctorListUrl = DoctorClient::getInstance()->getDoctorListUrl($doctorObjects + $shareDoctors, 85, 85); $response->shareSatisfactionListDoc = $recommendShareDoctors; //根据登陆用户查看订单状态 $userOrders = array(); $noAssessCnt = 0; $response->userNotLogin = $this->_newUser->isNull(); if (false == $this->_newUser->isNull()) { $userProposals = array(); if (false == empty($this->_newUser->patientList)) { $options = array(); $options['limit'] = 5; $options['status'] = array(Proposal::STATUS_NORMAL); /** * 获取正常和已完成的方案 */ $userProposals = DAL::get()->find_all_by_servicedef_and_patientIds('Proposal', ServiceDef::TYPE_TELORDER, array_keys($this->_newUser->patientList), $options); if (false == empty($userProposals)) { $userOrders = TelOrderClient::getInstance()->queryByProposalIds(array_keys($userProposals)); } } $response->userProposals = $userProposals; $response->userOrders = $userOrders; //未评价数 $owner = $this->_newUser->getPaymentOwner(); if ($owner->isNull() == false) { $noAssessCnt = TelOrderClient::getInstance()->getNoAssessCnt('telorder', $owner->id); } } $response->noAssessCnt = $noAssessCnt; $commonHospital = $this->getCommonHospital(); $response->commonHospitalCnt = SpaceClient::getInstance()->getHospitalOpenPhoneServiceCnt($commonHospital['name']); $response->commonHospital = $commonHospital; $response->areaHospitalCnt = SpaceClient::getInstance()->getAreaOpenPhoneServiceCnt(); //新产品模式搜索 $response->provinces = Area::provInfoAll(); $response->ScoreDesc = TelVisit::$scoreDesc; }
public function dispatch($request, $response) { /*{{{*/ //当网速慢时,防止医生同一个问题领两次 $proposal = DAL::get()->find('proposal', $request->id); $space = $this->space; DBC::requireFalse($proposal->isNull(), '没有找到相关咨询'); DBC::requireFalse($space->isNull(), '没有找到相关空间'); if ($proposal->hasPickedUp()) { $response->setRedirect($proposal->getUrl4Space() . '?from_pool=1'); } else { ProposalClient::getInstance()->pickupBySpace($space, $proposal); $proposal = DAL::get()->find('proposal', $request->id, true); $response->setRedirect($proposal->getUrl4Space() . '?from_pool=1'); } }
<?php $userCnt = ProposalClient::getInstance()->getProposalAndFlowCntByUser($patient->user); ?> <div class="borderDiv detail-module" style="padding-bottom:0px;"> <div class="detail-module_splitter"> <div class="detail-module_title"> <h3>患者信息</h3> </div> <div class="detail-patientinfo"> <div class="detail-patientinfo_basic"> <span class="tb">id:</span> <?php echo $patient->id; ?> <span class="tb">姓名:</span> <?php echo $patient->name; ?> <span class="tb">出生年月:</span> <?php echo $patient->birthday; ?> <span class="tb">性别:</span> <?php echo Patient::getPatientSex($patient->sex); ?> <span class="tb">地区:</span><?php echo $patient->province; ?> <?php echo $patient->city; ?> <span style="margin-left:25px"><input style="height:30px;" type="button" value="查看操作记录" onclick="showHealthManageLog('<?php echo get_class($apply);
public function pullDailyRecommendThreads($spaceId) {/*{{{*/ $space = DAL::get()->find('space', $spaceId); if($space->isNull()) { $this->setErrorCode(328); return 0; } $firstLoginTime = ''; $spaceexp= DAL::get()->find_by_userid('spaceexp', $space->user->id); if(false == $spaceexp->isNull()) { $firstLoginTime = $spaceexp->firstLoginTime; } if(empty($firstLoginTime) || false == empty($firstLoginTime) && (XDateTime::hourDiff(XDateTime::valueOf($firstLoginTime),XDateTime::now()) > 24)) { $proposalIds = ProposalClient::getInstance()->autoPullRecommends($space); error_log("[".XDateTime::now()."] ".$space->user->name."\n", 3, "/tmp/mobile_autopull.log"); if (false == empty($proposalIds)) { SpaceExpClient::getInstance()->createSpaceExp($space->user->id, XDateTime::now()); } } }/*}}}*/
/** * dispatch 我来回答 * * @param mixed $id * @param mixed $userId * @access public * @return void */ public function dispatch($id, $userId) {/*{{{*/ $proposal = DAL::get()->find('proposal', $id); if ($proposal->isNull()) { $this->setErrorCode(195); return 0; } $space = DAL::get()->find('space', $userId); if($space->isNull()) { $this->setErrorCode(328); return 0; } $code = $this->isAllowedToDispatch($space, $proposal); if($code) { $this->setErrorCode($code); return 0; } ProposalClient::getInstance()->attachProposalBySpace($space, array($proposal->id), $space); $this->content = array('id'=>$id); }/*}}}*/