コード例 #1
0
 public function formatData()
 {/*{{{*/
     $item = "<item>\n";
     $data = $this->data;
     foreach($data as $key=>$value)
     {
         if ($key == 'diseasevotes')
         {
             $item .= "<diseasevotes>\n";
             foreach ($value as $voteItems)
             {
                 $item .= "<diseasevote>\n";
                 foreach ($voteItems as $voteKey => $voteValue) 
                 {
                     $newkey = XString::convertToUnicode($voteKey);
                     $newvalue = XString::convertToUnicode($voteValue);
                     $item .= "<{$newkey}><![CDATA[{$newvalue}]]></{$newkey}>\n";
                 }
                 $item .= "</diseasevote>\n";
             }
             $item .= "</diseasevotes>\n";
         }
         else
         {
             $newkey = XString::convertToUnicode($key);
             $newvalue = XString::convertToUnicode($value);
             $item .= "<{$newkey}><![CDATA[{$newvalue}]]></{$newkey}>\n";
         }
     }
     $item .= '</item>';
     return $item;
 }/*}}}*/
コード例 #2
0
 public function formatData()
 {/*{{{*/
     $item = "<display>\n";
     $data = $this->data;
     foreach($data as $key=>$value)
     {
         if($key == 'contents')
         {
             $contents = $data['contents'];
             if(false == empty($contents))
             {
                 foreach($contents as $content)
                 {
                     $newkey = XString::convertToUnicode($content['type']);
                     $newvalue = XString::convertToUnicode($content['content']);
                     $item .= "<{$newkey}><![CDATA[{$newvalue}]]></{$newkey}>\n";
                     unset($newkey, $newvalue, $content);
                 }
             }
             unset($contents);
         }
         else
         {
             $newkey = XString::convertToUnicode($key);
             $newvalue = XString::convertToUnicode($value);
             $item .= "<{$newkey}><![CDATA[{$newvalue}]]></{$newkey}>\n";
             unset($newkey, $newvalue);
         }
         unset($key, $value);
     }
     $item .= '</display>';
     unset($data);
     return $item;
 }/*}}}*/
コード例 #3
0
 public function before($context)
 {
     $userId = $context->request->userId;
     $user = DAL::get()->find('user', $userId);
     $action = strtolower($context->request->action);
     $os = $context->request->os;
     $ver = $context->request->v;
     if(false !== strpos($action, 'doctoruser') || false !== strpos($action, 'main') || $context->request->xdoc || false !== strpos($action, 'flowref_uploadsound'))
     {
     }
     else
     {
         if ($user->isNull() || $user->getCertificateForMobile() != $context->request->certificateToken)
         {
             $this->echoErrorCode();
         }
         if($user->hasSpace())
         {
             $space = $user->getSpace();
             if($user->name != 'malijuanmlj' && $space->host instanceof Doctor && $space->host->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp())
             {
                 $this->echoErrorCode();
             }
         }
         //绑定设备验证                                                                                                                                                    
         if ($os == 'ios' && $ver >= '3.0.3' || $os == 'android' && $ver >= '3.0.8') 
         {
             $deviceToken = $os == 'ios' ? $context->request->deviceOpenUDID : $context->request->deviceToken;
             $doctorUser = DAL::get()->find_by_userid_and_status('doctoruser', $userId, DoctorUser::STATUS_BIND, true);
             if($doctorUser->isNull() == false && $doctorUser->deviceToken != $deviceToken && false == in_array($userId, DoctorUser::$doctorId4Test))
             {
                 $msg = "您的账号于 ".date('H:m', strtotime($doctorUser->ctime))." 在一台 ".$doctorUser->deviceType." 手机登录。如非本人操作,则密码可能已泄露,建议重新登录修改密码或直接联系我们 ".HdfPhoneNumber::PHONE_DOCTORHELP." 修改密码";
                 $msg = XString::convertToUnicode($msg);
                 echo '{"errorCode":"888","msg":"'.$msg.'","content":[]}';
                 exit;
             }
         }
     }
     if (($os == 'ios' && $ver >= '3.0.1' || $os == 'android' && $ver >= '3.0.5') && $this->actionIsNotInActions($context->action)) 
     {
         if ($user->id == 0) return;//用户id是0 的过滤
         $doctorOwner = DAL::get()->find_by_userid('DoctorOwner', $user->id);
         if (false == $doctorOwner->isNull() && $doctorOwner->isPreDoctor())
         {
             $predoctor = $doctorOwner->source;
             if ($predoctor->isRefused())
             {
                 echo '{"errorCode":"8000","msg":"","content":[]}';
                 exit;
             }
             if ($predoctor->isAbnormal())
             {
                 echo '{"errorCode":"8001","msg":"","content":[]}';
                 exit;
             }
         }
     }
 }
