public function showThreadList($request, $response) {/*{{{*/ $nowPage = $request->getRequest('p', 1); $pager = new XPager($nowPage, 10); $status = $request->getRequest('status', ''); if($request->patientId > 0) { $patient = DAL::get()->mustFind('Patient', $request->patientId); DBC::requireTrue($patient->user->id == $this->user->id, '无效患者'); list($caseList, $pageInfo) = ProposalClient::getInstance()->getProposalAndFlowList($patient, $pager, $status); } else { list($caseList, $pageInfo) = ProposalClient::getInstance()->getProposalAndFlowList($this->user, $pager, $status); } $response->caseList = $caseList; $url = $response->router->urlfor('proposal/showThreadList', array( 'patientId' => $request->patientId, 'status' => $request->status, )); $response->pageLink = PageNav::getNavLink( PageNav::getPageNavTemplate($url.'&p=') , $pageInfo['nowpage'] , $pageInfo['pagesize'] , $pageInfo['total'] ); $response->patientId = $request->patientId; $response->caseStatus = ""; $response->status = $status; $response->chargeFlowList = FlowClient::getInstance()->getPaiedFlowListByUser($this->user, $needCache = false); $response->titleAndDisease = NodeClient::getInstance()->getTitleAndDiseaseByRelatedObjIds(array_keys($caseList),"Proposal"); }/*}}}*/
public function updateDoctorSitemap() {/*{{{*/ $curPage = $_SERVER["argv"][1]; //开始页 echo date("Y-m-d H:i:s")." Current page: {$curPage} start... \n"; $indexFilePath = dirname(__FILE__).'/../../wwwfront/root/sitemap/'; $indexFileName = $curPage.'.xml'; $indexFile = $indexFilePath.$indexFileName; if(false == isset($_SERVER["argv"][2])) //若只有一个医生id { $spaces = DAL::get()->find('space',array($curPage)); } else { $pageSize = $_SERVER["argv"][2]; //每一页大小 $spaces = SpaceClient::getInstance()->getConfirmedSpaces($curPage,$pageSize); } if(false == count($spaces)) { echo date("Y-m-d H:i:s")." {$curPage} Space NOT FOUND! Processing quit"; exit; } $startTime = '2011-01-01'; //只统计从2011年开始的CASE和文章 $startTime2= mktime(0,0,0,1,1,2011); foreach($spaces as $space) { $cases = FlowClient::getInstance()->getIdAndSpaceName4sitemap($space->id,$startTime); $articles = ArticleClient::getInstance()->getIdAndSpaceName4sitemap($space->id,$startTime2); $sourceType = ($space->isOpenFlow())?(Space::SPACE_SITEMAP_SOURCE_FLOW):(Space::SPACE_SITEMAP_SOURCE_CASE); $this->createSitemap($cases, $space->user->name, $sourceType, $indexFile); $this->createSitemap($articles, $space->user->name, Space::SPACE_SITEMAP_SOURCE_ARTICLE, $indexFile); } echo date("Y-m-d H:i:s")." {$curPage},".(isset($pageSize)?$pageSize:'')." Finshed! Process Space number:".count($spaces)."\n"; }/*}}}*/
public function addFlowFreeOrder($request, $response) {/*{{{*/ $refId = $request->getRequest('refid',true); $dpRef = DAL::get()->find('DoctorPatientRef', $refId); if(false == $dpRef->isNull() && $this->_newUser->id == $dpRef->space->user->id && ($dpRef->getAllowSpaceReply() == 1 || $dpRef->getAllowSpaceReply() == 0 )) { FlowClient::getInstance()->addFreeServcieCardByDoctor($dpRef); } $response->setRedirect($dpRef->url); }/*}}}*/
public function temporaryTaskList($request, $response) { /*{{{*/ $status = $request->getRequest('status', 'all'); $flowId = $request->flowId; $spaceName = $request->spaceName; $userName = $request->userName; $pageSize = 15; $nowPage = $request->getRequest('p', 1); $res = FlowClient::getInstance()->getFlowList4TemporaryTask($flowId, $spaceName, $userName, $status, $pageSize, $nowPage); $response->doctorPatientRefList = $res['list']; $response->status = $status; $response->flowId = $flowId; $response->spaceName = $spaceName; $response->userName = $userName; $pageInfo = $res['pageInfo']; $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate('?flowId=' . $flowId . '&status=' . $status . '&spaceName=' . $spaceName . '&userName='******'&p='), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total']); $response->pagelink = $pagelink; }
private function getFlowList($searchType,$searchParam) {/*{{{*/ //咨询列表 $flowList = FlowClient::getInstance()->getLatestFlowList(8); if($searchType == CmsTagType::HOSPITAL) { $spaceIds = DAL::get()->find_id_byHospitalId('space', $searchParam, 30); if (false == empty($spaceIds)) { $flowList = FlowClient::getInstance()->getLastDoctorPatientPosts($spaceIds, 8); } } else if($searchType == CmsTagType::FACULTY) { $spaceIds = DAL::get()->find_id_activeSpaceIdsByFacultyId('space', $searchParam); if (false == empty($spaceIds)) { $flowList = FlowClient::getInstance()->getLastDoctorPatientPosts($spaceIds, 8); } } return $flowList; }/*}}}*/
public function workSheet($request, $response) { /*{{{*/ $auditor = $this->auditor; $response->auditor = $auditor; $followupAuditor = DAL::get()->find_by_auditorid('FollowupAuditor', $auditor->id); if ($followupAuditor->isNull()) { throw new BizException('你没有权限访问'); } $workSheetId = $request->worksheetid; $workSheet = DAL::get()->find('WorkSheet', $workSheetId); $response->workSheet = $workSheet; if ($workSheet->isNull()) { echo '没有找到该工作单!'; return parent::DIRECT_OUTPUT; } $user = DAL::get()->find('User', $workSheet->customer->userId); $response->user = $user; if (WorkSheet::SUBMIT_YES == $workSheet->submit) { $response->setRedirect($response->router->urlfor('followup/getworksheetcontent', array('worksheetId' => $workSheet->id))); } //找到患者基本信息 $owner = $user->getFollowupPatientSignin(); DBC::requireTrue(empty($patientsignin), '未找到指定signinId的患者'); $response->owner = $owner; // 新的血压、心率 $xueyaxinlvhealthRecordProblemCategory = HealthRecordClient::getInstance()->getProblemCategoryByName('血压心率组合'); $response->xueyaxinlvhealthRecordProblems = $xueyaxinlvhealthRecordProblemCategory->problems; //问诊,其他部分 $labelArr = WorkSheetClient::getInstance()->getLabels4WorkSheet($workSheet->id); $response->labelArr = $labelArr; $response->labelCategories = DAL::get()->find_all_by_isDeleted_and_type('LabelCategory', LabelCategory::DELETED_NO, LabelCategory::NFS_TEXTWENZHEN); $response->contactLabels = DAL::get()->find('Label', $workSheet->contactLabelIds); $wenzhenInquiry = WorkSheetClient::getInstance()->getInquiryByTypeAndWorkSheetId(WorkSheetInquiry::TYPE_STANDARD_TEXT, $workSheet->id); $qitaInquiry = WorkSheetClient::getInstance()->getInquiryByTypeAndWorkSheetId(WorkSheetInquiry::TYPE_OTHER, $workSheet->id); $response->wenzhenContent = $wenzhenInquiry->content; $response->qitaContent = $qitaInquiry->content; //标准化问诊 $this->getStandardInquiryQuestionSheet($request, $response); //用药部分 $medicineSchemeList = MedicineClient::getInstance()->getUserCurrentMedicineScheme($user->id); $response->medicineSchemeList = $medicineSchemeList; $medicineSchemeId = -1; if (false == empty($medicineSchemeList)) { $medicineSchemeId = key($medicineSchemeList); } $response->medicineSchemeId = $medicineSchemeId; //$response->followupAuditorList = FollowupOwner::getFollowupAuditors(); $auditorsRole = DAL::get()->find_by_name('followupauditorrole', FollowupAuditorRole::NAME_ASSISTANTDOCTOROPERATION); $response->followupAuditorList = FollowupAuditorClient::getInstance()->getAuditorListByRoleId($auditorsRole->id); $response->medicineEventLabelList = MedicineClient::getInstance()->getDefaultMedicineEventLabel(); //任务部分 $role = $followupAuditor->role; $response->auditorRole = $role; // 抽成方法 $params = array('auditorroleid' => $role->id, 'customerid' => $workSheet->customer->id, 'action' => 'tel', 'pending' => NfsTask::PENDING_NO, 'statusarr' => array(NfsTask::STATUS_UNFINISHED), 'deadline' => XDateTime::today()); $taskList = TaskClient::getInstance()->getOwnerTaskList($params); $resultArr = array(); foreach ($taskList['before'] as $task) { $resultArr[$task->taskModel->id][] = $task; } $response->taskList = $resultArr; $modelIds = array_keys($response->taskList); $response->modelList = DAL::get()->find('NfsTaskModel', $modelIds); $customerInfoRecordList = FollowupCustomerClient::getInstance()->getCustomerInfoRecordList4ByTaskIdArr(array_keys($taskList['before'])); $taskId_infoRecordList = array(); if ($customerInfoRecordList != null) { foreach ($customerInfoRecordList as $record) { $taskId_infoRecordList[$record->sourceid][] = $record; } $response->taskId_infoRecordList = $taskId_infoRecordList; } //健康日记部分 $response->diaryList = HealthDiaryClient::getInstance()->getLatestDiaries($user->id, XDateTime::today()->addDay(-14)->toShortString(), HealthDiary::AGENTAUDITORID_PATIENT); //提问部分 $response->checkupAnswerSheets = DAL::get()->find_all_by_userid_and_deleted('CheckupAnswerSheet', $owner->user->id); $response->questionLabelInfos = CheckupWenDaClient::getInstance()->formatCheckupAnswerSheet($response->checkupAnswerSheets); $response->labelList = DAL::get()->find('Label', array_keys($response->questionLabelInfos)); //下次联系内容部分 $lastCollectTimes = WorkSheetClient::getInstance()->getLastCollectTimes($user->id); foreach ($lastCollectTimes as $key => $time) { if (empty($time)) { $collectDayStr[$key] = "<span class='fb'>没有采集记录</span>"; } else { $time = XDateTime::valueOf($time); $collectDay = (strtotime(XDateTime::today()) - strtotime(XDateTime::valueOf($time->toShortString()))) / 3600 / 24; if ($collectDay < 14) { $collectDayStr[$key] = "<span>距离上次采集" . $collectDay . "天</span>"; } else { $collectDayStr[$key] = "<span class='fb'>距离上次采集" . $collectDay . "天</span>"; } } } $response->collectDayStr = $collectDayStr; $response->auditorId = $auditor->id; //找到患者现在体重 $nowWeightAnswerId = FollowupClient::getInstance()->getUserLastProblemByProblemId($owner->user->id, HealthRecordProblem::HEALTHDIARY_WEIGHT); if ($nowWeightAnswerId != '') { $response->nowWeightAnswer = DAL::get()->find('HealthRecordanswer', $nowWeightAnswerId); } //找到患者报到信息 if ($owner->getNfsDisease() != null) { $signinProblems = $owner->getNfsDisease()->getSigninHealthProblems(); $response->signinProblems = $signinProblems; } $heightProblem = DAL::get()->find_by_title_and_type('healthrecordproblem', HealthRecordProblem::HEIGHT, HealthRecordProblem::TYPE_SIGNIN); $heightAnswerList = HealthRecordClient::getInstance()->getLastHealthAnswerList($owner->user->id, array($heightProblem->id)); if (false == empty($heightAnswerList)) { $heightAnswer = array_shift($heightAnswerList); $height = $heightAnswer->value; } else { $height = ''; } $response->height = $height; $customerId = $workSheet->customer->id; $customer = DAL::get()->find('followupCustomer', $customerId); $response->customer = $customer; $customerWorkSheets = DAL::get()->find_all_by_customerid('worksheet', $customerId); XString::sortArray($customerWorkSheets, 'ctime'); $response->workSheetContents = array(); $response->workSheetContentMaxCount = 3; if (false == empty($customerWorkSheets)) { $workSheetContents = array(); foreach ($customerWorkSheets as $lastWorkSheet) { $lastInfo = WorkSheetClient::getInstance()->getWorkSheetContactByWorkSheetId($lastWorkSheet->id, $owner->patient); if (false == empty($lastInfo)) { $workSheetContents[] = $lastInfo; } } $response->workSheetContents = $workSheetContents; $response->isShow = false; } //得到患者的userid $userId = $owner->user->id; $flowList = FlowClient::getInstance()->get2WeeksFlowList($owner->patient->id, $customer->space->id); $response->flowList = $flowList; //PCI手术信息 $category = DAL::get()->find_by_name('HealthRecordProblemCategory', '二、PCI手术信息'); $healthProblems = $category->problems; $problemIds = array_keys($healthProblems); $answerList = HealthRecordClient::getInstance()->getHealthAnswerList4Initial($userId, $problemIds); $myAnswerList = array(); foreach ($answerList as $answer) { if ($answer->isNull() == false) { $myAnswerList[$answer->ref->problem->id] = $answer; } } $response->healthProblems = $healthProblems; $response->myAnswerList = $myAnswerList; $response->contacthealthitemnames = $workSheet->contactHealthItemNames; $response->sportProblems = HealthRecordClient::getInstance()->getSportProblem4WorkSheet(); $historyArr = HealthDiaryClient::getInstance()->getDiaryAnswerHistory4WorkSheet($userId, $num = 10); // 老的血压、心率历史记录,即将废掉 $response->bloodPressureHistory = $historyArr['bloodpressure']; $response->heartRateHistory = $historyArr['heartrate']; // 新的血压、心率历史记录 $response->xueyaxinlvHistory = $historyArr['xueyaxinlv']; $response->bloodGlucoseHistory = $historyArr['bloodglucose']; $response->weightHistory = $historyArr['weight']; $response->sportHistory = $historyArr['sport']; //出院诊断部分 $resultList = array(); $diagnosisList = DAL::get()->find_all_by_customerid('LeaveHospitalDiagnosis', $customerId); foreach ($diagnosisList as $diagnosis) { $resultList[$diagnosis->leavehospitaltime] = DiagnosisClient::getInstance()->findAllDiagnosisResultByDiagnosisId($diagnosis->id); } $response->resultList = $resultList; $response->BMIInfo = $user->getFollowupCustomer()->getBIMInfo(); $weightAnswer = DAL::get()->find_LastestWeightAnswer('HealthRecordAnswer', $owner->getFollowupCustomer()->userId); $lastWeight = $weightAnswer instanceof HealthRecordAnswer ? $weightAnswer->value : 0; //$lastWeight = DAL::get()->find_LastestWeightAnswer('HealthRecordAnswer', $owner->getFollowupCustomer()->userId)->value; $response->bmr = Patient::getBMR($owner->patient->getAgeNum(true), $lastWeight, $owner->patient->sex); //饮食部分 $tmpArr = array(dietFoodInfoNodeDefine::DIET_CACULATOR_WORKSHEETID => $workSheetId); $response->dietFoodsNodeObjs = DAL::get()->find_all_by_nodename_and_keyname_and_value_and_source('nodeobj', NodeObj::NODE_DEFINE_DIET_CACULATOR, $tmpArr, NodeObj::SOURCE_NFS); //疾病管理 $response->workMemos = DAL::get()->find_all_by_customerid('workmemo', $customerId); //新体重管理 $healthItemProjects = DAL::get()->find_all_by_followupcustomerid('HealthItemProject', $workSheet->customer->id); $response->healthItemProjects = $healthItemProjects; //症状事件 $incidents = DAL::get()->find_all_by_followupcustomerid('Incident', $workSheet->customer->id); $arr = array(); $res = array(); foreach ($incidents as $incident) { /*{{{*/ $incidentStates = DAL::get()->find_all_by_incidentid('IncidentState', $incident->id); if (false == empty($incidentStates)) { $arr[$incident->id] = end($incidentStates); } } /*}}}*/ if (false == empty($arr)) { /*{{{*/ foreach ($arr as $incidentId => $incidentState) { $ids[] = $incidentId; $emerg[] = $incidentState->emergencyLevel; $f[] = $incidentState->careLevel + $incidentState->impactLevel; } array_multisort($emerg, $f, SORT_DESC, SORT_NUMERIC, $ids); $res = array(); if (false == empty($ids)) { foreach ($ids as $id) { $res[$id] = DAL::get()->find('Incident', $id); } } } else { $res = $incidents; } $response->incidents = $res; //复查异常 $nfsSubTasks = DAL::get()->find_all_by_followupcustomerid_and_status('NfsSubTask', $workSheet->customer->id, ProjectConst::CustomerStatus_Start); //展示时先展示用药任务,然后是复查任务。 $_FuChaTasks[] = array(); $_YongYaoTasks[] = array(); foreach ($nfsSubTasks as $nfsSubTask) { /*{{{*/ if ($nfsSubTask->type == NfsSubTask::Type_FuCha) { $_FuChaTasks[$nfsSubTask->id] = $nfsSubTask; } else { if ($nfsSubTask->type == NfsSubTask::Type_YongYao) { $_YongYaoTasks[$nfsSubTask->id] = $nfsSubTask; } } } /*}}}*/ $nfsSubTasks = $_YongYaoTasks + $_FuChaTasks; $response->nfsSubTasks = $nfsSubTasks; //血糖管理 $bloodSugarSteps = DAL::get()->find_all_by_followupcustomerid('bloodSugarStep', $workSheet->customer->id); $response->bloodSugarSteps = $bloodSugarSteps; }
public function resetConfirmTime($request, $response) {/*{{{*/ TelOrderClient::getInstance()->resetConfirmTime($this->curUser, $request->orderId); $order = DAL::get()->find('telorder', $request->orderId); FlowClient::getInstance()->refreshFlow($order->getSpace()->id, $order->patient->id, $order); echo 1; return parent::DIRECT_OUTPUT; }/*}}}*/
private function refreshFlow($diaryId) { /*{{{*/ if ($diaryId) { $healthDiary = DAL::get()->find('HealthDiary', $diaryId); if ($healthDiary instanceof HealthDiary) { if ($healthDiary->flowId) { $flow = DAL::get()->find('doctorpatientref', $healthDiary->flowId); if ($flow instanceof doctorpatientref) { FlowClient::getInstance()->generateFlowOrAddItemToFlow($flow->space, $flow->patient, $healthDiary); } } } } }
public function _getPagedPosts4Third($thread, $fetchCount, $lastPostId) {/*{{{*/ $posts = array(); if ($thread instanceof DoctorPatientRef) {/*{{{*/ $params = array(); $spaceId = $thread->spaceid; $patientId = $thread->patientid; $posts = FlowClient::getInstance()->getAllFlowInfos($spaceId, $patientId, array('isBrowser'=>true)); $posts = FlowClient::getInstance()->getFlowListWithOutSens($posts); $needPost = array(); foreach($posts as $key => $post) { // todo::jz getclass if ($post instanceof Thread || $post instanceof Proposal || $post instanceof Post || $post instanceof DoctorPatientPost || $post instanceof TelOrder || $post instanceof TelVisit || $post instanceof DoctorRadioMessage || $post instanceof PatientSignin || $post instanceof PatientApply || $post instanceof BookingLog || $post instanceof DoctorComment || $post instanceof PresentOrder || $post instanceof ServiceCard) { $needPost[$key] = $post; } } $posts = $needPost; if(false == empty($posts)) { if($lastPostId == 0) { $fetchCount = $fetchCount < count($posts) ? $fetchCount : count($posts); $posts = array_slice($posts, 0, $fetchCount, true); } else { //有最后一条取posts后面的 foreach($posts as $key => $value) { if($lastPostId >= $key) { unset($posts[$key]); } } $fetchCount = $fetchCount < count($posts) ? $fetchCount : count($posts); $posts = array_slice($posts, 0, $fetchCount, true); } } }/*}}}*/ $hasMore = 1; if(count($posts) < 6) { $hasMore = 0; } if(count($posts) == 6) { $posts = array_slice($posts, 0, 5, true); } $info = array(); $info['posts'] = $posts; $info['hasMore'] = $hasMore; return $info; }/*}}}*/
/** 浏览者角色登录response页面数据**/ private function index4Browser($request, $response) { /*{{{*/ $nowPage = $request->getRequest('p', 1); $pageSize = 20; $role = 'browser'; $type = 'all'; $groups = ForumClient::getInstance()->getAllGroupsBySpace($this->space->id); $groupCount = isset($groups['list']) ? count($groups['list']) : 0; list($pagelink, $topicList) = $this->getTopicListByType($type, $role, $nowPage, $pageSize); $groupIds = array_keys($groups['list']); if (false == empty($groupIds)) { $countsArr = ResidentEvilClient::getInstance()->getTopicCountByGroupIds($groupIds); } $response->countsArr = $countsArr; $response->type = $type; $response->role = $role; $response->groups = $groups['list']; $response->cntsInfo = empty($groups['list']) ? array() : ForumClient::getInstance()->getLeadersCntByGroups($groups['list']); $response->pagelink = $pagelink; $response->topicList = $topicList['list']; $response->groupCount = $groupCount; $response->flows = FlowClient::getInstance()->getFlowListByUser($this->user->id, array('status' => DoctorPatientRef::STATUS_INIT)); }
public function promotion($request, $response) {/*{{{*/ $response->title = '感恩答谢'; $space = SpaceClient::getInstance()->getAnyOneSpace(); $response->space = $space; $params = array(); $params['limit'] = 3; $params['isOnline'] = true; $params['hasStock'] = true; $popularResult = PresentClient::getInstance()->getPresentsAndSoldCnt($params); $response->popularPresents = $popularResult['presents']; $recommendPresents = PresentClient::getInstance()->getRecommendedPresents(); $recommendPresent = array_shift($recommendPresents); $response->recommendPresent = $recommendPresent; //flow $orderby = "postcount"; $groupby = "spaceid"; $arr = array( 'status' => DoctorPatientRef::STATUS_INIT, 'orderby' => $orderby, 'groupby' => $groupby, ); $limit = $request->limit; $response->limit = $limit; if($this->curUser->id) { $flows = FlowClient::getInstance()->getFlowListByUser($this->curUser->id, $arr); } if($this->curUser->isNull() || 0 == count($flows)) { $response->allowSend = false; $num = 3; $heartResult = PresentClient::getInstance()->getBoardByType(SpaceHeartBillboard::TYPE_WEEK,$num); $spaceHeartWeekBillboards = $heartResult['rank']; $response->spaceHeartWeekBillboards = $spaceHeartWeekBillboards; } else { $flowList = array(); foreach($flows as $flow) { if($flow->space->host instanceof Doctor) { $flowList[] = $flow; } } foreach($flowList as $flow) { $thankLetterCounts[$flow->id] = $flow->space->host->getCureThankLetterCount(); } $response->refs = ($limit == "all") ? $flowList : array_slice($flowList, 0, 6); $response->refCount = count($flowList); $response->thankLetterCounts = $thankLetterCounts; } //礼物列表 $page = 1; $pageSize = 200; $options = array(); $options['categoryid'] = $request->getRequest('categoryid', 0); $options['hasStock'] = true; $listResult = PresentClient::getInstance()->showPresentList4Front($page, $pageSize, $options); $response->presentList = $listResult['presents']; //动态 $spaceId = 0; $bannerResult = PresentClient::getInstance()->showPresentBanner($spaceId, 8); $response->onePresentOrders = array_slice($bannerResult['presentOrders'], 0, 4); $response->threePresentOrders = array_slice($bannerResult['presentOrders'], 4, 4); $response->statistics = SpaceClient::getInstance()->getStatistics(); //最新礼物更新(临时写,下期更新后就下掉) $newPresents = DAL::get()->find_all_by_condition('Present', 'name in ("马到成功", "吉祥如意")'); foreach ($newPresents as $presentKey=>$newPresent) { $newPresents[$newPresent->name] = $newPresent; unset($newPresents[$presentKey]); } $response->presentMdcg = $newPresents['马到成功']; $response->presentJxry = $newPresents['吉祥如意']; }/*}}}*/
/** * @brief 根据用户id获取患者列表,带有部分医生信息。iOS使用 * @author cs * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/proposal_getPatientListWithService?userId=3 * * @param $userId * * @return */ public function getPatientListWithService($userId, $pageId=1, $pageSize=10) {/*{{{*/ $user = DAL::get()->find('user', $userId); if ($user->isNull()) { $this->setErrorCode(107); return 0; } $patients = $this->getPatientsOrderByLastPostTime($user); foreach ($patients as $key => $patient) { $doctorInfo = $doctorList = array(); $res = FlowClient::getInstance()->getFlowAndFlowProposalSpaceByPatientId($patient->id, 1, 20); $patientRefs = isset($res['list']) ? $res['list'] : array(); if (empty($patientRefs)) { unset($patients[$key]); continue; } foreach ($patientRefs as $patientRef) { $space = $patientRef->space; if ($space->isNull() || false == $space->isConfirmed()) continue; $doctor = $space->host; $doctorInfo['doctorName'] = $doctor->name; $doctorInfo['doctorHospital'] = $doctor->hospitalfaculty->hospital->name; $doctorInfo['doctorFaculty'] = $doctor->hospitalfaculty->name; $doctorList[] = $doctorInfo; } $pageDoctorList[$patient->id] = $doctorList; } $pagePatients = array_slice($patients, ($pageId-1)*$pageSize, $pageSize); $infos = array(); foreach ($pagePatients as $pagePatient) { $doctorList = isset($pageDoctorList[$pagePatient->id]) ? $pageDoctorList[$pagePatient->id] : array(); $info['id'] = $pagePatient->id; $info['name'] = $pagePatient->name; $info['doctorCnt'] = count($doctorList); $info['unReadCnt'] = FlowMarkClient::getInstance()->getPatientUnreadAmount($pagePatient->id); $info['doctorList'] = array_slice($doctorList, 0, 2); $infos[] = $info; } $this->content = $infos; $pageInfo = array(); $pageInfo['pages'] = ceil(count($patients) / $pageSize); $pageInfo['pagesize'] = $pageSize; $pageInfo['nowpage'] = $pageId; $pageInfo['total'] = count($patients); $this->pageInfo = $pageInfo; }/*}}}*/
public function checkCondition4SpaceAfter($request, $response) {/*{{{*/ //选了患者的话要bindpatient $patientId = $request->getRequest('patientId', 0); if($patientId > 0) { AskSessionInfo::bindPatient($patientId); } else { if(isset($_SESSION['newAsk']['bindPatientId'])) { unset($_SESSION['newAsk']['bindPatientId']); } } $askSpace = AskSessionInfo::getBindSpace(); $patient = AskSessionInfo::getBindPatient(); if(false == empty($askSpace) && false == $askSpace->isNull()) { $flow = FlowClient::getInstance()->getValidFlowRef($askSpace->id, $patient->id); if(false == $flow->isNull()) { $response->setRedirect($response->router->urlfor('newcase/doctorpatientthread', array('id' => $flow->id))); return false; } $isCanAsk = $this->ensureCanAsk($this->user, $askSpace, $response); if(false == $isCanAsk) { return false; } } $response->setRedirect($response->router->urlfor('newcase/askindex', array("patientId" => $patientId))); }/*}}}*/
/** * @brief 设置流的状态为隐私 * @author lhl * @version branches/v2.14.23 * @date 2013-07-25 */ public function changeFlowPrivate($request, $response) { /*{{{*/ FlowClient::getInstance()->setPrivateStatus($request->refid, DoctorPatientRef::REF_PRIVATE); $ref = DAL::get()->find('doctorPatientRef', $request->refid); $response->setRedirect($ref->url); }
public function caseList($request, $response) {/*{{{*/ if(stripos($_SERVER['REQUEST_URI'], 'p=')) { $page = substr($_SERVER['REQUEST_URI'], stripos($_SERVER['REQUEST_URI'], 'p=') + 2); if($page == 1) { $page = ''; } else { $page = '_'.$page; } $request_Url = substr($_SERVER['REQUEST_URI'], 0, stripos($_SERVER['REQUEST_URI'], 'zixun')); $request_Url = $request_Url."zixun$page.htm"; $target = 'http://'.$_SERVER['HTTP_HOST'].$request_Url; $response->exitJump($target, 301); } $currentPage = intval($request->getRequest('page', 1)); $response->currentPage = $currentPage; //最新咨询 $spaceIds = DAL::get()->find_id_byHospitalId('space', $this->_hospital->id, 30); if (false == empty($spaceIds)) { $options['curPage'] = $currentPage; $options['pageSize'] = 100; $res = FlowClient::getInstance()->getLastDoctorPatientPosts($spaceIds, 300, $options); $response->totalPages = ceil(($res['total'])/100); $response->flowList = $res['flowList']; } $response->hospitalFacultyList = DAL::get()->find_all_by_condition('hospitalfaculty', 'fld_HospitalId = '.$this->_hospital->id.' and fld_HospitalFacultyIsVirtual=0 order by fld_HospitalFacultyRank desc'); //在线医生 $params = array(); $params['hospitalId'] = $this->_hospital->id; $params['limit'] = 10; $params['postcount'] = 0; // $params['spaceAdminLevel'] = 3; $doctorList = SpaceClient::getInstance()->getCaseOpenedSpaceList($params); $doctorList = $doctorList['spaceList']; $response->doctorList = $doctorList; //两周内回复数 $spacePostCntInfos = $this->getspacePostCntInfo($doctorList); $response->spacePostCntInfos = $spacePostCntInfos; if ($response->doctorList) $response->doctorUserNotice = ''; else $response->doctorUserNotice = $this->_hospital->commonName." 目前没有医生提供咨询服务,您可以咨询同专业其他大夫:"; $response->title = $this->_hospital->commonName.'最新咨询_好大夫在线'; $response->description = '汇总'.$this->_hospital->commonName.$this->_hospital->spaceCount .'位注册医生与患者交流的最新咨询,帮助患者全面了解疾病,合理安排就医。'; $response->keywords = $this->_hospital->commonName.'最新咨询,'.$this->_hospital->commonName.'专家咨询,'.$this->_hospital->commonName.'最新文章'; $response->pageModule = 'case'; }/*}}}*/
public function askIndex($request, $response) {/*{{{*/ $space = AskSessionInfo::getBindSpace(); $patientId = $request->patientId; $spaceId = $space->id; if(false == empty($patientId) && false == $space->isNull()) { $flow = FlowClient::getInstance()->getValidFlowRef($spaceId, $patientId); if(false == $flow->isNull()) { $response->setRedirect($flow->getUrl()); } $proposal = DAL::get()->find_by_spaceId_and_patientId_and_servicedef_and_status('proposal', $spaceId, $patientId, ServiceDef::TYPE_FLOW, Proposal::STATUS_NORMAL); if(false == $proposal->isNull()) { $response->setRedirect($proposal->getUrl4User()); } } $caseTitle = AskSessionInfo::getThreadTitle(); $diseaseInfo = AskSessionInfo::getPatientInfos(NodeObj::NODE_DEFINE_DISEASE); AskSessionInfo::session_destroy(); //设置开始标记 AskSessionInfo::setStartMarkSession(); // 先登录未选患者 标记 if($request->beforelogin == 1) { AskSessionInfo::addBeforeLoginConfirmPatient(); } if($caseTitle != '') { AskSessionInfo::addThreadTitle($caseTitle, false); } if(false == $space->isNull() && $space->host instanceof Doctor) { AskSessionInfo::bindSpace($space->id); if($space->modulecase->isLimitLess() == false) $response->allowNewMaxNumber = $space->modulecase->allowNewMaxNumber - $space->getUnProcessFlowPropoalCnt(); } if(false == $this->_newUser->isNull()) { AskSessionInfo::bindUser($this->_newUser->id); if($patientId > 0 ) { AskSessionInfo::bindPatient($patientId); AskSessionInfo::flushPatientInfos(); } } if(false == empty($diseaseInfo)) { $diseaseInfo = array_shift($diseaseInfo); $diseaseKey = AskSessionInfo::addPatientInfo(NodeObj::NODE_DEFINE_DISEASE, $diseaseInfo); AskSessionInfo::bindPatientInfos(NodeObj::NODE_DEFINE_DISEASE, array($diseaseKey)); } $response->askSpace = $space; }/*}}}*/
public function ajaxPresentBanner($request, $response) { /*{{{*/ if ($request->presentorderid) { $presentOrder = DAL::get()->find('PresentOrder', $request->presentorderid); $ref = FlowClient::getInstance()->getValidFlowRef($presentOrder->space->id, $presentOrder->patient->id); if (false == $ref->isNull()) { $response->setRedirect($ref->getUrl()); } else { $response->setRedirect($this->space->getUrl()); } } else { $isDefined = $request->isDefined; $response->isDefined = $isDefined; $from = $request->from; $response->from = $from; $spaceId = $from || $isDefined ? $this->space->id : 0; $result = PresentClient::getInstance()->showPresentBanner($spaceId, 12, $from); $response->presentOrders = $result['presentOrders']; if ($from) { $response->presentCnt = $result['presentCnt']; $response->patientCnt = $result['patientCnt']; } $response->patientId = $request->patientid; $response->stat = SpaceClient::getInstance()->getStatistics(); } if ($request->patientNum) { $response->spaceRepliedCount = SpaceClient::getInstance()->getCountOfRepliedFlowsCount($this->space->id, $this->user->id); } $response->src = $request->src; }
/** * @brief 获取医生的回复列表 * @author * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/flow_getDoctorFlowList?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 getDoctorFlowList($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 = FlowClient::getInstance()->queryFlowListByUserIdAndLevel($doctor->space->id, $pageId, $pageSize); $myDoctor = DAL::get()->find_by_userIdAndDoctorId('userdoctor', $userId, $doctor->id); $results = array(); $flowIds = array(); foreach($res['flowList'] as $flow) { $result = array(); $result['id'] = $flow->id; $result['title'] = $flow->title; $result['doctorName'] = ''; $result['content'] = $flow->diseaseName; $result['ctime'] = $flow->ctime; $result['hits'] = ''; $result['url'] = ''; $result['type'] = "flow"; $result['isSelfOwner'] = ($flow->user->id == $userId) ? 1 : 0; $result['subscriptionId'] = $myDoctor->id; $result['subscriptionType'] = 'userdoctor'; $flowIds[] = $flow->id; $results[$flow->id] = $result; } $readStatus = SubscriptionClient::getInstance()->getUserSubscriptionReadStatus($userId, $flowIds); 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; }/*}}}*/
private function addPost2Flow($user, $ref, $postContent, $option) {/*{{{*/ // 如果还有继续能回复post的就打开post回复开关 if ($ref->isClosePost()) { DoctorPatientPostClient::getInstance()->switchPatientPostCan($this->user->id, $ref->id); } if ($postContent || (isset($option['attachmentIds']) && false == empty($option['attachmentIds']))) { $post = DoctorPatientPostClient::getInstance()->addPost($ref->id, $this->user->id, $postContent, $option); if (false == $post->isNull()) { //系统日志 try{ FlowClient::getInstance()->addLog($ref,$this->user, DoctorPatientLog::TYPE_SYSTEM_LOG, 'FlowController::createPost', $post); }catch(Exception $ex) {} //管理员给患者的提示信息失效 NfsClient::getInstance()->disablePatientNotice($ref->id); } return $post->id; } return 0; }/*}}}*/
private function getFlowList4HomePage() {/*{{{*/ $categoryIds = ThreadCateClient::getInstance()->getShuffleCategoryIds(self::THREADCATEGORY_COUNT); return FlowClient::getInstance()->getRefList4HomePage($categoryIds, self::THREADCATEGORY_COUNT, self::THREAD_COUNT); }/*}}}*/
public function unDispatchPost($request, $response) { /*{{{*/ $proposalId = (int) $request->id; $proposal = DAL::get()->find('Proposal', $proposalId); if (false == $proposal instanceof Proposal) { throw new BizException('无效的方案!'); } ProposalClient::getInstance()->releaseFirstFlowProductBySpace($this->space, $proposal); extract(FlowClient::getInstance()->getNextUnread4Thread($this->space)); $response->nextUrl = $nextUrl; $response->commonCaseNote = $this->space->getChangeCommonCaseNote(); }
public function newFromFlow($request, $response) { /*{{{*/ $ref = DAL::get()->find('doctorPatientRef', $request->refId); $response->ref = $ref; $posts = array(); $allPosts = FlowClient::getInstance()->getAllFlowInfos($ref->space->id, $ref->patient->id); foreach ($allPosts as $post) { if ($post instanceof Proposal && $post->isFromThread() || $post instanceof DoctorPatientPost) { if ($post instanceof DoctorPatientPost && $post->isSoundPost()) { continue; } $posts[] = $post; } } $response->posts = $posts; }
public function serviceList($request, $response) { /*{{{*/ DBC::requireFalse($this->spaceIsLogin, '不允许自己提交给自己订单!'); //对没有开通电话咨询医生的链接跳转,没有owner也会跳走. if (!$this->space->isPhoneOpenedForFront($this->user->id)) { $response->setRedirect('http://' . URL_PREFIX . '400.haodf.com/index/prompt?doctorName=' . rawurlencode($this->space->host->name) . '&doctorFaculty=' . rawurlencode($this->space->host->hospitalfaculty->faculty->name)); return; } //医生近期通话记录 $callingLogs = array(); $fromDoctorDetail = $request->fromDoctorDetail; $response->fromDoctorDetail = $fromDoctorDetail; if (0 == $fromDoctorDetail) { $callingLogs = PaymentClient::getInstance()->getDoctorRecentPhoneRecords($this->space); } $response->callingLogs = $callingLogs; //医生部分的信息--beg-- $owner = DAL::get()->find_by_relatedObject('telowner', $this->space->user); $response->owner = $owner; //新近开通 $latestOpenCallServiceTitle = doctorOutline::getLatestOpenCallServiceTitle($owner->spaceExt->starttime4tel->toString()); $response->latestOpenCallServiceTitle = $latestOpenCallServiceTitle; //取头像 $response->headImageUrl = TuClient::getInstance()->getThumbnailUrl($this->space->user->headImage, 96, 96, TuClient::TYPE_ZOOM); if (empty($this->space->user->headImage)) { $response->headImageUrl = "http://i1.hdfimg.com/my/img/doctor_default_96.gif"; } //满意度和评价 $doctorSatisfactionList = PaymentClient::getInstance()->getDoctorSatisfactionList($this->space->host->id); $doctorSatisfaction = null; if (false == empty($doctorSatisfactionList)) { $doctorSatisfaction = $doctorSatisfactionList[$this->space->host->id]; } $response->doctorSatisfaction = $doctorSatisfaction; $response->productList = ProductClient::getInstance()->getProducts($this->space, array(serviceDef::TYPE_TELORDER)); //固定接听时间 $doctorPhoneSchedules = TelOwnerClient::getInstance()->getDoctorPhoneScheduleByOwnerId($owner->id); $response->doctorPhoneSchedules = $doctorPhoneSchedules; //未完成且已付费的订单数量,在固定接听时间那 $OrderIdsOfUnfinishedAndPayed = TelOwnerClient::getInstance()->getOrderOfUnfinishedAndPayed('telorder', $owner->id); $OrderCntOfUnfinishedAndPayed = count($OrderIdsOfUnfinishedAndPayed); $response->OrderCntOfUnfinishedAndPayed = $OrderCntOfUnfinishedAndPayed; //医生部分--end-- //患者部分的信息--beg-- $curUser = $this->user; //患者的有效订单数 $myOwner = null; $patientIdOfSelected = null; $validOrderCnt = 0; //已登录状态 $myOwner = new NullEntity(); if (false == $curUser->isNull()) { $myOwner = DAL::get()->find_by_relatedObject('telowner', $curUser); if ($myOwner->isNull() == false) { $validOrderCnt = TelOrderClient::getInstance()->getValidOrderCnt($myOwner->id); } //wk //默认选择患者,TODO by wk $patientIdOfLatestFlow = FlowClient::getInstance()->getPatientIdOfLatestFlow($this->user->id, $this->space->id); $patientIdOfSelected = $patientIdOfLatestFlow; if (empty($patientIdOfLatestFlow)) { $patientIdOfSelected = PaymentClient::getInstance()->getLatestPatientIdOfOrders($myOwner->id); } //优惠 wk } //dodo::yyp从咨询完成页自动带入咨询id $threadid = $request->threadid; if (isset($threadid)) { $thread = DAL::get()->find('thread', $threadid); $response->thread = $thread; } $response->curUser = $curUser; $response->patientIdOfSelected = $patientIdOfSelected; $response->validOrderCnt = $validOrderCnt; $response->spaceModule = 'PhoneCase'; $response->returnVisitList = array(); $response->ScoreDesc = TelVisit::$scoreDesc; $response->myOwner = $myOwner; //患者信息--end-- //从电话咨询医生详情页过来的显示精简模板 if (1 == $request->fromDoctorDetail) { $response->callingLogs = array(); $response->fromDoctorDetail = $request->fromDoctorDetail; return "compactMode"; } else { $response->callingLogs = PaymentClient::getInstance()->getDoctorRecentPhoneRecords($this->space); return "default"; } }
<?php if (false == $record->hasConvert2Post()) { $flows = FlowClient::getInstance()->getFlowListByUser($patient->user->id, array('patientId' => $patient->id, 'status' => DoctorPatientRef::STATUS_INIT)); if (false == empty($flows)) { ?> <div class="borderDiv" id="convertpostdiv"> <div class="detail-module"> <div class="detail-module_title"> <h3>代患者提交对话</h3> </div> <p class="mt10 mb10 f14">患者医患流关系如下,可勾选后为患者提交post</p> <form method="post" action="convert2post" id="convertform"> <input type="hidden" name="id" value="<?=$record->id?>" /> <p> <?php foreach ($flows as $flow) { if ($flow->space->isNull()) continue; ?> <?php $isTrue = FlowMarkClient::getInstance()->isMarkForSpace($flow->space, SpaceSymbol::TYPE_MSD );?> <input type="radio" name="flowid"<?php if(false == empty($recordPatientIds) && $isTrue){?> onclick='addUrl()' <?}else{?>onclick='delUrl()'<?}?>value="<?=$flow->id?>"/><a href="<?=$flow->getUrl()?>" target="_blank"><?=$flow->id?></a>(<?=$flow->space->name?>) <span style="color:green"><?= ($isTrue)?"默沙东项目医生":''?></span> <?php } ?> </p> <div> <textarea name="content" id="convertcontent" style="width:65%;height:200px;" class="ml10 mt10 f14"><?=$record->getAnswersContent()?></textarea> <textarea hidden="true" id="convertcontent2" style="width:65%;height:200px;" class="ml10 mt10 f14"><?=$record->getAnswersContent()?></textarea> <span><a class="blueA ml20" style="position:relative;top:-100px;" onclick="return checkConvertForm();">转换</a> <?php if(false == empty($recordPatientIds)){?> <span><a class="blueA ml20" style="position:relative;top:-100px;" href="recorddetaillist?patientId=<?=$record->patient->id?>" target="_black">查看健康日记</a>
private function getNextPostId4Page($doctorPatientPost) {/*{{{*/ $nextPostId = 0; $ref = $doctorPatientPost->doctorPatientRef; $posts = FlowClient::getInstance()->getAllFlowInfos($ref->space->id, $ref->patient->id); foreach ($posts as $key => $post) { if ($post->id > $doctorPatientPost->id) { $nextPostId = $key; break; } } return $nextPostId; }/*}}}*/
public function getFlowList($request, $response) {/*{{{*/ $hospitalId = $request->partnerConfig->hospitalId; $option['hospitalId'] = $hospitalId; $out = SpaceClient::getInstance()->getCaseOpenDoctorIds4HzHospital($currentPage = 1, $pageSize = 1000, $option); $ids = $out['ids']; $flowList = array(); if (false == empty($ids)) { $flowList = FlowClient::getInstance()->getZixunFlowBySpaceIds($ids, $currentPage = 1, $pageSize = 4); $flowList = $flowList['flowList']; } $response->flowList = $flowList; return $request->partnerConfig->domain; }/*}}}*/
public function repealServiceCardByRef($request, $response) { /*{{{*/ $refId = $request->refId; $ticketId = $request->ticketId; $doctorPatientRef = DAL::get()->find('doctorpatientref', $refId); //dodo::djf $repealServiceCards = DAL::get()->find_all_by_SpaceAndPatientOfRepealServiceCard('servicecard', $doctorPatientRef->space, $doctorPatientRef->patient, ServiceDef::TYPE_FLOW); if (false == empty($repealServiceCards)) { $repealServiceCard = array_shift($repealServiceCards); FlowClient::getInstance()->repealServiceCard($doctorPatientRef, $repealServiceCard, $this->curInspector->user); } if (empty($ticketId)) { $response->setRedirect($response->router->urlfor('nfsaudit/notalk', array('refId' => $refId))); } else { $response->setRedirect($response->router->urlfor('nfsaudit/nexttask', array('c' => 'nfsaudit', 'a' => 'nexttask', 'ticketId' => $ticketId))); } }
private function canShowFreeFollowupLabel() { /*{{{*/ $showFreeFollowupLabel = true; $freeFollowupFlowTitle = "免费随访患者"; $freeUrl = $this->space->getFreeFollowupFlowUrl(); $abnormalFreeFollowUpFlowCount = FlowClient::getInstance()->getAbnormalFreeFollowUpFlowCnt('doctorpatientref', $this->space->id); if ($abnormalFreeFollowUpFlowCount > 0) { $freeFollowupFlowTitle = "免费随访患者(<span style='color:red'>异常患者 {$abnormalFreeFollowUpFlowCount}</span>)"; $freeUrl = $this->space->getFreeAndAbnormalFollowupFlowUrl(); } return array($freeUrl, $freeFollowupFlowTitle, $showFreeFollowupLabel); }
private function getPaiedList($response, $flowList) {/*{{{*/ $flowIds = array(); if(false == empty($flowList)) { $flowIds = array_keys($flowList); } $greenFlowList = FlowClient::getInstance()->getPaiedFlowListBySpace($this->_newSpace, ($this->_newSpace->user->id != $this->_newUser->id), $flowIds); $response->paiedIds = array_keys($greenFlowList); return $greenFlowList; }/*}}}*/
public function showFlowOrderList($request, $response) { /*{{{*/ $options['startTime'] = $beginDate = $request->beginDate; $options['endTime'] = $endDate = $request->endDate; $nowPage = $request->page ? $request->page : 1; $pageSize = 20; $res = ServiceCardClient::getInstance()->queryUnFreeServiceCardBySpaceAndServiceType($this->space, ServiceDef::TYPE_FLOW, $nowPage, $pageSize, $options); $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace("showfloworderlist?beginDate={$beginDate}&actionclass={$request->actionclass}&endDate={$endDate}&page="), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']); $response->flows = FlowClient::getInstance()->getFlowsByServiceCards($res['serviceCards']); $response->serviceCards = $res['serviceCards']; $response->pagelink = $pagelink; $response->beginDate = $beginDate; $response->actionClass = $request->actionclass; $response->endDate = $endDate; }