public function recoverDeletedFollowupPost($request, $response)
 {
     /*{{{*/
     DBC::requireNotEmptyString($request->postid, '数据有错,请重试');
     $postId = $request->postid;
     FollowupPostClient::getInstance()->recoverDelFollowupPost($postId);
     if (false == $request->ticketId && $request->flowId) {
         $response->setRedirect($response->router->urlfor('nfsaudit/notalk', array('refId' => $request->flowId)));
     } else {
         $response->setRedirect($response->router->urlfor('nfsaudit/nexttask', array('c' => 'nfsaudit', 'a' => 'nexttask', 'ticketId' => $request->ticketId, 'refresh' => 1)));
     }
 }
 public function agentAddFollowupPost($request, $response)
 {
     /*{{{*/
     $ownerId = $request->ownerid;
     if (empty($ownerId)) {
         die('随访患者报到信息不存在!');
     }
     $owner = DAL::get()->find('FollowupOwner', $ownerId);
     if ($owner->isNull()) {
         die('随访患者报到信息不存在!');
     }
     $doctorPatientRef = DAL::get()->find_by_patientid_and_spaceid('DoctorPatientRef', $owner->patient->id, $owner->space->id);
     $relateEntity = $doctorPatientRef;
     if ($doctorPatientRef->isNull() || $owner->isOpenFollowup() == false) {
         die('医患流不存在或者未开通随访!');
     }
     $option = array();
     $attachmentIds = $request->attachmentIds != null ? $request->attachmentIds : '';
     $attachmentArr = $attachmentIds == '' ? array() : explode(',', $attachmentIds);
     $option['attachmentIds'] = $attachmentArr;
     $option['agentAuditorId'] = $this->auditor->id;
     //患者代理
     $postContent = $request->getRequest('content');
     if (($postContent == '点击此处跟大夫对话!' || $postContent == '') && $attachmentIds != '') {
         $postContent = '有新资料上传';
     }
     $labelIds = $request->labelIds ? $request->labelIds : array();
     if (empty($labelIds)) {
         $post = DoctorPatientPostClient::getInstance()->addPost($doctorPatientRef->id, $owner->user->id, $postContent, $option);
         //系统日志
         try {
             FlowClient::getInstance()->addLog($doctorPatientRef, $owner->user, DoctorPatientLog::TYPE_SYSTEM_LOG, 'FollowupController::agentAddFollowupPost', $post);
         } catch (Exception $ex) {
         }
     } else {
         $post = FollowupPostClient::getInstance()->addFollowupPost($owner->id, $this->auditor->id, $postContent, $attachmentArr, $request->labelIds);
     }
     DBC::requireFalse($post->isNull(), '系统繁忙,请稍后重试');
     $response->setRedirect($response->router->urlfor('nfsaudit/blankpage', array()));
 }
 private function _yiwenjiejue_add_post($customer, $auditor, $content, $labelIds, $options)
 {
     /*{{{*/
     $owner = $customer->getFollowupOwner();
     if ($owner->isNull()) {
         return new NullEntity();
     }
     $doctorPatientRef = DAL::get()->find_by_patientid_and_spaceid('DoctorPatientRef', $owner->patient->id, $owner->space->id);
     if ($doctorPatientRef->isNull()) {
         return new NullEntity();
     }
     if (empty($content)) {
         return new NullEntity();
     }
     if (false == $owner->isOpenFollowup()) {
         return new NullEntity();
     }
     if (empty($labelIds)) {
         $post = DoctorPatientPostClient::getInstance()->addPost($doctorPatientRef->id, $owner->user->id, $content, $options);
         if (false == $post->isNull()) {
             try {
                 FlowClient::getInstance()->addLog($doctorPatientRef, $owner->user, DoctorPatientLog::TYPE_SYSTEM_LOG, 'WorkNoteController::_yiwenjiejue_add_post', $post);
             } catch (Exception $ex) {
             }
         }
     } else {
         $post = FollowupPostClient::getInstance()->addFollowupPost($owner->id, $auditor->id, $content, array(), $labelIds);
     }
 }