Browse Source

提交

newMaster
zzc 3 months ago
parent
commit
b79aa16fa3
  1. 19
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysLoginController.java
  2. 98
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java
  3. 81
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminFmsFollowupController.java
  4. 65
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsPatientController.java
  5. 87
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java
  6. 5
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java
  7. 29
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java
  8. 2
      acupuncture-admin/src/main/resources/application-stage.yml
  9. 38
      acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java
  10. 19
      acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java
  11. 4
      acupuncture-generator/src/main/resources/mbg.xml
  12. 11
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminReportDto.java
  13. 12
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java
  14. 1
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantsDto.java
  15. 11
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java
  16. 4
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java
  17. 1
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/StatisticsDto.java
  18. 8
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenant.java
  19. 30
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/DmsTenantExample.java
  20. 16
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminReportVo.java
  21. 4
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantUserVo.java
  22. 7
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminTenantsVo.java
  23. 21
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java
  24. 4
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java
  25. 5
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java
  26. 30
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java
  27. 4
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsPatientDao.java
  28. 13
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/PmsTreatmentDao.java
  29. 5
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java
  30. 77
      acupuncture-system/src/main/java/com/acupuncture/system/service/AdminFmsFollowupQueueService.java
  31. 11
      acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java
  32. 8
      acupuncture-system/src/main/java/com/acupuncture/system/service/ISysUserService.java
  33. 8
      acupuncture-system/src/main/java/com/acupuncture/system/service/PmsPatientService.java
  34. 10
      acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java
  35. 28
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminDataSourceServiceImpl.java
  36. 165
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminFmsFollowupQueueServiceImpl.java
  37. 2
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminReportServiceImpl.java
  38. 110
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java
  39. 6
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantsServiceImpl.java
  40. 12
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java
  41. 15
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java
  42. 76
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java
  43. 133
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java
  44. 37
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java
  45. 9
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/SysUserServiceImpl.java
  46. 1
      acupuncture-system/src/main/resources/mapper/dao/AdminDataSourceDao.xml
  47. 44
      acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml
  48. 27
      acupuncture-system/src/main/resources/mapper/dao/AdminRmsReportDao.xml
  49. 38
      acupuncture-system/src/main/resources/mapper/dao/AdminTenantDao.xml
  50. 185
      acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml
  51. 191
      acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml
  52. 62
      acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml
  53. 127
      acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml
  54. 190
      acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml
  55. 2
      acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml
  56. 14
      acupuncture-system/src/main/resources/mapper/system/DmsTenantMapper.xml
  57. 6
      acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml

19
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<String> roles = permissionService.getRolePermission(user);
// 权限集合

98
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<Integer> 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<Integer> 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<DmsUser> dmsUsers = dmsUserMapper.selectByExample(dmsUserExample);
if (CollectionUtil.isNotEmpty(dmsUsers)) {
DmsUser dmsUser = dmsUsers.get(0);
AdminTenantsDto.Query query = new AdminTenantsDto.Query();
query.setId(dmsUser.getTenantId());
List<AdminTenantsVo.Result> 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<Integer> 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<DmsUser> dmsUsers = dmsUserMapper.selectByExample(dmsUserExample);
if (CollectionUtil.isNotEmpty(dmsUsers)) {
for (DmsUser dmsUser : dmsUsers) {
AdminTenantsDto.Query query = new AdminTenantsDto.Query();
query.setId(dmsUser.getTenantId());
List<AdminTenantsVo.Result> 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<PageInfo<AdminTenantUserVo.Result>> query(@RequestBody @Validated BaseDto<AdminTenantUserDto.Query> 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);
}
}

81
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<PageInfo<FmsFollowupVo.FollowupQueueVO>> queryCommonQueue(@RequestBody @Validated BaseDto<FmsFollowupDto.QueueQuery> 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<Integer> addQueue(@RequestBody @Validated FmsFollowupDto.Add dto){
return JsonResponse.ok(fmsFollowupQueueService.addQueue(dto));
}
@ApiOperation("更新随访队列")
@PostMapping("/upd")
public JsonResponse<Integer> updQueue(@RequestBody @Validated FmsFollowupDto.Upd dto){
return JsonResponse.ok(fmsFollowupQueueService.updQueue(dto));
}
@ApiOperation("删除随访队列")
@PostMapping("/del")
public JsonResponse<Integer> delQueue(@RequestBody @Validated FmsFollowupDto.Del dto){
return JsonResponse.ok(fmsFollowupQueueService.delQueue(dto));
}
@ApiOperation("查询随访患者")
@PostMapping("/queryPatient")
public JsonResponse<PageInfo<FmsFollowupVo.FollowupPatient>> queryPatient(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupPatientQueryDTO> 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<PageInfo<FmsFollowupVo.FollowupTaskVO>> queryTask(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupTaskQueryDTO> dto) {
if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
}
return JsonResponse.ok(new PageInfo<>(fmsFollowupQueueService.adminQueryTask(dto.getParam())));
}
}

65
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<PageInfo<PmsPatientVo.PatientResult>> adminQuery( @RequestBody @Validated BaseDto<PmsPatientDto.PatientQuery> 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);
}
}

87
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<PageInfo<PmsTreatmentVo.TreatmentVO>> listTreatment(@RequestBody @Validated BaseDto<PmsTreatmentDto.TreatmentQueryDTO> 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<PmsTreatmentVo.TreatmentRecordVO> 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<Integer> 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);
}
}

5
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<PageInfo<FmsFollowupVo.FollowupTaskVO>> queryTask(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupTaskQueryDTO> dto) {
if (dto.getPageNum() > 0) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
}
return JsonResponse.ok(new PageInfo<>(fmsFollowupService.queryTask(dto.getParam())));
}

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

@ -88,7 +88,7 @@ public class TaskController {
{
//获取随访患者列表,根据患者出院日时间和队列添加工单
//1. 查询队列
List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null);
List<FmsFollowupVo.FollowupQueueVO> 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());

2
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
# 最小连接池数量

38
acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java

@ -13,17 +13,31 @@ public class DiseaseMapping {
public static final Map<String, String> 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<String, String> 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("运动员型", "运动员型");
}
}

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

4
acupuncture-generator/src/main/resources/mbg.xml

@ -57,9 +57,9 @@
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<!-- <table tableName="dms_tenant" domainObjectName="DmsTenant" enableDeleteByExample="false"/>-->
<table tableName="dms_tenant" domainObjectName="DmsTenant" enableDeleteByExample="false"/>
<!-- <table tableName="dms_user" domainObjectName="DmsUser" enableDeleteByExample="false"/>-->
<table tableName="fms_followup_queue" domainObjectName="FmsFollowupQueue" enableDeleteByExample="false"/>
<!-- <table tableName="fms_followup_queue" domainObjectName="FmsFollowupQueue" enableDeleteByExample="false"/>-->
<!-- <table tableName="fms_followup_task" domainObjectName="FmsFollowupTask" enableDeleteByExample="false"/>-->
<!-- <table tableName="fms_patient_queue_relation" domainObjectName="FmsPatientQueueRelation" enableDeleteByExample="false"/>-->
<!-- <table tableName="pms_patient" domainObjectName="PmsPatient" enableDeleteByExample="false"/>-->

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

12
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

1
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;
}
}

11
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

4
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<Long> queueIdList;
@ -131,6 +133,8 @@ public class PmsTreatmentDto {
private Integer endAge;
private String sourceId;
private String phone;
private Long tenantId;
}
@Data

1
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;
}
}

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

30
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<String> values) {
public Criteria andStatusIn(List<Byte> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
public Criteria andStatusNotIn(List<Byte> 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;
}

16
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;
}
}

4
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;
}
}

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

21
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;
}

4
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<QueueVo> queueVoList;
private String tenantName;
@Data
public static class QueueVo{
private Long queueId;

5
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<String> queryTxStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId);
}

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

