Compare commits

...

2 Commits

Author SHA1 Message Date
wzz f11c42defc 处理冲突 8 months ago
wzz e114c2bd87 合并new 8 months ago
  1. 8
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java
  2. 1
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java
  3. 1
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java
  4. 422
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java
  5. 2
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java
  6. 4
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java
  7. 1
      acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java
  8. 24
      acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java
  9. 5
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java
  10. 2
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java

8
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java

@ -2,10 +2,10 @@ package com.acupuncture.web.controller.web;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.annotation.Log; import com.acupuncture.common.annotation.Log;
import com.acupuncture.common.core.domain.AjaxResult;
import com.acupuncture.common.core.domain.BaseDto; import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.core.domain.entity.SysUser; import com.acupuncture.common.core.domain.entity.SysUser;
@ -89,6 +89,7 @@ public class AdminDmsUserController {
} else if (StringUtils.isNotEmpty(dto.getPhonenumber()) && !dmsLoginService.checkPhoneUnique(dto)) { } else if (StringUtils.isNotEmpty(dto.getPhonenumber()) && !dmsLoginService.checkPhoneUnique(dto)) {
return JsonResponse.ok().fail("新增用户'" + dto.getUserName() + "'失败,手机号码已存在"); return JsonResponse.ok().fail("新增用户'" + dto.getUserName() + "'失败,手机号码已存在");
} }
dto.setId(IdUtil.getSnowflakeNextId());
dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword()));
adminTenantUserService.insert(dto); adminTenantUserService.insert(dto);
@ -104,6 +105,7 @@ public class AdminDmsUserController {
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return JsonResponse.ok().fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return JsonResponse.ok().fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setUserId(dto.getId());
user.setTenantId(dto.getTenantId()); user.setTenantId(dto.getTenantId());
user.setCreateBy(SecurityUtils.getUsername()); user.setCreateBy(SecurityUtils.getUsername());
user.setPhonenumber(dto.getContactPhone()); user.setPhonenumber(dto.getContactPhone());
@ -196,8 +198,4 @@ public class AdminDmsUserController {
//只修改主库密码,修改从库密码没有任何意义。 //只修改主库密码,修改从库密码没有任何意义。
return JsonResponse.ok(adminTenantUserService.resetPwd(dto)); return JsonResponse.ok(adminTenantUserService.resetPwd(dto));
} }
private static void removeDataSource() {
DynamicDataSourceContextHolder.clearDataSourceType();
}
} }

1
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java