コード例 #4
0
 public function ajaxDeleteGroupPost($request, $response)
 {
     /*{{{*/
     $patientCategoryId = $request->category_id;
     ForumClient::getInstance()->deleteGroup($patientCategoryId);
     //$this->message('组已经被删除', $response, array('text' => '返回列表', 'url' => $response->router->urlfor('adminpatient/index')));
     echo json_encode(array('status' => '0', 'content' => XString::convertToUnicode('组已经被删除')));
     return parent::DIRECT_OUTPUT;
 }
コード例 #5
0
    public function ajaxAddFlowChargeOrder($request, $response)
    {/*{{{*/
       $refId = $request->getRequest('refid', 0);
       $ref = DAL::get()->find('DoctorPatientRef', $refId);
       $cashAccount = $this->user->getCashAccount();
       $product = ProductClient::getInstance()->getDoctorChargeFlowProduct($ref->space);

       if (false == ($ref instanceof DoctorPatientRef && $ref->user->id == $this->user->id && $ref->space->isChargeOpened()))
       {
           $msg = "对不起,您不能预充值";
           $res = "failure";
       }
       else if ($ref->isSpaceCanPost() && false == $ref->isLastSpaceReply())
       {
           $msg = "抱歉!现在不能购买。您已经提前购买了{$ref->space->name}医生的3次指导机会,为避免资源浪费,请在使用后再次购买。";
           $res = "failure";
       }
       else if ($cashAccount->amount < $product->salePrice)
       {
           $msg = "您的余额不足,不能购买,请充值后重新购买。";
           $res = "failure";
       }
       else
       {
           $serviceOrder = ServiceOrderClient::getInstance()->create($ref, $product, $this->user);
           if(false == $serviceOrder->isNull())
           {
               ServiceOrderClient::getInstance()->pay($serviceOrder, $this->user);
               $serviceOrder = DAL::get()->find('serviceOrder', $serviceOrder->id, true);
               if ($serviceOrder->isPaid())
               {
                   $msg = "支付成功!";
                   $res = "success";
               }
               else
               {
                   $msg = "支付失败!";
                   $res = "failure";
               }
           }
           else
           {
               $msg = "支付失败!";
               $res = "failure";
           }
       }
       $results = array('res' => $res, 'msg' => XString::convertToUnicode($msg));
       echo json_encode($results);
       return self::DIRECT_OUTPUT;
    }/*}}}*/
コード例 #6
0
 public function ajaxValidSpace($request, $response)
 {
     /*{{{*/
     $content = array();
     $userName = $request->username;
     $space = DAL::get()->find_by_userName('space', $userName);
     if ($space->isNull() == false && $space->isConfirmed()) {
         $content['id'] = $space->id;
         $content['name'] = XString::convertToUnicode($space->host->name);
         $content['faculty'] = XString::convertToUnicode($space->host->hospitalfaculty->name);
         $content['hospital'] = XString::convertToUnicode($space->host->hospitalfaculty->hospital->name);
         $content['key'] = md5('haodf2014' . $space->id . '0');
     }
     echo json_encode($content);
     return parent::DIRECT_OUTPUT;
 }