@ -25,6 +25,10 @@ public interface FmsFollowupDao {
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(@Param("name") String name);
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupQueueVO> queryAll(@Param("name") String name,
@Param("tenantId") Long tenantId);
/**
* 查询随访队列
* @param id
@ -32,18 +36,35 @@ public interface FmsFollowupDao {
*/
List<FmsFollowupVo.FollowupQueueVO> selectQueueList(@Param("id") Long id,
@Param("name") String name,
@Param("status") Byte status);
@Param("status") Byte status,
@Param("tenantId") Long tenantId);
List<FmsFollowupVo.FollowupPatient> queryPatient(@Param("id") Long id,
@Param("taskFlag") Byte taskFlag,
@Param("haveQueue")Integer haveQueue);
@Param("haveQueue")Integer haveQueue,
@Param("tenantId") Long tenantId);
List<FmsFollowupVo.FollowupPatient> adminQueryPatient(@Param("id") Long id,
@Param("taskFlag") Byte taskFlag,
@Param("haveQueue")Integer haveQueue,
@Param("tenantId") Long tenantId);
/**
* 查询随访任务
* @param dto
* @return
*/
List<FmsFollowupVo.FollowupTaskVO> selectTaskList(@Param("dto") FmsFollowupDto.FollowupTaskQueryDTO dto,
@Param("tenantId") Long tenantId);
/**
* 查询随访任务
* @param dto
* @return
*/
List<FmsFollowupVo.FollowupTaskVO> selectTaskList(@Param("dto") FmsFollowupDto.FollowupTaskQueryDTO dto);
List<FmsFollowupVo.FollowupTaskVO> adminSelectTaskList(@Param("dto") FmsFollowupDto.FollowupTaskQueryDTO dto);
/**
* 修改随访任务状态为失访
* @param dto
@ -54,4 +75,7 @@ public interface FmsFollowupDao {
int completeFollowup(@Param("dto") FmsFollowupDto.FollowupCompleteDTO dto);
List<PmsTreatmentVo.TreatmentVO.QueueVo> queryQueueListByPatientId(@Param("patientId") Long patientId);
@DataSource(DataSourceType.MASTER)
List<PmsTreatmentVo.TreatmentVO.QueueVo> adminQueryQueueListByPatientId(@Param("patientId") Long patientId);
}

4
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<PmsPatientVo.PatientResult> query(@Param("query") PmsPatientDto.PatientQuery query);
@DataSource(DataSourceType.MASTER)
List<PmsPatientVo.PatientResult> adminQuery(@Param("query") PmsPatientDto.PatientQuery query);
void batchInsert(@Param("pmsPatientList") List<PmsPatient> pmsPatientList);
}

13
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<PmsTreatmentVo.TreatmentVO> query(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query);
List<PmsTreatmentVo.TreatmentVO> query(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query,
@Param("tenantId")Long tenantId);
void batchInsertRecord(List<PmsTreatmentRecord> subList);
List<PmsTreatmentVo.TreatmentRecord> selectRecord(@Param("treatmentId") Long treatmentId,
@Param("codeList") List<String> codeList);
@DataSource(DataSourceType.MASTER)
List<PmsTreatmentVo.TreatmentRecord> adminSelectRecord(@Param("treatmentId") Long treatmentId,
@Param("codeList") List<String> codeList);
// void batchInsert(@Param("pmsPatientList") List<PmsPatient> pmsPatientList);
@DataSource(DataSourceType.MASTER)
List<PmsTreatmentVo.TreatmentVO> adminQuery(@Param("query") PmsTreatmentDto.TreatmentQueryDTO query);
PmsTreatmentVo.TreatmentRecordVO adminQueryTreatment(@Param("id") Long id);
}

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

@ -42,6 +42,9 @@ public interface StatisticsDao {
List<String> queryZyzdStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("tenantId") Long tenantId);
List<String> 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);
}

77
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<FmsFollowupVo.FollowupQueueVO> 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<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto);
/**
* 查询随访患者
* @param dto
* @return
*/
List<FmsFollowupVo.FollowupPatient> adminQueryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto);
/**
* 查询随访任务
* @param dto
* @return
*/
List<FmsFollowupVo.FollowupTaskVO> queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto);
/**
* 查询随访任务
* @param dto
* @return
*/
List<FmsFollowupVo.FollowupTaskVO> adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto);
}

11
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<FmsFollowupVo.FollowupTaskVO> queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto);
/**
* 查询随访任务
* @param dto
* @return
*/
@DataSource(DataSourceType.MASTER)
List<FmsFollowupVo.FollowupTaskVO> adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto);
/**
* 标记为失访
* @param dto

8
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);
/**
* 批量删除用户信息
*

8
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<PmsPatientVo.PatientResult> adminQuery(PmsPatientDto.PatientQuery dto);
void adminExportPatient(HttpServletResponse response, PmsPatientDto.PatientQuery dto);
}

10
acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java

@ -46,8 +46,18 @@ public interface PmsTreatmentService {
PmsTreatmentVo.TreatmentRecordVO queryRecord(Long treatmentId, List<String> codeList);
PmsTreatmentVo.TreatmentRecordVO adminQueryRecord(Long treatmentId, List<String> codeList);
void exportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto);
void importTreatment(MultipartFile file) throws IOException;
/**
* 查询诊疗档案
* @param queryDTO
* @return
*/
List<PmsTreatmentVo.TreatmentVO> adminListTreatment(PmsTreatmentDto.TreatmentQueryDTO queryDTO);
void adminExportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto);
}

28
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<UmsDataSource> 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<UmsDataSource> 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<DmsTenant> dmsTenants = dmsTenantMapper.selectByExample(dmsTenantExample);
if (CollectionUtil.isNotEmpty(dmsTenants)) {
throw new BaseException("数据源有租户绑定,请先删除租户!");
}
UmsDataSourceExample umsDataSourceExample = new UmsDataSourceExample();
umsDataSourceExample.createCriteria().andIdIn(dto.getIdList());
UmsDataSource umsDataSource = new UmsDataSource();

165
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<FmsFollowupVo.FollowupQueueVO> 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<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) {
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.queryPatient(dto.getQueueId(), null, dto.getHaveQueue(), SecurityUtils.getTenantId());
if (CollectionUtil.isNotEmpty(followupPatients)) {
List<Object> commonFollowupQueue = redisCache.getCacheList("common_followup_queue");
for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) {
if (CollectionUtil.isNotEmpty(followupPatient.getQueueList())) {
List<PmsTreatmentVo.TreatmentVO.QueueVo> queueVos = fmsFollowupDao.adminQueryQueueListByPatientId(followupPatient.getPatientId());
List<FmsFollowupVo.FollowupPatient.QueueVo> queueVoList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(queueVos)) {
queueVoList = BeanUtil.copyToList(queueVos, FmsFollowupVo.FollowupPatient.QueueVo.class);
Map<Long, FmsFollowupVo.FollowupQueueVO> map = new HashMap<>();
if (CollectionUtil.isNotEmpty(commonFollowupQueue)) {
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class);
map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
}
for (FmsFollowupVo.FollowupPatient.QueueVo queueVo : queueVoList) {
if (queueVo == null || queueVo.getQueueId() == null) {
continue;
}
FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId());
if (followupQueueVO != null) {
queueVo.setQueueName(followupQueueVO.getName());
}
}
}
followupPatient.setQueueList(queueVoList);
}
}
}
return followupPatients;
}
@Override
public List<FmsFollowupVo.FollowupPatient> adminQueryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) {
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.adminQueryPatient(dto.getQueueId(), null, dto.getHaveQueue(), dto.getTenantId());
if (CollectionUtil.isNotEmpty(followupPatients)) {
List<Object> commonFollowupQueue = redisCache.getCacheList("common_followup_queue");
for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) {
if (CollectionUtil.isNotEmpty(followupPatient.getQueueList())) {
List<PmsTreatmentVo.TreatmentVO.QueueVo> queueVos = fmsFollowupDao.adminQueryQueueListByPatientId(followupPatient.getPatientId());
List<FmsFollowupVo.FollowupPatient.QueueVo> queueVoList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(queueVos)) {
queueVoList = BeanUtil.copyToList(queueVos, FmsFollowupVo.FollowupPatient.QueueVo.class);
Map<Long, FmsFollowupVo.FollowupQueueVO> map = new HashMap<>();
if (CollectionUtil.isNotEmpty(commonFollowupQueue)) {
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class);
map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
}
for (FmsFollowupVo.FollowupPatient.QueueVo queueVo : queueVoList) {
if (queueVo == null || queueVo.getQueueId() == null) {
continue;
}
FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId());
if (followupQueueVO != null) {
queueVo.setQueueName(followupQueueVO.getName());
}
}
}
followupPatient.setQueueList(queueVoList);
}
}
}
return followupPatients;
}
@Override
public List<FmsFollowupVo.FollowupTaskVO> queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) {
List<FmsFollowupVo.FollowupTaskVO> followupTaskVOS = fmsFollowupDao.selectTaskList(dto, SecurityUtils.getTenantId());
if (CollectionUtil.isEmpty(followupTaskVOS)) {
return CollectionUtil.newArrayList();
}
return followupTaskVOS;
}
@Override
public List<FmsFollowupVo.FollowupTaskVO> adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) {
List<FmsFollowupVo.FollowupTaskVO> followupTaskVOS = fmsFollowupDao.adminSelectTaskList(dto);
if (CollectionUtil.isEmpty(followupTaskVOS)) {
return CollectionUtil.newArrayList();
}
return followupTaskVOS;
}
}

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

