public function ajaxDiseasePost($request, $response) { /*{{{*/ $lastCommonCaseNote = $this->space->commonCaseNote; $diseasesGbk = XString::convertToGbk($request->commonCaseNote); if (false == $diseasesGbk) { $diseasesGbk = ' '; } SpaceClient::getInstance()->setProperties($this->space->id, array('commonCaseNote' => $diseasesGbk)); $spaceUserId = $this->space->id; if ($lastCommonCaseNote != $diseasesGbk) { $type = SpaceLog::$type[SpaceLog::SPACE_LOG_TYPE_CASE]; SpaceChangeLogClient::getInstance()->addLog($spaceUserId, $type, $diseasesGbk); //非医生本人更改,记录到审核日志 if ($this->isSpaceLogin()) { RecommendThreadCategoryClient::getInstance()->pushUserLog($spaceUserId, $spaceUserId, '更新了咨询范围', RecommendThreadCategoryLog::TYPE_CASE_NUMBER_CATEGORY_JUDGE); } } DZoneClient::getInstance()->replaceSpaceAttribute($this->space->id, Space::ATTR_RECOMMEND_COMMONCASENOTE_UPDATED, 1); $diseasesGbk = strlen($diseasesGbk) > 0 ? $diseasesGbk : '暂无'; $commonCaseNoteMessage = array('status' => 0, 'disease' => XString::convertToUnicode($diseasesGbk)); echo json_encode($commonCaseNoteMessage); return self::DIRECT_OUTPUT; }
private function getCareThreads($request, $response) { /*{{{*/ $recommendThreadCategories = DAL::get()->find_all_by_space('RecommendThreadCategory', $this->space->id); $facultyRelatedThreadCategories = DAL::get()->find_id_by_faculty_forthread('ThreadCategory', $this->space->host->hospitalfaculty->faculty->id, ThreadCategory::LEVEL_2); $threadCategoryIds = array(); foreach ($recommendThreadCategories as $recommendThreadCategory) { if (false == $recommendThreadCategory->threadCategory->isNull()) { $threadCategoryIds[] = $recommendThreadCategory->threadCategory->id; } } $threadCategoryIds = array_merge($threadCategoryIds, $facultyRelatedThreadCategories); $threadCategoryIds = array_unique($threadCategoryIds); $recommendThreads = array(); try { $this->space->ensureToAnswer(); $isRecommend = true; } catch (Exception $e) { $isRecommend = false; } if ($isRecommend && false == empty($threadCategoryIds)) { $rows = 12; //限制条数 $threads = $tmp = array(); if (isset($threadCategoryIds) && false == empty($threadCategoryIds)) { $threadCategorys = DAL::get()->find('ThreadCategory', $threadCategoryIds); foreach ($threadCategoryIds as $threadCategoryId) { $levels = RecommendThreadCategoryClient::getInstance()->getRecommendLevels($this->space, $threadCategorys[$threadCategoryId]); $threads = DAL::get()->find_all_proposalsForRecommend('Proposal', $this->space, $threadCategorys[$threadCategoryId], array('levels' => $levels), $rows); if (false == empty($threads)) { $tmp = array_merge($tmp, $threads); if (count($tmp) >= $rows) { break; } } } } $recommendThreads = $tmp; if (count($recommendThreads) > $rows) { $recommendThreads = array_slice($recommendThreads, 0, 12); } } $response->recommendThreads = $recommendThreads; /** 与空间相关的咨询分类 */ //will be done by tpy $threadCategories = DAL::get()->find('ThreadCategory', $threadCategoryIds); $response->threadCategories = $threadCategories; }
private function getRecommendByCondition(array $threadCategorys, $response, $limitArea = '', $threadCategoryId = self::RECOMMEND_THREADCATEGORY_ALL) { /*{{{*/ $diseases = $titles = array(); $recommendProposals = array(); foreach ($threadCategorys as $threadCategory) { if (count($recommendProposals) > 50) { break; } $options = array(); $options['province'] = $limitArea; $options['levels'] = RecommendThreadCategoryClient::getInstance()->getRecommendLevels($this->space, $threadCategory); $recommendProposals = $recommendProposals + DAL::get()->find_all_proposalsForRecommend('Proposal', $this->space, $threadCategory, $options, self::RECOMMEND_PROPOSAL_LIMIT); } $proposalInfos = array(); if (false == empty($recommendProposals)) { $proposalInfos = NodeClient::getInstance()->getTitleAndDiseaseByRelatedObjIds(array_keys($recommendProposals), "Proposal"); } foreach ($proposalInfos as $proposalInfo) { $diseases[$proposalInfo->id] = XString::truncate($proposalInfo->disease, 44, "..."); $titles[$proposalInfo->id] = XString::truncate($proposalInfo->title, 60, "..."); } $response->recommendProposals = $recommendProposals; $response->diseases = $diseases; $response->titles = $titles; $response->threadCategoryId = $threadCategoryId; return $proposalInfos; }
public function deleteRecommendThreadCategory($request, $response) { /*{{{*/ $spaceId = $request->space_user_id; $slot = $request->slot; RecommendThreadCategoryClient::getInstance()->deleteRecommendThreadCategory($spaceId, $slot); RecommendThreadCategoryClient::getInstance()->pushUserLog($spaceId, $this->curInspector->user->id, '删除了推送分类'); $response->setRedirect($response->router->urlfor('threadcate/recommendAuditDetail', array('space_user_id' => $spaceId, 'message' => '更新成功!'))); }
public function ajaxDiseasePost($request, $response) { $lastCommonCaseNote = $this->_newSpace->commonCaseNote; $diseasesGbk = XString::convertToGbk($request->diseases); SpaceClient::getInstance()->setProperties($this->_newSpace->id, array('commonCaseNote'=>$diseasesGbk)); $spaceUserId = $this->_newSpace->id; if($lastCommonCaseNote != $diseasesGbk) { $type = SpaceLog::$type[SpaceLog::SPACE_LOG_TYPE_CASE]; SpaceChangeLogClient::getInstance()->addLog($spaceUserId, $type, $lastCommonCaseNote); //非医生本人更改,记录到审核日志 if($this->_adminIsLogin) { RecommendThreadCategoryClient::getInstance()->pushUserLog($spaceUserId, User::ADMIN_USERID, '更新了咨询范围'); } } DZoneClient::getInstance()->replaceSpaceAttribute($this->_newSpace->id, Space::ATTR_RECOMMEND_COMMONCASENOTE_UPDATED, 1); $diseasesGbk = strlen($diseasesGbk) > 0? $diseasesGbk: '暂无'; $commonCaseNoteMessage = array('status' => 0, 'disease' => XString::convertToUnicode($diseasesGbk)); $response->commonCaseNoteMessage = json_encode($commonCaseNoteMessage); }