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;
 }/*}}}*/
Ejemplo n.º 2
0
    private function getRealData(Hospital $hospital, $hospitalName = '')
    {/*{{{*/
        $res = array();
        if ($hospitalName)
        {
            $hsName = $hospitalName;
        }
        else
        {
            $hsName = $hospital->name;
        }

        $hospitals['item']['key'] = $hsName;
        $hospitals['item']['title'] = XString::truncate($hospital->commonName.'科室列表_门诊时间表_专家推荐_好大夫在线',59,'');
        $hospitals['item']['level'] = $hospital->getGradeStr();//
        $hospitals['item']['url'] = $hospital->getUrl();
        $hospitals['item']['address'] = strip_tags($hospital->address);
        $hospitals['item']['address_url'] = $hospital->getReMapUrl();
        $hospitals['item']['description'] = strip_tags($hospital->intro);
        $hospitals['item']['description_url'] = $hospital->getInfoUrl();
        $hospitals['item']['luxian'] = $hospital->addressinfo;
        $hospitals['item']['telephone'] = $hospital->phone;
        $hospitals['item']['online_doctors'] = $hospital->spaceCount;
        $hospitals['item']['online_doctors_url'] = $hospital->getDoctorUrl();
        $hospitals['item']['tel_doctors'] = HospitalClient::getInstance()->getHospitalDirectCallCount($hospital->id);
        $hospitals['item']['tel_doctors_url'] = $hospital->getTelDoctorUrl();
        $hospitals['item']['showurl'] = 'www.haodf.com/';

        $res[] = $hospitals;
        BeanFinder::get('LocalCache')->removeAll(); 
        return $res;

    }/*}}}*/
Ejemplo n.º 3
0
    private function getRealData(Hospital $hospital, $hospitalName = '', $isPlus)
    {/*{{{*/
        $res = array();
        if ($hospitalName)
        {
            $hsName = $hospitalName;
        }
        else
        {
            $hsName = $hospital->name;
        }

        $res['key'] = $hsName;
        $res['url'] = $hospital->getUrl();
        $res['title'] = XString::truncate($hsName.'科室列表_门诊时间表_专家推荐_好大夫在线', 58, '...');
        $res['type'] = isset(self::$hospitalLevelList[$hospital->grade])?self::$hospitalLevelList[$hospital->grade]:'';
        $res['address'] = XString::truncate($hospital->address, 65, '');
        $res['mapUrl'] = $hospital->getReMapUrl();
        $res['tel'] = XString::truncate($this->getPhoneStr($hospital->phone), 66, '...');
        $res['zixunUrl'] = $hospital->getDoctorUrl();
        $res['jiahaoUrl'] = $hospital->getJiaHaoUrl();
        $res['doctorUrl'] = $hospital->getDiseaseUrl();
        $res['keshiUrl'] = $hospital->getScheduleUrl();
        $res['showUrl'] = 'www.haodf.com';
        $res['infoUrl'] = $hospital->getInfoUrl();
        $res['date'] = date('Y-m-d', time());
        return $res;
    }/*}}}*/
Ejemplo n.º 4
0
    private function buildData($datas)
    {/*{{{*/
        $res = array();
        if (false == $datas)
        {
            return $res;
        }

        foreach($datas as $hospital)
        {
            $intro = (empty($hospital->conclusion))?$hospital->intro:$hospital->conclusion;
            $intro = XString::truncate(strip_tags($intro),500);
            $hospitalFacultyInfo = $this->getHospitalFacultyForm($hospital->id);
            $res[$hospital->id]['item'] = array(
                'key' => $hospital->name,
                'title' => $hospital->name,
                'synonym' => $hospital->synonyms,
                'url' => $hospital->getUrl(),
                'grade' => $hospital->getGradeStr(),
                'address' => $hospital->address,
                'phone' => $hospital->phone,
                'way' => XString::cntrim(strip_tags($hospital->addressInfo)),
                'intro' => XString::cntrim(strip_tags($intro)),
                'zixunInfo' => ($hospital->spaceCount)?"咨询".$hospital->spaceCount."位大夫":"",
                'zixunInfoUrl' => ($hospital->spaceCount)?$hospital->getDoctorUrl():"",
                'hospitalInfo' => "科室".$hospital->facultyCount."个, 大夫".$hospital->doctorCount."人",
                'hospitalFacultyCnt' => $hospital->facultyCount,
                'hospitalInfoUrl' => $hospital->getScheduleUrl(),
                'hospitalFacultyInfo' => $hospitalFacultyInfo,
            );
            unset($hospital);
        }
        return $res;
    }/*}}}*/
