Exemplo n.º 1
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);
    }/*}}}*/
Exemplo n.º 2
0
 private function leftCaseBrowse($request, $response, $res, $telOrderFlowIds)
 {
     /*{{{*/
     //我的list
     $currentUserFlowList = $myProposalThreads = array();
     $allProposalThreads = DAL::get()->find_all_spaceNotProcessList('Proposal', $this->space, ServiceDef::TYPE_FLOW, array());
     $otherProposalThreads = $allProposalThreads;
     if (false == $this->user->isNull()) {
         $otherProposalThreads = array();
         $myPatientIds = empty($this->user->patientList) ? array() : array_keys($this->user->patientList);
         $myProposalThreads = array();
         foreach ($allProposalThreads as $proposalThread) {
             if (in_array($proposalThread->patient->id, $myPatientIds)) {
                 $myProposalThreads[$proposalThread->id] = $proposalThread;
             } else {
                 $otherProposalThreads[$proposalThread->id] = $proposalThread;
             }
         }
         if (false == empty($myProposalThreads)) {
             XString::sortArray($myProposalThreads, 'utime');
         }
         $userSelfFlow = FlowClient::getInstance()->getAllFlows(array('spaceId' => $this->space->id, 'userId' => $this->user->id));
         if (false == empty($userSelfFlow['refs'])) {
             XString::sortArray($userSelfFlow['refs'], 'lastPostTime');
         }
         $currentUserFlowList = $myProposalThreads + $userSelfFlow['refs'];
     }
     $otherProposalThreads = array_slice($otherProposalThreads, 0, 10);
     $otherFlowList = array();
     if (count($otherProposalThreads) < 10) {
         $flowLimit = 10 - count($otherProposalThreads);
         $flowRes = FlowClient::getInstance()->getAllFlows(array('spaceId' => $this->space->id, 'limit' => $flowLimit, 'filterUserId' => $this->user->id));
         $otherFlowList = $flowRes['refs'];
     }
     uasort($otherFlowList, function ($a, $b) {
         if ($a->lastPostTime == $b->lastPostTime) {
             return 0;
         }
         return $a->lastPostTime < $b->lastPostTime ? 1 : -1;
     });
     $freeList = $otherProposalThreads + $otherFlowList;
     if (false == $this->isSpaceLogin()) {
         foreach ($telOrderFlowIds as $key => $telOrderFlowId) {
             if (array_key_exists($telOrderFlowId, $currentUserFlowList)) {
                 unset($telOrderFlowIds[$key]);
             }
         }
         $telOrderFlowIds = array_reverse($telOrderFlowIds);
         $threeTelOrderFlowIds = array_slice($telOrderFlowIds, 0, 3);
         foreach ($threeTelOrderFlowIds as $telOrderFlowId) {
             if (array_key_exists($telOrderFlowId, $freeList)) {
                 unset($freeList[$telOrderFlowId]);
             }
         }
         $threeTelOrderFlows = DAL::get()->find('doctorpatientref', $threeTelOrderFlowIds);
         $tmpArr = array();
         foreach ($threeTelOrderFlows as $key => $telOrderFlow) {
             $tmpArr[$key] = $telOrderFlow;
         }
         foreach ($freeList as $key => $freeFlow) {
             $tmpArr[$key] = $freeFlow;
         }
         $freeList = $tmpArr;
     }
     $flowCount = FlowClient::getInstance()->getFlowListCount($this->space->id, array('p_type' => 'all', 'isBrowser' => $this->user->isNull()));
     $flowCount = count($allProposalThreads) + $flowCount;
     $owner = DAL::get()->find_by_relatedObject('telowner', $this->space->user);
     $response->freeList = array_slice($freeList, 0, 10);
     $response->flowCount = $flowCount;
     $response->currentUserFlowList = $currentUserFlowList;
     $response->controller = 'index';
 }
Exemplo n.º 3
0
 public function showQuestionOfValueRange($request, $response)
 {
     /*{{{*/
     $this->checkAuditor();
     $ranges = DAL::get()->find_all_by_questionid('questionvaluerange', $request->questionid);
     XString::sortArray($ranges, 'checkupquestionsheetid', false);
     $response->ranges = $ranges;
     $response->question = DAL::get()->find('question', $request->questionid);
     $response->checkupQuestionSheets = DAL::get()->find_all('checkupquestionsheet');
 }
