Ejemplo n.º 1
0
 public function addIncidentPost($request, $response)
 {
     $followupCustomerId = $request->followupCustomerId;
     $params = $request->arr;
     $vars = $request->vars;
     $incident = DAL::get()->find_by_title_and_followupcustomerid('Incident', $params['title'], $followupCustomerId);
     if ($incident instanceof Incident) {
         throw new BizException('事件名称已存在!');
     }
     $incidentId = IncidentClient::getInstance()->addIncident($followupCustomerId, $params['title'], $params['firstTime'], $params);
     $incident = DAL::get()->find('Incident', $incidentId);
     $followupCustomer = DAL::get()->find('FollowupCustomer', $followupCustomerId);
     $model = DAL::get()->find_by_title('NfsTaskModel', '症状事件');
     $model = array($model);
     $incident = DAL::get()->find('Incident', $incidentId);
     $user = $followupCustomer->getBindUser();
     $assigner = $this->auditor;
     $deadline = XDateTime::tomorrow();
     $taskDesc = "新建症状事件任务";
     $roleId = 825967283;
     //医助的角色id
     $taskId = TaskClient::getInstance()->addTask($model, $incident, $followupCustomer->space, $user, $assigner, $deadline, $taskDesc, $roleId);
     $this->addIncidentStatePostImp($incident, $vars);
     $preMsg = "{$incidentId} 添加成功";
     $response->setRedirect($response->router->urlfor('incident/incidentsofcustomer', array('followupCustomerId' => $followupCustomerId, 'preMsg' => $preMsg)));
 }
	/** 创建文章提交(D,HF) */
    public function newArticlePost($request, $response)
    {/*{{{*/
		if (XString::cntrim($request->getRequest('article_title')) == '') {
			$this->message('文章标题不能为空', $response);
			return false;
        }
        $todayHasArticleNumber = DAL::get()->queryCntOfSpace('Article', $this->_newSpace->id, XDateTime::today()->toString(), XDateTime::tomorrow()->addSecond(-1)->toString());
        if(Article::MAX_CAN_ARTICLE_ONE_DAY_ADD_TWO <= $todayHasArticleNumber)
        {
			$this->message("您今天已经发表了".Article::MAX_CAN_ARTICLE_ONE_DAY_ADD_TWO."篇文章,请您明天再发表", $response);
            return false;
        }

		$categoryId = intval($request->getRequest('category_id', 0));
		$data = array();
        $data['tags'] = $request->article_tags;
        $data['topLevel'] = $request->top_level;
        $data['docAttachmentId'] = $request->getRequest('docAttachmentId', 0);
        $articleSource = intval($request->article_source);
        if(!$articleSource)
        {
            $this->message("文章来源不能为空", $response);
            return false;
        }
		$article = ArticleClient::getInstance()->addArticle($this->_newSpace, $categoryId, $request->article_title, $request->getUnSafeData('article_content'), $articleSource, $data);
		if($article->isNull()){
			$this->message('系统繁忙,请稍后再试', $response, array('text' => '返回文章列表', 
				'url' => $response->router->urlfor('article/index')));
			return false;
		}
		
		$response->setRedirect($this->_newSpace->getUrl().'adminarticle/newpostcomplete?id='.$article->id);
	}/*}}}*/
 /**
  * getSubsidyInfosForIndex
  * 医生补贴的明细页面账户详情 
  * 
  * @param mixed $userId 
  * @access public
  * @return void
  */
 public function getSubsidyInfosForIndex($userId)
 {/*{{{*/
     $space = DAL::get()->find('Space', $userId); 
     if($space->isNull())
     {
         $this->setErrorCode(819);
         return 0;
     }
     $settleOrders = DAL::get()->find_all_by_spaceid('SettleOrder', $space->id);
     $settleOrders = array_reverse($settleOrders);
     $subsidyInfos = array();
     $subsidyAccountAmount = DAL::get()->queryCntByTimeSpan('PatientSignin', $space->id);
     $subsidyInfos['patientSignsForDoctor'] = $subsidyAccountAmount;
     $defaultEndTime = XDateTime::tomorrow()->toShortString();
     $totalSettleSubsidyAmount = AccountClient::getInstance()->getSettleSubsidyAmountInTimespan($space->id, XDateTime::DEFAULT_START_TIME, $defaultEndTime);
     $subsidyInfos['SettleAmountForSubsidy'] = $totalSettleSubsidyAmount;
     $subsidyInfos['UnSettleAmountForSubsidy'] = $space->getSubsidyAccount()->amount;
     $subsidyInfos['dateForSubsidyAccountItems'] = self::$dateForSubsidyAccount;
     $subsidyInfos['defaultStartTime'] = XDateTime::now()->addDay(-29)->toShortString();
     $subsidyInfos['defaultEndTime'] = $defaultEndTime;
     $this->content = $subsidyInfos;
 }/*}}}*/
 public function showFundStatement($request, $response)
 {
     /*{{{*/
     $fundAccount = $this->space->getFoundAccount();
     $params = array();
     $params['nowPage'] = $request->page ? $request->page : 1;
     $params['pageSize'] = 20;
     $defaultStartTime = XDateTime::today()->toShortString();
     $defaultEndTime = XDateTime::tomorrow()->toShortString();
     $settleOrders = DAL::get()->find_all_by_spaceid('SettleOrder', $this->space->id);
     if (false == empty($settleOrders)) {
         $settleOrders = array_reverse($settleOrders);
         $defaultStartTime = $settleOrders[0]->ctime->toShortString();
     }
     $spaceFundAttribute = $this->space->getFundAttribute();
     if ($spaceFundAttribute->isNull() == false) {
         $response->spaceFundAttribute = $spaceFundAttribute;
     }
     $response->startTime = $params['startTime'] = $request->getRequest('startTime', $defaultStartTime);
     $response->endTime = $params['endTime'] = $request->getRequest('endTime', $defaultEndTime);
     $res = AccountClient::getInstance()->getPayAccountItemsOfFundAccount($fundAccount->id, $params);
     $response->payAccountItems = $res['payAccountItems'];
     $response->pagelink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace("showfundstatement?startTime={$response->startTime}&endTime={$response->endTime}&actionclass={$request->actionclass}&page="), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']);
     $response->actionClass = $request->actionclass;
     $response->fundAccountAmount = $this->space->getFoundAccount()->amount;
 }
