public function add($request, $response)
 {
     $diseaseId = $request->diseaseId;
     $params = $request->vars;
     $params['isVoteSelf'] = $request->isVoteSelf;
     if ($vars[threadCategoryId] < 0) {
         unset($vars[threadCategoryId]);
     }
     if (empty($diseaseId)) {
         $key = isset($params['key']) ? $params['key'] : '';
         $name = isset($params['name']) ? $params['name'] : '';
         $diseaseId = DiseaseClient::getInstance()->addDisease($key, $name, $params);
     } else {
         $diseaseId = DiseaseClient::getInstance()->modifyDisease($diseaseId, $params);
         $disease = DAL::get()->find('disease', $diseaseId);
         error_log($response->curOperatorUser->name . ' ' . XDateTime::now() . ' 修改疾病' . $disease->name . ' 的父疾病 为' . $params['parentName'] . "\n\n", 3, '/tmp/modifyparentdisease.log');
         $re_symptom = $request->getRequest('re_symptom', '');
         $re_search_word = $request->getRequest('re_search_word', '');
         $re_location = $request->getRequest('re_location', '');
         $stringList = array(DiseaseRelation::TYPE_SYMPTOM => $re_symptom, DiseaseRelation::TYPE_LOCATION => $re_location);
         DiseaseClient::getInstance()->updateStringRelation($disease->id, array_keys($stringList), $stringList);
     }
     $disease = DAL::get()->find('disease', $diseaseId);
     if ($disease->isNull() == false) {
         Squid::clean($disease->getUrl());
     }
     $msg = urlencode('操作成功');
     $response->setRedirect('/disease/detail?id=' . $diseaseId . '&msg=' . $msg);
 }
 private function cleanCacheUrls($adstuffId)
 {
     /*{{{*/
     $diseaseIds = DAL::get()->queryDiseaseIdByAdstuff('adword', $adstuffId);
     $diseaseList = DAL::get()->find('disease', $diseaseIds);
     foreach ($diseaseList as $disease) {
         Squid::clean($disease->getUrl());
     }
 }
 public function edit($request, $response)
 {
     $params = array('name' => trim($request->name), 'key' => trim($request->key), 'alias' => trim($request->alias), 'intro' => trim($request->intro), 'related' => $request->related);
     $res = FacultyClient::getInstance()->modifyFaculty($request->id, $params);
     $res ? $msg = '操作成功了' : '操作失败';
     $url = $response->router->urlfor('faculty/showedit?id=' . $request->id . '&msg=' . $msg);
     $response->setRedirect($url);
     $faculty = DAL::get()->find('Faculty', $request->id);
     Squid::clean($faculty->getUrl());
 }
 public function cleanUrlCache($request, $response)
 {
     /*{{{*/
     $channelRefId = $request->channelRefId;
     $channelRef = DAL::get()->find('ChannelRef', $channelRefId);
     $message = '';
     //清缓存
     $urls = array();
     $urls[] = $channelRef->object->getUrl();
     $urls[] = "http://www.haodf.com/jibing/" . $channelRef->object->key . "/";
     $urls[] = "http://www.haodf.com/jibing/zhuanti/" . $channelRef->object->key . "/";
     Squid::clean($urls);
     $message = '前台缓存已经清除';
     $message = mb_convert_encoding($message, 'utf-8', 'gbk');
     $out = array('message' => $message);
     echo json_encode($out);
     die;
 }
 public static function clearCache($hospital)
 {
     $urls = array();
     $urls[] = $hospital->getUrl();
     $urls[] = $hospital->getInfoUrl();
     $urls[] = $hospital->getScheduleUrl();
     $urls[] = $hospital->getFacultyUrl();
     $urls[] = $hospital->getDoctorUrl();
     $urls[] = $hospital->getDiseaseUrl();
     $urls[] = $hospital->getCaseUrl();
     $urls[] = $hospital->getAnnounceUrl();
     $urls[] = $hospital->getReMapUrl();
     Squid::clean($urls);
 }
 private function clearCache($id)
 {
     $diseaseFaculty = DAL::get()->find('diseasefaculty', $id);
     Squid::clean($hospitalAnnounce->hospital->getUrl());
     $hospitalFaculties = $hospitalAnnounce->hospital->hospitalFaculties;
     $urls = array();
     foreach ($hospitalFaculties as $hospitalFaculty) {
         $urls[] = $hospitalFaculty->getUrl();
     }
     Squid::clean($urls);
     return true;
 }
 /** 清理与医院相关的缓存 */
 private function clearCache($hospitalAnnounceId)
 {
     $hospitalAnnounce = DAL::get()->find('HospitalAnnounce', $hospitalAnnounceId);
     $urls = array();
     $urls[] = $hospitalAnnounce->hospital->getUrl();
     $urls[] = $hospitalAnnounce->hospital->getAnnounceUrl();
     $urls[] = $hospitalAnnounce->hospital->getScheduleUrl();
     $hospitalFaculties = $hospitalAnnounce->hospital->hospitalFaculties;
     foreach ($hospitalFaculties as $hospitalFaculty) {
         $urls[] = $hospitalFaculty->getUrl();
     }
     Squid::clean($urls);
     return true;
 }
 public function deleteOverseaDisease($request, $response)
 {/*{{{*/
     $id = $request->id;
     if (false == empty($id))
     {
         $overseaDisease = DAL::get()->find('overseadisease', $id);
         OverseaClient::getInstance()->deleteDisease($id);
         Squid::clean($overseaDisease->getUrl());
     }
     $response->setRedirect('/overseaadmin/showoverseadiseaselist');
 }/*}}}*/
 private function _batchClearSquidCache($schedules)
 {
     $urls = array();
     $urls['tingzhen'] = 'http://www.' . URL_PREFIX . 'haodf.com/tingzhen.htm';
     foreach ($schedules as $schedule) {
         if ($schedule->isNull() == false) {
             $doctorUrl = $schedule->doctor->getUrl();
             $urls[$doctorUrl] = $doctorUrl;
         }
     }
     Squid::clean($urls);
 }