@ -75,7 +75,6 @@ public class AdminPmsTreatmentController {
// } // }
// //
// @ApiOperation("导出诊疗档案评估报告") // @ApiOperation("导出诊疗档案评估报告")
// @PostMapping("/exportTreatmentPg") // @PostMapping("/exportTreatmentPg")
// public JsonResponse<String> exportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){ // public JsonResponse<String> exportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){

1
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java

@ -87,7 +87,6 @@ public class ScreeningController {
return JsonResponse.ok(detailInfo); return JsonResponse.ok(detailInfo);
} }
@ApiOperation(value = "提交筛查", notes = "") @ApiOperation(value = "提交筛查", notes = "")
@RequestMapping(value = "/submit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @RequestMapping(value = "/submit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse submitQuestionnaire(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.SubmitScreeningQuestionnaire> params) throws Exception { public JsonResponse submitQuestionnaire(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.SubmitScreeningQuestionnaire> params) throws Exception {

422
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java

@ -1,211 +1,211 @@
package com.acupuncture.web.controller.web; //package com.acupuncture.web.controller.web;
//
import cn.hutool.core.bean.BeanUtil; //import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; //import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; //import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; //import cn.hutool.core.util.IdUtil;
import com.acupuncture.common.annotation.Anonymous; //import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; //import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
import com.acupuncture.system.domain.po.FmsFollowupTask; //import com.acupuncture.system.domain.po.FmsFollowupTask;
import com.acupuncture.system.domain.po.FmsPatientQueueRelation; //import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
import com.acupuncture.system.domain.vo.FmsFollowupVo; //import com.acupuncture.system.domain.vo.FmsFollowupVo;
import com.acupuncture.system.domain.vo.UmsDataSourceVo; //import com.acupuncture.system.domain.vo.UmsDataSourceVo;
import com.acupuncture.system.persist.dao.FmsFollowupDao; //import com.acupuncture.system.persist.dao.FmsFollowupDao;
import com.acupuncture.system.persist.dao.UmsDataSourceDao; //import com.acupuncture.system.persist.dao.UmsDataSourceDao;
import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper; //import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper; //import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
import io.swagger.annotations.Api; //import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; //import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.quartz.TriggerUtils; //import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl; //import org.quartz.impl.triggers.CronTriggerImpl;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Propagation; //import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; //import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; //import org.springframework.web.bind.annotation.RestController;
//
import javax.annotation.Resource; //import javax.annotation.Resource;
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.Calendar; //import java.util.Calendar;
import java.util.Date; //import java.util.Date;
import java.util.List; //import java.util.List;
//
/** ///**
* @Author zzc // * @Author zzc
* @Package com.acupuncture.web.controller.web // * @Package com.acupuncture.web.controller.web
* @Date 2025/2/13 8:50 // * @Date 2025/2/13 8:50
* @description: // * @description:
*/ // */
@Slf4j //@Slf4j
@Api(tags = "定时任务相关") //@Api(tags = "定时任务相关")
@RestController //@RestController
@RequestMapping("/task") //@RequestMapping("/task")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) //@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class TaskController { //public class TaskController {
//
@Resource // @Resource
private FmsFollowupDao fmsFollowupDao; // private FmsFollowupDao fmsFollowupDao;
@Resource // @Resource
private FmsFollowupTaskMapper fmsFollowupTaskMapper; // private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Resource // @Resource
private UmsDataSourceDao umsDataSourceDao; // private UmsDataSourceDao umsDataSourceDao;
@Resource // @Resource
private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper; // private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
//
@ApiOperation("定时任务添加随访工单") // @ApiOperation("定时任务添加随访工单")
@PostMapping("/task") // @PostMapping("/task")
// @Scheduled(fixedRate = 10000) //// @Scheduled(fixedRate = 10000)
@Anonymous // @Anonymous
public void task() { // public void task() {
// TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 ) // // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )
//
//查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单 // //查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
// UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result(); //// UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result();
// result1.setDataSourceKey("MASTER"); //// result1.setDataSourceKey("MASTER");
// changeDataSource(result1); //// changeDataSource(result1);
List<UmsDataSourceVo.Result> query = umsDataSourceDao.query(null); // List<UmsDataSourceVo.Result> query = umsDataSourceDao.query(null);
if (CollectionUtil.isEmpty(query)) { // if (CollectionUtil.isEmpty(query)) {
return; // return;
} // }
//查询公共队列 // //查询公共队列
List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null); // List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null);
//切换数据源 // //切换数据源
for (UmsDataSourceVo.Result result : query) { // for (UmsDataSourceVo.Result result : query) {
if ("MASTER".equals(result.getDataSourceKey())) { // if ("MASTER".equals(result.getDataSourceKey())) {
continue; // continue;
} // }
changeDataSource(result); // changeDataSource(result);
{ // {
//获取随访患者列表,根据患者出院日时间和队列添加工单 // //获取随访患者列表,根据患者出院日时间和队列添加工单
//1. 查询队列 // //1. 查询队列
List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null, result.getTenantId()); // List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null, result.getTenantId());
//
if (CollectionUtil.isEmpty(queueList)) { // if (CollectionUtil.isEmpty(queueList)) {
queueList = queueResults; // queueList = queueResults;
} else { // } else {
queueList.addAll(queueResults); // queueList.addAll(queueResults);
} // }
for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) { // for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) {
//2. 查询队列随访患者列表 // //2. 查询队列随访患者列表
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), (byte) 0, null, followupQueueVO.getTenantId()); // List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), (byte) 0, null, followupQueueVO.getTenantId());
if (CollectionUtil.isEmpty(patientList)) { // if (CollectionUtil.isEmpty(patientList)) {
continue; // continue;
} // }
//随访总月数 // //随访总月数
Integer followupMonth = followupQueueVO.getFollowupMonth(); // Integer followupMonth = followupQueueVO.getFollowupMonth();
for (FmsFollowupVo.FollowupPatient followupPatient : patientList) { // for (FmsFollowupVo.FollowupPatient followupPatient : patientList) {
//获取随访到期时间 出院时间+随访总月数 = 到期时间 // //获取随访到期时间 出院时间+随访总月数 = 到期时间
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.setTime(followupPatient.getDischargeTime()); // calendar.setTime(followupPatient.getDischargeTime());
calendar.set(Calendar.MONTH, followupMonth); // calendar.set(Calendar.MONTH, followupMonth);
Date time = calendar.getTime(); // Date time = calendar.getTime();
//
//获取队列信息 // //获取队列信息
String frequency = followupQueueVO.getFrequency(); // String frequency = followupQueueVO.getFrequency();
List<Date> dateList = new ArrayList<>(); // List<Date> dateList = new ArrayList<>();
try { // try {
CronTriggerImpl cronTrigger = new CronTriggerImpl(); // CronTriggerImpl cronTrigger = new CronTriggerImpl();
cronTrigger.setCronExpression(frequency); // cronTrigger.setCronExpression(frequency);
//TriggerUtils.computeFireTimesBetween(要计算触发时间的触发器对象, 用于计算触发时间的日历对象, 计算触发时间的起始时间点, 计算触发时间的结束时间点); // //TriggerUtils.computeFireTimesBetween(要计算触发时间的触发器对象, 用于计算触发时间的日历对象, 计算触发时间的起始时间点, 计算触发时间的结束时间点);
dateList = TriggerUtils.computeFireTimesBetween(cronTrigger, null, followupPatient.getDischargeTime(), time); // dateList = TriggerUtils.computeFireTimesBetween(cronTrigger, null, followupPatient.getDischargeTime(), time);
if (CollectionUtil.isEmpty(dateList)) { // if (CollectionUtil.isEmpty(dateList)) {
continue; // continue;
} // }
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
//3. 判断随访类型 // //3. 判断随访类型
if (followupQueueVO.getFollowupType() == 0) { // if (followupQueueVO.getFollowupType() == 0) {
//单次 // //单次
FmsFollowupTask fmsFollowupTask = new FmsFollowupTask(); // FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask); // BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId()); // fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setName(followupPatient.getName()); // fmsFollowupTask.setName(followupPatient.getName());
fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull()); // fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple()); // fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
fmsFollowupTask.setGender(followupPatient.getGender()); // fmsFollowupTask.setGender(followupPatient.getGender());
if (followupPatient.getBirthDate() != null) { // if (followupPatient.getBirthDate() != null) {
fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date())); // fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
} // }
fmsFollowupTask.setEthnicity(followupPatient.getEthnicity()); // fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears()); // fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setPhone(followupPatient.getPhone()); // fmsFollowupTask.setPhone(followupPatient.getPhone());
fmsFollowupTask.setTenantId(followupPatient.getTenantId()); // fmsFollowupTask.setTenantId(followupPatient.getTenantId());
fmsFollowupTask.setIdCardType(followupPatient.getIdCardType()); // fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
fmsFollowupTask.setIdCard(followupPatient.getIdCard()); // fmsFollowupTask.setIdCard(followupPatient.getIdCard());
fmsFollowupTask.setTimes(1); // fmsFollowupTask.setTimes(1);
fmsFollowupTask.setQueueId(followupQueueVO.getId()); // fmsFollowupTask.setQueueId(followupQueueVO.getId());
fmsFollowupTask.setPatientId(followupPatient.getId()); // fmsFollowupTask.setPatientId(followupPatient.getId());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears()); // fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setDelFlag((byte) 0); // fmsFollowupTask.setDelFlag((byte) 0);
fmsFollowupTask.setCreateTime(new Date()); // fmsFollowupTask.setCreateTime(new Date());
fmsFollowupTask.setStatus((byte) 0); // fmsFollowupTask.setStatus((byte) 0);
fmsFollowupTask.setStartTime(dateList.get(0)); // fmsFollowupTask.setStartTime(dateList.get(0));
fmsFollowupTask.setEndTime(dateList.get(0)); // fmsFollowupTask.setEndTime(dateList.get(0));
fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge()); // fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
fmsFollowupTask.setFollowupTime(dateList.get(0)); // fmsFollowupTask.setFollowupTime(dateList.get(0));
changeDataSource(result); // changeDataSource(result);
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask); // fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
//
} else { // } else {
//周期 // //周期
//4. 根据频次和总月数添加 // //4. 根据频次和总月数添加
int i = 0; // int i = 0;
for (Date date : dateList) { // for (Date date : dateList) {
i+=1; // i+=1;
//单次 // //单次
FmsFollowupTask fmsFollowupTask = new FmsFollowupTask(); // FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask); // BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId()); // fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setName(followupPatient.getName()); // fmsFollowupTask.setName(followupPatient.getName());
fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull()); // fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple()); // fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
fmsFollowupTask.setGender(followupPatient.getGender()); // fmsFollowupTask.setGender(followupPatient.getGender());
if (followupPatient.getBirthDate() != null) { // if (followupPatient.getBirthDate() != null) {
fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date())); // fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
} // }
fmsFollowupTask.setEthnicity(followupPatient.getEthnicity()); // fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears()); // fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setTimes(i); // fmsFollowupTask.setTimes(i);
fmsFollowupTask.setPhone(followupPatient.getPhone()); // fmsFollowupTask.setPhone(followupPatient.getPhone());
fmsFollowupTask.setTenantId(followupPatient.getTenantId()); // fmsFollowupTask.setTenantId(followupPatient.getTenantId());
fmsFollowupTask.setIdCardType(followupPatient.getIdCardType()); // fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
fmsFollowupTask.setIdCard(followupPatient.getIdCard()); // fmsFollowupTask.setIdCard(followupPatient.getIdCard());
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId()); // fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setQueueId(followupQueueVO.getId()); // fmsFollowupTask.setQueueId(followupQueueVO.getId());
fmsFollowupTask.setDelFlag((byte) 0); // fmsFollowupTask.setDelFlag((byte) 0);
fmsFollowupTask.setCreateTime(new Date()); // fmsFollowupTask.setCreateTime(new Date());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears()); // fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setStatus((byte) 0); // fmsFollowupTask.setStatus((byte) 0);
fmsFollowupTask.setStartTime(date); // fmsFollowupTask.setStartTime(date);
fmsFollowupTask.setEndTime(date); // fmsFollowupTask.setEndTime(date);
fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge()); // fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
fmsFollowupTask.setFollowupTime(date); // fmsFollowupTask.setFollowupTime(date);
changeDataSource(result); // changeDataSource(result);
fmsFollowupTask.setPatientId(followupPatient.getId()); // fmsFollowupTask.setPatientId(followupPatient.getId());
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask); // fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
} // }
} // }
changeDataSource(result); // changeDataSource(result);
//将患者设置为已生成工单 // //将患者设置为已生成工单
FmsPatientQueueRelation fmsPatientQueueRelation = BeanUtil.copyProperties(followupPatient, FmsPatientQueueRelation.class); // FmsPatientQueueRelation fmsPatientQueueRelation = BeanUtil.copyProperties(followupPatient, FmsPatientQueueRelation.class);
fmsPatientQueueRelation.setTaskFlag((byte) 1); // fmsPatientQueueRelation.setTaskFlag((byte) 1);
fmsPatientQueueRelation.setPatientId(followupPatient.getId()); // fmsPatientQueueRelation.setPatientId(followupPatient.getId());
fmsPatientQueueRelationMapper.updateByPrimaryKeySelective(fmsPatientQueueRelation); // fmsPatientQueueRelationMapper.updateByPrimaryKeySelective(fmsPatientQueueRelation);
} // }
} // }
//
} // }
} // }
} // }
//
private static void changeDataSource(UmsDataSourceVo.Result result) { // private static void changeDataSource(UmsDataSourceVo.Result result) {
try { // try {
DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey()); // DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
}finally { // }finally {
DynamicDataSourceContextHolder.clearDataSourceType(); // DynamicDataSourceContextHolder.clearDataSourceType();
} // }
} // }
} //}

