/**
  * checkNotice  接收来自第三方的电话咨询订单验证消息
  * 
  * @access public
  * @return void
  */
 public function checkNotice()
 {/*{{{*/
     $data = file_get_contents("php://input");
     if(empty($data))
     {
         echo json_encode(array('errno' => 2, 'detail' => iconv("GBK", "UTF-8", '数据为空')));
         exit;
     }
     $arrData = json_decode($data, true);
     $type = $arrData['type'];
     $postData = $arrData['postdata'];
     $partnerTelOrder = DAL::get()->find_by_tradeid('partnertelorder', $postData['trade_id']);
     if(false == $partnerTelOrder->isNull())
     {
         $telOrder = DAL::get()->find('telorder', $partnerTelOrder->orderId); 
         if(false == $telOrder->isNull())
         {
             if(($type == '2' && $telOrder->isRefund()) || ($type == '1' && $telOrder->isFinished()))
             {
                 echo json_encode(array('errno'=>'0')); 
                 ScoreClient::getInstance()->createIntegralLog(User::ADMIN_USERID, $partnerTelOrder->tradeId, IntegralLog::BAIDUZHIDAO_PHONE_DRAWBACK_SUCCESS);
                 exit;
             }
         }
     }
     echo json_encode(array('errno'=>'1')); 
     ScoreClient::getInstance()->createIntegralLog(User::ADMIN_USERID, $partnerTelOrder->tradeId, IntegralLog::BAIDUZHIDAO_PHONE_DRAWBACK_FAIL);
     exit;
 }/*}}}*/
