From b79aa16fa34c39e6e237c7101362bed244946eef Mon Sep 17 00:00:00 2001 From: zzc Date: Sat, 15 Mar 2025 09:17:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysLoginController.java | 19 +- .../web/AdminDmsUserController.java | 98 +++++++-- .../web/AdminFmsFollowupController.java | 81 ++++++++ .../web/AdminPmsPatientController.java | 65 ++++++ .../web/AdminPmsTreatmentController.java | 87 ++++++++ .../controller/web/FmsFollowupController.java | 5 + .../acupuncture/web/task/TaskController.java | 29 ++- .../src/main/resources/application-stage.yml | 2 +- .../common/constant/DiseaseMapping.java | 38 ++-- .../common/core/domain/entity/SysUser.java | 19 ++ .../src/main/resources/mbg.xml | 4 +- .../system/domain/dto/AdminReportDto.java | 11 +- .../system/domain/dto/AdminTenantUserDto.java | 12 +- .../system/domain/dto/AdminTenantsDto.java | 1 + .../system/domain/dto/FmsFollowupDto.java | 11 + .../system/domain/dto/PmsTreatmentDto.java | 4 + .../system/domain/dto/StatisticsDto.java | 1 + .../system/domain/po/DmsTenant.java | 8 +- .../system/domain/po/DmsTenantExample.java | 30 +-- .../system/domain/vo/AdminReportVo.java | 16 +- .../system/domain/vo/AdminTenantUserVo.java | 4 +- .../system/domain/vo/AdminTenantsVo.java | 7 +- .../system/domain/vo/FmsFollowupVo.java | 21 +- .../system/domain/vo/PmsTreatmentVo.java | 4 +- .../system/persist/dao/AdminTongjiDao.java | 5 +- .../system/persist/dao/FmsFollowupDao.java | 30 ++- .../system/persist/dao/PmsPatientDao.java | 4 + .../system/persist/dao/PmsTreatmentDao.java | 13 +- .../system/persist/dao/StatisticsDao.java | 5 +- .../service/AdminFmsFollowupQueueService.java | 77 +++++++ .../system/service/FmsFollowupService.java | 11 + .../system/service/ISysUserService.java | 8 + .../system/service/PmsPatientService.java | 8 + .../system/service/PmsTreatmentService.java | 10 + .../impl/AdminDataSourceServiceImpl.java | 28 +++ .../AdminFmsFollowupQueueServiceImpl.java | 165 +++++++++++++++ .../service/impl/AdminReportServiceImpl.java | 2 + .../impl/AdminStatisticsServiceImpl.java | 110 ++++++---- .../service/impl/AdminTenantsServiceImpl.java | 6 +- .../impl/FmsFollowupQueueServiceImpl.java | 12 +- .../service/impl/FmsFollowupServiceImpl.java | 15 +- .../service/impl/PmsPatientServiceImpl.java | 76 +++++++ .../service/impl/PmsTreatmentServiceImpl.java | 133 +++++++++++- .../service/impl/StatisticsServiceImpl.java | 37 +++- .../service/impl/SysUserServiceImpl.java | 9 + .../mapper/dao/AdminDataSourceDao.xml | 1 + .../resources/mapper/dao/AdminDmsUserDao.xml | 44 ++-- .../mapper/dao/AdminRmsReportDao.xml | 27 ++- .../resources/mapper/dao/AdminTenantDao.xml | 38 ++-- .../resources/mapper/dao/AdminTongjiDao.xml | 185 ++++++++++++----- .../resources/mapper/dao/FmsFollowupDao.xml | 191 +++++++++++++++++- .../resources/mapper/dao/PmsPatientDao.xml | 62 ++++++ .../resources/mapper/dao/PmsTreatmentDao.xml | 127 +++++++++++- .../resources/mapper/dao/StatisticsDao.xml | 190 +++++++++++------ .../main/resources/mapper/dao/SysPowerDao.xml | 2 + .../mapper/system/DmsTenantMapper.xml | 14 +- .../resources/mapper/system/SysUserMapper.xml | 6 +- 57 files changed, 1916 insertions(+), 312 deletions(-) create mode 100644 acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java create mode 100644 acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.java create mode 100644 acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java create mode 100644 acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java create mode 100644 acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java 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 deb79320..9f9672e4 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 @@ -2,6 +2,10 @@ package com.acupuncture.web.controller.system; import java.util.List; import java.util.Set; + +import com.acupuncture.system.domain.po.DmsTenant; +import com.acupuncture.system.persist.mapper.DmsTenantMapper; +import com.acupuncture.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -19,6 +23,8 @@ import com.acupuncture.framework.web.service.SysPermissionService; import com.acupuncture.framework.web.service.TokenService; import com.acupuncture.system.service.ISysMenuService; +import javax.annotation.Resource; + /** * 登录验证 * @@ -38,6 +44,10 @@ public class SysLoginController @Autowired private TokenService tokenService; + @Resource + private ISysUserService sysUserService; + @Resource + private DmsTenantMapper dmsTenantMapper; /** * 登录方法 @@ -65,7 +75,14 @@ public class SysLoginController public AjaxResult getInfo() { LoginUser loginUser = SecurityUtils.getLoginUser(); - SysUser user = loginUser.getUser(); + 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); // 权限集合 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 9e53946f..2d6f48db 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 @@ -1,6 +1,7 @@ package com.acupuncture.web.controller.web; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import com.acupuncture.common.core.domain.BaseDto; import com.acupuncture.common.core.domain.JsonResponse; import com.acupuncture.common.core.domain.entity.SysUser; @@ -8,9 +9,19 @@ import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.common.utils.StringUtils; import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; import com.acupuncture.system.domain.dto.AdminTenantUserDto; +import com.acupuncture.system.domain.dto.AdminTenantsDto; +import com.acupuncture.system.domain.po.DmsTenant; +import com.acupuncture.system.domain.po.DmsUser; +import com.acupuncture.system.domain.po.DmsUserExample; +import com.acupuncture.system.domain.po.UmsDataSource; import com.acupuncture.system.domain.vo.AdminTenantUserVo; +import com.acupuncture.system.domain.vo.AdminTenantsVo; import com.acupuncture.system.domain.vo.UmsDataSourceVo; +import com.acupuncture.system.persist.mapper.DmsTenantMapper; +import com.acupuncture.system.persist.mapper.DmsUserMapper; +import com.acupuncture.system.persist.mapper.UmsDataSourceMapper; import com.acupuncture.system.service.AdminTenantUserService; +import com.acupuncture.system.service.AdminTenantsService; import com.acupuncture.system.service.DmsLoginService; import com.acupuncture.system.service.ISysUserService; import com.github.pagehelper.PageHelper; @@ -45,37 +56,46 @@ public class AdminDmsUserController { private DmsLoginService dmsLoginService; @Resource private ISysUserService userService; + @Resource + private AdminTenantsService adminTenantsService; + @Resource + private DmsUserMapper dmsUserMapper; + @Resource + private DmsTenantMapper dmsTenantMapper; + @Resource + private UmsDataSourceMapper umsDataSourceMapper; @ApiOperation("添加租户用户") @PostMapping("/add") public JsonResponse insert(@RequestBody @Validated AdminTenantUserDto.AddDto dto) { - //新增分库数据, + //新增分库数据 + //切换到分库数据源 + DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(dto.getTenantId()); + if (dmsTenant != null) { + UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId()); + if (umsDataSource != null) { + changeDataSource(umsDataSource.getDataSourceKey()); + } + } SysUser user = BeanUtil.copyProperties(dto, SysUser.class); - if (!userService.checkUserNameUnique(user)) - { + if (!userService.checkUserNameUnique(user)) { return JsonResponse.ok().fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); - } - else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) - { + } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { return JsonResponse.ok().fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); - } - else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) - { + } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { return JsonResponse.ok().fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } user.setTenantId(SecurityUtils.getTenantId()); user.setCreateBy(SecurityUtils.getUsername()); + user.setPhonenumber(dto.getContactPhone()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); int insert = userService.insertUser(user); //新增主库 if (insert > 0) { DynamicDataSourceContextHolder.setDataSourceType("MASTER"); - if (!dmsLoginService.checkUserNameUnique(dto)) - { + if (!dmsLoginService.checkUserNameUnique(dto)) { return JsonResponse.ok().fail("新增用户'" + dto.getUserName() + "'失败,登录账号已存在"); - } - else if (StringUtils.isNotEmpty(dto.getPhonenumber()) && !dmsLoginService.checkPhoneUnique(dto)) - { + } else if (StringUtils.isNotEmpty(dto.getPhonenumber()) && !dmsLoginService.checkPhoneUnique(dto)) { return JsonResponse.ok().fail("新增用户'" + dto.getUserName() + "'失败,手机号码已存在"); } dto.setPassword(user.getPassword()); @@ -87,15 +107,62 @@ public class AdminDmsUserController { @ApiOperation("修改租户用户") @PostMapping("/upd") public JsonResponse update(@RequestBody @Validated AdminTenantUserDto.UpdDto dto) { + updSysUser(dto); return JsonResponse.ok(adminTenantUserService.update(dto)); } + private void updSysUser(AdminTenantUserDto.UpdDto dto) { + //查询租户数据源,删除分库数据 + DmsUserExample dmsUserExample = new DmsUserExample(); + dmsUserExample.createCriteria().andDelFlagEqualTo((byte) 0).andIdEqualTo(dto.getId()); + List dmsUsers = dmsUserMapper.selectByExample(dmsUserExample); + if (CollectionUtil.isNotEmpty(dmsUsers)) { + DmsUser dmsUser = dmsUsers.get(0); + AdminTenantsDto.Query query = new AdminTenantsDto.Query(); + query.setId(dmsUser.getTenantId()); + List tenantList = adminTenantsService.query(query); + if (CollectionUtil.isNotEmpty(tenantList)) { + for (AdminTenantsVo.Result result : tenantList) { + //切换数据源 删除分库数据 + changeDataSource(result.getDataSourceKey()); + //修改分库用户 + SysUser sysUser = BeanUtil.copyProperties(dto, SysUser.class); + sysUser.setPhonenumber(dto.getContactPhone()); + userService.updateUser(sysUser); + } + } + } + } + @ApiOperation("删除租户用户") @PostMapping("/del") public JsonResponse delete(@RequestBody @Validated AdminTenantUserDto.DeleteDto dto) { + delSysUser(dto); return JsonResponse.ok(adminTenantUserService.delete(dto)); } + private void delSysUser(AdminTenantUserDto.DeleteDto dto) { + //查询租户数据源,删除分库数据 + DmsUserExample dmsUserExample = new DmsUserExample(); + dmsUserExample.createCriteria().andDelFlagEqualTo((byte) 0).andIdIn(dto.getIdList()); + List dmsUsers = dmsUserMapper.selectByExample(dmsUserExample); + if (CollectionUtil.isNotEmpty(dmsUsers)) { + for (DmsUser dmsUser : dmsUsers) { + AdminTenantsDto.Query query = new AdminTenantsDto.Query(); + query.setId(dmsUser.getTenantId()); + List tenantList = adminTenantsService.query(query); + if (CollectionUtil.isNotEmpty(tenantList)) { + for (AdminTenantsVo.Result result : tenantList) { + //切换数据源 删除分库数据 + changeDataSource(result.getDataSourceKey()); + //删除分库用户 + userService.deleteUserByUsername(dmsUser.getUserName()); + } + } + } + } + } + @ApiOperation("查询租户用户") @PostMapping("/list") public JsonResponse> query(@RequestBody @Validated BaseDto dto) { @@ -105,4 +172,7 @@ public class AdminDmsUserController { return JsonResponse.ok(new PageInfo<>(adminTenantUserService.query(dto.getParam()))); } + private static void changeDataSource(String key) { + DynamicDataSourceContextHolder.setDataSourceType(key); + } } 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 new file mode 100644 index 00000000..4c8ab572 --- /dev/null +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java @@ -0,0 +1,81 @@ +package com.acupuncture.web.controller.web; + +import com.acupuncture.common.annotation.Anonymous; +import com.acupuncture.common.core.domain.BaseDto; +import com.acupuncture.common.core.domain.JsonResponse; +import com.acupuncture.system.domain.dto.FmsFollowupDto; +import com.acupuncture.system.domain.vo.FmsFollowupVo; +import com.acupuncture.system.service.AdminFmsFollowupQueueService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * @Author zzc + * @Package com.acupuncture.web.controller.web + * @Date 2025/2/21 15:48 + * @description: + */ +@Slf4j +@Api(tags = "随访相关") +@RestController +@RequestMapping("/admin/followup") +public class AdminFmsFollowupController { + @Resource + private AdminFmsFollowupQueueService fmsFollowupQueueService; + + @ApiOperation("查询队列") + @PostMapping("/query") + @Anonymous + 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(), dto.getParam().getTenantId()))); + } + + @ApiOperation("添加随访队列") + @PostMapping("/add") + public JsonResponse addQueue(@RequestBody @Validated FmsFollowupDto.Add dto){ + return JsonResponse.ok(fmsFollowupQueueService.addQueue(dto)); + } + + @ApiOperation("更新随访队列") + @PostMapping("/upd") + public JsonResponse updQueue(@RequestBody @Validated FmsFollowupDto.Upd dto){ + return JsonResponse.ok(fmsFollowupQueueService.updQueue(dto)); + } + + @ApiOperation("删除随访队列") + @PostMapping("/del") + public JsonResponse delQueue(@RequestBody @Validated FmsFollowupDto.Del dto){ + return JsonResponse.ok(fmsFollowupQueueService.delQueue(dto)); + } + + @ApiOperation("查询随访患者") + @PostMapping("/queryPatient") + public JsonResponse> queryPatient(@RequestBody @Validated BaseDto dto) { + if (dto.getPageNum() > 0) { + PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); + } + return JsonResponse.ok(new PageInfo<>(fmsFollowupQueueService.adminQueryPatient(dto.getParam()))); + } + + @ApiOperation("查询随访任务") + @PostMapping("/queryTask") + public JsonResponse> queryTask(@RequestBody @Validated BaseDto dto) { + if (dto.getPageNum() > 0) { + PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); + } + return JsonResponse.ok(new PageInfo<>(fmsFollowupQueueService.adminQueryTask(dto.getParam()))); + } +} 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 new file mode 100644 index 00000000..d03c0f0b --- /dev/null +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.java @@ -0,0 +1,65 @@ +package com.acupuncture.web.controller.web; + +import com.acupuncture.common.core.domain.BaseDto; +import com.acupuncture.common.core.domain.JsonResponse; +import com.acupuncture.system.domain.dto.FmsFollowupDto; +import com.acupuncture.system.domain.dto.PmsPatientDto; +import com.acupuncture.system.domain.vo.FmsFollowupVo; +import com.acupuncture.system.domain.vo.PmsPatientVo; +import com.acupuncture.system.service.PmsPatientService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @Author zzc + * @Package com.acupuncture.web.controller.web + * @Date 2025/2/11 9:13 + * @description: + */ +@Slf4j +@Api(tags = "随访相关") +@RestController +@RequestMapping("/admin/patient") +public class AdminPmsPatientController { + + @Resource + private PmsPatientService pmsPatientService; + + /** + * 查询患者信息 + * + * @param dto + * @return + */ + @ApiOperation("查询上报类型") + @PostMapping("/list") + public JsonResponse> adminQuery( @RequestBody @Validated BaseDto dto) { + if (dto.getPageNum() > 0) { + PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); + } + return JsonResponse.ok(new PageInfo<>(pmsPatientService.adminQuery(dto.getParam()))); + } + + @ApiOperation("导出") + @PostMapping("/export") + 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 new file mode 100644 index 00000000..219a70f4 --- /dev/null +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java @@ -0,0 +1,87 @@ +package com.acupuncture.web.controller.web; + +import com.acupuncture.common.core.domain.BaseDto; +import com.acupuncture.common.core.domain.JsonResponse; +import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; +import com.acupuncture.system.domain.dto.PmsTreatmentDto; +import com.acupuncture.system.domain.po.DmsTenant; +import com.acupuncture.system.domain.po.UmsDataSource; +import com.acupuncture.system.domain.vo.PmsTreatmentVo; +import com.acupuncture.system.domain.vo.UmsDataSourceVo; +import com.acupuncture.system.persist.mapper.DmsTenantMapper; +import com.acupuncture.system.persist.mapper.UmsDataSourceMapper; +import com.acupuncture.system.service.PmsTreatmentService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author zzc + * @Package com.acupuncture.web.controller.web + * @Date 2025/2/11 14:55 + * @description: + */ +@Slf4j +@Api(tags = "诊疗档案相关") +@RestController +@RequestMapping("/admin/treatment") +public class AdminPmsTreatmentController { + + @Resource + private PmsTreatmentService treatmentService; + @Resource + private DmsTenantMapper dmsTenantMapper; + @Resource + private UmsDataSourceMapper umsDataSourceMapper; + + @ApiOperation("查询诊疗档案") + @PostMapping("/list") + public JsonResponse> listTreatment(@RequestBody @Validated BaseDto queryDTO) { + if (queryDTO.getPageNum() > 0) { + PageHelper.startPage(queryDTO.getPageNum(), queryDTO.getPageSize()); + } + return JsonResponse.ok(new PageInfo<>(treatmentService.adminListTreatment(queryDTO.getParam()))); + } + + @ApiOperation("查询诊疗档案数据") + @PostMapping("/queryRecord") + public JsonResponse queryRecord(@RequestBody @Validated PmsTreatmentDto.QueryRecord dto) { + return JsonResponse.ok(treatmentService.adminQueryRecord(dto.getTreatmentId(), dto.getCodeList())); + } + + @ApiOperation("导出诊疗档案数据") + @PostMapping("/exportTreatment") + public void exportTreatment(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.TreatmentQueryDTO dto) { + treatmentService.adminExportTreatment(response, dto); + } + + @ApiOperation("修改诊疗档案") + @PostMapping("/upd") + public JsonResponse updateTreatment(@RequestBody @Validated PmsTreatmentDto.TreatmentUpdateDTO dto) { + DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(dto.getTenantId()); + if (dmsTenant != null) { + UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId()); + if (umsDataSource != null) { + changeDataSource(umsDataSource.getDataSourceKey()); + } + } + treatmentService.updateTreatment(dto); + return JsonResponse.ok(); + } + + private static void changeDataSource(String dataSourceKey) { + DynamicDataSourceContextHolder.setDataSourceType(dataSourceKey); + } +} 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 aea89c50..9cfdff86 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 @@ -6,6 +6,7 @@ import cn.hutool.core.util.IdUtil; import com.acupuncture.common.annotation.Anonymous; import com.acupuncture.common.core.domain.BaseDto; import com.acupuncture.common.core.domain.JsonResponse; +import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; import com.acupuncture.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.po.FmsFollowupTask; @@ -95,6 +96,7 @@ public class FmsFollowupController { if (dto.getPageNum() > 0) { PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); } + dto.getParam().setTenantId(SecurityUtils.getTenantId()); return JsonResponse.ok(new PageInfo<>(fmsFollowupService.queryPatient(dto.getParam()))); } @@ -107,6 +109,9 @@ public class FmsFollowupController { @ApiOperation("查询随访任务") @PostMapping("/queryTask") public JsonResponse> queryTask(@RequestBody @Validated BaseDto dto) { + if (dto.getPageNum() > 0) { + PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); + } return JsonResponse.ok(new PageInfo<>(fmsFollowupService.queryTask(dto.getParam()))); } 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 2951bb94..de837a3d 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 @@ -88,7 +88,7 @@ public class TaskController { { //获取随访患者列表,根据患者出院日时间和队列添加工单 //1. 查询队列 - List queueList = fmsFollowupDao.selectQueueList(null, null, null); + List queueList = fmsFollowupDao.selectQueueList(null, null, null, null); if (CollectionUtil.isEmpty(queueList)) { if (CollectionUtil.isEmpty(queueResults)) { @@ -170,12 +170,19 @@ public class TaskController { fmsFollowupTask.setStatus((byte) 0); //计算第一次随访的时间 - Calendar instance = Calendar.getInstance(); - instance.setTime(dateList.get(0)); - instance.set(Calendar.DAY_OF_MONTH, -followWindowAdys / 2); - fmsFollowupTask.setStartTime(instance.getTime()); - instance.set(Calendar.DAY_OF_MONTH, followWindowAdys); - fmsFollowupTask.setEndTime(instance.getTime()); + 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); @@ -223,11 +230,11 @@ public class TaskController { fmsFollowupTask.setEducationYears(followupPatient.getEducationYears()); fmsFollowupTask.setStatus((byte) 0); - Calendar instance = Calendar.getInstance(); - instance.setTime(dateList.get(0)); - instance.set(Calendar.DAY_OF_MONTH, -followWindowAdys / 2); fmsFollowupTask.setStartTime(date); - instance.set(Calendar.DAY_OF_MONTH, followWindowAdys); + Calendar instance = Calendar.getInstance(); + instance.setTime(date); + instance.add(Calendar.DATE, followWindowAdys / 2); + fmsFollowupTask.setEndTime(instance.getTime()); changeDataSource(result); fmsFollowupTask.setPatientId(followupPatient.getId()); diff --git a/acupuncture-admin/src/main/resources/application-stage.yml b/acupuncture-admin/src/main/resources/application-stage.yml index a08ab3d8..aa11b73b 100644 --- a/acupuncture-admin/src/main/resources/application-stage.yml +++ b/acupuncture-admin/src/main/resources/application-stage.yml @@ -15,7 +15,7 @@ spring: enabled: false url: jdbc:mysql://localhost:3306/acupuncture_yfyy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: q7510327 + password: po3OynBO[M3579p6L7)o # 初始连接数 initialSize: 5 # 最小连接池数量 diff --git a/acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java b/acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java index e9e7aa17..77880912 100644 --- a/acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java +++ b/acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java @@ -13,17 +13,31 @@ public class DiseaseMapping { public static final Map DISEASE_MAP = new HashMap<>(); static { - DISEASE_MAP.put("E66.0", "肥胖症"); - DISEASE_MAP.put("BNX040", "失眠病"); - DISEASE_MAP.put("F51.0", "失眠病"); - DISEASE_MAP.put("BNG080", "中风病"); - DISEASE_MAP.put("I63", "中风病"); - DISEASE_MAP.put("BWV120", "面瘫病"); - DISEASE_MAP.put("G51.802", "面瘫病"); - DISEASE_MAP.put("BGS000", "项痹病"); - DISEASE_MAP.put("M47.221+G55.2*", "项痹病"); - DISEASE_MAP.put("M51.202", "腰痛病"); - DISEASE_MAP.put("BNG090", "痉挛性斜颈"); - DISEASE_MAP.put("G24.300", "痉挛性斜颈"); + DISEASE_MAP.put("肥胖症", "肥胖症"); + DISEASE_MAP.put("失眠病", "失眠病"); + DISEASE_MAP.put("中风病", "中风病"); + DISEASE_MAP.put("面瘫病", "面瘫病"); + DISEASE_MAP.put("项痹病", "项痹病"); + DISEASE_MAP.put("腰痛病202", "腰痛病"); + DISEASE_MAP.put("痉挛性斜颈", "痉挛性斜颈"); + DISEASE_MAP.put("其他", "其他"); } + + + public static final Map TX_MAP = new HashMap<>(); + + static { + TX_MAP.put("隐形肥胖型", "隐形肥胖型"); + TX_MAP.put("脂肪过多型", "脂肪过多型"); + TX_MAP.put("肥胖型", "肥胖型"); + TX_MAP.put("肌肉不足型", "肌肉不足型"); + TX_MAP.put("健康匀称型", "健康匀称型"); + TX_MAP.put("超重肌肉型", "超重肌肉型"); + TX_MAP.put("消瘦型", "消瘦型"); + TX_MAP.put("低脂肪型", "低脂肪型"); + TX_MAP.put("运动员型", "运动员型"); + } + + + } 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 52dc8f7d..997b8617 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 @@ -91,6 +91,9 @@ public class SysUser extends BaseEntity private Long tenantId; + private String tenantName; + + private String tenantPhone; private Long scoreId; public SysUser() @@ -98,6 +101,22 @@ public class SysUser extends BaseEntity } + public String getTenantPhone() { + return tenantPhone; + } + + public void setTenantPhone(String tenantPhone) { + this.tenantPhone = tenantPhone; + } + + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + public SysUser(Long userId) { this.userId = userId; diff --git a/acupuncture-generator/src/main/resources/mbg.xml b/acupuncture-generator/src/main/resources/mbg.xml index 2a417959..2dd59338 100644 --- a/acupuncture-generator/src/main/resources/mbg.xml +++ b/acupuncture-generator/src/main/resources/mbg.xml @@ -57,9 +57,9 @@ - + -
+ diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminReportDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminReportDto.java index 9e5b3a77..09f9b5f0 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminReportDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminReportDto.java @@ -1,6 +1,7 @@ package com.acupuncture.system.domain.dto; import com.acupuncture.system.domain.po.RmsReportManagement; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; @@ -16,7 +17,7 @@ public class AdminReportDto { @Data public static class AddDto { - private String name; + private String typeName; } @Data public static class UpdDto { @@ -39,13 +40,13 @@ public class AdminReportDto { private Long reportType; + @JsonFormat(pattern = "yyyy-MM-dd") private Date timeRangeStart; + @JsonFormat(pattern = "yyyy-MM-dd") private Date timeRangeEnd; private Byte status; - - } @Data @@ -55,9 +56,9 @@ public class AdminReportDto { private String reportTitle; private Long reportType; - + @JsonFormat(pattern = "yyyy-MM-dd") private Date timeRangeStart; - + @JsonFormat(pattern = "yyyy-MM-dd") private Date timeRangeEnd; private Byte status; 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 a64c1ceb..51288f14 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 @@ -35,9 +35,11 @@ public class AdminTenantUserDto { private String status; - public Long getTenantId() { - return SecurityUtils.getTenantId(); - } + private String contactPhone; +// +// public Long getTenantId() { +// return SecurityUtils.getTenantId(); +// } } @Data @@ -48,8 +50,6 @@ public class AdminTenantUserDto { private String userName; - private String password; - private String nickName; private String email; @@ -59,6 +59,8 @@ public class AdminTenantUserDto { private String sex; private String status; + + private String contactPhone; } @Data diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantsDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantsDto.java index 957772a4..8adfaf14 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantsDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantsDto.java @@ -65,5 +65,6 @@ public class AdminTenantsDto { @Data public static class Query{ private String name; + private Long id; } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java index 878c351a..038bb3f4 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java @@ -21,6 +21,7 @@ public class FmsFollowupDto { public static class QueueQuery { @ApiModelProperty("队列名称") private String name; + private Long tenantId; } @Data @@ -123,6 +124,7 @@ public class FmsFollowupDto { private Long queueId; @ApiModelProperty("0 无队列") private Integer haveQueue; + private Long tenantId; } @@ -130,10 +132,19 @@ public class FmsFollowupDto { @Data public static class FollowupTaskQueryDTO { private Long queueId; + @ApiModelProperty("0待随访" + + "1已随访" + + "2失访" + + "3即将超期" + + "4超期未随访" + + "5超期已随访") private Integer status; private String keywords; private Integer startAge; private Integer endAge; + @ApiModelProperty("0待随访 1即将超期 2超期") + private Integer childStatus; + private Long tenantId; } // FollowupLostDTO.java diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java index 6d619893..69ad1987 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java @@ -99,6 +99,8 @@ public class PmsTreatmentDto { private String createBy; private String remark; private String updateBy; + private Long tenantId; + @ApiModelProperty("随访队列ID集合") private List queueIdList; @@ -131,6 +133,8 @@ public class PmsTreatmentDto { private Integer endAge; private String sourceId; private String phone; + + private Long tenantId; } @Data diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/StatisticsDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/StatisticsDto.java index fefd553e..bb717f49 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/StatisticsDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/StatisticsDto.java @@ -21,6 +21,7 @@ public class StatisticsDto { private Date endTime; @ApiModelProperty("统计方式 0:周 1:月 2:季 3:年") private Integer timeType; + private Long tenantId; } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenant.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenant.java index 8dd11f33..41560bb3 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenant.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenant.java @@ -16,7 +16,7 @@ public class DmsTenant implements Serializable { private Long dataSourceId; - private String status; + private Byte status; private Byte delFlag; @@ -80,12 +80,12 @@ public class DmsTenant implements Serializable { this.dataSourceId = dataSourceId; } - public String getStatus() { + public Byte getStatus() { return status; } - public void setStatus(String status) { - this.status = status == null ? null : status.trim(); + public void setStatus(Byte status) { + this.status = status; } public Byte getDelFlag() { diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenantExample.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenantExample.java index 99d98ebb..3ec17b9f 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenantExample.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenantExample.java @@ -515,62 +515,52 @@ public class DmsTenantExample { return (Criteria) this; } - public Criteria andStatusEqualTo(String value) { + public Criteria andStatusEqualTo(Byte value) { addCriterion("status =", value, "status"); return (Criteria) this; } - public Criteria andStatusNotEqualTo(String value) { + public Criteria andStatusNotEqualTo(Byte value) { addCriterion("status <>", value, "status"); return (Criteria) this; } - public Criteria andStatusGreaterThan(String value) { + public Criteria andStatusGreaterThan(Byte value) { addCriterion("status >", value, "status"); return (Criteria) this; } - public Criteria andStatusGreaterThanOrEqualTo(String value) { + public Criteria andStatusGreaterThanOrEqualTo(Byte value) { addCriterion("status >=", value, "status"); return (Criteria) this; } - public Criteria andStatusLessThan(String value) { + public Criteria andStatusLessThan(Byte value) { addCriterion("status <", value, "status"); return (Criteria) this; } - public Criteria andStatusLessThanOrEqualTo(String value) { + public Criteria andStatusLessThanOrEqualTo(Byte value) { addCriterion("status <=", value, "status"); return (Criteria) this; } - public Criteria andStatusLike(String value) { - addCriterion("status like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotLike(String value) { - addCriterion("status not like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusIn(List values) { + public Criteria andStatusIn(List values) { addCriterion("status in", values, "status"); return (Criteria) this; } - public Criteria andStatusNotIn(List values) { + public Criteria andStatusNotIn(List values) { addCriterion("status not in", values, "status"); return (Criteria) this; } - public Criteria andStatusBetween(String value1, String value2) { + public Criteria andStatusBetween(Byte value1, Byte value2) { addCriterion("status between", value1, value2, "status"); return (Criteria) this; } - public Criteria andStatusNotBetween(String value1, String value2) { + public Criteria andStatusNotBetween(Byte value1, Byte value2) { addCriterion("status not between", value1, value2, "status"); return (Criteria) this; } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminReportVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminReportVo.java index 643d3490..40d6596a 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminReportVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminReportVo.java @@ -2,6 +2,7 @@ package com.acupuncture.system.domain.vo; import com.acupuncture.system.domain.po.RmsReportManagement; import com.acupuncture.system.domain.po.RmsReportType; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; @@ -16,9 +17,14 @@ public class AdminReportVo { @Data public static class TypeResult { - private Integer id; + private Long id; private String typeName; + + private String createBy; + + private Date createTime; + } @Data @@ -28,18 +34,18 @@ public class AdminReportVo { private String reportTitle; private Long reportType; - + @JsonFormat(pattern = "yyyy-MM-dd") private Date timeRangeStart; - + @JsonFormat(pattern = "yyyy-MM-dd") private Date timeRangeEnd; private Byte status; - private Byte delFlag; - private String createBy; private Date createTime; + + private String typeName; } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantUserVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantUserVo.java index 4f308120..51dc94f1 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantUserVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantUserVo.java @@ -15,7 +15,7 @@ public class AdminTenantUserVo { @Data public static class Result { - private Integer id; + private Long id; private Long tenantId; @@ -36,6 +36,8 @@ public class AdminTenantUserVo { private String createBy; private Date createTime; + + private String tenantName; } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantsVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantsVo.java index 1078fbe1..4b1998c6 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantsVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantsVo.java @@ -27,11 +27,16 @@ public class AdminTenantsVo { private Long dataSourceId; - private String status; + private Byte status; private String createBy; private Date createTime; private String remark; + + private Byte dataSourceStatus; + + private String dataSourceKey; + private Byte type; } } 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 507a0d5a..d0205ebe 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 @@ -52,7 +52,8 @@ public class FmsFollowupVo { private String personInCharge; private String personInChargeUsername; private Integer status; - private Long organizationId; + private Long tenantId; + private String tenantName; private String createBy; private Date createTime; private String updateBy; @@ -63,6 +64,18 @@ public class FmsFollowupVo { @ApiModelProperty("临近提醒时间") private Integer remindTime; + + @ApiModelProperty("类型 0公共队列 1租户队列") + public Integer getType() { + if (tenantId == null) { + return 0; + } + if (tenantId == 1) { + return 0; + } + return 1; + } + } // FollowupTaskVO.java @@ -119,6 +132,9 @@ public class FmsFollowupVo { public Integer getStatus() { + if (status == 2){ + return status; + } //随访状态(0待随访, 1已随访, 2失访(手动标记)) 超期根据时间判断 超期已随访 if (status == 0) { //待随访 判断是否超期 如当前>结束时间,则超期 @@ -186,6 +202,9 @@ public class FmsFollowupVo { @ApiModelProperty("临近提醒时间") private Integer remindTime; + + private String tenantName; + public Long getPatientId() { return id; } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java index d457138e..22aaabe7 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java @@ -50,9 +50,11 @@ public class PmsTreatmentVo { private String updateBy; private Date updateTime; private String remark; - + private Long tenantId; private List queueVoList; + private String tenantName; + @Data public static class QueueVo{ private Long queueId; 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 bcbf904c..39159e86 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 @@ -83,6 +83,9 @@ public interface AdminTongjiDao { AdminStatisticsVo.TreamentVo.JlfbVo queryJlfbStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); @DataSource(DataSourceType.MASTER) - AdminStatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(StatisticsDto.Query dto, Long tenantId); + AdminStatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); + + List queryTxStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); } 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 87ff3502..5905ce39 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 @@ -25,6 +25,10 @@ public interface FmsFollowupDao { @DataSource(DataSourceType.MASTER) List queryCommonQueue(@Param("name") String name); + @DataSource(DataSourceType.MASTER) + List queryAll(@Param("name") String name, + @Param("tenantId") Long tenantId); + /** * 查询随访队列 * @param id @@ -32,18 +36,35 @@ public interface FmsFollowupDao { */ List selectQueueList(@Param("id") Long id, @Param("name") String name, - @Param("status") Byte status); + @Param("status") Byte status, + @Param("tenantId") Long tenantId); List queryPatient(@Param("id") Long id, @Param("taskFlag") Byte taskFlag, - @Param("haveQueue")Integer haveQueue); + @Param("haveQueue")Integer haveQueue, + @Param("tenantId") Long tenantId); + + List adminQueryPatient(@Param("id") Long id, + @Param("taskFlag") Byte taskFlag, + @Param("haveQueue")Integer haveQueue, + @Param("tenantId") Long tenantId); + + /** + * 查询随访任务 + * @param dto + * @return + */ + List selectTaskList(@Param("dto") FmsFollowupDto.FollowupTaskQueryDTO dto, + @Param("tenantId") Long tenantId); /** * 查询随访任务 * @param dto * @return */ - List selectTaskList(@Param("dto") FmsFollowupDto.FollowupTaskQueryDTO dto); + List adminSelectTaskList(@Param("dto") FmsFollowupDto.FollowupTaskQueryDTO dto); + + /** * 修改随访任务状态为失访 * @param dto @@ -54,4 +75,7 @@ public interface FmsFollowupDao { int completeFollowup(@Param("dto") FmsFollowupDto.FollowupCompleteDTO dto); 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 eb39e54d..55b4f978 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 @@ -1,5 +1,7 @@ package com.acupuncture.system.persist.dao; +import com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.system.domain.dto.PmsPatientDto; import com.acupuncture.system.domain.po.PmsPatient; import com.acupuncture.system.domain.vo.PmsPatientVo; @@ -18,5 +20,7 @@ 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 fe894345..629353a3 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 @@ -1,5 +1,7 @@ package com.acupuncture.system.persist.dao; +import com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.system.domain.dto.PmsTreatmentDto; import com.acupuncture.system.domain.po.PmsTreatmentRecord; import com.acupuncture.system.domain.vo.PmsTreatmentVo; @@ -15,12 +17,21 @@ import java.util.List; */ public interface PmsTreatmentDao { - List query(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query); + List query(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query, + @Param("tenantId")Long tenantId); void batchInsertRecord(List subList); 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); + + PmsTreatmentVo.TreatmentRecordVO adminQueryTreatment(@Param("id") Long id); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java index e33bdf29..bec84bed 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java @@ -42,6 +42,9 @@ public interface StatisticsDao { List queryZyzdStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); + List queryTxStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + Integer queryTotalPatient(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); @@ -79,7 +82,7 @@ public interface StatisticsDao { StatisticsVo.TreamentVo.JlfbVo queryJlfbStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - StatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(StatisticsDto.Query dto, Long tenantId); + StatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(StatisticsDto.Query dto,@Param("tenantId") Long tenantId); } 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 new file mode 100644 index 00000000..0aed8d23 --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java @@ -0,0 +1,77 @@ +package com.acupuncture.system.service; + +import com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.enums.DataSourceType; +import com.acupuncture.system.domain.dto.FmsFollowupDto; +import com.acupuncture.system.domain.vo.FmsFollowupVo; + +import java.util.List; + +/** + * @Author zzc + * @Package com.acupuncture.system.service + * @Date 2025/2/21 15:49 + * @description: + */ +public interface AdminFmsFollowupQueueService { + + /** + * 查询公共队列 + * @return + */ + @DataSource(DataSourceType.MASTER) + List queryCommonQueue(String name, Long tenantId); + + /** + * 添加删除随访队列 + * @param dto + * @return + */ + @DataSource(DataSourceType.MASTER) + int addQueue(FmsFollowupDto.Add dto); + + /** + * 更新随访队列 + * @param dto + * @return + */ + @DataSource(DataSourceType.MASTER) + int updQueue(FmsFollowupDto.Upd dto); + + /** + * 删除随访队列 + * @param dto + * @return + */ + @DataSource(DataSourceType.MASTER) + int delQueue(FmsFollowupDto.Del dto); + + /** + * 查询随访患者 + * @param dto + * @return + */ + List queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto); + + /** + * 查询随访患者 + * @param dto + * @return + */ + List adminQueryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto); + + /** + * 查询随访任务 + * @param dto + * @return + */ + List queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto); + + /** + * 查询随访任务 + * @param dto + * @return + */ + List adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO 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 98c9b5f5..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 @@ -1,5 +1,7 @@ package com.acupuncture.system.service; +import com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.vo.FmsFollowupVo; import lombok.Data; @@ -62,6 +64,15 @@ public interface FmsFollowupService { * @return */ List queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto); + + + /** + * 查询随访任务 + * @param dto + * @return + */ + @DataSource(DataSourceType.MASTER) + List adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto); /** * 标记为失访 * @param dto diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/ISysUserService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/ISysUserService.java index 3152f59c..4ea38b6a 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/ISysUserService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/ISysUserService.java @@ -194,6 +194,14 @@ public interface ISysUserService */ public int deleteUserById(Long userId); + /** + * 通过用户名删除用户 + * + * @param username 用户名 + * @return 结果 + */ + public int deleteUserByUsername(String username); + /** * 批量删除用户信息 * diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsPatientService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsPatientService.java index 68ae3e08..520ae4f1 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsPatientService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsPatientService.java @@ -50,4 +50,12 @@ public interface PmsPatientService { void importPatient(MultipartFile file) throws IOException; + /** + * 查询患者信息 + * @param dto + * @return + */ + List adminQuery(PmsPatientDto.PatientQuery dto); + + void adminExportPatient(HttpServletResponse response, PmsPatientDto.PatientQuery dto); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java index d2ff6c1f..a8f85ed5 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java @@ -46,8 +46,18 @@ public interface PmsTreatmentService { PmsTreatmentVo.TreatmentRecordVO queryRecord(Long treatmentId, List codeList); + PmsTreatmentVo.TreatmentRecordVO adminQueryRecord(Long treatmentId, List codeList); + void exportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto); void importTreatment(MultipartFile file) throws IOException; + /** + * 查询诊疗档案 + * @param queryDTO + * @return + */ + List adminListTreatment(PmsTreatmentDto.TreatmentQueryDTO queryDTO); + + void adminExportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminDataSourceServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminDataSourceServiceImpl.java index 60cfb269..d93532a9 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminDataSourceServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminDataSourceServiceImpl.java @@ -1,7 +1,9 @@ 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 com.acupuncture.common.exception.base.BaseException; import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.system.domain.dto.AdminDataSourceDto; import com.acupuncture.system.domain.po.DmsTenant; @@ -10,6 +12,7 @@ import com.acupuncture.system.domain.po.UmsDataSource; import com.acupuncture.system.domain.po.UmsDataSourceExample; import com.acupuncture.system.domain.vo.AdminDataSourceVo; import com.acupuncture.system.persist.dao.AdminDataSourceDao; +import com.acupuncture.system.persist.mapper.DmsTenantMapper; import com.acupuncture.system.persist.mapper.UmsDataSourceMapper; import com.acupuncture.system.service.AdminDataSourceService; import org.springframework.stereotype.Service; @@ -30,9 +33,19 @@ public class AdminDataSourceServiceImpl implements AdminDataSourceService { private UmsDataSourceMapper umsDataSourceMapper; @Resource private AdminDataSourceDao adminDataSourceDao; + @Resource + private DmsTenantMapper dmsTenantMapper; @Override public int insert(AdminDataSourceDto.AddDto dto) { + + UmsDataSourceExample umsDataSourceExample = new UmsDataSourceExample(); + umsDataSourceExample.createCriteria().andDelFlagEqualTo((byte) 0).andDataSourceKeyEqualTo(dto.getDataSourceKey()); + List umsDataSources = umsDataSourceMapper.selectByExample(umsDataSourceExample); + if (CollectionUtil.isNotEmpty(umsDataSources)) { + throw new BaseException("不可以重复KEY"); + } + UmsDataSource umsDataSource = BeanUtil.copyProperties(dto, UmsDataSource.class); umsDataSource.setId(IdUtil.getSnowflakeNextId()); umsDataSource.setCreateBy(SecurityUtils.getUsername()); @@ -42,6 +55,13 @@ public class AdminDataSourceServiceImpl implements AdminDataSourceService { @Override public int update(AdminDataSourceDto.UpdDto dto) { + UmsDataSourceExample umsDataSourceExample = new UmsDataSourceExample(); + umsDataSourceExample.createCriteria().andDelFlagEqualTo((byte) 0).andDataSourceKeyEqualTo(dto.getDataSourceKey()).andIdNotEqualTo(dto.getId()); + List umsDataSources = umsDataSourceMapper.selectByExample(umsDataSourceExample); + if (CollectionUtil.isNotEmpty(umsDataSources)) { + throw new BaseException("不可以重复KEY"); + } + UmsDataSource umsDataSource = BeanUtil.copyProperties(dto, UmsDataSource.class); umsDataSource.setUpdateBy(SecurityUtils.getUsername()); umsDataSource.setCreateTime(new Date()); @@ -50,6 +70,14 @@ public class AdminDataSourceServiceImpl implements AdminDataSourceService { @Override public int delete(AdminDataSourceDto.DeleteDto dto) { + DmsTenantExample dmsTenantExample = new DmsTenantExample(); + dmsTenantExample.createCriteria().andDelFlagEqualTo((byte) 0).andDataSourceIdIn(dto.getIdList()); + List dmsTenants = dmsTenantMapper.selectByExample(dmsTenantExample); + if (CollectionUtil.isNotEmpty(dmsTenants)) { + throw new BaseException("数据源有租户绑定,请先删除租户!"); + } + + UmsDataSourceExample umsDataSourceExample = new UmsDataSourceExample(); umsDataSourceExample.createCriteria().andIdIn(dto.getIdList()); UmsDataSource umsDataSource = new UmsDataSource(); 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 new file mode 100644 index 00000000..58e022ef --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java @@ -0,0 +1,165 @@ +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 com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.core.redis.RedisCache; +import com.acupuncture.common.enums.DataSourceType; +import com.acupuncture.common.utils.SecurityUtils; +import com.acupuncture.system.domain.dto.FmsFollowupDto; +import com.acupuncture.system.domain.po.FmsFollowupQueue; +import com.acupuncture.system.domain.po.FmsFollowupQueueExample; +import com.acupuncture.system.domain.vo.FmsFollowupVo; +import com.acupuncture.system.domain.vo.PmsTreatmentVo; +import com.acupuncture.system.persist.dao.FmsFollowupDao; +import com.acupuncture.system.persist.mapper.FmsFollowupQueueMapper; +import com.acupuncture.system.service.AdminFmsFollowupQueueService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @Author zzc + * @Package com.acupuncture.system.service.impl + * @Date 2025/2/21 15:50 + * @description: + */ +@Service +public class AdminFmsFollowupQueueServiceImpl implements AdminFmsFollowupQueueService { + + @Resource + private FmsFollowupDao fmsFollowupDao; + @Resource + private RedisCache redisCache; + public static String COMMON_FOLLOWUP_QUEUE = "common_followup_queue"; + @Resource + 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()); + fmsFollowupQueue.setCreateBy(SecurityUtils.getUsername()); + fmsFollowupQueue.setCreateTime(new Date()); + fmsFollowupQueue.setTenantId(SecurityUtils.getTenantId()); + return fmsFollowupQueueMapper.insertSelective(fmsFollowupQueue); + } + + @Override + @DataSource(DataSourceType.MASTER) + public int updQueue(FmsFollowupDto.Upd dto) { + FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class); + fmsFollowupQueue.setUpdateBy(SecurityUtils.getUsername()); + fmsFollowupQueue.setCreateTime(new Date()); + return fmsFollowupQueueMapper.updateByPrimaryKeySelective(fmsFollowupQueue); + } + + @Override + @DataSource(DataSourceType.MASTER) + public int delQueue(FmsFollowupDto.Del dto) { + FmsFollowupQueueExample fmsFollowupQueueExample = new FmsFollowupQueueExample(); + fmsFollowupQueueExample.createCriteria().andIdIn(dto.getIdList()); + FmsFollowupQueue fmsFollowupQueue = new FmsFollowupQueue(); + fmsFollowupQueue.setDelFlag((byte) 1); + 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()); + 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 queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) { + List followupTaskVOS = fmsFollowupDao.selectTaskList(dto, SecurityUtils.getTenantId()); + if (CollectionUtil.isEmpty(followupTaskVOS)) { + return CollectionUtil.newArrayList(); + } + return followupTaskVOS; + } + + @Override + public List adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) { + List followupTaskVOS = fmsFollowupDao.adminSelectTaskList(dto); + if (CollectionUtil.isEmpty(followupTaskVOS)) { + return CollectionUtil.newArrayList(); + } + return followupTaskVOS; + } +} diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminReportServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminReportServiceImpl.java index cc570120..84db5eda 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminReportServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminReportServiceImpl.java @@ -43,6 +43,7 @@ public class AdminReportServiceImpl implements AdminReportService { RmsReportType reportType = BeanUtil.copyProperties(dto, RmsReportType.class); reportType.setId(IdUtil.getSnowflakeNextId()); reportType.setCreateBy(SecurityUtils.getUsername()); + reportType.setTypeName(dto.getTypeName()); reportType.setCreateTime(new Date()); return rmsReportTypeMapper.insertSelective(reportType); } @@ -75,6 +76,7 @@ public class AdminReportServiceImpl implements AdminReportService { reportManagement.setId(IdUtil.getSnowflakeNextId()); reportManagement.setCreateBy(SecurityUtils.getUsername()); reportManagement.setCreateTime(new Date()); + reportManagement.setStatus((byte) 0); return rmsReportManagementMapper.insertSelective(reportManagement); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java index f7f18179..5fd3ce1a 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java @@ -2,9 +2,9 @@ package com.acupuncture.system.service.impl; import cn.hutool.core.collection.CollUtil; import com.acupuncture.common.constant.DiseaseMapping; -import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.system.domain.dto.StatisticsDto; import com.acupuncture.system.domain.vo.AdminStatisticsVo; +import com.acupuncture.system.domain.vo.StatisticsVo; import com.acupuncture.system.persist.dao.AdminTongjiDao; import com.acupuncture.system.service.AdminStatisticsService; import org.springframework.stereotype.Service; @@ -29,17 +29,30 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService { @Override public AdminStatisticsVo.PatientVo queryPatientStatistics(StatisticsDto.Query dto) { AdminStatisticsVo.PatientVo patientVo = new AdminStatisticsVo.PatientVo(); - patientVo.setGender(adminTongjiDao.queryGenderStatistics(dto, SecurityUtils.getTenantId())); - patientVo.setAge(adminTongjiDao.queryAgeStatistics(dto, SecurityUtils.getTenantId())); - patientVo.setJwbz(adminTongjiDao.queryJwbzStatistics(dto, SecurityUtils.getTenantId())); - patientVo.setTotalPatients(adminTongjiDao.queryTotalPatient(dto, SecurityUtils.getTenantId())); + AdminStatisticsVo.PatientVo.GenderVo genderVo = adminTongjiDao.queryGenderStatistics(dto, dto.getTenantId()); + if (genderVo != null) { + patientVo.setGender(genderVo); + }else { + patientVo.setGender(new AdminStatisticsVo.PatientVo.GenderVo()); + } + AdminStatisticsVo.PatientVo.AgeVo ageVo = adminTongjiDao.queryAgeStatistics(dto, dto.getTenantId()); + if (ageVo == null) { + ageVo = new AdminStatisticsVo.PatientVo.AgeVo(); + } + patientVo.setAge(ageVo); + AdminStatisticsVo.PatientVo.JwbzVo jwbzVo = adminTongjiDao.queryJwbzStatistics(dto, dto.getTenantId()); + if (jwbzVo == null) { + jwbzVo = new AdminStatisticsVo.PatientVo.JwbzVo(); + } + patientVo.setJwbz(jwbzVo); + patientVo.setTotalPatients(adminTongjiDao.queryTotalPatient(dto, dto.getTenantId())); return patientVo; } @Override public AdminStatisticsVo.TreamentVo queryZlStatistics(StatisticsDto.Query dto) { AdminStatisticsVo.TreamentVo treamentVo = new AdminStatisticsVo.TreamentVo(); - List answers = adminTongjiDao.queryZyzdStatistics(dto, SecurityUtils.getTenantId()); + List answers = adminTongjiDao.queryZyzdStatistics(dto, dto.getTenantId()); // 统计病种出现次数 if (CollUtil.isNotEmpty(answers)) { Map diseaseCountMap = new HashMap<>(); @@ -64,58 +77,81 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService { int total = sortedList.size(); for (int i = 0; i < sortedList.size(); i++) { Map.Entry entry = sortedList.get(i); - result.add(new AdminStatisticsVo.TreamentVo.SortVo(total, i + 1, "主要诊断", entry.getKey(), entry.getValue())); + result.add(new AdminStatisticsVo.TreamentVo.SortVo(entry.getValue(), i + 1, entry.getKey(), entry.getKey(), entry.getValue())); } treamentVo.setSort(result); } - treamentVo.setTxfb(adminTongjiDao.queryTxfbStatistics(dto, SecurityUtils.getTenantId())); - treamentVo.setZytz(adminTongjiDao.queryZytzStatistics(dto, SecurityUtils.getTenantId())); - treamentVo.setTtfb(adminTongjiDao.queryTtfbStatistics(dto, SecurityUtils.getTenantId())); - treamentVo.setSmfb(adminTongjiDao.querySmfbStatistics(dto, SecurityUtils.getTenantId())); - treamentVo.setJlfb(adminTongjiDao.queryJlfbStatistics(dto, SecurityUtils.getTenantId())); + List list = adminTongjiDao.queryTxStatistics(dto, dto.getTenantId()); + if (CollUtil.isNotEmpty(list)) { + Map diseaseCountMap = new HashMap<>(); + for (String answer : list) { + if (answer != null && !answer.isEmpty()) { + String[] items = answer.split("!@#"); + for (String item : items) { + String code = item.split(" ")[0]; // 提取编码 + String diseaseName = DiseaseMapping.TX_MAP.get(code); + if (diseaseName != null) { + diseaseCountMap.put(diseaseName, diseaseCountMap.getOrDefault(diseaseName, 0) + 1); + } + } + } + } + // 转换为列表并排序 + List> sortedList = new ArrayList<>(diseaseCountMap.entrySet()); + sortedList.sort((e1, e2) -> e2.getValue().compareTo(e1.getValue())); + + // 封装为SortVo对象 + AdminStatisticsVo.TreamentVo.TxfbVo txfbVo = new AdminStatisticsVo.TreamentVo.TxfbVo(); + txfbVo.setCzjrx(diseaseCountMap.getOrDefault("超重肌肉型", 0)); + txfbVo.setJrbzx(diseaseCountMap.getOrDefault("肌肉不足型", 0)); + txfbVo.setFpx(diseaseCountMap.getOrDefault("肥胖型", 0)); + txfbVo.setYxfpz(diseaseCountMap.getOrDefault("隐形肥胖型", 0)); + txfbVo.setZfgdx(diseaseCountMap.getOrDefault("脂肪过多型", 0)); + txfbVo.setDzfx(diseaseCountMap.getOrDefault("低脂肪型", 0)); + txfbVo.setYdyx(diseaseCountMap.getOrDefault("运动员型", 0)); + txfbVo.setXsx(diseaseCountMap.getOrDefault("消瘦型", 0)); + txfbVo.setTotal(sortedList.size()); + treamentVo.setTxfb(txfbVo); + }else { + treamentVo.setTxfb(new AdminStatisticsVo.TreamentVo.TxfbVo()); + } + treamentVo.setZytz(adminTongjiDao.queryZytzStatistics(dto, dto.getTenantId())); + treamentVo.setTtfb(adminTongjiDao.queryTtfbStatistics(dto, dto.getTenantId())); + treamentVo.setSmfb(adminTongjiDao.querySmfbStatistics(dto, dto.getTenantId())); + treamentVo.setJlfb(adminTongjiDao.queryJlfbStatistics(dto, dto.getTenantId())); return treamentVo; } @Override public AdminStatisticsVo.ZlTypeVo queryZlTypeStatistics(StatisticsDto.Query dto) { AdminStatisticsVo.ZlTypeVo zlTypeVo = new AdminStatisticsVo.ZlTypeVo(); - zlTypeVo.setZllxtj(adminTongjiDao.queryZllxtjStatistics(dto, SecurityUtils.getTenantId())); + zlTypeVo.setZllxtj(adminTongjiDao.queryZllxtjStatistics(dto, dto.getTenantId())); AdminStatisticsVo.ZlTypeVo.BzfffbVo bzfffbVo = new AdminStatisticsVo.ZlTypeVo.BzfffbVo(); - bzfffbVo.setFpz(adminTongjiDao.queryFpzStatistics(dto, SecurityUtils.getTenantId())); - bzfffbVo.setSmz(adminTongjiDao.querySmzStatistics(dto, SecurityUtils.getTenantId())); + bzfffbVo.setFpz(adminTongjiDao.queryFpzStatistics(dto, dto.getTenantId())); + bzfffbVo.setSmz(adminTongjiDao.querySmzStatistics(dto, dto.getTenantId())); //TODO zlTypeVo.setBzfffb(bzfffbVo); - zlTypeVo.setZlxwfb(adminTongjiDao.queryZlxgStatistics(dto, SecurityUtils.getTenantId())); - zlTypeVo.setZlfy(adminTongjiDao.queryZlfyStatistics(dto, SecurityUtils.getTenantId())); + zlTypeVo.setZlxwfb(adminTongjiDao.queryZlxgStatistics(dto, dto.getTenantId())); + zlTypeVo.setZlfy(adminTongjiDao.queryZlfyStatistics(dto, dto.getTenantId())); return zlTypeVo; } @Override public List querySfStatistics(StatisticsDto.Query dto) { - AdminStatisticsVo.SffbVo sffbVo = new AdminStatisticsVo.SffbVo(); - return adminTongjiDao.querySfStatistics(dto, SecurityUtils.getTenantId()); -// if (CollUtil.isNotEmpty(dlVos)) { -// for (AdminStatisticsVo.SffbVo.DlVo dlVo : dlVos) { -// if (dlVo.getQueueId() == 10L) { -// //减重队列 -// AdminStatisticsVo.SffbVo.DlVo jzdl = new AdminStatisticsVo.SffbVo.DlVo(); -// BeanUtil.copyProperties(dlVo, jzdl); -// sffbVo.setJzdl(jzdl); -// } else if (dlVo.getQueueId() == 11L) { -// //失眠队列 -// //减重队列 -// AdminStatisticsVo.SffbVo.DlVo smdl = new AdminStatisticsVo.SffbVo.DlVo(); -// BeanUtil.copyProperties(dlVo, smdl); -// sffbVo.setSmdl(smdl); -// } -// } -// } -// return sffbVo; + List dlVos = adminTongjiDao.querySfStatistics(dto, dto.getTenantId()); + if (CollUtil.isEmpty(dlVos)) { + return CollUtil.newArrayList(new AdminStatisticsVo.SffbVo.DlVo()); + } + return dlVos; } @Override public List querySfTjStatistics(StatisticsDto.Query dto) { - return adminTongjiDao.querySftjStatistics(dto, SecurityUtils.getTenantId()); + List sftjVos = adminTongjiDao.querySftjStatistics(dto, dto.getTenantId()); + if (CollUtil.isEmpty(sftjVos)) { + return CollUtil.newArrayList(new AdminStatisticsVo.SftjVo()); + } + return sftjVos; } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantsServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantsServiceImpl.java index 75614ab6..7cd551a9 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantsServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantsServiceImpl.java @@ -35,6 +35,7 @@ public class AdminTenantsServiceImpl implements AdminTenantsService { DmsTenant dmsTenant = BeanUtil.copyProperties(dto, DmsTenant.class); dmsTenant.setId(IdUtil.getSnowflakeNextId()); dmsTenant.setCreateBy(SecurityUtils.getUsername()); + dmsTenant.setStatus((byte) 0); dmsTenant.setCreateTime(new Date()); return dmsTenantMapper.insertSelective(dmsTenant); } @@ -43,12 +44,15 @@ public class AdminTenantsServiceImpl implements AdminTenantsService { public int update(AdminTenantsDto.UpdDto dto) { DmsTenant dmsTenant = BeanUtil.copyProperties(dto, DmsTenant.class); dmsTenant.setUpdateBy(SecurityUtils.getUsername()); - dmsTenant.setCreateTime(new Date()); + dmsTenant.setUpdateTime(new Date()); return dmsTenantMapper.updateByPrimaryKeySelective(dmsTenant); } @Override public int delete(AdminTenantsDto.DeleteDto dto) { + if (dto.getIdList().contains(1L) || dto.getIdList().contains(2L)) { + return 0; + } DmsTenantExample dmsTenantExample = new DmsTenantExample(); dmsTenantExample.createCriteria().andIdIn(dto.getIdList()); DmsTenant dmsTenant = new DmsTenant(); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java index e3865bee..865c4346 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java @@ -27,18 +27,14 @@ public class FmsFollowupQueueServiceImpl implements FmsFollowupQueueService { @Resource private RedisCache redisCache; public static String COMMON_FOLLOWUP_QUEUE = "common_followup_queue"; + @Override @DataSource(DataSourceType.MASTER) public List queryCommonQueue(String name) { -// List cacheList =redisCache.getCacheList(COMMON_FOLLOWUP_QUEUE); -// if (CollectionUtil.isEmpty(cacheList)) { redisCache.deleteObject(COMMON_FOLLOWUP_QUEUE); - List followupQueueVOS = fmsFollowupDao.queryCommonQueue(name); - redisCache.setCacheList(COMMON_FOLLOWUP_QUEUE, followupQueueVOS); - return followupQueueVOS; -// }else { -// return BeanUtil.copyToList(cacheList, FmsFollowupVo.FollowupQueueVO.class); -// } + List followupQueueVOS = fmsFollowupDao.queryCommonQueue(name); + redisCache.setCacheList(COMMON_FOLLOWUP_QUEUE, followupQueueVOS); + return followupQueueVOS; } } 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 346c59bb..9b6131a4 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 @@ -49,7 +49,7 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { @Override public List queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) { - return fmsFollowupDao.selectQueueList(dto.getId(), dto.getName(), dto.getStatus()); + return fmsFollowupDao.selectQueueList(dto.getId(), dto.getName(), dto.getStatus(), SecurityUtils.getTenantId()); } @Override @@ -81,7 +81,7 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { @Override public List queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) { - List followupPatients = fmsFollowupDao.queryPatient(dto.getQueueId(), null, dto.getHaveQueue()); + List followupPatients = fmsFollowupDao.queryPatient(dto.getQueueId(), null, dto.getHaveQueue(), dto.getTenantId()); if (CollectionUtil.isNotEmpty(followupPatients)) { List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) { @@ -158,7 +158,16 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { @Override public List queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) { - List followupTaskVOS = fmsFollowupDao.selectTaskList(dto); + List followupTaskVOS = fmsFollowupDao.selectTaskList(dto, SecurityUtils.getTenantId()); + if (CollectionUtil.isEmpty(followupTaskVOS)) { + return CollectionUtil.newArrayList(); + } + return followupTaskVOS; + } + + @Override + public List adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) { + List followupTaskVOS = fmsFollowupDao.selectTaskList(dto, null); if (CollectionUtil.isEmpty(followupTaskVOS)) { return CollectionUtil.newArrayList(); } 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 2bf84264..879795cd 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 @@ -99,6 +99,7 @@ public class PmsPatientServiceImpl implements PmsPatientService { @Override public List query(PmsPatientDto.PatientQuery dto) { + dto.setTenantId(SecurityUtils.getTenantId()); return pmsPatientDao.query(dto); } @@ -214,6 +215,81 @@ public class PmsPatientServiceImpl implements PmsPatientService { } } + @Override + public List adminQuery(PmsPatientDto.PatientQuery dto) { + return pmsPatientDao.adminQuery(dto); + } + + @Override + public void adminExportPatient(HttpServletResponse response, PmsPatientDto.PatientQuery dto) { + List patientList = adminQuery(dto); + if (CollectionUtil.isEmpty(patientList)) { + throw new BaseException("暂无数据"); + } + BigExcelWriter writer = new BigExcelWriter(patientTemplate, ""); + int row = 0; + for (int i = 0; i < patientList.size(); i++) { + row += 1; + 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")); + writer.writeCellValue(4, row, patientList.get(i).getEthnicity()); + writer.writeCellValue(5, row, patientList.get(i).getEducationYears()); + writer.writeCellValue(6, row, patientList.get(i).getPhone()); + Integer idCardType = patientList.get(i).getIdCardType(); + if (idCardType != null) { + switch (idCardType) { + case 0: + writer.writeCellValue(7, row, "身份证"); + break; + case 1: + writer.writeCellValue(7, row, "护照或外国人永居证"); + break; + case 2: + writer.writeCellValue(7, row, "港澳居民来往内地通行证"); + break; + case 3: + writer.writeCellValue(7, row, "其他"); + } + } + writer.writeCellValue(8, row, patientList.get(i).getIdCard()); + Integer source = patientList.get(i).getSource(); + if (source != null) { + switch (source) { + case 0: + writer.writeCellValue(9, row, "筛查"); + break; + case 1: + writer.writeCellValue(9, row, "录入"); + break; + case 2: + writer.writeCellValue(9, row, "HIS"); + } + } + writer.writeCellValue(10, row, patientList.get(i).getCurrentIllnessHistory()); + } + String filename = StrUtil.format("患者档案-{}.xlsx", DateUtil.date().toString("yyyyMMdd")); + + //response为HttpServletResponse对象 + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 + response.setHeader("Content-Disposition", "attachment;filename=" + filename); + ServletOutputStream out = null; + try { + out = response.getOutputStream(); + writer.flush(out); + } catch ( + IOException e) { + e.printStackTrace(); + } finally { + // 关闭writer,释放内存 + writer.close(); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + } + } + public Integer batchSave(List list) { int max = 2000; for (int start = 0; start < list.size(); start += max) { diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java index d3664137..db0dca19 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java @@ -178,7 +178,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { @Override public List listTreatment(PmsTreatmentDto.TreatmentQueryDTO queryDTO) { - List query = pmsTreatmentDao.query(queryDTO); + List query = pmsTreatmentDao.query(queryDTO, SecurityUtils.getTenantId()); if (CollectionUtil.isNotEmpty(query)) { //查询公共队列 List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); @@ -299,6 +299,30 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { return treatmentRecordVO; } + @Override + public PmsTreatmentVo.TreatmentRecordVO adminQueryRecord(Long treatmentId, List codeList) { + PmsTreatmentVo.TreatmentRecordVO treatmentRecordVO = pmsTreatmentDao.adminQueryTreatment(treatmentId); + if (treatmentRecordVO == null) { + throw new BaseException("诊疗信息不存在"); + } +// PmsTreatmentVo.TreatmentRecordVO treatmentRecordVO = new PmsTreatmentVo.TreatmentRecordVO(pmsTreatment); + List treatmentRecords = pmsTreatmentDao.adminSelectRecord(treatmentId, codeList); + //按照code分组 + Map> recordVoMap = null; + if (CollectionUtil.isNotEmpty(treatmentRecords)) { + recordVoMap = treatmentRecords.stream().collect(Collectors.groupingBy(PmsTreatmentVo.TreatmentRecord::getQuestionCode, HashMap::new, Collectors.collectingAndThen(Collectors.toList(), list -> { + //SQL中已经提前做好排序,将第一个赋值为valid + list.get(0).setValid(true); + return list; + }))); + } else { + recordVoMap = MapUtil.newHashMap(); + } + treatmentRecordVO.setRecordValDict(recordVoMap); + + return treatmentRecordVO; + } + @Override public void exportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto) { List treatmentVOList = listTreatment(dto); @@ -403,4 +427,111 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { } }); } + + @Override + public List adminListTreatment(PmsTreatmentDto.TreatmentQueryDTO queryDTO) { + List query = pmsTreatmentDao.adminQuery(queryDTO); + if (CollectionUtil.isNotEmpty(query)) { + //查询公共队列 + List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); + for (PmsTreatmentVo.TreatmentVO treatmentVO : query) { + PmsTreatmentRecordExample pmsTreatmentRecordExample = new PmsTreatmentRecordExample(); + pmsTreatmentRecordExample.createCriteria().andDelFlagEqualTo((byte) 0).andQuestionCodeEqualTo("JBXX_ZYZD").andTreatmentIdEqualTo(treatmentVO.getId()); + List pmsTreatmentRecords = pmsTreatmentRecordMapper.selectByExample(pmsTreatmentRecordExample); + List treatmentRecords = pmsTreatmentDao.adminSelectRecord(treatmentVO.getId(), CollectionUtil.newArrayList("JBXX_ZYZD")); + if (CollectionUtil.isNotEmpty(treatmentRecords)) { + List answer = treatmentRecords.get(0).getAnswer(); + if (CollectionUtil.isNotEmpty(answer)) { + treatmentVO.setDiagnosisName(answer.stream().collect(Collectors.joining(","))); + } + } + List queueVos = fmsFollowupDao.adminQueryQueueListByPatientId(treatmentVO.getPatientId()); + if (CollectionUtil.isNotEmpty(queueVos)) { + 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())); + } + List list = new ArrayList<>(); + for (PmsTreatmentVo.TreatmentVO.QueueVo queueVo : queueVos) { + if (queueVo == null || queueVo.getQueueId() == null) { + list.add(queueVo); + continue; + } + FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId()); + if (followupQueueVO != null) { + queueVo.setQueueName(followupQueueVO.getName()); + } + } + queueVos.removeAll(list); + } + treatmentVO.setQueueVoList(CollectionUtil.isEmpty(queueVos) ? CollectionUtil.newArrayList() : queueVos); + } + } + return query; + } + + @Override + public void adminExportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto) { + List treatmentVOList = adminListTreatment(dto); + if (CollectionUtil.isEmpty(treatmentVOList)) { + throw new BaseException("暂无数据"); + } + BigExcelWriter writer = new BigExcelWriter(treamentTemplate, ""); + int row = 0; + for (int i = 0; i < treatmentVOList.size(); i++) { + row += 1; + // 建档时间 患者姓名 性别 年龄 民族 受教育程度 手机号码 证件类型(0身份证;1护照或外国人永居证; 2港澳居民来往内地通行; 3台湾居民来往大陆通行证; 4其他;) 证件号码 门诊/住院 门诊号/住院号 门诊时间/住院时间 出院时间 责任医生 建档人 + + writer.writeCellValue(0, row, DateUtil.format(treatmentVOList.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss")); + writer.writeCellValue(1, row, treatmentVOList.get(i).getName()); + writer.writeCellValue(2, row, treatmentVOList.get(i).getGender() == null ? "未知" : treatmentVOList.get(i).getGender() == 0 ? "男" : "女"); + writer.writeCellValue(3, row, treatmentVOList.get(i).getAge()); + writer.writeCellValue(4, row, treatmentVOList.get(i).getEthnicity()); + writer.writeCellValue(5, row, treatmentVOList.get(i).getEducationYears()); + writer.writeCellValue(6, row, treatmentVOList.get(i).getPhone()); + Integer idCardType = treatmentVOList.get(i).getIdCardType(); + if (idCardType != null) { + switch (idCardType) { + case 0: + writer.writeCellValue(7, row, "身份证"); + break; + case 1: + writer.writeCellValue(7, row, "护照或外国人永居证"); + break; + case 2: + writer.writeCellValue(7, row, "港澳居民来往内地通行证"); + break; + case 3: + writer.writeCellValue(7, row, "其他"); + } + } + writer.writeCellValue(8, row, treatmentVOList.get(i).getIdCard()); + writer.writeCellValue(9, row, treatmentVOList.get(i).getVisitType() == 0 ? "门诊" : "住院"); + writer.writeCellValue(9, row, treatmentVOList.get(i).getVisitNumber()); + writer.writeCellValue(10, row, DateUtil.format(treatmentVOList.get(i).getVisitTime(), "yyyy-MM-dd HH:mm:ss")); + writer.writeCellValue(12, row, DateUtil.format(treatmentVOList.get(i).getDischargeTime(), "yyyy-MM-dd HH:mm:ss")); + writer.writeCellValue(13, row, treatmentVOList.get(i).getDoctor()); + writer.writeCellValue(14, row, treatmentVOList.get(i).getCreateBy()); + } + String filename = StrUtil.format("患者档案-{}.xlsx", DateUtil.date().toString("yyyyMMdd")); + + //response为HttpServletResponse对象 + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 + response.setHeader("Content-Disposition", "attachment;filename=" + filename); + ServletOutputStream out = null; + try { + out = response.getOutputStream(); + writer.flush(out); + } catch ( + IOException e) { + e.printStackTrace(); + } finally { + // 关闭writer,释放内存 + writer.close(); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + } + } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java index 10654819..40a47401 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java @@ -63,11 +63,44 @@ public class StatisticsServiceImpl implements StatisticsService { int total = sortedList.size(); for (int i = 0; i < sortedList.size(); i++) { Map.Entry entry = sortedList.get(i); - result.add(new StatisticsVo.TreamentVo.SortVo(total, i + 1, "主要诊断", entry.getKey(), entry.getValue())); + result.add(new StatisticsVo.TreamentVo.SortVo(entry.getValue(), i + 1, entry.getKey(), entry.getKey(), entry.getValue())); } treamentVo.setSort(result); } - treamentVo.setTxfb(statisticsDao.queryTxfbStatistics(dto, SecurityUtils.getTenantId())); + List list = statisticsDao.queryTxStatistics(dto, SecurityUtils.getTenantId()); + if (CollUtil.isNotEmpty(list)) { + Map diseaseCountMap = new HashMap<>(); + for (String answer : list) { + if (answer != null && !answer.isEmpty()) { + String[] items = answer.split("!@#"); + for (String item : items) { + String code = item.split(" ")[0]; // 提取编码 + String diseaseName = DiseaseMapping.TX_MAP.get(code); + if (diseaseName != null) { + diseaseCountMap.put(diseaseName, diseaseCountMap.getOrDefault(diseaseName, 0) + 1); + } + } + } + } + // 转换为列表并排序 + List> sortedList = new ArrayList<>(diseaseCountMap.entrySet()); + sortedList.sort((e1, e2) -> e2.getValue().compareTo(e1.getValue())); + + // 封装为SortVo对象 + StatisticsVo.TreamentVo.TxfbVo txfbVo = new StatisticsVo.TreamentVo.TxfbVo(); + txfbVo.setCzjrx(diseaseCountMap.getOrDefault("超重肌肉型", 0)); + txfbVo.setJrbzx(diseaseCountMap.getOrDefault("肌肉不足型", 0)); + txfbVo.setFpx(diseaseCountMap.getOrDefault("肥胖型", 0)); + txfbVo.setYxfpz(diseaseCountMap.getOrDefault("隐形肥胖型", 0)); + txfbVo.setZfgdx(diseaseCountMap.getOrDefault("脂肪过多型", 0)); + txfbVo.setDzfx(diseaseCountMap.getOrDefault("低脂肪型", 0)); + txfbVo.setYdyx(diseaseCountMap.getOrDefault("运动员型", 0)); + txfbVo.setXsx(diseaseCountMap.getOrDefault("消瘦型", 0)); + txfbVo.setTotal(sortedList.size()); + treamentVo.setTxfb(txfbVo); + } + +// treamentVo.setTxfb(statisticsDao.queryTxfbStatistics(dto, SecurityUtils.getTenantId())); treamentVo.setZytz(statisticsDao.queryZytzStatistics(dto, SecurityUtils.getTenantId())); treamentVo.setTtfb(statisticsDao.queryTtfbStatistics(dto, SecurityUtils.getTenantId())); treamentVo.setSmfb(statisticsDao.querySmfbStatistics(dto, SecurityUtils.getTenantId())); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysUserServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysUserServiceImpl.java index 0a046b65..a593c8f8 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysUserServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysUserServiceImpl.java @@ -457,6 +457,15 @@ public class SysUserServiceImpl implements ISysUserService return userMapper.deleteUserById(userId); } + @Override + public int deleteUserByUsername(String username) { + SysUser sysUser = userMapper.selectUserByUserName(username); + if (sysUser != null) { + deleteUserById(sysUser.getUserId()); + } + return 0; + } + /** * 批量删除用户信息 * diff --git a/acupuncture-system/src/main/resources/mapper/dao/AdminDataSourceDao.xml b/acupuncture-system/src/main/resources/mapper/dao/AdminDataSourceDao.xml index d5a8b03b..775ad980 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/AdminDataSourceDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/AdminDataSourceDao.xml @@ -25,6 +25,7 @@ and t.id = #{tenantId} + group by s.id order by s.create_time desc diff --git a/acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml b/acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml index a67d3c3b..351a7b0d 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml @@ -2,29 +2,33 @@ - SELECT - id, - tenant_id as tenantId, - user_name as userName, - password, - nick_name as nickName, - email, - phonenumber, - sex, - status, - del_flag as delFlag, - create_by as createBy, - create_time as createTime, - update_by as updateBy, - update_time as updateTime, - remark + u.id, + u.tenant_id as tenantId, + u.user_name as userName, + u.password, + u.nick_name as nickName, + u.email, + u.phonenumber, + u.sex, + u.status, + u.del_flag as delFlag, + u.create_by as createBy, + u.create_time as createTime, + u.update_by as updateBy, + u.update_time as updateTime, + u.remark, + t.name as tenantName FROM - dms_user + dms_user u + left join + dms_tenant t on u.tenant_id = t.id - del_flag = 0 - - AND tenant_id = #{dto.tenantId} + u.del_flag = 0 + + AND u.tenant_id = #{dto.tenantId} diff --git a/acupuncture-system/src/main/resources/mapper/dao/AdminRmsReportDao.xml b/acupuncture-system/src/main/resources/mapper/dao/AdminRmsReportDao.xml index 4a367c47..dc0fedd8 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/AdminRmsReportDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/AdminRmsReportDao.xml @@ -13,22 +13,27 @@ and type_name like concat('%', #{typeName}, '%') + order by create_time desc diff --git a/acupuncture-system/src/main/resources/mapper/dao/AdminTenantDao.xml b/acupuncture-system/src/main/resources/mapper/dao/AdminTenantDao.xml index 5708af98..eaafb9f4 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/AdminTenantDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/AdminTenantDao.xml @@ -4,28 +4,36 @@ diff --git a/acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml b/acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml index 1baab239..b2332d17 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml @@ -10,70 +10,90 @@ FROM v_pms_patient + del_flag = 0 AND tenant_id = #{tenantId} + + AND create_time >= #{dto.startTime} + + + AND create_time <= #{dto.endTime} + - SELECT answer FROM v_pms_treatment_record WHERE question_code = 'JBXX_ZYZD' and del_flag = 0 + SELECT + answer + FROM + v_pms_treatment t + left join + v_pms_treatment_record r on t.id = r.treatment_id + WHERE + r.question_code = 'JBXX_ZYZD' + and + r.del_flag = 0 + and t.del_flag = 0 + + AND t.tenant_id = #{tenantId} + @@ -197,6 +234,9 @@ question_code = 'ZLFA_ZLXG' AND t.del_flag = 0 and r.del_flag = 0 + + AND t.tenant_id = #{tenantId} + @@ -262,6 +311,9 @@ WHERE question_code = 'PG_TT_TAPS_DF' AND t.del_flag = 0 and r.del_flag = 0 + + AND t.tenant_id = #{tenantId} + + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml b/acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml index 7ce7c928..a05ab2e6 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml @@ -13,7 +13,9 @@ person_in_charge as personInCharge, person_in_charge_username as personInChargeUsername, status, - create_by as createBy + create_by as createBy, + remind_time as remindTime, + follow_window_adys as followWindowAdys from fms_followup_queue @@ -25,6 +27,40 @@ + + + + + + UPDATE fms_followup_task SET status = 2, lost_reason = #{dto.reason} @@ -198,4 +371,16 @@ r.del_flag = 0 AND r.patient_id = #{patientId} + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml index c4065813..bd5d0f80 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml @@ -2,6 +2,7 @@ + + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml index 01f5d1e1..f8fadf2d 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml @@ -29,13 +29,16 @@ create_time as createTime from pms_treatment where del_flag = 0 + + AND tenant_id = #{tenantId} + AND ( name LIKE CONCAT('%', #{query.keywords}, '%') OR pinyin_full LIKE CONCAT('%', #{query.keywords}, '%') OR pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%') OR phone LIKE CONCAT('%', #{query.keywords}, '%') - OR diagnosis_name LIKE CONCAT('%', #{query.keywords}, '%') + or id_card LIKE CONCAT('%', #{query.keywords}, '%') ) @@ -65,6 +68,106 @@ order by create_time desc + + + + insert into pms_treatment_record ( @@ -112,4 +215,26 @@ order by source_id asc, id desc + + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml b/acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml index 42d6e429..f3eee697 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml @@ -14,64 +14,81 @@ AND tenant_id = #{tenantId} + + AND create_time >= #{dto.startTime} + + + AND create_time <= #{dto.endTime} + - SELECT answer FROM pms_treatment_record WHERE question_code = 'JBXX_ZYZD' and del_flag = 0 + SELECT r.answer FROM pms_treatment_record r left join pms_treatment t on r.treatment_id = t.id + WHERE + r.question_code = 'JBXX_ZYZD' + and r.del_flag = 0 + and t.del_flag = 0 + + AND t.tenant_id = #{tenantId} + + + + @@ -194,6 +245,9 @@ question_code = 'ZLFA_ZLXG' AND t.del_flag = 0 and r.del_flag = 0 + + AND tenant_id = #{tenantId} + diff --git a/acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml b/acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml index 038ea526..42102cd5 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml @@ -47,8 +47,10 @@ and d.user_name = #{userName} + and d.del_flag = 0 and s.del_flag = 0 and t.del_flag = 0 + and t.status = 0 group by d.id diff --git a/acupuncture-system/src/main/resources/mapper/system/DmsTenantMapper.xml b/acupuncture-system/src/main/resources/mapper/system/DmsTenantMapper.xml index b567908c..8f4ad7f4 100644 --- a/acupuncture-system/src/main/resources/mapper/system/DmsTenantMapper.xml +++ b/acupuncture-system/src/main/resources/mapper/system/DmsTenantMapper.xml @@ -8,7 +8,7 @@ - + @@ -110,7 +110,7 @@ remark) values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{leader,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, #{dataSourceId,jdbcType=BIGINT}, - #{status,jdbcType=CHAR}, #{delFlag,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR}, + #{status,jdbcType=TINYINT}, #{delFlag,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}) @@ -177,7 +177,7 @@ #{dataSourceId,jdbcType=BIGINT}, - #{status,jdbcType=CHAR}, + #{status,jdbcType=TINYINT}, #{delFlag,jdbcType=TINYINT}, @@ -227,7 +227,7 @@ data_source_id = #{record.dataSourceId,jdbcType=BIGINT}, - status = #{record.status,jdbcType=CHAR}, + status = #{record.status,jdbcType=TINYINT}, del_flag = #{record.delFlag,jdbcType=TINYINT}, @@ -260,7 +260,7 @@ leader = #{record.leader,jdbcType=VARCHAR}, contact_phone = #{record.contactPhone,jdbcType=VARCHAR}, data_source_id = #{record.dataSourceId,jdbcType=BIGINT}, - status = #{record.status,jdbcType=CHAR}, + status = #{record.status,jdbcType=TINYINT}, del_flag = #{record.delFlag,jdbcType=TINYINT}, create_by = #{record.createBy,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=TIMESTAMP}, @@ -290,7 +290,7 @@ data_source_id = #{dataSourceId,jdbcType=BIGINT}, - status = #{status,jdbcType=CHAR}, + status = #{status,jdbcType=TINYINT}, del_flag = #{delFlag,jdbcType=TINYINT}, @@ -320,7 +320,7 @@ leader = #{leader,jdbcType=VARCHAR}, contact_phone = #{contactPhone,jdbcType=VARCHAR}, data_source_id = #{dataSourceId,jdbcType=BIGINT}, - status = #{status,jdbcType=CHAR}, + status = #{status,jdbcType=TINYINT}, del_flag = #{delFlag,jdbcType=TINYINT}, create_by = #{createBy,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, diff --git a/acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml b/acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml index dd88422b..6fe48291 100644 --- a/acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -133,7 +133,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"