Esempio n. 10
0
 /**
  * unbind user
  * 1.检查 用户存在?用户绑定其它对象?  取消绑定是用户未绑定对象
  * 2.取消绑定流程
  *  1)删除space中的信息
  *  2)由host type 更新医生或医院科室表
  *  3)从doctor log恢复修改的数据
  *
  * 参数要求, $data中必须包含 fld_UserId, fld_SpaceHostType, fld_SpaceHostId
  */
 public function unBind($request, $response)
 {
     $data = $request->data;
     $data['spaceHostId'] = $request->spaceHostId;
     $data['spaceHostName'] = $request->spaceHostName;
     $data['spaceHostType'] = $request->spaceHostType;
     $space = DAL::get()->find('space', $data['userId']);
     $res = SpaceClient::getInstance()->unBindUserSpace($data);
     $urls = $this->getSpaceCacheUrls($space);
     Squid::clean($urls, true);
     if ($res) {
         $admin = UserClient::getInstance()->getCurrentUser();
         $predoctor = DAL::get()->find_by_userid('predoctor', $space->user->id);
         $inspector = DAL::get()->find_by_userid('inspector', $admin->id);
         if (false == $predoctor->isNull() && false == $inspector->isNull()) {
             PreDoctorClient::getInstance()->setResultNo($predoctor->id, $inspector->id);
             DoctorClient::getInstance()->addDoctorOwner($predoctor->user->id, $predoctor->id, DoctorOwner::OWNER_TYPE_PREDOCTOR);
         }
         $msg = "操作成功!";
         $options = array('userId' => $data['userId'], 'userName' => $data['userName'], 'hostName' => $data['spaceHostName'], 'hostId' => $data['spaceHostId'], 'hostType' => $data['spaceHostType'], 'bindType' => $data['bindType'], 'msg' => $msg);
         $url = $response->router->urlfor('space/showopenspace', $options);
         $response->setRedirect($url);
     }
 }
 public static function clearCache($hospitalFaculty)
 {
     Squid::clean($hospitalFaculty->hospital->getUrl());
     Squid::clean($hospitalFaculty->hospital->getScheduleUrl());
     Squid::clean($hospitalFaculty->hospital->getFacultyUrl());
     Squid::clean($hospitalFaculty->getUrl());
     Squid::clean($hospitalFaculty->getScheduleUrl());
     Squid::clean($hospitalFaculty->getCaseUrl());
     Squid::clean($hospitalFaculty->faculty->getUrl());
     Squid::clean($hospitalFaculty->faculty->getCaseUrl());
     Squid::clean($hospitalFaculty->getJieShaoUrl());
 }
    public function step2bind($request, $response)
    {
    	$doctorId = $request->doctor_id;
    	if($doctorId == -1)
    	{
    		$hname = $request->hname;
    		$hfname = $request->hfname;
    		header("location: ".$response->router->urlfor('doctorreg/step2sendmsg', array('hname'=>$hname, 'hfname'=>$hfname)));
    		exit;
    	}
    	$user = UserClient::getInstance()->getCurrentUser();
    	if ($user->hasSpace())
    	{
    		header("location: ".$response->router->urlfor('doctorreg/finish', array('nocache'=>true)));
    		exit;
    	}
    	if ((int)$doctorId > 0)
    	{
    		$doctor = DAL::get()->find('doctor', $doctorId);
			$space = SpaceClient::getInstance()->bind($user->id, $doctor->id, 'Doctor', $doctor->name);
    		if ($space->isNull() == false)
    		{
                Squid::clean($doctor->getUrl(), true);
    			header('Location: '.$response->router->urlfor('doctorreg/finish', array('nocache'=>true)));
    		}
    		else
    		{
				MsgHtml::msg('注册失败, 请检查医院科室是否正确选择', $_SERVER['HTTP_REFERER']);
    		}
    	}
    	else
    	{
    		MsgHtml::msg('请选择医院科室');
    	}
    	exit;
    }