Exemplo n.º 4
0
 public function mobile($request, $response)
 {
     /*{{{*/
     $response->objects = $response->orderCntList = array();
     $today = XDateTime::now();
     if ($request->today) {
         $today = XDateTime::valueof($request->today);
     }
     $response->today = $today;
     $options['startTime'] = $today->toShortString();
     $options['endTime'] = $today->addDay(1)->toShortString();
     $options['status'] = $request->getRequest('status', PresentOrder::STATUS_PAID_YES);
     $groupBy = 'spaceid';
     $response->status = $options['status'];
     $orderCntList = PresentClient::getInstance()->getCntsInPresentOrder($groupBy, $options);
     $list = array();
     $allAmount = $allCnt = 0;
     $response->sortType = $request->getRequest('sortType', 'cnt');
     if ($orderCntList) {
         foreach ($orderCntList as $key => $ordersCnt) {
             $list[$key]['id'] = $key;
             $list[$key]['cnt'] = $ordersCnt['cnt'];
             $list[$key]['amount'] = $ordersCnt['amount'];
             $allAmount += $ordersCnt['amount'];
             $allCnt += $ordersCnt['cnt'];
         }
         XString::sortArray($list, $response->sortType);
         $response->orderCntList = $list;
         $objectIds = array_keys($orderCntList);
         $response->objects = DAL::get()->find('space', $objectIds);
     }
     $response->allAmount = $allAmount;
     $response->allCnt = $allCnt;
 }
    /**
        * @brief 获取文章列表
        * @author meihao
        * @exampleUrl http://dev.mobile-api.haodf.com/doctorapi/patientclub_getArtcleList?userId=1&pageSize=1&pageId=1&os=1&xdoc=1
        *
        * @Param $userId  用户id
        * @Param $pageSize  每页条数
        * @Param $pageId  页号
        * @Param $os 
        *
        * @Returns   array('articleId', 'doctorId', 'grade', 'title', 'ctime', 'categroy', 'readCount', intro', 'url');
     */
    public function getArtcleList($userId, $pageSize, $pageId, $os)
    {/*{{{*/
        $this->_initPageInfo($pageId, $pageSize);
        $space = DAL::get()->find_by_fld_SpaceUserId('space', $userId);
    	if ($space->isNull())
        {
            $predoctor = DAL::get()->find_by_userid('predoctor', $userId);
            if(!$predoctor->isNull())
            {
                    return 0;
            }
            $this->setErrorCode(144);
            return 0;
        }
        $categoryId = null;
        $options['orderby'] = 'topLevel desc, fld_ArticleCreateTime desc';
		$res = ArticleClient::getInstance()->getList($space->id, $categoryId, $pageId, $pageSize, $options);
        $articleList = $res['articleList'];
        $pageInfo = $res['pageInfo'];
        $this->pageInfo = $pageInfo;
        $infos = array();
        $topArticleList = array();
        $bottomArticleList = array();
        foreach($articleList as $article)
        {
            if ($article->topLevel)
            {
                $topArticleList[] = $article;
            }
            else
            {
                $bottomArticleList[] = $article;
            }
        }
        XString::sortArray($topArticleList, 'topLevel');
        XString::sortArray($bottomArticleList, 'ctime');
        $articleList = array_merge_recursive($topArticleList, $bottomArticleList); 
        foreach($articleList as $article)
        {
            if (trim(strip_tags($article->content)) == '')
            {
                continue;
            }
            $info = array();
            $info['articleId'] = $article->id;
            $info['doctorId'] = $space->host->id;
            $info['grade'] = ($article->topLevel)? 3 : 0;
            $info['title'] = $article->title;
            $info['ctime'] = XDateTime::printTime4Touch($article->ctime->getTime(), 'Y-m-d');
            $info['category'] = '['.$article->articleCategory->name.']';
            $info['readCount'] = $this->getHits($article);
            //$info['intro'] = trim(mb_substr(XString::getContentWithOutHtml($article->content), 0, 90, 'gbk'));
            $info['intro'] = mb_substr(trim(preg_replace(array("/(&#[0-9]+;)/", "/(&\w+;)/"), '', str_replace(array("\r", "\n"), '', strip_tags(htmlspecialchars_decode($article->content))))), 0, 90, 'GBK');
            $info['url'] = "http://www.".URL_PREFIX."haodf.com/index/mobilearticle?id=".$info['articleId']."&clkfrom=".$os;
            $infos[] = $info;
        }
        $this->content = $infos;
    }/*}}}*/
 public function showMedicineDiary($request, $response)
 {
     /*{{{*/
     $diary = DAL::get()->find('medicinediary', $request->diaryid);
     if ($diary->isNull()) {
         throw new BizException('该用药日记不存在');
     }
     if (false == empty($diary->medicineAnswerIds)) {
         $medicineAnswers = DAL::get()->find('medicineanswer', $diary->medicineAnswerIds);
         XString::sortArray($medicineAnswers, 'medicineUserScheme');
         XString::sortArray($medicineAnswers, 'doTime');
         $response->medicineAnswers = $medicineAnswers;
     }
     $response->medicineDiary = $diary;
     $response->ticketId = $request->ticketid;
 }
 public function showPostLog($request, $response)
 {
     /*{{{*/
     $postId = $request->postid;
     $post = DAL::get()->find('DoctorPatientPost', $postId);
     $postLogList = DAL::get()->find_all_by_doctorpatientpostid_and_doctorpatientrefid('DoctorPatientLog', $postId, $post->doctorPatientRef->id);
     XString::sortArray($postLogList, 'ctime');
     $response->postLogList = $postLogList;
 }
    private function getHealthApplyPatientList($userId)
    {/*{{{*/
        $user = DAL::get()->find('user', $userId);//$userId);
        DBC::requireFalse($user->isNull(),'用户不存在');
        $vars = array();
        $vars['UserName'] = $user->name;
        $vars['Type'] = (string) PatientHealthApply::TYPE_NEW;
        $applyList = DAL::get()->find_all_list4Search('PatientHealthApply',$vars);
        XString::sortArray($applyList, 'ctime', true);

        $applyPatientIds = array();
        $applyPatientInfos = array();
        $patientInfos = array();
        foreach($applyList as $apply)
        {
            //只取该患者名下最新更新的一条健康日志申请
            if (false == in_array($apply->patient->id, $applyPatientIds))
            {
                $applyPatientIds[] = $apply->patient->id;
                $patientInfo['id'] = $apply->patient->id;
                $patientInfo['name'] = $apply->patient->name;
                $patientInfo['status'] = $apply->getApplyStatus();
                $applyPatientInfos[] = $patientInfo;
                if ($apply->status != PatientHealthApply::STATUS_INVALID)
                {
                    $patientInfos[] = $patientInfo;
                }
            }
        }
        return $applyPatientInfos;
    }/*}}}*/
Exemplo n.º 9
0
<?php

$caselogs = S3LogClient::getInstance()->getLogList($orgPatientCase->getLogable(), false);
$courselogs = S3LogClient::getInstance()->getLogList($patientCourse->getLogable(), false);
$logs = array_merge($caselogs, $courselogs);
XString::sortArray($logs, 'ctime');
?>
<div class="detail-module mt20">
<div class="tb">操作记录:</div>
<table class="question_table"> 
    <thead class="check_audit">
        <tr> 
            <th>#</th> 
            <th>时间</th> 
            <th>操作人</th> 
            <th>描述</th>
        </tr>
    </thead>
    <tbody>
    <?php 
