Ejemplo n.º 1
0
 private static function getAttachmentByAttachmentId($attachmentId)
 {/*{{{*/
     $pa = DAL::get()->find('PatientAttachment', $attachmentId);
     $thumbnailUrl = $url = $innerHtml = $attachmentType = '';
     $canClick = 0;
     if(false == $pa->isNull()) 
     {
         $attachment = $pa->getAttachOrReportAttachment();
         if($attachment->isNull() == false && $attachment->filePath)
         {
             if(preg_match('/\.(?:jpg|png|gif)/i', $attachment->filePath))
             {
                 $thumbnailUrl = TuClient::getInstance()->getThumbnailUrl($attachment->filePath, 120, 120);
                 $url = MainDataBucket::getPictureUrl($attachment);
                 $attachmentType = 'image';
                 $innerHtml = '';
                 $canClick = 1;
             }
             else
             {
                 $thumbnailUrl = 'http://i1.hdfimg.com/wap/images/dangan.png';
                 $url = 'http://i1.hdfimg.com/wap/images/mobile_defattach4.jpg';
                 $attachmentType = 'annex';
                 $innerHtml = '';
                 $canClick = 0;
             }
         }
         else
         {
             $thumbnailUrl = 'http://i1.hdfimg.com/wap/images/mobile_defattach1.jpg';
             $url = 'http://i1.hdfimg.com/wap/images/mobile_defattach3.jpg';
             $attachmentType = 'handWriter';
             $innerHtml = self::_getAttachmentInnerHtml($pa);
             $canClick = 1;
         }
     }
     return array('thumbnailUrl'=>$thumbnailUrl, 'url'=>$url,'id'=>$attachmentId, 
         'attachmentType'=>$attachmentType, 'innerHtml'=>$innerHtml, 'pa'=>$pa, 'canClick'=>$canClick);
 }/*}}}*/
 public static function getAttachmentListImp($attachments, $start=0, $end=5) 
 {/*{{{*/
     $infos = $datas = array();
     $cnt = 0 ;
     foreach($attachments as $attachment)
     {/*{{{*/
         $info = array();
         $time = date('Y-m-d',strtotime($attachment->ctime->toString()));
         $info['attachmentId'] = $attachment->id;
         $info['name'] = $attachment->attachment->name;
         if($attachment->attachmentId == 0)
         {
             $html = '';
             $info['reportType'] = PatientAttachment::$typeList[$attachment->type]['name'];
             $html = "<p>病历类型:".$info['reportType']."</p>";
             $html .= "<p>检查时间:".$attachment->checkTime."</p>";
             $html .= preg_replace("'([\r\n])[\s]+'", "", $attachment->content);
             $html .= "<p>".$attachment->title."</p>";
             $info['innerHtml'] = $html;
             $info['canClick'] = '1';
             $datas[$time]['report'][] = $info;
         }
         else if($attachment->attachment->filePath)
         {
             if (preg_match('/\.(?:jpg|png|gif)/i', $attachment->attachment->filePath))
             {
                 $info['canClick'] = '1';
                 $info['thumbnailUrl'] = TuClient::getInstance()->getThumbnailUrl($attachment->attachment->filePath, 300, 200);
                 $url = MainDataBucket::getPictureUrl($attachment->attachment);
                 $info['url'] = $url;
                 $datas[$time]['pic'][] = $info;
             }
             else
             {
                 $info['canClick'] = '0';
                 $info['thumbnailUrl'] = 'http://i1.hdfimg.com/wap/images/dangan.png';
                 $datas[$time]['other'][] = $info;
             }
         }
     }/*}}}*/
     krsort($datas);
     foreach($datas as $time=>$data)
     {
         if($cnt >= $start && $cnt <= $end)
         {
             $inf = array();
             if(array_key_exists('pic',$data))
             {
                 $inf['image'] = $data['pic'];
             }
             if(array_key_exists('report',$data))
             {
                 $inf['handWriter'] = $data['report'];
             }
             if(array_key_exists('other',$data))
             {
                 $inf['annex'] = $data['other'];
             }
             $infos = $inf;
         }
         else if($cnt > $end)
         {
             break;
         }
         $cnt ++;
     }
     return array($infos, $datas);
 }/*}}}*/
Ejemplo n.º 3
0
 private function _getFlowPatientSignInfos($post, $key, $finalId) 
 {/*{{{*/
     $postInfo['postId'] = $post->id;
     $postInfo['userId'] = $post->user->id;
     $postInfo['title'] = '诊后报到';
     $postInfo['postTime'] = substr($post->getSourceCtime4Flow(), 0, 16);
     $postInfo['adminComment'] = '';
     $postInfo['latestId'] = $key;
     $postInfo['type'] = 'patientSignin';
     $postInfo['attachmentIds'] = implode($post->attachmentIds,",");
     $postInfo['attachments'] = array();
     if(false == empty($post->attachmentIds))
     {
         $patientAttachments = DAL::get()->find('patientattachment', $post->attachmentIds);
         foreach($patientAttachments as $patientAttach)
         {
             $attachInfo = array();
             if(false == $patientAttach->isNull() && false == $patientAttach->attachment->isNull() && preg_match('/\.(?:jpg|png|gif)/i', $patientAttach->attachment->filePath))
             {
                 $attachInfo['attachmentId'] = $patientAttach->id;
                 $attachInfo['thumbnailUrl'] = TuClient::getInstance()->getThumbnailUrl($patientAttach->attachment->filePath, 120, 120);
                 $attachInfo['url'] = MainDataBucket::getPictureUrl($patientAttach->attachment);
                 $attachInfo['attachmentType'] = 'image';
                 $attachInfo['canClick'] = 1;
                 $postInfo['attachments'][] = $attachInfo;
             }
         }
     }
     $postInfo['presentImgUrl'] = ''; 
     $postInfo['isFinal'] = 0;
     $postInfo['content'] = '';
     $postInfo['detailContent'] = $this->getPatientSignInfo($post);
     if($key == $finalId)
     {
         $postInfo['isFinal'] = 1;
     }
     return $postInfo;
 }/*}}}*/