Exemplo n.º 1
0
 /** 患友会首页 **/
 public function index($request, $response)
 {
     /*{{{*/
     if ($this->isSpaceLogin()) {
         //space 查看
         $this->index4Space($request, $response);
         $response->module = Space::MODULE_PATIENT4DOCTOR;
     } else {
         if (false == $this->user->isNull() && UserRole::getGroupMemberRole($this->user->id, $this->space->id)) {
             //患友查看
             $this->index4Patient($request, $response);
         } else {
             //浏览者查看
             $this->index4Browser($request, $response);
         }
     }
     $response->title = $this->space->host->hospitalfaculty->hospital->commonName . $this->space->name . '大夫患友会';
 }
Exemplo n.º 2
0
 /** 是否可以分享 **/
 private function canShareArticle($article, $response)
 {
     /*{{{*/
     $response->canShareArticle = false == $this->user->isNull() && UserRole::getGroupMemberRole($this->user->id, $this->space->id) && false == $article->hasDocAttachment();
 }
Exemplo n.º 3
0
	/** 文章详细(D,HF) */
    public function detail($request, $response)
    {/*{{{*/
		/** 当前空间主人的所有医生身份 */
		$doctorIds = DoctorClient::getInstance()->getDoctorList4space($this->_newSpace->user->id);
		$belongDoctors = DAL::get()->find('doctor', $doctorIds);
		$response->belongDoctors = $belongDoctors;
		foreach ($belongDoctors as $doctor) 
		{  
			$response->facultyName=$doctor->hospitalfaculty->name;
			break;
		}
		$response->newSpace=$this->_newSpace;

		$thankLetterCount = 0;
		if($this->_newSpace->isDoctor()){
			$thankLetterCount = $this->_newSpace->host->getCureThankLetterCount();
		}
		$response->thankLetterCount = $thankLetterCount;
		
        if($this->_newSpace->isDoctor())
        {
            $response->presentCnt = PresentClient::getInstance()->getCntOfPresent($this->_newSpace->id);
        }
		
		/** 文章详细 */
		$articleId = intval($request->getRequest('article_id', 0));
		$article = DAL::get()->find('article', $articleId);
        if(($this->_newUser->isNull() || $this->_newUser->id != $this->_newSpace->user->id )
            && $article->isAuditing())
        {
			$this->message('文章正在审核中!', $response, array('forward' => $this->_newSpace->getUrl() ));
            return false;
        }
		
		if ($article->user->id != $this->_newSpace->user->id)
        {
            $response->setFor404();
			$this->message('错误的链接!', $response, array('forward' => $this->_newSpace->getUrl() ));
            return false;
        }
        if ($article->isDelete()) 
        {
            $response->setFor404();
			$this->message('文章已经被删除了!', $response, array('forward' => $this->_newSpace->getUrl() ));
            return false;
		}
		$response->article = $article;

        if($article->isShield() && $this->_newSpace->user->name != $this->_newUser->name)
        {
			$this->message('您无权查看此文章', $response, array('forward' => $this->_newSpace->getUrl() ));
            return false;
        } 
		
		//患者身份
		$CanShareArticle = false;
		if($this->_newUser->isNull() == false && UserRole::getGroupMemberRole($this->_newUser->id, $this->_newSpace->id) && false == $article->hasDocAttachment())
		{
			$CanShareArticle = true;
		}
		$response->CanShareArticle=$CanShareArticle;
		
		/** 文章分类 */
		$this->_getArticleCategoryList(false, $response);
		/** 文章评论 */
		$res = ArticleClient::getInstance()->getCommentList($article->id);
        if(false == empty($res))
        {
            $response->commentList = $res['commentList'];
        }
        else
        {
            $response->commentList = array();
        }
		/** 相关文章 */
		$relatedArticleList = ArticleClient::getInstance()->getRelateArticleList($this->_newSpace->user->id, $article->id);

        if($article->isNull() == false){
		  $response->articleHits = $this->getArticleHits($article);
          $isShare = $request->getRequest('isShare', '');
          //分享文章阅读量统计
          if(false == empty($isShare))
          {
              HitClient::getInstance()->increaseArticleHitsForShare($article->id);
          }
        }
        
        //接口中取内容
        $this->getRelationInfo($article, $this->_newUser, $response);
        //在患友会里的文章贴子的最新动向
        $this->getReTopicInfo($article, $response);
        
        
		$response->relatedArticleList = $relatedArticleList;
		
		$response->articleObject = $article;
		$response->title = $article->title.'_好大夫在线';
		$articleContentArr = explode('</P>',$article->content);
        $articleContentArr = explode('</p>',$articleContentArr[0]);
        $articleContect = str_replace('&nbsp;', '', $articleContentArr[0]);
        $response->articleContect = str_replace('"', '', strip_tags($articleContect));
        //dodo::wxy 新增医生接听电话数
		$doctorAnswerPhoneList = PaymentClient::getInstance()->getDoctorSatisfactionCntList($this->_newSpace->id);
        $doctorAnswerPhoneCount = 0;
        if(false == empty($doctorAnswerPhoneList))
        {
            $doctorAnswerPhoneCount = $doctorAnswerPhoneList[0]['cnt'];
        };
        $response->doctorAnswerPhoneCount = $doctorAnswerPhoneCount;

        $commentsCount = 0;
        $comments = PaymentClient::getInstance()->getDoctorSatisfactionList($this->_newSpace->host->id);
        if(false == empty($comments[$this->_newSpace->host->id]['scorecnt']))
        {
            $commentsCount = $comments[$this->_newSpace->host->id]['scorecnt'];
        }
        $response->commentsCount = $commentsCount;

        $anyOneSpace = SpaceClient::getInstance()->getAnyOneSpace();
        $response->anyOneSpace = $anyOneSpace;
        $response->flows = FlowClient::getInstance()->getFlowListByUser($this->_newUser->id, array('status' => DoctorPatientRef::STATUS_INIT, 'limit'=>10));
        $articleAttachmentRef = new NullEntity();
        if ($article->hasDocAttachment())
        {
            $articleAttachmentRef = ArticleClient::getInstance()->getValidAttachmentRef($article->id);
        }
        $response->articleAttachmentRef = $articleAttachmentRef;
        $response->token = Captcha::generate('article', $article->id, ContentFactory::TYPE_ARITHMATIC, 4, XIpLocation::getIp(), 3);
	}/*}}}*/