public function __construct($options = null)
 {
     if ($options === null) {
         $options = Intention::getOption('db');
     }
     $this->connect($options);
 }
 public function notice($request, $response)
 {/*{{{*/
     if(XDateTime::isSpringHoliday())
     {
         $response->setRedirect(Intention::getIntentionTongzhiUrl());
         return false;
     } 
     $response->next = $request->next;
     $response->refer = $request->refer;
 }/*}}}*/
    public function askGuidePage($request, $response)
    {/*{{{*/
        $this->initialize($request, $response);
        $response->topTitle = "咨询前必读";

        if(date('Y-m-d H:i:s') <= '2014-04-18 17:30:00' || XDateTime::isSpringHoliday())
        {
            $response->setRedirect(Intention::getZixunNoticeTouchUrl());
            return false;
        } 

        AskSessionInfo::session_destroy();
        if(false == $this->user->isNull())
        {
            AskSessionInfo::bindUser($this->user->id);
        }

        $goUrl = $response->router->urlfor('newcase/checkcondition4pool');
        $caseHostId = $request->getRequest('host_id', 0);
        if($caseHostId > 0)
        {
            $doctor = DAL::get()->find('doctor', $caseHostId);
            if (false == $doctor->isNull())
            {
                if ($doctor->hasSpace() && $doctor->space->isConfirmed())
                {
                    AskSessionInfo::bindSpace($doctor->space->id);
                    $space = AskSessionInfo::getBindSpace();
                    if (false == $space->isNull())
                    {
                        if (false == $space->isCaseOpen())
                        {
                            $response->setRedirect($response->router->urlfor('doctor/casecallin', array('id'=>$doctor->getEncodeId())));
                            return false;
                        }
                        $goUrl = $response->router->urlfor('newcase/checkcondition4spacebefore');
                        $response->askSpace = $space;
                    }
                }
                else
                {
                    $response->setRedirect($response->router->urlfor('doctor/casecallin', array('id'=>$doctor->getEncodeId())));
                    return false;
                }
            }
        }
        $response->goUrl = $goUrl;
    }/*}}}*/
    private function ensureCanAsk($request, $response)
    {/*{{{*/
        $caseHostUserId = $request->getRequest('host_user_id', 0);
        $askSpace = DAL::get()->find('space', $caseHostUserId);
        if(XDateTime::isSpringHoliday() || XDateTime::isClosedThreadTime())
        {
            AskSessionInfo::session_destroy();
            $response->setRedirect(Intention::getIntentionTongzhiUrl());
            return false;
        } 

        if(false == $askSpace->isNull())
        {
            if ($askSpace->host instanceof Doctor)
            {
                $askSpace->host->doctorIsDead();
            }
            if ($this->skipHospitals($askSpace) || $this->skipDoctors($askSpace))
            {
                $response->setRedirect('http://www.'.URL_PREFIX.'haodf.com/info/spacefrontnotice.php');
                return false;
            }
        }
        try
        {
            SpaceClient::getInstance()->ensureAllowAskRule($this->_newUser, $askSpace);
        }
        catch(SpaceUnconfirmException $ex)
        {
            $response->setRedirect('http://'.URL_PREFIX.'zixun.haodf.com/newcase/askintentionintro?spaceid='.$askSpace->id.'&message='.$ex->getMessage());
            return false;
        }
        catch(SpaceCaseClosedException $ex)
        {
            $message = "暂时关闭,无法回复您的问题。";
            $response->setRedirect('http://'.URL_PREFIX.'zixun.haodf.com/newcase/askintentionintro?spaceid='.$askSpace->id.'&message='.$message);
            return false;
        }
        catch(SpaceForbiddenAnswerException $ex)
        {
            $message = "暂时关闭,无法回复您的问题。";
            $response->setRedirect('http://'.URL_PREFIX.'zixun.haodf.com/newcase/askintentionintro?spaceid='.$askSpace->id.'&message='.$message);
            return false;
        }
        return true;
    }/*}}}*/
    public function showFuwaiAsk($request, $response)
    {/*{{{*/
        if (XDateTime::isSpringHoliday())
        {
            $response->setRedirect(Intention::getIntentionTongzhiUrl());
		    return false;
        }
        $space = array();
        if ($request->host_user_id)
        {
            $space = DAL::get()->find('space', $request->host_user_id);
            if($space->isNull() == false && ($space->modulecase->allowNewMaxNumber == 0 || $space->isCaseAndNewCaseOpen() == false 
                    || $space->isNewCaseOpen() == false || false == $space->user->allowAnswer()))
            {
                throw new BizException('此功能暂时关闭'); 
            }
        }
        $response->caseTitle = $request->case_title;
        $response->isLogin = UserClient::getInstance()->isLogin();
        $response->space = $space;
        $response->categoryList = ThreadCateClient::getInstance()->getTopLevelList();
    }/*}}}*/
	public function showAsk($request, $response)
    {/*{{{*/
        if (XDateTime::isSpringHoliday())
        {
            $response->setRedirect(Intention::getIntentionTongzhiUrl());
		    return false;
        }

		$caseHostUserId = $request->getRequest('host_user_id', 0);

        //判断是否存在流关系:要判断caseHostUserId不可为空
        if($this->_newUser->isNull() == false && empty($caseHostUserId) == false)
        {
            $patients = $this->_newUser->patients;
            $patient = array_shift($patients);
            $doctorPatientRef = new NullEntity();
            if($patient != null)
            {
                $doctorPatientRef = FlowClient::getInstance()->getValidFlowRef($caseHostUserId, $patient->id);
            }
            if($doctorPatientRef->isNull() == false)
            {
                $response->setRedirect($doctorPatientRef->url);
                return;
            }
        } 

		$attachments = array();
		if (false == $this->_newUser->isNull())
		{
			//附件的获取
			$attachments = $this->_newUser->attachments;
			if (is_array($attachments) == false){
				if ($attachments->isNull())
				$attachments = array();
			}
		}

		$response->patientAttachments = $attachments;
		$askSpace = array();
		if ($caseHostUserId) {
			$askSpace = DAL::get()->find('space', $caseHostUserId);
		}
		/** 登录用户的咨询列表 */
		$userCaseList = array();

		/** 用户提问的一些限制 */
		$out = array();
		$res = $this->_userIsAllowAsk($askSpace, $out, $response);

		//咨询区未满,并且允许普通用户或者患者提问
		if ($res && false == $out['askSpaceFull'] && ($out['allowUserAsk'] || $out['allowPatientAsk'])) {
			$response->askSpaceObjectBefore = array();
		} else {
			$response->askSpaceObjectBefore = $askSpace;
			$askSpace = array();
		}


        $patients = $this->_newUser->patients;
        if(is_array($patients) && false == empty($patients))
        {
            $patient = array_shift($patients);
        }
        else
        {
            $patient = new NullEntity();
        }
        $response->patientInfo = $patient;
		$response->askSpaceRes = $out;
		$response->askSpace = $askSpace;
		$response->userCaseList = $userCaseList;
		$response->moduleCase = array();
		$response->allowPhone = isset($out['allowPhone'])?$out['allowPhone']:false;
	}/*}}}*/
 private function _doProcessIntention4Pay(Intention $intention, $request)
 {
     /*{{{*/
     $product = $intention->product;
     $space = $intention->space;
     $sourceId = $intention->id;
     $patient = $intention->patient;
     $content = $intention->getConditionDesc();
     $replenishUrl = $intention->getReplenishUrl();
     $showUrl = $intention->getUrl();
     $user = $intention->user;
     $isSuccess = $intention->isPaid();
     $from4UnionPay = 'intention';
     return new ShowPayTypePageDto($space, $patient, $sourceId, $request->sourceType, $product, $content, $replenishUrl, $showUrl, $user, $isSuccess, $from4UnionPay);
 }
 private function getBingliDetail($id, $type)
 {/*{{{*/
     $source = DAL::get()->find($type, $id);
     $bingliSet = BingLiDtoClient::getInstance()->getBingLiByRelatedObj($source);
     $isTreated = array_pop($bingliSet->treated)->treated;
     $diseaseList = empty($bingliSet->disease) ? array() : $bingliSet->disease;
     $diseaseDescList = empty($bingliSet->conditiondesc) ? array() : $bingliSet->conditiondesc;
     $diseaseStr = $diseaseDesc = $goalStr = '';
     foreach($diseaseList as $diseaseDto)
     {
         $diseaseStr .= $diseaseDto->diseaseName.' ';
     }
     $content['disease'] = $diseaseStr; 
     $content['isOldPatient'] = isset(BookingOrder::$treatedDesc[$isTreated]) ? BookingOrder::$treatedDesc[$isTreated] : '否';
     foreach($diseaseDescList as $diseaseDescDto)
     {
         if($diseaseDescDto->conditionDesc)
             $diseaseDesc .= str_replace(array("<br/>", "<br />"), "\n", $diseaseDescDto->conditionDesc).' ';
     }
     $content['diseaseDesc'] = $diseaseDesc; 
     $goalArray = Intention::getGoalDisplay(array_pop($bingliSet->goal)->goal);
     foreach($goalArray as $key => $value)
     {
         if ($value)
             $goalStr .= (BookingOrder::$goalDesc[$key])." ";
     }
     $content['goal'] = $goalStr; 
     $content['lastSeeTime'] = isset($bingliSet->lastTreatedTime) && 
         false == empty($bingliSet->lastTreatedTime) ? array_pop($bingliSet->lastTreatedTime)->lastTreatedTime : "";
     $content['time'] = isset($bingliSet->schedule) && 
         false == empty($bingliSet->schedule) ? array_pop($bingliSet->schedule)->schedule : "";
     $content['address'] = isset($bingliSet->address) && 
         false == empty($bingliSet->address) ? array_pop($bingliSet->address)->address : "";
     return $content;
 }/*}}}*/