Esempio n. 13
0
 public function add($request, $response)
 {
     $doctorId = $request->doctorId;
     $hospitalFacultyId = $request->hospitalFacultyId;
     $params = $request->vars;
     $params['hospitalFacultyId'] = $hospitalFacultyId;
     $params['sex'] = $request->sex;
     $params['isVip'] = $request->isVip;
     $params['isExpert'] = $request->isExpert;
     $params['adminLevel'] = $request->adminLevel;
     $params['workStatus'] = $request->workStatus;
     $params['canOpenSpace'] = false == $request->canopenspace;
     if (empty($doctorId)) {
         $msg = '添加成功';
         $name = isset($params['name']) ? $params['name'] : '';
         $doctorId = DoctorClient::getInstance()->addDoctor($hospitalFacultyId, $name, $params);
     } else {
         if (isset($params['adminLevel'])) {
             $doctor = DAL::get()->find('doctor', $doctorId);
             $specialPrivilegeHelper = new SpecialPrivilegeHelper($this->inspector);
             DBC::requireTrue($specialPrivilegeHelper->isAllowed($doctor), '没有权限修改医生级别');
         }
         $msg = '修改成功';
         $doctorId = DoctorClient::getInstance()->modifyDoctor($doctorId, $params);
     }
     $doctor = DAL::get()->find('doctor', $doctorId, true);
     if ($doctor->isNull() == false) {
         Squid::clean($doctor->getUrl());
         try {
             if ($params['grade'] != $doctor->grade) {
                 throw new Exception();
             }
         } catch (Exception $e) {
             $msg = "<span style='color:red;'>医生职称“" . $params['grade'] . "”保存失败。</span>";
             file_put_contents('/tmp/modifyDoctor_' . XDateTime::now()->toStringByFormat("Y_m_d") . '.log', XDateTime::now()->toStringByFormat() . '=================' . chr(13) . chr(10) . var_export($e, true), FILE_APPEND);
         }
     }
     $response->setRedirect('/doctor/detail?id=' . $doctorId . '&msg=' . urlencode($msg));
 }