Ejemplo n.º 5
0
 public function ajaxShowMyTickets($request, $response)
 {
     /*{{{*/
     $hostType = $request->hosttype;
     if ($hostType == 'DoctorPatientPost') {
         $res = InspectClient::getInstance()->getInspectedSourceIds($this->curInspector, InspectGroup::APP_FOLLOWUPPOST, array('beginTime' => XDateTime::today(), 'endTime' => XDateTime::tomorrow()));
         $flowPostList = DAL::get()->find('DoctorPatientPost', $res['ids']);
         $response->doctorPatientPostList = $flowPostList;
     } else {
         $response->tickets = DAL::get()->find_all_byAuditor_hosttype_status_date('nfstaskticket', $this->auditor, $request->hosttype, NfsTaskTicket::STATUS_DONE, XDateTime::today(), XDateTime::tomorrow());
     }
     $response->hosttype = $hostType;
 }
 public function newFromFlowPost($request, $response)
 {
     /*{{{*/
     $todayHasArticleNumber = DAL::get()->queryCntOfSpace('Article', $this->space->id, XDateTime::today()->toString(), XDateTime::tomorrow()->addSecond(-1)->toString());
     DBC::requireTrue(Article::MAX_CAN_ARTICLE_ONE_DAY > $todayHasArticleNumber, "您今天已经发表了" . Article::MAX_CAN_ARTICLE_ONE_DAY . "篇文章,请您明天再发表");
     $article = $this->newFromSave($request, $response);
     if ($article) {
         $ref = DAL::get()->find('doctorPatientRef', $request->flow_id);
         $this->message('经典问答发表成功', $response, array('text' => '查看转化的经典问答', 'url' => $article->getUrl(), 'reserveText' => '返回', 'reserveUrl' => $ref->getUrl()));
     }
 }
Ejemplo n.º 7
0
 public function dayCountByProvider($request, $response)
 {
     $response->queues = DAL::get()->find_all_by_queuetype('ServiceQueue', array_keys(ServiceQueue::$queueTypeDesc));
     $response->queueId = $request->queueId;
     $response->direction = $request->direction;
     $response->dateTime = $request->dateTime;
     $startTime = XDateTime::today();
     $endTime = XDateTime::tomorrow();
     $dateTime = $request->dateTime;
     if (false == empty($dateTime)) {
         $startTime = XDateTime::valueOf($dateTime);
         $endTime = $startTime->addDay(1);
     }
     $response->dateTime = $startTime->getDateTime($startTime);
     $list = DAL::get()->queryCountGroupByTeleProvider('TeleConversation', $request->queueId, $request->direction, $startTime, $endTime);
     $telephoneAccount = $list['allcnt'] - $list['cmcc'] - $list['unicom'] - $list['telecom'];
     $response->cmccAccount = empty($list['cmcc']) ? 0 : $list['cmcc'];
     $response->unicomAccount = empty($list['unicom']) ? 0 : $list['unicom'];
     $response->telecomAccount = empty($list['telecom']) ? 0 : $list['telecom'];
     $response->telephoneAccount = empty($telephoneAccount) ? 0 : $telephoneAccount;
     $response->cmccPercent = round($response->cmccAccount / $list['allcnt'], 2) * 100 . '%';
     $response->unicomPercent = round($response->unicomAccount / $list['allcnt'], 2) * 100 . '%';
     $response->telecomPercent = round($response->telecomAccount / $list['allcnt'], 2) * 100 . '%';
     $response->telephonePercent = round($response->telephoneAccount / $list['allcnt'], 2) * 100 . '%';
 }