Пример #2
0
 private function modifyScore($thread, $post, $user)
 {/*{{{*/
     ScoreClient::getInstance()->reply($user, $thread);
     $result = ScoreClient::getInstance()->goodAsk($thread);
     if($result)
     {
         $subject = '奖励咨询点';
         $score = Event::getPatientAmount('goodAsk');
         $messageContent = '由于您详细填写病情资料,系统奖励:<span class="orange">+ '.$score.'咨询点</span><br><br>本奖励咨询点可用于向大夫提问问题<br>';
         StationLetterClient::getInstance()->sendMsg(Auditor::ADMIN_USER_ID, array($thread->user->id), $subject, $messageContent);
     }
 }/*}}}*/
 private function flowAndFollowUpMessage($request, $response)
 {
     /*{{{*/
     $doctorPatientRef = DAL::get()->find('doctorPatientRef', $request->refId);
     $ticketId = $request->ticketId;
     $response->repealServiceCards = DAL::get()->find_all_by_SpaceAndPatientOfRepealServiceCard('servicecard', $doctorPatientRef->space, $doctorPatientRef->patient, ServiceDef::TYPE_FLOW);
     $nowPage = $request->getRequest('p', 1);
     $allFlowInfos = FlowClient::getInstance()->getAllFlowInfos($doctorPatientRef->space->id, $doctorPatientRef->patient->id, array('includeDeleteData' => true));
     $doctorPatientRef->checkRefCnt();
     $isFlow = $request->isFlow ? 15 : 10;
     $pageSize = $request->page ? count($allFlowInfos) : $isFlow;
     $response->page = $request->page ? $request->page : 0;
     $showAll = true;
     if (false == $response->page && count($allFlowInfos) > $isFlow) {
         $showAll = false;
     }
     $response->showAll = $showAll;
     $options = array();
     $options['flowOrder'] = SpaceAttribute::FLOW_ORDER_DESC;
     $options['isAll'] = true;
     $options['noUpdate'] = true;
     $flowList = FlowClient::getInstance()->getFlowInfos($doctorPatientRef->id, $nowPage, $pageSize, $options);
     $response->flowList = $flowList['objects'];
     //通过流id取到收费postIds
     $response->chargePostIds = ServiceCardClient::getInstance()->querySameServiceTypeAndUnfreeServiceAppIds($doctorPatientRef->space, $doctorPatientRef->patient, ServiceDef::TYPE_FLOW);
     $response->doctorPatientRef = $doctorPatientRef;
     $scoreAmounts = ScoreClient::getInstance()->getScoreByUserIdGroupByCate($doctorPatientRef->user->id);
     $response->scoreAmount = $scoreAmounts[Account::CATE_INTEGRAL][Account::TYPE_PRESENT] + $scoreAmounts[Account::CATE_INTEGRAL][Account::TYPE_NORMAL];
     $ticket = DAL::get()->find('Ticket', $ticketId);
     $response->ticket = $ticket;
     //标注异常
     $response->abnormalStatus = $this->getAbnormalStatus($flowList['objects']);
     $page = $request->page;
     if (empty($page)) {
         $page = 1;
     }
     $params = array();
     $params['doctorpatientrefid'] = $doctorPatientRef->id;
     $params['nowPage'] = $page;
     $params['pageSize'] = $pageSize;
     $res = DoctorPatientPostClient::getInstance()->getPostList($params);
     $postList = $res['postList'];
     $postIds = array_keys($postList);
     $response->keyWords = array();
     $response->postList = $postList;
     $response->pageLink = '';
     if (false == empty($res['pageInfo']) && $ticketId) {
         $response->pageLink = PageNav::getNavLink(PageNav::getPageNavTemplate('/nfsaudit/nexttask?ticketId=' . $ticketId . '&page='), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']);
     }
     $proposalIds = DAL::get()->querySpacePatientProposals('proposal', $doctorPatientRef->space, array($doctorPatientRef->user->id), $doctorPatientRef->patient->id);
     $threadParentCategoryName = '未知';
     $proposal = NullEntity::create();
     if (false == empty($proposalIds)) {
         $proposal = DAL::get()->mustFind('proposal', array_pop($proposalIds));
         $threadParentCategory = DAL::get()->find('ThreadCategory', $proposal->category->parentId);
         if (false == $threadParentCategory->isNull()) {
             $threadParentCategoryName = $threadParentCategory->name;
         }
     }
     $response->proposal = $proposal;
     $response->threadParentCategoryName = $threadParentCategoryName;
     //随访信息,目前一个医生有一个随访卡,但未来会有多个,暂时只查询一条显示(产品gjb确认)
     $patientCard = DAL::get()->find_by_spaceid('PatientCard', $doctorPatientRef->space->id);
     if (false == $patientCard->isNull()) {
         $response->followupAuditor = DAL::get()->find_by_auditorid('FollowupAuditor', $this->auditor->id);
         $owner = DAL::get()->find_by_spaceid_and_patientid('FollowupOwner', $patientCard->space->id, $doctorPatientRef->patient->id);
         $userScheme = new NullEntity();
         if ($owner->isNull() == false) {
             $userScheme = HealthRecordClient::getInstance()->getPatientSigninScheme($owner->id);
         }
         $response->userScheme = $userScheme;
         if ($doctorPatientRef->space->isOpenFollowup()) {
             $response->owner = $owner;
         }
     }
     $postTicketList = $response->postTicketList == null ? array() : $response->postTicketList;
     $this->attachmentList($request, $response, $postList, $postTicketList);
     $response->postTicketList = $postTicketList;
 }
    private function checkPriceVaild4PresentOrder($userId, $price, $orderId)
    {/*{{{*/
        $presentOrder = DAL::get()->find('presentorder', $orderId);
        if ($presentOrder->isNull())
        {
            return true;
        }
        $user = DAL::get()->find('user', $userId);
        DBC::requireFalse($user->isNull(), '无效的用户');
        $cashAccount = $user->getCashAccount();
        DBC::requireFalse($cashAccount->isNull(), '现金账户不能为空');

        $scoreAccounts = ScoreClient::getInstance()->getScoreByUserIdGroupByCate($user->id);
        $integral = $scoreAccounts[Account::CATE_INTEGRAL][Account::TYPE_NORMAL]+$scoreAccounts[Account::CATE_INTEGRAL][Account::TYPE_PRESENT];
        $payAmount = ceil(Account::integral2money($presentOrder->present->price - $integral)) - floor($cashAccount->amount);
        if ($payAmount <= 0)
        {
            return true;
        }
        DBC::requireTrue((int)($price * 100) >= (int)($payAmount * 100) , '充值的金额无法支付礼物订单,请重新确认充值金额');
    }/*}}}*/
Пример #5
0
 /**
  * @brief 
  * @author lhl
  * @version branches/v2.14.23
  * @date 2013-07-25
  */
 private function modifyScore($ref)
 {
     /*{{{*/
     ScoreClient::getInstance()->replyForFlow($this->user, $ref);
     //判断是否是患者回复,如果是患者回复则设 cookie,为了在detail页面上做判断
     if ($ref->user->id == $this->user->id) {
         $cookie = new HdfCookie();
         $cookie->set('replyCase', 1, 600);
     }
 }
Пример #6
0
 private function getDoctorInfo($request, $response)
 {
     /*{{{*/
     //科室数
     $response->belongDoctors = DoctorClient::getInstance()->getDoctorList4space($this->space->user->id);
     // 感谢信数量
     $thankLetterCount = 0;
     if ($this->space->isDoctor()) {
         $thankLetterCount = $this->space->host->getCureThankLetterCount();
     }
     $response->thankLetterCount = $thankLetterCount;
     //礼物数
     $response->presentCnt = PresentClient::getInstance()->getCntOfPresent($this->space->id);
     //贡献值
     $res = ScoreClient::getInstance()->getScoreByUserIdGroupByCate($this->space->id);
     if (isset($res[Account::CATE_SCORE][Account::TYPE_PRESENT])) {
         $response->contributionAmount = $res[Account::CATE_SCORE][Account::TYPE_PRESENT];
     } else {
         $response->contributionAmount = 0;
     }
     //爱心图片
     list($featAmount, $heartImgHtml) = ScoreClient::getInstance()->showFlagsforPage($this->space->user->id);
     $response->heartImgHtml = $heartImgHtml;
     //爱心值
     $response->featAmount = $featAmount;
 }
Пример #7
0
    private function spaceReplyCase4Flow(DoctorPatientRef $ref, $options, $attachmentIds, $user, $content) 
    {/*{{{*/
        if(false == $ref->isSpaceCanPost())
        {
            $this->setErrorCode(842);
            return 0;
        }
        if ($ref->isClosePost()) 
        {
            DoctorPatientPostClient::getInstance()->switchPatientPostCan($ref->space->user->id, $ref->id);
        }
        if($ref->replyLimitationIsApproaching())
        {
            $option['removeReplyLimitation']  = isset($options['removeReplyLimitation']) ? $options['removeReplyLimitation'] : 0;
        }
        if(isset($option['removeReplyLimitation']) && $option['removeReplyLimitation'])
        {
            if($ref->space->isChargeOpened())
            {
                //当是收费咨询的时候,取消remove参数。因为传0或者1都会在addPost再次改变次数
                unset($option['removeReplyLimitation']);
                FlowClient::getInstance()->addFreeServcieCardBySystem($ref);
            }
        }

        //加入默认患友会
        if($user->id == $ref->space->user->id
        && $ref->space->isPatientOpened()
            && $ref->isReGroupMember() == false)
        {
            FlowClient::getInstance()->addUserToDefaultReGroup($ref->id, $user->id);
        }

        $attachmentIds = explode(',', $attachmentIds);
        $option['attachmentIds'] = $attachmentIds;
        if(isset($options['isPrivated']) && $options['isPrivated'])
        {
            $option['isPrivated'] = true;
        }
        $post = DoctorPatientPostClient::getInstance()->addPost($ref->id, $user->id, $content, $option);
        DBC::requireFalse($post->isNull(), '系统繁忙,请稍后重试');
        if (false == $post->isNull())
        {
            ScoreClient::getInstance()->replyForFlow($user, $ref);
        }
        try{
            FlowClient::getInstance()->addLog($ref, $user, DoctorPatientLog::TYPE_SYSTEM_LOG, 'CaseDataBucket::spaceReplyCase', $post);
        }catch(Exception $ex)
        {}
        return $post;
    }/*}}}*/
Пример #8
0
    public function postDeletePost($request, $response)
    {/*{{{*/
        $post = DAL::get()->find('post', $request->postid);
        if($post->isNull()){
            $this->message('咨询对话不存在', $response);
            return false;
        }
        postClient::getInstance()->delete($post->user,$post->thread->id, $post->id);
        //删除回复  扣回积分
        ScoreClient::getInstance()->doctorDeletePost($post->id);

        $this->message('咨询对话已经被删除了', $response, array(
            'buttons' => array(
                array('text' => '返回问题', 'url' => $post->thread->getUrl())
            ),
        ));
    }/*}}}*/
Пример #9
0
 private function recordWapUser($user, $app, $os)
 {/*{{{*/
     $wapUser = DAL::get()->find_by_userid_and_os('wapuser', $user->id, $os);
     if($wapUser->isNull() && 'haodf' == $app)
     {
         ScoreClient::getInstance()->createWapUser($user->id, $os);
     }
 }/*}}}*/
Пример #10
0
    public function doRechargeToSysAccount($request, $response)
    {/*{{{*/
        $amount = $request->amount;
        DBC::requireTrue(($amount >= 0), 'amount 不能小于0');
        DBC::requireTrue(is_numeric($amount), 'amount 必须是数字');
        $sysAccountType = $request->sysaccount;
        $message = '充值成功';

        if(in_array($sysAccountType, PayAccount::$needRechaegeAccount))
        {
            $userId = PayAccount::$sysAccountUsers[$sysAccountType];
            if($userId == Account::PHONE_FOUND_USER_ID)
            {
                $operator = UserClient::getInstance()->getCurrentUser();
                AccountClient::getInstance()->rechargeToPhoneAccount($userId, $amount, $operator);
            }
            else
            {
                ScoreClient::getInstance()->rechargeToSysAccount($userId, $request->amount);
            }
        }
        else
        {
            $message = '所选账户不能充值';
        }

        $response->setRedirect($response->router->urlfor('account/rechargetosysaccount', array('message'=>$message)));
    }/*}}}*/
<?php
$isPresent = ($from == Pay::ORDER_TYPE_PRESENT && false == empty($presentOrder));
$scoreAccounts = ScoreClient::getInstance()->getScoreByUserIdGroupByCate($user->id);
$integral = $scoreAccounts[Account::CATE_INTEGRAL][Account::TYPE_NORMAL]+$scoreAccounts[Account::CATE_INTEGRAL][Account::TYPE_PRESENT];
if($isPresent)
{
     $ceilPrice = (ceil(Account::integral2money($price-$integral)) > floor($user->getCashAccount()->amount))?ceil(Account::integral2money($price-$integral)) - floor($user->getCashAccount()->amount):0;
}
else
{
    $ceilPrice = $price > floor($user->getCashAccount()->amount) ? ($price-floor($user->getCashAccount()->amount)) : 0;
}

$product = ProductClient::getInstance()->getDoctorChargeFlowProduct($space);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<title>账户资金查询</title>
<!--for update headimg-->
<link href="<?php echo $imgUrl; ?>/css/css.css?110418" rel="stylesheet" type="text/css" />
<link href="http://i1.hdfimg.com/css/base.css?2012052401" rel="stylesheet" type="text/css" />
<link href="http://i1.hdfimg.com/nav/nav.css?1303460346" rel="stylesheet" type="text/css"/> 
<link type="text/css" rel="stylesheet" href="http://i1.hdfimg.com/userspace/css/scenter.css?1361946205" />
<link href="http://i1.hdfimg.com/400/css/n_business.css" rel="stylesheet" type="text/css">
<link href="http://i1.hdfimg.com/userspace/css/recharge.css?1350483481" rel="stylesheet" type="text/css">
<link type="text/css" rel="stylesheet" href="http://i1.hdfimg.com/space/present/present.css?1358357448" />
<script type="text/javascript" src="http://i1.hdfimg.com/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://i1.hdfimg.com/userspace/js/scenter.js?2012020"></script>
<script type="text/javascript" src="http://i1.hdfimg.com/space/doctor/scripts/global.js?1374591589"></script>
    /**
        * @brief 提交咨询意向
        * @author cs
        * @exampleUrl  dev.mobile-api.haodf.com/patientapi/intention_newCaseWithPatient?userId=581662815&doctorId=238324&title=xxx&tag=xxx&content1=xxx&content2=xxx&content3=xxx&attachmentIds=&deviceType=android&patientId=1163360744
        *
        * @Param $userId 用户id
        * @Param $doctorId 咨询医生id
        * @Param $title 标题
        * @Param $tag 疾病
        * @Param $content1 内容1
        * @Param $content2 内容2
        * @Param $content3 内容3
        * @Param $attachmentIds 附件ids(逗号分割)
        * @Param $deviceType 设备类型 
        * @Param $patientId 患者id
        *
        * @Returns   
     */
    public function newCaseWithPatient($userId, $doctorId, $title, $tag, $content1, $content2, $content3, $attachmentIds, $deviceType, $patientId)
    {/*{{{*/
        if($this->isThreadServiceSuspendTime())
        {
           $this->setErrorCode(901); 
           return 0;
        }
        $user = DAL::get()->find('user', $userId);
        if ($userId <=0 || $user->isNull())
        {    
            $this->setErrorCode(107);
            return 0;
        }    
        $patient = DAL::get()->find('patient', $patientId);
        if ($patient->isNull())
        {
            $this->setErrorCode(316);
            return 0;
        }
        if(false == isset($user->patients[$patient->id]))
        {
            $this->setErrorCode(316);
            return 0;
        }
        $askSpace = new NullEntity();
        if ($doctorId == 'null')
        {
            $doctorId = 0;
        }

        if($doctorId)
        {
            $doctor = DAL::get()->find('doctor', $doctorId);
            if($doctor->isNull())
            {
                $this->setErrorCode(132);
                return 0;
            }
            $askSpace = $doctor->space;
            if($askSpace->isNull())
            {
                $this->setErrorCode(144);
                return 0;
            }
            try
            {
                SpaceClient::getInstance()->ensureAllowAskRule($user, $askSpace);
            }
            catch(Exception $ex)
            {
                $this->setErrorCode(320);
                return 0;
            }
        }
        $title = htmlspecialchars_decode($title, ENT_QUOTES);
        $tag = htmlspecialchars_decode($tag, ENT_QUOTES);
        if(mb_strlen(XString::cntrim($title)) < 5 || mb_strlen(XString::cntrim($title)) > 10)
        {
            $this->setErrorCode(167);
            return 0;
        }
        if(mb_strlen(XString::cntrim($tag)) < 1 || mb_strlen(XString::cntrim($tag)) > 20)
        {
            $this->setErrorCode(304);
            return 0;
        }

        $content = $content1;
        if ($content2)
        {
            $content .= "\n\n曾经治疗情况和效果:\n\n".$content2;
        }
        $attachmentArrs = $attachmentIds ? explode("," , $attachmentIds) : array(); 
        $deviceType = ($deviceType  == 'Android') ? Intention::SRC_ANDROID : Intention::SRC_IOS;

        $intention = IntentionClient::getInstance()->add4ThreadFromWap($patient, $askSpace, $deviceType, '', $content, $attachmentArrs, $tag, $title, '', $content3);
        if ($intention->isNull())
        {
            $this->setErrorCode(169);
            return 0;
        }

        $res = ScoreClient::getInstance()->ask($user->id);
        $noticeAfterCase = "您的咨询将由网站医学助理按病情转交合适的医生回复。70%的咨询可在3天内得到医生回复,未回复的咨询将在7天后过期。如病情紧急建议直接去医院就诊。";
        $this->content = array('threadId' => $intention->id, 'caseType' => 'thread',  'sign' => 0, 'noticeAfterCase' => $noticeAfterCase);
    }/*}}}*/
Пример #13
0
 /**
  * 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());
 }
Пример #14
0
 public function searchExchangeOrder($request, $response)
 {
     /*{{{*/
     $nowPage = (int) $request->getRequest('p', 1);
     $pagelink = '';
     $pageInfo = array();
     $option = array();
     $pageSize = 30;
     $beginTime = $request->beginTime ? XDateTime::valueOf($request->beginTime) : XDateTime::today();
     $endTime = $request->endTime ? $request->endTime : XDateTime::today()->getDate();
     $response->beginTime = $beginTime->toShortString();
     $response->endTime = $request->endTime ? XDateTime::valueOf($request->endTime)->toShortString() : XDateTime::valueOf($endTime)->toShortString();
     $keyword = $request->getRequest('keyword', '');
     $response->keyword = $keyword;
     $scoreOrderList = array();
     $moneyOrderList = array();
     $presentOrderList = array();
     $user = new NullEntity();
     $searchType = $request->searchType;
     $response->searchType = $searchType;
     if ($keyword) {
         $user = DAL::get()->find_by_name('user', $keyword);
         if ($user instanceof User) {
             $option['userId'] = $user->id;
         } else {
             throw new BizException('用户不存在');
             $option['userId'] = -1;
         }
     }
     $option['beginTime'] = $beginTime;
     $option['endTime'] = $endTime;
     //按充值查询
     if ('rechange' == $searchType) {
         if ($keyword) {
             $userAccount = DAL::get()->find_by_userid('useraccount', $user->id);
             $option['accountId'] = $userAccount->cashAccountId;
         }
         $result = AccountClient::getInstance()->getMoneyOrderList($nowPage, $pageSize, $option);
         $response->moneyOrderList = $result['moneyOrderList'];
         $pageInfo = $result['pageInfo'];
     } else {
         if ('presentOrder' == $searchType) {
             if ($keyword) {
                 if ($user->patients) {
                     $option['patientId'] = array_keys($user->patients);
                 } else {
                     throw new BizException('没有患者信息');
                 }
             }
             $option['status'] = PresentOrder::STATUS_PAID_YES;
             $option['startTime'] = $beginTime;
             $option['nowPage'] = $nowPage;
             $option['pageSize'] = $pageSize;
             $option['notSpacePresentCate'] = true;
             $result = PresentClient::getInstance()->getPresentOrders($option);
             $response->presentOrderList = $result['presentOrderList'];
             $pageInfo = $result['pageInfo'];
         } else {
             if ('exchange' == $searchType) {
                 $result = ScoreClient::getInstance()->getScoreOrderList($nowPage, $pageSize, $option);
                 $response->scoreOrderList = $result['scoreOrderList'];
                 $pageInfo = $result['pageInfo'];
             }
         }
     }
     $response->user = $user;
     if (false == empty($pageInfo)) {
         $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate("/present/searchexchangeorder?showContent=1&keyword=" . $keyword . "&beginTime=" . $beginTime . "&endTime=" . $endTime . "&searchType=" . $searchType . "&p="), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']);
     }
     $response->pagelink = $pagelink;
 }
