Browse Source

合并new

new-ays
wzz 3 months ago
parent
commit
e114c2bd87
  1. 15
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java
  2. 6
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDataSourceController.java
  3. 85
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java
  4. 28
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java
  5. 6
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminTenantsController.java
  6. 91
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/DmsLoginController.java
  7. 10
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java
  8. 15
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java
  9. 17
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java
  10. 422
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java
  11. 2
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java
  12. 394
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java
  13. 42
      acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java
  14. 1
      acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/UserDetailsServiceImpl.java
  15. 2
      acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java
  16. 20
      acupuncture-generator/src/main/resources/mbg.xml
  17. 25
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java
  18. 17
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsUser.java
  19. 80
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsUserExample.java
  20. 2
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantUserVo.java
  21. 5
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/DmsLoginUserVo.java
  22. 2
      acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java
  23. 7
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java
  24. 4
      acupuncture-system/src/main/java/com/acupuncture/system/persist/mapper/DmsUserMapper.java
  25. 1
      acupuncture-system/src/main/java/com/acupuncture/system/service/AdminTenantUserService.java
  26. 9
      acupuncture-system/src/main/java/com/acupuncture/system/service/DmsLoginService.java
  27. 1
      acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupQueueService.java
  28. 10
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java
  29. 28
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/DmsLoginServiceImpl.java
  30. 1
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java
  31. 3
      acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml
  32. 18
      acupuncture-system/src/main/resources/mapper/dao/DmsUserDao.xml
  33. 57
      acupuncture-system/src/main/resources/mapper/system/DmsUserMapper.xml
  34. 6
      acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml

15
acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java

@ -165,7 +165,6 @@ public class SysUserController extends BaseController
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user)
{
// changeDataSource(user.getTenantId());
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
deptService.checkDeptDataScope(user.getDeptId());
@ -186,20 +185,6 @@ public class SysUserController extends BaseController
return toAjax(userService.updateUser(user));
}
private void changeDataSource(Long tenantId) {
DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(tenantId);
if (dmsTenant != null) {
UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId());
if (umsDataSource != null) {
try {
DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey());
}finally {
DynamicDataSourceContextHolder.clearDataSourceType();
}
}
}
}
/**
* 删除用户
*/

6
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDataSourceController.java

