1747191978@qq.com 3 months ago
parent
commit
f7c89b5865
  1. 17
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysLoginController.java
  2. 9
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java
  3. 7
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java
  4. 4
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.java
  5. 10
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java
  6. 7
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java
  7. 3
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java
  8. 12
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java
  9. 211
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java
  10. 2
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java
  11. 324
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java
  12. 5
      acupuncture-admin/src/main/resources/application.yml
  13. 1
      acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java
  14. 22
      acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java
  15. 3
      acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/DataSourceAspect.java
  16. 2
      acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java
  17. 47
      acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/SysLoginService.java
  18. 2
      acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java
  19. 5
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java
  20. 7
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java
  21. 1
      acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java
  22. 1
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminDataSourceDao.java
  23. 17
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java
  24. 1
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java
  25. 10
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java
  26. 1
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsPatientDao.java
  27. 5
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java
  28. 1
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java
  29. 3
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java
  30. 2
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java
  31. 11
      acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java
  32. 9
      acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java
  33. 2
      acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java
  34. 39
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java
  35. 2
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java
  36. 54
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java
  37. 16
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java
  38. 2
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysConfigServiceImpl.java
  39. 3
      acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml
  40. 26
      acupuncture-system/src/main/resources/mapper/dao/UmsDataSourceDao.xml

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