コード例 #7
0
	public function ajaxAnnouncePost($request, $response)
	{
		$titleUtf8 = $request->title;
		$announceUtf8 = $request->announce;
		$title = XString::convertToGbk($titleUtf8);
		$announce = XString::convertToGbk($announceUtf8);

		SpaceClient::getInstance()->setProperties($this->_newSpace->id, array('announceTitle'=>$title, 'announce'=>$announce));
		$results = array('status' => 0, 'announce_title' => $title == '' ? '欢迎词':XString::convertToUnicode(XString::truncate($title, 66)), 
					'announce' => nl2br($announceUtf8));
		echo json_encode($results);
		exit;
	}
コード例 #8
0
ファイル: wapalipay.php プロジェクト: sdgdsffdsfff/hdf-client
 public function encryptOrderInfo($sn, $type, $price, $callBackUrl, $name, $description = '')
 {
     /*{{{*/
     $callBackUrl = urlencode($callBackUrl);
     $sn = Pay::makeSN($sn, $type);
     $partner = $this->partner;
     $seller = $this->seller;
     $out_trade_no = $sn;
     $subject = $name . "-订单号({$sn})";
     $body = $description;
     $total_fee = number_format($price, 2, '.', '');
     $notifyurl = $callBackUrl;
     //异步返回
     $waitSign = 'partner="' . $partner . '"&seller="' . $seller . '"&out_trade_no="' . $out_trade_no . '"&subject="' . $subject . '"&body="' . $body . '"&total_fee="' . $total_fee . '"&notify_url="' . $notifyurl . '"';
     // $waitSignArr = array('partner' => $partner, 'seller' => $seller, 'out_trade_no' => $out_trade_no, 'subject' => $subject, 'body' => $body, 'total_fee' => $total_fee, 'notify_url' => $notifyurl, 'signType' => 'RSA');
     // $waitSign = $this->create_linkstring($waitSignArr);
     $waitSign_utf8 = XString::convertToUnicode($waitSign);
     //utf-8
     $sign = $this->sign($waitSign_utf8);
     $sign = urlencode($sign);
     $string = $waitSign . '&sign_type="RSA"' . '&sign="' . $sign . '"';
     return $string;
 }
コード例 #9
0
 public function ajaxRemitBankList($request, $response)
 {
     /*{{{*/
     $bankType = $request->bankType;
     $remitList = AccountClient::getInstance()->getRemit4OrderList(Remit::TYPE_UNCLAIMED, $bankType);
     $res = array();
     foreach ($remitList as $remit) {
         if (false == $remit->isNull()) {
             $res[$remit->id] = XString::convertToUnicode($remit->getBriefInfo());
         }
     }
     echo json_encode($res);
     exit;
 }
コード例 #10
0
ファイル: xstring.php プロジェクト: sdgdsffdsfff/hdf-client
 public static function getContentWithOutHtml($content)
 {
     $content = XString::convertToUnicode($content);
     $content =  html_entity_decode($content);
     $content = preg_replace("/\&ldquo\;/i", '"', $content); 
     $content = preg_replace("/\&rdquo\;/i", '"', $content);
     //error_log($content."\n",3,'/tmp/wap123.log');
     //$content = strip_tags($content,'<br/> </p> </div> <br>');
     $params = array('<br />', '</p>', '</div>', '<br>','<BR>', '<BR />', '<div>');
     $content = str_replace($params, "\r\n", $content);
     $content = preg_replace("/<div[^>]*>/i", "\r\n", $content);
     $content = preg_replace("/<a[^>]*>/i", "", $content);
     $content = preg_replace("/&#\d{3,6};/", "", $content);
     $options = array('&nbsp;','&amp;nbsp;');
     $content = str_replace($options, " ", $content);
     //这会丢失文本
     $content = strip_tags($content);
     //error_log($content."\n",3,'/tmp/wap123.log');
     $content = preg_replace('/((\r\n )|(\r\n))+/', "\n", $content);
     $content = preg_replace('/((\n )|(\n))+/', "\n", $content);
     $content = XString::convertToGbk($content);
     if(mb_strlen($content) > 6746)
     {
         $content = substr($content, 0, 6746).'...';
     }
     return $content;
 }