@ -1,7 +1,9 @@
package com.acupuncture.web.controller.web;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.common.utils.SecurityUtils;
import com.acupuncture.system.domain.dto.AdminDataSourceDto;
import com.acupuncture.system.domain.vo.AdminDataSourceVo;
@ -34,6 +36,7 @@ public class AdminDataSourceController {
@ApiOperation("添加数据源")
@PostMapping("/add")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> insert(@RequestBody @Validated AdminDataSourceDto.AddDto dto) {
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
return JsonResponse.ok().fail("无权限");
@ -43,6 +46,7 @@ public class AdminDataSourceController {
@ApiOperation("修改数据源")
@PostMapping("/upd")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> update(@RequestBody @Validated AdminDataSourceDto.UpdDto dto) {
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
return JsonResponse.ok().fail("无权限");
@ -52,6 +56,7 @@ public class AdminDataSourceController {
@ApiOperation("删除数据源")
@PostMapping("/del")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> delete(@RequestBody @Validated AdminDataSourceDto.DeleteDto dto) {
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
return JsonResponse.ok().fail("无权限");
@ -61,6 +66,7 @@ public class AdminDataSourceController {
@ApiOperation("查询数据源")
@PostMapping("/list")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<AdminDataSourceVo.Result>> query(@RequestBody @Validated BaseDto<AdminDataSourceDto.Query> dto) {
return JsonResponse.ok(new PageInfo<>(adminDataSourceService.query(dto.getParam())));
}

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

@ -2,10 +2,15 @@ package com.acupuncture.web.controller.web;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.annotation.Log;
import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.core.domain.entity.SysUser;
import com.acupuncture.common.enums.BusinessType;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.common.utils.SecurityUtils;
import com.acupuncture.common.utils.StringUtils;
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
@ -30,11 +35,9 @@ import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@ -68,6 +71,7 @@ public class AdminDmsUserController {
@ApiOperation("添加租户用户")
@PostMapping("/add")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> insert(@RequestBody @Validated AdminTenantUserDto.AddDto dto) {
//判定租户及数据源是否存在
DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(dto.getTenantId());
@ -85,11 +89,12 @@ public class AdminDmsUserController {
} else if (StringUtils.isNotEmpty(dto.getPhonenumber()) && !dmsLoginService.checkPhoneUnique(dto)) {
return JsonResponse.ok().fail("新增用户'" + dto.getUserName() + "'失败,手机号码已存在");
}
dto.setId(IdUtil.getSnowflakeNextId());
dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword()));
adminTenantUserService.insert(dto);
//切换至从库
changeDataSource(umsDataSource.getDataSourceKey());
DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey());
//新增从库数据
SysUser user = BeanUtil.copyProperties(dto, SysUser.class);
@ -100,6 +105,7 @@ public class AdminDmsUserController {
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return JsonResponse.ok().fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUserId(dto.getId());
user.setTenantId(dto.getTenantId());
user.setCreateBy(SecurityUtils.getUsername());
user.setPhonenumber(dto.getContactPhone());
@ -107,49 +113,46 @@ public class AdminDmsUserController {
int insert = userService.insertUser(user);
//销毁切换数据源
removeDataSource();
DynamicDataSourceContextHolder.clearDataSourceType();
return JsonResponse.ok(insert);
}
@ApiOperation("修改租户用户")
@PostMapping("/upd")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> update(@RequestBody @Validated AdminTenantUserDto.UpdDto dto) {
updSysUser(dto);
return JsonResponse.ok(adminTenantUserService.update(dto));
//判定租户及数据源是否存在
DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(dto.getTenantId());
if (dmsTenant == null) {
return JsonResponse.ok().fail("租户不存在");
}
UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId());
if (umsDataSource == null || StrUtil.isEmpty(umsDataSource.getDataSourceKey())) {
return JsonResponse.ok().fail("数据源不存在");
}
private void updSysUser(AdminTenantUserDto.UpdDto dto) {
//查询租户数据源,删除分库数据
DmsUserExample dmsUserExample = new DmsUserExample();
dmsUserExample.createCriteria().andDelFlagEqualTo((byte) 0).andIdEqualTo(dto.getId());
List<DmsUser> dmsUsers = dmsUserMapper.selectByExample(dmsUserExample);
if (CollectionUtil.isNotEmpty(dmsUsers)) {
DmsUser dmsUser = dmsUsers.get(0);
AdminTenantsDto.Query query = new AdminTenantsDto.Query();
query.setId(dmsUser.getTenantId());
List<AdminTenantsVo.Result> tenantList = adminTenantsService.query(query);
if (CollectionUtil.isNotEmpty(tenantList)) {
for (AdminTenantsVo.Result result : tenantList) {
//切换数据源 删除分库数据
changeDataSource(result.getDataSourceKey());
//修改分库用户
//修改主库租户用户
int rows = adminTenantUserService.update(dto);
//切换至从库
DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey());
//修改从库用户信息
SysUser sysUser = BeanUtil.copyProperties(dto, SysUser.class);
sysUser.setPhonenumber(dto.getContactPhone());
userService.updateUser(sysUser);
}
}
}
//销毁切换数据源
DynamicDataSourceContextHolder.clearDataSourceType();
return JsonResponse.ok(rows);
}
@ApiOperation("删除租户用户")
@PostMapping("/del")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> delete(@RequestBody @Validated AdminTenantUserDto.DeleteDto dto) {
delSysUser(dto);
return JsonResponse.ok(adminTenantUserService.delete(dto));
}
private void delSysUser(AdminTenantUserDto.DeleteDto dto) {
//查询租户数据源,删除分库数据
DmsUserExample dmsUserExample = new DmsUserExample();
dmsUserExample.createCriteria().andDelFlagEqualTo((byte) 0).andIdIn(dto.getIdList());
@ -162,17 +165,21 @@ public class AdminDmsUserController {
if (CollectionUtil.isNotEmpty(tenantList)) {
for (AdminTenantsVo.Result result : tenantList) {
//切换数据源 删除分库数据
changeDataSource(result.getDataSourceKey());
DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
//删除分库用户
userService.deleteUserByUsername(dmsUser.getUserName());
//销毁切换数据源
DynamicDataSourceContextHolder.clearDataSourceType();
}
}
}
}
return JsonResponse.ok(adminTenantUserService.delete(dto));
}
@ApiOperation("查询租户用户")
@PostMapping("/list")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<AdminTenantUserVo.Result>> query(@RequestBody @Validated BaseDto<AdminTenantUserDto.Query> dto) {
if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
@ -180,11 +187,15 @@ public class AdminDmsUserController {
return JsonResponse.ok(new PageInfo<>(adminTenantUserService.query(dto.getParam())));
}
private static void changeDataSource(String key) {
DynamicDataSourceContextHolder.setDataSourceType(key);
}
private static void removeDataSource() {
DynamicDataSourceContextHolder.clearDataSourceType();
/**
* 重置密码
*/
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> resetPwd(@RequestBody @Validated AdminTenantUserDto.ResetPwd dto) {
//只修改主库密码,修改从库密码没有任何意义。
return JsonResponse.ok(adminTenantUserService.resetPwd(dto));
}
}

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

@ -67,27 +67,13 @@ public class AdminPmsTreatmentController {
treatmentService.adminExportTreatment(response, dto);
}
@ApiOperation("修改诊疗档案")
@PostMapping("/upd")
public JsonResponse<Integer> updateTreatment(@RequestBody @Validated PmsTreatmentDto.TreatmentUpdateDTO dto) {
DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(dto.getTenantId());
if (dmsTenant != null) {
UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId());
if (umsDataSource != null) {
changeDataSource(umsDataSource.getDataSourceKey());
}
}
treatmentService.updateTreatment(dto);
return JsonResponse.ok();
}
private static void changeDataSource(String dataSourceKey) {
try {
DynamicDataSourceContextHolder.setDataSourceType(dataSourceKey);
}finally {
DynamicDataSourceContextHolder.clearDataSourceType();
}
}
// @ApiOperation("修改诊疗档案")
// @PostMapping("/upd")
// public JsonResponse<Integer> updateTreatment(@RequestBody @Validated PmsTreatmentDto.TreatmentUpdateDTO dto) {
// treatmentService.updateTreatment(dto);
// return JsonResponse.ok();
// }
//
// @ApiOperation("导出诊疗档案评估报告")
// @PostMapping("/exportTreatmentPg")

6
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminTenantsController.java

@ -1,7 +1,9 @@
package com.acupuncture.web.controller.web;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.common.utils.SecurityUtils;
import com.acupuncture.system.domain.dto.AdminTenantsDto;
import com.acupuncture.system.domain.vo.AdminTenantsVo;
@ -37,6 +39,7 @@ public class AdminTenantsController {
@ApiOperation("添加租户")
@PostMapping("/add")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> insert(@RequestBody @Validated AdminTenantsDto.AddDto dto) {
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
return JsonResponse.ok().fail("无权限");
@ -46,6 +49,7 @@ public class AdminTenantsController {
@ApiOperation("修改租户")
@PostMapping("/upd")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> update(@RequestBody @Validated AdminTenantsDto.UpdDto dto) {
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
return JsonResponse.ok().fail("无权限");
@ -55,6 +59,7 @@ public class AdminTenantsController {
@ApiOperation("删除租户")
@PostMapping("/del")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> delete(@RequestBody @Validated AdminTenantsDto.DeleteDto dto) {
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
return JsonResponse.ok().fail("无权限");
@ -64,6 +69,7 @@ public class AdminTenantsController {
@ApiOperation("查询租户")
@PostMapping("/list")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<AdminTenantsVo.Result>> query(@RequestBody @Validated BaseDto<AdminTenantsDto.Query> dto) {
if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());

91
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/DmsLoginController.java

@ -1,28 +1,40 @@
package com.acupuncture.web.controller.web;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.annotation.Log;
import com.acupuncture.common.constant.Constants;
import com.acupuncture.common.core.domain.AjaxResult;
import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.core.domain.entity.SysUser;
import com.acupuncture.common.core.domain.model.LoginBody;
import com.acupuncture.common.core.domain.model.LoginUser;
import com.acupuncture.common.enums.BusinessType;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.common.utils.SecurityUtils;
import com.acupuncture.framework.web.service.SysPermissionService;
import com.acupuncture.framework.web.service.TokenService;
import com.acupuncture.framework.web.service.WebDmsLoginService;
import com.acupuncture.system.domain.dto.FmsFollowupDto;
import com.acupuncture.system.domain.po.DmsTenant;
import com.acupuncture.system.domain.vo.DmsLoginUserVo;
import com.acupuncture.system.domain.vo.FmsFollowupVo;
import com.acupuncture.system.service.DmsLoginService;
import com.acupuncture.system.service.FmsFollowupQueueService;
import com.acupuncture.system.service.FmsFollowupService;
import com.acupuncture.system.service.ISysUserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
import java.util.Set;
/**
@ -45,6 +57,8 @@ public class DmsLoginController {
private DmsLoginService dmsLoginService;
@Resource
private ISysUserService sysUserService;
@Resource
private FmsFollowupQueueService fmsFollowupQueueService;
/**
* 登录方法
@ -53,6 +67,7 @@ public class DmsLoginController {
* @return 结果
*/
@PostMapping("/login")
@DataSource(DataSourceType.MASTER)
public AjaxResult login(@RequestBody LoginBody loginBody) {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
@ -63,33 +78,81 @@ public class DmsLoginController {
}
/**
* 获取用户信息
*
* 重置密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
@DataSource(DataSourceType.MASTER)
public AjaxResult updatePwd(@RequestBody Map<String, String> params)
{
String oldPassword = params.get("oldPassword");
String newPassword = params.get("newPassword");
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
String userName = loginUser.getUsername();
String password = loginUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password))
{
return AjaxResult.error("修改密码失败,旧密码错误");
}
if (SecurityUtils.matchesPassword(newPassword, password))
{
return AjaxResult.error("新密码不能与旧密码相同");
}
newPassword = SecurityUtils.encryptPassword(newPassword);
if (dmsLoginService.resetPwd(userId, userName, newPassword) > 0)
{
// 更新缓存用户密码
loginUser.getUser().setPassword(newPassword);
tokenService.setLoginUser(loginUser);
return AjaxResult.success("操作成功");
}
return AjaxResult.error("修改密码异常,请联系管理员");
}
@ApiOperation("查询公共队列")
@PostMapping("/commonQueue")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<FmsFollowupVo.FollowupQueueVO>> queryCommonQueue(@RequestBody @Validated BaseDto<FmsFollowupDto.QueueQuery> dto) {
if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
}
return JsonResponse.ok(new PageInfo<>(fmsFollowupQueueService.queryCommonQueue(dto.getParam().getName())));
}
/**
* 获取用户信息暂时先从主库获取
* @return 用户信息
*/
@GetMapping("getInfo")
@ApiOperation("用户信息")
@GetMapping("/getInfo")
@DataSource(DataSourceType.MASTER)
public AjaxResult getInfo() {
LoginUser loginUser = SecurityUtils.getLoginUser();
//获取用户从库信息
SysUser user = sysUserService.selectUserByTenantId(loginUser.getTenantId(), loginUser.getUsername());
DmsLoginUserVo.DmsUserVo tenantUser = dmsLoginService.selectTenantUserById(loginUser.getUserId());
SysUser user = new SysUser();
user.setUserId(tenantUser.getId());
user.setUserName(tenantUser.getUserName());
user.setNickName(tenantUser.getNickName());
user.setTenantId(tenantUser.getTenantId());
user.setTenantName(tenantUser.getTenantName());
user.setTenantPhone(tenantUser.getTenantPhone());
user.setSlaverAdmin(tenantUser.getSlaverAdmin());
//刷新token
tokenService.refreshToken(loginUser);
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("tenantId", loginUser.getTenantId());
ajax.put("scoreId", loginUser.getScoreId());
return ajax;
}
@PutMapping("/resetPwd")
public JsonResponse<Integer> resetPwd(@RequestBody DmsLoginUserVo.DmsUserVo user) {
// webDmsLoginService.checkUserAllowed(user);
// webDmsLoginService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return JsonResponse.ok(dmsLoginService.resetPwd(user));
}
/**
* 筛查接口此接口已添加白名单所以不需要@annomous
* @param dto
* @return
*/
@PostMapping("/queryTenantById")
@DataSource(DataSourceType.MASTER)
public JsonResponse<DmsTenant> queryTenantById(@RequestBody DmsLoginUserVo.Query dto){
return JsonResponse.ok(dmsLoginService.queryById(dto.getId()));
}

10
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java

@ -80,21 +80,13 @@ public class ExternalController {
throw new BaseException("查询不到社区");
}
//切换数据源查询
changeDataSource(dataSourceList.get(0).getDataSourceKey());
DynamicDataSourceContextHolder.setDataSourceType(dataSourceList.get(0).getDataSourceKey());
}catch (Exception e) {
throw new BaseException("UUID错误:{}", from);
}
}
private static void changeDataSource(String key) {
try {
DynamicDataSourceContextHolder.setDataSourceType(key);
}finally {
DynamicDataSourceContextHolder.clearDataSourceType();
}
}
// @Anonymous
// @ApiOperation("上传数据")
// @PostMapping("/http/uploadMemberInfo")

15
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java

@ -4,8 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.common.utils.SecurityUtils;
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
import com.acupuncture.system.domain.dto.FmsFollowupDto;
@ -47,22 +49,9 @@ import java.util.List;
@RestController
@RequestMapping("/followup")
public class FmsFollowupController {
@Resource
private FmsFollowupQueueService fmsFollowupQueueService;
@Resource
private FmsFollowupService fmsFollowupService;
@ApiOperation("查询公共队列")
@PostMapping("/commonQueue")
@Anonymous
public JsonResponse<PageInfo<FmsFollowupVo.FollowupQueueVO>> queryCommonQueue(@RequestBody @Validated BaseDto<FmsFollowupDto.QueueQuery> dto) {
if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
}
return JsonResponse.ok(new PageInfo<>(fmsFollowupQueueService.queryCommonQueue(dto.getParam().getName())));
}
@ApiOperation("查询随访队列")
@PostMapping("/query")
public JsonResponse<PageInfo<FmsFollowupVo.FollowupQueueVO>> queryQueue(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupQueueQueryDTO> dto) {

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

@ -82,26 +82,11 @@ public class ScreeningController {
@RequestMapping(value = "/createNoToken", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<QuestionnaireVo.DetailInfo> createNoToken(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.CreateDetail> params) throws Exception {
log.info("创建筛查详情{}", params);
// changeDataSource(params.getParam().getTenantId());
QuestionnaireVo.DetailInfo detailInfo = screeningService.createDetail(params.getParam(), params.getParam().getUserId(), params.getParam().getTenantId());
log.info("创建筛查详情结束");
return JsonResponse.ok(detailInfo);
}
private void changeDataSource(Long tenantId) {
DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(tenantId);
if (dmsTenant != null) {
UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId());
if (umsDataSource != null) {
try {
DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey());
}finally {
DynamicDataSourceContextHolder.clearDataSourceType();
}
}
}
}
@ApiOperation(value = "提交筛查", notes = "")
@RequestMapping(value = "/submit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse submitQuestionnaire(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.SubmitScreeningQuestionnaire> params) throws Exception {
@ -115,7 +100,6 @@ public class ScreeningController {
@RequestMapping(value = "/submitNoToken", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse submitNoToken(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.SubmitScreeningQuestionnaire> params) throws Exception {
log.info("提交筛查开始{}", params);
// changeDataSource(params.getParam().getTenantId());
screeningService.submitQuestionnaire(params.getParam(), 0L);
return JsonResponse.ok();
}
@ -125,7 +109,6 @@ public class ScreeningController {
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse saveQuestionnaire(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.SaveQuestionnaire> params) throws Exception {
log.info("保存调查筛查开始{}", params);
// changeDataSource(params.getParam().getTenantId());
screeningService.saveQuestionnaire(params.getParam(), params.getParam().getUserId());
log.info("保存调查筛查结束");
return JsonResponse.ok();

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

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

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

@ -1,111 +1,111 @@
//package com.acupuncture.web.controller.web;
//
//import cn.hutool.core.bean.BeanUtil;
//import cn.hutool.core.collection.CollectionUtil;
//import cn.hutool.core.date.DateUtil;
//import cn.hutool.core.util.IdUtil;
//import com.acupuncture.common.annotation.Anonymous;
//import com.acupuncture.common.core.redis.RedisCache;
//import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
//import com.acupuncture.system.domain.dto.FmsFollowupDto;
//import com.acupuncture.system.domain.po.FmsFollowupTask;
//import com.acupuncture.system.domain.po.FmsFollowupTaskExample;
//import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
//import com.acupuncture.system.domain.vo.FmsFollowupVo;
//import com.acupuncture.system.domain.vo.UmsDataSourceVo;
//import com.acupuncture.system.persist.dao.FmsFollowupDao;
//import com.acupuncture.system.persist.dao.UmsDataSourceDao;
//import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
//import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
//import com.acupuncture.system.service.FmsFollowupQueueService;
//import com.acupuncture.system.service.FmsFollowupService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.Data;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.catalina.connector.Response;
//import org.quartz.TriggerUtils;
//import org.quartz.impl.triggers.CronTriggerImpl;
//import org.quartz.spi.OperableTrigger;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.transaction.annotation.Propagation;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.*;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;
//
///**
// * @Author zzc
// * @Package com.acupuncture.web.controller.web
// * @Date 2025/2/13 8:50
// * @description:
// */
//@Slf4j
//@Api(tags = "定时任务相关")
//@RestController
//@RequestMapping("/task")
//@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//public class TaskController {
//
// @Resource
// private FmsFollowupDao fmsFollowupDao;
// @Resource
// private FmsFollowupService fmsFollowupService;
// @Resource
// private FmsFollowupTaskMapper fmsFollowupTaskMapper;
// @Resource
// private UmsDataSourceDao umsDataSourceDao;
// @Resource
// private RedisCache redisCache;
// @Resource
// private FmsFollowupQueueService fmsFollowupQueueService;
//
// @ApiOperation("定时任务添加随访工单")
// @PostMapping("/task")
// @Scheduled(fixedDelay = 10000)
// @Anonymous
// public void task() {
// // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )
// //查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
//// UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result();
//// result1.setDataSourceKey("MASTER");
//// changeDataSource(result1);
//// List<UmsDataSourceVo.Result> query = umsDataSourceDao.query(null);
//// if (CollectionUtil.isEmpty(query)) {
//// return;
//// }
// //查询公共队列
// List<Object> queueResults = redisCache.getCacheList("common_followup_queue");
// List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS = new ArrayList<>();
// if (CollectionUtil.isEmpty(queueResults)) {
//
// followupQueueVOS = fmsFollowupQueueService.queryCommonQueue(null);
package com.acupuncture.web.task;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.common.core.redis.RedisCache;
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
import com.acupuncture.system.domain.dto.FmsFollowupDto;
import com.acupuncture.system.domain.po.FmsFollowupTask;
import com.acupuncture.system.domain.po.FmsFollowupTaskExample;
import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
import com.acupuncture.system.domain.vo.FmsFollowupVo;
import com.acupuncture.system.domain.vo.UmsDataSourceVo;
import com.acupuncture.system.persist.dao.FmsFollowupDao;
import com.acupuncture.system.persist.dao.UmsDataSourceDao;
import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
import com.acupuncture.system.service.FmsFollowupQueueService;
import com.acupuncture.system.service.FmsFollowupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl;
import org.quartz.spi.OperableTrigger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author zzc
* @Package com.acupuncture.web.controller.web
* @Date 2025/2/13 8:50
* @description:
*/
@Slf4j
@Api(tags = "定时任务相关")
@RestController
@RequestMapping("/task")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class TaskController {
@Resource
private FmsFollowupDao fmsFollowupDao;
@Resource
private FmsFollowupService fmsFollowupService;
@Resource
private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Resource
private UmsDataSourceDao umsDataSourceDao;
@Resource
private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
@Resource
private RedisCache redisCache;
@Resource
private FmsFollowupQueueService fmsFollowupQueueService;
/**
* 处理业务
*
* @param tenandId 租户用户
* @param commonQueue 公共队列
*/
public void doTask(Long tenandId, List<FmsFollowupVo.FollowupQueueVO> commonQueue) {
//查询从库队列
//1. 查询队列
List<FmsFollowupVo.FollowupQueueVO> slavelQueueList = fmsFollowupDao.selectQueueList(null, null, null, null);
//合并公共队列和从库的队列
slavelQueueList.addAll(commonQueue);
//查询每个队列的对象
for (FmsFollowupVo.FollowupQueueVO queue : slavelQueueList) {
FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO();
followupPatientQueryDTO.setQueueId(queue.getId());
followupPatientQueryDTO.setTenantId(queue.getTenantId());
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO);
log.info("查询每个队列的对象:{}", patientList);
}
//定时任务
// //循环租户
// for (UmsDataSourceVo.Result tenant : tenantList) {
// if ("MASTER".equals(tenant.getDataSourceKey())) {
// continue;
// }
//// List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null);
// //切换数据源
//// for (UmsDataSourceVo.Result result : query) {
//// if ("MASTER".equals(result.getDataSourceKey()) || "PROD_YY".equals(result.getDataSourceKey())) {
//// continue;
//// }
//// changeDataSource(result);
// changeDataSource(tenant);
// {
// //获取随访患者列表,根据患者出院日时间和队列添加工单
// //1. 查询队列
// List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null, null);
//
// if (CollectionUtil.isEmpty(queueList)) {
// if (CollectionUtil.isEmpty(queueResults)) {
// queueList = followupQueueVOS;
// }
// } else {
// if (CollectionUtil.isEmpty(queueResults)) {
// if (CollectionUtil.isEmpty(followupQueueVOS)) {
// queueList.addAll(followupQueueVOS);
// }
// }
@ -117,8 +117,9 @@
// FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO();
// followupPatientQueryDTO.setQueueId(followupQueueVO.getId());
// followupPatientQueryDTO.setTenantId(followupQueueVO.getTenantId());
//// changeDataSource(result);
// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryTaskPatient(followupPatientQueryDTO);
// changeDataSource(result);
//
// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO);
//// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), null, null);
// if (CollectionUtil.isEmpty(patientList)) {
// continue;
@ -149,6 +150,7 @@
// //3. 判断随访类型
// if (followupQueueVO.getFollowupType() == 0) {
// //单次
//
// //判断是否已有该次随访
// FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
// fmsFollowupTaskExample.createCriteria().andTimesEqualTo(1).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId());
@ -196,7 +198,7 @@
// fmsFollowupTask.setEndTime(instance1.getTime());
// fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
// fmsFollowupTask.setFollowupTime(dateList.get(0));
//// changeDataSource(result);
// changeDataSource(result);
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
//
// } else {
@ -247,97 +249,113 @@
// instance.add(Calendar.DATE, followWindowAdys / 2);
//
// fmsFollowupTask.setEndTime(instance.getTime());
//// changeDataSource(result);
// changeDataSource(result);
// fmsFollowupTask.setPatientId(followupPatient.getId());
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
// }
// }
// }
// }
// }
//
// private static void changeDataSource(UmsDataSourceVo.Result result) {
// try {
// DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
// } finally {
// DynamicDataSourceContextHolder.clearDataSourceType();
// }
// }
//
// public String getName(String url) {
// Pattern pattern = Pattern.compile("jdbc:mysql://[^/]+/([^?]+)");
// Matcher matcher = pattern.matcher(url);
// if (matcher.find()) {
// String dbName = matcher.group(1); // 输出 acupuncture_yfyy
// System.out.println("数据库名称: " + dbName);
// return dbName;
// }
// return "";
// }
//
// /**
// * 法用于计算在指定时间范围内触发器的触发时间点。具体步骤如下:
// * 初始化一个空列表 lst 存储触发时间点。
// * 克隆传入的触发器 trigg,并检查其下一个触发时间是否为空。如果为空,则设置开始时间和结束时间,并计算首次触发时间。
// * 使用 while 循环遍历触发器的触发时间点,直到没有更多触发时间或超出指定范围。
// * 如果触发时间在指定范围内,则将其添加到列表中,并更新触发器状态。
// *
// * @param trigg cron表达式
// * @param from 患者出院时间
// * @param to 患者出院时间 + 随访总月数
// * @return
// */
// public static List<Date> computeFireTimesBetween(OperableTrigger trigg, org.quartz.Calendar cal, Date from, Date to) {
// LinkedList<Date> lst = new LinkedList();
// OperableTrigger t = (OperableTrigger) trigg.clone();
// if (t.getNextFireTime() == null) {
// t.setStartTime(from);
// t.setEndTime(to);
// t.computeFirstFireTime(cal);
// }
//
// while (true) {
// Date d = t.getNextFireTime();
// if (d == null) {
// break;
// }
//
// if (d.before(from)) {
// t.triggered(cal);
// } else {
// if (d.after(to)) {
// break;
// }
// lst.add(d);
// t.triggered(cal);
// }
// }
// return Collections.unmodifiableList(lst);
// }
//
// /**
// * 返回当前时间之后的第一个date及对应顺序
// *
// * @param dateList key 为顺序,value 为时间
// * @return
// */
// public static DateComparator getDate(List<Date> dateList) {
// Date today = new Date();
// DateComparator dateComparator = new DateComparator();
// for (int i = 0; i < dateList.size(); i++) {
// Date date = dateList.get(i);
// if (date.after(today)) {
// dateComparator.setDate(date);
// dateComparator.setIndex(i + 1);
// return dateComparator;
// }
// }
// return dateComparator;
// }
//
// @Data
// public static class DateComparator {
// private Date date;
// private Integer index;
// }
//}
}
@ApiOperation("定时任务添加随访工单")
@PostMapping("/task")
@Scheduled(cron = "0 0 0 * * ?")
@Anonymous
public void task() {
// TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )
//查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
List<UmsDataSourceVo.Result> tenantList = umsDataSourceDao.query(null);
if (CollectionUtil.isEmpty(tenantList)) {
return;
}
//过滤掉没有数据源的租户
tenantList = tenantList.stream().filter(result -> StrUtil.isNotEmpty(result.getDataSourceKey())).collect(Collectors.toList());
//查询公共队列
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS = fmsFollowupQueueService.queryCommonQueue(null);
//循环租户
for (UmsDataSourceVo.Result tenant : tenantList) {
//切换数据源
DynamicDataSourceContextHolder.setDataSourceType(tenant.getDataSourceKey());
//处理从库业务
doTask(tenant.getTenantId(), followupQueueVOS);
//销毁数据源
DynamicDataSourceContextHolder.clearDataSourceType();
}
}
/**
* 法用于计算在指定时间范围内触发器的触发时间点具体步骤如下
* 初始化一个空列表 lst 存储触发时间点
* 克隆传入的触发器 trigg并检查其下一个触发时间是否为空如果为空则设置开始时间和结束时间并计算首次触发时间
* 使用 while 循环遍历触发器的触发时间点直到没有更多触发时间或超出指定范围
* 如果触发时间在指定范围内则将其添加到列表中并更新触发器状态
*
* @param trigg cron表达式
* @param from 患者出院时间
* @param to 患者出院时间 + 随访总月数
* @return
*/
public static List<Date> computeFireTimesBetween(OperableTrigger trigg, org.quartz.Calendar cal, Date from, Date to) {
LinkedList<Date> lst = new LinkedList();
OperableTrigger t = (OperableTrigger) trigg.clone();
if (t.getNextFireTime() == null) {
t.setStartTime(from);
t.setEndTime(to);
t.computeFirstFireTime(cal);
}
while (true) {
Date d = t.getNextFireTime();
if (d == null) {
break;
}
if (d.before(from)) {
t.triggered(cal);
} else {
if (d.after(to)) {
break;
}
lst.add(d);
t.triggered(cal);
}
}
return Collections.unmodifiableList(lst);
}
/**
* 返回当前时间之后的第一个date及对应顺序
*
* @param dateList key 为顺序value 为时间
* @return
*/
public static DateComparator getDate(List<Date> dateList) {
Date today = new Date();
DateComparator dateComparator = new DateComparator();
for (int i = 0; i < dateList.size(); i++) {
Date date = dateList.get(i);
if (date.after(today)) {
dateComparator.setDate(date);
dateComparator.setIndex(i + 1);
return dateComparator;
}
}
return dateComparator;
}
@Data
public static class DateComparator {
private Date date;
private Integer index;
}
}

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

@ -37,8 +37,6 @@ import javax.servlet.http.HttpServletRequest;
public class AdminGlobalDataSourceAspect {
protected Logger logger = LoggerFactory.getLogger(getClass());
// @Autowired
// private UmsDataSourceMapper umsDataSourceMapper;
@Resource
private DmsLoginService dmsLoginService;
@ -51,10 +49,16 @@ public class AdminGlobalDataSourceAspect {
@Around("dsPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
//获取datasource
try {
String dataSourceKey = getDataSource(point);
if (StringUtils.isNotNull(dataSourceKey)) {
if (StringUtils.isNotEmpty(dataSourceKey)) {
DataSourceManager.setDataSourceKey(dataSourceKey);
} else {
DataSourceManager.setDataSourceKey(null);
}
}catch (Exception e){
throw new BaseException(StrUtil.format("获取数据源错误:{}", e));
}
try {
@ -70,41 +74,25 @@ public class AdminGlobalDataSourceAspect {
*/
public String getDataSource(ProceedingJoinPoint point) {
// 获取请求携带的令牌
ServletRequestAttributes requestAttributes = (ServletRequestAttributes)
RequestContextHolder.getRequestAttributes();
HttpServletRequest request;
if (requestAttributes == null) {
DynamicDataSourceContextHolder.getDataSourceType();
return DynamicDataSourceContextHolder.getDataSourceType();
}
request = requestAttributes.getRequest();
//token为空
Long tenantId;
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
Long tenantId = null;
String header = request.getHeader(UserConstants.DEPT);
if(StrUtil.isNotEmpty(header)){
tenantId = Long.parseLong(header);
}else {
// String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
String authHeader = request.getHeader(UserConstants.HEADER_KEY_TOKEN);
if (StrUtil.isEmpty(authHeader)) {
return null;
}
if (StrUtil.isNotEmpty(request.getHeader(UserConstants.HEADER_KEY_TOKEN))) {
tenantId = SecurityUtils.getTenantId();
if (tenantId == null) {
return null;
}
}
//设置所属医院和数据源l
// LoginUser loginUser = SecurityUtils.getLoginUser();
// if(ObjectUtil.isNull(loginUser) || loginUser.getUser().isAdmin()){
// return null;
// }
//根据组织ID查询数据源
if(tenantId !=null) {
UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId);
if (dataSource == null) {
throw new BaseException(DATASOURCE_NOT_FOUND);
}
return dataSource.getDataSourceKey();
}
return null;
}
}

1
acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/UserDetailsServiceImpl.java

@ -100,6 +100,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
{
SysUser sysUser = new SysUser();
sysUser.setUserName(user.getUsername());
sysUser.setPassword(user.getPassword());
sysUser.setUserId(user.getDmsUserId());
return new LoginUser(user.getDmsUserId(), user.getHospitalId(), sysUser, CollUtil.newHashSet(), user.getTenantId() ,user.getScoreId());
}

2
acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java

@ -62,7 +62,7 @@ public class WebDmsLoginService
public String login(String username, String password, String code, String uuid)
{
// 验证码校验
// validateCaptcha(username, code, uuid);
validateCaptcha(username, code, uuid);
// 登录前置校验
loginPreCheck(username, password);
// 用户验证

20
acupuncture-generator/src/main/resources/mbg.xml

@ -20,7 +20,7 @@
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://sd.tall.wiki:3306/acupuncture_yfyy?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=GMT%2B8&amp;tinyInt1isBit=false"
connectionURL="jdbc:mysql://sd.tall.wiki:3306/acupuncture?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=GMT%2B8&amp;tinyInt1isBit=false"
userId="root"
password="po3OynBO[M3579p6L7)o">
<!--仅仅查询当前库的表,不查询其他库-->
@ -57,16 +57,16 @@
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<table tableName="upl_rtcf_info" domainObjectName="UplRtcfInfo" enableDeleteByExample="false"/>
<table tableName="upl_report_image" domainObjectName="UplReportImage" enableDeleteByExample="false"/>
<table tableName="scr_screening" domainObjectName="ScrScreening" enableDeleteByExample="false"/>
<table tableName="scr_screening_detail" domainObjectName="ScrScreeningDetail" enableDeleteByExample="false"/>
<table tableName="scr_screening_draw" domainObjectName="ScrScreeningDraw" enableDeleteByExample="false"/>
<table tableName="scr_screening_record" domainObjectName="ScrScreeningRecord" enableDeleteByExample="false"/>
<table tableName="scr_screening_sound" domainObjectName="ScrScreeningSound" enableDeleteByExample="false"/>
<table tableName="ams_screen_wx_qr_code" domainObjectName="AmsScreenWxQrCode" enableDeleteByExample="false"/>
<!-- <table tableName="upl_rtcf_info" domainObjectName="UplRtcfInfo" enableDeleteByExample="false"/>-->
<!-- <table tableName="upl_report_image" domainObjectName="UplReportImage" enableDeleteByExample="false"/>-->
<!-- <table tableName="scr_screening" domainObjectName="ScrScreening" enableDeleteByExample="false"/>-->
<!-- <table tableName="scr_screening_detail" domainObjectName="ScrScreeningDetail" enableDeleteByExample="false"/>-->
<!-- <table tableName="scr_screening_draw" domainObjectName="ScrScreeningDraw" enableDeleteByExample="false"/>-->
<!-- <table tableName="scr_screening_record" domainObjectName="ScrScreeningRecord" enableDeleteByExample="false"/>-->
<!-- <table tableName="scr_screening_sound" domainObjectName="ScrScreeningSound" enableDeleteByExample="false"/>-->
<!-- <table tableName="ams_screen_wx_qr_code" domainObjectName="AmsScreenWxQrCode" enableDeleteByExample="false"/>-->
<!-- <table tableName="dms_user" domainObjectName="DmsUser" enableDeleteByExample="false"/>-->
<table tableName="dms_user" domainObjectName="DmsUser" enableDeleteByExample="false"/>
<!-- <table tableName="fms_followup_queue" domainObjectName="FmsFollowupQueue" enableDeleteByExample="false"/>-->
<!-- <table tableName="fms_followup_task" domainObjectName="FmsFollowupTask" enableDeleteByExample="false"/>-->
<!-- <table tableName="fms_patient_queue_relation" domainObjectName="FmsPatientQueueRelation" enableDeleteByExample="false"/>-->

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

@ -5,7 +5,10 @@ import com.acupuncture.system.domain.po.DmsUser;
import com.acupuncture.system.service.AdminTenantUserService;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@ -18,7 +21,7 @@ public class AdminTenantUserDto {
@Data
public static class AddDto {
private Integer id;
private Long id;
private Long tenantId;
@ -37,17 +40,14 @@ public class AdminTenantUserDto {
private String status;
private String contactPhone;
@ApiModelProperty("是否具有审核权限(0不具有; 1具有)")
private Byte slaverAdmin;
//
// public Long getTenantId() {
// return SecurityUtils.getTenantId();
// }
private Byte slaverAdmin = 0;
}
@Data
public static class UpdDto {
private Integer id;
private Long id;
private Long tenantId;
@ -71,14 +71,21 @@ public class AdminTenantUserDto {
@Data
public static class DeleteDto {
private List<Integer> idList;
private List<Long> idList;
}
@Data
public static class Query {
private Long tenantId;
private String tenantName;
}
@Data
public static class ResetPwd {
@NotNull
private Long id;
@NotBlank
@Length(min = 6, max = 20)
private String password;
}
}

17
acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsUser.java

@ -4,7 +4,7 @@ import java.io.Serializable;
import java.util.Date;
public class DmsUser implements Serializable {
private Integer id;
private Long id;
private Long tenantId;
@ -20,6 +20,8 @@ public class DmsUser implements Serializable {
private String sex;
private Byte slaverAdmin;
private String status;
private Byte delFlag;
@ -36,11 +38,11 @@ public class DmsUser implements Serializable {
private static final long serialVersionUID = 1L;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
@ -100,6 +102,14 @@ public class DmsUser implements Serializable {
this.sex = sex == null ? null : sex.trim();
}
public Byte getSlaverAdmin() {
return slaverAdmin;
}
public void setSlaverAdmin(Byte slaverAdmin) {
this.slaverAdmin = slaverAdmin;
}
public String getStatus() {
return status;
}
@ -170,6 +180,7 @@ public class DmsUser implements Serializable {
sb.append(", email=").append(email);
sb.append(", phonenumber=").append(phonenumber);
sb.append(", sex=").append(sex);
sb.append(", slaverAdmin=").append(slaverAdmin);
sb.append(", status=").append(status);
sb.append(", delFlag=").append(delFlag);
sb.append(", createBy=").append(createBy);

80
acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsUserExample.java

@ -115,52 +115,52 @@ public class DmsUserExample {
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
@ -645,6 +645,66 @@ public class DmsUserExample {
return (Criteria) this;
}
public Criteria andSlaverAdminIsNull() {
addCriterion("slaver_admin is null");
return (Criteria) this;
}
public Criteria andSlaverAdminIsNotNull() {
addCriterion("slaver_admin is not null");
return (Criteria) this;
}
public Criteria andSlaverAdminEqualTo(Byte value) {
addCriterion("slaver_admin =", value, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminNotEqualTo(Byte value) {
addCriterion("slaver_admin <>", value, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminGreaterThan(Byte value) {
addCriterion("slaver_admin >", value, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminGreaterThanOrEqualTo(Byte value) {
addCriterion("slaver_admin >=", value, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminLessThan(Byte value) {
addCriterion("slaver_admin <", value, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminLessThanOrEqualTo(Byte value) {
addCriterion("slaver_admin <=", value, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminIn(List<Byte> values) {
addCriterion("slaver_admin in", values, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminNotIn(List<Byte> values) {
addCriterion("slaver_admin not in", values, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminBetween(Byte value1, Byte value2) {
addCriterion("slaver_admin between", value1, value2, "slaverAdmin");
return (Criteria) this;
}
public Criteria andSlaverAdminNotBetween(Byte value1, Byte value2) {
addCriterion("slaver_admin not between", value1, value2, "slaverAdmin");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;

2
acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantUserVo.java

@ -38,6 +38,8 @@ public class AdminTenantUserVo {
private Date createTime;
private String tenantName;
private Byte slaverAdmin;
}
}

5
acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/DmsLoginUserVo.java

@ -22,8 +22,10 @@ public class DmsLoginUserVo {
}
@Data
public static class DmsUserVo {
private Integer id;
private Long id;
private Long tenantId;
private String tenantName;
private String tenantPhone;
private String userName;
private String password;
@ -33,6 +35,7 @@ public class DmsLoginUserVo {
private String email;
private String phonenumber;
private Byte slaverAdmin;
private String sex;

2
acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java

@ -27,7 +27,7 @@ public interface SysRoleMapper
* @param userId 用户ID
* @return 角色列表
*/
@DataSource(DataSourceType.MASTER)
// @DataSource(DataSourceType.MASTER)
public List<SysRole> selectRolePermissionByUserId(Long userId);
/**

7
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java

@ -45,4 +45,11 @@ public interface DmsUserDao {
DmsLoginUserVo.DmsUserVo checkUserNameUnique(String userName);
DmsLoginUserVo.DmsUserVo checkPhoneUnique(String phonenumber);
/**
* 根据租户用户id查询租户用户信息
* @param userId
* @return
*/
DmsLoginUserVo.DmsUserVo queryTenantUserById(Long userId);
}

4
acupuncture-system/src/main/java/com/acupuncture/system/persist/mapper/DmsUserMapper.java

@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
public interface DmsUserMapper {
long countByExample(DmsUserExample example);
int deleteByPrimaryKey(Integer id);
int deleteByPrimaryKey(Long id);
int insert(DmsUser record);
@ -16,7 +16,7 @@ public interface DmsUserMapper {
List<DmsUser> selectByExample(DmsUserExample example);
DmsUser selectByPrimaryKey(Integer id);
DmsUser selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") DmsUser record, @Param("example") DmsUserExample example);

1
acupuncture-system/src/main/java/com/acupuncture/system/service/AdminTenantUserService.java

@ -21,4 +21,5 @@ public interface AdminTenantUserService {
List<AdminTenantUserVo.Result> query(AdminTenantUserDto.Query dto);
int resetPwd(AdminTenantUserDto.ResetPwd dto);
}

9
acupuncture-system/src/main/java/com/acupuncture/system/service/DmsLoginService.java

@ -34,10 +34,11 @@ public interface DmsLoginService {
/**
* 重置用户密码
*
* @param user 用户信息
* @param username 用户信息
* @param password 密码
* @return 结果
*/
public int resetPwd(DmsLoginUserVo.DmsUserVo user);
public int resetPwd(Long userId, String username, String password);
/**
* 根据租户ID获取数据源
@ -49,4 +50,8 @@ public interface DmsLoginService {
boolean checkPhoneUnique(AdminTenantUserDto.AddDto dto);
DmsTenant queryById(Long id);
DmsLoginUserVo.DmsUserVo selectTenantUserById(Long userId);
int updateTenantUserById(AdminTenantUserDto.UpdDto updDto);
}

1
acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupQueueService.java

@ -19,7 +19,6 @@ public interface FmsFollowupQueueService {
* 查询公共队列
* @return
*/
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(String name);
}

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

@ -35,7 +35,7 @@ public class AdminTenantUserServiceImpl implements AdminTenantUserService {
@Override
public int insert(AdminTenantUserDto.AddDto dto) {
DmsUser dmsUser = BeanUtil.copyProperties(dto, DmsUser.class);
dmsUser.setId((int) IdUtil.getSnowflakeNextId());
dmsUser.setId(dto.getId());
dmsUser.setCreateBy(SecurityUtils.getUsername());
dmsUser.setCreateTime(new Date());
return dmsUserMapper.insertSelective(dmsUser);
@ -62,4 +62,12 @@ public class AdminTenantUserServiceImpl implements AdminTenantUserService {
public List<AdminTenantUserVo.Result> query(AdminTenantUserDto.Query dto) {
return adminDmsUserDao.query(dto);
}
@Override
public int resetPwd(AdminTenantUserDto.ResetPwd dto) {
DmsUser dmsUser = new DmsUser();
dmsUser.setId(dto.getId());
dmsUser.setPassword(SecurityUtils.encryptPassword(dto.getPassword()));
return dmsUserMapper.updateByPrimaryKeySelective(dmsUser);
}
}

28
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/DmsLoginServiceImpl.java

@ -1,5 +1,6 @@
package com.acupuncture.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.acupuncture.common.constant.UserConstants;
import com.acupuncture.common.core.domain.entity.SysUser;
import com.acupuncture.common.utils.StringUtils;
@ -10,6 +11,7 @@ import com.acupuncture.system.domain.po.UmsDataSource;
import com.acupuncture.system.domain.vo.DmsLoginUserVo;
import com.acupuncture.system.persist.dao.DmsUserDao;
import com.acupuncture.system.persist.mapper.DmsTenantMapper;
import com.acupuncture.system.persist.mapper.DmsUserMapper;
import com.acupuncture.system.persist.mapper.UmsDataSourceMapper;
import com.acupuncture.system.service.DmsLoginService;
import org.springframework.stereotype.Service;
@ -28,6 +30,9 @@ public class DmsLoginServiceImpl implements DmsLoginService {
@Resource
private DmsUserDao dmsUserDao;
@Resource
private DmsUserMapper dmsUserMapper;
@Resource
private DmsTenantMapper dmsTenantMapper;
@ -54,7 +59,11 @@ public class DmsLoginServiceImpl implements DmsLoginService {
}
@Override
public int resetPwd(DmsLoginUserVo.DmsUserVo user) {
public int resetPwd(Long userId, String username, String password) {
DmsLoginUserVo.DmsUserVo user = new DmsLoginUserVo.DmsUserVo();
user.setId(userId);
user.setUserName(username);
user.setPassword(password);
return dmsUserDao.updateUser(user);
}
@ -97,5 +106,22 @@ public class DmsLoginServiceImpl implements DmsLoginService {
return dmsTenantMapper.selectByPrimaryKey(id);
}
@Override
public DmsLoginUserVo.DmsUserVo selectTenantUserById(Long userId) {
return dmsUserDao.queryTenantUserById(userId);
}
@Override
public int updateTenantUserById(AdminTenantUserDto.UpdDto updDto) {
DmsUser dmsUser = new DmsUser();
dmsUser.setId(updDto.getId());
dmsUser.setUserName(updDto.getUserName());
dmsUser.setNickName(updDto.getNickName());
dmsUser.setEmail(updDto.getEmail());
dmsUser.setPhonenumber(updDto.getPhonenumber());
dmsUser.setSex(updDto.getSex());
dmsUser.setTenantId(updDto.getTenantId());
dmsUser.setSlaverAdmin(updDto.getSlaverAdmin());
return dmsUserMapper.updateByPrimaryKeySelective(dmsUser);
}
}

1
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java

@ -29,7 +29,6 @@ public class FmsFollowupQueueServiceImpl implements FmsFollowupQueueService {
public static String COMMON_FOLLOWUP_QUEUE = "common_followup_queue";
@Override
@DataSource(DataSourceType.MASTER)
public List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(String name) {
redisCache.deleteObject(COMMON_FOLLOWUP_QUEUE);
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS = fmsFollowupDao.queryCommonQueue(name);

3
acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml

@ -20,6 +20,7 @@
u.update_by as updateBy,
u.update_time as updateTime,
u.remark,
u.slaver_admin as slaverAdmin,
t.name as tenantName
FROM
dms_user u
@ -34,7 +35,7 @@
AND t.name like concat('%',#{dto.tenantName},'%')
</if>
</where>
order by u.create_time desc
order by u.tenant_id desc, u.id desc
</select>
</mapper>

18
acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml → acupuncture-system/src/main/resources/mapper/dao/DmsUserDao.xml

@ -86,4 +86,22 @@
<select id="checkPhoneUnique" parameterType="String" resultType="com.acupuncture.system.domain.vo.DmsLoginUserVo$DmsUserVo">
select id, user_name from dms_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
</select>
<select id="queryTenantUserById" resultType="com.acupuncture.system.domain.vo.DmsLoginUserVo$DmsUserVo">
select
u.id,
u.nick_name as nickName,
u.user_name as userName,
u.tenant_id as tenantId,
u.phonenumber as phonenumber,
u.email as email,
u.sex as sex,
t.`name` as tenantName,
t.contact_phone as tenantPhone,
u.slaver_admin as slaverAdmin
from
dms_user u join dms_tenant t on u.tenant_id = t.id
WHERE
u.del_flag = 0
and u.id = #{userId}
</select>
</mapper>

57
acupuncture-system/src/main/resources/mapper/system/DmsUserMapper.xml

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.acupuncture.system.persist.mapper.DmsUserMapper">
<resultMap id="BaseResultMap" type="com.acupuncture.system.domain.po.DmsUser">
<id column="id" jdbcType="INTEGER" property="id" />
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
<result column="password" jdbcType="VARCHAR" property="password" />
@ -10,6 +10,7 @@
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="phonenumber" jdbcType="VARCHAR" property="phonenumber" />
<result column="sex" jdbcType="CHAR" property="sex" />
<result column="slaver_admin" jdbcType="TINYINT" property="slaverAdmin" />
<result column="status" jdbcType="CHAR" property="status" />
<result column="del_flag" jdbcType="TINYINT" property="delFlag" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
@ -77,8 +78,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, tenant_id, user_name, password, nick_name, email, phonenumber, sex, status, del_flag,
create_by, create_time, update_by, update_time, remark
id, tenant_id, user_name, password, nick_name, email, phonenumber, sex, slaver_admin,
status, del_flag, create_by, create_time, update_by, update_time, remark
</sql>
<select id="selectByExample" parameterType="com.acupuncture.system.domain.po.DmsUserExample" resultMap="BaseResultMap">
select
@ -94,29 +95,29 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from dms_user
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from dms_user
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.acupuncture.system.domain.po.DmsUser">
insert into dms_user (id, tenant_id, user_name,
password, nick_name, email,
phonenumber, sex, status,
del_flag, create_by, create_time,
update_by, update_time, remark
)
values (#{id,jdbcType=INTEGER}, #{tenantId,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR},
phonenumber, sex, slaver_admin,
status, del_flag, create_by,
create_time, update_by, update_time,
remark)
values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{phonenumber,jdbcType=VARCHAR}, #{sex,jdbcType=CHAR}, #{status,jdbcType=CHAR},
#{delFlag,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}
)
#{phonenumber,jdbcType=VARCHAR}, #{sex,jdbcType=CHAR}, #{slaverAdmin,jdbcType=TINYINT},
#{status,jdbcType=CHAR}, #{delFlag,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.acupuncture.system.domain.po.DmsUser">
insert into dms_user
@ -145,6 +146,9 @@
<if test="sex != null">
sex,
</if>
<if test="slaverAdmin != null">
slaver_admin,
</if>
<if test="status != null">
status,
</if>
@ -169,7 +173,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
#{id,jdbcType=BIGINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
@ -192,6 +196,9 @@
<if test="sex != null">
#{sex,jdbcType=CHAR},
</if>
<if test="slaverAdmin != null">
#{slaverAdmin,jdbcType=TINYINT},
</if>
<if test="status != null">
#{status,jdbcType=CHAR},
</if>
@ -225,7 +232,7 @@
update dms_user
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
@ -248,6 +255,9 @@
<if test="record.sex != null">
sex = #{record.sex,jdbcType=CHAR},
</if>
<if test="record.slaverAdmin != null">
slaver_admin = #{record.slaverAdmin,jdbcType=TINYINT},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=CHAR},
</if>
@ -276,7 +286,7 @@
</update>
<update id="updateByExample" parameterType="map">
update dms_user
set id = #{record.id,jdbcType=INTEGER},
set id = #{record.id,jdbcType=BIGINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
user_name = #{record.userName,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
@ -284,6 +294,7 @@
email = #{record.email,jdbcType=VARCHAR},
phonenumber = #{record.phonenumber,jdbcType=VARCHAR},
sex = #{record.sex,jdbcType=CHAR},
slaver_admin = #{record.slaverAdmin,jdbcType=TINYINT},
status = #{record.status,jdbcType=CHAR},
del_flag = #{record.delFlag,jdbcType=TINYINT},
create_by = #{record.createBy,jdbcType=VARCHAR},
@ -319,6 +330,9 @@
<if test="sex != null">
sex = #{sex,jdbcType=CHAR},
</if>
<if test="slaverAdmin != null">
slaver_admin = #{slaverAdmin,jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status,jdbcType=CHAR},
</if>
@ -341,7 +355,7 @@
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.acupuncture.system.domain.po.DmsUser">
update dms_user
@ -352,6 +366,7 @@
email = #{email,jdbcType=VARCHAR},
phonenumber = #{phonenumber,jdbcType=VARCHAR},
sex = #{sex,jdbcType=CHAR},
slaver_admin = #{slaverAdmin,jdbcType=TINYINT},
status = #{status,jdbcType=CHAR},
del_flag = #{delFlag,jdbcType=TINYINT},
create_by = #{createBy,jdbcType=VARCHAR},
@ -359,6 +374,6 @@
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

6
acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -168,7 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="slaverAdmin != null ">slaver_admin,</if>
<if test="slaverAdmin != null">slaver_admin,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
@ -184,7 +184,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="slaverAdmin != null ">#{slaverAdmin},</if>
<if test="slaverAdmin != null">#{slaverAdmin},</if>
sysdate()
)
</insert>
@ -192,6 +192,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateUser" parameterType="SysUser">
update sys_user
<set>
<if test="tenantId != null and tenantId != 0">tenant_id = #{tenantId},</if>
<if test="slaverAdmin != null">slaver_admin = #{slaverAdmin},</if>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>

Loading…
Cancel
Save