public function paySms($request, $response) { /*{{{*/ $phoneNumbers = $request->phoneNumbers; $content = $request->content; DBC::requireNotEmpty($phoneNumbers, '手机号不能为空!'); DBC::requireNotEmptyString($content, '内容不能为空!'); SMSClient::getInstance()->sendAsync($phoneNumbers, $content, SMSLog::OPT_TYPE_TEL_ZIXUN); $response->setRedirect($response->router->urlfor('serviceorder/showdetail', array('id' => $request->id, 'msg' => '短信发送成功!'))); }
public function reportInfo($request,$response) {/*{{{*/ $spaceId = $request->spaceid; $weixUserId = $this->getWeixUserIdFromRequest(); DBC::requireNotEmpty($weixUserId,"weixUserId不能为空"); DBC::requireNotEmpty($spaceId,"spaceId不能为空"); $nickName = DAL::get()->find('weixuser',$weixUserId)->nickname; $response->nickName = $nickName; $response->weixUserId = $weixUserId; $response->userPhone = $userPhone = $request->userPhone; $response->disease = $disease = $request->disease; $response->patientName = $patientName = $request->patientName; $space = DAL::get()->find('space',$spaceId); $response->spaceName = $space->name; $response->spaceId = $spaceId; }/*}}}*/
public function auditSave($request, $response) {/*{{{*/ $result = ""; $orderId = $request->orderId; $order = DAL::get()->find('telorder', $orderId, true); if ($order->executer->isGroup()) { throw new BizException('亲,这个是群.请先绑定医生再试试看~'); } $phonePurpose = $request->purpose; DBC::requireNotEmpty($phonePurpose, '通话目的不可为空'); DBC::requireNotEmptyString($request->userVisit['Course'], '病程不可为空'); DBC::requireNotEmptyString($request->userVisit['OutPatient'], '门诊就诊不可为空'); $purpose = implode(",", $phonePurpose); $params = array('diseaseCourse'=>(int)$request->userVisit['Course'], 'outPatientService'=>(int)$request->userVisit['OutPatient'], 'phonePurpose'=>$purpose, 'title'=>$request->orderTitle); $telOrderId = TelOrderClient::getInstance()->updateAuditOrder($orderId,$this->curUser, $params); $response->telOrder = $order; $response->setRedirect($response->router->urlfor('telorder/orderdetail', array('orderId'=>$orderId, 'msg'=>$result))."#msg"); }/*}}}*/
private function getQpayAccessUrl() { $configs = BeanFinder::get('configs'); if(isset($configs->qpayAccessUrl)) { return $configs->qpayAccessUrl; } DBC::requireNotEmpty('','QpayAccessUrl配置不可为空'); }
private function initial2bu($request) { /*{{{*/ DBC::requireNotEmpty($request->buGroupIds, 'BU组不能为空'); DBC::requireNotEmptyString($request->patientid, '患者id不能为空'); $group = $this->getInitialGroup($request->groupid); $patient = DAL::get()->mustFind('patient', $request->patientid); $inspectResultDtoArr = $this->getInspectResultDtoArr($patient, $group, Intention::STATUS_UNAUDIT, $request->buGroupIds); InspectClient::getInstance()->batchNext($patient, $this->curInspector, $group, $inspectResultDtoArr); }
public function bindDiseaseExperience($request, $response) {/*{{{*/ $diseaseKeys = $request->diseasekey; DBC::requireNotEmpty($diseaseKeys, "疾病信息不能为空"); AskSessionInfo::bindPatientInfos(NodeObj::NODE_DEFINE_DISEASE, $diseaseKeys); $request->keys = implode(",", $diseaseKeys); $request->type = "disease"; $this->ajaxSetAskSession($request, $response); $patientTreatmentInfo = AskSessionInfo::getPatientInfos(NodeObj::NODE_DEFINE_TREATMENT); if(false == empty($patientTreatmentInfo)) { $response->setRedirect($response->router->urlfor('newcase/treatmentexperiencewithpatient')); } else { $response->setRedirect($response->router->urlfor('newcase/choosetreatmentexperience')); } }/*}}}*/
public function updateEntity($entityType, $entityId, $args) { DBC::requireNotEmptyString($entityType, '实体名不可为空'); DBC::requireNotEmptyString($entityId, '实体Id不可为空'); DBC::requireNotEmpty($args, '要更新的参数不可为空'); self::checkEntityType($entityType); BeanFinder::get('dbexecuter')->mustUseMaster(); $entityObject = DAL::get()->find($entityType, $entityId); foreach ($args as $key => $value) { $entityObject->$key = $value; } return $entityObject->id; }
public function refuseContract($request, $response) {/*{{{*/ DBC::requireNotEmpty($request->deleteReason, '删除说明必填!'); $telContract = DAL::get()->find('telContract', $request->telContractId); $request->deleteReason .= TelContract::DELETE_MARK_CONTENT; $response->space = $this->_newSpace; $response->setRedirect($response->router->urlfor('adminpayment/showcontractlist')); }/*}}}*/
private function payOrder($orderIds, $userId) { /*{{{*/ DBC::requireNotEmpty($orderIds, '订单Id不可为空'); DBC::requireNotEmpty($userId, '用户Id不可为空'); $orders = DAL::get()->find('serviceOrder', $orderIds); $user = DAL::get()->mustFind('User', $userId); $accountTotal = 0; foreach ($orders as $orderItem) { $accountTotal += $orderItem->price; } if ($user->getCashAccount()->amount >= $accountTotal) { foreach ($orders as $order) { ServiceOrderClient::getInstance()->pay($order, $this->curInspector->user); } } else { die('余额不足,只认领不付款'); } }
public function updatePost($request, $response) { $id = $request->id; $space = DAL::get()->find('Space', $id); DBC::requireFalse($space->isNull(), '编辑对象为空'); $vars = $request->getUnSafeData('vars'); DBC::requireNotEmpty($vars, '编辑对象为空'); if (isset($vars['note1'])) { $offlineTime = $request->offline_year . '-' . $request->offline_month . '-' . $request->offline_day; $vars['offlineNoteValidTime'] = strtotime($offlineTime); } if (isset($vars['caseOpened']) || isset($vars['caseapplyopened'])) { $caseOpened = isset($vars['caseOpened']) ? $vars['caseOpened'] : ''; unset($vars['caseOpened']); $caseapplyopened = isset($vars['caseapplyopened']) ? $vars['caseapplyopened'] : ''; unset($vars['caseapplyopened']); SpaceClient::getInstance()->setCaseAndCaseApplyStatus($this->_newSpace, $caseOpened, $caseapplyopened); } $this->rebuildBookingTask($space, $vars); $r = SpaceClient::getInstance()->setProperties($id, $vars); if ($r) { $response->setRedirect("/space/edit?id={$id}&msg=" . urlencode('更新成功')); } }
private function breakIfLessMessage($request, $response) {/*{{{*/ $mustMessages = array( 'case_title' => '标题', 'case_disease_tag' => '疾病', 'case_prehospital' => '最后就诊医院', 'case_prekeshi' => '就诊科室', ); foreach($mustMessages as $inputName => $name) { $t = $request->$inputName; DBC::requireNotEmpty($t, $name.' 不能为空'); } }/*}}}*/
public function updateInspector($request, $response) { /*{{{*/ $inspectorId = $request->id; $realName = $request->realName; $inGroupIds = $request->getRequest('groupIds', array()); $allGroupIds = $request->allGroupIds; $outOfGroupIds = array_diff($allGroupIds, $inGroupIds); $email = $request->email; $role = $request->role; $tag = 0; if (empty($inspectorId)) { $userName = $request->getRequest('userName', ''); DBC::requireNotEmpty($userName, '请填写用户名'); $user = DAL::get()->find_by_name('user', $userName); DBC::requireFalse($user->isNull(), '请填写正确的用户名,无法找到此用户'); $inspector = DAL::get()->find_by_userid('inspector', $user->id); if (false == $inspector->isNull()) { if (false == $inspector->isActived()) { DBC::requireTrue(false, '该用户已被删除,请重新注册'); } } else { $inspectorId = InspectorClient::getInstance()->createInspector($user, $email, $realName, $role, $inGroupIds, $outOfGroupIds, $this->curInspector); } $tag = 1; } else { $inspector = DAL::get()->find('inspector', $inspectorId); InspectorClient::getInstance()->updateInspector($inspector, $email, $role, $realName, $inGroupIds, $outOfGroupIds, $this->curInspector); } $url = $response->router->urlfor('intentiongroup/showinspector', array('id' => $inspectorId, 'app' => $request->app, 'tag' => $tag)); $response->setRedirect($url); }
private function authAlipayUserInfo($request, $response) {/*{{{*/ $alipayOpenApi = new AlipayOpenApi(); $res = $alipayOpenApi->getAlipaySystemOauthTokenRequest($request->auth_code); $accessToken = $res->alipay_system_oauth_token_response->access_token; $alipayUserId = $res->alipay_system_oauth_token_response->alipay_user_id; error_log(XDateTime::now()." accessToken=".$accessToken." alipayUserId=".$alipayUserId."\n", 3, BeanFinder::get('configs')->logFilePath."alipay_auth.log"); DBC::requireNotEmptyString($accessToken, "用户授权失败,请返回重试!"); DBC::requireNotEmptyString($alipayUserId, "用户授权失败,请返回重试!"); $userInfoRes = $alipayOpenApi->getAlipayUserUserinfoShareRequest($accessToken); $retUserInfos = $userInfoRes->alipay_user_userinfo_share_response; DBC::requireNotEmpty($retUserInfos, "用户授权失败,请返回重试!"); error_log(XDateTime::now()." alipayUserId=".$alipayUserId." ".print_r($retUserInfos, true)."\n\n", 3, BeanFinder::get('configs')->logFilePath."alipay_auth.log"); $alipayUser = MobileClient::getInstance()->genAlipayUser($alipayUserId); $entityKeyValues = $alipayUser->__dump(); $tmpEntityFields = array_keys($entityKeyValues); $entityFields = array(); foreach ($tmpEntityFields as $field) { $entityFields[] = strtolower($field); } $params = array(); foreach ($retUserInfos as $key => $value) { $entityKey = 'alipay'.str_replace('_', '', $key); if (in_array($entityKey, $entityFields)) { $params[$entityKey] = mb_convert_encoding($value,'GBK','UTF-8'); } } DBC::requireNotEmpty($params, "用户授权失败,请返回重试!"); MobileClient::getInstance()->updateAlidayUser($alipayUser->alipayuserid, $params); $response->user = $this->forceLogin($alipayUser->userId); $this->user = $response->user; error_log(print_r($this->user, true), 3, "/tmp/alipay1.log"); return $alipayUser; }/*}}}*/
protected static function appendSyncKeyInOptions(array $options, $firstKey) { /*{{{*/ $keys = func_get_args(); unset($keys[0]); DBC::requireNotEmpty($keys, 'keys不能为空'); foreach ($keys as $key) { DBC::requireTrue(is_string($key) || is_int($key), 'key只能是字符串或者数字'); } $key = implode('_', $keys); $options['synchronized'] = true; $options['synchronizedKey'] = $key; return $options; }
private function joinParam($params) { /*{{{*/ DBC::requireNotEmpty($params, 'params参数不可为空'); $out = ''; foreach ($params as $key => $val) { $out .= $this->checkNull($key, $val); } return $out; }
public function sendDiagnoseReport($request, $response) {/*{{{*/ $spType = $request->spType; $confId = $request->confId; $reportContent = $request->reportContent; $loginUser = $this->curUser->name; DBC::requireNotEmpty($reportContent,"邮件内容不能为空"); $resultContent = ""; if(false == empty($spType)) { $resultContent = XDateTime::now()->toString()."{$spType} \n"; $resultContent .= $reportContent; if(false == empty($confId)) { $confMemberList = DAL::get()->find_all_by_confid('ConferenceMember', $confId); foreach($confMemberList as $confMember) { $resultContent .= "\n".$confMember->getRoleTitle()."|".$confMember->phoneNumber."|".$confMember->spcallId."|".$confMember->ctime."|".$confMember->startTime->toString(); if(false == $confMember->startTime->isZero()) { $resultContent .= "成功接听"; } } } $resultContent .= "\n"." ----BY ".$loginUser; EmailClient::getInstance()->batchSendMail(array('*****@*****.**'), '电话会议诊断结果', $resultContent); } $response->setRedirect("/paymentfront/telconference/diagnose?confId={$confId}&spType={$spType}&step=reportdiagnose"); }/*}}}*/
public function addLabelQuestionRefs($request, $response) { /*{{{*/ $this->checkAuditor(); DBC::requireNotEmpty($request->labelid, 'labelid不能为空'); $questionIds = DAL::get()->find_id_labelidAndSourceType('question', $request->labelid, 'question'); $currentQuestionIds = $request->getRequest('currentQuestionIds', array()); $deleteQuestionIds = array_diff($questionIds, $currentQuestionIds); WenDaClient::getInstance()->batchDeleteLabelFromSourceEntities($request->labelid, $deleteQuestionIds); $addQuestionIds = $request->getRequest('addQuestionIds', array()); $addQuestions = DAL::get()->find('question', $addQuestionIds); WenDaClient::getInstance()->batchAddLabel2sourceEntity($request->labelid, $addQuestions); $response->setRedirect($response->router->urlfor('checkup/checkupquestionlabelrefmanage', array('labelid' => $request->labelid))); }