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;
 }
 public function showFlowOrderList($request, $response)
 {
     /*{{{*/
     $options['startTime'] = $beginDate = $request->beginDate;
     $options['endTime'] = $endDate = $request->endDate;
     $nowPage = $request->page ? $request->page : 1;
     $pageSize = 20;
     $res = ServiceCardClient::getInstance()->queryUnFreeServiceCardBySpaceAndServiceType($this->space, ServiceDef::TYPE_FLOW, $nowPage, $pageSize, $options);
     $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace("showfloworderlist?beginDate={$beginDate}&actionclass={$request->actionclass}&endDate={$endDate}&page="), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']);
     $response->flows = FlowClient::getInstance()->getFlowsByServiceCards($res['serviceCards']);
     $response->serviceCards = $res['serviceCards'];
     $response->pagelink = $pagelink;
     $response->beginDate = $beginDate;
     $response->actionClass = $request->actionclass;
     $response->endDate = $endDate;
 }
Esempio n. 3
0
    public function showDetail($request, $response)
    {/*{{{*/
        $response->spaceModule = 'Case';
        $ref = DAL::get()->find('DoctorPatientRef', $request->refid);
		$response->ref = $ref;
        if($ref->isNull())
        {
            $response->exitJump($this->_newSpace->url, 301);
        }
        else if ($ref->isDeleted() || $ref->space->isHospitalFaculty())
    	{
            $response->setFor404();
            $this->message('医患关系不存在!', $response);
            return false;
        }
        else if ($ref->isClosed())
    	{
            $this->message('医患关系已经关闭!', $response);
            return false;
        }
        else if ($ref->isPrivated() && $ref->isBrowser($this->_newUser))
    	{
            $response->setFor404();
            $this->message('医患关系已经设为隐私!', $response);
            return false;
        }
        
        //设置标题
        list($title, $flowTitle, $navigatorTitle) = FlowClient::getInstance()->getFlowTitle($ref, $ref->isBrowser($this->_newUser), $request->getRequest('p', 1));
        $response->title = $title;
        $response->flowTitle = $flowTitle;
        $response->navigatorTitle = $navigatorTitle;
        
        $followupOwner = $ref->getFollowupOwner();
		$response->followupOwner = $followupOwner;
        $canReplyFollowupOwner = ($followupOwner->isNull() == false && $followupOwner->isOpenFollowup());
        $response->canReplyFollowupOwner = $canReplyFollowupOwner;

		if(false == $followupOwner->isNull())
		{
	  		$medicineUserSchemes = MedicineClient::getInstance()->getUserCurrentMedicineScheme($followupOwner->user->id);
      		$response->medicineUserSchemes = $medicineUserSchemes;
		}

        $response->ref = $ref;

        $chargeFlowList = FlowClient::getInstance()->getPaiedFlowListBySpace($ref->space, false, array($ref->id));
        $response->canShowCharge = array_key_exists($ref->id, $chargeFlowList);

        if ($this->_newSpace->id != $this->_newUser->id)
        {
            $telOrderFlows = TelOrderClient::getInstance()->getTelOrderFlows($this->_newSpace->id);
            $response->canShowTel = (in_array($ref->id, $telOrderFlows));

            $presentOrders = DAL::get()->find_by_spaceid_and_patientid_and_status('PresentOrder', $ref->space->id, $ref->patient->id, PresentOrder::STATUS_PAID_YES);
            $response->canShowPresent = !$presentOrders->isNull();
        }

        if (false == $this->_newUser->isNull()) 
        {
            if ($this->_newUser->id == $ref->space->user->id) 
            {
                //医生本人视角
                //先进行服务卡数据修复,给没有服务卡的老数据生成服务卡
                ServiceCardClient::getInstance()->fixDataForNoServicecard($ref->space, $ref->patient);
                $this->detailForSpace($response, $request, $ref);
                $response->object = 'space';
            } 
            else if ($this->_newUser->id == $ref->user->id) 
            {
                //患者本人视角
                $this->detailForPatient($response, $request, $ref);
                $response->object = 'patient';
            }
            else 
            {
                //第三方视角
                $this->detailForBrowser($response, $request, $ref);
                $response->object = 'browser';
            } 
        }
        else 
        {
            // 非登陆视角
            $response->isLogin = '******';
            $this->detailForBrowser($response, $request, $ref);
            $response->object = 'browser';
        }
    }/*}}}*/