Ejemplo n.º 5
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;
 }/*}}}*/
Ejemplo n.º 6
0
    private function getRealData(Disease $disease, $diseaseName = '')
    {/*{{{*/
        $diseaseList = array();
        $res = array();
        if ($diseaseName)
        {
            $dName = $diseaseName;
        }
        else
        {
            $dName = $disease->name;
        }
        //为了Grave'S疾病"'"转义问题
        $dName = preg_replace('/&#39;/', "'", $dName);

        $res['key'] = $dName;
        $res['url'] = $disease->getUrl();
        $res['title'] = XString::truncate($dName."症状_治疗_".$dName."好评专家_咨询_预约_好大夫在线", 56, '...');
        $res['showUrl'] = 'www.haodf.com';
        $res['pageSize'] = rand(58, 62).'K';
        $res['date'] = date('Y-m-d', time());
        $res['content'] = XString::truncate($dName.'好评专家'.$disease->goodVoteCount.'位,可咨询'.$dName.'问题,预约专家门诊,权威专家亲自介绍'.$dName.'病因,症状,治疗,如何护理'.$dName.'患者等.', 156, '...'); 
        $diseaseList['item'] = $res;
        return $diseaseList;
    }/*}}}*/
 protected function getData($nowPage, $pageSize)
 {/*{{{*/
     $dataList = $this->prepareData($nowPage, $pageSize);
     $res = array();
     foreach ($dataList as $data)
     {
         $tempData = array();
         $tempData['item']['key'] = $data['dname'].'医院';
         $tempData['item']['url'] = 'http://haoping.haodf.com/jibing/'.$data['dkey'].'/yiyuan.htm';
         $tempData['item']['showUrl'] = XString::truncate('haoping.haodf.com/jibing/'.$data['dkey'].'/yiyuan.htm', 38, '...');
         $tempData['item']['title'] = $data['dname']."推荐医院_好大夫在线";
         $tempData['item']['pageSize'] = rand(58, 62).'K';
         $tempData['item']['date'] = date('Y-m-d', time());
         $tempData['item']['content'] = "各地".$data['dname']."医院就医指南";
         foreach ($data['formdata'] as $key => $form)
         {
             $data['formdata'][$key]['form']['diseaseHospitalUrl'] = 'http://haoping.haodf.com/hospital/'.Codec::getInstance()->encodeId($form['form']['hid']).'/'.$data['dkey'].'.htm';
             unset($form);
         }
         $tempData['item'] = $tempData['item'] + $data['formdata'];
         $res[] = $tempData;
         unset($data);
    }
     return $res;
 }/*}}}*/
  private function filterContent($content)
 {/*{{{*/
     $content = trim(strip_tags($content)); 
     $content = str_replace('&amp;nbsp;', '', $content);
     $content = str_replace('&nbsp;', '', $content);
     return XString::truncate($content, 500, '...');
 }/*}}}*/
Ejemplo n.º 9
0
    public function detail($request, $response)
    {/*{{{*/
		$articleId = intval($request->getRequest('article_id', 0));
		$article = DAL::get()->find('article', $articleId);
        if($article->isNull())
        {
            $this->_exit404();
        }
        DBC::requireFalse($article->isDelete(), "文章已经被删除了!");
        DBC::requireFalse($article->isShield(), "文章正在审核中!");
        if ($article->isAuditing())
        {
            $result = $this->filterArticle($article);
            if (false == empty($result['title']) || false == empty($result['content']))
            {
                DBC::requireFalse(true, "文章正在审核中!");
            }
        }
        $isShare = $request->getRequest('isShare', '');
        //分享文章阅读量统计
        if(false == empty($isShare))
        {
            HitClient::getInstance()->increaseArticleHitsForShare($article->id);
        }
        $response->article = $article;
        $response->topTitle = XString::truncate($article->title, 18);
        $response->title = $article->title."_好大夫在线";

        $articleAttachmentRef = new NullEntity();
        if ($article->hasDocAttachment())
        {
            $articleAttachmentRef = ArticleClient::getInstance()->getValidAttachmentRef($article->id);
        }
        $response->articleAttachmentRef = $articleAttachmentRef;
    }/*}}}*/