110
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<String> answers = adminTongjiDao.queryZyzdStatistics(dto, SecurityUtils.getTenantId());
List<String> answers = adminTongjiDao.queryZyzdStatistics(dto, dto.getTenantId());
// 统计病种出现次数
if (CollUtil.isNotEmpty(answers)) {
Map<String, Integer> 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<String, Integer> 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<String> list = adminTongjiDao.queryTxStatistics(dto, dto.getTenantId());
if (CollUtil.isNotEmpty(list)) {
Map<String, Integer> 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<Map.Entry<String, Integer>> 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<AdminStatisticsVo.SffbVo.DlVo> 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<AdminStatisticsVo.SffbVo.DlVo> dlVos = adminTongjiDao.querySfStatistics(dto, dto.getTenantId());
if (CollUtil.isEmpty(dlVos)) {
return CollUtil.newArrayList(new AdminStatisticsVo.SffbVo.DlVo());
}
return dlVos;
}
@Override
public List<AdminStatisticsVo.SftjVo> querySfTjStatistics(StatisticsDto.Query dto) {
return adminTongjiDao.querySftjStatistics(dto, SecurityUtils.getTenantId());
List<AdminStatisticsVo.SftjVo> sftjVos = adminTongjiDao.querySftjStatistics(dto, dto.getTenantId());
if (CollUtil.isEmpty(sftjVos)) {
return CollUtil.newArrayList(new AdminStatisticsVo.SftjVo());
}
return sftjVos;
}
}

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

12
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<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(String name) {
// List<Object> cacheList =redisCache.getCacheList(COMMON_FOLLOWUP_QUEUE);
// if (CollectionUtil.isEmpty(cacheList)) {
redisCache.deleteObject(COMMON_FOLLOWUP_QUEUE);
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS = fmsFollowupDao.queryCommonQueue(name);
redisCache.setCacheList(COMMON_FOLLOWUP_QUEUE, followupQueueVOS);
return followupQueueVOS;
// }else {
// return BeanUtil.copyToList(cacheList, FmsFollowupVo.FollowupQueueVO.class);
// }
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS = fmsFollowupDao.queryCommonQueue(name);
redisCache.setCacheList(COMMON_FOLLOWUP_QUEUE, followupQueueVOS);
return followupQueueVOS;
}
}

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

@ -49,7 +49,7 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
@Override
public List<FmsFollowupVo.FollowupQueueVO> 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<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) {
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.queryPatient(dto.getQueueId(), null, dto.getHaveQueue());
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.queryPatient(dto.getQueueId(), null, dto.getHaveQueue(), dto.getTenantId());
if (CollectionUtil.isNotEmpty(followupPatients)) {
List<Object> commonFollowupQueue = redisCache.getCacheList("common_followup_queue");
for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) {
@ -158,7 +158,16 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
@Override
public List<FmsFollowupVo.FollowupTaskVO> queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) {
List<FmsFollowupVo.FollowupTaskVO> followupTaskVOS = fmsFollowupDao.selectTaskList(dto);
List<FmsFollowupVo.FollowupTaskVO> followupTaskVOS = fmsFollowupDao.selectTaskList(dto, SecurityUtils.getTenantId());
if (CollectionUtil.isEmpty(followupTaskVOS)) {
return CollectionUtil.newArrayList();
}
return followupTaskVOS;
}
@Override
public List<FmsFollowupVo.FollowupTaskVO> adminQueryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) {
List<FmsFollowupVo.FollowupTaskVO> followupTaskVOS = fmsFollowupDao.selectTaskList(dto, null);
if (CollectionUtil.isEmpty(followupTaskVOS)) {
return CollectionUtil.newArrayList();
}

76
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java

@ -99,6 +99,7 @@ public class PmsPatientServiceImpl implements PmsPatientService {
@Override
public List<PmsPatientVo.PatientResult> query(PmsPatientDto.PatientQuery dto) {
dto.setTenantId(SecurityUtils.getTenantId());
return pmsPatientDao.query(dto);
}
@ -214,6 +215,81 @@ public class PmsPatientServiceImpl implements PmsPatientService {
}
}
@Override
public List<PmsPatientVo.PatientResult> adminQuery(PmsPatientDto.PatientQuery dto) {
return pmsPatientDao.adminQuery(dto);
}
@Override
public void adminExportPatient(HttpServletResponse response, PmsPatientDto.PatientQuery dto) {
List<PmsPatientVo.PatientResult> 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<PmsPatient> list) {
int max = 2000;
for (int start = 0; start < list.size(); start += max) {

133
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java

@ -178,7 +178,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
@Override
public List<PmsTreatmentVo.TreatmentVO> listTreatment(PmsTreatmentDto.TreatmentQueryDTO queryDTO) {
List<PmsTreatmentVo.TreatmentVO> query = pmsTreatmentDao.query(queryDTO);
List<PmsTreatmentVo.TreatmentVO> query = pmsTreatmentDao.query(queryDTO, SecurityUtils.getTenantId());
if (CollectionUtil.isNotEmpty(query)) {
//查询公共队列
List<Object> 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<String> codeList) {
PmsTreatmentVo.TreatmentRecordVO treatmentRecordVO = pmsTreatmentDao.adminQueryTreatment(treatmentId);
if (treatmentRecordVO == null) {
throw new BaseException("诊疗信息不存在");
}
// PmsTreatmentVo.TreatmentRecordVO treatmentRecordVO = new PmsTreatmentVo.TreatmentRecordVO(pmsTreatment);
List<PmsTreatmentVo.TreatmentRecord> treatmentRecords = pmsTreatmentDao.adminSelectRecord(treatmentId, codeList);
//按照code分组
Map<String, List<PmsTreatmentVo.TreatmentRecord>> 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<PmsTreatmentVo.TreatmentVO> treatmentVOList = listTreatment(dto);
@ -403,4 +427,111 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
}
});
}
@Override
public List<PmsTreatmentVo.TreatmentVO> adminListTreatment(PmsTreatmentDto.TreatmentQueryDTO queryDTO) {
List<PmsTreatmentVo.TreatmentVO> query = pmsTreatmentDao.adminQuery(queryDTO);
if (CollectionUtil.isNotEmpty(query)) {
//查询公共队列
List<Object> 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<PmsTreatmentRecord> pmsTreatmentRecords = pmsTreatmentRecordMapper.selectByExample(pmsTreatmentRecordExample);
List<PmsTreatmentVo.TreatmentRecord> treatmentRecords = pmsTreatmentDao.adminSelectRecord(treatmentVO.getId(), CollectionUtil.newArrayList("JBXX_ZYZD"));
if (CollectionUtil.isNotEmpty(treatmentRecords)) {
List<String> answer = treatmentRecords.get(0).getAnswer();
if (CollectionUtil.isNotEmpty(answer)) {
treatmentVO.setDiagnosisName(answer.stream().collect(Collectors.joining(",")));
}
}
List<PmsTreatmentVo.TreatmentVO.QueueVo> queueVos = fmsFollowupDao.adminQueryQueueListByPatientId(treatmentVO.getPatientId());
if (CollectionUtil.isNotEmpty(queueVos)) {
Map<Long, FmsFollowupVo.FollowupQueueVO> map = new HashMap<>();
if (CollectionUtil.isNotEmpty(commonFollowupQueue)) {
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class);
map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
}
List<PmsTreatmentVo.TreatmentVO.QueueVo> 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<PmsTreatmentVo.TreatmentVO> 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);
}
}
}

37
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<String, Integer> 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<String> list = statisticsDao.queryTxStatistics(dto, SecurityUtils.getTenantId());
if (CollUtil.isNotEmpty(list)) {
Map<String, Integer> 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<Map.Entry<String, Integer>> 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()));

