public function doUploadAttach($request, $response) { /*{{{*/ $patient = DAL::get()->mustFind('Patient', $request->patientid); $file = $_FILES['attach']; if (0 == $file['error']) { $attach = Uploader::file2attach($patient->user, $file); $hospitalDtoId = 0; $hospitalName = $request->hospitalName; $facultyName = $request->facultyName; if (false == empty($hospitalName) || false == empty($facultyName)) { $hospitalDto = BingLiDto::createHospitalDto($hospitalName, $facultyName, $patient->id); $hospitalDtoId = NodeClient::getInstance()->addBingLi($hospitalDto, NodeObj::SOURCE_PATIENT); } $pa = BingLiClient::getInstance()->addBingLi($patient->user->id, $patient->id, '', PatientAttachment::TYPE_PIC, 0, '', $request->checkTime, $attach->id, $hospitalName, $facultyName, $request->itemName, $hospitalDtoId); $obj = DAL::get()->find($request->objname, $request->objid); $this->bindAttachBingliByPaIds($patient, array($pa->id), $obj); } echo "<script>parent.\$.fancybox.close();parent.document.location.reload();</script>"; return parent::DIRECT_OUTPUT; }
public function hospitalChip($request, $response) {/*{{{*/ $hosKeyAndNum = $request->id; $hosKeyAndNumList = explode('_', $hosKeyAndNum); $hosKey = $hosKeyAndNumList[0]; $response->num = $hosKeyAndNumList[1]; $hosName = XString::convertToGbk($request->hos); $depName = XString::convertToGbk($request->dep); $hospitalDto = BingLiDto::createHospitalDto($hosName, $depName); $newHosKey = AskSessionInfo::modifyPatientInfo(NodeObj::NODE_DEFINE_HOSPITAL, $hosKey, $hospitalDto); $hosInfo = AskSessionInfo::getSinglePatientInfos(NodeObj::NODE_DEFINE_HOSPITAL, $newHosKey); $response->hosInfo = $hosInfo; $response->newHosKey = $newHosKey; }/*}}}*/
private function collectHosInfo($request, $response) {/*{{{*/ if(XString::getLengthOfGBKString($_REQUEST['hos'])<1 || XString::getLengthOfGBKString($_REQUEST['hos']) > 20) { throw new BizException('医院名称请控制在20字内'); } if(XString::getLengthOfGBKString($_REQUEST['dep'])<1 || XString::getLengthOfGBKString($_REQUEST['dep']) > 20) { throw new BizException('科室名称请控制在20字内'); } $hospitalName = XString::convertUTF8ToGBK(ltrim($request->hospitalName)); $facultyName = XString::convertUTF8ToGBK(ltrim($request->facultyName)); $patientHospital = BingLiDto::createHospitalDto($hospitalName, $facultyName); return $patientHospital; }/*}}}*/
public function add($request, $response) {/*{{{*/ $this->breakIfLessMessage($request, $response); if ($response->isQQ) { $this->checkLogin($request, $response); } $isLogin = UserClient::getInstance()->isLogin(); if ($isLogin == true) { $curUser = $this->_newUser; } else { $username = $request->username; $password = $request->password; $curUser = UserClient::getInstance()->register($username, $password); User::sendRegisterMsg($curUser->id); $curUser = UserClient::getInstance()->login($username, $password, false, null, $this->partnerDomain); } if ($curUser->isNull()) { throw new BizException('该邮箱已被注册!');; } if (false == $curUser->allowQuestion()) { throw new BizException('不允许提问'); } $patient = $this->getPatient($request, $curUser); $space = DAL::get()->find('space', $request->host_id); $ip = RequestDelegate::getIp(); $diseaseDto = BingLiDto::createDiseaseDto(XString::convertToGbk($request->case_disease_tag), $patient->id); $titleDto = BingLiDto::createTitleDto(XString::convertToGbk($request->case_title), $patient->id); $hospitalDto = BingLiDto::createHospitalDto(XString::convertToGbk($request->case_prehospital), XString::convertToGbk($request->case_prekeshi), $patient->id); $hopeHelpDto = BingLiDto::createHopeHelpDto(XString::convertToGbk($request->post_help), $patient->id); $content = "检查及化验:\n".XString::convertToGbk($request->post_content). "\n治疗情况(当前用药或近期手术):\n".XString::convertToGbk($request->post_effects). "\n病史:\n".XString::convertToGbk($request->post_history); if(XString::getLengthOfGBKString(XString::getLengthOfGBKString($content)>1000)) { throw new BizException('请精简您所填写的病情信息'); } $contentDto = BingLiDto::createConditionDescDto($content, $patient->id); $realBingLiDtos = NodeClient::getInstance()->addBingLis(array( $diseaseDto, $titleDto, $hospitalDto, $hopeHelpDto, $contentDto, ), NodeObj::SOURCE_PATIENT); if(false == $space->isNull()) { $product = ProductClient::getInstance()->getFirstFlowProduct($space); } else { $product = FirstFlowPoolVirtualProduct::fetch(); } SpaceClient::getInstance()->ensureAllowAskRule($curUser, $space); $src = $_SERVER['HTTP_HOST']; $intention = IntentionClient::getInstance()->createWithProduct($patient, $product, $src, $realBingLiDtos, $ip); $response->setRedirect('http://'.$_SERVER['HTTP_HOST'].$response->router->urlfor('thread/finish', array('threadId' => $intention->id))); }/*}}}*/