コード例 #11
0
 public function ajaxGetHospitalFaculty($request, $response)
 {
     /*{{{*/
     $hfLevel = $hospitalLevel = '';
     $hf = DAL::get()->find('hospitalfaculty', $request->hfid);
     if (false == $hf->isNull()) {
         $hfLevel = XString::convertToUnicode($hf->getHospitalFacultyLevelDesc());
         $hospitalLevel = XString::convertToUnicode($hf->hospital->getGradeStr());
     }
     $results = array('hfLevel' => $hfLevel, 'hospitalLevel' => $hospitalLevel);
     echo json_encode($results);
     return self::DIRECT_OUTPUT;
 }
コード例 #12
0
<?php include('_treatment.php');?>
<!--治疗情况 end--> 

<!--用药情况 start-->
<?php include('_medicine.php');?>
<!--用药情况 end-->

<!--内容 start-->
<?php include('_content.php');?>
<!--内容 end-->

<!--加号信息 start-->
<?php include('_booking.php');?>
<!--加号信息 end-->

<!--电话咨询信息 start-->
<?php include('_telorder.php');?>
<!--电话咨询信息 end-->

<!--附件 start-->
<?//php include("_attachment.php");?>
<!--附件 end-->
<?php
$html = ob_get_contents();
ob_end_clean();
header("Content-Type: text/html; charset=UTF-8");
echo $callback.'(';
echo json_encode(XString::convertToUnicode($html));
echo ');';
?>
コード例 #13
0
	function ajaxCaseStatusTip()
	{/*{{{*/
		$tip = ''; 
		if (false == $this->_newSpace->isCaseOpen())
		{
			$tip = XString::convertToUnicode('您关闭了此功能,患者不能向您提问,<a id="anchor_case_open" class="red" href="javascript: void(0);">点击打开</a>');
		}
		else if (false == $this->_newSpace->isNewCaseOpen())
		{
			$tip = XString::convertToUnicode('您限制了新患者提问,患者不能向您提问,<a href="#" onclick="space_edit_case_setup(this); return false;" class="red">点击设置</a>');
		}
		else if ($this->_newSpace->modulecase->allowNewMaxNumber == 0)
		{
			$tip = XString::convertToUnicode('您限制了新患者提问,患者不能向您提问,<a href="#" onclick="space_edit_case_new_max_number(this); return false;" class="red">点击设置</a>');
		}
		else if(ThreadClient::getInstance()->isAskedFullBySpace($this->_newSpace->user->id))
		{
			$tip = XString::convertToUnicode('您限制了患者提问数量,目前咨询已满,其他患者不能向您提问,<a href="#" onclick="space_edit_case_new_max_number(this); return false;" class="red">点击设置</a>');
		}
		
		echo json_encode(array('tip'=>$tip));
		exit;
	}/*}}}*/
コード例 #14
0
	public function stopAddSignPost($request, $response)
	{
		ini_set('display_errors', false); // json output do no error information
		$vars      = $request->var;
		$vars      = XString::toGbkDeep($vars);
		$beginTime = $vars["year1"].'-'.$vars['month1'].'-'.$vars['day1'].' '.$vars['time1'].':00:00';
		$endTime   = $vars["year2"].'-'.$vars['month2'].'-'.$vars['day2'].' '.$vars['time2'].':00:00';
		$beginTime = $beginTime;
		$endTime   = $endTime;
		$doctorUserId = $this->_newSpace->id;
		if ($beginTime > $endTime){
			
			echo json_encode(array(
				'status'   => 1,
				'content'  => XString::convertToUnicode('开始时间大于结束时间'),
			));
			exit;
		} else {
			$orderList = BookingClient::getInstance()->getSendSmsOrderList($this->_newSpace->id, $beginTime, $endTime);
			if (empty($orderList)){
				echo json_encode(array(
					'status'   => 1,
					'content'  => XString::convertToUnicode('选择时间内没有加号信息'),
					));
				exit;
			} else {
				foreach ($orderList as $order) {
					try {
						$user = DAL::get()->find('User', $this->_newSpace->id);
						BookingClient::getInstance()->doctorCancelOrder($user, $order->id);
					} catch(Exception $e) {
						$msg = '发送失败,原因是可能你已经发送过了';	
					}
				}
				$msg = '停诊通知已告知相应患者';
				echo json_encode(array(
					'status'   => 0,
					'content'  => XString::convertToUnicode($msg),
					));
				exit;
			}
		}
	}
