From 7d31af857eccff97123ac280bf12bcbe2fd3c42c Mon Sep 17 00:00:00 2001 From: zzc Date: Mon, 17 Mar 2025 19:06:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysUserController.java | 25 ++ .../web/AdminDmsUserController.java | 2 +- .../web/AdminPmsTreatmentController.java | 12 + .../controller/web/ExternalController.java | 149 +++++++++++- .../web/PmsTreatmentController.java | 6 + .../controller/web/ScreeningController.java | 17 ++ .../controller/web/WxQrCodeController.java | 14 ++ .../acupuncture/web/task/TaskController.java | 2 +- .../src/main/resources/application-stage.yml | 1 + .../common/utils/SecurityUtils.java | 3 +- .../framework/config/SecurityConfig.java | 2 +- .../system/domain/dto/ExternalDto.java | 157 ++++++------ .../system/domain/dto/PmsTreatmentDto.java | 8 + .../system/domain/dto/ScreeningDto.java | 2 + .../system/domain/po/UplReportImage.java | 12 +- .../domain/po/UplReportImageExample.java | 56 ++--- .../system/domain/vo/PmsTreatmentVo.java | 4 + .../system/domain/vo/UplRtcfInfoVo.java | 224 ++++++++++++++++++ .../system/mapper/SysRoleMapper.java | 4 + .../system/persist/dao/DmsUserDao.java | 4 + .../persist/dao/ScreeningDetailDao.java | 9 + .../system/persist/dao/UmsDataSourceDao.java | 3 +- .../system/persist/dao/WxQrCodeDao.java | 11 + .../system/service/ExternalService.java | 21 +- .../system/service/IScreeningService.java | 4 + .../system/service/PmsTreatmentService.java | 9 + .../system/service/WxQrCodeService.java | 4 + .../service/impl/ExternalServiceImpl.java | 102 +++++++- .../service/impl/PmsPatientServiceImpl.java | 3 + .../service/impl/PmsTreatmentServiceImpl.java | 218 ++++++++++++++--- .../service/impl/ScreeningServiceImpl.java | 133 +++++++++++ .../service/impl/WxQrCodeServiceImpl.java | 50 ++++ .../main/resources/mapper/dao/ExternalDao.xml | 2 +- .../resources/mapper/dao/PmsTreatmentDao.xml | 1 + .../mapper/dao/ScreeningDetailDao.xml | 53 +++++ .../main/resources/mapper/dao/SysPowerDao.xml | 14 ++ .../resources/mapper/dao/UmsDataSourceDao.xml | 3 + .../main/resources/mapper/dao/WxQrCodeDao.xml | 42 ++++ .../mapper/system/UplReportImageMapper.xml | 28 +-- 39 files changed, 1232 insertions(+), 182 deletions(-) create mode 100644 acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/UplRtcfInfoVo.java diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java index 6c78824c..2ca06b37 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/system/SysUserController.java @@ -2,7 +2,15 @@ package com.acupuncture.web.controller.system; import java.util.List; import java.util.stream.Collectors; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; + +import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; +import com.acupuncture.system.domain.po.DmsTenant; +import com.acupuncture.system.domain.po.UmsDataSource; +import com.acupuncture.system.domain.vo.UmsDataSourceVo; +import com.acupuncture.system.persist.mapper.DmsTenantMapper; +import com.acupuncture.system.persist.mapper.UmsDataSourceMapper; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -53,6 +61,12 @@ public class SysUserController extends BaseController @Autowired private ISysPostService postService; + @Resource + private DmsTenantMapper dmsTenantMapper; + + @Resource + private UmsDataSourceMapper umsDataSourceMapper; + /** * 获取用户列表 */ @@ -151,6 +165,7 @@ public class SysUserController extends BaseController @PutMapping public AjaxResult edit(@Validated @RequestBody SysUser user) { +// changeDataSource(user.getTenantId()); userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); deptService.checkDeptDataScope(user.getDeptId()); @@ -171,6 +186,16 @@ public class SysUserController extends BaseController return toAjax(userService.updateUser(user)); } + private void changeDataSource(Long tenantId) { + DmsTenant dmsTenant = dmsTenantMapper.selectByPrimaryKey(tenantId); + if (dmsTenant != null) { + UmsDataSource umsDataSource = umsDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId()); + if (umsDataSource != null) { + DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey()); + } + } + } + /** * 删除用户 */ diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java index 2d6f48db..49193abc 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java @@ -85,7 +85,7 @@ public class AdminDmsUserController { } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { return JsonResponse.ok().fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } - user.setTenantId(SecurityUtils.getTenantId()); + user.setTenantId(dto.getTenantId()); user.setCreateBy(SecurityUtils.getUsername()); user.setPhonenumber(dto.getContactPhone()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java index 219a70f4..8f900a27 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java @@ -84,4 +84,16 @@ public class AdminPmsTreatmentController { private static void changeDataSource(String dataSourceKey) { DynamicDataSourceContextHolder.setDataSourceType(dataSourceKey); } + + @ApiOperation("导出诊疗档案评估报告") + @PostMapping("/exportTreatmentPg") + public JsonResponse exportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){ + return JsonResponse.ok(treatmentService.exportTreatmentPg(response, dto)); + } + + @ApiOperation("后台导出诊疗档案评估报告") + @PostMapping("/admin/exportTreatmentPg") + public JsonResponse adminExportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){ + return JsonResponse.ok(treatmentService.adminExportTreatmentPg(response, dto)); + } } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java index 08cbea0b..ba6c7c30 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java @@ -1,16 +1,36 @@ package com.acupuncture.web.controller.web; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.acupuncture.common.annotation.Anonymous; import com.acupuncture.common.config.RuoYiConfig; import com.acupuncture.common.core.domain.AjaxResult; import com.acupuncture.common.core.domain.BaseDto; +import com.acupuncture.common.core.domain.JsonResponse; +import com.acupuncture.common.core.redis.RedisCache; +import com.acupuncture.common.exception.base.BaseException; import com.acupuncture.common.utils.file.FileUploadUtils; import com.acupuncture.common.utils.file.FileUtils; +import com.acupuncture.framework.config.ServerConfig; +import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; import com.acupuncture.system.domain.dto.ExternalDto; +import com.acupuncture.system.domain.po.UplReportImage; +import com.acupuncture.system.domain.po.UplRtcfInfo; import com.acupuncture.system.domain.vo.ExternalVo; +import com.acupuncture.system.domain.vo.UmsDataSourceVo; +import com.acupuncture.system.domain.vo.UplRtcfInfoVo; +import com.acupuncture.system.persist.dao.UmsDataSourceDao; import com.acupuncture.system.service.ExternalService; +import com.mysql.cj.xdevapi.JsonArray; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import jdk.nashorn.internal.runtime.logging.Logger; import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.annotations.Param; +import org.apache.regexp.RE; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -31,10 +51,19 @@ public class ExternalController { @Resource private ExternalService externalService; + @Autowired + private ServerConfig serverConfig; + @Resource + private UmsDataSourceDao umsDataSourceDao; + @Resource + private RedisCache redisCache; + @Anonymous @ApiOperation("获取人员信息") @GetMapping("/http/getUserInfo") public Object test(@RequestParam("from") String from, @RequestParam("memberid") String memberid) { + log.info("获取人员信息:{},{}",from, memberid); + checkoutData(from); ExternalVo.Result query = externalService.query(from, memberid); if (query == null) { return "no person"; @@ -42,22 +71,116 @@ public class ExternalController { return query; } - @ApiOperation("上传数据") - @PostMapping("/http/uploadMemberInfo") - public Object add(@RequestBody BaseDto dto){ - int add = externalService.add(dto.getParam().getList()); - if (add == 0) { - return "upload fail"; + //切换数据源 + private void checkoutData(String from) { + //根据社区ID查询数据源 + List dataSourceList = umsDataSourceDao.query(Long.parseLong(from)); + if (CollectionUtil.isEmpty(dataSourceList)) { + throw new BaseException("查询不到社区"); } - return "upload ok"; + //切换数据源查询 + changeDataSource(dataSourceList.get(0).getDataSourceKey()); } -// /** -// * 上传测试报告 -// * @param reportImageVo -// * @return -// */ -// int addReportImage(ExternalDto.ReportImageDto reportImageVo){ + private static void changeDataSource(String key) { + DynamicDataSourceContextHolder.setDataSourceType(key); + } + +// @Anonymous +// @ApiOperation("上传数据") +// @PostMapping("/http/uploadMemberInfo") +// public Object add(@RequestBody List list){ +// log.info("上传数据dto123:{}",list); +//// List list = dto.getList(); +// int add = 0; +// for (ExternalDto.RtcfInfoDto rtcfInfoDto : list) { +// checkoutData(rtcfInfoDto.getUUID()); +// add += externalService.add(rtcfInfoDto); +// } +// if (add == 0) { +// return "upload fail"; +// } +// return "upload ok"; +// } + +// @Anonymous +// @ApiOperation("上传数据") +// @PostMapping("/http/uploadMemberInfo") +// public Object add(@RequestBody String str){ +// JsonArray jsonValues = new JsonArray(); // +// log.info("上传数据dto123:{}",list); +//// List list = dto.getList(); +// int add = 0; +// for (ExternalDto.RtcfInfoDto rtcfInfoDto : list) { +// checkoutData(rtcfInfoDto.getUUID()); +// add += externalService.add(rtcfInfoDto); +// } +// if (add == 0) { +// return "upload fail"; +// } +// return "upload ok"; // } + + @Anonymous + @ApiOperation("上传数据") + @PostMapping("/http/addReportImage") + public Object addReportImage(MultipartFile image){ + try { + //切换数据源 + String str = removeExtension(image.getOriginalFilename()); + Object o = redisCache.get("rtcfInfo:" + str); + if (ObjectUtil.isEmpty(o)) { + throw new BaseException("未查询到数据源"); + } + checkoutData(o.toString()); + + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, image); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", image.getOriginalFilename()); + ExternalDto.ReportImageDto reportImageDto = new ExternalDto.ReportImageDto(); + reportImageDto.setFileName(fileName); + reportImageDto.setFilePath(url); + reportImageDto.setMemberId(str); + externalService.addReportImage(reportImageDto); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + + private static String removeExtension(String fileName) { + if (StrUtil.isEmpty(fileName)) { + return ""; + } + int lastDotIndex = fileName.lastIndexOf('.'); + return (lastDotIndex > 0) ? fileName.substring(0, lastDotIndex) : fileName; + } + + @ApiOperation("上传数据查询") + @PostMapping("/http/list") + public List list(){ + return externalService.list(); + } + + @ApiOperation("根据住院号/门诊号查询人体成分信息") + @PostMapping("/http/selectByMemberId") + public JsonResponse selectByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto){ + return JsonResponse.ok(externalService.selectByMemberId(dto.getMemberId())); + } + + @ApiOperation("根据住院号/门诊号查询人体成分报告") + @PostMapping("/http/selectReportByMemberId") + public JsonResponse selectReportByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto){ + return JsonResponse.ok(externalService.selectReportByMemberId(dto.getMemberId())); + } } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/PmsTreatmentController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/PmsTreatmentController.java index 2f0768b1..2812aa6f 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/PmsTreatmentController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/PmsTreatmentController.java @@ -93,4 +93,10 @@ public class PmsTreatmentController { treatmentService.importTreatment(file); return JsonResponse.ok(); } + + @ApiOperation("导出诊疗档案评估报告") + @PostMapping("/exportTreatmentPg") + public JsonResponse exportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){ + return JsonResponse.ok(treatmentService.exportTreatmentPg(response, dto)); + } } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java index be9f4df2..a8afca11 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java @@ -47,6 +47,16 @@ public class ScreeningController { return JsonResponse.ok(screeningService.queryDetailByPage(param.getParam(), param.getPageNum(), param.getPageSize())); } + @ApiOperation(value = "后台查询筛查列表", notes = "原:查询医院是否填写了调查筛查") + @RequestMapping(value = "/admin/queryDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse> adminQueryDetail(@ApiParam @Validated @RequestBody BaseDto param){ + log.info("查询筛查列表"); + if (param.getPageNum() > 0) { + PageHelper.startPage(param.getPageNum(), param.getPageSize()); + } + return JsonResponse.ok(screeningService.adminQueryDetailByPage(param.getParam(), param.getPageNum(), param.getPageSize())); + } + @ApiOperation(value = "创建筛查详情", notes = "") @RequestMapping(value = "/create", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @@ -117,12 +127,19 @@ public class ScreeningController { screeningService.export(response, param.getParam()); } + @ApiOperation(value = "导出筛查列表", notes = "") + @RequestMapping(value = "/admin/exportScreen", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public void adminExport(HttpServletResponse response, @RequestBody @Validated BaseDto param) { + screeningService.adminExport(response, param.getParam()); + } + @ApiOperation(value = "导出认知筛查列表", notes = "") @RequestMapping(value = "/exportRzScreen", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public void exportRzScreen(HttpServletResponse response, @RequestBody @Validated BaseDto param) { screeningService.exportRzScreen(response, param.getParam()); } + // @Anonymous // @ApiOperation(value = "导出筛查记录", notes = "") // @RequestMapping(value = "/export", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java index 5738bea4..76450cb7 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java @@ -66,6 +66,15 @@ public class WxQrCodeController { return JsonResponse.ok(new PageInfo<>(wxQrCodeService.queryList(dto.getParam().getTenantId()))); } + @ApiOperation(value = "查询筛查二维码") + @PostMapping("/admin/queryScreenList") + public JsonResponse> adminQueryScreenList(@Validated @RequestBody BaseDto dto){ + if (dto.getPageNum() > 0) { + PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); + } + return JsonResponse.ok(new PageInfo<>(wxQrCodeService.queryList(dto.getParam().getTenantId()))); + } + @ApiOperation(value = "查询客户端筛查二维码") @PostMapping("/queryClientScreenList") public JsonResponse> queryClientScreenList(){ @@ -91,6 +100,11 @@ public class WxQrCodeController { public JsonResponse exportScreen(@Validated @RequestBody AmsWxQrCodeDto.Query query) throws Exception{ return JsonResponse.ok(wxQrCodeService.exportScreen(query.getUrl(), query.getTenantId())); } + @ApiOperation(value = "导出筛查") + @PostMapping("/admin/exportScreen") + public JsonResponse adminExportScreen(@Validated @RequestBody AmsWxQrCodeDto.Query query) throws Exception{ + return JsonResponse.ok(wxQrCodeService.adminExportScreen(query.getUrl(), query.getTenantId())); + } @ApiOperation(value = "导出海报筛查") @PostMapping("/exportHbScreen") diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java index de837a3d..58fdcd19 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java @@ -72,7 +72,7 @@ public class TaskController { // UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result(); // result1.setDataSourceKey("MASTER"); // changeDataSource(result1); - List query = umsDataSourceDao.query(); + List query = umsDataSourceDao.query(null); if (CollectionUtil.isEmpty(query)) { return; } diff --git a/acupuncture-admin/src/main/resources/application-stage.yml b/acupuncture-admin/src/main/resources/application-stage.yml index 3e216ada..bd811e86 100644 --- a/acupuncture-admin/src/main/resources/application-stage.yml +++ b/acupuncture-admin/src/main/resources/application-stage.yml @@ -66,4 +66,5 @@ file: screenQrCodeTemplate: /home/acupuncture/server/profile/screenQrCodeTemplate.docx hbTemplate: /home/acupuncture/server/profile/screenHbQrCodeTemplate.docx screenPath: http://test.tall.wiki/acupuncture/web-admin/screening/H5?hospitalId=hosId&hospitalName=hosName¢erId=cId + pgTemplate: /home/acupuncture/server/profile/TreamtmentPgTemplate.docx jmrsUrl: /home/acupuncture/server/profile/uploads/jmrsTemplate.docx diff --git a/acupuncture-common/src/main/java/com/acupuncture/common/utils/SecurityUtils.java b/acupuncture-common/src/main/java/com/acupuncture/common/utils/SecurityUtils.java index b99a7454..afec49d1 100644 --- a/acupuncture-common/src/main/java/com/acupuncture/common/utils/SecurityUtils.java +++ b/acupuncture-common/src/main/java/com/acupuncture/common/utils/SecurityUtils.java @@ -186,7 +186,8 @@ public class SecurityUtils } catch (Exception e) { - throw new ServiceException("获取租户ID异常", HttpStatus.UNAUTHORIZED); + return 1901557972215377920L; +// throw new ServiceException("获取租户ID异常", HttpStatus.UNAUTHORIZED); } } } diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java index 03175fa3..1ab1b6ce 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/config/SecurityConfig.java @@ -114,7 +114,7 @@ public class SecurityConfig .authorizeHttpRequests((requests) -> { permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - requests.antMatchers("/login", "/register", "/captchaImage", "/web/login", "/web/queryTenantById").permitAll() + requests.antMatchers("/login", "/register", "/captchaImage", "/web/login", "/web/queryTenantById", "/api/http/getUserInfo", "/api/http/addReportImage", "/api/http/uploadMemberInfo").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**", "/static/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java index 029e4d79..ca5ed4bb 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java @@ -5,6 +5,7 @@ import com.acupuncture.system.domain.po.UplRtcfInfo; import io.swagger.annotations.ApiModel; import lombok.Data; +import javax.validation.constraints.NotNull; import java.util.List; /** @@ -16,9 +17,16 @@ import java.util.List; public class ExternalDto { @Data public static class Insert{ + @NotNull(message = "信息不能为空") private List list; } + @Data + public static class MemberDto{ + @NotNull + private String memberId; + } + @Data @ApiModel("人体成分数据上传") public static class RtcfInfoDto{ @@ -26,15 +34,15 @@ public class ExternalDto { private String message; - private String uuid; + private String UUID; - private String deviceId; + private String deviceID; private String deviceType; private String memberid; - private String testId; + private String testID; private String testDate; @@ -46,146 +54,145 @@ public class ExternalDto { private String birthYear; - private String weight; - - private String fat; + private String Weight; - private String bone; + private String Fat; - private String protein; + private String Bone; - private String water; + private String Protein; - private String muscle; + private String Water; - private String smm; + private String Muscle; - private String pbf; + private String SMM; - private String bmi; + private String PBF; - private String bmr; + private String BMI; - private String whr; + private String BMR; - private String edema; + private String WHR; - private String vfi; + private String Edema; - private String bodyAge; + private String VFI; - private String score; + private String BodyAge; - private String bodyType; + private String Score; - private String lbm; + private String BodyType; - private String icw; + private String LBM; - private String ecw; + private String ICW; - private String standardWeight; + private String ECW; - private String weightControl; + private String Standard_weight; - private String fatControl; + private String Weight_control; - private String muscleControl; + private String Fat_control; - private String liverRisk; + private String Muscle_control; - private String asmi; + private String LiverRisk; - private String trFat; + private String ASMI; - private String laFat; + private String TR_fat; - private String raFat; + private String LA_fat; - private String llFat; + private String RA_fat; - private String rlFat; + private String LL_fat; - private String trWater; + private String RL_fat; - private String laWater; + private String TR_water; - private String raWater; + private String LA_water; - private String llWater; + private String RA_water; - private String rlWater; + private String LL_water; - private String trMuscle; + private String RL_water; - private String laMuscle; + private String TR_muscle; - private String raMuscle; + private String LA_muscle; - private String llMuscle; + private String RA_muscle; - private String rlMuscle; + private String LL_muscle; - private String trBone; + private String RL_muscle; - private String laBone; + private String TR_bone; - private String raBone; + private String LA_bone; - private String llBone; + private String RA_bone; - private String rlBone; + private String LL_bone; - private String weightMax; + private String RL_bone; - private String weightMin; + private String WeightMax; - private String fatMax; + private String WeightMin; - private String fatMin; + private String FatMax; - private String boneMax; + private String FatMin; - private String boneMin; + private String BoneMax; - private String proteinMax; + private String BoneMin; - private String proteinMin; + private String ProteinMax; - private String waterMax; + private String ProteinMin; - private String waterMin; + private String WaterMax; - private String muscleMax; + private String WaterMin; - private String muscleMin; + private String MuscleMax; - private String smmMax; + private String MuscleMin; - private String smmMin; + private String SMMMax; - private String pbfMax; + private String SMMMin; - private String pbfMin; + private String PBFMax; - private String bmiMax; + private String PBFMin; - private String bmiMin; + private String BMIMax; - private String whrMax; + private String BMIMin; - private String whrMin; + private String WHRMax; - private String edemaMax; + private String WHRMin; - private String edemaMin; + private String EdemaMax; - private String vfiMax; + private String EdemaMin; - private String vfiMin; + private String VFIMax; - private String diagnosis; + private String VFIMin; + private String Diagnosis; } @Data @@ -193,7 +200,7 @@ public class ExternalDto { public static class ReportImageDto{ private Long id; - private String patientId; + private String memberId; private String fileName; diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java index 69ad1987..2c6fac15 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java @@ -51,6 +51,7 @@ public class PmsTreatmentDto { private Long organizationId; private String createBy; private String remark; + private Byte source = 1; @ApiModelProperty("随访队列ID集合") private List queueIdList; @@ -213,4 +214,11 @@ public class PmsTreatmentDto { @ApiModelProperty("code集合") private List codeList; } + + @Data + public static class ExportVO { + @NotNull + private Long treatmentId; + + } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ScreeningDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ScreeningDto.java index d2d469b6..de67d923 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ScreeningDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ScreeningDto.java @@ -40,6 +40,8 @@ public class ScreeningDto { private Integer endAge; private Long hospitalId; + private Long tenantId; + private String province; private String city; private String county; diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/UplReportImage.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/UplReportImage.java index dcbfd5d4..dbcb8e5f 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/UplReportImage.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/UplReportImage.java @@ -6,7 +6,7 @@ import java.util.Date; public class UplReportImage implements Serializable { private Long id; - private String patientId; + private String memberId; private String fileName; @@ -36,12 +36,12 @@ public class UplReportImage implements Serializable { this.id = id; } - public String getPatientId() { - return patientId; + public String getMemberId() { + return memberId; } - public void setPatientId(String patientId) { - this.patientId = patientId == null ? null : patientId.trim(); + public void setMemberId(String memberId) { + this.memberId = memberId == null ? null : memberId.trim(); } public String getFileName() { @@ -123,7 +123,7 @@ public class UplReportImage implements Serializable { sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); - sb.append(", patientId=").append(patientId); + sb.append(", memberId=").append(memberId); sb.append(", fileName=").append(fileName); sb.append(", filePath=").append(filePath); sb.append(", delFlag=").append(delFlag); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/UplReportImageExample.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/UplReportImageExample.java index 4fa8ab2e..53d03419 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/UplReportImageExample.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/UplReportImageExample.java @@ -165,73 +165,73 @@ public class UplReportImageExample { return (Criteria) this; } - public Criteria andPatientIdIsNull() { - addCriterion("patient_id is null"); + public Criteria andMemberIdIsNull() { + addCriterion("member_id is null"); return (Criteria) this; } - public Criteria andPatientIdIsNotNull() { - addCriterion("patient_id is not null"); + public Criteria andMemberIdIsNotNull() { + addCriterion("member_id is not null"); return (Criteria) this; } - public Criteria andPatientIdEqualTo(String value) { - addCriterion("patient_id =", value, "patientId"); + public Criteria andMemberIdEqualTo(String value) { + addCriterion("member_id =", value, "memberId"); return (Criteria) this; } - public Criteria andPatientIdNotEqualTo(String value) { - addCriterion("patient_id <>", value, "patientId"); + public Criteria andMemberIdNotEqualTo(String value) { + addCriterion("member_id <>", value, "memberId"); return (Criteria) this; } - public Criteria andPatientIdGreaterThan(String value) { - addCriterion("patient_id >", value, "patientId"); + public Criteria andMemberIdGreaterThan(String value) { + addCriterion("member_id >", value, "memberId"); return (Criteria) this; } - public Criteria andPatientIdGreaterThanOrEqualTo(String value) { - addCriterion("patient_id >=", value, "patientId"); + public Criteria andMemberIdGreaterThanOrEqualTo(String value) { + addCriterion("member_id >=", value, "memberId"); return (Criteria) this; } - public Criteria andPatientIdLessThan(String value) { - addCriterion("patient_id <", value, "patientId"); + public Criteria andMemberIdLessThan(String value) { + addCriterion("member_id <", value, "memberId"); return (Criteria) this; } - public Criteria andPatientIdLessThanOrEqualTo(String value) { - addCriterion("patient_id <=", value, "patientId"); + public Criteria andMemberIdLessThanOrEqualTo(String value) { + addCriterion("member_id <=", value, "memberId"); return (Criteria) this; } - public Criteria andPatientIdLike(String value) { - addCriterion("patient_id like", value, "patientId"); + public Criteria andMemberIdLike(String value) { + addCriterion("member_id like", value, "memberId"); return (Criteria) this; } - public Criteria andPatientIdNotLike(String value) { - addCriterion("patient_id not like", value, "patientId"); + public Criteria andMemberIdNotLike(String value) { + addCriterion("member_id not like", value, "memberId"); return (Criteria) this; } - public Criteria andPatientIdIn(List values) { - addCriterion("patient_id in", values, "patientId"); + public Criteria andMemberIdIn(List values) { + addCriterion("member_id in", values, "memberId"); return (Criteria) this; } - public Criteria andPatientIdNotIn(List values) { - addCriterion("patient_id not in", values, "patientId"); + public Criteria andMemberIdNotIn(List values) { + addCriterion("member_id not in", values, "memberId"); return (Criteria) this; } - public Criteria andPatientIdBetween(String value1, String value2) { - addCriterion("patient_id between", value1, value2, "patientId"); + public Criteria andMemberIdBetween(String value1, String value2) { + addCriterion("member_id between", value1, value2, "memberId"); return (Criteria) this; } - public Criteria andPatientIdNotBetween(String value1, String value2) { - addCriterion("patient_id not between", value1, value2, "patientId"); + public Criteria andMemberIdNotBetween(String value1, String value2) { + addCriterion("member_id not between", value1, value2, "memberId"); return (Criteria) this; } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java index 22aaabe7..80ab8576 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java @@ -90,6 +90,10 @@ public class PmsTreatmentVo { @ApiModelProperty("code和答案列表") private Map> recordValDict; + private String createBy; + + private Date createTime; + public TreatmentRecordVO() { } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/UplRtcfInfoVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/UplRtcfInfoVo.java new file mode 100644 index 00000000..7f88aed3 --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/UplRtcfInfoVo.java @@ -0,0 +1,224 @@ +package com.acupuncture.system.domain.vo; + +import cn.hutool.core.util.StrUtil; +import lombok.Data; + +import java.util.Date; + +/** + * @Author zzc + * @Package com.acupuncture.system.domain.vo + * @Date 2025/3/17 15:47 + * @description: + */ +public class UplRtcfInfoVo { + + @Data + public static class Result{ + private Long id; + + private String message; + + private String uuid; + + private String deviceId; + + private String deviceType; + + private String memberid; + + private String testId; + + private String testDate; + + private String name; + + private String sex; + + private String height; + + private String birthYear; + + private String weight; + + private String fat; + + private String bone; + + private String protein; + + private String water; + + private String muscle; + + private String smm; + + private String pbf; + + private String bmi; + + private String bmr; + + private String whr; + + private String edema; + + private String vfi; + + private String bodyAge; + + private String score; + + private String bodyType; + + private String lbm; + + private String icw; + + private String ecw; + + private String standardWeight; + + private String weightControl; + + private String fatControl; + + private String muscleControl; + + private String liverRisk; + + private String asmi; + + private String trFat; + + private String laFat; + + private String raFat; + + private String llFat; + + private String rlFat; + + private String trWater; + + private String laWater; + + private String raWater; + + private String llWater; + + private String rlWater; + + private String trMuscle; + + private String laMuscle; + + private String raMuscle; + + private String llMuscle; + + private String rlMuscle; + + private String trBone; + + private String laBone; + + private String raBone; + + private String llBone; + + private String rlBone; + + private String weightMax; + + private String weightMin; + + private String fatMax; + + private String fatMin; + + private String boneMax; + + private String boneMin; + + private String proteinMax; + + private String proteinMin; + + private String waterMax; + + private String waterMin; + + private String muscleMax; + + private String muscleMin; + + private String smmMax; + + private String smmMin; + + private String pbfMax; + + private String pbfMin; + + private String bmiMax; + + private String bmiMin; + + private String whrMax; + + private String whrMin; + + private String edemaMax; + + private String edemaMin; + + private String vfiMax; + + private String vfiMin; + + private String diagnosis; + + private Byte status; + + private Byte delFlag; + + private Long tenantId; + + private String createBy; + + private Date createTime; + + private String updateBy; + + private Date updateTime; + + private String remark; + + public String getBodyType() { + if (StrUtil.isNotBlank(bodyType)) { + switch (bodyType) { + case "1": + return "隐形肥胖型"; + case "2": + return "肌肉不足型"; + case "3": + return "消瘦型"; + case "4": + return "脂肪过多型"; + case "5": + return "健康匀称型"; + case "6": + return "低脂肪型"; + case "7": + return "肥胖型"; + case "8": + return "超重肌肉型"; + case "9": + return "运动员型"; + } + } + return bodyType; + } + } +} diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java b/acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java index d169baa0..688d3324 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/mapper/SysRoleMapper.java @@ -1,7 +1,10 @@ package com.acupuncture.system.mapper; import java.util.List; + +import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.core.domain.entity.SysRole; +import com.acupuncture.common.enums.DataSourceType; /** * 角色表 数据层 @@ -24,6 +27,7 @@ public interface SysRoleMapper * @param userId 用户ID * @return 角色列表 */ + @DataSource(DataSourceType.MASTER) public List selectRolePermissionByUserId(Long userId); /** diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java index 1fbca7c6..a7764f18 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/DmsUserDao.java @@ -3,6 +3,7 @@ package com.acupuncture.system.persist.dao; import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.core.domain.entity.SysUser; import com.acupuncture.common.enums.DataSourceType; +import com.acupuncture.system.domain.po.DmsTenant; import com.acupuncture.system.domain.po.DmsUser; import com.acupuncture.system.domain.vo.DmsLoginUserVo; import org.apache.ibatis.annotations.Param; @@ -15,6 +16,9 @@ import org.apache.ibatis.annotations.Param; */ public interface DmsUserDao { + @DataSource(DataSourceType.MASTER) + DmsTenant queryById(@Param("id") Long id); + /** * 通过用户名查询用户 * diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java index dd503144..7a3ad41a 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ScreeningDetailDao.java @@ -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.ScreeningDto; import com.acupuncture.system.domain.vo.QuestionnaireVo; import com.acupuncture.system.domain.vo.ScrScreenVo; @@ -40,5 +42,12 @@ public interface ScreeningDetailDao extends ScrScreeningDetailMapper { @Param("type") Byte type, @Param("param") ScreeningDto.Query param); + @DataSource(DataSourceType.MASTER) + List adminQueryResult(@Param("detailId") Long detailId, + @Param("type") Byte type, + @Param("param") ScreeningDto.Query param); + List queryDetailList(@Param("detailIdList") List detailIdList); + + List adminQueryDetailList(@Param("detailIdList") List detailIdList); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java index a755779e..cc576581 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/UmsDataSourceDao.java @@ -3,6 +3,7 @@ package com.acupuncture.system.persist.dao; import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.system.domain.vo.UmsDataSourceVo; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -15,6 +16,6 @@ import java.util.List; public interface UmsDataSourceDao { @DataSource(DataSourceType.MASTER) - List query(); + List query(@Param("tenantId") Long tenantId); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java index 272d97ab..b60cfc7b 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/WxQrCodeDao.java @@ -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.vo.AmsWxQrCodeVo; import org.apache.ibatis.annotations.Param; @@ -7,6 +9,9 @@ import java.util.List; public interface WxQrCodeDao { + @DataSource(DataSourceType.MASTER) + AmsWxQrCodeVo.Result queryById(@Param("id")Long id); + /** * 查询 * @return @@ -20,4 +25,10 @@ public interface WxQrCodeDao { List selectScreen(@Param("hospitalId") Long hospitalId); List selectScreenList(@Param("hospitalIdList") List hospitalIdList); + + @DataSource(DataSourceType.MASTER) + List adminSelectScreenList(@Param("hospitalIdList") List hospitalIdList); + + + } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java index a0688d9e..130f5f54 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java @@ -1,7 +1,10 @@ package com.acupuncture.system.service; import com.acupuncture.system.domain.dto.ExternalDto; +import com.acupuncture.system.domain.po.UplReportImage; +import com.acupuncture.system.domain.po.UplRtcfInfo; import com.acupuncture.system.domain.vo.ExternalVo; +import com.acupuncture.system.domain.vo.UplRtcfInfoVo; import java.util.List; @@ -26,7 +29,7 @@ public interface ExternalService { * @param rtcfInfoDtoList * @return */ - int add(List rtcfInfoDtoList); + int add(ExternalDto.RtcfInfoDto rtcfInfoDto); /** * 上传测试报告 @@ -35,4 +38,20 @@ public interface ExternalService { */ int addReportImage(ExternalDto.ReportImageDto reportImageVo); + List list(); + + /** + * 根据住院号/门诊号查询人体成分信息 + * @param membreId + * @return + */ + UplRtcfInfoVo.Result selectByMemberId(String membreId); + + /** + * 根据住院号/门诊号查询人体成分信息 + * @param membreId + * @return + */ + UplReportImage selectReportByMemberId(String membreId); + } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java index 5cdfd3e2..d7d60e7d 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/IScreeningService.java @@ -20,10 +20,14 @@ public interface IScreeningService { void export(HttpServletResponse response, ScreeningDto.Query param); + void adminExport(HttpServletResponse response, ScreeningDto.Query param); + void exportRzScreen(HttpServletResponse response, ScreeningDto.Query param); PageInfo queryDetailByPage(ScreeningDto.Query param, Integer pageNum, Integer pageSize); + PageInfo adminQueryDetailByPage(ScreeningDto.Query param, Integer pageNum, Integer pageSize); + /** * * 保存问卷调查信息 diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java index a8f85ed5..f3c0c33c 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java @@ -50,6 +50,15 @@ public interface PmsTreatmentService { void exportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto); + /** + * 当初诊疗档案评估报告 + * @param response + * @param dto + */ + String exportTreatmentPg(HttpServletResponse response, PmsTreatmentDto.ExportVO dto); + + String adminExportTreatmentPg(HttpServletResponse response, PmsTreatmentDto.ExportVO dto); + void importTreatment(MultipartFile file) throws IOException; /** * 查询诊疗档案 diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/WxQrCodeService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/WxQrCodeService.java index cca6f9b1..9cc24158 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/WxQrCodeService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/WxQrCodeService.java @@ -20,6 +20,8 @@ public interface WxQrCodeService { List queryList(Long hospitalId); + List adminQueryList(Long hospitalId); + List queryScreenList(); AmsScreenWxQrCode add(AmsWxQrCodeDto.ScreenInsert amsScreenWxQrCode) throws Exception; @@ -28,5 +30,7 @@ public interface WxQrCodeService { String exportScreen(String url, Long hostpitalId) throws Exception; + String adminExportScreen(String url, Long hostpitalId) throws Exception; + String exportHbScreen(String url, Long hostpitalId) throws Exception; } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java index 9407d10e..5062df71 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java @@ -1,11 +1,16 @@ 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.core.redis.RedisCache; import com.acupuncture.system.domain.dto.ExternalDto; import com.acupuncture.system.domain.po.UplReportImage; +import com.acupuncture.system.domain.po.UplReportImageExample; import com.acupuncture.system.domain.po.UplRtcfInfo; +import com.acupuncture.system.domain.po.UplRtcfInfoExample; import com.acupuncture.system.domain.vo.ExternalVo; +import com.acupuncture.system.domain.vo.UplRtcfInfoVo; import com.acupuncture.system.persist.dao.ExternalDao; import com.acupuncture.system.persist.mapper.UplReportImageMapper; import com.acupuncture.system.persist.mapper.UplRtcfInfoMapper; @@ -31,6 +36,8 @@ public class ExternalServiceImpl implements ExternalService { private UplRtcfInfoMapper uplRtcfInfoMapper; @Resource private ExternalDao externalDao; + @Resource + private RedisCache redisCache; @Override public ExternalVo.Result query(String from, String memberid) { @@ -41,15 +48,64 @@ public class ExternalServiceImpl implements ExternalService { } @Override - public int add(List rtcfInfoDtoList) { - List uplRtcfInfos = BeanUtil.copyToList(rtcfInfoDtoList, UplRtcfInfo.class); - int i = 0; - for (UplRtcfInfo uplRtcfInfo : uplRtcfInfos) { - uplRtcfInfo.setId(IdUtil.getSnowflakeNextId()); - uplRtcfInfo.setCreateTime(new Date()); - i += uplRtcfInfoMapper.insert(uplRtcfInfo); + public int add(ExternalDto.RtcfInfoDto rtcfInfoDto) { + UplRtcfInfo uplRtcfInfos = BeanUtil.copyProperties(rtcfInfoDto, UplRtcfInfo.class); + uplRtcfInfos.setId(IdUtil.getSnowflakeNextId()); + uplRtcfInfos.setCreateTime(new Date()); + uplRtcfInfos.setDelFlag((byte) 0); + + uplRtcfInfos.setAsmi(rtcfInfoDto.getASMI()); + uplRtcfInfos.setBmi(rtcfInfoDto.getBMI()); + uplRtcfInfos.setDeviceId(rtcfInfoDto.getDeviceID()); + uplRtcfInfos.setDeviceType(rtcfInfoDto.getDeviceType()); + uplRtcfInfos.setDiagnosis(rtcfInfoDto.getDiagnosis()); + uplRtcfInfos.setEdema(rtcfInfoDto.getEdema()); + uplRtcfInfos.setFat(rtcfInfoDto.getFat()); + uplRtcfInfos.setFatControl(rtcfInfoDto.getFat_control()); + uplRtcfInfos.setFatMax(rtcfInfoDto.getFatMax()); + uplRtcfInfos.setFatMin(rtcfInfoDto.getFatMin()); + uplRtcfInfos.setHeight(rtcfInfoDto.getHeight()); + uplRtcfInfos.setLbm(rtcfInfoDto.getLBM()); + uplRtcfInfos.setLlBone(rtcfInfoDto.getLL_bone()); + uplRtcfInfos.setLlFat(rtcfInfoDto.getLL_fat()); + uplRtcfInfos.setLlMuscle(rtcfInfoDto.getLL_muscle()); + uplRtcfInfos.setLlWater(rtcfInfoDto.getLL_water()); + uplRtcfInfos.setLlWater(rtcfInfoDto.getLL_water()); + uplRtcfInfos.setLlWater(rtcfInfoDto.getLL_water()); + uplRtcfInfos.setMemberid(rtcfInfoDto.getMemberid()); + uplRtcfInfos.setMuscle(rtcfInfoDto.getMuscle()); + uplRtcfInfos.setSmm(rtcfInfoDto.getSMM()); + uplRtcfInfos.setPbf(rtcfInfoDto.getPBF()); + uplRtcfInfos.setPbfMax(rtcfInfoDto.getPBFMax()); + uplRtcfInfos.setPbfMin(rtcfInfoDto.getPBFMin()); + uplRtcfInfos.setBodyAge(rtcfInfoDto.getBodyAge()); + uplRtcfInfos.setBodyType(rtcfInfoDto.getBodyType()); + uplRtcfInfos.setScore(rtcfInfoDto.getScore()); + uplRtcfInfos.setStandardWeight(rtcfInfoDto.getStandard_weight()); + uplRtcfInfos.setWeight(rtcfInfoDto.getWeight()); + uplRtcfInfos.setWeightControl(rtcfInfoDto.getWeight_control()); + uplRtcfInfos.setWeightMax(rtcfInfoDto.getWeightMax()); + uplRtcfInfos.setWeightMin(rtcfInfoDto.getWeightMin()); + uplRtcfInfos.setBmi(rtcfInfoDto.getBMI()); + uplRtcfInfos.setBmr(rtcfInfoDto.getBMR()); + uplRtcfInfos.setWhr(rtcfInfoDto.getWHR()); + uplRtcfInfos.setEdema(rtcfInfoDto.getEdema()); + uplRtcfInfos.setVfi(rtcfInfoDto.getVFI()); + uplRtcfInfos.setLiverRisk(rtcfInfoDto.getLiverRisk()); + uplRtcfInfos.setAsmi(rtcfInfoDto.getASMI()); + uplRtcfInfos.setTrFat(rtcfInfoDto.getTR_fat()); + uplRtcfInfos.setLaFat(rtcfInfoDto.getLA_fat()); + uplRtcfInfos.setRaFat(rtcfInfoDto.getRA_fat()); + uplRtcfInfos.setLlFat(rtcfInfoDto.getLL_fat()); + uplRtcfInfos.setRlFat(rtcfInfoDto.getRL_fat()); + uplRtcfInfos.setTrWater(rtcfInfoDto.getTR_water()); + uplRtcfInfos.setLaWater(rtcfInfoDto.getLA_water()); + + int insert = uplRtcfInfoMapper.insert(uplRtcfInfos); + if (insert > 0) { + redisCache.set("rtcfInfo:" + uplRtcfInfos.getMemberid(), uplRtcfInfos.getUuid()); } - return i; + return insert; } @Override @@ -57,6 +113,36 @@ public class ExternalServiceImpl implements ExternalService { UplReportImage uplReportImage = BeanUtil.copyProperties(reportImageVo, UplReportImage.class); uplReportImage.setId(IdUtil.getSnowflakeNextId()); uplReportImage.setCreateTime(new Date()); + uplReportImage.setDelFlag((byte) 0); return uplReportImageMapper.insertSelective(uplReportImage); } + + + + @Override + public List list() { + return uplRtcfInfoMapper.selectByExample(new UplRtcfInfoExample()); + } + + @Override + public UplRtcfInfoVo.Result selectByMemberId(String membreId) { + UplRtcfInfoExample uplRtcfInfoExample = new UplRtcfInfoExample(); + uplRtcfInfoExample.createCriteria().andMemberidEqualTo(membreId).andDelFlagEqualTo((byte) 0); + List uplRtcfInfos = uplRtcfInfoMapper.selectByExample(uplRtcfInfoExample); + if (CollectionUtil.isNotEmpty(uplRtcfInfos)) { + return BeanUtil.copyProperties(uplRtcfInfos.get(0), UplRtcfInfoVo.Result.class); + } + return new UplRtcfInfoVo.Result(); + } + + @Override + public UplReportImage selectReportByMemberId(String membreId) { + UplReportImageExample uplReportImageExample = new UplReportImageExample(); + uplReportImageExample.createCriteria().andMemberIdEqualTo(membreId).andDelFlagEqualTo((byte) 0); + List uplReportImages = uplReportImageMapper.selectByExample(uplReportImageExample); + if (CollectionUtil.isNotEmpty(uplReportImages)) { + return uplReportImages.get(0); + } + return new UplReportImage(); + } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java index 879795cd..ed996850 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java @@ -74,6 +74,9 @@ public class PmsPatientServiceImpl implements PmsPatientService { pmsPatient.setDelFlag((byte) 0); pmsPatient.setCreateTime(new Date()); pmsPatient.setTenantId(SecurityUtils.getTenantId()); + if (pmsPatient.getSource() == null) { + pmsPatient.setSource((byte) 1); + } pmsPatientMapper.insertSelective(pmsPatient); return pmsPatient.getId(); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java index db0dca19..d22b9bd4 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java @@ -3,6 +3,7 @@ package com.acupuncture.system.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.IdUtil; @@ -13,6 +14,7 @@ import cn.hutool.poi.excel.BigExcelWriter; import cn.hutool.poi.excel.ExcelUtil; import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.common.exception.base.BaseException; +import com.acupuncture.common.utils.AsposeUtils; import com.acupuncture.common.utils.ExceptionUtil; import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.system.domain.dto.PmsPatientDto; @@ -29,6 +31,7 @@ import com.acupuncture.system.persist.mapper.PmsTreatmentMapper; import com.acupuncture.system.persist.mapper.PmsTreatmentRecordMapper; import com.acupuncture.system.service.PmsPatientService; import com.acupuncture.system.service.PmsTreatmentService; +import com.deepoove.poi.XWPFTemplate; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -36,7 +39,10 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -68,6 +74,13 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { private RedisCache redisCache; @Value("${file.TreamentTemplate}") private String treamentTemplate; + @Value("${file.pgTemplate}") + private String pgTemplate; + @Value("${acupuncture.profile}") + private String profilePath; + @Value("${acupuncture.profileUrl}") + private String profileUrl; + @Override public void addTreatment(PmsTreatmentDto.TreatmentAdd dto) { @@ -112,7 +125,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { patientQueueRelation.setCreateTime(new Date()); fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation); } - }else { + } else { FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class); patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); patientQueueRelation.setDelFlag((byte) 0); @@ -134,36 +147,36 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { pmsTreatment.setUpdateTime(new Date()); treatmentMapper.updateByPrimaryKeySelective(pmsTreatment); - //删除队列 - //如有患者档案信息,则需要判断患者是否有随访队列,如果有,则需要删除(先删除后新增) - FmsPatientQueueRelationExample fmsPatientQueueRelationExample = new FmsPatientQueueRelationExample(); - fmsPatientQueueRelationExample.createCriteria().andPatientIdEqualTo(pmsTreatment.getPatientId()).andDelFlagEqualTo((byte) 0); - FmsPatientQueueRelation fmsPatientQueueRelation = new FmsPatientQueueRelation(); - fmsPatientQueueRelation.setDelFlag((byte) 1); - fmsPatientQueueRelationMapper.updateByExampleSelective(fmsPatientQueueRelation, fmsPatientQueueRelationExample); +// //删除队列 +// //如有患者档案信息,则需要判断患者是否有随访队列,如果有,则需要删除(先删除后新增) +// FmsPatientQueueRelationExample fmsPatientQueueRelationExample = new FmsPatientQueueRelationExample(); +// fmsPatientQueueRelationExample.createCriteria().andPatientIdEqualTo(pmsTreatment.getPatientId()).andDelFlagEqualTo((byte) 0); +// FmsPatientQueueRelation fmsPatientQueueRelation = new FmsPatientQueueRelation(); +// fmsPatientQueueRelation.setDelFlag((byte) 1); +// fmsPatientQueueRelationMapper.updateByExampleSelective(fmsPatientQueueRelation, fmsPatientQueueRelationExample); //新增随访队列 - if (CollectionUtil.isNotEmpty(dto.getQueueIdList())) { - for (Long queueId : dto.getQueueIdList()) { - FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class); - patientQueueRelation.setDelFlag((byte) 0); - patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); - patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); - patientQueueRelation.setQueueId(queueId); - patientQueueRelation.setCreateTime(new Date()); - patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); - fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation); - } - }else { - FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class); - patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); - patientQueueRelation.setDelFlag((byte) 0); - patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); - patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); - patientQueueRelation.setTenantId(pmsTreatment.getTenantId()); - patientQueueRelation.setQueueId(null); - patientQueueRelation.setCreateTime(new Date()); - fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation); - } +// if (CollectionUtil.isNotEmpty(dto.getQueueIdList())) { +// for (Long queueId : dto.getQueueIdList()) { +// FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class); +// patientQueueRelation.setDelFlag((byte) 0); +// patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); +// patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); +// patientQueueRelation.setQueueId(queueId); +// patientQueueRelation.setCreateTime(new Date()); +// patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); +// fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation); +// } +// }else { +// FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class); +// patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); +// patientQueueRelation.setDelFlag((byte) 0); +// patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); +// patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); +// patientQueueRelation.setTenantId(pmsTreatment.getTenantId()); +// patientQueueRelation.setQueueId(null); +// patientQueueRelation.setCreateTime(new Date()); +// fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation); +// } } @@ -253,6 +266,44 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { willSavedRecord.setCreateTime(now); willSavedRecord.setCreateBy(SecurityUtils.getUsername()); willSavedFirstAidRecordList.add(willSavedRecord); + + //处理随访队列 + //删除队列 + //如有患者档案信息,则需要判断患者是否有随访队列,如果有,则需要删除(先删除后新增) + FmsPatientQueueRelationExample fmsPatientQueueRelationExample = new FmsPatientQueueRelationExample(); + fmsPatientQueueRelationExample.createCriteria().andPatientIdEqualTo(pmsTreatment.getPatientId()).andDelFlagEqualTo((byte) 0); + FmsPatientQueueRelation fmsPatientQueueRelation = new FmsPatientQueueRelation(); + fmsPatientQueueRelation.setDelFlag((byte) 1); + fmsPatientQueueRelationMapper.updateByExampleSelective(fmsPatientQueueRelation, fmsPatientQueueRelationExample); + if ("SFDL".equals(codeAndAnswer.getQuestionCode())) { + //新增随访队列 + if (CollectionUtil.isNotEmpty(codeAndAnswer.getAnswer())) { + List answer = codeAndAnswer.getAnswer(); + for (String queueId : answer) { + FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(pmsTreatment, FmsPatientQueueRelation.class); + patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); + patientQueueRelation.setDelFlag((byte) 0); + patientQueueRelation.setIdCard(pmsTreatment.getIdCard()); + patientQueueRelation.setIdCardType(pmsTreatment.getIdCardType().byteValue()); + patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); + patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); + patientQueueRelation.setQueueId(Long.parseLong(queueId)); + patientQueueRelation.setCreateTime(new Date()); + fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation); + } + } else { + FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(pmsTreatment, FmsPatientQueueRelation.class); + patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); + patientQueueRelation.setDelFlag((byte) 0); + patientQueueRelation.setIdCard(pmsTreatment.getIdCard()); + patientQueueRelation.setIdCardType(pmsTreatment.getIdCardType().byteValue()); + patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); + patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); + patientQueueRelation.setQueueId(null); + patientQueueRelation.setCreateTime(new Date()); + fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation); + } + } } //批量保存 batchSave(willSavedFirstAidRecordList); @@ -387,12 +438,117 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { } } + @Override + public String exportTreatmentPg(HttpServletResponse response, PmsTreatmentDto.ExportVO dto) { + PmsTreatment pmsTreatment = treatmentMapper.selectByPrimaryKey(dto.getTreatmentId()); + if (pmsTreatment == null) { + throw new BaseException("诊疗信息不存在"); + } + PmsTreatmentRecordExample pmsTreatmentRecordExample = new PmsTreatmentRecordExample(); + pmsTreatmentRecordExample.createCriteria().andTreatmentIdEqualTo(dto.getTreatmentId()).andDelFlagEqualTo((byte) 0); + List pmsTreatmentRecords = pmsTreatmentRecordMapper.selectByExample(pmsTreatmentRecordExample); + + String pdfName = pmsTreatment.getName() + "_" + pmsTreatment.getVisitNumber(); + String wordPath = profilePath + File.separator + pdfName + ".docx"; + String pdfPath = profilePath + File.separator + pdfName + ".pdf"; + try { + XWPFTemplate template = XWPFTemplate.compile(pgTemplate); + Map map = new HashMap<>(); + map.put("name", pmsTreatment.getName()); + map.put("sex", pmsTreatment.getGender() == 0 ? "男" : "女"); + map.put("age", pmsTreatment.getAge()); + map.put("phone", pmsTreatment.getPhone()); + map.put("visitNum", pmsTreatment.getVisitNumber()); + map.put("visitTime", DateUtil.format(pmsTreatment.getVisitTime(), "yyyy-MM-dd HH:mm:ss")); + map.put("doctor", pmsTreatment.getDoctor()); + map.put("createBy", pmsTreatment.getCreateBy()); + map.put("createTime", DateUtil.format(pmsTreatment.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); + map.put("status", pmsTreatment.getStatus() == 0 ? "未完成" : "已完成"); + + if (CollectionUtil.isNotEmpty(pmsTreatmentRecords)) { + Map recordMap = pmsTreatmentRecords.stream().collect(Collectors.toMap(PmsTreatmentRecord::getQuestionCode, Function.identity())); + map.put("score1", recordMap.get("PG_TT_TAPS_DF") == null ? "" : recordMap.get("PG_TT_TAPS_DF").getAnswer()); + map.put("score2", recordMap.get("PG_TT_TRACE_DF") == null ? "" : recordMap.get("PG_TT_TRACE_DF").getAnswer()); + map.put("score3", recordMap.get("PG_TT_SRS22_DF") == null ? "" : recordMap.get("PG_TT_SRS22_DF").getAnswer()); + map.put("score4", recordMap.get("PG_SM_PHQ-9_DF") == null ? "" : recordMap.get("PG_SM_PHQ-9_DF").getAnswer()); + map.put("score5", recordMap.get("PG_SM_EPSW_DF") == null ? "" : recordMap.get("PG_SM_EPSW_DF").getAnswer()); + map.put("score6", recordMap.get("PG_SM_PSQI_DF") == null ? "" : recordMap.get("PG_SM_PSQI_DF").getAnswer()); + map.put("score7", recordMap.get("PG_JL_HAMD-24_DF") == null ? "" : recordMap.get("PG_JL_HAMD-24_DF").getAnswer()); + map.put("score8", recordMap.get("PG_JL_SAS_DF") == null ? "" : recordMap.get("PG_JL_SAS_DF").getAnswer()); + } + //渲染 + template.render(map); + //以文件形式输出 + template.writeAndClose(Files.newOutputStream(Paths.get(wordPath))); + //转换为pdf + AsposeUtils.doc2pdf(wordPath, pdfPath); + //删除word + FileUtil.del(wordPath); + } catch (Exception e) { + e.printStackTrace(); + } + return profileUrl + "/" + pdfName + ".pdf"; + } + + @Override + public String adminExportTreatmentPg(HttpServletResponse response, PmsTreatmentDto.ExportVO dto) { + PmsTreatmentVo.TreatmentRecordVO treatmentRecordVO = pmsTreatmentDao.adminQueryTreatment(dto.getTreatmentId()); + + if (treatmentRecordVO == null) { + throw new BaseException("诊疗信息不存在"); + } + PmsTreatmentRecordExample pmsTreatmentRecordExample = new PmsTreatmentRecordExample(); + pmsTreatmentRecordExample.createCriteria().andTreatmentIdEqualTo(dto.getTreatmentId()).andDelFlagEqualTo((byte) 0); + List pmsTreatmentRecords = pmsTreatmentRecordMapper.selectByExample(pmsTreatmentRecordExample); + + String pdfName = treatmentRecordVO.getName() + "_" + treatmentRecordVO.getVisitNumber(); + String wordPath = profilePath + File.separator + pdfName + ".docx"; + String pdfPath = profilePath + File.separator + pdfName + ".pdf"; + try { + XWPFTemplate template = XWPFTemplate.compile(pgTemplate); + Map map = new HashMap<>(); + map.put("name", treatmentRecordVO.getName()); + map.put("sex", treatmentRecordVO.getGender() == 0 ? "男" : "女"); + map.put("age", treatmentRecordVO.getAge()); + map.put("phone", treatmentRecordVO.getPhone()); + map.put("visitNum", treatmentRecordVO.getVisitNumber()); + map.put("visitTime", DateUtil.format(treatmentRecordVO.getVisitTime(), "yyyy-MM-dd HH:mm:ss")); + map.put("doctor", treatmentRecordVO.getDoctor()); + map.put("createBy", treatmentRecordVO.getCreateBy()); + map.put("createTime", DateUtil.format(treatmentRecordVO.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); + map.put("status", treatmentRecordVO.getStatus() == 0 ? "未完成" : "已完成"); + + if (CollectionUtil.isNotEmpty(pmsTreatmentRecords)) { + Map recordMap = pmsTreatmentRecords.stream().collect(Collectors.toMap(PmsTreatmentRecord::getQuestionCode, Function.identity())); + map.put("score1", recordMap.get("PG_TT_TAPS_DF") == null ? "" : recordMap.get("PG_TT_TAPS_DF").getAnswer()); + map.put("score2", recordMap.get("PG_TT_TRACE_DF") == null ? "" : recordMap.get("PG_TT_TRACE_DF").getAnswer()); + map.put("score3", recordMap.get("PG_TT_SRS22_DF") == null ? "" : recordMap.get("PG_TT_SRS22_DF").getAnswer()); + map.put("score4", recordMap.get("PG_SM_PHQ-9_DF") == null ? "" : recordMap.get("PG_SM_PHQ-9_DF").getAnswer()); + map.put("score5", recordMap.get("PG_SM_EPSW_DF") == null ? "" : recordMap.get("PG_SM_EPSW_DF").getAnswer()); + map.put("score6", recordMap.get("PG_SM_PSQI_DF") == null ? "" : recordMap.get("PG_SM_PSQI_DF").getAnswer()); + map.put("score7", recordMap.get("PG_JL_HAMD-24_DF") == null ? "" : recordMap.get("PG_JL_HAMD-24_DF").getAnswer()); + map.put("score8", recordMap.get("PG_JL_SAS_DF") == null ? "" : recordMap.get("PG_JL_SAS_DF").getAnswer()); + } + //渲染 + template.render(map); + //以文件形式输出 + template.writeAndClose(Files.newOutputStream(Paths.get(wordPath))); + //转换为pdf + AsposeUtils.doc2pdf(wordPath, pdfPath); + //删除word + FileUtil.del(wordPath); + } catch (Exception e) { + e.printStackTrace(); + } + return profileUrl + "/" + pdfName + ".pdf"; + } + @Override public void importTreatment(MultipartFile file) throws IOException { //读取excel List pmsPatientList = CollectionUtil.newArrayList(); ExcelUtil.readBySax(file.getInputStream(), 0, (sheetIndex, rowIndex, rowList) -> { - // 建档时间 患者姓名 性别 年龄 民族 受教育程度 手机号码 证件类型(0身份证;1护照或外国人永居证; 2港澳居民来往内地通行; 3台湾居民来往大陆通行证; 4其他;) 证件号码 门诊/住院 门诊号/住院号 门诊时间/住院时间 出院时间 责任医生 建档人 + // 建档时间 患者姓名 性别 年龄 民族 受教育程度 手机号码 证件类型(0身份证;1护照或外国人永居证; 2港澳居民来往内地通行; 3台湾居民来往大陆通行证; 4其他;) 证件号码 门诊/住院 门诊号/住院号 门诊时间/住院时间 出院时间 责任医生 建档人 try { if (rowIndex < 1) { return; diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java index 080047bd..84df4a3a 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ScreeningServiceImpl.java @@ -197,6 +197,123 @@ public class ScreeningServiceImpl implements IScreeningService { } } + + @Override + public void adminExport(HttpServletResponse response, ScreeningDto.Query param) { + ExcelWriter excelWriter = ExcelUtil.getWriter(); + List headerList = CollectionUtil.newArrayList( + "姓名", + "性别", + "年龄", + "身份证", + "出生日期", + "手机号", + "有高血压,>=140/90mmHg", + "血脂异常,或不清楚", + "有糖尿病", + "心跳不规则", + "吸烟", + "明显超重或肥胖", + "缺乏运动", + "有卒中家族史", + "有既往脑卒中病史", + "有既往短暂脑缺血病史", + "筛查结果", + "数据来源", + "科室名称"); + excelWriter.writeHeadRow(headerList); + + PageInfo page = adminQueryDetailByPage(param, -1, -1); + if (page != null) { + List detailVos = page.getList(); + if (CollectionUtil.isNotEmpty(detailVos)) { + int row = 0; + for (int i = 0; i < detailVos.size(); i++) { + List recordList = detailVos.get(i).getDetailList(); + Map map = new HashMap<>(); + if (CollectionUtil.isNotEmpty(recordList)) { + map = recordList.stream().collect(Collectors.toMap(ScrScreenVo.ScreeningDetailVo::getQuestionCode, Function.identity())); + } + //筛查信息 + ScrScreenVo.ScreeningDetailVo record = map.get("SCWJ-ILLNESS"); + //筛查结果 + ScrScreenVo.ScreeningDetailVo result = map.get("SCWJ-RESULT"); + row += 1; + excelWriter.writeCellValue(0, row, detailVos.get(i).getName() + ""); + excelWriter.writeCellValue(1, row, map.get("SCWJ-SEX") == null ? "未知" : map.get("SCWJ-SEX").getAnswer()); + excelWriter.writeCellValue(2, row, map.get("SCWJ-AGE") == null ? "" : map.get("SCWJ-AGE").getAnswer()); + excelWriter.writeCellValue(3, row, map.get("SCWJ-idCard") == null ? "" : map.get("SCWJ-idCard").getAnswer()); + excelWriter.writeCellValue(4, row, map.get("SCWJ-BIRTH") == null ? "" : map.get("SCWJ-BIRTH").getAnswer()); + excelWriter.writeCellValue(5, row, map.get("SCWJ-PHONE") == null ? "" : map.get("SCWJ-PHONE").getAnswer()); + + if (record == null || StrUtil.isEmpty(record.getAnswer())) { + excelWriter.writeCellValue(6, row, "否"); + excelWriter.writeCellValue(7, row, "否"); + excelWriter.writeCellValue(8, row, "否"); + excelWriter.writeCellValue(9, row, "否"); + excelWriter.writeCellValue(10, row, "否"); + excelWriter.writeCellValue(11, row, "否"); + excelWriter.writeCellValue(12, row, "否"); + excelWriter.writeCellValue(13, row, "否"); + excelWriter.writeCellValue(14, row, "否"); + excelWriter.writeCellValue(15, row, "否"); + } else { + String answer = record.getAnswer(); + String[] split = answer.split(","); + excelWriter.writeCellValue(6, row, Arrays.asList(split).contains("01") ? "是" : "否"); + excelWriter.writeCellValue(7, row, Arrays.asList(split).contains("02") ? "是" : "否"); + excelWriter.writeCellValue(8, row, Arrays.asList(split).contains("03") ? "是" : "否"); + excelWriter.writeCellValue(9, row, Arrays.asList(split).contains("04") ? "是" : "否"); + excelWriter.writeCellValue(10, row, Arrays.asList(split).contains("05") ? "是" : "否"); + excelWriter.writeCellValue(11, row, Arrays.asList(split).contains("06") ? "是" : "否"); + excelWriter.writeCellValue(12, row, Arrays.asList(split).contains("07") ? "是" : "否"); + excelWriter.writeCellValue(13, row, Arrays.asList(split).contains("08") ? "是" : "否"); + excelWriter.writeCellValue(14, row, Arrays.asList(split).contains("09") ? "是" : "否"); + excelWriter.writeCellValue(15, row, Arrays.asList(split).contains("10") ? "是" : "否"); + } + String str = ""; + if (map.get("SCWJ-RESULT") != null && StrUtil.isNotEmpty(map.get("SCWJ-RESULT").getAnswer())) { + String answer1 = map.get("SCWJ-RESULT").getAnswer(); + if ("0".equals(answer1)) { + str = "正常"; + } + if ("1".equals(answer1)) { + str = "低危"; + } + if ("2".equals(answer1)) { + str = "中危"; + } + if ("3".equals(answer1)) { + str = "高危"; + } + } + excelWriter.writeCellValue(16, row, str); + excelWriter.writeCellValue(17, row, map.get("SCWJ-SQMC") == null ? "" : map.get("SCWJ-SQMC").getAnswer()); + excelWriter.writeCellValue(18, row, map.get("SCWJ-DEPT") == null ? "" : map.get("SCWJ-DEPT").getAnswer()); + } + } + } + + 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(); + excelWriter.flush(out); + } catch (IOException e) { + e.printStackTrace(); + } finally { + // 关闭writer,释放内存 + excelWriter.close(); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + } + } + @Override public void exportRzScreen(HttpServletResponse response, ScreeningDto.Query param) { @@ -215,6 +332,22 @@ public class ScreeningServiceImpl implements IScreeningService { } return new PageInfo<>(results); } + + @Override + public PageInfo adminQueryDetailByPage(ScreeningDto.Query param, Integer pageNum, Integer pageSize) { + List results = screeningDetailDao.adminQueryResult(null, null, param); + if (CollectionUtil.isNotEmpty(results)) { + List screeningDetailVos = screeningDetailDao.adminQueryDetailList(results.stream().map(ScrScreenVo.Result::getId).collect(Collectors.toList())); + if (CollectionUtil.isNotEmpty(screeningDetailVos)) { + Map> map = screeningDetailVos.stream().collect(Collectors.groupingBy(ScrScreenVo.ScreeningDetailVo::getRecordId)); + results.forEach(result -> { + result.setDetailList(map.get(result.getId())); + }); + } + } + return new PageInfo<>(results); + } + @Override public void saveQuestionnaire(ScreeningDto.SaveQuestionnaire param, Long userId) throws Exception { //redis判断是否已有 diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/WxQrCodeServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/WxQrCodeServiceImpl.java index 2fd76477..f5129c91 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/WxQrCodeServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/WxQrCodeServiceImpl.java @@ -4,7 +4,9 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.IdUtil; +import com.acupuncture.common.exception.base.BaseException; import com.acupuncture.system.domain.dto.AmsWxQrCodeDto; +import com.acupuncture.system.persist.dao.DmsUserDao; import com.acupuncture.system.persist.dao.WxQrCodeDao; import com.acupuncture.system.persist.mapper.AmsScreenWxQrCodeMapper; import com.acupuncture.common.utils.*; @@ -45,6 +47,9 @@ public class WxQrCodeServiceImpl implements WxQrCodeService { @Resource private WxQrCodeDao wxQrCodeDao; + @Resource + private DmsUserDao dmsUserDao; + @Value("${file.wxQrCodeTemplate}") public String wxQrCodeTemplate; @@ -201,6 +206,11 @@ public class WxQrCodeServiceImpl implements WxQrCodeService { return wxQrCodeDao.selectScreenList(hospitalId == null ? null : CollectionUtil.newArrayList(hospitalId)); } + @Override + public List adminQueryList(Long hospitalId) { + return wxQrCodeDao.adminSelectScreenList(hospitalId == null ? null : CollectionUtil.newArrayList(hospitalId)); + } + // @Override // public List queryList(Long hospitalId) { // if (SecurityUtils.getUserId() == 1) { @@ -277,6 +287,46 @@ public class WxQrCodeServiceImpl implements WxQrCodeService { DmsTenant amsHospital = dmsTenantMapper.selectByPrimaryKey(hostpitalId); + AmsScreenWxQrCodeExample amsScreenWxQrCodeExample = new AmsScreenWxQrCodeExample(); + amsScreenWxQrCodeExample.createCriteria().andTenantIdEqualTo(hostpitalId).andDelFlagEqualTo((byte) 0); + List amsScreenWxQrCodes = wxQrCodeMapper.selectByExample(amsScreenWxQrCodeExample); + if (CollectionUtil.isNotEmpty(amsScreenWxQrCodes)) { + url = amsScreenWxQrCodes.get(0).getUrl(); + } + + File file = new File(screenQrCodeTemplate); + XWPFTemplate template = XWPFTemplate.compile(file.getAbsolutePath()); + HashMap params = new HashMap<>(); + PictureRenderData pictureRenderData = Pictures.ofLocal("/home/acupuncture/server" + url).size(200, 200).create(); + params.put("pic", pictureRenderData); + String hospitalName = ""; + if (amsHospital != null) { + hospitalName = amsHospital.getName(); + } + params.put("hospitalName", hospitalName); + Long l = System.currentTimeMillis(); + //成图 + template.render(params); + //word转pdf + String filePath = "/home/acupuncture/server/profile/upload/" + hospitalName + "卒中筛查二维码.docx"; + template.writeAndClose(Files.newOutputStream(Paths.get(filePath))); + String pdfPath = "/home/acupuncture/server/profile/upload/" + hospitalName + "卒中筛查二维码.pdf"; + AsposeUtils.doc2pdf(filePath, pdfPath); + + return "/profile/upload/" + hospitalName + "卒中筛查二维码.pdf"; + + } + + @Override + public String adminExportScreen(String url, Long hostpitalId) throws IOException { + + DmsTenant amsHospital = dmsUserDao.queryById(hostpitalId); + AmsWxQrCodeVo.Result result = wxQrCodeDao.queryById(hostpitalId); + if (result == null) { + throw new BaseException("未找到数据"); + } + url = result.getUrl(); + File file = new File(screenQrCodeTemplate); XWPFTemplate template = XWPFTemplate.compile(file.getAbsolutePath()); HashMap params = new HashMap<>(); diff --git a/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml b/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml index 86e72dc7..7881b688 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml @@ -15,7 +15,7 @@ left join pms_patient p on t.patient_id = p.id - t.delete_flag = 0 + t.del_flag = 0 and t.visit_number = #{query.memberid} diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml index f8fadf2d..c88a27d1 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml @@ -99,6 +99,7 @@ left join dms_tenant d on t.tenant_id = d.id where t.del_flag = 0 + and t.status = 2 AND t.tenant_id = #{query.tenantId} diff --git a/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml b/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml index 22c6c9bf..a9181da4 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/ScreeningDetailDao.xml @@ -101,6 +101,46 @@ order by r.create_time desc + + + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml b/acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml index 42102cd5..4154f3eb 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/SysPowerDao.xml @@ -2,6 +2,20 @@ + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/WxQrCodeDao.xml b/acupuncture-system/src/main/resources/mapper/dao/WxQrCodeDao.xml index 825fdfad..90c0985b 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/WxQrCodeDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/WxQrCodeDao.xml @@ -2,6 +2,18 @@ + + + + \ No newline at end of file diff --git a/acupuncture-system/src/main/resources/mapper/system/UplReportImageMapper.xml b/acupuncture-system/src/main/resources/mapper/system/UplReportImageMapper.xml index 1c5f4061..1ce078cb 100644 --- a/acupuncture-system/src/main/resources/mapper/system/UplReportImageMapper.xml +++ b/acupuncture-system/src/main/resources/mapper/system/UplReportImageMapper.xml @@ -3,7 +3,7 @@ - + @@ -73,7 +73,7 @@ - id, patient_id, file_name, file_path, del_flag, tenant_id, create_by, create_time, + id, member_id, file_name, file_path, del_flag, tenant_id, create_by, create_time, update_by, update_time, remark