public function photoalbumdetail($request, $response) { $attachmentId = $request->attachment_id; $photoAlbumId = $request->photoalbum_id; $photoAlbumObject = DAL::get()->find('PhotoAlbum', $photoAlbumId); $response->photoAlbumObject = $photoAlbumObject; $currentPhoto = DAL::get()->find('Attachment', $attachmentId); if ($currentPhoto->isNull()) { $this->message('没有相关照片', $response); return false; } $response->currentPhoto = $currentPhoto; $photoList = AttachClient::getInstance()->getAlbumAttach($photoAlbumId); $response->photoList = $photoList; sort($ids = array_keys($photoList)); $firstId = false; $prevId = false; $nextId = false; $lastId = false; if (!empty($ids)) { $firstId = $ids[0]; $lastId = $ids[count($ids)-1]; for ($i=0; $i<count($ids); $i++) { if ($ids[$i] == $currentPhoto->id) { if ($i-1>=0) $prevId = $ids[$i-1]; else $prevId = 0; if ($i+1<=count($ids)-1) $nextId = $ids[$i+1]; else $nextId = $lastId; } } } $response->firstId = $firstId; $response->prevId = $prevId; $response->nextId = $nextId; $response->lastId = $lastId; $response->title = '相册详细_'.$response->title; }
public function addAttach($request, $response) { if (isset($_FILES['attach'])) { $file = $_FILES['attach']; if ($file['error']==0) { $file['name'] = XString::convertToGbk($file['name']); $file['name'] = TuClient::getInstance()->checkFileSuffixName($file); $filePath = TuClient::getInstance()->uploadAttach($file); $attach = AttachClient::getInstance()->addAttach($this->_newUser->id, $file['name'], $filePath, $file['type'], $file['size'], Attachment::TYPE_JPG, '', ''); // 传入默认的patientid $bingLi = BingLiClient::getInstance()->addBingLi($this->_newUser->id, PatientAttachment::DEFAULT_PATIENTID, '', PatientAttachment::TYPE_PIC, 0, '', '', $attach->id); echo "<script>parent.tb_remove();parent.showMyAttach('el_my_attachment', 0, '".$bingLi->id."');</script>"; //echo "<script>parent.showMyAttach('el_my_attachment', 0, '".$bingLi->id."');</script>"; } } exit(); }
public function uploadHistory($request, $response) { /*{{{*/ $nowPage = $request->getRequest('p', 1); $res = AttachClient::getInstance()->getList4Hdfadmin($this->curOperatorUser->id, $nowPage, 10); $response->attachsJson = Attachment::getJson($res['attachments'], Attachment::THUMBNAIL_WIDTH_HDFADMIN, Attachment::THUMBNAIL_HIGHT_HDFADMIN); $response->pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate("/spider/uploadhistory?p="), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']); }
public function rotateImg($request, $response) { /*{{{*/ AttachClient::getInstance()->rotateImg($request->id, $request->diagree); $response->setRedirect($request->callback); }
public function ajaxRotateAttachmentImg($request, $response) { /*{{{*/ $response->showContent = true; $attachment = DAL::get()->find('attachment', $request->id); AttachClient::getInstance()->rotateImg($attachment->id, $request->degree); $response->attachment = DAL::get()->find('attachment', $attachment->id, true); $response->callback = $request->callback; }
public function addAttach($request, $response) {/*{{{*/ if (isset($_FILES['attach'])) { $file = $_FILES['attach']; if ($file['error']==0) { $file['name'] = XString::convertToGbk($file['name']); $file['name'] = TuClient::getInstance()->checkFileSuffixName($file); $filePath = TuClient::getInstance()->uploadAttach($file); if(empty($filePath)) { exit(); } if($this->_newUser->isNull()) { $this->_newUser = DAL::get()->find('user',PatientAttachment::DEFAULT_USERID); } $attach = AttachClient::getInstance()->addAttach($this->_newUser->id, $file['name'], $filePath, $file['type'], $file['size'], Attachment::TYPE_JPG, '', ''); // 传入默认的patientid $user = $this->_newUser; $patientId = $request->patientId; if(empty($patientId) || $patientId == "all") { $patientId = PatientAttachment::DEFAULT_PATIENTID; } else { //传过来patient以后,要用patient的user $patient = DAL::get()->find('Patient', $patientId); $user = $patient->user; } $checkTime = $request->date; $hospitalId = $request->hoskey; $hospitalName = $request->hospitalName; $facultyName = $request->facultyName; $itemName = $request->itemName; $hospitalId = isset($hospitalId)?$hospitalId:''; $checkTime = isset($checkTime)?$checkTime:''; $hospitalName = isset($hospitalName)?$hospitalName:''; $facultyName = isset($facultyName)?$facultyName:''; $itemName = isset($itemName)?$itemName:''; $bingLi = BingLiClient::getInstance()->addBingLi($user->id, $patientId, '', PatientAttachment::TYPE_PIC, 0, '', $checkTime, $attach->id, $hospitalName, $facultyName, $itemName, $hospitalId); $patientAttachment = BingLiDto::createPatientAttachmentDto($bingLi->id, $hospitalId, $patientId); AskSessionInfo::addPatientInfo(NodeObj::NODE_DEFINE_ATTACHMENT, $patientAttachment); //随访复查报告 $ticketId= $request->ticketid; if(isset($ticketId)) { if(CheckupTicket::NONE_TICKETID != $ticketId) { echo "<script>parent.addCheckupReportLeft($ticketId,$bingLi->id)</script>"; } else {//无指定复查直接上传附件 echo "<script>parent.afterUpload();</script>"; } } else { echo "<script>parent.tb_remove();parent.showMyAttach('el_my_attachment', 0, '".$bingLi->id."');</script>"; } } } return parent::DIRECT_OUTPUT; }/*}}}*/
public function updatePhotoCount($id) { if(empty($id)){ $this->message('相册ID不可为空', $response); return false; } $photoAlbum = DAL::get()->find('photoAlbum', $id); $count = AttachClient::getInstance()->getAlbumCount($id); DZoneClient::getInstance()->modifyPhotoAlbum($id, array('photoCount'=>$count)); }
public function deleteAttachment($request, $response) { /*{{{*/ $attachmentId = $request->attachmentId; AttachClient::getInstance()->deleteAttach($attachmentId); $followupCustomerId = $request->followupCustomerId; $preMsg = "删除成功"; $response->setRedirect("/projectcustomermgr/attachmentsofcustomer?followupCustomerId=" . $followupCustomerId . "&preMsg=" . $preMsg); }
public function uploadAttachment($userId) {/*{{{*/ set_time_limit(60); $user = DAL::get()->find('user', $userId); if($user->isNull()) { $this->setErrorCode(107); return 0; } if (isset($_FILES['content'])) { $file = $_FILES['content']; if ($file['error']==0) { $file['name'] = XString::convertToGbk($file['name']); $file['name'] = TuClient::getInstance()->checkFileSuffixName($file); $filePath = tuClient::getInstance()->uploadAttach($file); $attach = AttachClient::getInstance()->addAttach($userId, $file['name'], $filePath, $file['type'], $file['size'], Attachment::TYPE_JPG, '', ''); if (!$attach || $attach->isNull()) { $this->setErrorCode('165'); return 0; } // 传入默认的patientid $bingLi = BingLiClient::getInstance()->addBingLi($userId, PatientAttachment::DEFAULT_PATIENTID, '', PatientAttachment::TYPE_PIC, 0, '', '', $attach->id); $content['attachmentId'] = $bingLi->id;//存储attachment有两张表,去看两张表的关系就明白了 $this->content = $content; }else{ $this->setErrorCode('165'); return 0; } }else{ $this->setErrorCode('164'); return 0; } }/*}}}*/
public function rotatePredoctorImg($request, $response) { /*{{{*/ $response->showContent = true; $attachment = DAL::get()->find('attachment', $request->id); DBC::requireTrue($attachment->isPicture(), '只能转图片的附件'); AttachClient::getInstance()->rotateImg($attachment->id, $request->diagree); $attachment = DAL::get()->find('Attachment', $attachment->id, true); $response->attachment = $attachment; $response->callback = $request->callback; }
private function _doHospitalFacultyIndex($request, $response) {/*{{{*/ /** 取得网站头条文章 */ $headLineArticle = DAL::get()->find('article', $this->_newSpace->headlineArticleId); $attachmentList = AttachClient::getInstance()->getList($this->_newSpace->headlineArticleId, Attachment::HOSTTYPE_ARTICLE); $response->headLineArticle = $headLineArticle; $response->attachmentList = $attachmentList; /** 分类取所有文章列表 */ $articleCategoryList = ArticleClient::getInstance()->getArticleCategory($this->_newSpace->id); $articleList = array(); foreach($articleCategoryList as $idx => $category){ $tmpArticles = ArticleClient::getInstance()->getList($this->_newSpace->id, $category->id, 0, 10, array('orderby'=>'fld_ArticleUpdateTime desc')); $articleList[$idx]= $tmpArticles['articleList']; } $response->articleCategoryList = $articleCategoryList; $response->articleList = $articleList; /** 取得医生文章 */ $res = ArticleClient::getInstance()->getList4Faculty($this->_newSpace->host->id, 1, $pageSize=10); $response->doctorArticleList = $res['articleList']; /** 取得当前科室的咨询列表 */ if (false == $this->_newUser->isNull()) $userId = $this->_newUser->id; else $userId = 0; $response->threads = array(); /** 当前科室下医生的咨询列表 */ $userIds = DAL::get()->find_id_byHospitalFacultyId('space', $this->_newSpace->host->id); $doctorFlows = array(); if (false == empty($userIds)) { $flowRes = FlowClient::getInstance()->getZixunFlowBySpaceIds($userIds, 1, 5); $doctorFlows = $flowRes['flowList']; } $response->doctorFlows = $doctorFlows; /** 当前科室下开放了咨询区的医生 */ $openCaseDoctorList = SpaceClient::getInstance()->getByHospitalFacultyId($this->_newSpace->host->id, array('caseOpened'=>1)); $response->openCaseDoctorList = $openCaseDoctorList; /** 最新照片 */ $photoList = AttachClient::getInstance()->getListByUserIdAndHostType($this->_newSpace->user->id, 'PhotoAlbum', array('limit'=>5)); $photoAlbum =array(); foreach($photoList as $photo){ $photoAlbum[$photo->id] = DAL::get()->find('photoAlbum', $photo->hostId); } $response->photoList = $photoList; $response->photoAlbumList = $photoAlbum; /** 科室成员列表 */ $doctorList = DoctorClient::getInstance()->getListByHospitalFacultyId($this->_newSpace->host->id); sort($doctorList); $response->doctorList = $doctorList; $encodeFacultyId = Codec::getInstance()->encodeId($this->_newSpace->host->id); $response->encodeFacultyId = $encodeFacultyId; /** 专家风采列表 */ $expertDoctorList = DoctorClient::getInstance()->getListByHospitalFacultyId($this->_newSpace->host->id, array('id'=>$this->_newSpace->getScheduleData())); $validDoctorList = array(); foreach ($this->_newSpace->getScheduleData() as $doctorId) { foreach ($expertDoctorList as $expertDoctor) { if ($expertDoctor->id == $doctorId) $validDoctorList[] = $expertDoctor; } } $response->expertDoctorList = $validDoctorList; }/*}}}*/
public function uploadFUAttachment($userId, $checkupTicketId) {/*{{{*/ $user = DAL::get()->find('user', $userId); if($user->isNull()) { $this->setErrorCode(107); return 0; } if(empty($checkupTicketId)) { $this->setErrorCode(401); return 0; } $followupOwner = $user->getFollowupPatientSignin(); if (false == $followupOwner->isNull()) { $patient = $followupOwner->patient; } if (isset($_FILES['content'])) { $file = $_FILES['content']; if ($file['error']==0) { $file['name'] = XString::convertToGbk($file['name']); $file['name'] = TuClient::getInstance()->checkFileSuffixName($file); $filePath = TuClient::getInstance()->uploadAttach($file); $attach = AttachClient::getInstance()->addAttach($userId, $file['name'], $filePath, $file['type'], $file['size'], Attachment::TYPE_JPG, '', ''); $bingLi = BingLiClient::getInstance()->addBingLi($userId, $patient->id, '', PatientAttachment::TYPE_PIC, 0, '', '', $attach->id); NfsClient::getInstance()->addAttachmentCheckupReportFromMbi($followupOwner, $bingLi->id, $checkupTicketId); } else { $this->setErrorCode('165'); return 0; } } else { $this->setErrorCode('164'); return 0; } }/*}}}*/
/** * upload * * @param mixed $userId * @param mixed $files * @static * @access public * @return void */ public static function upload($userId, $files) {/*{{{*/ set_time_limit(60); $user = DAL::get()->find('user', $userId); if($user->isNull()) { $this->setErrorCode(107); return 0; } if (isset($files['content'])) { $file = $files['content']; if ($file['error']==0) { $filePath = TuClient::getInstance()->uploadAttach($file); $attachType = self::getType4Attachment($file); $attach = AttachClient::getInstance()->addAttach($userId, $file['name'], $filePath, $file['type'], $file['size'], $attachType, '', ''); if (!$attach || $attach->isNull()) { return 165; } //语音amr转mp3 if(Attachment::isSound($files['content']['type'])) { MessageQueueClient::getInstance()->regEvent(new VoliceConvertToMp3($attach->id)); } $content['userId'] = $userId; $content['attachmentId'] = $attach->id; return $content; } else { return 165; } } else { return 164; } }/*}}}*/