コード例 #15
0
 /** 获取文章内容*/
 public function ajaxShareArticle($request, $response)
 {
     /*{{{*/
     $article = DAL::get()->find('Article', $request->articleId);
     $res['title'] = XString::convertToUnicode($article->title);
     $res['content'] = XString::convertToUnicode(mb_substr(trim(preg_replace(array("/(&#[0-9]+;)/", "/(&\\w+;)/"), '', str_replace(array("\r", "\n"), '', strip_tags(htmlspecialchars_decode($article->content))))), 0, 110, 'GBK'));
     echo json_encode($res);
     return parent::DIRECT_OUTPUT;
     $this->patient = $patient;
 }
コード例 #16
0
 private function getTip()
 {
     /*{{{*/
     $tip = '';
     if (false == $this->space->isCaseOpen()) {
         $tip = XString::convertToUnicode('您关闭了此功能,患者不能向您提问。<a href="javascript:;" onclick="case_link_bind()" class="edit3 f12">点击打开</a>');
     } else {
         if (false == $this->space->isNewCaseOpen()) {
             $tip = XString::convertToUnicode('您限制了新患者提问,患者不能向您提问。<a href="/thread/ajaxcaseswitcher" class="popupwindow edit3 f12">点击设置</a>');
         } else {
             if ($this->space->modulecase->allowNewMaxNumber == 0) {
                 $tip = XString::convertToUnicode('您限制了新患者提问,患者不能向您提问。<a href="/adminthread/ajaxnewmaxnumber" class="popupwindow edit3 f12">点击设置</a>');
             } else {
                 if (SpaceModuleCaseClient::getInstance()->isAskedFull($this->space, $needCache = false)) {
                     $tip = XString::convertToUnicode('您限制了患者提问数量,目前咨询已满,其他患者不能向您提问。<a href="/adminthread/ajaxnewmaxnumber" class="popupwindow edit3 f12">点击设置</a>');
                 }
             }
         }
     }
     return $tip;
 }
コード例 #17
0
 /** 设置网站座右铭 */
 public function ajaxPostMotto($request, $response)
 {
     /*{{{*/
     $mottoUtf8 = $request->motto;
     $motto = XString::convertToGbk($mottoUtf8);
     SpaceClient::getInstance()->setProperties($this->space->id, array('motto' => $motto));
     $results = array('res' => 'success', 'motto' => XString::convertToUnicode(trim($mottoUtf8) ? $mottoUtf8 : "编辑网站座右铭"));
     echo json_encode($results);
     return self::DIRECT_OUTPUT;
 }
コード例 #18
0
 /**
  * 创建alipay.wap.trade.create.direct接口
  */
 function alipay_wap_trade_create_direct($parameter, $key, $sign_type)
 {
     foreach ($parameter as $a => $value) {
         $parameter[$a] = XString::convertToUnicode($value);
     }
     $this->_key = $key;
     //MD5校验码
     $this->sign_type = $sign_type;
     //签名类型,此处为MD5
     $this->parameter = wap_alipay_function::getInstance()->para_filter($parameter);
     //除去数组中的空值和签名参数
     $this->req_data = $parameter['req_data'];
     $this->format = $this->parameter['format'];
     //编码格式,此处为utf-8
     $sort_array = wap_alipay_function::getInstance()->arg_sort($this->parameter);
     //得到从字母a到z排序后的签名参数数组
     $this->mysign = wap_alipay_function::getInstance()->build_mysign($sort_array, $this->_key, $this->sign_type);
     //生成签名
     $this->req_data = wap_alipay_function::getInstance()->create_linkstring($this->parameter) . '&sign=' . urlencode($this->mysign);
     //配置post请求数据,注意sign签名需要urlencode
     //Post提交请求
     $result = $this->post($this->gateway);
     // $result = urldecode($result);
     // var_dump($result);exit;
     // var_dump($this->getToken($result));exit;
     //调用GetToken方法,并返回token
     return $this->getToken($result);
 }