Ejemplo n.º 10
0
	public function postTopic($request, $response)
	{
		$groupIds = $request->groupIds;
		if(!$groupIds)
		{
			$response->message = '没有选择话题所在的组!';
			MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/post', array('delay' => 6, 'button' => 'back'));
			return false;
		}
		$title = $request->title;
		$content = preg_replace("/<\/?a[^>]*>/i", "", $request->content);
		if(XString::cntrim($title) == '' || XString::cntrim($content) == '')
		{
			$response->message = '话题标题和内容都不能为空!';
			MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/post', array('delay' => 6, 'button' => 'back'));
			return false;
		}
		$groups = DAL::get()->find('regroup', $groupIds);
		foreach($groups as $group)
		{
			if($group->reboard->isNull() == false)
			{
				$member = ForumClient::getInstance()->getMemberByUserIdAndGroupId($this->user->id, $group->id);
				if($member->isNull() == false && $member->isForbiddened())
				{
					$response->message = '您的发言没有成功,可能是已被禁止发言!服务电话:'.HdfPhoneNumber::PHONE_FENZHEN;
					MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/index', array('delay' => 6, 'button' => 'back'));
					return false;
				}
				ResidentEvilClient::getInstance()->createTopic($group->space, $group->reboard, $this->user, $title, $content);
			}
		}
		$response->message = '话题发表成功!';
		MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/index', array('delay' => 6, 'button' => 'back'));
	}
 protected function getData($nowPage, $pageSize)
 {/*{{{*/
     $hospitalList = DAL::get()->find_all_AllHospital4Sc('hospital', $nowPage, $pageSize); 
     $doctorDescription = array();
     foreach($hospitalList as $hospital)
     {
         $doctorList = DAL::get()->find_all_by_hospitalid('doctor', $hospital->id);
         foreach($doctorList as $doctor)
         {
             $tempIntroArray = array();
             $tempIntroArray['key'] = $hospital->commonName.$doctor->name;
             $tempIntroArray['city'] = $hospital->city;
             $tempIntroArray['doctor_name'] = $doctor->name;
             $tempIntroArray['doctor_pic'] = '';
             $tempIntroArray['doctor_link'] = $doctor->getTouchUrl();
             $tempIntroArray['hospital'] = $hospital->name;
             $tempIntroArray['department'] = $doctor->getHospitalFacultyName();
             $tempIntroArray['doctor_title'] = $doctor->grade." ".$doctor->educateGrade;
             $tempIntroArray['good_at'] = trim(XString::truncate($doctor->specialize, 200));
             $doctorIntro = trim(XString::truncate(strip_tags($doctor->intro), 200));
             $tempIntroArray['personal_details'] = $doctorIntro;
             $tempIntroArray['personal_details_link'] = $doctor->getTouchIntroUrl();
             $tempIntroArray['site_name'] = '好大夫在线';
             $doctorDescription[] = array('item' => $tempIntroArray);
             unset($doctor);
         }
         unset($doctorList);
         unset($hospital);
         BeanFinder::get('LocalCache')->removeAll();
     }
     unset($hospitalList);
     BeanFinder::get('LocalCache')->removeAll();
     return $doctorDescription;
 }/*}}}*/
Ejemplo n.º 12
0
    private function getServiceOrderList($userId, $pageId, $pageSize)
    {/*{{{*/
        $serviceOrderList = DAL::get()->find_all_charge_orders('serviceorder', $userId, ServiceDef::TYPE_FLOW);
        foreach ($serviceOrderList as $key => $serviceOrder)
        {
            $flow = $serviceOrder->source;
            if (false == $flow instanceof DoctorPatientRef || $flow->space->isNull())
            {
                unset($serviceOrderList[$key]);
                continue;
            }
            if ($serviceOrder->isUnpaid() && $flow->hasSpaceLeftAllowCnt())
            {
                unset($serviceOrderList[$key]);
            }
        }

        XString::sortArray($serviceOrderList, 'ctime');

        $showList = array_slice($serviceOrderList, ($pageId-1)*$pageSize, $pageSize);
        $pageInfo['pages'] = ceil(count($serviceOrderList)/ $pageSize);
        $pageInfo['pagesize'] = $pageSize;
        $pageInfo['nowpage'] = $pageId;
        $pageInfo['total'] = count($serviceOrderList);
        return array('list' => $showList, 'pageInfo' => $pageInfo);
    }/*}}}*/
