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 745ac45c8..99e9c1267 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 @@ -3,6 +3,8 @@ package com.acupuncture.web.controller.system; import java.util.List; import java.util.Set; +import com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.system.domain.po.DmsTenant; import com.acupuncture.system.persist.mapper.DmsTenantMapper; import com.acupuncture.system.service.ISysUserService; @@ -85,21 +87,22 @@ public class SysLoginController /** * 获取用户信息 - * + * * @return 用户信息 */ @GetMapping("getInfo") public AjaxResult getInfo() { LoginUser loginUser = SecurityUtils.getLoginUser(); - SysUser user = sysUserService.selectUserByTenantId(null, loginUser.getUsername()); - if (user.getTenantId() != null) { - DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(user.getTenantId()); - if (dmsTenant != null) { - user.setTenantName(dmsTenant.getName()); - user.setTenantPhone(dmsTenant.getContactPhone()); - } - } + SysUser user = sysUserService.selectUserById(loginUser.getUser().getUserId()); +// SysUser user = sysUserService.selectUserByTenantId(null, loginUser.getUsername()); +// if (user.getTenantId() != null) { +// DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(user.getTenantId()); +// if (dmsTenant != null) { +// user.setTenantName(dmsTenant.getName()); +// user.setTenantPhone(dmsTenant.getContactPhone()); +// } +// } // 角色集合 Set roles = permissionService.getRolePermission(user); // 权限集合 @@ -116,6 +119,39 @@ public class SysLoginController return ajax; } +// /** +// * 获取用户信息 +// * +// * @return 用户信息 +// */ +// @GetMapping("getInfo") +// public AjaxResult getInfo() +// { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// SysUser user = sysUserService.selectUserByTenantId(null, loginUser.getUsername()); +// if (user.getTenantId() != null) { +// DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(user.getTenantId()); +// if (dmsTenant != null) { +// user.setTenantName(dmsTenant.getName()); +// user.setTenantPhone(dmsTenant.getContactPhone()); +// } +// } +// // 角色集合 +// Set roles = permissionService.getRolePermission(user); +// // 权限集合 +// Set permissions = permissionService.getMenuPermission(user); +// if (!loginUser.getPermissions().equals(permissions)) +// { +// loginUser.setPermissions(permissions); +// tokenService.refreshToken(loginUser); +// } +// AjaxResult ajax = AjaxResult.success(); +// ajax.put("user", user); +// ajax.put("roles", roles); +// ajax.put("permissions", permissions); +// return ajax; +// } + /** * 获取路由信息 * diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java index d251be941..5137852e7 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java @@ -185,6 +185,23 @@ public class SysUserController extends BaseController return toAjax(userService.updateUser(user)); } +<<<<<<< HEAD + private void changeDataSource(Long tenantId) { + DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(tenantId); + if (dmsTenant != null) { + UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId()); + if (umsDataSource != null) { + try { + DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey()); + }finally { + DynamicDataSourceContextHolder.clearDataSourceType(); + } + } + } + } + +======= +>>>>>>> new /** * 删除用户 */ 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 7777e52aa..49ff9e4c9 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 @@ -94,8 +94,14 @@ public class AdminDmsUserController { adminTenantUserService.insert(dto); //切换至从库 +<<<<<<< HEAD + changeDataSource(umsDataSource.getDataSourceKey()); + + DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey()); +======= DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey()); +>>>>>>> new //新增从库数据 SysUser user = BeanUtil.copyProperties(dto, SysUser.class); if (!userService.checkUserNameUnique(user)) { @@ -110,9 +116,15 @@ public class AdminDmsUserController { user.setCreateBy(SecurityUtils.getUsername()); user.setPhonenumber(dto.getContactPhone()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + user.setTenantName(dmsTenant.getName()); + user.setTenantPhone(dmsTenant.getContactPhone()); int insert = userService.insertUser(user); //销毁切换数据源 +<<<<<<< HEAD + removeDataSource(); +======= +>>>>>>> new DynamicDataSourceContextHolder.clearDataSourceType(); return JsonResponse.ok(insert); @@ -188,6 +200,12 @@ public class AdminDmsUserController { return JsonResponse.ok(new PageInfo<>(adminTenantUserService.query(dto.getParam()))); } +<<<<<<< HEAD + private static void changeDataSource(String key) { + DynamicDataSourceContextHolder.setDataSourceType(key); + } +======= +>>>>>>> new /** * 重置密码 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 ca7a3c341..87b265ce1 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 @@ -95,6 +95,17 @@ public class AdminPmsTreatmentController { // } // +<<<<<<< HEAD + private static void changeDataSource(String dataSourceKey) { + try { + DynamicDataSourceContextHolder.setDataSourceType(dataSourceKey); + }finally { + DynamicDataSourceContextHolder.clearDataSourceType(); + } + } + +======= +>>>>>>> new // @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/DmsLoginController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/DmsLoginController.java index 96814c534..ec812898d 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/DmsLoginController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/DmsLoginController.java @@ -66,6 +66,7 @@ public class DmsLoginController { * @param loginBody 登录信息 * @return 结果 */ + @DataSource(DataSourceType.MASTER) @PostMapping("/login") @DataSource(DataSourceType.MASTER) public AjaxResult login(@RequestBody LoginBody loginBody) { @@ -78,6 +79,28 @@ public class DmsLoginController { } /** +<<<<<<< HEAD + * 登录方法 + * + * @param loginBody 登录信息 + * @return 结果 + */ + @DataSource(DataSourceType.MASTER) + @PostMapping("/loginSimple") + public AjaxResult loginSimple(@RequestBody LoginBody loginBody) { + AjaxResult ajax = AjaxResult.success(); + // 生成令牌 + String token = webDmsLoginService.loginSimple(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), + loginBody.getUuid()); + ajax.put(Constants.TOKEN, token); + return ajax; + } + + + /** + * 获取用户信息 + * +======= * 重置密码 */ @Log(title = "个人信息", businessType = BusinessType.UPDATE) @@ -122,6 +145,7 @@ public class DmsLoginController { /** * 获取用户信息,暂时先从主库获取 +>>>>>>> new * @return 用户信息 */ @ApiOperation("用户信息") 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 635f1390b..cbd384665 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 @@ -97,6 +97,17 @@ public class ExternalController { } +<<<<<<< HEAD + private static void changeDataSource(String key) { + try { + DynamicDataSourceContextHolder.setDataSourceType(key); + }finally { + DynamicDataSourceContextHolder.clearDataSourceType(); + } + } + +======= +>>>>>>> new // @Anonymous // @ApiOperation("上传数据") // @PostMapping("/http/uploadMemberInfo") diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java index 06df38de4..3416b6cad 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java @@ -52,6 +52,21 @@ public class FmsFollowupController { @Resource private FmsFollowupService fmsFollowupService; +<<<<<<< HEAD + + @ApiOperation("查询公共队列") + @PostMapping("/commonQueue") + @Anonymous + @DataSource(DataSourceType.MASTER) + public JsonResponse> queryCommonQueue(@RequestBody @Validated BaseDto dto) { + if (dto.getPageNum() > 0) { + PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); + } + return JsonResponse.ok(new PageInfo<>(fmsFollowupQueueService.queryCommonQueue(dto.getParam().getName()))); + } + +======= +>>>>>>> new @ApiOperation("查询随访队列") @PostMapping("/query") public JsonResponse> queryQueue(@RequestBody @Validated BaseDto dto) { 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 5afdf3b7d..e0c25c9a3 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 @@ -93,6 +93,23 @@ public class ScreeningController { return JsonResponse.ok(detailInfo); } +<<<<<<< HEAD + private void changeDataSource(Long tenantId) { + DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(tenantId); + if (dmsTenant != null) { + UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId()); + if (umsDataSource != null) { + try { + DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey()); + }finally { + DynamicDataSourceContextHolder.clearDataSourceType(); + } + } + } + } + +======= +>>>>>>> new @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/task/TaskController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java index 33a8bf5c3..5136b8640 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 @@ -1,3 +1,349 @@ +<<<<<<< HEAD +//package com.acupuncture.web.controller.web; +// +//import cn.hutool.core.bean.BeanUtil; +//import cn.hutool.core.collection.CollectionUtil; +//import cn.hutool.core.date.DateUtil; +//import cn.hutool.core.util.IdUtil; +//import com.acupuncture.common.annotation.Anonymous; +//import com.acupuncture.common.core.redis.RedisCache; +//import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; +//import com.acupuncture.system.domain.dto.FmsFollowupDto; +//import com.acupuncture.system.domain.po.FmsFollowupTask; +//import com.acupuncture.system.domain.po.FmsFollowupTaskExample; +//import com.acupuncture.system.domain.po.FmsPatientQueueRelation; +//import com.acupuncture.system.domain.vo.FmsFollowupVo; +//import com.acupuncture.system.domain.vo.UmsDataSourceVo; +//import com.acupuncture.system.persist.dao.FmsFollowupDao; +//import com.acupuncture.system.persist.dao.UmsDataSourceDao; +//import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper; +//import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper; +//import com.acupuncture.system.service.FmsFollowupQueueService; +//import com.acupuncture.system.service.FmsFollowupService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.Data; +//import lombok.extern.slf4j.Slf4j; +//import org.apache.catalina.connector.Response; +//import org.quartz.TriggerUtils; +//import org.quartz.impl.triggers.CronTriggerImpl; +//import org.quartz.spi.OperableTrigger; +//import org.springframework.scheduling.annotation.Scheduled; +//import org.springframework.transaction.annotation.Propagation; +//import org.springframework.transaction.annotation.Transactional; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +// +//import javax.annotation.Resource; +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.util.*; +//import java.util.regex.Matcher; +//import java.util.regex.Pattern; +// +///** +// * @Author zzc +// * @Package com.acupuncture.web.controller.web +// * @Date 2025/2/13 8:50 +// * @description: +// */ +//@Slf4j +//@Api(tags = "定时任务相关") +//@RestController +//@RequestMapping("/task") +//@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +//public class TaskController { +// +// @Resource +// private FmsFollowupDao fmsFollowupDao; +// @Resource +// private FmsFollowupService fmsFollowupService; +// @Resource +// private FmsFollowupTaskMapper fmsFollowupTaskMapper; +// @Resource +// private UmsDataSourceDao umsDataSourceDao; +// @Resource +// private RedisCache redisCache; +// @Resource +// private FmsFollowupQueueService fmsFollowupQueueService; +// +// @ApiOperation("定时任务添加随访工单") +// @PostMapping("/task") +// @Scheduled(fixedDelay = 10000) +// @Anonymous +// public void task() { +// // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 ) +// //查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单 +//// UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result(); +//// result1.setDataSourceKey("MASTER"); +//// changeDataSource(result1); +//// List query = umsDataSourceDao.query(null); +//// if (CollectionUtil.isEmpty(query)) { +//// return; +//// } +// //查询公共队列 +// List queueResults = redisCache.getCacheList("common_followup_queue"); +// List followupQueueVOS = new ArrayList<>(); +// if (CollectionUtil.isEmpty(queueResults)) { +// +// followupQueueVOS = fmsFollowupQueueService.queryCommonQueue(null); +// } +//// List queueResults = fmsFollowupDao.queryCommonQueue(null); +// //切换数据源 +//// for (UmsDataSourceVo.Result result : query) { +//// if ("MASTER".equals(result.getDataSourceKey()) || "PROD_YY".equals(result.getDataSourceKey())) { +//// continue; +//// } +//// changeDataSource(result); +// { +// //获取随访患者列表,根据患者出院日时间和队列添加工单 +// //1. 查询队列 +// List queueList = fmsFollowupDao.selectQueueList(null, null, null, null); +// +// if (CollectionUtil.isEmpty(queueList)) { +// if (CollectionUtil.isEmpty(queueResults)) { +// queueList = followupQueueVOS; +// } +// } else { +// if (CollectionUtil.isEmpty(queueResults)) { +// 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.queryTaskPatient(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); +// } +// } +// } +// } +// } +// +// private static void changeDataSource(UmsDataSourceVo.Result result) { +// try { +// DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey()); +// } finally { +// DynamicDataSourceContextHolder.clearDataSourceType(); +// } +// } +// +// public String getName(String url) { +// Pattern pattern = Pattern.compile("jdbc:mysql://[^/]+/([^?]+)"); +// Matcher matcher = pattern.matcher(url); +// if (matcher.find()) { +// String dbName = matcher.group(1); // 输出 acupuncture_yfyy +// System.out.println("数据库名称: " + dbName); +// return dbName; +// } +// return ""; +// } +// +// /** +// * 法用于计算在指定时间范围内触发器的触发时间点。具体步骤如下: +// * 初始化一个空列表 lst 存储触发时间点。 +// * 克隆传入的触发器 trigg,并检查其下一个触发时间是否为空。如果为空,则设置开始时间和结束时间,并计算首次触发时间。 +// * 使用 while 循环遍历触发器的触发时间点,直到没有更多触发时间或超出指定范围。 +// * 如果触发时间在指定范围内,则将其添加到列表中,并更新触发器状态。 +// * +// * @param trigg cron表达式 +// * @param from 患者出院时间 +// * @param to 患者出院时间 + 随访总月数 +// * @return +// */ +// public static List computeFireTimesBetween(OperableTrigger trigg, org.quartz.Calendar cal, Date from, Date to) { +// LinkedList lst = new LinkedList(); +// OperableTrigger t = (OperableTrigger) trigg.clone(); +// if (t.getNextFireTime() == null) { +// t.setStartTime(from); +// t.setEndTime(to); +// t.computeFirstFireTime(cal); +// } +// +// while (true) { +// Date d = t.getNextFireTime(); +// if (d == null) { +// break; +// } +// +// if (d.before(from)) { +// t.triggered(cal); +// } else { +// if (d.after(to)) { +// break; +// } +// lst.add(d); +// t.triggered(cal); +// } +// } +// return Collections.unmodifiableList(lst); +// } +// +// /** +// * 返回当前时间之后的第一个date及对应顺序 +// * +// * @param dateList key 为顺序,value 为时间 +// * @return +// */ +// public static DateComparator getDate(List dateList) { +// Date today = new Date(); +// DateComparator dateComparator = new DateComparator(); +// for (int i = 0; i < dateList.size(); i++) { +// Date date = dateList.get(i); +// if (date.after(today)) { +// dateComparator.setDate(date); +// dateComparator.setIndex(i + 1); +// return dateComparator; +// } +// } +// return dateComparator; +// } +// +// @Data +// public static class DateComparator { +// private Date date; +// private Integer index; +// } +//} +======= +>>>>>>> new package com.acupuncture.web.task; import cn.hutool.core.bean.BeanUtil; 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 697a56b54..c08cf8a3a 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,7 +100,10 @@ public class SysUser extends BaseEntity @ApiModelProperty("是否具有审核权限(0不具有; 1具有)") private Byte slaverAdmin; +<<<<<<< HEAD +======= +>>>>>>> new 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 a6a75ed77..62d3c5665 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 @@ -72,9 +72,22 @@ public class AdminGlobalDataSourceAspect { */ public String getDataSource(ProceedingJoinPoint point) { // 获取请求携带的令牌 +<<<<<<< HEAD + ServletRequestAttributes requestAttributes = (ServletRequestAttributes) + RequestContextHolder.getRequestAttributes(); + HttpServletRequest request; + if (requestAttributes == null) { + DynamicDataSourceContextHolder.getDataSourceType(); + return DynamicDataSourceContextHolder.getDataSourceType(); + } + request = requestAttributes.getRequest(); + //token为空 + Long tenantId; +======= HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); Long tenantId = null; +>>>>>>> new String header = request.getHeader(UserConstants.DEPT); if(StrUtil.isNotEmpty(header)){ tenantId = Long.parseLong(header); @@ -83,6 +96,15 @@ public class AdminGlobalDataSourceAspect { tenantId = SecurityUtils.getTenantId(); } } +<<<<<<< HEAD + + //设置所属医院和数据源l +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if(ObjectUtil.isNull(loginUser) || loginUser.getUser().isAdmin()){ +// return null; +// } +======= +>>>>>>> new //根据组织ID查询数据源 if(tenantId !=null) { UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId); 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 3184d6f17..9828c5523 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,11 @@ public class SecurityConfig .authorizeHttpRequests((requests) -> { permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); // 对于登录login 注册register 验证码captchaImage 允许匿名访问 +<<<<<<< HEAD + 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() +>>>>>>> new // 静态资源,可匿名访问 .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 ec76ab47a..cb8a9bb70 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 @@ -147,6 +147,10 @@ public class SysLoginService // 生成token return tokenService.createToken(loginUser); } +<<<<<<< HEAD + +======= +>>>>>>> new /** * 登录验证 * 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 9f65dacb2..1e98f6fdd 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 @@ -98,6 +98,54 @@ public class WebDmsLoginService 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 + { + DmsUserAuthenticationToken authenticationToken = new DmsUserAuthenticationToken(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/domain/dto/AdminTenantUserDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java index 480e2473b..db73c149b 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 @@ -40,7 +40,10 @@ public class AdminTenantUserDto { private String status; private String contactPhone; +<<<<<<< HEAD +======= +>>>>>>> new @ApiModelProperty("是否具有审核权限(0不具有; 1具有)") private Byte slaverAdmin = 0; } @@ -64,7 +67,10 @@ public class AdminTenantUserDto { private String status; private String contactPhone; +<<<<<<< HEAD +======= +>>>>>>> new @ApiModelProperty("是否具有审核权限(0不具有; 1具有)") private Byte slaverAdmin; } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java index e2d68d623..42bbd9209 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java @@ -331,7 +331,12 @@ public class PmsPatientServiceImpl implements PmsPatientService { writer.writeCellValue(0, row, DateUtil.format(patientList.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss")); writer.writeCellValue(1, row, patientList.get(i).getName()); writer.writeCellValue(2, row, patientList.get(i).getGender() == null ? "未知" : patientList.get(i).getGender() == 0 ? "男" : "女"); - writer.writeCellValue(3, row, DateUtil.format(patientList.get(i).getBirthDate(), "yyyy-MM-dd")); + try { + + writer.writeCellValue(3, row, DateUtil.format(patientList.get(i).getBirthDate(), "yyyy-MM-dd")); + }catch (Exception e) { + e.printStackTrace(); + } writer.writeCellValue(4, row, patientList.get(i).getEthnicity()); writer.writeCellValue(5, row, patientList.get(i).getEducationYears()); writer.writeCellValue(6, row, patientList.get(i).getPhone()); diff --git a/acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml b/acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml index 5af028957..74d042af3 100644 --- a/acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -25,6 +25,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +<<<<<<< HEAD +======= + + +>>>>>>> 93181b5fbb436385d1d312300e8dcc61b43d1666 @@ -49,7 +54,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +<<<<<<< HEAD select u.user_id, u.tenant_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.slaver_admin, +======= + select u.user_id, u.tenant_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.slaver_admin, u.tenant_name, u.tenant_phone, +>>>>>>> 93181b5fbb436385d1d312300e8dcc61b43d1666 d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from sys_user u @@ -168,7 +177,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" status, create_by, remark, +<<<<<<< HEAD +<<<<<<< HEAD + slaver_admin, +======= slaver_admin, + tenant_name, + tenant_phone, +>>>>>>> 93181b5fbb436385d1d312300e8dcc61b43d1666 +======= + slaver_admin, +>>>>>>> new create_time )values( #{userId}, @@ -184,7 +203,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{status}, #{createBy}, #{remark}, +<<<<<<< HEAD +<<<<<<< HEAD + #{slaverAdmin}, +======= + #{slaverAdmin}, + #{tenantName}, + #{tenantPhone}, +>>>>>>> 93181b5fbb436385d1d312300e8dcc61b43d1666 +======= #{slaverAdmin}, +>>>>>>> new sysdate() ) diff --git a/acupuncture-前台/vue.config.js b/acupuncture-前台/vue.config.js index ccd794ee7..a14f79529 100644 --- a/acupuncture-前台/vue.config.js +++ b/acupuncture-前台/vue.config.js @@ -39,7 +39,7 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `https://test.tall.wiki/acupuncture/api/`, + target: `http://192.168.1.3:20001`, changeOrigin: true, pathRewrite: { ["^" + process.env.VUE_APP_BASE_API]: "", diff --git a/acupuncture-后台/vue.config.js b/acupuncture-后台/vue.config.js index ccd794ee7..60b4bd0ea 100644 --- a/acupuncture-后台/vue.config.js +++ b/acupuncture-后台/vue.config.js @@ -39,7 +39,7 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `https://test.tall.wiki/acupuncture/api/`, + target: `http://192.168.1.3:20001/`, changeOrigin: true, pathRewrite: { ["^" + process.env.VUE_APP_BASE_API]: "",