Ejemplo n.º 8
0
 /**
  * showPatientSigninSubsidy 
  * 医生个人空间展示老患者报到补贴收入信息
  * @author wangxiang 
  * @param mixed $request 
  * @param mixed $response 
  * @access private
  * @return void
  */
 private function showPatientSigninSubsidy($request, $response)
 {
     /*{{{*/
     $showSubsidyInfo = false;
     if ($this->isSpaceLogin()) {
         $space = $this->space;
         if ($space->isSignSubsidyOpen()) {
             $showSubsidyInfo = true;
             //近一个月补贴收入start
             $subsidyAccount = $space->getSubsidyAccount();
             $startTime = XDateTime::now()->addDay(-29)->toShortString();
             $endTime = XDateTime::now();
             $monthAmount = AccountClient::getInstance()->getSubsidyOrdersAmountInTimespan($space->id, $startTime, $endTime);
             $response->monthAmount = number_format($monthAmount, 1);
             //今日报到人数start
             $startTime = XDateTime::now()->toShortString();
             $todaySigninCnt = DAL::get()->querySubsidyCntByTimeSpan('SubsidyOrder', $space->id, $startTime);
             $response->todaySigninCnt = $todaySigninCnt;
             //近一个月的报到人数start
             $startTime = XDateTime::now()->addDay(-29)->toShortString();
             $monthSigninCnt = DAL::get()->querySubsidyCntByTimeSpan('SubsidyOrder', $space->id, $startTime);
             $response->monthSigninCnt = $monthSigninCnt;
             $fromDate = XDateTime::now()->addDay(-29)->toShortString();
             $toDate = XDateTime::tomorrow()->toShortString();
             $response->fromDate = $fromDate;
             $response->toDate = $toDate;
         }
     }
     $response->showSubsidyInfo = $showSubsidyInfo;
 }
 /**
  * personalHospitalMaintenance 
  * 个人查询推广情况 
  * @author wx
  * @param mixed $request 
  * @param mixed $response 
  * @access public
  */
 public function personalHospitalMaintenance($request, $response)
 {
     /*{{{*/
     $isFirstQuery = $request->firstQuery;
     $inspector = $this->curInspector;
     $startTime = $request->startTime;
     $endTime = $request->endTime;
     $doctorName = $request->doctorName;
     $userName = $request->userName;
     $hospitalName = $request->hospitalName;
     $totalSigninNum = 0;
     $signinInfo = $spaces = $spaceIds = $pageInfo = array();
     $page = $request->getRequest('page', '1');
     $pageSize = 20;
     if (empty($isFirstQuery)) {
         $startTime = XDateTime::now()->toShortString();
         $endTime = XDateTime::tomorrow()->toShortString();
     }
     if ($startTime && $endTime) {
         DBC::requireTrue(XDateTime::dayDiff(XDateTime::valueOf($startTime), XDateTime::valueOf($endTime)) >= 0, "日期范围不正确");
     }
     $spaceIds = $this->getSpacesByQueryCondition($doctorName, $userName, $hospitalName);
     list($spaceIds, $pageInfo) = DAL::get()->queryInspectorBindedSpaceId('SubsidySwitch', $inspector->id, $spaceIds, $page, $pageSize, $startTime, $endTime);
     $totalSigninNum = DAL::get()->queryAllBindCntByInspector('SubsidyOrder', $inspector->id, $spaceIds, $startTime, $endTime);
     foreach ($spaceIds as $spaceId) {
         $count = DAL::get()->querySpaceSigninSubsidyOrderCntByTimeSpan('SubsidyOrder', $spaceId, $startTime, $endTime);
         $space = DAL::get()->find('Space', $spaceId);
         $signinInfo[$space->id]['cnt'] = $count;
         $signinInfo[$space->id]['space'] = $space;
     }
     $response->pageLink = PageNav::getNavLink(PageNav::getPageNavTemplate('personalhospitalmaintenance?startTime=' . $startTime . '&endTime=' . $endTime . '&doctorName=' . $doctorName . '&userName='******'&hospitalName=' . $hospitalName . '&firstQuery=NO&page='), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']);
     $response->signinInfo = $signinInfo;
     $response->totalSigninNum = $totalSigninNum;
     $response->startTime = $startTime;
     $response->endTime = $endTime;
     $response->doctorName = $doctorName;
     $response->userName = $userName;
     $response->hospitalName = $hospitalName;
 }
 public function bindTask4Bloodsugarstep($request, $response)
 {
     /*{{{*/
     $bloodSugarStep = DAL::get()->find('BloodSugarStep', $request->bloodSugarStepId);
     DBC::requireTrue($bloodSugarStep instanceof BloodSugarStep, "不存在该血糖");
     $followupCustomer = $bloodSugarStep->followupCustomer;
     $model = DAL::get()->find_by_title('NfsTaskModel', '血糖任务');
     $model = array($model);
     $user = $followupCustomer->getBindUser();
     $assigner = $this->auditor;
     $deadline = XDateTime::tomorrow();
     $taskDesc = "新建血糖管理任务";
     $roleId = 825967283;
     //医助的角色id
     $taskId = TaskClient::getInstance()->addTask($model, $bloodSugarStep, $followupCustomer->space, $user, $assigner, $deadline, $taskDesc, $roleId);
     $preMsg = $bloodSugarStep->id . "绑定成功";
     $response->setRedirect($response->router->urlfor('bloodsugarstep/bloodsugarstepsofcustomer', array('followupCustomerId' => $followupCustomer->id, 'preMsg' => $preMsg)));
 }
 public function bindTask4HealthItemProject($request, $response)
 {
     /*{{{*/
     $healthItemProject = DAL::get()->find('HealthItemProject', $request->healthItemProjectId);
     DBC::requireTrue($healthItemProject instanceof HealthItemProject, "不存在该项目");
     $followupCustomer = $healthItemProject->followupCustomer;
     $model = DAL::get()->find_by_title('NfsTaskModel', '体重管理');
     $model = array($model);
     $user = $followupCustomer->getBindUser();
     $assigner = $this->auditor;
     $deadline = XDateTime::tomorrow();
     $taskDesc = "新建体重管理任务";
     $roleId = 825967283;
     //医助的角色id
     $taskId = TaskClient::getInstance()->addTask($model, $healthItemProject, $followupCustomer->space, $user, $assigner, $deadline, $taskDesc, $roleId);
     $preMsg = $healthItemProject->id . "绑定成功";
     $response->setRedirect($response->router->urlfor('healthitemproject/healthitemprojectsofcustomer', array('followupCustomerId' => $followupCustomer->id, 'preMsg' => $preMsg)));
 }
Ejemplo n.º 12
0
 public function ajaxAddWaitFeedbackTask($request, $response)
 {
     /*{{{*/
     $request->convertToGBK();
     $modelIds = array('1083335826');
     // 转自助待反馈任务的ID
     $models = DAL::get()->find('nfstaskmodel', $modelIds);
     $followupCustomer = DAL::get()->find('followupcustomer', $request->customerid);
     $sourceEntity = $followupCustomer;
     $space = $followupCustomer->space;
     $user = $followupCustomer->getBindUser();
     $assigner = $this->auditor;
     $deadline = XDateTime::tomorrow();
     $taskDesc = "转自助待反馈任务, 截止时间:默认当天。";
     $roleId = 825967281;
     //自助的角色id
     TaskClient::getInstance()->addTask($models, $sourceEntity, $space, $user, $assigner, $deadline, $taskDesc, $roleId);
     echo 'ok';
     return parent::DIRECT_OUTPUT;
 }
Ejemplo n.º 13
0
 private function _submit_jueceren($customer, $datas, EntityBase $sourceEntity)
 {
     /*{{{*/
     $str = "\n===决策人start===\n";
     $links = array('1' => '本人', '2' => '家属');
     $decisionManStr = isset($datas['decision']) && isset($links[$datas['decision']]) ? $links[$datas['decision']] : '未知';
     $commentStr = "决策人:{$decisionManStr}\n";
     $linkDescStr = $datas['link_desc'];
     $commentStr .= "联系情况:{$linkDescStr}\n";
     $str .= $commentStr;
     $str .= "\n===决策人end===\n";
     // 添加到责任人备注
     $owner = $customer->getFollowupOwner();
     $owner = DAL::get()->find("FollowupOwner", $owner->id, true);
     if (false == $owner->isNull()) {
         FollowupClient::getInstance()->saveSigninAuditorComment($owner->id, $owner->auditorComment . "\n" . $commentStr);
     }
     // 添加联系决策人任务
     $model = DAL::get()->find_by_title("nfstaskmodel", NfsTaskModel::TITLE_CONTRACT_DECISION);
     if (isset($datas['decision']) && '2' == $datas['decision']) {
         $task = TaskClient::getInstance()->createTask4NoUserCustomer($customer->id, array($model->id), $sourceEntity, $this->auditor, XDateTime::tomorrow(), $commentStr, FollowupAuditorRole::NAME_ASSISTANTDOCTOROPERATION_ID);
     }
     return $str;
 }