Ejemplo n.º 13
0
    private function getRealData(Hospital $hospital, $hospitalName = '')
    {/*{{{*/
        $res = array();
        $hospitalList = array();
        if ($hospitalName)
        {
            $hsName = $hospitalName;
        }
        else
        {
            $hsName = $hospital->name;
        }

        $res['key'] = $hsName;
        $res['url'] = $hospital->getUrl();
        $res['title'] = XString::truncate($hsName.'科室列表,门诊时间,专家推荐_好大夫在线', 59, '...');
        $res['showUrl'] = 'www.haodf.com';
        $res['pageSize'] = rand(60, 66).'K';
        $res['date'] = date('Y-m-d', time());
        $extContent = ($hospital->spaceCount > 0) ? ",以及".$hospital->spaceCount."位医生提供免费网上咨询":"";
        $res['content'] = "提供医院简介、地址、预约挂号电话、科室门诊时间,包括".$hsName.$hospital->facultyCount."个科室、".$hospital->doctorCount."位医生的相关介绍".$extContent;
        $hospitalList['item'] = $res;
        BeanFinder::get('LocalCache')->removeAll(); 
        return $hospitalList;
    }/*}}}*/
 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;
             }
         }
     }
 }
Ejemplo n.º 15
0
    /**
        * @brief 获取医生的文章列表 
        * @author 
        * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/article_getDoctorArticleList?userId=581662815&pageId=1&pageSize=10
        *
        * @Param $doctorId 用户id
        * @Param $pageSize 每页显示数
        * @Param $nowPage 当前页码
        *
        * @Returns array('id', 'sn', 'price', 'statusDesc', 'flowId', 'spaceId', 'doctorName', 'hospitalName', 'hospitalFacultyName', 'alertMsg', 'needPay', 'caseType', 'doctorAssistant', 'doctorAssistantTel');
     */
    public function getDoctorArticleList($userId, $doctorId, $pageSize = 10, $pageId = 1)
    {/*{{{*/
        $doctor = DAL::get()->find('doctor', $doctorId);
        $user = DAL::get()->find('user', $userId);
        if($userId != $this->currentUserId)
        {
            $this->setErrorCode(309);
            return 0;
        }
		if ($user->isNull() || $user->id == 0)
		{
            $this->setErrorCode(107);
            return 0;
        }
        if($doctor->isNull())
        {
            $this->setErrorCode(132);
            return 0;
        }
    	if ($doctor->space->isNull())
        {
            $this->setErrorCode(144);
            return 0;
        }
		$res = ArticleClient::getInstance()->getList($doctor->space->id, '', $pageId, $pageSize, array('articleLevel' => Article::LEVEL_2, 'orderby' => 'topLevel desc, fld_ArticleCreateTime desc'));
        $myDoctor = DAL::get()->find_by_userIdAndDoctorId('userdoctor', $userId, $doctor->id);
        $results = array();
        $articleIds = array();
        foreach($res['articleList'] as $article)
        {
            $result = array();
            $result['id'] = $article->id;
            $result['title'] = $article->title;
            $result['doctorName'] = $article->space->host->name." ".$article->space->host->hospitalfaculty->hospital->commonName;
            $result['content'] = XString::truncate(str_replace(array("\n", "\t", "\r", "&nbsp;"), "", strip_tags(htmlspecialchars_decode($article->content))), 50); 
            $result['ctime'] = $article->ctime;
            $result['hits'] =  HitClient::getInstance()->getArticleHitsForMobile($article->id) + $article->hits;
            $result['url'] = '';
            $result['type'] = "article";
            $result['isSelfOwner'] = 0;
            $result['subscriptionId'] = $myDoctor->id;
            $result['subscriptionType'] = 'userdoctor';
            $articleIds[] = $article->id;
            $results[$article->id] = $result;
        }
        $readStatus = SubscriptionClient::getInstance()->getUserSubscriptionReadStatus($userId, $articleIds);
        foreach($readStatus as $contentId => $status)
        {
            $results[$contentId]['readStatus'] = $status;
        }
        $this->content = array_values($results); 
        $pageInfo['pages'] = $res['pageInfo']['pages'];
        $pageInfo['pagesize'] = $pageSize;
        $pageInfo['nowpage'] = $pageId;
        $pageInfo['total'] = $res['pageInfo']['total'];
        $this->pageInfo = $pageInfo;
    }/*}}}*/
 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;
 }
