private function getshowDefaulted($patient, $response)
 {
     /*{{{*/
     $patientIds = DAL::get()->find_id_samePhoneOrSameIdcardOf('Patient', $patient);
     $proposals = DAL::get()->find_all_by_servicedef_and_patientIds_and_status('Proposal', ServiceDef::TYPE_BOOKING, $patientIds);
     $dtos = BookingDto::createOfProposals($proposals, BookingDto::QUERY_STATUS_ALL);
     $isDefaulted = false;
     foreach ($dtos as $dto) {
         if ($dto->isPhoneUserDefaulted()) {
             $isDefaulted = true;
             break;
         }
     }
     $response->isDefaulted = $isDefaulted;
     $unFinishdBookingOrders = DAL::get()->find_id_by_patientIds_and_status('bookingorder', $patientIds, array(BookingOrder::STATUS_AUDIT, BookingOrder::STATUS_CONFIRM));
     $response->hasUnFinishedBookingOrder = count($unFinishdBookingOrders) > 0;
 }
Ejemplo n.º 2
0
 private function getBookingOrderStatus4User($bookingOrder)
 {/*{{{*/
     $status = 0;
     if ($bookingOrder instanceof Intention)
     {
         if ($bookingOrder->isRefused())
         {
             $status = self::BOOKING_INVALID_ADMIN_REFUSE;
         }
         else if ($bookingOrder->isUnAudited())
         {
             $status = self::BOOKING_STATUS_SUBMITED;
         }
     }
     else
     {
         $bookingOrder = BookingDto::createByProposalId($bookingOrder->id);
         $execution = $bookingOrder->execution;
         if ($execution instanceof BookingOrder && $execution->isCallBack())
         {
             $status = self::BOOKING_WAIT_CALLBACK;
         }
         else if ($bookingOrder->isDefaulted()) 
         {
             $status = self::BOOKING_DEFAULTED;
         }
         else if($bookingOrder->isSuccess()) 
         {
             $status = self::BOOKING_FINISHED;//原已就诊
         }
         else if($bookingOrder->isPending())
         {
             $status = self::BOOKING_PENDING;
         }
         else if (($bookingOrder->isPhoneUserConfirm() || $bookingOrder->isPhoneDoctorEndConfirm())
             && false == $bookingOrder->isInvalid()) //电话状态
         {
             $status = self::BOOKING_APPLY_SUCCESS;
         }
         else if ($bookingOrder->isConfirm() 
             && false == $bookingOrder->isPhoneUserConfirm() && false == $bookingOrder->isPhoneDoctorEndConfirm())
         {
             $status = self::BOOKING_SUCCESS;
         }
         else if ($bookingOrder->isInvalid())
         {
             //失效状态
             $status = $bookingOrder->invalidcause;
         }
         else if($bookingOrder->isFinished() && $bookingOrder->isPhoneUserPending())
         {
             $status = self::BOOKING_SUCCESS;//医生确认显示为加号成功
         }
         else
         {
             $status = self::BOOKING_STATUS_SUBMITED;
         }
     }
     return $status;
 }/*}}}*/
Ejemplo n.º 3
0
    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) ));
    }/*}}}*/
Ejemplo n.º 4
0
    public function agreeBookingOrder($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();
            $bookingOrderId = $proposal->id;
        }

        $dto = BookingDto::createByProposalId($bookingOrderId);
        $bookingOrderId = $dto->getExecutionId();
		$bookingOrder = DAL::get()->find('bookingOrder', $bookingOrderId);
    	if ($bookingOrder->isNull())
        {
            $this->setErrorCode(158);
            return 0;
        }
    	if($bookingOrder->patient->user->id != $userId)
        {
        	$this->setErrorCode(159);
            return 0;
        }

		$now = XDateTime::now("Y-m-d H:i:s");
		$before1Schedule = $bookingOrder->schedule->addDay(-1)->setHour("16")->setMinute("00");
		$before2Schedule = $bookingOrder->schedule->addDay(-2)->setHour("20")->setMinute("00");
		if($now < $before2Schedule)
        {
            $this->errorCode = 1002;
            $this->msg = "暂时不能领取加号凭证,请您在".date('Y-m-d H:i', strtotime($before2Schedule))."至".date('Y-m-d H:i', strtotime($before1Schedule))."到此页面领取加号凭证短信";
            return 0;
        }
        
		//患者自己确认去就诊相当于患者电话确认
		BookingClient::getInstance()->patientConfirmOrder($user, $bookingOrder->id);
    }/*}}}*/