diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysLoginController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysLoginController.java index 9f9672e4..745ac45c 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysLoginController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysLoginController.java @@ -66,6 +66,23 @@ public class SysLoginController 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; + } + /** * 获取用户信息 * diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java index cadf6c79..7777e52a 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java +++ b/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.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.AjaxResult; import com.acupuncture.common.core.domain.BaseDto; import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.core.domain.entity.SysUser; @@ -89,6 +89,7 @@ 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); @@ -104,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()); @@ -138,6 +140,7 @@ public class AdminDmsUserController { //修改从库用户信息 SysUser sysUser = BeanUtil.copyProperties(dto, SysUser.class); + sysUser.setUserId(dto.getId()); sysUser.setPhonenumber(dto.getContactPhone()); userService.updateUser(sysUser); @@ -196,8 +199,4 @@ public class AdminDmsUserController { //只修改主库密码,修改从库密码没有任何意义。 return JsonResponse.ok(adminTenantUserService.resetPwd(dto)); } - - private static void removeDataSource() { - DynamicDataSourceContextHolder.clearDataSourceType(); - } } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java index 4c8ab572..8a56bc2a 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java @@ -1,8 +1,10 @@ package com.acupuncture.web.controller.web; 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.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.vo.FmsFollowupVo; import com.acupuncture.system.service.AdminFmsFollowupQueueService; @@ -36,6 +38,7 @@ public class AdminFmsFollowupController { @ApiOperation("查询队列") @PostMapping("/query") @Anonymous + @DataSource(DataSourceType.MASTER) public JsonResponse> queryCommonQueue(@RequestBody @Validated BaseDto dto) { if (dto.getPageNum() > 0) { PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); @@ -45,6 +48,7 @@ public class AdminFmsFollowupController { @ApiOperation("添加随访队列") @PostMapping("/add") + @DataSource(DataSourceType.MASTER) public JsonResponse addQueue(@RequestBody @Validated FmsFollowupDto.Add dto){ return JsonResponse.ok(fmsFollowupQueueService.addQueue(dto)); } @@ -57,12 +61,14 @@ public class AdminFmsFollowupController { @ApiOperation("删除随访队列") @PostMapping("/del") + @DataSource(DataSourceType.MASTER) public JsonResponse delQueue(@RequestBody @Validated FmsFollowupDto.Del dto){ return JsonResponse.ok(fmsFollowupQueueService.delQueue(dto)); } @ApiOperation("查询随访患者") @PostMapping("/queryPatient") + @DataSource(DataSourceType.MASTER) public JsonResponse> queryPatient(@RequestBody @Validated BaseDto dto) { if (dto.getPageNum() > 0) { PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); @@ -72,6 +78,7 @@ public class AdminFmsFollowupController { @ApiOperation("查询随访任务") @PostMapping("/queryTask") + @DataSource(DataSourceType.MASTER) public JsonResponse> queryTask(@RequestBody @Validated BaseDto dto) { if (dto.getPageNum() > 0) { PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.java index d03c0f0b..79e9634a 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.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.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.dto.PmsPatientDto; import com.acupuncture.system.domain.vo.FmsFollowupVo; @@ -47,6 +49,7 @@ public class AdminPmsPatientController { */ @ApiOperation("查询上报类型") @PostMapping("/list") + @DataSource(DataSourceType.MASTER) public JsonResponse> adminQuery( @RequestBody @Validated BaseDto dto) { if (dto.getPageNum() > 0) { PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); @@ -56,6 +59,7 @@ public class AdminPmsPatientController { @ApiOperation("导出") @PostMapping("/export") + @DataSource(DataSourceType.MASTER) public void adminExportPatient(HttpServletResponse response, @RequestBody @Validated PmsPatientDto.PatientQuery dto) { pmsPatientService.adminExportPatient(response, dto); } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java index d857e193..2f976d16 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.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.framework.datasource.DynamicDataSourceContextHolder; import com.acupuncture.system.domain.dto.PmsTreatmentDto; import com.acupuncture.system.domain.po.DmsTenant; @@ -41,13 +43,10 @@ public class AdminPmsTreatmentController { @Resource private PmsTreatmentService treatmentService; - @Resource - private DmsTenantMapper dmsTenantMapper; - @Resource - private UmsDataSourceMapper umsDataSourceMapper; @ApiOperation("查询诊疗档案") @PostMapping("/list") + @DataSource(DataSourceType.MASTER) public JsonResponse> listTreatment(@RequestBody @Validated BaseDto queryDTO) { if (queryDTO.getPageNum() > 0) { PageHelper.startPage(queryDTO.getPageNum(), queryDTO.getPageSize()); @@ -57,12 +56,14 @@ public class AdminPmsTreatmentController { @ApiOperation("查询诊疗档案数据") @PostMapping("/queryRecord") + @DataSource(DataSourceType.MASTER) public JsonResponse queryRecord(@RequestBody @Validated PmsTreatmentDto.QueryRecord dto) { return JsonResponse.ok(treatmentService.adminQueryRecord(dto.getTreatmentId(), dto.getCodeList())); } @ApiOperation("导出诊疗档案数据") @PostMapping("/exportTreatment") + @DataSource(DataSourceType.MASTER) public void exportTreatment(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.TreatmentQueryDTO dto) { treatmentService.adminExportTreatment(response, dto); } @@ -75,7 +76,6 @@ public class AdminPmsTreatmentController { // } // - // @ApiOperation("导出诊疗档案评估报告") // @PostMapping("/exportTreatmentPg") // public JsonResponse exportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){ diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java index 2b5a8a70..2ec33f90 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java @@ -1,6 +1,8 @@ package com.acupuncture.web.controller.web; +import com.acupuncture.common.annotation.DataSource; 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.vo.AdminStatisticsVo; import com.acupuncture.system.service.AdminStatisticsService; @@ -33,30 +35,35 @@ public class AdminStatisticsController { @ApiOperation("患者统计") @PostMapping("/patientTotal") + @DataSource(DataSourceType.MASTER) public JsonResponse queryPatientStatistics(@RequestBody @Validated StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.queryPatientStatistics(dto)); } @ApiOperation("诊疗统计") @PostMapping("/zlInfo") + @DataSource(DataSourceType.MASTER) public JsonResponse queryZlStatistics(@RequestBody @Validated StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.queryZlStatistics(dto)); } @ApiOperation("治疗类型统计") @PostMapping("/zlType") + @DataSource(DataSourceType.MASTER) public JsonResponse queryZlTypeStatistics(@RequestBody @Validated StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.queryZlTypeStatistics(dto)); } @ApiOperation("随访分布统计") @PostMapping("/sffb") + @DataSource(DataSourceType.MASTER) public JsonResponse> querySfStatistics(@RequestBody @Validated StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.querySfStatistics(dto)); } @ApiOperation("失访统计") @PostMapping("/sftj") + @DataSource(DataSourceType.MASTER) public JsonResponse> querySfTjStatistics(@RequestBody @Validated StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.querySfTjStatistics(dto)); } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java index 404f10fa..dda7802b 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java +++ b/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.json.JSONArray; import com.acupuncture.common.annotation.Anonymous; +import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.config.RuoYiConfig; 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.redis.RedisCache; import com.acupuncture.common.core.text.Convert; +import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.common.exception.base.BaseException; import com.acupuncture.common.utils.file.FileUploadUtils; import com.acupuncture.common.utils.file.FileUtils; @@ -61,6 +63,7 @@ public class ExternalController { @Anonymous @ApiOperation("获取人员信息") @GetMapping("/http/getUserInfo") + @DataSource(DataSourceType.MASTER) public Object test(@RequestParam("from") String from, @RequestParam("memberid") String memberid) { log.info("获取人员信息:{},{}",from, memberid); checkoutData(from); diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java index 7bfe7ebc..aab6bc0e 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java +++ b/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())); } + @ApiOperation(value = "查询筛查列表", notes = "原:查询医院是否填写了调查筛查") + @RequestMapping(value = "/queryDetailNoToken", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse> queryDetailNoToken(@ApiParam @Validated @RequestBody BaseDto 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 = "原:查询医院是否填写了调查筛查") @RequestMapping(value = "/admin/queryDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse> adminQueryDetail(@ApiParam @Validated @RequestBody BaseDto param) { @@ -87,7 +98,6 @@ public class ScreeningController { return JsonResponse.ok(detailInfo); } - @ApiOperation(value = "提交筛查", notes = "") @RequestMapping(value = "/submit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse submitQuestionnaire(@ApiParam @Validated @RequestBody BaseDto params) throws Exception { diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java deleted file mode 100644 index 1a08d188..00000000 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java +++ /dev/null @@ -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 query = umsDataSourceDao.query(null); - if (CollectionUtil.isEmpty(query)) { - return; - } - //查询公共队列 - List queueResults = fmsFollowupDao.queryCommonQueue(null); - //切换数据源 - for (UmsDataSourceVo.Result result : query) { - if ("MASTER".equals(result.getDataSourceKey())) { - continue; - } - changeDataSource(result); - { - //获取随访患者列表,根据患者出院日时间和队列添加工单 - //1. 查询队列 - List 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 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 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(); - } - } -} diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java index f2d2dc90..a053d9f4 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java +++ b/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; diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java index d0a521dc..33a8bf5c 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java +++ b/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.StrUtil; import com.acupuncture.common.annotation.Anonymous; +import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.core.redis.RedisCache; +import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; import com.acupuncture.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.po.FmsFollowupTask; @@ -48,7 +50,7 @@ import java.util.stream.Collectors; @Api(tags = "定时任务相关") @RestController @RequestMapping("/task") -@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +//@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public class TaskController { @Resource @@ -76,199 +78,165 @@ public class TaskController { //查询从库队列 //1. 查询队列 List slavelQueueList = fmsFollowupDao.selectQueueList(null, null, null, null); - - //合并公共队列和从库的队列 + log.info("sa:{}", slavelQueueList); +// //合并公共队列和从库的队列 slavelQueueList.addAll(commonQueue); //查询每个队列的对象 - for (FmsFollowupVo.FollowupQueueVO queue : slavelQueueList) { + for (FmsFollowupVo.FollowupQueueVO followupQueueVO : slavelQueueList) { FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO(); - followupPatientQueryDTO.setQueueId(queue.getId()); - followupPatientQueryDTO.setTenantId(queue.getTenantId()); + followupPatientQueryDTO.setQueueId(followupQueueVO.getId()); + followupPatientQueryDTO.setTenantId(followupQueueVO.getTenantId()); List patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO); 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 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 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 fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample); + if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) { + continue; + } -// //循环租户 -// for (UmsDataSourceVo.Result tenant : tenantList) { -// if ("MASTER".equals(tenant.getDataSourceKey())) { -// continue; -// } -// changeDataSource(tenant); -// { -// //获取随访患者列表,根据患者出院日时间和队列添加工单 -// //1. 查询队列 -// List 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 patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO); -//// List 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 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 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 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 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()); + fmsFollowupTask.setPatientId(followupPatient.getId()); + fmsFollowupTaskMapper.insertSelective(fmsFollowupTask); + } + } + } } + @DataSource(DataSourceType.MASTER) @ApiOperation("定时任务添加随访工单") @PostMapping("/task") - @Scheduled(cron = "0 0 0 * * ?") + @Scheduled(cron = "0 0 0 * * 1") @Anonymous public void task() { // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 ) //查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单 - List tenantList = umsDataSourceDao.query(null); + List tenantList = umsDataSourceDao.query1(null); if (CollectionUtil.isEmpty(tenantList)) { return; } @@ -293,10 +261,6 @@ public class TaskController { } - private static void changeDataSource(UmsDataSourceVo.Result result) { - DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey()); - } - /** * 法用于计算在指定时间范围内触发器的触发时间点。具体步骤如下: * 初始化一个空列表 lst 存储触发时间点。 diff --git a/acupuncture-admin/src/main/resources/application.yml b/acupuncture-admin/src/main/resources/application.yml index 7a586722..40a39b86 100644 --- a/acupuncture-admin/src/main/resources/application.yml +++ b/acupuncture-admin/src/main/resources/application.yml @@ -48,6 +48,11 @@ user: # Spring配置 spring: + jpa: + show-sql: true + properties: + hibernate: + format_sql: true # 资源信息 messages: # 国际化资源文件路径 diff --git a/acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java b/acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java index bd8bafcf..697a56b5 100644 --- a/acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java +++ b/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具有)") private Byte slaverAdmin; + public SysUser() { diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java index beeeaf09..a6a75ed7 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java +++ b/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,14 @@ public class AdminGlobalDataSourceAspect { @Around("dsPointCut()") public Object around(ProceedingJoinPoint point) throws Throwable { - String dataSourceKey = getDataSource(point); - - if (StringUtils.isNotNull(dataSourceKey)) { - DataSourceManager.setDataSourceKey(dataSourceKey); + //获取datasource + try { + String dataSourceKey = getDataSource(point); + if (StringUtils.isNotEmpty(dataSourceKey)) { + DataSourceManager.setDataSourceKey(dataSourceKey); + } + }catch (Exception e){ + throw new BaseException(StrUtil.format("获取数据源错误:{}", e)); } try { @@ -72,25 +74,23 @@ public class AdminGlobalDataSourceAspect { // 获取请求携带的令牌 HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - Long tenantId; + Long tenantId = null; String header = request.getHeader(UserConstants.DEPT); if(StrUtil.isNotEmpty(header)){ tenantId = Long.parseLong(header); }else { - String authHeader = request.getHeader(UserConstants.HEADER_KEY_TOKEN); - if (StrUtil.isEmpty(authHeader)) { - return null; - } - tenantId = SecurityUtils.getTenantId(); - if (tenantId == null) { - return null; + if (StrUtil.isNotEmpty(request.getHeader(UserConstants.HEADER_KEY_TOKEN))) { + tenantId = SecurityUtils.getTenantId(); } } //根据组织ID查询数据源 - UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId); - if (dataSource == null) { - throw new BaseException(DATASOURCE_NOT_FOUND); + if(tenantId !=null) { + UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId); + if (dataSource == null) { + throw new BaseException(DATASOURCE_NOT_FOUND); + } + return dataSource.getDataSourceKey(); } - return dataSource.getDataSourceKey(); + return null; } } diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/DataSourceAspect.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/DataSourceAspect.java index df745c47..1ef9e3fd 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/DataSourceAspect.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/DataSourceAspect.java @@ -28,8 +28,7 @@ public class DataSourceAspect protected Logger logger = LoggerFactory.getLogger(getClass()); @Pointcut("@annotation(com.acupuncture.common.annotation.DataSource)" - + "|| @within(com.acupuncture.common.annotation.DataSource)" + - "|| within(com.acupuncture.web.task.TaskController)") + + "|| @within(com.acupuncture.common.annotation.DataSource)") public void dsPointCut() { diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java index aeb17097..3184d6f1 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java @@ -114,7 +114,7 @@ public class SecurityConfig .authorizeHttpRequests((requests) -> { permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); // 对于登录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("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/SysLoginService.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/SysLoginService.java index 8efafe15..ec76ab47 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/SysLoginService.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/SysLoginService.java @@ -100,6 +100,53 @@ public class SysLoginService 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); + } /** * 登录验证 * diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java index f5a40b40..9f65dacb 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java +++ b/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); // 用户验证 diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java index a6da8464..480e2473 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java @@ -64,11 +64,16 @@ public class AdminTenantUserDto { private String status; private String contactPhone; + @ApiModelProperty("是否具有审核权限(0不具有; 1具有)") private Byte slaverAdmin; } @Data + public static class DeleteDto { + private List idList; + } + @Data public static class Query { private Long tenantId; diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java index d0205ebe..e8ccfd7b 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java @@ -123,6 +123,7 @@ public class FmsFollowupVo { private Date updateTime; private String remark; private String queueName; + private Long queueId; private String tenantName; @ApiModelProperty("随访窗口期") private Integer followWindowAdys; @@ -132,6 +133,9 @@ public class FmsFollowupVo { public Integer getStatus() { + if (status == null) { + return 0; + } if (status == 2){ return status; } @@ -143,6 +147,9 @@ public class FmsFollowupVo { return 4; } if (startTime != null) { + if (remindTime == null) { + return status; + } //判断是否临近随访时间 开始时间 + 临近提醒时间 < 当前时间 Calendar instance = Calendar.getInstance(); instance.setTime(startTime); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java b/acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java index 9acb7743..dbd46b67 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java @@ -27,7 +27,6 @@ public interface SysRoleMapper * @param userId 用户ID * @return 角色列表 */ -// @DataSource(DataSourceType.MASTER) public List selectRolePermissionByUserId(Long userId); /** diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminDataSourceDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminDataSourceDao.java index 59bab50d..153c513d 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminDataSourceDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminDataSourceDao.java @@ -23,7 +23,6 @@ public interface AdminDataSourceDao { * @param dto * @return */ - @DataSource(value = DataSourceType.MASTER) List query(@Param("query") AdminDataSourceDto.Query dto, @Param("userId") Long userId, @Param("tenantId")Long tenantId); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java index 39159e86..85eb828e 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java @@ -25,7 +25,6 @@ public interface AdminTongjiDao { * @param tenantId * @return */ - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.PatientVo.GenderVo queryGenderStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); @@ -36,53 +35,37 @@ public interface AdminTongjiDao { * @param tenantId * @return */ - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.PatientVo.AgeVo queryAgeStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.PatientVo.JwbzVo queryJwbzStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) List queryZyzdStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) Integer queryTotalPatient(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.TreamentVo.TxfbVo queryTxfbStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.TreamentVo.ZytzVo queryZytzStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.ZlTypeVo.Zllxtj queryZllxtjStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.ZlTypeVo.BzfffbVo.Fpz queryFpzStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.ZlTypeVo.ZlxgVo queryZlxgStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.ZlTypeVo.ZlfyVo queryZlfyStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) List querySftjStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) List querySfStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.TreamentVo.TtfbVo queryTtfbStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.TreamentVo.SmfbVo querySmfbStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.TreamentVo.JlfbVo queryJlfbStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) AdminStatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); List queryTxStatistics(@Param("dto") StatisticsDto.Query dto, diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java index 56f59d88..41f0abc0 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java +++ b/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 { - @DataSource(DataSourceType.MASTER) DmsTenant queryById(@Param("id") Long id); /** diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java index 8c5cfaab..9a56bc49 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java @@ -22,10 +22,8 @@ public interface FmsFollowupDao { * @param name * @return */ - @DataSource(DataSourceType.MASTER) List queryCommonQueue(@Param("name") String name); - @DataSource(DataSourceType.MASTER) List queryAll(@Param("name") String name, @Param("tenantId") Long tenantId); @@ -44,13 +42,6 @@ public interface FmsFollowupDao { @Param("haveQueue")Integer haveQueue, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) - List queryTaskPatient(@Param("id") Long id, - @Param("taskFlag") Byte taskFlag, - @Param("haveQueue")Integer haveQueue, - @Param("tenantId") Long tenantId, - @Param("dataScore") String dataScore); - List adminQueryPatient(@Param("id") Long id, @Param("taskFlag") Byte taskFlag, @Param("haveQueue")Integer haveQueue, @@ -83,6 +74,5 @@ public interface FmsFollowupDao { List queryQueueListByPatientId(@Param("patientId") Long patientId); - @DataSource(DataSourceType.MASTER) List adminQueryQueueListByPatientId(@Param("patientId") Long patientId); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsPatientDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsPatientDao.java index 55b4f978..2245b6d6 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsPatientDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsPatientDao.java @@ -20,7 +20,6 @@ public interface PmsPatientDao { List query(@Param("query") PmsPatientDto.PatientQuery query); - @DataSource(DataSourceType.MASTER) List adminQuery(@Param("query") PmsPatientDto.PatientQuery query); void batchInsert(@Param("pmsPatientList") List pmsPatientList); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java index c92171c0..4f73cafd 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java @@ -25,14 +25,9 @@ public interface PmsTreatmentDao { List selectRecord(@Param("treatmentId") Long treatmentId, @Param("codeList") List codeList); - @DataSource(DataSourceType.MASTER) List adminSelectRecord(@Param("treatmentId") Long treatmentId, @Param("codeList") List codeList); -// void batchInsert(@Param("pmsPatientList") List pmsPatientList); - - @DataSource(DataSourceType.MASTER) List adminQuery(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query); - @DataSource(DataSourceType.MASTER) PmsTreatmentVo.TreatmentRecordVO adminQueryTreatment(@Param("id") Long id); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java index 7a3ad41a..ca3c602b 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java +++ b/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("param") ScreeningDto.Query param); - @DataSource(DataSourceType.MASTER) List adminQueryResult(@Param("detailId") Long detailId, @Param("type") Byte type, @Param("param") ScreeningDto.Query param); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java index cc576581..a2366b52 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java @@ -14,8 +14,9 @@ import java.util.List; * @description: */ public interface UmsDataSourceDao { - @DataSource(DataSourceType.MASTER) List query(@Param("tenantId") Long tenantId); + List query1(@Param("tenantId") Long tenantId); + } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java index a6192b03..8f1e6d68 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java @@ -9,7 +9,6 @@ import java.util.List; public interface WxQrCodeDao { - @DataSource(DataSourceType.MASTER) AmsWxQrCodeVo.Result queryById(@Param("id")Long id); /** @@ -28,7 +27,6 @@ public interface WxQrCodeDao { @Param("userId") Long userId, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) List adminSelectScreenList(@Param("hospitalIdList") List hospitalIdList); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java index 0aed8d23..d7099916 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java @@ -19,7 +19,6 @@ public interface AdminFmsFollowupQueueService { * 查询公共队列 * @return */ - @DataSource(DataSourceType.MASTER) List queryCommonQueue(String name, Long tenantId); /** @@ -27,7 +26,6 @@ public interface AdminFmsFollowupQueueService { * @param dto * @return */ - @DataSource(DataSourceType.MASTER) int addQueue(FmsFollowupDto.Add dto); /** @@ -35,7 +33,6 @@ public interface AdminFmsFollowupQueueService { * @param dto * @return */ - @DataSource(DataSourceType.MASTER) int updQueue(FmsFollowupDto.Upd dto); /** @@ -43,16 +40,8 @@ public interface AdminFmsFollowupQueueService { * @param dto * @return */ - @DataSource(DataSourceType.MASTER) int delQueue(FmsFollowupDto.Del dto); - /** - * 查询随访患者 - * @param dto - * @return - */ - List queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto); - /** * 查询随访患者 * @param dto diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java index 0e32835b..51d034ac 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java @@ -51,14 +51,6 @@ public interface FmsFollowupService { */ List queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto); - /** - * 查询随访患者 - * @param dto - * @return - */ - @DataSource(DataSourceType.MASTER) - List queryTaskPatient(FmsFollowupDto.FollowupPatientQueryDTO dto); - /** * 更新随访患者 * @param dto @@ -79,7 +71,6 @@ public interface FmsFollowupService { * @param dto * @return */ - @DataSource(DataSourceType.MASTER) List adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto); /** * 标记为失访 diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java index d7d60e7d..ad64bdd6 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java @@ -28,6 +28,8 @@ public interface IScreeningService { PageInfo adminQueryDetailByPage(ScreeningDto.Query param, Integer pageNum, Integer pageSize); + PageInfo queryDetailByPageNoToken(ScreeningDto.Query param, Integer pageNum, Integer pageSize); + /** * * 保存问卷调查信息 diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java index 58e022ef..1829068e 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java @@ -40,13 +40,11 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe private FmsFollowupQueueMapper fmsFollowupQueueMapper; @Override - @DataSource(DataSourceType.MASTER) public List queryCommonQueue(String name, Long tenantId) { return fmsFollowupDao.queryAll(name, tenantId); } @Override - @DataSource(DataSourceType.MASTER) public int addQueue(FmsFollowupDto.Add dto) { FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class); fmsFollowupQueue.setId(IdUtil.getSnowflakeNextId()); @@ -57,7 +55,6 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe } @Override - @DataSource(DataSourceType.MASTER) public int updQueue(FmsFollowupDto.Upd dto) { FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class); fmsFollowupQueue.setUpdateBy(SecurityUtils.getUsername()); @@ -66,7 +63,6 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe } @Override - @DataSource(DataSourceType.MASTER) public int delQueue(FmsFollowupDto.Del dto) { FmsFollowupQueueExample fmsFollowupQueueExample = new FmsFollowupQueueExample(); fmsFollowupQueueExample.createCriteria().andIdIn(dto.getIdList()); @@ -75,41 +71,6 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe return fmsFollowupQueueMapper.updateByExampleSelective(fmsFollowupQueue, fmsFollowupQueueExample); } - @Override - public List queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) { - List followupPatients = fmsFollowupDao.queryPatient(dto.getQueueId(), null, dto.getHaveQueue(), SecurityUtils.getTenantId()); - if (CollectionUtil.isNotEmpty(followupPatients)) { - List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); - for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) { - if (CollectionUtil.isNotEmpty(followupPatient.getQueueList())) { - - List queueVos = fmsFollowupDao.adminQueryQueueListByPatientId(followupPatient.getPatientId()); - List queueVoList = new ArrayList<>(); - if (CollectionUtil.isNotEmpty(queueVos)) { - queueVoList = BeanUtil.copyToList(queueVos, FmsFollowupVo.FollowupPatient.QueueVo.class); - Map map = new HashMap<>(); - if (CollectionUtil.isNotEmpty(commonFollowupQueue)) { - List 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 public List adminQueryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) { List followupPatients = fmsFollowupDao.adminQueryPatient(dto.getQueueId(), null, dto.getHaveQueue(), dto.getTenantId()); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java index 4dc840ec..a98f386f 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java +++ b/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(IdUtil.getSnowflakeNextId()); + dmsUser.setId(dto.getId()); dmsUser.setCreateBy(SecurityUtils.getUsername()); dmsUser.setCreateTime(new Date()); return dmsUserMapper.insertSelective(dmsUser); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java index 239cbbdb..884ac311 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java +++ b/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.collection.CollectionUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.core.redis.RedisCache; 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.FmsFollowupTaskMapper; import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper; +import com.acupuncture.system.service.FmsFollowupQueueService; import com.acupuncture.system.service.FmsFollowupService; import org.quartz.TriggerUtils; import org.quartz.impl.triggers.CronTriggerImpl; @@ -48,6 +50,8 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { private RedisCache redisCache; @Resource private FmsFollowupTaskMapper fmsFollowupTaskMapper; + @Resource + private FmsFollowupQueueService fmsFollowupQueueService; @Override public List queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) { @@ -127,42 +131,6 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { return followupPatients; } - - @Override - @DataSource(DataSourceType.MASTER) - public List queryTaskPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) { - List followupPatients = fmsFollowupDao.queryTaskPatient(dto.getQueueId(), null, dto.getHaveQueue(), dto.getTenantId(), dto.getDataScore()); - if (CollectionUtil.isNotEmpty(followupPatients)) { - List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); - for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) { - if (CollectionUtil.isNotEmpty(followupPatient.getQueueList())) { - - List queueVos = fmsFollowupDao.queryQueueListByPatientId(followupPatient.getPatientId()); - List queueVoList = new ArrayList<>(); - if (CollectionUtil.isNotEmpty(queueVos)) { - queueVoList = BeanUtil.copyToList(queueVos, FmsFollowupVo.FollowupPatient.QueueVo.class); - Map map = new HashMap<>(); - if (CollectionUtil.isNotEmpty(commonFollowupQueue)) { - List 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 public Integer updPatient(FmsFollowupDto.UpdPatient dto) { FmsPatientQueueRelationExample fmsPatientQueueRelationExample = new FmsPatientQueueRelationExample(); @@ -200,6 +168,20 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { if (CollectionUtil.isEmpty(followupTaskVOS)) { return CollectionUtil.newArrayList(); } + List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); +// List followupQueueVOS = fmsFollowupQueueService.queryCommonQueue(null); + if (CollectionUtil.isNotEmpty(commonFollowupQueue)) { + List followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class); + Map 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; } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java index e0c2c4ca..85c56d53 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java +++ b/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); } + @Override + public PageInfo queryDetailByPageNoToken(ScreeningDto.Query param, Integer pageNum, Integer pageSize) { + List results = screeningDetailDao.queryResult(null, null, param); + if (CollectionUtil.isNotEmpty(results)) { + List screeningDetailVos = screeningDetailDao.queryDetailList(results.stream().map(ScrScreenVo.Result::getId).collect(Collectors.toList())); + if (CollectionUtil.isNotEmpty(screeningDetailVos)) { + Map> map = screeningDetailVos.stream().collect(Collectors.groupingBy(ScrScreenVo.ScreeningDetailVo::getRecordId)); + results.forEach(result -> { + result.setDetailList(map.get(result.getId())); + }); + } + } + return new PageInfo<>(results); + } + + @Override public void saveQuestionnaire(ScreeningDto.SaveQuestionnaire param, Long userId) throws Exception { //redis判断是否已有 diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysConfigServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysConfigServiceImpl.java index dd95eb21..034d40c3 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysConfigServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysConfigServiceImpl.java @@ -47,7 +47,7 @@ public class SysConfigServiceImpl implements ISysConfigService * @return 参数配置信息 */ @Override - @DataSource(DataSourceType.MASTER) + public SysConfig selectConfigById(Long configId) { SysConfig config = new SysConfig(); diff --git a/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml b/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml index ef479da3..5545f119 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml @@ -99,6 +99,9 @@ and r.age between #{param.startAge} and #{param.endAge} + + and r.phone = #{param.phone} + -- group by r.id order by r.create_time desc diff --git a/acupuncture-system/src/main/resources/mapper/dao/UmsDataSourceDao.xml b/acupuncture-system/src/main/resources/mapper/dao/UmsDataSourceDao.xml index dad69113..e8af55f3 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/UmsDataSourceDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/UmsDataSourceDao.xml @@ -28,4 +28,30 @@ t.id + +