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); }/*}}}*/
public function getUserInfo4NewIndex($userId) {/*{{{*/ $doctorOwner = DAL::get()->find_by_userid('DoctorOwner', $userId); if($doctorOwner->isNull()) { $this->setErrorCode(819); return 0; } $infos = array(); $infos['userName'] = $doctorOwner->source->user->name; $infos['hostName'] = $doctorOwner->source->name; $infos['userRole'] = $this->getUserRole($doctorOwner->user); $infos['isFollowupOpened'] = 2; $infos['headImage'] = ($doctorOwner->isSpace()) ? $doctorOwner->source->getHeadImg4Modify() : $doctorOwner->source->getHeadImage(); $infos['bigHeadImage'] = ($doctorOwner->isSpace()) ? $doctorOwner->source->getHeadImg4Modify(2400) : $doctorOwner->source->getHeadImage(2400); if($doctorOwner->isSpace()) { $space = $doctorOwner->source; $infos['spaceId'] = $space->id; list($featAmount, $heartImgCnt) = ScoreClient::getInstance()->getHeartInfoById($space->id); $infos['featAmount'] = $featAmount; $infos['heartImgCnt'] = $this->getFlagCnt($heartImgCnt); $count = count(BookingClient::getInstance()->getOrderList4Doctor($space->id, self::STATUS_TODAY)); if(false == $space->isBookingOpened()) { $count = 0; } $infos['bookingCnt'] = $count; $telOwner = DAL::get()->find_by_relatedObject('telowner', $space->user); $needIllnessCnt = TelOrderClient::getInstance()->queryNeedIllnessTelOrderCnt('TelOrder', $telOwner->id); if(!PaymentDataBucket::isOpenPhone($space)) { $needIllnessCnt = 0; } $infos['needIllnessCnt'] = $needIllnessCnt; $waitTimeCnt = TelOrderClient::getInstance()->queryWaitTimeTelOrderCnt('TelOrder', $telOwner->id); $waitTelOrderCount = TelOrderClient::getInstance()->getLastNotExeTelOrderCnt($telOwner->id); $isShowFreeButton = MainDataBucket::isShowPhoneButton($space, $waitTimeCnt, $waitTelOrderCount); $infos['isShowFreeButton'] = $isShowFreeButton; $infos['isFollowupOpened'] = ($space->isConfirmed() && false == $space->isOpenFollowup()) ? 0 : 1; //患者报道和医生补贴 $infos['isOpenSubsidy'] = $space->isSignSubsidyOpen()?'1':'0'; $patientSignForToday = DAL::get()->querySubsidyCntByTimeSpan('SubsidyOrder', $space->id, XDateTime::now()->toShortString()); $patientSignForMonth = DAL::get()->querySubsidyCntByTimeSpan('SubsidyOrder', $space->id, XDateTime::now()->addDay(-29)->toShortString()); $subsidyAccountAmount = AccountClient::getInstance()->getSubsidyOrdersAmountInTimespan($space->id, XDateTime::now()->addDay(-29)->toShortString(), XDateTime::now()); $infos['patientSignForToday'] = $patientSignForToday; $infos['patientSignForMonth'] = $patientSignForMonth; $infos['subsidyAccountAmount'] = $subsidyAccountAmount; } $belongDoctors = DoctorClient::getInstance()->getDoctorList4spaceByNoCache($userId); if(empty($belongDoctors)) { if ($doctorOwner->isPreDoctor()) { $infos['hospital'][0]['hospitalName'] = $doctorOwner->source->hospitalName; $infos['hospital'][0]['hospitalFacultyName'] = $doctorOwner->source->facultyName; } else { $this->setErrorCode(840); return 0; } } else { $i = 0; foreach($belongDoctors as $doctor){ $infos['hospital'][$i]['hospitalName'] = $doctor->hospitalfaculty->hospital->name; $infos['hospital'][$i]['hospitalFacultyName'] = $doctor->hospitalfaculty->name; $i++; } } $this->content = $infos; }/*}}}*/
private function getBookingOrderPatientMessage($patient) {/*{{{*/ $sexs = array(0=>"女", 1=>"男"); $paperstypes = array(0 => "身份证", 1=>"护照", 2=>"军人证", 3=>"台胞证", 4=>"港澳居民内地通行证"); $result['patientName'] = $patient->name; $result['age'] = $patient->age ? $patient->age.'岁' : $patient->getPatientAge(); $result['birthday'] = XDateTime::isDate($patient->birthday) == false ? 0 : $patient->birthday; $result['sex'] = $sexs[$patient->sex]; $result['idType'] = $paperstypes[$patient->paperstype]; $result['idNumber'] = MainDataBucket::getPrivateIdCard4Mobile($patient); $result['province'] = $patient->province.$patient->city; $result['mobile'] = $patient->mobile; if($patient->province == $patient->city) { $result['province'] = $patient->province; } return $result; }/*}}}*/
public function getSoundAttachmentUrl($clientId, $attachmentId) {/*{{{*/ list($url, $type, $suffix, $thumbnailUrl) = MainDataBucket::getSoundAttachmentUrl($attachmentId); $this->content = array('clientId'=>$clientId, 'attachmentId'=>$attachmentId, 'url'=>$url, 'thumbnailUrl'=>$thumbnailUrl, 'type'=>$type, 'suffix'=>$suffix); }/*}}}*/
/** * getOrderDetail 订单详情 * * @param mixed $userId * @param mixed $orderId * @access public * @return void */ public function getOrderDetail($userId, $orderId) {/*{{{*/ $order = DAL::get()->find('TelOrder', $orderId); if($order->isNull()) { $this->setErrorCode(328); return 0; } $out = $this->getOrder($order, array()); $attachmentIds = array(); $infos = BingLiDtoClient::getInstance()->getBingLiByRelatedObj($order->notification->proposal); if(false == $order->getBingLiSource()->isNull()) { $out += $this->getBingliDetail($order->getBingLiSource()->id, get_class($order->getBingLiSource())); } if (false == empty($infos->patientAttachment)) { foreach ($infos->patientAttachment as $pa) { $attachmentIds[] = $pa->patientAttachmentId; $patientAttachment = DAL::get()->find('PatientAttachment', $pa->patientAttachmentId); $typeDesc = PatientAttachment::$typeList[$patientAttachment->type]; $out['checkProject'] = $patientAttachment->itemName ? $patientAttachment->itemName : ''; $out['bingliType'] = $typeDesc['name']; $out['checkTime'] = substr($patientAttachment->checkTime,0,11); } } foreach($attachmentIds as $attachmentId) { $out['attachments'][] = MainDataBucket::getAttachmentInfoByAttachId($attachmentId); } if(false == isset($out['attachments'])) { $out['attachments'] = array(); } $this->content = $out; }/*}}}*/
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); }/*}}}*/
/** * uploadPostImage 医生图片上传接口 * * @param mixed $userId * @param mixed $clientId * @access public * @return void */ public function uploadPostImage($userId, $clientId) {/*{{{*/ $space = DAL::get()->find('Space', $userId); if($space->isNull()) { $this->setErrorCode(606); return 0; } $content = MainDataBucket::upload($userId, $_FILES); if(false == is_array($content)) { $this->setErrorCode($content); return 0; } $this->content = array('userId'=>$userId, 'clientId'=>$clientId, 'attachmentId'=>$content['attachmentId']); }/*}}}*/