public function testShouldGetOriginalGETData() { $_GET = ['city' => 'city a', 'page' => 1]; $this->object->set('add', ['city' => 'city b']); $this->assertEquals(['city' => ['=' => ['city a', 'city b']]], $this->object->filter()); $this->assertTrue($this->object->paginate()); $this->object->refresh(); $this->assertEquals(['city' => ['=' => ['city a']]], $this->object->filter()); $this->object->refresh(['city' => 'city a;city b']); $this->assertEquals(['city' => ['=' => ['city a', 'city b']]], $this->object->filter()); $this->assertFalse($this->object->paginate()); }
public function addBingli($request, $response) { $data = $request->getUnSafeData('attachment'); $data['title'] = Request::filter($data['title']); $data['title02'] = Request::filter($data['title02']); if(isset($data['title01'])) { $data['title01'] = Request::filter($data['title01']); } $type = isset($data['type']) ? Request::filter($data['type']) : PatientAttachment::TYPE_OTHER; $fileType = isset($data['fileType']) ? Request::filter($data['fileType']) : 0; $content = isset($data['content']) ? $data['content'] : ''; $timeYear = $request->getRequest('time_year', ''); $timeMonth = $request->getRequest('time_month', ''); $timeDay = $request->getRequest('time_day', ''); if($timeYear && $timeMonth && $timeDay) $checkTime = XDateTime::createXDateTime($timeYear, $timeMonth, $timeDay); else $checkTime = XDateTime::today(); $title1 = ''; if(isset($data['title01']) && $data['title01']) { $tmp = ''; if($type == PatientAttachment::TYPE_YINGXIANG) $tmp = '检查部位:'; else if($type == PatientAttachment::TYPE_BINGLI) $tmp = '病理标本:'; $title1 = $tmp.$data['title01']."\n"; } $title2 = ''; if(isset($data['title02']) && $data['title02']) { $title2 = '检查医院:'.$data['title02']."\n"; } $title = $title1.$title2.$data['title']; // 传入默认的patientid $pa = BingLiClient::getInstance()->addBingLi($this->_newUser->id, PatientAttachment::DEFAULT_PATIENTID, $title, $type, $fileType, $content, $checkTime); $typeName = PatientAttachment::$typeList[$type]; echo "<script>parent.myAttach('el_my_attachment', true);</script>"; exit(); }
public function replyCase($caseId, $userId, $content, $deviceType, $options = array()) {/*{{{*/ $content = Request::filter($content); $user = DAL::get()->find('user', $userId); if ($user->isNull()) { $this->setErrorCode(107); return 0; } $thread = $this->getTheRightThread($caseId); if($thread->isNull()) { $this->setErrorCode(142); return 0; } if($thread instanceof Intention) { $this->setErrorCode(601); return 0; } $attachmentIds = ''; if(isset($options['attachmentIds'])) { $attachmentIds = $options['attachmentIds']; } $postContent = array('content'=>$content, 'attachmentIds'=>$attachmentIds); if($thread instanceof DoctorPatientRef) {/*{{{*/ if($userId == $thread->patient->user->id) { $canUserReply = 0; if($thread->canPatientReply() && false == $thread->isClosePost()) { $canUserReply = 1; } //如果用户是当前医生的免费随访用户, 不能回复 $followupPatientSignin = $thread->patient->user->getFollowupPatientSignin($thread->space->id); if(false == $followupPatientSignin->isNull() && false == $followupPatientSignin->isPayingStatus()) { $canUserReply = 0; } if(0 == $canUserReply) { $this->setErrorCode(195); return 0; } } $attachmentIds = explode(',', $attachmentIds); $option['attachmentIds'] = $attachmentIds; $post = DoctorPatientPostClient::getInstance()->addPost($thread->id, $userId, $content, $option); DBC::requireFalse($post->isNull(), '系统繁忙,请稍后重试'); //系统日志 try{ FlowClient::getInstance()->addLog($thread,$user, DoctorPatientLog::TYPE_SYSTEM_LOG, 'CaseDataBucket::replyCase', $post); }catch(Exception $ex) {} //加入默认患友会 if($user->id == $thread->space->user->id && $thread->space->isPatientOpened() && $thread->isReGroupMember() == false) { FlowClient::getInstance()->addUserToDefaultReGroup($thread->id, $user->id); } }/*}}}*/ else if ($thread instanceof Proposal) {/*{{{*/ if ($userId != $thread->user->id) { $this->setErrorCode(195); return 0; } $attachmentIds = array_filter(explode(',', $attachmentIds)); $intention = IntentionClient::getInstance()->replenishByProposal($thread, Intention::SRC_ANDROID, $content, $attachmentIds); if ($intention->isNull()) { $this->setErrorCode(195); return 0; } $this->content = array('intentionId' => $intention->id); }/*}}}*/ }/*}}}*/
/** * 获取PATCH请求参数 */ protected function patch($key, $default = '', $type = 'str') { if (Request::method() !== 'patch') { return $default; } $json = Request::stream(); $data = json_decode($json, true); if (!$data) { return $default; } $data = Request::filterArray($data); return Request::filter($key, $data, $default, $type); }
public function addBingli($request, $response) {/*{{{*/ $data = $request->getUnSafeData('attachment'); $data['title'] = Request::filter($data['title']); $data['title02'] = Request::filter($data['title02']); if(isset($data['title01'])) { $data['title01'] = Request::filter($data['title01']); } $type = isset($data['type']) ? Request::filter($data['type']) : PatientAttachment::TYPE_OTHER; $fileType = isset($data['fileType']) ? Request::filter($data['fileType']) : 0; $content = isset($data['content']) ? $data['content'] : ''; $timeYear = $request->getRequest('time_year', ''); $timeMonth = $request->getRequest('time_month', ''); $timeDay = $request->getRequest('time_day', ''); if($timeYear && $timeMonth && $timeDay) $checkTime = XDateTime::createXDateTime($timeYear, $timeMonth, $timeDay); else $checkTime = XDateTime::today(); $title1 = ''; if(isset($data['title01']) && $data['title01']) { $tmp = ''; if($type == PatientAttachment::TYPE_YINGXIANG) $tmp = '检查部位:'; else if($type == PatientAttachment::TYPE_BINGLI) $tmp = '病理标本:'; $title1 = $tmp.$data['title01']."\n"; } $title2 = ''; if(isset($data['title02']) && $data['title02']) { $title2 = '检查医院:'.$data['title02']."\n"; } $title = $title1.$title2.$data['title']; // 传入默认的patientid if($this->_newUser->isNull()) { $this->_newUser = DAL::get()->find('user', PatientAttachment::DEFAULT_USERID); } $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); $patientId = $patient->id; $user = $patient->user; } $hospitalId = $request->hoskey; $date = $request->date; $hospitalName = $request->hospitalName; $facultyName = $request->facultyName; $itemName = trim($request->itemName); $hospitalId = isset($hospitalId)?$hospitalId:0; $checkTime = isset($date)?$date:$checkTime; $hospitalName = isset($hospitalName)?$hospitalName:''; $facultyName = isset($facultyName)?$facultyName:''; $itemName = isset($itemName)?$itemName:''; $pa = BingLiClient::getInstance()->addBingLi($user->id, $patientId, $title, $type, $fileType, $content, $checkTime, '', $hospitalName, $facultyName, $itemName, $hospitalId); $patientAttachmentDto = BingLiDto::createPatientAttachmentDto($pa->id, $hospitalId, $patientId); AskSessionInfo::addPatientInfo(NodeObj::NODE_DEFINE_ATTACHMENT, $patientAttachmentDto); $typeName = PatientAttachment::$typeList[$type]; //复查项目id $questionCategoryId = $request->questionCategoryId; if(empty($questionCategoryId)) { echo "<script>parent.myAttach('el_my_attachment', true, '".$patientId."');</script>";; } else { echo "<script>parent.myAttach('el_my_attachment$questionCategoryId', true, '".$patientId."');parent.addCheckupReport('$questionCategoryId', '$pa->id')</script>";; } return parent::DIRECT_OUTPUT; }/*}}}*/
public function filter($name) { return Request::filter(Request::param($name)); }