From d81db453d1b0380cca5638dbf2437e8d8756e8f9 Mon Sep 17 00:00:00 2001 From: wzz Date: Sat, 29 Mar 2025 13:59:29 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20GlobalDataSourceAspect=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=88=87=E6=8D=A2=E8=87=B3null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/aspectj/AdminGlobalDataSourceAspect.java | 2 -- 1 file changed, 2 deletions(-) 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 85840588..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 @@ -54,8 +54,6 @@ public class AdminGlobalDataSourceAspect { String dataSourceKey = getDataSource(point); if (StringUtils.isNotEmpty(dataSourceKey)) { DataSourceManager.setDataSourceKey(dataSourceKey); - } else { - DataSourceManager.setDataSourceKey(null); } }catch (Exception e){ throw new BaseException(StrUtil.format("获取数据源错误:{}", e)); From 32aa2d06e61f14165e31fa5698265120147789e7 Mon Sep 17 00:00:00 2001 From: wzz Date: Sat, 29 Mar 2025 14:08:49 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=AD=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=A7=9F=E6=88=B7=E7=94=A8=E6=88=B7id=E6=9C=AA?= =?UTF-8?q?=E8=B5=8B=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acupuncture/web/controller/web/AdminDmsUserController.java | 1 + 1 file changed, 1 insertion(+) 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 90340568..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 @@ -140,6 +140,7 @@ public class AdminDmsUserController { //修改从库用户信息 SysUser sysUser = BeanUtil.copyProperties(dto, SysUser.class); + sysUser.setUserId(dto.getId()); sysUser.setPhonenumber(dto.getContactPhone()); userService.updateUser(sysUser); From ba370d8391b7970303072d58d6820fbb75bdd591 Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 31 Mar 2025 09:42:48 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtask=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=88=87=E6=8D=A2=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/web/TaskController.java | 211 ------------------ .../acupuncture/web/task/TaskController.java | 22 +- .../src/main/resources/application.yml | 5 + .../framework/aspectj/DataSourceAspect.java | 3 +- .../system/persist/dao/UmsDataSourceDao.java | 2 + .../resources/mapper/dao/UmsDataSourceDao.xml | 26 +++ 6 files changed, 48 insertions(+), 221 deletions(-) delete mode 100644 acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java 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 b612a4ac..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/task/TaskController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java index 56005541..2cdbabb2 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,8 +78,8 @@ public class TaskController { //查询从库队列 //1. 查询队列 List slavelQueueList = fmsFollowupDao.selectQueueList(null, null, null, null); - - //合并公共队列和从库的队列 + log.info("sa:{}", slavelQueueList); +// //合并公共队列和从库的队列 slavelQueueList.addAll(commonQueue); //查询每个队列的对象 @@ -87,10 +89,13 @@ public class TaskController { followupPatientQueryDTO.setTenantId(queue.getTenantId()); List patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO); log.info("查询每个队列的对象:{}", patientList); + if (CollectionUtil.isEmpty(patientList)) { + continue; + } } - - //定时任务 - +// +//// //定时任务 +// // //循环租户 // for (UmsDataSourceVo.Result tenant : tenantList) { // if ("MASTER".equals(tenant.getDataSourceKey())) { @@ -255,11 +260,12 @@ public class TaskController { // } // } // } -// + // } // } } + @DataSource(DataSourceType.MASTER) @ApiOperation("定时任务添加随访工单") @PostMapping("/task") @Scheduled(cron = "0 0 0 * * ?") @@ -268,7 +274,7 @@ public class TaskController { // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 ) //查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单 - List tenantList = umsDataSourceDao.query(null); + List tenantList = umsDataSourceDao.query1(null); if (CollectionUtil.isEmpty(tenantList)) { return; } 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-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-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..819262ba 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 @@ -18,4 +18,6 @@ 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/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 + + From 3bf72c27b6a92cd8d4ced4d7ebd86f50b5dd9196 Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 31 Mar 2025 14:47:01 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9A=8F=E8=AE=BF?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E5=85=AC=E5=85=B1=E9=98=9F=E5=88=97=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acupuncture/web/task/TaskController.java | 310 ++++++++---------- .../web/service/WebDmsLoginService.java | 2 +- .../system/domain/vo/FmsFollowupVo.java | 7 + .../service/impl/FmsFollowupServiceImpl.java | 18 + 4 files changed, 162 insertions(+), 175 deletions(-) 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 2cdbabb2..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 @@ -83,192 +83,154 @@ public class TaskController { 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; } - } -// -//// //定时任务 -// -// //循环租户 -// 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); -// } -// } -// } + 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; + } -// } -// } + 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 + 轮次时间 ) 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/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/service/impl/FmsFollowupServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java index 239cbbdb..50ae8ec9 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) { @@ -200,6 +204,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; } From a50bfe49db8d271c1419017d634313f45df08afb Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 31 Mar 2025 15:57:31 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=A0=E9=99=A4@DataSo?= =?UTF-8?q?urce=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysLoginController.java | 17 +++++++ .../web/AdminFmsFollowupController.java | 7 +++ .../web/AdminPmsPatientController.java | 4 ++ .../web/AdminPmsTreatmentController.java | 9 ++-- .../web/AdminStatisticsController.java | 7 +++ .../framework/config/SecurityConfig.java | 2 +- .../web/service/SysLoginService.java | 47 +++++++++++++++++++ .../system/persist/dao/AdminTongjiDao.java | 17 ------- .../system/persist/dao/FmsFollowupDao.java | 9 ---- .../system/persist/dao/PmsTreatmentDao.java | 6 +-- .../system/persist/dao/WxQrCodeDao.java | 4 +- .../service/AdminFmsFollowupQueueService.java | 9 +--- .../system/service/FmsFollowupService.java | 8 ---- .../AdminFmsFollowupQueueServiceImpl.java | 37 +-------------- .../service/impl/FmsFollowupServiceImpl.java | 36 -------------- 15 files changed, 95 insertions(+), 124 deletions(-) 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/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 cb215b8b..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); } 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-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java index aeb17097..8bc43fea 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").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-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/FmsFollowupDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java index 8c5cfaab..daff610a 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, 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..f01a853c 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,14 @@ public interface PmsTreatmentDao { List selectRecord(@Param("treatmentId") Long treatmentId, @Param("codeList") List codeList); - @DataSource(DataSourceType.MASTER) +// @DataSource(DataSourceType.MASTER) List adminSelectRecord(@Param("treatmentId") Long treatmentId, @Param("codeList") List codeList); // void batchInsert(@Param("pmsPatientList") List pmsPatientList); - @DataSource(DataSourceType.MASTER) +// @DataSource(DataSourceType.MASTER) List adminQuery(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query); - @DataSource(DataSourceType.MASTER) +// @DataSource(DataSourceType.MASTER) PmsTreatmentVo.TreatmentRecordVO adminQueryTreatment(@Param("id") Long id); } 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..f0769021 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,7 @@ import java.util.List; public interface WxQrCodeDao { - @DataSource(DataSourceType.MASTER) +// @DataSource(DataSourceType.MASTER) AmsWxQrCodeVo.Result queryById(@Param("id")Long id); /** @@ -28,7 +28,7 @@ public interface WxQrCodeDao { @Param("userId") Long userId, @Param("tenantId") Long tenantId); - @DataSource(DataSourceType.MASTER) +// @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..8ff6c239 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,7 @@ public interface AdminFmsFollowupQueueService { * 查询公共队列 * @return */ - @DataSource(DataSourceType.MASTER) +// @DataSource(DataSourceType.MASTER) List queryCommonQueue(String name, Long tenantId); /** @@ -46,13 +46,6 @@ public interface AdminFmsFollowupQueueService { @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..ee6d2cf5 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 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..57c63ca1 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,7 +40,7 @@ public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueSe private FmsFollowupQueueMapper fmsFollowupQueueMapper; @Override - @DataSource(DataSourceType.MASTER) +// @DataSource(DataSourceType.MASTER) public List queryCommonQueue(String name, Long tenantId) { return fmsFollowupDao.queryAll(name, tenantId); } @@ -75,41 +75,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/FmsFollowupServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java index 50ae8ec9..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 @@ -131,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(); From 35ec4795e5c26ff322f44faebe8153e2db2abc27 Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 31 Mar 2025 16:43:53 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3DataSource=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acupuncture/web/controller/web/ExternalController.java | 3 +++ .../java/com/acupuncture/system/mapper/SysRoleMapper.java | 1 - .../acupuncture/system/persist/dao/AdminDataSourceDao.java | 1 - .../java/com/acupuncture/system/persist/dao/DmsUserDao.java | 1 - .../com/acupuncture/system/persist/dao/FmsFollowupDao.java | 1 - .../com/acupuncture/system/persist/dao/PmsPatientDao.java | 1 - .../com/acupuncture/system/persist/dao/PmsTreatmentDao.java | 5 ----- .../acupuncture/system/persist/dao/ScreeningDetailDao.java | 1 - .../com/acupuncture/system/persist/dao/UmsDataSourceDao.java | 1 - .../java/com/acupuncture/system/persist/dao/WxQrCodeDao.java | 2 -- .../system/service/AdminFmsFollowupQueueService.java | 4 ---- .../com/acupuncture/system/service/FmsFollowupService.java | 1 - .../service/impl/AdminFmsFollowupQueueServiceImpl.java | 4 ---- .../system/service/impl/SysConfigServiceImpl.java | 2 +- 14 files changed, 4 insertions(+), 24 deletions(-) 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-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/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 daff610a..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 @@ -74,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 f01a853c..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 819262ba..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,7 +14,6 @@ import java.util.List; * @description: */ public interface UmsDataSourceDao { - @DataSource(DataSourceType.MASTER) List query(@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 f0769021..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 8ff6c239..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,7 +40,6 @@ public interface AdminFmsFollowupQueueService { * @param dto * @return */ - @DataSource(DataSourceType.MASTER) int delQueue(FmsFollowupDto.Del 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 ee6d2cf5..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 @@ -71,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/impl/AdminFmsFollowupQueueServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java index 57c63ca1..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()); 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(); From b5258b5b2a8faf026b6e9d3c8ef0da7661773b0b Mon Sep 17 00:00:00 2001 From: zzc Date: Wed, 2 Apr 2025 19:33:27 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=99=BB=E5=BD=95=E6=9F=A5=E8=AF=A2=E7=AD=9B=E6=9F=A5?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/web/ScreeningController.java | 11 +++++++++++ .../framework/config/SecurityConfig.java | 2 +- .../system/service/IScreeningService.java | 2 ++ .../service/impl/ScreeningServiceImpl.java | 16 ++++++++++++++++ .../resources/mapper/dao/ScreeningDetailDao.xml | 3 +++ 5 files changed, 33 insertions(+), 1 deletion(-) 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 c04a2d29..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) { 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 8bc43fea..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", "/loginSimple").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-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/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/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