public function delAnnotation($request, $response)
 {
     /*{{{*/
     $sourceId = $request->sourceId;
     $sourceType = $request->sourceType;
     $ticketId = $request->ticketId;
     $annotation = DAL::get()->find_by_hostid_and_hosttype('NfsAnnotation', $sourceId, $sourceType);
     $sourceEntity = DAL::get()->find($sourceType, $sourceId);
     if ($sourceEntity->isNull()) {
         die('批注的载体对象已经不存在!' . $sourceType . ':' . $sourceId);
     }
     if ($annotation->isNull() == false) {
         AnnotationClient::getInstance()->deleteAnnotation($annotation->id);
     }
     $url = 'healthrecord/nextdiary';
     if ($sourceType == 'DoctorPatientPost') {
         $url = 'nfsaudit/nexttask';
     } elseif ($sourceType == 'MedicineDiary') {
         $url = 'followup/nextmedicinediary';
     }
     if ($sourceType == 'DoctorPatientPost' && empty($ticketId)) {
         $url = 'nfsaudit/notalk';
         $response->setRedirect($response->router->urlfor($url, array('refId' => $sourceEntity->doctorPatientRef->id)));
     } else {
         $response->setRedirect($response->router->urlfor($url, array('ticketId' => $ticketId)));
     }
 }
 public function saveAnnotation($request, $response)
 {
     /*{{{*/
     $sourceId = $request->sourceId;
     $sourceType = $request->sourceType;
     $ticketId = $request->ticketId;
     $content = $request->getUnSafeData('content');
     if (empty($content)) {
         die('批注内容不能为空!');
     }
     $sourceEntity = DAL::get()->find($sourceType, $sourceId);
     if ($sourceEntity->isNull()) {
         die('批注的载体对象已经不存在!' . $sourceType . ':' . $sourceId);
     }
     $doAction = $request->doAction;
     if (empty($doAction)) {
         $doAction = 'add';
     }
     if ($doAction == 'add') {
         $annotation = AnnotationClient::getInstance()->addAnnotation($this->getAuditor(), $sourceEntity, $content);
     } else {
         $annotationId = $request->annotationId;
         AnnotationClient::getInstance()->updateAnnotation($this->getAuditor(), $annotationId, $content);
     }
     $url = 'healthrecord/nextdiary';
     if ($sourceEntity instanceof DoctorPatientPost) {
         $url = 'nfsaudit/nexttask';
     } elseif ($sourceEntity instanceof MedicineDiary) {
         $url = 'followup/nextmedicinediary';
     }
     if ("healthdiary" == $request->comesfrom || "medicinediary" == $request->comesfrom) {
         $response->setRedirect($response->router->urlfor("followup/refreshopener", array()));
     } else {
         if ($sourceEntity instanceof DoctorPatientPost && empty($ticketId)) {
             $url = 'nfsaudit/notalk';
             $response->setRedirect($response->router->urlfor($url, array('refId' => $sourceEntity->doctorPatientRef->id)));
         } else {
             $response->setRedirect($response->router->urlfor($url, array('ticketId' => $ticketId)));
         }
     }
 }
 public function setAnnotationUserReadPost($request, $response)
 {/*{{{*/
     $annotationId = $request->annotationId;
     AnnotationClient::getInstance()->setAnnotationUserRead($annotationId);
     echo "success";
     exit;
 }/*}}}*/