Example #9
0
 </li>
    <!--是否老患者 end-->
</ul>
<?php 
}
?>

<?php 
if (false == empty($bingliSet->goal)) {
    ?>
<ul class="booking bingli">
    <!--就诊目的 start-->
        <li class="title">本次预约目的:</li>
        <li class="item">
<?php 
    $goalArray = Intention::getGoalDisplay(array_pop($bingliSet->goal)->goal);
    foreach ($goalArray as $key => $value) {
        if ($value) {
            echo BookingOrder::$goalDesc[$key] . " ";
        }
    }
    ?>
        </li>
    <!--就诊目的 end-->
</ul>
<?php 
}
?>

<?php 
$params = array('lastTreatedTime' => '上次就诊时间', 'schedule' => '加号时间', 'address' => '加号地点');
Example #10
0
                        <p class="tr pt10"><a href="/keshi/<?=$faculty->getEncodeId()?>/daifu.htm" class="green">查看更多好评大夫>></a></p>
                        </div>
                    </div>
                </div>

                
            </div>
            <!--end hdf-qq-main element-->
            <!--start hdf-qq-side element-->
            <div class="hdf-qq-side fr">
                <?php if ($isThreadOpen) { ?>
                <div class="hdf-qq-side-box hdf-qq-gray-b mt10">
                    <div class="hdf-qq-side-box-t"><h3 class="green fn f18 f-yaihei">在线咨询专家</h3></div>
                    <div class="hdf-qq-side-box-c p10">
                        <div class="question clearfix">
                        <form id="question-form" action="<?=Intention::getQQZixunUrl()?>" method="GET">
                            <div class="question-content fl">
                                <textarea class="f12" id="title" name="case_title" style="color: #666;font-size:14px;" rows="3" cols="28" onclick="cleanTips();">输入问题标题,点击提问按钮,立刻咨询万名正规医院实名大夫...</textarea>
                            </div>
                            <div class="question-btn fl"><a href="###" onclick="ask();">提问</a></div>
                            </form>
                        </div>
                        <div class="question-list pt15">
                           <a href="/thread/22.htm">·妇科</a>
                           <a href="/thread/25.htm">·儿内科 </a>
                           <a href="/thread/12.htm">·外科</a>
                           <a href="/thread/38.htm">·眼科</a>
                           <a href="/thread/44.htm">·男科 </a>
                           <a href="/thread/45.htm">·肿瘤 </a>
                           <a href="/thread/57.htm">·心理</a>
                           <a href="/thread/46.htm">·中医</a>
Example #11
0
 /**
  * Sets up the parameters (usualy from the url) in a logical manner
  * @param  array  $params Array containing the parameters
  * @return $this
  */
 protected function setParameters($url = '')
 {
     $this->_url = $url;
     $params = explode('/', $url);
     $p['controller'] = empty($params[0]) ? static::DEFAULT_CONTROLLER : $params[0];
     $p['page'] = empty($params[1]) ? static::DEFAULT_PAGE : $params[1];
     $p['arguments'] = array();
     if (!empty($params[2])) {
         for ($i = 2; $i < count($params); $i++) {
             $p['arguments'][] = $params[$i];
         }
     }
     self::$_options = array_merge(self::$_options, $p);
     return $this;
 }
Example #12
0
            </tr>
			<?php if (false == empty($space->commonCaseNote)) { ?>
             <tr>
                <td>&nbsp;</td>
                <td colspan="2" class="gray">咨询范围:<?=XString::truncate($space->commonCaseNote, 36)?></td>
            </tr>
            <?php } ?>
            <tr>
                <td class="lb_line" colspan="3"></td>
            </tr>
			<?php
			}
			?>
            <tr>
            <?php if ($isThreadOpen){ ?>
            <td align="right" colspan="3"><a href="<?=Intention::getQQZixunUrl()?>" class="orange">向更多在线好大夫咨询&gt;&gt;</a></td>
            <?php } else { ?>
            <td align="right" colspan="3"><a href="http://<?=URL_PREFIX?>zixun.haodf.com/ask.php" class="orange">向更多在线好大夫咨询&gt;&gt;</a></td>
            <?php } ?>
            </tr>
        </table></td>
    </tr>
    <tr>

        <td class="bottom_left"></td>
        <td class="bottom_middle"></td>
        <td class="bottom_right"></td>
    </tr>

    <tr>
        <td colspan="3" height="8"></td>
 private function getBingLi4Goal($bingLiSet, &$allBingli)
 {/*{{{*/
     if (false == empty($bingLiSet->goal))
     {
         $goalArray = Intention::getGoalDisplay(array_shift($bingLiSet->goal)->goal);
         $goalStr = "";
         foreach ($goalArray as $key => $value)
         {
             if($value)
             {
                 $goalStr .= (BookingOrder::$goalDesc[$key])." ";
             }
         }
         $allBingli['goal'] = array($goalStr);
     }
 }/*}}}*/