@ -66,6 +66,23 @@ public class SysLoginController
return ajax; return ajax;
} }
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/loginSimple")
public AjaxResult loginSimple(@RequestBody LoginBody loginBody)
{
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.loginSimple(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/** /**
* 获取用户信息 * 获取用户信息
* *

9
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());
@ -138,6 +140,7 @@ public class AdminDmsUserController {
//修改从库用户信息 //修改从库用户信息
SysUser sysUser = BeanUtil.copyProperties(dto, SysUser.class); SysUser sysUser = BeanUtil.copyProperties(dto, SysUser.class);
sysUser.setUserId(dto.getId());
sysUser.setPhonenumber(dto.getContactPhone()); sysUser.setPhonenumber(dto.getContactPhone());
userService.updateUser(sysUser); userService.updateUser(sysUser);
@ -196,8 +199,4 @@ public class AdminDmsUserController {
//只修改主库密码,修改从库密码没有任何意义。 //只修改主库密码,修改从库密码没有任何意义。
return JsonResponse.ok(adminTenantUserService.resetPwd(dto)); return JsonResponse.ok(adminTenantUserService.resetPwd(dto));
} }
private static void removeDataSource() {
DynamicDataSourceContextHolder.clearDataSourceType();
}
} }

7
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java

@ -1,8 +1,10 @@
package com.acupuncture.web.controller.web; package com.acupuncture.web.controller.web;
import com.acupuncture.common.annotation.Anonymous; 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.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.dto.FmsFollowupDto;
import com.acupuncture.system.domain.vo.FmsFollowupVo; import com.acupuncture.system.domain.vo.FmsFollowupVo;
import com.acupuncture.system.service.AdminFmsFollowupQueueService; import com.acupuncture.system.service.AdminFmsFollowupQueueService;
@ -36,6 +38,7 @@ public class AdminFmsFollowupController {
@ApiOperation("查询队列") @ApiOperation("查询队列")
@PostMapping("/query") @PostMapping("/query")
@Anonymous @Anonymous
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<FmsFollowupVo.FollowupQueueVO>> queryCommonQueue(@RequestBody @Validated BaseDto<FmsFollowupDto.QueueQuery> dto) { public JsonResponse<PageInfo<FmsFollowupVo.FollowupQueueVO>> queryCommonQueue(@RequestBody @Validated BaseDto<FmsFollowupDto.QueueQuery> dto) {
if (dto.getPageNum() > 0) { if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
@ -45,6 +48,7 @@ public class AdminFmsFollowupController {
@ApiOperation("添加随访队列") @ApiOperation("添加随访队列")
@PostMapping("/add") @PostMapping("/add")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> addQueue(@RequestBody @Validated FmsFollowupDto.Add dto){ public JsonResponse<Integer> addQueue(@RequestBody @Validated FmsFollowupDto.Add dto){
return JsonResponse.ok(fmsFollowupQueueService.addQueue(dto)); return JsonResponse.ok(fmsFollowupQueueService.addQueue(dto));
} }
@ -57,12 +61,14 @@ public class AdminFmsFollowupController {
@ApiOperation("删除随访队列") @ApiOperation("删除随访队列")
@PostMapping("/del") @PostMapping("/del")
@DataSource(DataSourceType.MASTER)
public JsonResponse<Integer> delQueue(@RequestBody @Validated FmsFollowupDto.Del dto){ public JsonResponse<Integer> delQueue(@RequestBody @Validated FmsFollowupDto.Del dto){
return JsonResponse.ok(fmsFollowupQueueService.delQueue(dto)); return JsonResponse.ok(fmsFollowupQueueService.delQueue(dto));
} }
@ApiOperation("查询随访患者") @ApiOperation("查询随访患者")
@PostMapping("/queryPatient") @PostMapping("/queryPatient")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<FmsFollowupVo.FollowupPatient>> queryPatient(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupPatientQueryDTO> dto) { public JsonResponse<PageInfo<FmsFollowupVo.FollowupPatient>> queryPatient(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupPatientQueryDTO> dto) {
if (dto.getPageNum() > 0) { if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
@ -72,6 +78,7 @@ public class AdminFmsFollowupController {
@ApiOperation("查询随访任务") @ApiOperation("查询随访任务")
@PostMapping("/queryTask") @PostMapping("/queryTask")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<FmsFollowupVo.FollowupTaskVO>> queryTask(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupTaskQueryDTO> dto) { public JsonResponse<PageInfo<FmsFollowupVo.FollowupTaskVO>> queryTask(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupTaskQueryDTO> dto) {
if (dto.getPageNum() > 0) { if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); PageHelper.startPage(dto.getPageNum(), dto.getPageSize());

4
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.java

@ -1,7 +1,9 @@
package com.acupuncture.web.controller.web; 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.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.dto.FmsFollowupDto;
import com.acupuncture.system.domain.dto.PmsPatientDto; import com.acupuncture.system.domain.dto.PmsPatientDto;
import com.acupuncture.system.domain.vo.FmsFollowupVo; import com.acupuncture.system.domain.vo.FmsFollowupVo;
@ -47,6 +49,7 @@ public class AdminPmsPatientController {
*/ */
@ApiOperation("查询上报类型") @ApiOperation("查询上报类型")
@PostMapping("/list") @PostMapping("/list")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<PmsPatientVo.PatientResult>> adminQuery( @RequestBody @Validated BaseDto<PmsPatientDto.PatientQuery> dto) { public JsonResponse<PageInfo<PmsPatientVo.PatientResult>> adminQuery( @RequestBody @Validated BaseDto<PmsPatientDto.PatientQuery> dto) {
if (dto.getPageNum() > 0) { if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
@ -56,6 +59,7 @@ public class AdminPmsPatientController {
@ApiOperation("导出") @ApiOperation("导出")
@PostMapping("/export") @PostMapping("/export")
@DataSource(DataSourceType.MASTER)
public void adminExportPatient(HttpServletResponse response, @RequestBody @Validated PmsPatientDto.PatientQuery dto) { public void adminExportPatient(HttpServletResponse response, @RequestBody @Validated PmsPatientDto.PatientQuery dto) {
pmsPatientService.adminExportPatient(response, dto); pmsPatientService.adminExportPatient(response, dto);
} }

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

@ -1,7 +1,9 @@
package com.acupuncture.web.controller.web; 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.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
import com.acupuncture.system.domain.dto.PmsTreatmentDto; import com.acupuncture.system.domain.dto.PmsTreatmentDto;
import com.acupuncture.system.domain.po.DmsTenant; import com.acupuncture.system.domain.po.DmsTenant;
@ -41,13 +43,10 @@ public class AdminPmsTreatmentController {
@Resource @Resource
private PmsTreatmentService treatmentService; private PmsTreatmentService treatmentService;
@Resource
private DmsTenantMapper dmsTenantMapper;
@Resource
private UmsDataSourceMapper umsDataSourceMapper;
@ApiOperation("查询诊疗档案") @ApiOperation("查询诊疗档案")
@PostMapping("/list") @PostMapping("/list")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PageInfo<PmsTreatmentVo.TreatmentVO>> listTreatment(@RequestBody @Validated BaseDto<PmsTreatmentDto.TreatmentQueryDTO> queryDTO) { public JsonResponse<PageInfo<PmsTreatmentVo.TreatmentVO>> listTreatment(@RequestBody @Validated BaseDto<PmsTreatmentDto.TreatmentQueryDTO> queryDTO) {
if (queryDTO.getPageNum() > 0) { if (queryDTO.getPageNum() > 0) {
PageHelper.startPage(queryDTO.getPageNum(), queryDTO.getPageSize()); PageHelper.startPage(queryDTO.getPageNum(), queryDTO.getPageSize());
@ -57,12 +56,14 @@ public class AdminPmsTreatmentController {
@ApiOperation("查询诊疗档案数据") @ApiOperation("查询诊疗档案数据")
@PostMapping("/queryRecord") @PostMapping("/queryRecord")
@DataSource(DataSourceType.MASTER)
public JsonResponse<PmsTreatmentVo.TreatmentRecordVO> queryRecord(@RequestBody @Validated PmsTreatmentDto.QueryRecord dto) { public JsonResponse<PmsTreatmentVo.TreatmentRecordVO> queryRecord(@RequestBody @Validated PmsTreatmentDto.QueryRecord dto) {
return JsonResponse.ok(treatmentService.adminQueryRecord(dto.getTreatmentId(), dto.getCodeList())); return JsonResponse.ok(treatmentService.adminQueryRecord(dto.getTreatmentId(), dto.getCodeList()));
} }
@ApiOperation("导出诊疗档案数据") @ApiOperation("导出诊疗档案数据")
@PostMapping("/exportTreatment") @PostMapping("/exportTreatment")
@DataSource(DataSourceType.MASTER)
public void exportTreatment(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.TreatmentQueryDTO dto) { public void exportTreatment(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.TreatmentQueryDTO dto) {
treatmentService.adminExportTreatment(response, dto); treatmentService.adminExportTreatment(response, dto);
} }
@ -75,7 +76,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){

7
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java

@ -1,6 +1,8 @@
package com.acupuncture.web.controller.web; package com.acupuncture.web.controller.web;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.system.domain.dto.StatisticsDto; import com.acupuncture.system.domain.dto.StatisticsDto;
import com.acupuncture.system.domain.vo.AdminStatisticsVo; import com.acupuncture.system.domain.vo.AdminStatisticsVo;
import com.acupuncture.system.service.AdminStatisticsService; import com.acupuncture.system.service.AdminStatisticsService;
@ -33,30 +35,35 @@ public class AdminStatisticsController {
@ApiOperation("患者统计") @ApiOperation("患者统计")
@PostMapping("/patientTotal") @PostMapping("/patientTotal")
@DataSource(DataSourceType.MASTER)
public JsonResponse<AdminStatisticsVo.PatientVo> queryPatientStatistics(@RequestBody @Validated StatisticsDto.Query dto) { public JsonResponse<AdminStatisticsVo.PatientVo> queryPatientStatistics(@RequestBody @Validated StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.queryPatientStatistics(dto)); return JsonResponse.ok(statisticsService.queryPatientStatistics(dto));
} }
@ApiOperation("诊疗统计") @ApiOperation("诊疗统计")
@PostMapping("/zlInfo") @PostMapping("/zlInfo")
@DataSource(DataSourceType.MASTER)
public JsonResponse<AdminStatisticsVo.TreamentVo> queryZlStatistics(@RequestBody @Validated StatisticsDto.Query dto) { public JsonResponse<AdminStatisticsVo.TreamentVo> queryZlStatistics(@RequestBody @Validated StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.queryZlStatistics(dto)); return JsonResponse.ok(statisticsService.queryZlStatistics(dto));
} }
@ApiOperation("治疗类型统计") @ApiOperation("治疗类型统计")
@PostMapping("/zlType") @PostMapping("/zlType")
@DataSource(DataSourceType.MASTER)
public JsonResponse<AdminStatisticsVo.ZlTypeVo> queryZlTypeStatistics(@RequestBody @Validated StatisticsDto.Query dto) { public JsonResponse<AdminStatisticsVo.ZlTypeVo> queryZlTypeStatistics(@RequestBody @Validated StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.queryZlTypeStatistics(dto)); return JsonResponse.ok(statisticsService.queryZlTypeStatistics(dto));
} }
@ApiOperation("随访分布统计") @ApiOperation("随访分布统计")
@PostMapping("/sffb") @PostMapping("/sffb")
@DataSource(DataSourceType.MASTER)
public JsonResponse<List<AdminStatisticsVo.SffbVo.DlVo>> querySfStatistics(@RequestBody @Validated StatisticsDto.Query dto) { public JsonResponse<List<AdminStatisticsVo.SffbVo.DlVo>> querySfStatistics(@RequestBody @Validated StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.querySfStatistics(dto)); return JsonResponse.ok(statisticsService.querySfStatistics(dto));
} }
@ApiOperation("失访统计") @ApiOperation("失访统计")
@PostMapping("/sftj") @PostMapping("/sftj")
@DataSource(DataSourceType.MASTER)
public JsonResponse<List<AdminStatisticsVo.SftjVo>> querySfTjStatistics(@RequestBody @Validated StatisticsDto.Query dto) { public JsonResponse<List<AdminStatisticsVo.SftjVo>> querySfTjStatistics(@RequestBody @Validated StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.querySfTjStatistics(dto)); return JsonResponse.ok(statisticsService.querySfTjStatistics(dto));
} }

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

@ -6,12 +6,14 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import com.acupuncture.common.annotation.Anonymous; import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.config.RuoYiConfig; import com.acupuncture.common.config.RuoYiConfig;
import com.acupuncture.common.core.domain.AjaxResult; 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.redis.RedisCache; import com.acupuncture.common.core.redis.RedisCache;
import com.acupuncture.common.core.text.Convert; import com.acupuncture.common.core.text.Convert;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.common.exception.base.BaseException; import com.acupuncture.common.exception.base.BaseException;
import com.acupuncture.common.utils.file.FileUploadUtils; import com.acupuncture.common.utils.file.FileUploadUtils;
import com.acupuncture.common.utils.file.FileUtils; import com.acupuncture.common.utils.file.FileUtils;
@ -61,6 +63,7 @@ public class ExternalController {
@Anonymous @Anonymous
@ApiOperation("获取人员信息") @ApiOperation("获取人员信息")
@GetMapping("/http/getUserInfo") @GetMapping("/http/getUserInfo")
@DataSource(DataSourceType.MASTER)
public Object test(@RequestParam("from") String from, @RequestParam("memberid") String memberid) { public Object test(@RequestParam("from") String from, @RequestParam("memberid") String memberid) {
log.info("获取人员信息:{},{}",from, memberid); log.info("获取人员信息:{},{}",from, memberid);
checkoutData(from); checkoutData(from);

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

@ -57,6 +57,17 @@ public class ScreeningController {
return JsonResponse.ok(screeningService.queryDetailByPage(param.getParam(), param.getPageNum(), param.getPageSize())); return JsonResponse.ok(screeningService.queryDetailByPage(param.getParam(), param.getPageNum(), param.getPageSize()));
} }
@ApiOperation(value = "查询筛查列表", notes = "原:查询医院是否填写了调查筛查")
@RequestMapping(value = "/queryDetailNoToken", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<PageInfo<ScrScreenVo.Result>> queryDetailNoToken(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.Query> param) {
log.info("查询筛查列表");
if (param.getPageNum() > 0) {
PageHelper.startPage(param.getPageNum(), param.getPageSize());
}
return JsonResponse.ok(screeningService.queryDetailByPageNoToken(param.getParam(), param.getPageNum(), param.getPageSize()));
}
@ApiOperation(value = "后台查询筛查列表", notes = "原:查询医院是否填写了调查筛查") @ApiOperation(value = "后台查询筛查列表", notes = "原:查询医院是否填写了调查筛查")
@RequestMapping(value = "/admin/queryDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @RequestMapping(value = "/admin/queryDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<PageInfo<ScrScreenVo.Result>> adminQueryDetail(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.Query> param) { public JsonResponse<PageInfo<ScrScreenVo.Result>> adminQueryDetail(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.Query> param) {
@ -87,7 +98,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 {

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

@ -1,211 +0,0 @@
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; 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;

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

@ -6,7 +6,9 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.annotation.Anonymous; import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.common.core.redis.RedisCache;
import com.acupuncture.common.enums.DataSourceType;
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
import com.acupuncture.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.dto.FmsFollowupDto;
import com.acupuncture.system.domain.po.FmsFollowupTask; import com.acupuncture.system.domain.po.FmsFollowupTask;
@ -48,7 +50,7 @@ import java.util.stream.Collectors;
@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
@ -76,199 +78,165 @@ public class TaskController {
//查询从库队列 //查询从库队列
//1. 查询队列 //1. 查询队列
List<FmsFollowupVo.FollowupQueueVO> slavelQueueList = fmsFollowupDao.selectQueueList(null, null, null, null); List<FmsFollowupVo.FollowupQueueVO> slavelQueueList = fmsFollowupDao.selectQueueList(null, null, null, null);
log.info("sa:{}", slavelQueueList);
//合并公共队列和从库的队列 // //合并公共队列和从库的队列
slavelQueueList.addAll(commonQueue); slavelQueueList.addAll(commonQueue);
//查询每个队列的对象 //查询每个队列的对象
for (FmsFollowupVo.FollowupQueueVO queue : slavelQueueList) { for (FmsFollowupVo.FollowupQueueVO followupQueueVO : slavelQueueList) {
FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO(); FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO();
followupPatientQueryDTO.setQueueId(queue.getId()); followupPatientQueryDTO.setQueueId(followupQueueVO.getId());
followupPatientQueryDTO.setTenantId(queue.getTenantId()); followupPatientQueryDTO.setTenantId(followupQueueVO.getTenantId());
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO); List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO);
log.info("查询每个队列的对象:{}", patientList); log.info("查询每个队列的对象:{}", patientList);
if (CollectionUtil.isEmpty(patientList)) {
continue;
}
Integer followWindowAdys = followupQueueVO.getFollowWindowAdys();
//随访总月数
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();
}finally {
if (CollectionUtil.isEmpty(dateList)) {
continue;
}
}
//3. 判断随访类型
if (followupQueueVO.getFollowupType() == 0) {
//单次
//判断是否已有该次随访
FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
fmsFollowupTaskExample.createCriteria().andTimesEqualTo(1).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId());
List<FmsFollowupTask> fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample);
if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) {
continue;
}
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);
//计算第一次随访的时间
DateComparator dateComparator = getDate(dateList);
if (dateComparator.getDate() != null) {
fmsFollowupTask.setStartTime(dateComparator.getDate());
} else {
Calendar instance = Calendar.getInstance();
instance.setTime(dateList.get(0));
instance.add(Calendar.DATE, -followWindowAdys / 2);
fmsFollowupTask.setStartTime(instance.getTime());
} }
Calendar instance1 = Calendar.getInstance();
instance1.setTime(dateList.get(0));
instance1.add(Calendar.DATE, followWindowAdys / 2);
fmsFollowupTask.setEndTime(instance1.getTime());
fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
fmsFollowupTask.setFollowupTime(dateList.get(0));
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
} else {
//周期
//4. 根据频次和总月数添加
DateComparator dateComparator = getDate(dateList);
if (dateComparator.getDate() == null || dateComparator.getIndex() == null) {
continue;
}
Date date = dateComparator.getDate();
Integer index = dateComparator.getIndex();
//定时任务 //判断是否已有该次随访
FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
fmsFollowupTaskExample.createCriteria().andTimesEqualTo(index).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId());
List<FmsFollowupTask> fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample);
if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) {
continue;
}
// //循环租户 FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
// for (UmsDataSourceVo.Result tenant : tenantList) { BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
// if ("MASTER".equals(tenant.getDataSourceKey())) { fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
// continue; fmsFollowupTask.setName(followupPatient.getName());
// } fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
// changeDataSource(tenant); fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
// { fmsFollowupTask.setGender(followupPatient.getGender());
// //获取随访患者列表,根据患者出院日时间和队列添加工单 if (followupPatient.getBirthDate() != null) {
// //1. 查询队列 fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
// List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null, null);
//
// if (CollectionUtil.isEmpty(queueList)) {
// queueList = followupQueueVOS;
// } else {
// if (CollectionUtil.isEmpty(followupQueueVOS)) {
// queueList.addAll(followupQueueVOS);
// }
// }
// for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) {
// Integer followWindowAdys = followupQueueVO.getFollowWindowAdys();
//
// //2. 查询队列随访患者列表
//// changeDataSource(result);
// FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO();
// followupPatientQueryDTO.setQueueId(followupQueueVO.getId());
// followupPatientQueryDTO.setTenantId(followupQueueVO.getTenantId());
// changeDataSource(result);
//
// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO);
//// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), null, null);
// 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) {
// //单次
//
// //判断是否已有该次随访
// FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
// fmsFollowupTaskExample.createCriteria().andTimesEqualTo(1).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId());
// List<FmsFollowupTask> fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample);
// if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) {
// continue;
// }
// 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);
//
// //计算第一次随访的时间
// DateComparator dateComparator = getDate(dateList);
// if (dateComparator.getDate() != null) {
// fmsFollowupTask.setStartTime(dateComparator.getDate());
// } else {
// Calendar instance = Calendar.getInstance();
// instance.setTime(dateList.get(0));
// instance.add(Calendar.DATE, -followWindowAdys / 2);
// fmsFollowupTask.setStartTime(instance.getTime());
// }
// Calendar instance1 = Calendar.getInstance();
// instance1.setTime(dateList.get(0));
// instance1.add(Calendar.DATE, followWindowAdys / 2);
// fmsFollowupTask.setEndTime(instance1.getTime());
// fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
// fmsFollowupTask.setFollowupTime(dateList.get(0));
// changeDataSource(result);
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
//
// } else {
// //周期
// //4. 根据频次和总月数添加
// DateComparator dateComparator = getDate(dateList);
// if (dateComparator.getDate() == null || dateComparator.getIndex() == null) {
// continue;
// }
// Date date = dateComparator.getDate();
// Integer index = dateComparator.getIndex();
//
// //判断是否已有该次随访
// FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
// fmsFollowupTaskExample.createCriteria().andTimesEqualTo(index).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId());
// List<FmsFollowupTask> fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample);
// if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) {
// continue;
// }
//
// 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(index);
// 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);
// Calendar instance = Calendar.getInstance();
// instance.setTime(date);
// instance.add(Calendar.DATE, followWindowAdys / 2);
//
// fmsFollowupTask.setEndTime(instance.getTime());
// changeDataSource(result);
// fmsFollowupTask.setPatientId(followupPatient.getId());
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
// }
// }
// }
//
// }
// }
} }
fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setTimes(index);
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);
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.add(Calendar.DATE, followWindowAdys / 2);
fmsFollowupTask.setEndTime(instance.getTime());
fmsFollowupTask.setPatientId(followupPatient.getId());
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
}
}
}
}
@DataSource(DataSourceType.MASTER)
@ApiOperation("定时任务添加随访工单") @ApiOperation("定时任务添加随访工单")
@PostMapping("/task") @PostMapping("/task")
@Scheduled(cron = "0 0 0 * * ?") @Scheduled(cron = "0 0 0 * * 1")
@Anonymous @Anonymous
public void task() { public void task() {
// TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 ) // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )
//查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单 //查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
List<UmsDataSourceVo.Result> tenantList = umsDataSourceDao.query(null); List<UmsDataSourceVo.Result> tenantList = umsDataSourceDao.query1(null);
if (CollectionUtil.isEmpty(tenantList)) { if (CollectionUtil.isEmpty(tenantList)) {
return; return;
} }
@ -293,10 +261,6 @@ public class TaskController {
} }
private static void changeDataSource(UmsDataSourceVo.Result result) {
DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
}
/** /**
* 法用于计算在指定时间范围内触发器的触发时间点具体步骤如下 * 法用于计算在指定时间范围内触发器的触发时间点具体步骤如下
* 初始化一个空列表 lst 存储触发时间点 * 初始化一个空列表 lst 存储触发时间点

5
acupuncture-admin/src/main/resources/application.yml

@ -48,6 +48,11 @@ user:
# Spring配置 # Spring配置
spring: spring:
jpa:
show-sql: true
properties:
hibernate:
format_sql: true
# 资源信息 # 资源信息
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径

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()
{ {

22
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,11 +49,15 @@ 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);
} }
}catch (Exception e){
throw new BaseException(StrUtil.format("获取数据源错误:{}", e));
}
try { try {
return point.proceed(); return point.proceed();
@ -72,25 +74,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;
}
} }

3
acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/DataSourceAspect.java

@ -28,8 +28,7 @@ public class DataSourceAspect
protected Logger logger = LoggerFactory.getLogger(getClass()); protected Logger logger = LoggerFactory.getLogger(getClass());
@Pointcut("@annotation(com.acupuncture.common.annotation.DataSource)" @Pointcut("@annotation(com.acupuncture.common.annotation.DataSource)"
+ "|| @within(com.acupuncture.common.annotation.DataSource)" + + "|| @within(com.acupuncture.common.annotation.DataSource)")
"|| within(com.acupuncture.web.task.TaskController)")
public void dsPointCut() public void dsPointCut()
{ {

2
acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java

@ -114,7 +114,7 @@ public class SecurityConfig
.authorizeHttpRequests((requests) -> { .authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login", "/register", "/captchaImage", "/web/login", "/web/queryTenantById", "/api/http/getUserInfo", "/api/http/addReportImage", "/api/http/uploadMemberInfo", "/task/task").permitAll() requests.antMatchers("/login", "/register", "/captchaImage", "/web/login", "/web/queryTenantById", "/api/http/getUserInfo", "/api/http/addReportImage", "/api/http/uploadMemberInfo", "/task/task", "/loginSimple", "/screening/queryDetailNoToken").permitAll()
// 静态资源,可匿名访问 // 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**", "/static/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**", "/static/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

47
acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/SysLoginService.java

@ -100,6 +100,53 @@ public class SysLoginService
return tokenService.createToken(loginUser); return tokenService.createToken(loginUser);
} }
/**
* 登录验证
*
* @param username 用户名
* @param password 密码
* @param code 验证码
* @param uuid 唯一标识
* @return 结果
*/
public String loginSimple(String username, String password, String code, String uuid)
{
// 验证码校验
// validateCaptcha(username, code, uuid);
// 登录前置校验
loginPreCheck(username, password);
// 用户验证
Authentication authentication = null;
try
{
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);
}
catch (Exception e)
{
if (e instanceof BadCredentialsException)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
else
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
}
finally
{
AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createToken(loginUser);
}
/** /**
* 登录验证 * 登录验证
* *

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) public String login(String username, String password, String code, String uuid)
{ {
// 验证码校验 // 验证码校验
validateCaptcha(username, code, uuid); // validateCaptcha(username, code, uuid);
// 登录前置校验 // 登录前置校验
loginPreCheck(username, password); loginPreCheck(username, password);
// 用户验证 // 用户验证

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;

7
acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java

@ -123,6 +123,7 @@ public class FmsFollowupVo {
private Date updateTime; private Date updateTime;
private String remark; private String remark;
private String queueName; private String queueName;
private Long queueId;
private String tenantName; private String tenantName;
@ApiModelProperty("随访窗口期") @ApiModelProperty("随访窗口期")
private Integer followWindowAdys; private Integer followWindowAdys;
@ -132,6 +133,9 @@ public class FmsFollowupVo {
public Integer getStatus() { public Integer getStatus() {
if (status == null) {
return 0;
}
if (status == 2){ if (status == 2){
return status; return status;
} }
@ -143,6 +147,9 @@ public class FmsFollowupVo {
return 4; return 4;
} }
if (startTime != null) { if (startTime != null) {
if (remindTime == null) {
return status;
}
//判断是否临近随访时间 开始时间 + 临近提醒时间 < 当前时间 //判断是否临近随访时间 开始时间 + 临近提醒时间 < 当前时间
Calendar instance = Calendar.getInstance(); Calendar instance = Calendar.getInstance();
instance.setTime(startTime); instance.setTime(startTime);

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

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

1
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminDataSourceDao.java

@ -23,7 +23,6 @@ public interface AdminDataSourceDao {
* @param dto * @param dto
* @return * @return
*/ */
@DataSource(value = DataSourceType.MASTER)
List<AdminDataSourceVo.Result> query(@Param("query") AdminDataSourceDto.Query dto, List<AdminDataSourceVo.Result> query(@Param("query") AdminDataSourceDto.Query dto,
@Param("userId") Long userId, @Param("userId") Long userId,
@Param("tenantId")Long tenantId); @Param("tenantId")Long tenantId);

17
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java

@ -25,7 +25,6 @@ public interface AdminTongjiDao {
* @param tenantId * @param tenantId
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.PatientVo.GenderVo queryGenderStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.PatientVo.GenderVo queryGenderStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@ -36,53 +35,37 @@ public interface AdminTongjiDao {
* @param tenantId * @param tenantId
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.PatientVo.AgeVo queryAgeStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.PatientVo.AgeVo queryAgeStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.PatientVo.JwbzVo queryJwbzStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.PatientVo.JwbzVo queryJwbzStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
List<String> queryZyzdStatistics(@Param("dto") StatisticsDto.Query dto, List<String> queryZyzdStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
Integer queryTotalPatient(@Param("dto") StatisticsDto.Query dto, Integer queryTotalPatient(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.TreamentVo.TxfbVo queryTxfbStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.TreamentVo.TxfbVo queryTxfbStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.TreamentVo.ZytzVo queryZytzStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.TreamentVo.ZytzVo queryZytzStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.ZlTypeVo.Zllxtj queryZllxtjStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.ZlTypeVo.Zllxtj queryZllxtjStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.ZlTypeVo.BzfffbVo.Fpz queryFpzStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.ZlTypeVo.BzfffbVo.Fpz queryFpzStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.ZlTypeVo.ZlxgVo queryZlxgStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.ZlTypeVo.ZlxgVo queryZlxgStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.ZlTypeVo.ZlfyVo queryZlfyStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.ZlTypeVo.ZlfyVo queryZlfyStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
List<AdminStatisticsVo.SftjVo> querySftjStatistics(@Param("dto") StatisticsDto.Query dto, List<AdminStatisticsVo.SftjVo> querySftjStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
List<AdminStatisticsVo.SffbVo.DlVo> querySfStatistics(@Param("dto") StatisticsDto.Query dto, List<AdminStatisticsVo.SffbVo.DlVo> querySfStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.TreamentVo.TtfbVo queryTtfbStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.TreamentVo.TtfbVo queryTtfbStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.TreamentVo.SmfbVo querySmfbStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.TreamentVo.SmfbVo querySmfbStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.TreamentVo.JlfbVo queryJlfbStatistics(@Param("dto") StatisticsDto.Query dto, AdminStatisticsVo.TreamentVo.JlfbVo queryJlfbStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
AdminStatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); AdminStatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId);
List<String> queryTxStatistics(@Param("dto") StatisticsDto.Query dto, List<String> queryTxStatistics(@Param("dto") StatisticsDto.Query dto,

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

@ -16,7 +16,6 @@ import org.apache.ibatis.annotations.Param;
*/ */
public interface DmsUserDao { public interface DmsUserDao {
@DataSource(DataSourceType.MASTER)
DmsTenant queryById(@Param("id") Long id); DmsTenant queryById(@Param("id") Long id);
/** /**

10
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java

@ -22,10 +22,8 @@ public interface FmsFollowupDao {
* @param name * @param name
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(@Param("name") String name); List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(@Param("name") String name);
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupQueueVO> queryAll(@Param("name") String name, List<FmsFollowupVo.FollowupQueueVO> queryAll(@Param("name") String name,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@ -44,13 +42,6 @@ public interface FmsFollowupDao {
@Param("haveQueue")Integer haveQueue, @Param("haveQueue")Integer haveQueue,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupPatient> queryTaskPatient(@Param("id") Long id,
@Param("taskFlag") Byte taskFlag,
@Param("haveQueue")Integer haveQueue,
@Param("tenantId") Long tenantId,
@Param("dataScore") String dataScore);
List<FmsFollowupVo.FollowupPatient> adminQueryPatient(@Param("id") Long id, List<FmsFollowupVo.FollowupPatient> adminQueryPatient(@Param("id") Long id,
@Param("taskFlag") Byte taskFlag, @Param("taskFlag") Byte taskFlag,
@Param("haveQueue")Integer haveQueue, @Param("haveQueue")Integer haveQueue,
@ -83,6 +74,5 @@ public interface FmsFollowupDao {
List<PmsTreatmentVo.TreatmentVO.QueueVo> queryQueueListByPatientId(@Param("patientId") Long patientId); List<PmsTreatmentVo.TreatmentVO.QueueVo> queryQueueListByPatientId(@Param("patientId") Long patientId);
@DataSource(DataSourceType.MASTER)
List<PmsTreatmentVo.TreatmentVO.QueueVo> adminQueryQueueListByPatientId(@Param("patientId") Long patientId); List<PmsTreatmentVo.TreatmentVO.QueueVo> adminQueryQueueListByPatientId(@Param("patientId") Long patientId);
} }

1
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsPatientDao.java

@ -20,7 +20,6 @@ public interface PmsPatientDao {
List<PmsPatientVo.PatientResult> query(@Param("query") PmsPatientDto.PatientQuery query); List<PmsPatientVo.PatientResult> query(@Param("query") PmsPatientDto.PatientQuery query);
@DataSource(DataSourceType.MASTER)
List<PmsPatientVo.PatientResult> adminQuery(@Param("query") PmsPatientDto.PatientQuery query); List<PmsPatientVo.PatientResult> adminQuery(@Param("query") PmsPatientDto.PatientQuery query);
void batchInsert(@Param("pmsPatientList") List<PmsPatient> pmsPatientList); void batchInsert(@Param("pmsPatientList") List<PmsPatient> pmsPatientList);
} }

5
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java

@ -25,14 +25,9 @@ public interface PmsTreatmentDao {
List<PmsTreatmentVo.TreatmentRecord> selectRecord(@Param("treatmentId") Long treatmentId, List<PmsTreatmentVo.TreatmentRecord> selectRecord(@Param("treatmentId") Long treatmentId,
@Param("codeList") List<String> codeList); @Param("codeList") List<String> codeList);
@DataSource(DataSourceType.MASTER)
List<PmsTreatmentVo.TreatmentRecord> adminSelectRecord(@Param("treatmentId") Long treatmentId, List<PmsTreatmentVo.TreatmentRecord> adminSelectRecord(@Param("treatmentId") Long treatmentId,
@Param("codeList") List<String> codeList); @Param("codeList") List<String> codeList);
// void batchInsert(@Param("pmsPatientList") List<PmsPatient> pmsPatientList);
@DataSource(DataSourceType.MASTER)
List<PmsTreatmentVo.TreatmentVO> adminQuery(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query); List<PmsTreatmentVo.TreatmentVO> adminQuery(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query);
@DataSource(DataSourceType.MASTER)
PmsTreatmentVo.TreatmentRecordVO adminQueryTreatment(@Param("id") Long id); PmsTreatmentVo.TreatmentRecordVO adminQueryTreatment(@Param("id") Long id);
} }

1
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java

@ -42,7 +42,6 @@ public interface ScreeningDetailDao extends ScrScreeningDetailMapper {
@Param("type") Byte type, @Param("type") Byte type,
@Param("param") ScreeningDto.Query param); @Param("param") ScreeningDto.Query param);
@DataSource(DataSourceType.MASTER)
List<ScrScreenVo.Result> adminQueryResult(@Param("detailId") Long detailId, List<ScrScreenVo.Result> adminQueryResult(@Param("detailId") Long detailId,
@Param("type") Byte type, @Param("type") Byte type,
@Param("param") ScreeningDto.Query param); @Param("param") ScreeningDto.Query param);

3
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java

@ -14,8 +14,9 @@ import java.util.List;
* @description: * @description:
*/ */
public interface UmsDataSourceDao { public interface UmsDataSourceDao {
@DataSource(DataSourceType.MASTER) @DataSource(DataSourceType.MASTER)
List<UmsDataSourceVo.Result> query(@Param("tenantId") Long tenantId); List<UmsDataSourceVo.Result> query(@Param("tenantId") Long tenantId);
List<UmsDataSourceVo.Result> query1(@Param("tenantId") Long tenantId);
} }

2
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java

@ -9,7 +9,6 @@ import java.util.List;
public interface WxQrCodeDao { public interface WxQrCodeDao {
@DataSource(DataSourceType.MASTER)
AmsWxQrCodeVo.Result queryById(@Param("id")Long id); AmsWxQrCodeVo.Result queryById(@Param("id")Long id);
/** /**
@ -28,7 +27,6 @@ public interface WxQrCodeDao {
@Param("userId") Long userId, @Param("userId") Long userId,
@Param("tenantId") Long tenantId); @Param("tenantId") Long tenantId);
@DataSource(DataSourceType.MASTER)
List<AmsWxQrCodeVo.ScreenResult> adminSelectScreenList(@Param("hospitalIdList") List<Long> hospitalIdList); List<AmsWxQrCodeVo.ScreenResult> adminSelectScreenList(@Param("hospitalIdList") List<Long> hospitalIdList);

11
acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java

@ -19,7 +19,6 @@ public interface AdminFmsFollowupQueueService {
* 查询公共队列 * 查询公共队列
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(String name, Long tenantId); List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(String name, Long tenantId);
/** /**
@ -27,7 +26,6 @@ public interface AdminFmsFollowupQueueService {
* @param dto * @param dto
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER)
int addQueue(FmsFollowupDto.Add dto); int addQueue(FmsFollowupDto.Add dto);
/** /**
@ -35,7 +33,6 @@ public interface AdminFmsFollowupQueueService {
* @param dto * @param dto
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER)
int updQueue(FmsFollowupDto.Upd dto); int updQueue(FmsFollowupDto.Upd dto);
/** /**
@ -43,16 +40,8 @@ public interface AdminFmsFollowupQueueService {
* @param dto * @param dto
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER)
int delQueue(FmsFollowupDto.Del dto); int delQueue(FmsFollowupDto.Del dto);
/**
* 查询随访患者
* @param dto
* @return
*/
List<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto);
/** /**
* 查询随访患者 * 查询随访患者
* @param dto * @param dto

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

@ -51,14 +51,6 @@ public interface FmsFollowupService {
*/ */
List<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto); List<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto);
/**
* 查询随访患者
* @param dto
* @return
*/
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupPatient> queryTaskPatient(FmsFollowupDto.FollowupPatientQueryDTO dto);
/** /**
* 更新随访患者 * 更新随访患者
* @param dto * @param dto
@ -79,7 +71,6 @@ public interface FmsFollowupService {
* @param dto * @param dto
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupTaskVO> adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto); List<FmsFollowupVo.FollowupTaskVO> adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto);
/** /**
* 标记为失访 * 标记为失访

2
acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java

@ -28,6 +28,8 @@ public interface IScreeningService {
PageInfo<ScrScreenVo.Result> adminQueryDetailByPage(ScreeningDto.Query param, Integer pageNum, Integer pageSize); PageInfo<ScrScreenVo.Result> adminQueryDetailByPage(ScreeningDto.Query param, Integer pageNum, Integer pageSize);
PageInfo<ScrScreenVo.Result> queryDetailByPageNoToken(ScreeningDto.Query param, Integer pageNum, Integer pageSize);
/** /**
* *
* 保存问卷调查信息 * 保存问卷调查信息

39
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java

@ -40,13 +40,11 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe
private FmsFollowupQueueMapper fmsFollowupQueueMapper; private FmsFollowupQueueMapper fmsFollowupQueueMapper;
@Override @Override
@DataSource(DataSourceType.MASTER)
public List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(String name, Long tenantId) { public List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(String name, Long tenantId) {
return fmsFollowupDao.queryAll(name, tenantId); return fmsFollowupDao.queryAll(name, tenantId);
} }
@Override @Override
@DataSource(DataSourceType.MASTER)
public int addQueue(FmsFollowupDto.Add dto) { public int addQueue(FmsFollowupDto.Add dto) {
FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class); FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class);
fmsFollowupQueue.setId(IdUtil.getSnowflakeNextId()); fmsFollowupQueue.setId(IdUtil.getSnowflakeNextId());
@ -57,7 +55,6 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe
} }
@Override @Override
@DataSource(DataSourceType.MASTER)
public int updQueue(FmsFollowupDto.Upd dto) { public int updQueue(FmsFollowupDto.Upd dto) {
FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class); FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class);
fmsFollowupQueue.setUpdateBy(SecurityUtils.getUsername()); fmsFollowupQueue.setUpdateBy(SecurityUtils.getUsername());
@ -66,7 +63,6 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe
} }
@Override @Override
@DataSource(DataSourceType.MASTER)
public int delQueue(FmsFollowupDto.Del dto) { public int delQueue(FmsFollowupDto.Del dto) {
FmsFollowupQueueExample fmsFollowupQueueExample = new FmsFollowupQueueExample(); FmsFollowupQueueExample fmsFollowupQueueExample = new FmsFollowupQueueExample();
fmsFollowupQueueExample.createCriteria().andIdIn(dto.getIdList()); fmsFollowupQueueExample.createCriteria().andIdIn(dto.getIdList());
@ -75,41 +71,6 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe
return fmsFollowupQueueMapper.updateByExampleSelective(fmsFollowupQueue, fmsFollowupQueueExample); return fmsFollowupQueueMapper.updateByExampleSelective(fmsFollowupQueue, fmsFollowupQueueExample);
} }
@Override
public List<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) {
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.queryPatient(dto.getQueueId(), null, dto.getHaveQueue(), SecurityUtils.getTenantId());
if (CollectionUtil.isNotEmpty(followupPatients)) {
List<Object> commonFollowupQueue = redisCache.getCacheList("common_followup_queue");
for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) {
if (CollectionUtil.isNotEmpty(followupPatient.getQueueList())) {
List<PmsTreatmentVo.TreatmentVO.QueueVo> queueVos = fmsFollowupDao.adminQueryQueueListByPatientId(followupPatient.getPatientId());
List<FmsFollowupVo.FollowupPatient.QueueVo> queueVoList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(queueVos)) {
queueVoList = BeanUtil.copyToList(queueVos, FmsFollowupVo.FollowupPatient.QueueVo.class);
Map<Long, FmsFollowupVo.FollowupQueueVO> map = new HashMap<>();
if (CollectionUtil.isNotEmpty(commonFollowupQueue)) {
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class);
map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
}
for (FmsFollowupVo.FollowupPatient.QueueVo queueVo : queueVoList) {
if (queueVo == null || queueVo.getQueueId() == null) {
continue;
}
FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId());
if (followupQueueVO != null) {
queueVo.setQueueName(followupQueueVO.getName());
}
}
}
followupPatient.setQueueList(queueVoList);
}
}
}
return followupPatients;
}
@Override @Override
public List<FmsFollowupVo.FollowupPatient> adminQueryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) { public List<FmsFollowupVo.FollowupPatient> adminQueryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) {
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.adminQueryPatient(dto.getQueueId(), null, dto.getHaveQueue(), dto.getTenantId()); List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.adminQueryPatient(dto.getQueueId(), null, dto.getHaveQueue(), dto.getTenantId());

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);

54
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java

@ -3,6 +3,7 @@ package com.acupuncture.system.service.impl;
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.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.common.core.redis.RedisCache;
import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.common.enums.DataSourceType;
@ -15,6 +16,7 @@ import com.acupuncture.system.persist.dao.FmsFollowupDao;
import com.acupuncture.system.persist.mapper.FmsFollowupQueueMapper; import com.acupuncture.system.persist.mapper.FmsFollowupQueueMapper;
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 com.acupuncture.system.service.FmsFollowupQueueService;
import com.acupuncture.system.service.FmsFollowupService; import com.acupuncture.system.service.FmsFollowupService;
import org.quartz.TriggerUtils; import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl; import org.quartz.impl.triggers.CronTriggerImpl;
@ -48,6 +50,8 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
private RedisCache redisCache; private RedisCache redisCache;
@Resource @Resource
private FmsFollowupTaskMapper fmsFollowupTaskMapper; private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Resource
private FmsFollowupQueueService fmsFollowupQueueService;
@Override @Override
public List<FmsFollowupVo.FollowupQueueVO> queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) { public List<FmsFollowupVo.FollowupQueueVO> queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) {
@ -127,42 +131,6 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
return followupPatients; return followupPatients;
} }
@Override
@DataSource(DataSourceType.MASTER)
public List<FmsFollowupVo.FollowupPatient> queryTaskPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) {
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.queryTaskPatient(dto.getQueueId(), null, dto.getHaveQueue(), dto.getTenantId(), dto.getDataScore());
if (CollectionUtil.isNotEmpty(followupPatients)) {
List<Object> commonFollowupQueue = redisCache.getCacheList("common_followup_queue");
for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) {
if (CollectionUtil.isNotEmpty(followupPatient.getQueueList())) {
List<PmsTreatmentVo.TreatmentVO.QueueVo> queueVos = fmsFollowupDao.queryQueueListByPatientId(followupPatient.getPatientId());
List<FmsFollowupVo.FollowupPatient.QueueVo> queueVoList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(queueVos)) {
queueVoList = BeanUtil.copyToList(queueVos, FmsFollowupVo.FollowupPatient.QueueVo.class);
Map<Long, FmsFollowupVo.FollowupQueueVO> map = new HashMap<>();
if (CollectionUtil.isNotEmpty(commonFollowupQueue)) {
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class);
map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
}
for (FmsFollowupVo.FollowupPatient.QueueVo queueVo : queueVoList) {
if (queueVo == null || queueVo.getQueueId() == null) {
continue;
}
FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId());
if (followupQueueVO != null) {
queueVo.setQueueName(followupQueueVO.getName());
}
}
}
followupPatient.setQueueList(queueVoList);
}
}
}
return followupPatients;
}
@Override @Override
public Integer updPatient(FmsFollowupDto.UpdPatient dto) { public Integer updPatient(FmsFollowupDto.UpdPatient dto) {
FmsPatientQueueRelationExample fmsPatientQueueRelationExample = new FmsPatientQueueRelationExample(); FmsPatientQueueRelationExample fmsPatientQueueRelationExample = new FmsPatientQueueRelationExample();
@ -200,6 +168,20 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
if (CollectionUtil.isEmpty(followupTaskVOS)) { if (CollectionUtil.isEmpty(followupTaskVOS)) {
return CollectionUtil.newArrayList(); return CollectionUtil.newArrayList();
} }
List<Object> commonFollowupQueue = redisCache.getCacheList("common_followup_queue");
// List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS = fmsFollowupQueueService.queryCommonQueue(null);
if (CollectionUtil.isNotEmpty(commonFollowupQueue)) {
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class);
Map<Long, FmsFollowupVo.FollowupQueueVO> map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
for (FmsFollowupVo.FollowupTaskVO followupTaskVO : followupTaskVOS) {
if (StrUtil.isEmpty(followupTaskVO.getQueueName()) && followupTaskVO.getQueueId() != null) {
FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(followupTaskVO.getQueueId());
if (followupQueueVO != null) {
followupTaskVO.setQueueName(followupQueueVO.getName());
}
}
}
}
return followupTaskVOS; return followupTaskVOS;
} }

16
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java

@ -335,6 +335,22 @@ public class ScreeningServiceImpl implements IScreeningService {
return new PageInfo<>(results); return new PageInfo<>(results);
} }
@Override
public PageInfo<ScrScreenVo.Result> queryDetailByPageNoToken(ScreeningDto.Query param, Integer pageNum, Integer pageSize) {
List<ScrScreenVo.Result> results = screeningDetailDao.queryResult(null, null, param);
if (CollectionUtil.isNotEmpty(results)) {
List<ScrScreenVo.ScreeningDetailVo> screeningDetailVos = screeningDetailDao.queryDetailList(results.stream().map(ScrScreenVo.Result::getId).collect(Collectors.toList()));
if (CollectionUtil.isNotEmpty(screeningDetailVos)) {
Map<Long, List<ScrScreenVo.ScreeningDetailVo>> map = screeningDetailVos.stream().collect(Collectors.groupingBy(ScrScreenVo.ScreeningDetailVo::getRecordId));
results.forEach(result -> {
result.setDetailList(map.get(result.getId()));
});
}
}
return new PageInfo<>(results);
}
@Override @Override
public void saveQuestionnaire(ScreeningDto.SaveQuestionnaire param, Long userId) throws Exception { public void saveQuestionnaire(ScreeningDto.SaveQuestionnaire param, Long userId) throws Exception {
//redis判断是否已有 //redis判断是否已有

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

@ -47,7 +47,7 @@ public class SysConfigServiceImpl implements ISysConfigService
* @return 参数配置信息 * @return 参数配置信息
*/ */
@Override @Override
@DataSource(DataSourceType.MASTER)
public SysConfig selectConfigById(Long configId) public SysConfig selectConfigById(Long configId)
{ {
SysConfig config = new SysConfig(); SysConfig config = new SysConfig();

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

@ -99,6 +99,9 @@
<if test="param.startAge != null and param.endAge != ''"> <if test="param.startAge != null and param.endAge != ''">
and r.age between #{param.startAge} and #{param.endAge} and r.age between #{param.startAge} and #{param.endAge}
</if> </if>
<if test="param.phone != null and param.phone != ''">
and r.phone = #{param.phone}
</if>
</where> </where>
-- group by r.id -- group by r.id
order by r.create_time desc order by r.create_time desc

26
acupuncture-system/src/main/resources/mapper/dao/UmsDataSourceDao.xml

@ -28,4 +28,30 @@
t.id t.id
</select> </select>
<select id="query1" resultType="com.acupuncture.system.domain.vo.UmsDataSourceVo$Result">
select
t.id as tenantId,
t.name,
s.id,
s.data_source_key as dataSourceKey,
s.hospital_id as hospitalId,
s.url,
s.username,
s.password
from
dms_tenant t
left join
ums_data_source s
on t.data_source_id = s.id
where
t.del_flag = 0
and
s.del_flag = 0
<if test="tenantId != null">
and t.id = #{tenantId}
</if>
group by
t.id
</select>
</mapper> </mapper>

Loading…
Cancel
Save