Ejemplo n.º 17
0
    public function doAddBingliToIntention($request, $response)
    {/*{{{*/
        $intention = DAL::get()->find('Intention', $request->intentionId);
        DBC::requireTrue(false == $intention->isNull() && $this->user->id == $intention->user->id, '无效数据');

        $content = trim(XString::convertUTF8ToGBK($request->content));
        $paIds = array_filter(explode(',', $request->attachmentIds));
        $newIntention = IntentionClient::getInstance()->replenishFromIntention($intention, Intention::SRC_TOUCH, $content, $paIds);

        $response->setRedirect($response->router->urlfor('intention/intentionlist', array('patientId' => $newIntention->patient->id)));
    }/*}}}*/
 private function checkPhoneNumber(array $phones, $errorMsgs)
 {/*{{{*/
     $phones  = array_filter($phones);
     foreach ($phones as $phone)
     {
         if (false == XString::isValidPhoneNumber($phone))
         {
             $errorMsgs[] = "<span class='yellow'>电话号码({$phone})格式有问题</span>";
         }
     }
     return $errorMsgs;
 }/*}}}*/
Ejemplo n.º 19
0
 public function callback($request,$response)
 {
     if (md5($request->msg_id . $request->task_id . $request->fault_time . BeanFinder::get('configs')->jiankongbaoToken)
         == $request->token)
     {
         $content = XString::convertEncoding($request->content, 'gbk', 'utf-8');
         SMSClient::getInstance()->sendSMS(HdfPhoneNumber::$opsPhoneNumbers, $content.' by jkb');
         echo 'OK';
         return parent::DIRECT_OUTPUT;
     }
     echo 'INVALID';
     return parent::DIRECT_OUTPUT;
 }
Ejemplo n.º 20
0
    public function testIsEmail()
    {/*{{{*/
        $this->assertTrue(XString::isEmail('*****@*****.**'));
        $this->assertTrue(XString::isEmail('*****@*****.**'));
        $this->assertTrue(XString::isEmail('*****@*****.**'));
        $this->assertTrue(XString::isEmail('*****@*****.**'));
        $this->assertTrue(XString::isEmail('*****@*****.**'));

        $this->assertFalse(XString::isEmail(123));
        $this->assertFalse(XString::isEmail('abc'));
        $this->assertFalse(XString::isEmail('123@haodf'));
        $this->assertFalse(XString::isEmail('13839799202@.com'));
    }/*}}}*/
Ejemplo n.º 21
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;
    }/*}}}*/
Ejemplo n.º 22
0
    public function cityList($request, $response)
    {/*{{{*/
        $provKey = $request->provinceKey;
		$provInfo = array_merge(Area::provInfo(), Area::provInfoAppend());
		$provName = $provInfo[$provKey]['Province'] ? $provInfo[$provKey]['Province'] : '北京';
		$citys = HospitalClient::getInstance()->getHospitalCityList($provName);
        $selectedCity = $request->getRequest(self::SELECT_PAGE_PARAM, 'all');

        $response->citys = XString::trimArray($citys);
        $response->provKey = $provKey;
        $response->provName = $provName;
        $response->topTitle = '按地区筛选';
        $response->title = "按地区筛选医院_好大夫在线";
        $response->selectedCity = $selectedCity;
    }/*}}}*/