9
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;
}
/**
* 批量删除用户信息
*

1
acupuncture-system/src/main/resources/mapper/dao/AdminDataSourceDao.xml

@ -25,6 +25,7 @@
and t.id = #{tenantId}
</if>
</where>
group by s.id
order by s.create_time desc
</select>

44
acupuncture-system/src/main/resources/mapper/dao/AdminDmsUserDao.xml

@ -2,29 +2,33 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.acupuncture.system.persist.dao.AdminDmsUserDao">
<select id="query" resultType="com.acupuncture.system.domain.vo.AdminTenantUserVo$Result">
<select id="query" resultType="com.acupuncture.system.domain.vo.AdminTenantUserVo$Result"
parameterType="com.acupuncture.system.domain.dto.AdminTenantUserDto$Query">
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
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{dto.tenantId}
u.del_flag = 0
<if test="dto.tenantId != null">
AND u.tenant_id = #{dto.tenantId}
</if>
</where>
</select>

27
acupuncture-system/src/main/resources/mapper/dao/AdminRmsReportDao.xml

@ -13,22 +13,27 @@
<if test="typeName != null and typeName != ''">
and type_name like concat('%', #{typeName}, '%')
</if>
order by create_time desc
</select>
<select id="queryManagerList" resultType="com.acupuncture.system.domain.vo.AdminReportVo$Result">
select
id,
report_title as reportTitle,
report_type as reportType,
time_range_start as timeRangeStart,
time_range_end as timeRangeEnd,
status,
create_by as createBy,
create_time as createTime
from rms_report_manager
where del_flag = 0
m.id,
m.report_title as reportTitle,
m.report_type as reportType,
m.time_range_start as timeRangeStart,
m.time_range_end as timeRangeEnd,
m.status,
m.create_by as createBy,
m.create_time as createTime,
t.type_name as typeName
from rms_report_management m
left join
rms_report_type t on m.report_type = t.id
where m.del_flag = 0
<if test="reportTitle != null and reportTitle != ''">
and report_title like concat('%', #{reportTitle}, '%')
and m.report_title like concat('%', #{reportTitle}, '%')
</if>
order by m.create_time desc
</select>
</mapper>

38
acupuncture-system/src/main/resources/mapper/dao/AdminTenantDao.xml

@ -4,28 +4,36 @@
<select id="query" resultType="com.acupuncture.system.domain.vo.AdminTenantsVo$Result"
parameterType="com.acupuncture.system.domain.dto.AdminTenantsDto$Query">
SELECT
id,
code,
name,
leader,
contact_phone as contactPhone,
data_source_id as dataSourceId,
status,
create_by as createBy,
create_time as createTime,
remark
t.id,
t.code,
t.name,
t.leader,
t.contact_phone as contactPhone,
t.data_source_id as dataSourceId,
t.status,
u.type,
t.create_by as createBy,
t.create_time as createTime,
t.remark,
u.data_source_key as dataSourceKey
FROM
dms_tenant
dms_tenant t
left join
ums_data_source u
on t.data_source_id = u.id
<where>
del_flag = 0
t.del_flag = 0
<if test="dto.name != null and dto.name != ''">
AND name like concat('%', #{dto.name}, '%')
AND t.name like concat('%', #{dto.name}, '%')
</if>
<if test="userId != null and userId != 1 and tenantId != null">
and id = #{tenantId}
and t.id = #{tenantId}
</if>
<if test="tenantId != null and userId != 1">
and t.id = #{tenantId}
</if>
</where>
order by create_time desc
order by u.id desc, t.create_time desc
</select>
</mapper>

185
acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml

@ -10,70 +10,90 @@
FROM
v_pms_patient
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
<if test="dto.startTime != null">
AND create_time &gt;= #{dto.startTime}
</if>
<if test="dto.endTime != null">
AND create_time &lt;= #{dto.endTime}
</if>
</where>
</select>
<select id="queryAgeStatistics" resultType="com.acupuncture.system.domain.vo.AdminStatisticsVo$PatientVo$AgeVo">
SELECT
IFNULL(SUM(CASE WHEN age BETWEEN 0 AND 40 THEN 1 ELSE 0 END), 0) as num1,
IFNULL(SUM(CASE WHEN age BETWEEN 41 AND 50 THEN 1 ELSE 0 END), 0) as num2,
IFNULL(SUM(CASE WHEN age BETWEEN 51 AND 60 THEN 1 ELSE 0 END), 0) as num3,
IFNULL(SUM(CASE WHEN age BETWEEN 61 AND 70 THEN 1 ELSE 0 END), 0) as num4,
IFNULL(SUM(CASE WHEN age BETWEEN 71 AND 80 THEN 1 ELSE 0 END), 0) as num5,
IFNULL(SUM(CASE WHEN age &gt; 80 THEN 1 ELSE 0 END), 0) as num6
SUM(CASE WHEN age BETWEEN 0 AND 40 THEN 1 ELSE 0 END) AS num1,
SUM(CASE WHEN age BETWEEN 41 AND 50 THEN 1 ELSE 0 END) AS num2,
SUM(CASE WHEN age BETWEEN 51 AND 60 THEN 1 ELSE 0 END) AS num3,
SUM(CASE WHEN age BETWEEN 61 AND 70 THEN 1 ELSE 0 END) AS num4,
SUM(CASE WHEN age BETWEEN 71 AND 80 THEN 1 ELSE 0 END) AS num5,
SUM(CASE WHEN age > 80 THEN 1 ELSE 0 END) AS num6
FROM
v_pms_treatment
<where>
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</where>
(
SELECT
TIMESTAMPDIFF(YEAR, birth_date, now()) AS age
FROM
v_pms_patient
WHERE
del_flag = 0 and
birth_date IS NOT NULL
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
<if test="dto.startTime != null">
AND create_time &gt;= #{dto.startTime}
</if>
<if test="dto.endTime != null">
AND create_time &lt;= #{dto.endTime}
</if>
) AS age_data;
</select>
<select id="queryJwbzStatistics" resultType="com.acupuncture.system.domain.vo.AdminStatisticsVo$PatientVo$JwbzVo">
SELECT
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"高血压"') THEN 1 ELSE 0 END) AS gxy, -- 高血压
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"脑血管病"') THEN 1 ELSE 0 END) AS nxgb, -- 脑血管病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"恶性肿瘤"') THEN 1 ELSE 0 END) AS exzl, -- 恶性肿瘤
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"冠心病"') THEN 1 ELSE 0 END) AS gxb, -- 冠心病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"精神疾病"') THEN 1 ELSE 0 END) AS jsjb, -- 精神疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"胃和十二指肠溃疡"') THEN 1 ELSE 0 END) AS whsezcky, -- 胃和十二指肠溃疡
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肥胖症"') THEN 1 ELSE 0 END) AS fpz, -- 肥胖症
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"骨质疏松症"') THEN 1 ELSE 0 END) AS gzssz, -- 骨质疏松症
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"遗传性、先天性疾病"') THEN 1 ELSE 0 END) AS ycxXtxjb, -- 遗传性、先天性疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"糖尿病"') THEN 1 ELSE 0 END) AS tnb, -- 糖尿病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"慢性肺系疾病"') THEN 1 ELSE 0 END) AS mxfxjb, -- 慢性肺系疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"高脂血症"') THEN 1 ELSE 0 END) AS gzxz, -- 高脂血症
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肝脏疾病"') THEN 1 ELSE 0 END) AS gzjb, -- 肝脏疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"过敏性疾病"') THEN 1 ELSE 0 END) AS gmxjb, -- 过敏性疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"关节炎"') THEN 1 ELSE 0 END) AS gjy, -- 关节炎
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"痛风"') THEN 1 ELSE 0 END) AS tf, -- 痛风
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肾炎、肾病"') THEN 1 ELSE 0 END) AS sySb, -- 肾炎、肾病
SUM(CASE WHEN FIND_IN_SET ('高血压' ,current_illness_history ) THEN 1 ELSE 0 END) AS gxy, -- 高血压
SUM(CASE WHEN FIND_IN_SET ('脑血管病' ,current_illness_history ) THEN 1 ELSE 0 END) AS nxgb, -- 脑血管病
SUM(CASE WHEN FIND_IN_SET ('恶性肿瘤' ,current_illness_history ) THEN 1 ELSE 0 END) AS exzl, -- 恶性肿瘤
SUM(CASE WHEN FIND_IN_SET ('冠心病' ,current_illness_history ) THEN 1 ELSE 0 END) AS gxb, -- 冠心病
SUM(CASE WHEN FIND_IN_SET ('精神疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS jsjb, -- 精神疾病
SUM(CASE WHEN FIND_IN_SET ('胃和十二指肠溃疡' ,current_illness_history ) THEN 1 ELSE 0 END) AS whsezcky, --
SUM(CASE WHEN FIND_IN_SET ('肥胖症' ,current_illness_history ) THEN 1 ELSE 0 END) AS fpz, -- 肥胖症
SUM(CASE WHEN FIND_IN_SET ('骨质疏松症' ,current_illness_history ) THEN 1 ELSE 0 END) AS gzssz, -- 骨质疏松症
SUM(CASE WHEN FIND_IN_SET ('遗传性、先天性疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS ycxXtxjb, --
SUM(CASE WHEN FIND_IN_SET ('糖尿病' ,current_illness_history ) THEN 1 ELSE 0 END) AS tnb, -- 糖尿病
SUM(CASE WHEN FIND_IN_SET ('慢性肺系疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS mxfxjb, -- 慢性肺系疾病
SUM(CASE WHEN FIND_IN_SET ('高脂血症' ,current_illness_history ) THEN 1 ELSE 0 END) AS gzxz, -- 高脂血症
SUM(CASE WHEN FIND_IN_SET ('肝脏疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS gzjb, -- 肝脏疾病
SUM(CASE WHEN FIND_IN_SET ('过敏性疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS gmxjb, -- 过敏性疾病
SUM(CASE WHEN FIND_IN_SET ('关节炎' ,current_illness_history ) THEN 1 ELSE 0 END) AS gjy, -- 关节炎
SUM(CASE WHEN FIND_IN_SET ('痛风' ,current_illness_history ) THEN 1 ELSE 0 END) AS tf, -- 痛风
SUM(CASE WHEN FIND_IN_SET ('肾炎、肾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS sySb, -- 肾炎、肾病
SUM(CASE WHEN
JSON_CONTAINS(current_illness_history, '"高血压"') = 0 AND
JSON_CONTAINS(current_illness_history, '"脑血管病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"恶性肿瘤"') = 0 AND
JSON_CONTAINS(current_illness_history, '"冠心病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"精神疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"胃和十二指肠溃疡"') = 0 AND
JSON_CONTAINS(current_illness_history, '"肥胖症"') = 0 AND
JSON_CONTAINS(current_illness_history, '"骨质疏松症"') = 0 AND
JSON_CONTAINS(current_illness_history, '"遗传性、先天性疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"糖尿病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"慢性肺系疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"高脂血症"') = 0 AND
JSON_CONTAINS(current_illness_history, '"肝脏疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"过敏性疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"关节炎"') = 0 AND
JSON_CONTAINS(current_illness_history, '"痛风"') = 0 AND
JSON_CONTAINS(current_illness_history, '"肾炎、肾病"') = 0
FIND_IN_SET('高血压' , current_illness_history ) = 0 AND
FIND_IN_SET('脑血管病' , current_illness_history ) = 0 AND
FIND_IN_SET('恶性肿瘤' , current_illness_history ) = 0 AND
FIND_IN_SET('冠心病' , current_illness_history ) = 0 AND
FIND_IN_SET('精神疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('胃和十二指肠溃疡' , current_illness_history ) = 0 AND
FIND_IN_SET('肥胖症' , current_illness_history ) = 0 AND
FIND_IN_SET('骨质疏松症' , current_illness_history ) = 0 AND
FIND_IN_SET('遗传性、先天性疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('糖尿病' , current_illness_history ) = 0 AND
FIND_IN_SET('慢性肺系疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('高脂血症' , current_illness_history ) = 0 AND
FIND_IN_SET('肝脏疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('过敏性疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('关节炎' , current_illness_history ) = 0 AND
FIND_IN_SET('痛风' , current_illness_history ) = 0 AND
FIND_IN_SET('肾炎、肾病' , current_illness_history ) = 0
THEN 1 ELSE 0 END) AS other -- 其他
FROM
v_pms_patient
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
@ -88,7 +108,20 @@
</resultMap>
<select id="queryZyzdStatistics" resultType="java.lang.String">
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
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
<select id="queryTotalPatient" resultType="java.lang.Integer">
SELECT
@ -96,6 +129,7 @@
FROM
v_pms_patient
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
@ -181,6 +215,9 @@
WHERE
question_code IN ( 'ZLFA_XWXLGY', 'ZLFA_YDGY', 'ZLFA_LCYYZL', 'ZLFA_ZJ', 'ZLFA_ZL' )
AND r.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
@ -197,6 +234,9 @@
question_code = 'ZLFA_ZLXG'
AND t.del_flag = 0
and r.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
<select id="queryZlfyStatistics" resultType="com.acupuncture.system.domain.vo.AdminStatisticsVo$ZlTypeVo$ZlfyVo">
@ -214,6 +254,9 @@
AND t.del_flag = 0
and r.del_flag = 0
AND answer REGEXP '^[0-9]+$';
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
<select id="querySftjStatistics" resultType="com.acupuncture.system.domain.vo.AdminStatisticsVo$SftjVo">
@ -229,6 +272,9 @@
lost_reason
ORDER BY
num DESC
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="querySfStatistics" resultType="com.acupuncture.system.domain.vo.AdminStatisticsVo$SffbVo$DlVo">
@ -236,15 +282,18 @@
queue_id as queueId,
q.name as queueName,
COUNT(*) AS num, -- 总记录数
SUM(CASE WHEN t.status = 0 AND followup_time IS NULL AND end_time &gt; NOW() THEN 1 ELSE 0 END) AS dsf, -- 待随访
SUM(CASE WHEN t.status = 0 AND followup_time IS NULL AND end_time BETWEEN DATE_SUB(NOW(), INTERVAL 2 DAY) AND DATE_ADD(NOW(), INTERVAL 2 DAY) THEN 1 ELSE 0 END) AS ljsf, -- 临近随访
SUM(CASE WHEN t.status = 0 THEN 1 ELSE 0 END) AS dsf, -- 待随访
SUM(CASE WHEN t.status = 0 AND followup_time IS NULL AND start_time BETWEEN DATE_SUB(NOW(), INTERVAL 2 DAY) AND DATE_ADD(NOW(), INTERVAL 2 DAY) THEN 1 ELSE 0 END) AS ljsf, -- 临近随访
SUM(CASE WHEN (t.status = 0 AND followup_time IS NULL AND end_time &lt; NOW()) OR (t.status = 1 AND followup_time &gt; end_time) THEN 1 ELSE 0 END) AS cqsf, -- 超期随访
SUM(CASE WHEN t.status = 1 AND followup_time &lt;= end_time THEN 1 ELSE 0 END) AS zc -- 正常随访
FROM
v_fms_followup_task t
left join fms_followup_queue q on t.queue_id = q.id
left join all_fms_followup_queue q on t.queue_id = q.id
WHERE
t.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
group by queue_id
</select>
@ -262,6 +311,9 @@
WHERE
question_code = 'PG_TT_TAPS_DF'
AND t.del_flag = 0 and r.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
<select id="querySmfbStatistics" resultType="com.acupuncture.system.domain.vo.AdminStatisticsVo$TreamentVo$SmfbVo">
@ -273,9 +325,12 @@
FROM v_pms_treatment t
left join
v_pms_treatment_record r on t.id = r.treatment_id
WHERE question_code = 'PG_SM_PHQ_9_DF'
WHERE question_code = 'PG_SM_PHQ-9_DF'
AND t.del_flag = 0
and r.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
<select id="queryJlfbStatistics" resultType="com.acupuncture.system.domain.vo.AdminStatisticsVo$TreamentVo$JlfbVo">
@ -286,9 +341,12 @@
FROM v_pms_treatment t
left join
v_pms_treatment_record r on t.id = r.treatment_id
WHERE question_code = 'PG_JL_HAMD_24_DF'
WHERE question_code = 'PG_JL_HAMD-24_DF'
AND t.del_flag = 0
and r.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
<select id="querySmzStatistics" resultType="com.acupuncture.system.domain.vo.AdminStatisticsVo$ZlTypeVo$BzfffbVo$Smz">
@ -298,9 +356,28 @@
COUNT( CASE WHEN question_code = 'ZLFA_ZJ' THEN 1 END ) AS lcyyzl,
COUNT( CASE WHEN question_code = 'ZLFA_YW' THEN 1 END ) AS zjlf
FROM
v_pms_treatment_record
v_pms_treatment t
left join
v_pms_treatment_record r on t.id = r.treatment_id
WHERE
question_code IN ( 'ZLFA_XWXLGY', 'ZLFA_YDGY', 'ZLFA_LCYYZL', 'ZLFA_ZJ', 'ZLFA_ZL' )
AND del_flag = 0
AND r.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="queryTxStatistics" resultType="java.lang.String">
SELECT answer
FROM v_pms_treatment_record r
left join
v_pms_treatment t
on r.treatment_id = t.id
WHERE r.question_code = 'PG_RTCF_TXLX'
and t.del_flag = 0
and r.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
</mapper>

191
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
<where>
@ -25,6 +27,40 @@
</where>
</select>
<select id="queryAll" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupQueueVO">
select
q.id,
q.name,
q.followup_method as followupMethod,
q.followup_type as followupType,
q.frequency,
q.followup_month as followupMonth,
q.person_in_charge as personInCharge,
q.person_in_charge_username as personInChargeUsername,
q.status,
q.tenant_id as tenantId,
q.create_by as createBy,
q.create_time as createTime,
q.remind_time as remindTime,
q.follow_window_adys as followWindowAdys,
t.name as tenantName
from
all_fms_followup_queue q
left join
dms_tenant t on q.tenant_id = t.id
where
q.del_flag = 0
and t.del_flag = 0
<if test="name != null and name != ''">
and q.name like concat('%', #{name}, '%')
</if>
<if test="tenantId != null">
and q.tenant_id = #{tenantId}
</if>
group by q.id
order by q.`tenant_id`,q.`create_time` desc
</select>
<select id="selectQueueList" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupQueueVO">
SELECT id,
name,
@ -41,6 +77,9 @@
create_time as createTime
FROM fms_followup_queue
WHERE del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
<if test="id != null">
and id = #{id}
</if>
@ -68,6 +107,7 @@
<result column="tenantId" property="tenantId"/>
<result column="createBy" property="createBy"/>
<result column="createTime" property="createTime"/>
<result column="tenantName" property="tenantName"/>
<collection property="queueList" ofType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupPatient$QueueVo">
<result column="queueId" property="queueId" />
<result column="queueName" property="queueName" />
@ -97,9 +137,12 @@
q.follow_window_adys as followWindowAdys
FROM fms_patient_queue_relation r
left join
fms_followup_queue q
fms_followup_queue q
on r.queue_id = q.id or q.id is null
WHERE r.del_flag = 0
<if test="tenantId != null">
AND r.tenant_id = #{tenantId}
</if>
<if test="haveQueue != null">
AND r.queue_id is null
</if>
@ -113,6 +156,50 @@
order by r.create_time desc
</select>
<select id="adminQueryPatient" resultMap="BaseResultMap">
select
r.patient_id as id,
r.queue_id as queueId,
r.name,
r.pinyin_full as pinyinFull,
r.pinyin_simple as pinyinSimple,
r.gender,
r.birth_date as birthDate,
r.ethnicity,
r.education_years as educationYears,
r.phone,
r.discharge_time as dischargeTime,
r.id_card_type as idCardType,
r.id_card as idCard,
r.tenant_id as tenantId,
r.create_by as createBy,
r.create_time as createTime,
q.name as queueName,
q.remind_time as remindTime,
q.follow_window_adys as followWindowAdys,
d.name as tenantName
FROM v_fms_patient_queue_relation r
left join
all_fms_followup_queue q on r.queue_id = q.id or q.id is null
left join
dms_tenant d on r.tenant_id = d.id
WHERE r.del_flag = 0
<if test="tenantId != null">
AND r.tenant_id = #{tenantId}
</if>
<if test="haveQueue != null">
AND r.queue_id is null
</if>
<if test="id != null">
AND r.queue_id = #{id}
</if>
<if test="taskFlag != null">
AND r.task_flag = #{taskFlag}
</if>
group by r.patient_id, r.tenant_id
order by r.create_time desc
</select>
<select id="selectTaskList" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupTaskVO"
parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupTaskQueryDTO">
SELECT
@ -152,12 +239,25 @@
left join
dms_tenant d on d.id = t.tenant_id and d.del_flag = 0
<where>
t.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
<if test="dto.queueId != null">
t.queue_id = #{dto.queueId}
and t.queue_id = #{dto.queueId}
</if>
<if test="dto.status != null">
AND t.status = #{dto.status}
</if>
<if test="dto.childStatus != null">
-- 0待随访 1即将超期(结束时间 - 当前时间 小于 队列配置临近提醒时间) 2超期(结束时间 小于 当前时间)
<if test="dto.childStatus == 1">
AND DATEDIFF(t.end_time , NOW()) &lt; q.remind_time and t.end_time &gt; NOW()
</if>
<if test="dto.childStatus == 2">
AND t.end_time &lt; NOW()
</if>
</if>
<if test="dto.keywords != null and dto.keywords != ''">
AND (t.name LIKE CONCAT('%', #{dto.keywords}, '%')
OR t.phone LIKE CONCAT('%', #{dto.keywords}, '%')
@ -174,6 +274,79 @@
order by t.update_time DESC
</select>
<select id="adminSelectTaskList" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupTaskVO"
parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupTaskQueryDTO">
SELECT
t.id as id,
t.patient_id as patientId,
t.name,
t.gender,
t.age,
t.ethnicity,
t.education_years as educationYears,
t.phone,
t.id_card_type as idCardType,
t.id_card as idCard,
t.tenant_id as tenantId,
t.queue_id as queueId,
t.times,
t.start_time as startTime,
t.end_time as endTime,
t.status,
t.lost_reason as reason,
t.followuper,
t.followup_time as followupTime,
t.followup_text as followupText,
t.create_by as createBy,
t.create_time as createTime,
q.name as queueName,
d.name as tenantName,
t.lost_reason as reason,
t.start_time as startTime,
t.end_time as endTime,
q.remind_time as remindTime,
q.follow_window_adys as followWindowAdys
FROM v_fms_followup_task t
left join
all_fms_followup_queue q
on t.queue_id = q.id and q.del_flag = 0
left join
dms_tenant d on d.id = t.tenant_id and d.del_flag = 0
<where>
<if test="dto.tenantId != null">
AND t.tenant_id = #{dto.tenantId}
</if>
<if test="dto.queueId != null">
t.queue_id = #{dto.queueId}
</if>
<if test="dto.status != null">
AND t.status = #{dto.status}
</if>
<if test="dto.childStatus != null">
-- 0待随访 1即将超期(结束时间 - 当前时间 小于 队列配置临近提醒时间) 2超期(结束时间 小于 当前时间)
<if test="dto.childStatus == 1">
AND DATEDIFF(t.end_time , NOW()) &lt; q.remind_time and t.end_time &gt; NOW()
</if>
<if test="dto.childStatus == 2">
AND t.end_time &lt; NOW()
</if>
</if>
<if test="dto.keywords != null and dto.keywords != ''">
AND (t.name LIKE CONCAT('%', #{dto.keywords}, '%')
OR t.phone LIKE CONCAT('%', #{dto.keywords}, '%')
OR t.id_card LIKE CONCAT('%', #{dto.keywords}, '%')
OR t.name LIKE CONCAT('%', #{dto.keywords}, '%'))
</if>
<if test="dto.startAge != null">
AND t.age >= #{dto.startAge}
</if>
<if test="dto.endAge != null">
AND t.age &lt;= #{dto.endAge}
</if>
</where>
order by t.update_time DESC
</select>
<update id="updateStatusToLost" parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupLostDTO">
UPDATE fms_followup_task
SET status = 2, lost_reason = #{dto.reason}
@ -198,4 +371,16 @@
r.del_flag = 0
AND r.patient_id = #{patientId}
</select>
<select id="adminQueryQueueListByPatientId" resultType="com.acupuncture.system.domain.vo.PmsTreatmentVo$TreatmentVO$QueueVo">
SELECT
r.queue_id AS queueId,
q.NAME AS queueName
FROM
v_fms_patient_queue_relation r
LEFT JOIN v_fms_followup_queue q ON q.id = r.queue_id
WHERE
r.del_flag = 0
AND r.patient_id = #{patientId}
</select>
</mapper>

62
acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml

@ -2,6 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.acupuncture.system.persist.dao.PmsPatientDao">
<select id="query" resultType="com.acupuncture.system.domain.vo.PmsPatientVo$PatientResult"
parameterType="com.acupuncture.system.domain.dto.PmsPatientDto$PatientQuery">
SELECT
@ -58,6 +59,67 @@
)
</if>
</where>
group by p.id
order by p.create_time desc
</select>
<select id="adminQuery" resultType="com.acupuncture.system.domain.vo.PmsPatientVo$PatientResult"
parameterType="com.acupuncture.system.domain.dto.PmsPatientDto$PatientQuery">
SELECT
p.id,
p.name,
p.gender,
p.birth_date as birthDate,
p.ethnicity,
p.education_years as educationYears,
p.phone,
p.id_card_type as idCardType,
p.id_card as idCard,
p.source,
p.current_illness_history as currentIllnessHistory,
p.current_illness_history_qt as currentIllnessHistoryQt,
p.tenant_id as tenantId,
p.create_by as createBy,
p.create_time as createTime,
t.name as tenantName
FROM
v_pms_patient p
left join
dms_tenant t
on
p.tenant_id = t.id
<where>
p.del_flag = 0
<if test="query.tenantId != null">
AND p.tenant_id = #{query.tenantId}
</if>
<if test="query.gender != null">
AND p.gender = #{query.gender}
</if>
<if test="query.phone != null and query.phone != ''">
AND p.phone = #{query.phone}
</if>
<if test="query.idCard != null and query.idCard != ''">
AND p.id_card = #{query.idCard}
</if>
<if test="query.sourceId != null">
AND p.source = #{query.sourceId}
</if>
<if test="query.startAge != null">
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), p.birth_date)), '%Y') + 0 &gt;= #{query.startAge}
</if>
<if test="query.endAge != null">
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), p.birth_date)), '%Y') + 0 &lt;= #{query.endAge}
</if>
<if test="query.keywords != null and query.keywords != ''">
AND (
p.name LIKE CONCAT('%', #{query.keywords}, '%')
OR p.pinyin_full LIKE CONCAT('%', #{query.keywords}, '%')
OR p.pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%')
or p.id_card LIKE CONCAT('%', #{query.keywords}, '%')
)
</if>
</where>
order by p.create_time desc
</select>

127
acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml

@ -29,13 +29,16 @@
create_time as createTime
from pms_treatment
where del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
<if test="query.keywords != null and query.keywords != ''">
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}, '%')
)
</if>
<if test="query.patientId != null">
@ -65,6 +68,106 @@
order by create_time desc
</select>
<select id="adminQuery" resultType="com.acupuncture.system.domain.vo.PmsTreatmentVo$TreatmentVO"
parameterType="com.acupuncture.system.domain.dto.PmsTreatmentDto$TreatmentQueryDTO">
select
t.id,
t.patient_id as patientId,
t.name,
t.gender,
t.age,
t.birth_date as birthDate,
t.ethnicity,
t.education_years as educationYears,
t.phone,
t.id_card_type as idCardType,
t.id_card as idCard,
t.visit_type as visitType,
t.visit_number as visitNumber,
t.visit_time as visitTime,
t.discharge_time as dischargeTime,
t.doctor,
t.dept_name as deptName,
t.diagnosis_code as diagnosisCode,
t.diagnosis_name as diagnosisName,
t.status,
t.tenant_id as tenantId,
t.create_by as createBy,
t.create_time as createTime,
d.name as tenantName
from v_pms_treatment t
left join
dms_tenant d on t.tenant_id = d.id
where t.del_flag = 0
<if test="query.tenantId != null">
AND t.tenant_id = #{query.tenantId}
</if>
<if test="query.keywords != null and query.keywords != ''">
AND (
t.name LIKE CONCAT('%', #{query.keywords}, '%')
OR t.pinyin_full LIKE CONCAT('%', #{query.keywords}, '%')
OR t.pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%')
OR t.phone LIKE CONCAT('%', #{query.keywords}, '%')
or t.id_card LIKE CONCAT('%', #{query.keywords}, '%')
)
</if>
<if test="query.patientId != null">
AND t.patient_id = #{query.patientId}
</if>
<if test="query.gender != null">
AND t.gender = #{query.gender}
</if>
<if test="query.phone != null and query.phone != ''">
AND t.phone = #{query.phone}
</if>
<if test="query.visitType != null">
AND t.visit_type = #{query.visitType}
</if>
<if test="query.startAge != null">
AND t.age &gt;= #{query.startAge}
</if>
<if test="query.endAge != null">
AND t.age &lt;= #{query.endAge}
</if>
<if test="query.status != null">
AND t.status = #{query.status}
</if>
<if test="query.doctor != null and query.doctor != ''">
AND t.doctor = #{query.doctor}
</if>
order by t.create_time desc
</select>
<select id="adminQueryTreatment" resultType="com.acupuncture.system.domain.vo.PmsTreatmentVo$TreatmentRecordVO">
select
id,
patient_id as patientId,
name,
gender,
age,
birth_date as birthDate,
ethnicity,
education_years as educationYears,
phone,
id_card_type as idCardType,
id_card as idCard,
visit_type as visitType,
visit_number as visitNumber,
visit_time as visitTime,
discharge_time as dischargeTime,
doctor,
dept_name as deptName,
diagnosis_code as diagnosisCode,
diagnosis_name as diagnosisName,
status,
create_by as createBy,
create_time as createTime
from
v_pms_treatment
where del_flag = 0
and id = #{id}
</select>
<insert id="batchInsertRecord">
insert into pms_treatment_record
(
@ -112,4 +215,26 @@
</if>
order by source_id asc, id desc
</select>
<select id="adminSelectRecord" resultType="com.acupuncture.system.domain.vo.PmsTreatmentVo$TreatmentRecord">
select
id,
treatment_id as treatmentId,
question_code as questionCode,
answer as answerString,
time,
source_id as sourceId,
create_by as createBy,
create_time as createTime
from v_pms_treatment_record
where treatment_id = #{treatmentId}
<if test="codeList != null and codeList.size() > 0">
and question_code in
<foreach collection="codeList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by source_id asc, id desc
</select>
</mapper>

190
acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml

@ -14,64 +14,81 @@
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
<if test="dto.startTime != null">
AND create_time &gt;= #{dto.startTime}
</if>
<if test="dto.endTime != null">
AND create_time &lt;= #{dto.endTime}
</if>
</where>
</select>
<select id="queryAgeStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$PatientVo$AgeVo">
SELECT
IFNULL(SUM(CASE WHEN age BETWEEN 0 AND 40 THEN 1 ELSE 0 END), 0) as num1,
IFNULL(SUM(CASE WHEN age BETWEEN 41 AND 50 THEN 1 ELSE 0 END), 0) as num2,
IFNULL(SUM(CASE WHEN age BETWEEN 51 AND 60 THEN 1 ELSE 0 END), 0) as num3,
IFNULL(SUM(CASE WHEN age BETWEEN 61 AND 70 THEN 1 ELSE 0 END), 0) as num4,
IFNULL(SUM(CASE WHEN age BETWEEN 71 AND 80 THEN 1 ELSE 0 END), 0) as num5,
IFNULL(SUM(CASE WHEN age &gt; 80 THEN 1 ELSE 0 END), 0) as num6
SUM(CASE WHEN age BETWEEN 0 AND 40 THEN 1 ELSE 0 END) AS num1,
SUM(CASE WHEN age BETWEEN 41 AND 50 THEN 1 ELSE 0 END) AS num2,
SUM(CASE WHEN age BETWEEN 51 AND 60 THEN 1 ELSE 0 END) AS num3,
SUM(CASE WHEN age BETWEEN 61 AND 70 THEN 1 ELSE 0 END) AS num4,
SUM(CASE WHEN age BETWEEN 71 AND 80 THEN 1 ELSE 0 END) AS num5,
SUM(CASE WHEN age > 80 THEN 1 ELSE 0 END) AS num6
FROM
pms_treatment
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</where>
(
SELECT
TIMESTAMPDIFF(YEAR, birth_date, now()) AS age
FROM
pms_patient
WHERE
del_flag = 0 and
birth_date IS NOT NULL
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
<if test="dto.startTime != null">
AND create_time &gt;= #{dto.startTime}
</if>
<if test="dto.endTime != null">
AND create_time &lt;= #{dto.endTime}
</if>
) AS age_data;
</select>
<select id="queryJwbzStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$PatientVo$JwbzVo">
SELECT
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"高血压"') THEN 1 ELSE 0 END) AS gxy, -- 高血压
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"脑血管病"') THEN 1 ELSE 0 END) AS nxgb, -- 脑血管病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"恶性肿瘤"') THEN 1 ELSE 0 END) AS exzl, -- 恶性肿瘤
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"冠心病"') THEN 1 ELSE 0 END) AS gxb, -- 冠心病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"精神疾病"') THEN 1 ELSE 0 END) AS jsjb, -- 精神疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"胃和十二指肠溃疡"') THEN 1 ELSE 0 END) AS whsezcky, -- 胃和十二指肠溃疡
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肥胖症"') THEN 1 ELSE 0 END) AS fpz, -- 肥胖症
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"骨质疏松症"') THEN 1 ELSE 0 END) AS gzssz, -- 骨质疏松症
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"遗传性、先天性疾病"') THEN 1 ELSE 0 END) AS ycxXtxjb, -- 遗传性、先天性疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"糖尿病"') THEN 1 ELSE 0 END) AS tnb, -- 糖尿病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"慢性肺系疾病"') THEN 1 ELSE 0 END) AS mxfxjb, -- 慢性肺系疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"高脂血症"') THEN 1 ELSE 0 END) AS gzxz, -- 高脂血症
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肝脏疾病"') THEN 1 ELSE 0 END) AS gzjb, -- 肝脏疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"过敏性疾病"') THEN 1 ELSE 0 END) AS gmxjb, -- 过敏性疾病
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"关节炎"') THEN 1 ELSE 0 END) AS gjy, -- 关节炎
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"痛风"') THEN 1 ELSE 0 END) AS tf, -- 痛风
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肾炎、肾病"') THEN 1 ELSE 0 END) AS sySb, -- 肾炎、肾病
SUM(CASE WHEN FIND_IN_SET ('高血压' ,current_illness_history ) THEN 1 ELSE 0 END) AS gxy, -- 高血压
SUM(CASE WHEN FIND_IN_SET ('脑血管病' ,current_illness_history ) THEN 1 ELSE 0 END) AS nxgb, -- 脑血管病
SUM(CASE WHEN FIND_IN_SET ('恶性肿瘤' ,current_illness_history ) THEN 1 ELSE 0 END) AS exzl, -- 恶性肿瘤
SUM(CASE WHEN FIND_IN_SET ('冠心病' ,current_illness_history ) THEN 1 ELSE 0 END) AS gxb, -- 冠心病
SUM(CASE WHEN FIND_IN_SET ('精神疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS jsjb, -- 精神疾病
SUM(CASE WHEN FIND_IN_SET ('胃和十二指肠溃疡' ,current_illness_history ) THEN 1 ELSE 0 END) AS whsezcky, --
SUM(CASE WHEN FIND_IN_SET ('肥胖症' ,current_illness_history ) THEN 1 ELSE 0 END) AS fpz, -- 肥胖症
SUM(CASE WHEN FIND_IN_SET ('骨质疏松症' ,current_illness_history ) THEN 1 ELSE 0 END) AS gzssz, -- 骨质疏松症
SUM(CASE WHEN FIND_IN_SET ('遗传性、先天性疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS ycxXtxjb, --
SUM(CASE WHEN FIND_IN_SET ('糖尿病' ,current_illness_history ) THEN 1 ELSE 0 END) AS tnb, -- 糖尿病
SUM(CASE WHEN FIND_IN_SET ('慢性肺系疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS mxfxjb, -- 慢性肺系疾病
SUM(CASE WHEN FIND_IN_SET ('高脂血症' ,current_illness_history ) THEN 1 ELSE 0 END) AS gzxz, -- 高脂血症
SUM(CASE WHEN FIND_IN_SET ('肝脏疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS gzjb, -- 肝脏疾病
SUM(CASE WHEN FIND_IN_SET ('过敏性疾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS gmxjb, -- 过敏性疾病
SUM(CASE WHEN FIND_IN_SET ('关节炎' ,current_illness_history ) THEN 1 ELSE 0 END) AS gjy, -- 关节炎
SUM(CASE WHEN FIND_IN_SET ('痛风' ,current_illness_history ) THEN 1 ELSE 0 END) AS tf, -- 痛风
SUM(CASE WHEN FIND_IN_SET ('肾炎、肾病' ,current_illness_history ) THEN 1 ELSE 0 END) AS sySb, -- 肾炎、肾病
SUM(CASE WHEN
JSON_CONTAINS(current_illness_history, '"高血压"') = 0 AND
JSON_CONTAINS(current_illness_history, '"脑血管病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"恶性肿瘤"') = 0 AND
JSON_CONTAINS(current_illness_history, '"冠心病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"精神疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"胃和十二指肠溃疡"') = 0 AND
JSON_CONTAINS(current_illness_history, '"肥胖症"') = 0 AND
JSON_CONTAINS(current_illness_history, '"骨质疏松症"') = 0 AND
JSON_CONTAINS(current_illness_history, '"遗传性、先天性疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"糖尿病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"慢性肺系疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"高脂血症"') = 0 AND
JSON_CONTAINS(current_illness_history, '"肝脏疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"过敏性疾病"') = 0 AND
JSON_CONTAINS(current_illness_history, '"关节炎"') = 0 AND
JSON_CONTAINS(current_illness_history, '"痛风"') = 0 AND
JSON_CONTAINS(current_illness_history, '"肾炎、肾病"') = 0
FIND_IN_SET('高血压' , current_illness_history ) = 0 AND
FIND_IN_SET('脑血管病' , current_illness_history ) = 0 AND
FIND_IN_SET('恶性肿瘤' , current_illness_history ) = 0 AND
FIND_IN_SET('冠心病' , current_illness_history ) = 0 AND
FIND_IN_SET('精神疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('胃和十二指肠溃疡' , current_illness_history ) = 0 AND
FIND_IN_SET('肥胖症' , current_illness_history ) = 0 AND
FIND_IN_SET('骨质疏松症' , current_illness_history ) = 0 AND
FIND_IN_SET('遗传性、先天性疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('糖尿病' , current_illness_history ) = 0 AND
FIND_IN_SET('慢性肺系疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('高脂血症' , current_illness_history ) = 0 AND
FIND_IN_SET('肝脏疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('过敏性疾病' , current_illness_history ) = 0 AND
FIND_IN_SET('关节炎' , current_illness_history ) = 0 AND
FIND_IN_SET('痛风' , current_illness_history ) = 0 AND
FIND_IN_SET('肾炎、肾病' , current_illness_history ) = 0
THEN 1 ELSE 0 END) AS other -- 其他
FROM
pms_patient
@ -91,8 +108,30 @@
</resultMap>
<select id="queryZyzdStatistics" resultType="java.lang.String">
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
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
<select id="queryTxStatistics" resultType="java.lang.String">
SELECT answer
FROM pms_treatment_record r
left join
pms_treatment t
on r.treatment_id = t.id
WHERE r.question_code = 'PG_RTCF_TXLX'
and t.del_flag = 0
and r.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="queryTotalPatient" resultType="java.lang.Integer">
SELECT
COUNT(1)
@ -150,6 +189,9 @@
WHERE
question_code = 'PG_TZBS_ZYTZ'
AND r.del_flag = 0 and t.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="queryZllxtjStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$Zllxtj">
@ -163,6 +205,9 @@
question_code = 'ZLFA_ZLLX'
AND t.del_flag = 0
AND t.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="queryFpzStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$BzfffbVo$Fpz">
@ -173,10 +218,16 @@
COUNT( CASE WHEN question_code = 'ZLFA_ZJ' THEN 1 END ) AS zjlf,
COUNT( CASE WHEN question_code = 'ZLFA_ZL' THEN 1 END ) AS ywzl
FROM
pms_treatment_record
pms_treatment t
left join
pms_treatment_record r on t.id = r.treatment_id
WHERE
question_code IN ( 'ZLFA_XWXLGY', 'ZLFA_YDGY', 'ZLFA_LCYYZL', 'ZLFA_ZJ', 'ZLFA_ZL' )
AND del_flag = 0
AND r.del_flag = 0
and t.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
@ -194,6 +245,9 @@
question_code = 'ZLFA_ZLXG'
AND t.del_flag = 0
and r.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="queryZlfyStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$ZlfyVo">
@ -210,7 +264,10 @@
question_code = 'ZLFA_ZTFY'
AND t.del_flag = 0
and r.del_flag = 0
AND answer REGEXP '^[0-9]+$';
AND answer REGEXP '^[0-9]+$'
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="querySftjStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$SftjVo">
@ -233,8 +290,8 @@
queue_id as queueId,
q.name as queueName,
COUNT(*) AS num, -- 总记录数
SUM(CASE WHEN t.status = 0 AND followup_time IS NULL AND end_time &gt; NOW() THEN 1 ELSE 0 END) AS dsf, -- 待随访
SUM(CASE WHEN t.status = 0 AND followup_time IS NULL AND end_time BETWEEN DATE_SUB(NOW(), INTERVAL 2 DAY) AND DATE_ADD(NOW(), INTERVAL 2 DAY) THEN 1 ELSE 0 END) AS ljsf, -- 临近随访
SUM(CASE WHEN t.status = 0 THEN 1 ELSE 0 END) AS dsf, -- 待随访
SUM(CASE WHEN t.status = 0 AND followup_time IS NULL AND start_time BETWEEN DATE_SUB(NOW(), INTERVAL 2 DAY) AND DATE_ADD(NOW(), INTERVAL 2 DAY) THEN 1 ELSE 0 END) AS ljsf, -- 临近随访
SUM(CASE WHEN (t.status = 0 AND followup_time IS NULL AND end_time &lt; NOW()) OR (t.status = 1 AND followup_time &gt; end_time) THEN 1 ELSE 0 END) AS cqsf, -- 超期随访
SUM(CASE WHEN t.status = 1 AND followup_time &lt;= end_time THEN 1 ELSE 0 END) AS zc -- 正常随访
FROM
@ -242,7 +299,11 @@
left join fms_followup_queue q on t.queue_id = q.id
WHERE
t.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
group by queue_id
</select>
<select id="queryTtfbStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$TreamentVo$TtfbVo">
@ -259,6 +320,9 @@
WHERE
question_code = 'PG_TT_TAPS_DF'
AND t.del_flag = 0 and r.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="querySmfbStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$TreamentVo$SmfbVo">
@ -270,9 +334,12 @@
FROM pms_treatment t
left join
pms_treatment_record r on t.id = r.treatment_id
WHERE question_code = 'PG_SM_PHQ_9_DF'
WHERE question_code = 'PG_SM_PHQ-9_DF'
AND t.del_flag = 0
and r.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="queryJlfbStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$TreamentVo$JlfbVo">
@ -283,9 +350,12 @@
FROM pms_treatment t
left join
pms_treatment_record r on t.id = r.treatment_id
WHERE question_code = 'PG_JL_HAMD_24_DF'
WHERE question_code = 'PG_JL_HAMD-24_DF'
AND t.del_flag = 0
and r.del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
</select>
<select id="querySmzStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$BzfffbVo$Smz">
@ -294,10 +364,14 @@
COUNT( CASE WHEN question_code = 'ZLFA_XLTS' THEN 1 END ) AS ydgy,
COUNT( CASE WHEN question_code = 'ZLFA_ZJ' THEN 1 END ) AS lcyyzl,
COUNT( CASE WHEN question_code = 'ZLFA_YW' THEN 1 END ) AS zjlf
FROM
pms_treatment_record
FROM pms_treatment t
left join
pms_treatment_record r on t.id = r.treatment_id
WHERE
question_code IN ( 'ZLFA_XWXLGY', 'ZLFA_YDGY', 'ZLFA_LCYYZL', 'ZLFA_ZJ', 'ZLFA_ZL' )
AND del_flag = 0
AND r.del_flag = 0
<if test="tenantId != null">
AND t.tenant_id = #{tenantId}
</if>
</select>
</mapper>

2
acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml

@ -47,8 +47,10 @@
<if test="userName != null and userName != ''">
and d.user_name = #{userName}
</if>
and d.del_flag = 0
and s.del_flag = 0
and t.del_flag = 0
and t.status = 0
</where>
group by d.id
</select>

14
acupuncture-system/src/main/resources/mapper/system/DmsTenantMapper.xml

@ -8,7 +8,7 @@
<result column="leader" jdbcType="VARCHAR" property="leader" />
<result column="contact_phone" jdbcType="VARCHAR" property="contactPhone" />
<result column="data_source_id" jdbcType="BIGINT" property="dataSourceId" />
<result column="status" jdbcType="CHAR" property="status" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="del_flag" jdbcType="TINYINT" property="delFlag" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@ -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})
</insert>
@ -177,7 +177,7 @@
#{dataSourceId,jdbcType=BIGINT},
</if>
<if test="status != null">
#{status,jdbcType=CHAR},
#{status,jdbcType=TINYINT},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=TINYINT},
@ -227,7 +227,7 @@
data_source_id = #{record.dataSourceId,jdbcType=BIGINT},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=CHAR},
status = #{record.status,jdbcType=TINYINT},
</if>
<if test="record.delFlag != null">
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},
</if>
<if test="status != null">
status = #{status,jdbcType=CHAR},
status = #{status,jdbcType=TINYINT},
</if>
<if test="delFlag != null">
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},

6
acupuncture-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -133,7 +133,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserByTenantId" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.tenant_id = #{tenantId} and u.user_name = #{userName}
where
u.user_name = #{userName}
<if test="tenantId != null">
and u.tenant_id = #{tenantId}
</if>
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">

Loading…
Cancel
Save