2
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java

@ -1,7 +1,5 @@
package com.acupuncture.web.controller.web; package com.acupuncture.web.controller.web;
import cn.hutool.core.bean.BeanUtil;
import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.common.core.domain.BaseDto; import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.system.domain.dto.AmsWxQrCodeDto; import com.acupuncture.system.domain.dto.AmsWxQrCodeDto;

4
acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java

@ -293,10 +293,6 @@ public class TaskController {
} }
private static void changeDataSource(UmsDataSourceVo.Result result) {
DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
}
/** /**
* 法用于计算在指定时间范围内触发器的触发时间点具体步骤如下 * 法用于计算在指定时间范围内触发器的触发时间点具体步骤如下
* 初始化一个空列表 lst 存储触发时间点 * 初始化一个空列表 lst 存储触发时间点

1
acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java

@ -100,6 +100,7 @@ public class SysUser extends BaseEntity
@ApiModelProperty("是否具有审核权限(0不具有; 1具有)") @ApiModelProperty("是否具有审核权限(0不具有; 1具有)")
private Byte slaverAdmin; private Byte slaverAdmin;
public SysUser() public SysUser()
{ {

24
acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java

@ -37,8 +37,6 @@ import javax.servlet.http.HttpServletRequest;
public class AdminGlobalDataSourceAspect { public class AdminGlobalDataSourceAspect {
protected Logger logger = LoggerFactory.getLogger(getClass()); protected Logger logger = LoggerFactory.getLogger(getClass());
// @Autowired
// private UmsDataSourceMapper umsDataSourceMapper;
@Resource @Resource
private DmsLoginService dmsLoginService; private DmsLoginService dmsLoginService;
@ -51,10 +49,16 @@ public class AdminGlobalDataSourceAspect {
@Around("dsPointCut()") @Around("dsPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable { public Object around(ProceedingJoinPoint point) throws Throwable {
//获取datasource
try {
String dataSourceKey = getDataSource(point); String dataSourceKey = getDataSource(point);
if (StringUtils.isNotEmpty(dataSourceKey)) {
if (StringUtils.isNotNull(dataSourceKey)) {
DataSourceManager.setDataSourceKey(dataSourceKey); DataSourceManager.setDataSourceKey(dataSourceKey);
} else {
DataSourceManager.setDataSourceKey(null);
}
}catch (Exception e){
throw new BaseException(StrUtil.format("获取数据源错误:{}", e));
} }
try { try {
@ -72,25 +76,23 @@ public class AdminGlobalDataSourceAspect {
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
Long tenantId; Long tenantId = null;
String header = request.getHeader(UserConstants.DEPT); String header = request.getHeader(UserConstants.DEPT);
if(StrUtil.isNotEmpty(header)){ if(StrUtil.isNotEmpty(header)){
tenantId = Long.parseLong(header); tenantId = Long.parseLong(header);
}else { }else {
String authHeader = request.getHeader(UserConstants.HEADER_KEY_TOKEN); if (StrUtil.isNotEmpty(request.getHeader(UserConstants.HEADER_KEY_TOKEN))) {
if (StrUtil.isEmpty(authHeader)) {
return null;
}
tenantId = SecurityUtils.getTenantId(); tenantId = SecurityUtils.getTenantId();
if (tenantId == null) {
return null;
} }
} }
//根据组织ID查询数据源 //根据组织ID查询数据源
if(tenantId !=null) {
UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId); UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId);
if (dataSource == null) { if (dataSource == null) {
throw new BaseException(DATASOURCE_NOT_FOUND); throw new BaseException(DATASOURCE_NOT_FOUND);
} }
return dataSource.getDataSourceKey(); return dataSource.getDataSourceKey();
} }
return null;
}
} }

5
acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java

@ -64,11 +64,16 @@ public class AdminTenantUserDto {
private String status; private String status;
private String contactPhone; private String contactPhone;
@ApiModelProperty("是否具有审核权限(0不具有; 1具有)") @ApiModelProperty("是否具有审核权限(0不具有; 1具有)")
private Byte slaverAdmin; private Byte slaverAdmin;
} }
@Data @Data
public static class DeleteDto {
private List<Long> idList;
}
@Data @Data
public static class Query { public static class Query {
private Long tenantId; private Long tenantId;

2
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java

@ -35,7 +35,7 @@ public class AdminTenantUserServiceImpl implements AdminTenantUserService {
@Override @Override
public int insert(AdminTenantUserDto.AddDto dto) { public int insert(AdminTenantUserDto.AddDto dto) {
DmsUser dmsUser = BeanUtil.copyProperties(dto, DmsUser.class); DmsUser dmsUser = BeanUtil.copyProperties(dto, DmsUser.class);
dmsUser.setId(IdUtil.getSnowflakeNextId()); dmsUser.setId(dto.getId());
dmsUser.setCreateBy(SecurityUtils.getUsername()); dmsUser.setCreateBy(SecurityUtils.getUsername());
dmsUser.setCreateTime(new Date()); dmsUser.setCreateTime(new Date());
return dmsUserMapper.insertSelective(dmsUser); return dmsUserMapper.insertSelective(dmsUser);

Loading…
Cancel
Save