Ejemplo n.º 23
0
    /**
        * @brief 根据用户id获取站内信列表
        * @author whd
        * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/message_getinboxmsglistbyuserid?userId=613876396&type=all&pageId=1&pageSize=10&xdoc=1
        *
        * @Param $userId 用户id
        * @Param $type (all,unread)
        * @Param $pageId 当前页码
        * @Param $pageSize 每页显示数
        *
        * @Returns  array('id', 'title', 'isread', 'senderName', 'content', 'ctime') 
     */
    public function getInboxMsgListByUserId($userId, $type, $pageId, $pageSize)
    {/*{{{*/
        $user = DAL::get()->find('user', $userId);
        if ($user->isNull())
        {
            $this->setErrorCode(107);
            return 0;
        }
        $this->_initPageInfo($pageId, $pageSize);
        $options = array();
        $options['filterSourceType'] = Message::TYPE_PATIENTCLUB;
        if ($type == 'unread')
        {
            $options['isread'] = 0;
        }
        if ($type == 'orderbyunread')
        {
            $options['orderby'] = 'isread';
        }
		$res = StationLetterClient::getInstance()->getMsgs($userId, Box::TYPE_INBOX, $pageId, $pageSize, $options);
        $mailList = $res['msgInfos'];
        $infos = array();
        $senderIds = array();
        foreach ($mailList as $mail)
        {
            if(empty($mail))
                continue;
            $info = array();
            $info['id'] = $mail['id'];//boxmsgref->id
            $info['title'] = strip_tags($mail['title']);
            $info['isread'] = $mail['isread'];//状态
            $info['senderName'] = $mail['senderId'];
            $info['content'] = mb_substr(trim(XString::fixHtmlText(str_replace('&nbsp;', '', $mail['content']))), 0, 15, 'GBK');
            $info['ctime'] = strtotime($mail['ctime']);
            $infos[] = $info;
            $senderIds[] = $mail['senderId'];
        }
        $userList = DAL::get()->find('User', $senderIds);
        foreach($infos as $key => $info)
        {
            if ($userList[$info['senderName']]->isNull())
                $infos[$key]['senderName'] = '身份不明';
            else
                $infos[$key]['senderName'] = $userList[$info['senderName']]->name;
        }
        $this->pageInfo = $res['pageInfo'];
        $this->content = $infos;
    }/*}}}*/
Ejemplo n.º 24
0
	public function addAttach($request, $response) 
	{
		if (isset($_FILES['attach'])) {
			$file = $_FILES['attach'];
			if ($file['error']==0) {
                $file['name'] = XString::convertToGbk($file['name']);
                $file['name'] = TuClient::getInstance()->checkFileSuffixName($file);
                $filePath = TuClient::getInstance()->uploadAttach($file);
				$attach = AttachClient::getInstance()->addAttach($this->_newUser->id, $file['name'], $filePath, $file['type'], $file['size'], Attachment::TYPE_JPG, '', '');
				// 传入默认的patientid
				$bingLi = BingLiClient::getInstance()->addBingLi($this->_newUser->id, PatientAttachment::DEFAULT_PATIENTID, '', PatientAttachment::TYPE_PIC, 0, '', '', $attach->id);
				echo "<script>parent.tb_remove();parent.showMyAttach('el_my_attachment', 0, '".$bingLi->id."');</script>";
				//echo "<script>parent.showMyAttach('el_my_attachment', 0, '".$bingLi->id."');</script>";
			} 
		}
		exit();
	}
 public function dealEvaluation($request, $response)
 {
     /*{{{*/
     $this->privilegeManagement();
     //mark是标记,remark是备注
     $feedbackId = $request->id;
     $mark = $request->mark;
     $status = $request->status;
     $remark = $request->remark;
     $remark = XString::convertToGbk($remark);
     if (empty($remark)) {
         $remark = "";
     }
     UserFeedbackClient::getInstance()->dealEvaluation($feedbackId, $mark, $status, $remark, $this->curInspector->id);
     echo json_encode(array('success' => 1));
     return self::DIRECT_OUTPUT;
 }