Пример #15
0
    public function ajaxDoctorBuyPresent($request, $response)
    {/*{{{*/
        $canSend = true;
        $errorMsg = '';
        if($this->_newUser->id != $this->_newSpace->user->id)
        {
            $canSend = false;
            $errorMsg = "您不能代替{$this->_newSpace->name}医生送礼物!";
        }
        $response->errorMsg = $errorMsg;
        if(false == $canSend)
        {
            return 'ajaxfailsent';
        }

        $present = DAL::get()->find('Present', $request->presentid);
        $patient = DAL::get()->find('patient', $request->patientid);
        $presentOrder = PresentClient::getInstance()->createOrder($this->_newSpace->user, $patient
            , $this->_newSpace, $present, $request->wish, false);

        $result = 4;
        if(false == $presentOrder->isNull())
        {
            $result =  ScoreClient::getInstance()->payForPresent($this->_newSpace->user->id, $this->_newSpace->id, $presentOrder->id);
        }
        if(Account::PAY_RESULT_SUCC == $result)
        {
            $ref = DAL::get()->find_by_spaceid_and_patientid_and_status('doctorpatientref'
                , $this->_newSpace->id, $request->patientid, DoctorPatientRef::STATUS_INIT);
            $response->ref = $ref;

            $title = "医生送祝福";
            $content = "{$patient->user->name}您好。<p>{$this->_newSpace->name}大夫亲自为您送祝福 {$present->name} </p><p><a href='{$ref->getUrl()}' class='blue' target='_blank'>立即查看</a>或<a href='{$ref->getUrl()}?type=presentchoose' class='blue' target='_blank'>我要回赠医生礼物</a></p>";
            StationLetterClient::getInstance()->sendMsg(Message::AdminUserId, $patient->user->id, $title, $content);

            return 'ajaxdoctorsuccesssent';
        }
        else
        {
            $errorMsg = '订单提交失败';
            $response->errorMsg = $errorMsg;
            return 'ajaxfailsent';
        }
    }/*}}}*/
 public function clearBadge($userId)
 {/*{{{*/
 	$user = DAL::get()->find('user', $userId);
     if ($user->isNull())
     {
         $this->setErrorCode(107);
         return 0;
     }
     ScoreClient::getInstance()->clearIosBadge($userId);
 }/*}}}*/