if (empty($logs)) {
    ?>
    <tr> 
        <td colspan=5><span class="ml10">无备注</span</td>
    </tr> 
    <?php 
} else {
    ?>
    <?php 
    $total = count($logs);
    foreach ($logs as $num => $log) {
Exemplo n.º 10
0
 protected static function filterProposalIds(Array $ids)
 {/*{{{*/
     $sIds = DAL::get()->find_id_by_sources('ServiceOrder', 'Proposal', $ids);
     $pIds = DAL::get()->querySourceIds('ServiceOrder', $sIds);
     $proposalList = DAL::get()->find('Proposal', $pIds);
     XString::sortArray($proposalList, 'ctime', true);
     $proposalIds = array();
     foreach ($proposalList as $proposal)
     {
         $proposalIds[] = $proposal->id;
     }
     return $proposalIds;
 }/*}}}*/
 public function doctorCollection($request, $response)
 {
     /*{{{*/
     $patientId = $request->patientId;
     $patientCaseId = $request->patientCaseId;
     $response->patientId = $patientId;
     $response->patientCaseId = $patientCaseId;
     $list = $this->getPatientCaseandBreadCrumbNavigation($patientCaseId, $patientId);
     $breadcrumbNavigation = $list['breadcrumbNavigation'];
     $patientCase = $list['patientCase'];
     if (false == $patientCase->isNull()) {
         list($patientCourses, $pageInfo) = PatientFileClient::getInstance()->getPatientCourseList($patientCase, $request->pageId, 10);
         $response->patientCourses = $patientCourses;
         $patientCourseDetails = array();
         foreach ($patientCourses as $patientCourse) {
             if ($patientCourse->isCompleted()) {
                 $courseDetails = array();
                 foreach ($patientCourse->patientCourseDetails as $patientCourseDetail) {
                     $patientCourseDetailContents = $patientCourseDetail->patientCourseDetailContents;
                     XString::sortArray($patientCourseDetailContents, 'occurDate');
                     foreach ($patientCourseDetailContents as $detailContent) {
                         $courseKey = $detailContent->occurDate . $detailContent->patientCourseDetailCategory->name;
                         $courseDetails[$courseKey][$detailContent->contentType][] = $detailContent;
                         $courseDetails[$courseKey]['type'] = $detailContent->patientCourseDetailCategory->name;
                         $courseDetails[$courseKey]['date'] = $detailContent->occurDate;
                     }
                 }
                 ksort($courseDetails);
                 $patientCourseDetails[$patientCourse->id] = $courseDetails;
             } else {
                 $courseDetails = $courseInfos = array();
                 foreach ($patientCourse->patientCourseDetails as $patientCourseDetail) {
                     $patientCourseDetailContents = $patientCourseDetail->patientCourseDetailContents;
                     XString::sortArray($patientCourseDetailContents, 'occurDate');
                     foreach ($patientCourseDetailContents as $detailContent) {
                         $courseInfos['unaudit'][$detailContent->contentType][$detailContent->ctime->toString() . $detailContent->id] = $detailContent;
                     }
                 }
                 if (isset($courseInfos['unaudit'])) {
                     foreach ($courseInfos['unaudit'] as $key => $details) {
                         ksort($details);
                         $courseDetails['unaudit'][$key] = $details;
                     }
                 }
                 $patientCourseDetails[$patientCourse->id] = $courseDetails;
             }
         }
         $response->patientCourseDetails = $patientCourseDetails;
         $response->patientCase = $patientCase;
         $url = "/adminpatient/doctorcollection?patientId={$patientId}&patientCaseId={$patientCaseId}&pageId=";
         $response->pageLink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace("{$url}"), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']);
         $doctorOwner = DAL::get()->find_by_userid('doctorOwner', $this->space->id);
         $memberId = DAL::get()->queryMemberIdByOwnerIdAndPatientCaseId('regrouppatientcasemember', $doctorOwner->id, $patientCase->id);
         $member = DAL::get()->find('regroupPatientCaseMember', $memberId);
         $response->member = $member;
         $response->patientGroup = $member->regroup;
         $response->groupNames = array($member->regroup->name);
     } else {
         $response->patientCase = NullEntity::create();
         $response->patientCourses = array();
         $response->pageLink = '';
         $response->patientGroup = NullEntity::create();
         $response->groupNames = array();
     }
     $response->breadcrumbNavigation = $breadcrumbNavigation;
 }
Exemplo n.º 12
0
 /** 获取文章列表 zj **/
 private function getArticleList($categoryId, $classicCategoryId, $request, $response)
 {
     /*{{{*/
     if ($request->category_id == '') {
         $page = intval($request->getRequest('page', 1));
     } else {
         $page = intval($request->getRequest('p', 1));
     }
     $options = array();
     $options['articleLevel'] = Article::LEVEL_0;
     $userId = UserClient::getInstance()->getCheckedSeed('id');
     $res = ArticleClient::getInstance()->getList($this->space->id, $categoryId, $page, $pageSize = 20, $options, $userId);
     $articleList = $res['articleList'];
     $pagelink = "";
     if (isset($res['pageInfo']) && false == empty($res['pageInfo']) && '' == $request->category_id) {
         $pageInfo = $res['pageInfo'];
         $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace('lanmu_', 2, 3, 1, true), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']);
         $pagelink = str_replace("href=\"lanmu_1\"", "href=\"lanmu\"", $pagelink);
     } else {
         if (isset($res['pageInfo']) && false == empty($res['pageInfo'])) {
             $pageInfo = $res['pageInfo'];
             $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace('?p='), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']);
         }
     }
     $category = new NullEntity();
     if ($categoryId) {
         $category = DAL::get()->find('ArticleCategory', $categoryId);
     }
     $response->category = $category;
     $response->categoryId = $categoryId;
     $response->isClassicsCase = $categoryId == $classicCategoryId;
     $topArticleList = array();
     $downArticleList = array();
     foreach ($articleList as $article) {
         if ($article->topLevel) {
             $topArticleList[] = $article;
         } else {
             $downArticleList[] = $article;
         }
     }
     XString::sortArray($topArticleList, 'topLevel');
     $response->topArticleList = $topArticleList;
     XString::sortArray($downArticleList, 'ctime');
     $response->downArticleList = $downArticleList;
     $newHitRes = array();
     if (false == empty($articleList) && false == $this->isSpaceLogin()) {
         $hitRes = HitClient::getInstance()->getHitsNoCache(array_keys($articleList));
         $articleIds = array_keys($articleList);
         foreach ($articleIds as $articleId) {
             $redisKey = "article_" . $articleId;
             $newHitRes[$articleId] = HitClient::getInstance()->getHitCntByKey($redisKey);
         }
     }
     $response->hitRes = $newHitRes;
     if ($this->isSpaceLogin()) {
         $response->maxTop = ArticleClient::getInstance()->getMaxTopLevel($this->space->id, $isAll = false);
         $response->minTop = ArticleClient::getInstance()->getMinTopLevel($this->space->id);
     }
     $response->pagelink = $pagelink;
     $response->articleId = $request->articleId;
 }
 public function ajaxLoadItem($request, $response)
 {
     /*{{{*/
     $parentId = $request->parentid;
     $items = array();
     $return = array();
     //        $items['id'] = 0;//为0有输入检查
     //        $items['name'] = '------';
     //        $return[] = $items;
     if ($parentId > 0) {
         $questions = DAL::get()->find_all_by_categoryid_and_isdeleted('nfsQuestion', $parentId, nfsQuestion::IS_DELETED_FALSE);
         XString::sortArray($questions, 'id');
         foreach ($questions as $question) {
             $items['id'] = $question->id;
             $items['name'] = mb_convert_encoding($question->title, 'utf-8', 'gbk');
             $return[] = $items;
         }
     }
     echo json_encode($return);
     return parent::DIRECT_OUTPUT;
 }
    public function showContracts($request, $response)
    {/*{{{*/
        $params = array();
        $params['doctorName'] = $this->_newSpace->name;
        $params['pageSize'] = 20;
        $params['nowPage'] = $request->page ? $request->page : 1; 
        $params['status'] = TelContract::STATUS_CONFIRM;

        //代码可以删除
        $res = array();
        $telContract = new NullEntity();
        if (false == empty($res['telContracts']))
        {
            $telContracts = $res['telContracts'];
            XString::sortArray($telContracts, 'ctime');
            krsort($telContracts);
            $telContract = array_shift($telContracts);
        }
        $response->telContract = $telContract;
        $response->actionClass = $request->actionclass;
    }/*}}}*/
Exemplo n.º 15
0
 private function browserList($request, $response, $threadsCount, $flowsCount, $flowType = '')
 {
     /*{{{*/
     $chargeFlowCount = FlowClient::getInstance()->getPaiedFlowCntBySpace($this->space, $needCache = true);
     $response->chargeCount = $chargeFlowCount;
     $response->freeCount = $response->allCount - $response->chargeCount;
     $options = array();
     $options['spaceId'] = $this->space->id;
     $nowPage = intval($request->getRequest('p', 1));
     $nowPage = $nowPage > 0 ? $nowPage : 1;
     $pageSize = 25;
     //当前患者的proposal & flow
     $myProposals = $myFlows = array();
     $myProposalsCount = $myFlowsCount = 0;
     if ($this->user->isNull() == false && $this->user->id != $this->space->user->id) {
         $myPatientIds = array_keys($this->user->patientList);
         if (false == empty($myPatientIds)) {
             $myProposalOptions = array();
             $myProposalOptions['patientIds'] = $myPatientIds;
             $myProposals = DAL::get()->find_all_spaceNotProcessList('proposal', $this->space, ServiceDef::TYPE_FLOW, $myProposalOptions);
         }
         $myFlows = FlowClient::getInstance()->getUserSpaceFlows($this->space->id, $this->user->id);
         XString::sortArray($myFlows, 'lastPostTime');
         if ($nowPage == 1 && false == empty($myFlows)) {
             $response->lastPostList = DoctorPatientPostClient::getInstance()->getLastPosts4Flows(array_keys($myFlows));
         }
         $myProposalsCount = count($myProposals);
         $myFlowsCount = count($myFlows);
         if ($nowPage > 1) {
             $myProposals = array();
             $myFlows = array();
         }
     }
     $options['nowPage'] = $nowPage;
     $options['pageSize'] = $pageSize;
     if (false == $this->user->isNull()) {
         $options['excludeuser'] = $this->user->id;
     }
     $otherUserProposalList = DAL::get()->find_all_spaceNotProcessList('proposal', $this->space, ServiceDef::TYPE_FLOW, $options);
     $nowPageThreadCount = count($otherUserProposalList);
     if ($nowPageThreadCount < $pageSize) {
         if ($nowPageThreadCount > 0) {
             $options['from'] = 0;
             $options['pageSize'] = $pageSize - $nowPageThreadCount;
         } else {
             $options['from'] = ($nowPage - 1) * $pageSize == $threadsCount - $myProposalsCount ? 0 : ($nowPage - 1) * $pageSize - $threadsCount + $myProposalsCount;
             $options['pageSize'] = $pageSize;
         }
         if (false == $this->user->isNull()) {
             $options['filterUserId'] = $this->user->id;
         }
         //排除随访的
         if (strtolower($flowType) == 'allcaseflow') {
             $flowBinds = array();
             $flowBinds['isBrowser'] = $this->user->isNull();
             $flowBinds['isOpenFollowup'] = false;
             //患者本人,过滤掉本人的flow
             if (false == $this->user->isNull() && $this->isSpaceBrowse()) {
                 $flowBinds['excludeuserid'] = $this->user->id;
             }
             $notFollowupFlowList = $flowsList = FlowClient::getInstance()->getFlowListBySection($this->space->id, $options['from'], $options['pageSize'], $flowBinds);
             $flowList = $otherUserProposalList + $notFollowupFlowList;
         } else {
             $res = FlowClient::getInstance()->getAllFlows($options);
             $flowList = $otherUserProposalList + $res['refs'];
         }
     } else {
         $flowList = $otherUserProposalList;
     }
     $pageInfo = Pager::calcPageInfo($flowsCount + $threadsCount - $myProposalsCount - $myFlowsCount, $nowPage, $pageSize);
     $response->pageLink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace('?type=' . $flowType . '&p='), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']);
     /**
      * 原来是先取我的意向、我的咨询、我的流、其他流
      * => 我的方案、我的流、其他方案、其他流
      */
     $spaceAllList = array_merge($myProposals, $myFlows);
     $spaceAllList = array_merge($spaceAllList, $flowList);
     $response->allList = $spaceAllList;
     $response->patientIdsOfFlower = $this->getUserIdsforPresent($this->space->id, $response->allList);
     $response->demand = $this->getSpaceDemand();
     $response->telOrders = $this->getTelOrderFlows();
     $response->chargeIds = $this->filterPaiedFlowIds($spaceAllList);
     $response->hasCNZZ = 1;
 }
Exemplo n.º 16
0
    private function getCommentAndPresentOrder($doctor)
    {/*{{{*/
        //医生评价和礼物动态
        $presentResult = PresentClient::getInstance()->showPresentBanner($doctor->space->id, 6);
        $presentOrderList = isset($presentResult['presentOrders']) ? $presentResult['presentOrders'] : array();

        $doctorCommentResult = array();
        $option['doctorId'] = $doctor->id;
        $pageInfo['limit'] = 12;                                                         
        if($doctor->getPrimaryDoctor() instanceof Doctor)
        {
            $doctorCommentResult = DoctorCommentClient::getInstance()->getDoctorCommentList4Doctor($doctor->getPrimaryDoctor(), 1, 12);
        }
        $doctorCommentList = isset($doctorCommentResult['commentList']) ? $doctorCommentResult['commentList'] : array();
        $arr = $presentOrderList + $doctorCommentList;
        XString::sortArray($arr, 'ctime');
        if (count($arr) > 6)
        {
            $arr = array_slice($arr, 0, 6);
        }
        return $arr;
    }/*}}}*/
Exemplo n.º 17
0
        ?>
    <p class="green">
    (已删除)
    </p>
<?php 
    }
    ?>
	</div>
	<!-- start medicinediary -->
	<div>
    <span class="green" style="display:block">用药答案:</span>
<?php 
    if (false == empty($diary->medicineAnswerIds)) {
        $medicineAnswers = DAL::get()->find('MedicineAnswer', $diary->medicineAnswerIds);
        XString::sortArray($medicineAnswers, 'medicineUserScheme');
        XString::sortArray($medicineAnswers, 'doTime');
        ?>
 <table class="adminlist" cellspacing="0" cellpadding="0" border="1">
    <tr>
       <th width="10%">日期</th>
       <th width="40%">用药</th>
       <th width="10%">剂量/次</th>
       <th width="10%">每日几次</th>
       <th width="20%">服用情况</th>
    </tr>

<?php 
        $dotimes = array();
        $newMedicineAnswers = array();
        foreach ($medicineAnswers as $ans) {
            if (!in_array($ans->doTime->toShortString(), $dotimes)) {
    /**
        * @brief 获取用户下所有申请过健康管理的患者信息
        * @author zjj 
        *
        * @param $userId 用户ID
        *
        * @return $applyPatientInfos 用户下申请过健康管理的患者信息, $applyPatientIds 申请过健康管理的患者ID
     */
    public function getHealthApplyPatientList($userId)
    {/*{{{*/
        $user = DAL::get()->find('user', $userId);
        if ($user->isNull())
        {
            $this->setErrorCode(107);
            return 0;
        }
        $vars = array();
        $vars['UserName'] = $user->name;
        $vars['Type'] = (string) PatientHealthApply::TYPE_NEW;
        $applyList = DAL::get()->find_all_list4Search('PatientHealthApply',$vars);
        XString::sortArray($applyList, 'ctime', true);

        $applyPatientIds = array();
        $applyPatientInfos = array();
        $patientInfos = array();
        foreach($applyList as $apply)
        {
            //只取该患者名下最新更新的一条健康日志申请
            if (false == in_array($apply->patient->id, $applyPatientIds))
            {
                $applyPatientIds[] = $apply->patient->id;
                $patientInfo['id'] = $apply->patient->id;
                $patientInfo['name'] = $apply->patient->name;
                $patientInfo['status'] = $apply->getApplyStatus();
                $patientInfo['unReadRecordCount'] = $this->getUnReadHealthRecordCount4Patient($apply->patient->id);
                $applyPatientInfos[] = $patientInfo;
                if ($apply->status != PatientHealthApply::STATUS_INVALID)
                {
                    $patientInfos[] = $patientInfo;
                }
            }
        }
        $this->content = $patientInfos;
        return array($applyPatientInfos, $applyPatientIds);
    }/*}}}*/
Exemplo n.º 19
0
 public function doctorPatientThread($request, $response)
 {/*{{{*/
     $response->title = $response->topTitle = "";
     $askSpace = AskSessionInfo::getBindSpace();
     $patient = AskSessionInfo::getBindPatient();
     $threads = array();
     if(false == empty($askSpace) && false == $askSpace->isNull() && false == $patient->isNull())
     {
         $response->askSpace = $askSpace;
         $thread = DAL::get()->find('doctorpatientref', $request->id);
         if ($thread->isNull())
         {
             $statusArr= array(Thread::STATUS_VALID,Thread::STATUS_AUDITING);
             $statusStr = implode(',', $statusArr);
             $threads = DAL::get()->find_all_by_condition('thread', 'patientid=? and spaceid=? and status in ('.$statusStr.')', array($patient->id, $askSpace->id));
             XString::sortArray($threads, 'ctime');
         }
         else
         {
             $threads[] = $thread;
         }
     }
     $response->threads = $threads;
 }/*}}}*/
Exemplo n.º 20
0
 /**
  * blackListManage 
  * @brief 黑名单管理:页面中可管理所有已存在的黑名单号码,并可对其进行删除;也可新增新的黑名单号码 
  * @author kxy 
  * @version tags/v3.0
  * @date 2013-12-11
  */
 public function blackListManage($request, $response)
 {
     /*{{{*/
     $blackPhoneNum = $request->blackPhoneNum;
     $nowPage = $request->page ? $request->page : 1;
     $pageSize = 20;
     $res = TeleConversationClient::getInstance()->getBlackListByPage($blackPhoneNum, $nowPage, $pageSize);
     $response->pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate("blacklistmanage?page="), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']);
     XString::sortArray($res['list'], 'ctime');
     $response->blackLists = $res['list'];
     $response->blackPhoneNum = $blackPhoneNum;
 }
    /**
     * getBookingOrderList  医生查看自己的加号列表(需要我批准,今日来诊,等待就诊)
     * @exampleUrl http://dev.mobile-api.haodf.com/doctorapi/bookingorder_getbookingorderlist?userId=105133781&type=1&xdebug=1 
     * @param mixed $userId 
     * @param mixed $type 
     * @access public
     * @return void
     */
    public function getBookingOrderList($userId, $type)
    {/*{{{*/
        $code = $this->_check($userId);
        if($code)
        {
            $this->setErrorCode($code);
            return 0;
        }

        $type = (isset($type) == false) ? 1 : $type;
        $status = self::$typeArray[$type];
        if($status == self::STATUS_PENDING || $status == self::STATUS_CONFIRMED)
        {
            $params['wap'] = true; 
        }
        else
        {
            $params = array();
        }
        $res = BookingClient::getInstance()->getSpaceOrderList($userId, $status, '','',$params);

        $results = array(); 
        foreach($res['list'] as $bookingOrder)
        {
            $order = array();
            $order['id'] = $bookingOrder->id;
            $order['userName'] = $bookingOrder->user->name;
            $patient = $bookingOrder->patient;
            $order += $this->getBookingOrderPatientMessage($patient);
            $disease = str_replace("&#8226;", "", 
                BingLiDtoHelper::create($bookingOrder->getBingLiSource())->getDiseasesStr());
            $order['disease'] = $disease;
            $order['schedule'] = date('Y-m-d H:i',strtotime($bookingOrder->schedule->toString()));
            $order['address'] = $bookingOrder->address;
            $order['status'] = $this->getBookingOrderStatus($bookingOrder);
            $time = XDateTime::valueOf($bookingOrder->schedule)->toShortString();
            if($type == self::TODAY)
            {
                $order['time'] = $time.'门诊';
            }
            else
            {
                $order['time'] = $time.' '.XDateTime::getWeek($time);
            }
            if ($type == 2)
            {
                $order['noon'] = $this->getNoon4BookingOrder($bookingOrder);
                $results[] = $order;
            }
            else
            {
                $results[$time][] = $order;
            }
        }
        if ($type == 2)
        {
            XString::sortArray($results, 'noon', false);
        }
        $space = DAL::get()->find('space', $userId);
        $ids = DAL::get()->queryAdminConfirmOrder('BookingTask', $space->host->id);
        if(false == empty($ids) && $type == self::PENDING)
        {
            $results = array();
        }
        $this->content = array_values($results);
    }/*}}}*/
Exemplo n.º 22
0
 public function getPatientsByUserId($userId)
 {/*{{{*/
     $user = DAL::get()->find('user', $userId);
     if($user->isNull())
     {
         $this->setErrorCode(107);
         return 0;
     } 
     $patients = $user->patients;
     $patientInfos = array();
     if (false == empty($patients))
     {
         XString::sortArray($patients, 'ctime');
         foreach($patients as $patient)
         {
             $patientInfo = array();
             $patientInfo['id'] = $patient->id;
             $patientInfo['name'] = $patient->name;
             $patientInfo['sex'] = $patient->sex;
             $patientInfo['age'] = $patient->age;
             $patientInfo['birthday'] = strtotime($patient->birthday);
             $patientInfo['birthdayStr'] = $patient->birthday;
             $patientInfo['province'] = $patient->province.$patient->city;
             $patientInfo['type'] = $patient->relation;
             $patientInfo['userId'] = $userId;
             $patientInfo['idcard'] = $patient->idcard;
             $patientInfo['paperstype'] = $patient->paperstype;
             $patientInfo['paperstypename'] = Patient::$paperstypes[$patient->paperstype];
             if($patient->province == $patient->city)
                 $patientInfo['province'] = $patient->province;
             $patientInfo['mobile'] = $patient->mobile;
             if('' == $patientInfo['type'])
             {
                 $patientInfo['type'] = 0;
             }
             //兼容老患者报到改进所出现的性别和生日等可以不填的情况
             if('' == $patientInfo['sex'])
             {
                 $patientInfo['sex'] = 0;
             }
             if('' == $patientInfo['birthdayStr'])
             {
                 $patientInfo['birthdayStr'] = 0;
             }
             if('' == $patientInfo['birthday'])
             {
                 $patientInfo['birthday'] = 0;
             }
             $patientInfos[] = $patientInfo;
         }
     }
     $this->content = $patientInfos;
 }/*}}}*/
    public function loadMoreCaseOrPhoneOpenedDoctor($request, $response)
    {/*{{{*/
        $this->initialize($request, $response);
        
        //开通网上咨询的医生ids
		$params = array();
		$params['hospitalFacultyId'] = $this->hospitalFaculty->id;
		$spaceList = SpaceClient::getInstance()->getCaseOpenedSpaceList($params);	
		$spaceList = $spaceList['spaceList'];	
        $caseDoctorIds = array();
        foreach ($spaceList as $space)
        {
            if (true == $space->isCaseAndNewCaseOpen() && $space->user->allowAnswer() && 0 != $space->modulecase->allowNewMaxNumber)
            {
                $caseDoctorIds[] = $space->host->id;
            }
        }

        //开通电话咨询的医生ids
        $infos = DoctorClient::getInstance()->getDoctorListFor400Search(array(), $this->hospitalFaculty->hospital->province, $this->hospitalFaculty->faculty->name, $this->hospitalFaculty->hospital->commonName);
        $phoneDoctorIds = $infos['doctorids']; 

        $caseOrPhoneDoctorIds = array_unique(array_merge($caseDoctorIds, $phoneDoctorIds));
        $caseOrPhoneDoctorList = DAL::get()->find('doctor', $caseOrPhoneDoctorIds);
        XString::sortArray($caseOrPhoneDoctorList, 'rank');

        $nowPage = $request->getRequest('p', 1);
        $response->resDoctorList = array_slice($caseOrPhoneDoctorList, ($nowPage-1)*(self::PAGESIZE_DOCTOR), self::PAGESIZE_DOCTOR);
        $pageInfo = Pager::calcPageInfo(count($caseOrPhoneDoctorList), $nowPage, self::PAGESIZE_DOCTOR);
        $response->nowPage = $nowPage;
        $response->pages = $pageInfo['pages'];
        $response->totalDoctorCnt = $pageInfo['total'];
        $response->openCaseCount = $pageInfo['total'];
        $response->loadUrl = $response->touchUrl.'/hospitalfaculty/loadmorecaseorphoneopeneddoctor?id='.$request->id.'&p=';
    }/*}}}*/
 public function recommendAuditDetail($request, $response)
 {
     /*{{{*/
     $spaceUserId = $request->space_user_id;
     $recommendThreadCategories = DAL::get()->find_all_by_space('RecommendThreadCategory', $spaceUserId);
     $space = DAL::get()->find('Space', $spaceUserId);
     $response->space = $space;
     //获取医生的捡取问题池设置
     $spaceModuleCase = DAL::get()->find('SpaceModuleCase', $spaceUserId);
     $threadCategoryTopList = ThreadCateClient::getInstance()->getTopLevelList();
     //前端显示固定的分类,利用slot字段做排序
     $threadCategoryIds = array();
     foreach ($recommendThreadCategories as $recommendKey => $recommendThreadCategory) {
         if ($recommendThreadCategory->isNull() || in_array($recommendThreadCategory->threadCategory->id, $threadCategoryIds)) {
             unset($recommendThreadCategories[$recommendKey]);
         }
         $threadCategoryIds[] = $recommendThreadCategory->threadCategory->id;
     }
     XString::sortArray($recommendThreadCategories, 'slot');
     $newRecommendThreadCategories = array_reverse($recommendThreadCategories, false);
     krsort($newRecommendThreadCategories);
     $response->vipCategoryIds = $space->host->prdAdDoctor instanceof PrdADDoctor ? $space->host->prdAdDoctor->getValidCateIds() : array();
     $areaDef = RecommendThreadCategory::$AreaDefs;
     $recommendThreadCategoryLogs = DAL::get()->find_all_by_space('RecommendThreadCategoryLog', $space->id);
     $isUpdateByWap = false;
     foreach ($recommendThreadCategoryLogs as $recommendThreadCategoryLog) {
         if ($recommendThreadCategoryLog->isUpdateByWap()) {
             $isUpdateByWap = true;
             break;
         } else {
             if ($recommendThreadCategoryLog->isUpdateByNet()) {
                 $isUpdateByWap = false;
                 break;
             }
         }
     }
     $response->isUpdateByWap = $isUpdateByWap;
     $response->recommendThreadCategories = $newRecommendThreadCategories;
     $response->threadCategoryTopList = $threadCategoryTopList;
     $response->areaDef = $areaDef;
     $response->maxRecommendThreadCategoryCount = 20;
     $response->message = $request->getRequest('message', '');
     $response->maintainInfo = $request->maintainInfo;
     $response->poolInfo = $request->poolInfo;
     $response->recommendThreadCategoryLogs = $recommendThreadCategoryLogs;
     $response->showContent = 1;
     $response->spaceModuleCase = $spaceModuleCase;
     $response->spaceLastChangeLog = SpaceChangeLogClient::getInstance()->getLastCommonCaseNote($spaceUserId);
 }
Exemplo n.º 25
0
    private function getOldThreadListsFixed($spaceId, $lastPostTime = 0, $fetchCount = 10, $caseId)
    {/*{{{*/
        $infos = array();
        $paiedList = array();
        $space = DAL::get()->find('space', $spaceId);
        $unReadPaiedList = array();
        if($lastPostTime == 0)
        {
            if($space->isChargeOpened())
            {
                $paiedList = FlowClient::getInstance()->getPaiedFlowListBySpace($space, false);
                foreach($paiedList as $paiedFLow)
                {
                    if(false == $paiedFLow->isSpaceRead)
                    {
                        $unReadPaiedList[] = $paiedFLow;
                    }
                    XString::sortArray($unReadPaiedList, 'lastPostTime');
                }
            }
            if(count($unReadPaiedList) >= $fetchCount)
            {
                $flows = $unReadPaiedList;
            }
            else
            {
                $fetchCount = $fetchCount - count($unReadPaiedList);
                $flows = flowClient::getInstance()->getOldThreadList($spaceId, $fetchCount, '', array_keys($paiedList));
                $flows = array_merge($unReadPaiedList, $flows);
            }
        }
        else
        {
            $isPayed = false;
            $ref = DAL::get()->find('doctorpatientref', $caseId);
            $isPayed = $ref->isChargeOrderType();
            $paiedList = FlowClient::getInstance()->getPaiedFlowListBySpace($space, false);
            $paiedIds = array_keys($paiedList);
            if(false == empty($paiedList))
            {
                $paiedList = FlowClient::getInstance()->getPaiedList4mobliePaged($paiedList, $lastPostTime, $fetchCount);
            }
            if($isPayed)
            {
                if(count($paiedList) >= $fetchCount)
                {
                    $threads = $paiedList;
                }
                else
                {
                    $fetchCount = $fetchCount - count($paiedList);
                    $flows = FlowClient::getInstance()->getNextOldThreadList($spaceId, $lastPostTime, $fetchCount, $paiedIds);
                }
            }
            else
            {
                $flows = FlowClient::getInstance()->getNextOldThreadList($spaceId, $lastPostTime, $fetchCount,'', $paiedIds);
            }
        }
        $infos = array();
        $res = FlowClient::getInstance()->getPaiedList4Mobile($spaceId);
        $logFlowIdStr = '';
        foreach($flows as $flow)
        {
            $logFlowIdStr .= ' '.$flow->id;
            $info['id'] = $flow->id;
            $info['type'] = 'flow';
            $info['title'] = $flow->title;
            $info['attachmentCnts'] = $this->getAttachmentCnt4LastPost($flow);
            $info['isPayed'] = in_array($flow->id, $res['filterFlowIds']) ? 1: 0;
            $info['diseaseTag'] = $flow->diseaseName;
            $info['lastPostTime'] = $flow->lastPostTime;
            $info['isRead'] = $flow->isSpaceRead;
            $info['latestId'] = $flow->id;
            $info['chargingLogoUrl'] = self::chargingLogoUrl;
            $info2 = $this->_getCaseUserInfo($flow);
            $info = array_merge($info, $info2);
            $infos[] = $info;
        }

        //记log
        $space = DAL::get()->find('space', $spaceId);
        $logStr = XDateTime::now();
        $logStr .= ' space: '.$space->name.' '.$spaceId;
        $logStr .= ' '.__FUNCTION__;
        $logStr .= ' pageInfo: '.$lastPostTime;
        $logStr .= ' flowIds:'.$logFlowIdStr;
        error_log($logStr."\n", 3, BeanFinder::get('configs')->spaceThreadInfoLogPath);

        return $infos;
    }/*}}}*/
Exemplo n.º 26
0
 private function detail4Dicom($request, $response, $pa)
 {/*{{{*/
     $attachment = $pa->attachment;
     $dicom = DAL::get()->find_by_attachmentid('dicom', $attachment->id);
     $dicomPics = $dicom->dicompics;
     if(empty($dicomPics))
     {
         $response->setRedirect('/attach/dicomtemporary?id='.$pa->id);
     }
     XString::sortArray($dicomPics, 'fileNumber',false);
     $filePaths = array();
     foreach($dicomPics as $dicompic)
     {
         $filePaths[$dicompic->fileNumber] = $dicompic->filePath;
     }
     $response->dicomTags = DicomClient::getInstance()->getDicomTagInfosByDicomId($dicom->id);
     //$dicomTags = $response->dicomTags;
     //$name = $dicomTags['患者姓名'];
     //error_log(print_r("\nname =error::dfy=====================================================================>>>>>\n",true),3,"/tmp/dfy.log");
     //error_log(print_r($name , true), 3, "/tmp/dfy.log");
     //$name = urldecode($name);
     //error_log(print_r("\ndicomTags =error::dfy=====================================================================>>>>>\n",true),3,"/tmp/dfy.log");
     //error_log(print_r($name , true), 3, "/tmp/dfy.log");
     $this->calWidthHeight($request,$response, $dicom);
     $response->tuUrls = TuClient::getInstance()->getThumbnailUrls($filePaths, $response->width, $response->height);
     $response->currentDicom = $dicom;
     $response->dicoms = DicomClient::getInstance()->getDicomsOfSameStudyAndUser($dicom, $attachment->user);
     $response->isSingleFrame = $dicom->isSingleFrame();
     $response->dicomPic = array_shift($dicomPics);
 }/*}}}*/
 /**
  * getSettleOrders 
  * 提现明细 
  * @param mixed $userId 
  * @param mixed $pageId 
  * @param mixed $pageSize 
  * @access public
  * @return void
  */
 public function getSettleOrders($userId, $pageId, $pageSize)
 {/*{{{*/
     $space = DAL::get()->find('Space', $userId); 
     if($space->isNull())
     {
         $this->setErrorCode(819);
         return 0;
     }
     $this->_initPageInfo($pageId, $pageSize);
     $settleOrders = DAL::get()->find_all_by_spaceid('SettleOrder', $space->id);
     XString::sortArray($settleOrders, 'ctime');
     $total = count($settleOrders);
     $pages = ceil($total/$pageSize);
     $settleOrders = array_slice($settleOrders, ($pageId-1)*$pageSize, $pageSize);
     $infos = array();
     foreach($settleOrders as $settleOrder)
     {
         $info = array();
         $info['id'] = $settleOrder->id;
         $info['ctime'] = $settleOrder->ctime->toShortString();
         $info['totalAmount'] = $settleOrder->amount;
         $info['subsidyAmount']= $settleOrder->subsidyAmount;
         $info['allTaxAmount'] = $settleOrder->allTaxAmount;
         if($info['allTaxAmount'] == 0)
         {
             $info['allTaxAmount'] = $settleOrder->taxAmount;
         }
         $info['taxAmount'] = $settleOrder->taxAmount;
         $info['taxByCompany'] = $settleOrder->subsidyTaxAmount;
         $info['withdrawAmount'] = number_format($settleOrder->getAmountWithoutTax(), 2);
         $info['status'] = $settleOrder->isWithdraw() ? '已汇出' : '未汇出';
         $infos[] = $info;
     }
     $this->content = $infos;
     $pageInfo = array();
     $pageInfo['pages'] = $pages;
     $pageInfo['pagesize'] = $pageSize;
     $pageInfo['nowpage'] = $pageId;
     $pageInfo['total'] = $total;
     $this->pageInfo = $pageInfo;
 }/*}}}*/
Exemplo n.º 28
0
 private function sortUpdateTime($relatedObjs)
 {/*{{{*/
     $stdClasses = array();
     foreach($relatedObjs as $relatedObj)
     {
         if($relatedObj instanceof DoctorPatientRef)
         {
             $re = new StdClass();
             $re->relatedobj = $relatedObj;
             $re->sortTime = $relatedObj->lastPostTime;
             $stdClasses[] = $re;
         }
         else if($relatedObj instanceof TelDto || $relatedObj instanceof BookingOrder)
         {
             $re = new StdClass();
             $re->relatedobj = $relatedObj;
             $re->sortTime = $relatedObj->utime;
             $stdClasses[] = $re;
         }
     }
     XString::sortArray($stdClasses, 'sortTime');
     $relatedObjs = array();
     foreach($stdClasses as $stdClass)
     {
         $relatedObjs[] = $stdClass->relatedobj;
     }
     return $relatedObjs;
 }/*}}}*/