Ejemplo n.º 26
0
 private function getDoctorComment($doctor)
 {/*{{{*/
     $cureExp = DAL::get()->find_all_Doctor2Comments('cureexp', $doctor->id); 
     foreach($cureExp as $key => $cure)
     {
         if($cure->isNull())
         {
             unset($cureExp[$key]);
         }
     }
     $thankLetter = array();
     if(count($cureExp) < 2)
     {
         $thankLetter = DAL::get()->find_all_Doctor2Comments('curethankletter', $doctor->id);
         foreach($thankLetter as $key => $letter)
         {
             if($letter->isNull())
             {
                 unset($thankLetter[$key]);
             }
         }
     }
     $sum = count($cureExp) + count($thankLetter);
     $res = array();
     if($sum == 0)
     {
         return false;
     }
     else
     {
         foreach ($cureExp as $key => $comment)
         {
             $content = trim(XString::truncate(strip_tags($comment->content), 200));
             $res[$key]['comment']['content'] = mb_substr($content, 5 , 200,'gbk');
             $res[$key]['comment']['diseaseName'] = $comment->disease->name?$comment->disease->name:'';
         }
         foreach($thankLetter as $key => $comment)
         {
             $content = trim(XString::truncate(strip_tags($comment->content), 200));
             $res[$key]['comment']['content'] = $content;
             $res[$key]['comment']['diseaseName'] = $comment->disease->name?$comment->disease->name:'';
         }
     }
     return $res;
 }/*}}}*/
Ejemplo n.º 27
0
 public function ajaxShowTelSmsList($request, $response)
 {/*{{{*/
     $mobile = $request->mobile;
     $minCtimeOfTaskId = $request->minctimeoftaskid;
     if(XString::isMobile($mobile) == false)
     {
         die("亲,电话不是手机号。没有短信哦");        
     }
     if(isset($minCtimeOfTaskId) == false)
     {
         die("亲,没有任务");        
     }
     $telTask = DAL::get()->find('TelTask', $minCtimeOfTaskId);
     $filter = " mobile=:mobile and ctime >= :ctime order by ctime desc limit 20";
     $binds = array(':mobile'=>$mobile, ':ctime'=>$telTask->ctime);
     $mobileSmsLogs = DAL::get()->find_all_by_condition("smslog", $filter, $binds);
     $response->mobileSmsLogs = $mobileSmsLogs;
 }/*}}}*/
Ejemplo n.º 28
0
 private static function getFileList($dataPath)
 {/*{{{*/
     $dirList = XString::listDir($dataPath);
     $fileList = array();
     foreach ($dirList as $dirName)
     {
         $dirPath = $dataPath.$dirName;
         if (is_dir($dirPath))
         {
             $files = XString::listFile($dirPath, false);
             if ($files)
             {
                 $fileList[$dirName] = $files; 
             }
         }
     }
     return $fileList;
 }/*}}}*/
 private function getRealData($thankLetter)
 {/*{{{*/
     $res = array();
     $res['id'] = $thankLetter->id;
     $res['doctorId'] = Codec::getInstance()->encodeId($thankLetter->doctorId);
     if (false == $thankLetter->doctor->isNull())
     {
         $res['doctorName'] = $thankLetter->doctor->name;
     }
     if (false == $thankLetter->doctor->isNull() && false == $thankLetter->doctor->hospitalfaculty->isNull())
     {
         $res['hospitalFacultyId'] = $thankLetter->doctor->hospitalfaculty->getEncodeId();
     }
     $res['content'] = strip_tags($thankLetter->content);
     $res['patient'] = $thankLetter->user->isNull()?$thankLetter->ipLocation : XString::truncate($thankLetter->user->name, 1, "***");
     $res['ctime'] = $thankLetter->ctime;
     return $res;
 }/*}}}*/
Ejemplo n.º 30
0
 public function testWrap()
 {/*{{{*/
     $dir = dirname(__FILE__);
     $wrapper = new Wrapper;
     $xsltFile = $dir.'/demo.xslt';
     $xmlFile = $dir.'/demo.xml';
     $result = $wrapper->wrap($xsltFile, $xmlFile);
     $expectedRes = '<?xml version="1.0" encoding="gbk"?>
                         <document>
                         <item>
                         <hospitalfacultyname>testÒ½Ôºtest¿Æ</hospitalfacultyname>
                         <url>www.haodf.com</url>
                         </item>
                         </document>';
     $resArray = XString::xmlToArray($result);
     $expectedResArray = XString::xmlToArray($expectedRes);
     $this->assertEquals($expectedResArray, $resArray);
 }/*}}}*/