Пример #17
0
 public function ajaxApplyWishPresent($request, $response)
 {
     /*{{{*/
     $page = $request->getRequest('page', 0);
     $response->page = $page;
     $patientId = $request->patientid;
     $response->patientId = $patientId;
     $patient = DAL::get()->find('patient', $patientId);
     $presentId = $request->presentid;
     $present = DAL::get()->find('Present', $presentId);
     $response->present = $present;
     $wish = $request->wish;
     $response->wish = $wish ? mb_convert_encoding($wish, 'gbk', 'utf-8') : $present->wish;
     list($featAmount, $heartImgHtml) = ScoreClient::getInstance()->showFlagsforPage($this->space->user->id);
     //爱心图片
     $response->heartImgHtml = $heartImgHtml;
     //爱心值
     $response->featAmount = $featAmount;
     list($canSend, $errorMsg) = $this->canSendPresent($patientId, $presentId);
     $response->canSend = $canSend;
     $response->errorMsg = $errorMsg;
 }
	          if ($doctor->hasSpace() && $doctor->space->user->headImage)
	          {
                  $headImageUrl = TuClient::getInstance()->getThumbnailUrl( $doctor->space->user->headImage, 96, 96, TuClient::TYPE_ZOOM);
                  $imgTitle = $doctor->hospitalfaculty->hospital->commonName.$doctor->hospitalfaculty->name.$doctor->name;
			  ?>
	          <tr>
                <td width="120" rowspan="10" valign="top">
                <div class="ys_tx">
                <table border="0" cellspacing="0" cellpadding="0" style="border:2px solid #e1e1e1; width:96px; height:96px;background-color:#FFFFFF;">
	                <tr>
	                	<td align="center" valign="middle"><img src="<?=$headImageUrl?>" title="<?php echo $imgTitle;?>" /></td>
	                </tr>
        		</table>
                </div>
                <?php 
                	list($featAmount, $heartImgHtml) = ScoreClient::getInstance()->showFlagsforPage($doctor->space->id);
                	if($featAmount > 0)
                	{
                ?>
          		      <div>爱心:<a href="http://passport.haodf.com/doctorreg/aixinzhi" title="爱心值:<?=$featAmount?>分" target="_blank"><?=$heartImgHtml ?></a></div> 
                <?php 
                	}
                ?>
                <?php 
                	if($doctor->isGoodDoctor())
                	{
                ?>
          		      <div style="padding-top:10px;"><a href="http://www.haodf.com/paperdetail/2013ndlt.htm#banjiang" target="_blank"><img width="111" align="absmiddle" height="18"  src="http://i1.hdfimg.com/2013/diseasepage/images/nd_hdf_big.jpg"></a></div> 
                <?php 
                	}
                ?>
Пример #19
0
 public function scoreDetail($request, $response)
 {/*{{{*/
     $pageSize = 25;
     $pageIndex = $request->getRequest('page', 1);
     $result = ScoreClient::getInstance()->getLastMonthAccountItemByUserId($this->user->id, $pageIndex, $pageSize);
     $response->scoreItems = $result['scoreItems'];
     $response->pageLink = Pager::getNavLink('/index/scoredetail?page=', $result['pageInfo'], false);
 }/*}}}*/