From 21b8f31ddfc4ab214fbab8e2a5de2d205a23798a Mon Sep 17 00:00:00 2001 From: "zhengzhic18@163.com" Date: Tue, 8 Jul 2025 12:01:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BD=93=E6=88=90=E5=88=86?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=87=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/web/ExternalController.java | 4 +- .../system/domain/dto/ExternalDto.java | 7 ++ .../system/service/ExternalService.java | 2 +- .../service/impl/ExternalServiceImpl.java | 77 ++++++++++++++----- 4 files changed, 68 insertions(+), 22 deletions(-) diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java index 73868fe42..635f1390b 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 @@ -243,7 +243,7 @@ public class ExternalController { @ApiOperation("查询身高体重") @PostMapping("/export") - public void export(HttpServletResponse response){ - externalService.export(response); + public void export(HttpServletResponse response, @RequestBody ExternalDto.Export dto){ + externalService.export(response, dto.getStartTime(), dto.getEndTime()); } } 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 78a456410..74ac50278 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 @@ -220,4 +220,11 @@ public class ExternalDto { private String from; private String memberid; } + + @Data + public static class Export{ + private String startTime; + private String endTime; + + } } 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 8a61ff448..469aaa4a9 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 @@ -64,5 +64,5 @@ public interface ExternalService { HmsWeightHeight getWeightHeight(String weightMachineId); - void export(HttpServletResponse response); + void export(HttpServletResponse response, String startTime, String endTime); } 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 ff909bcb4..a90567af1 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 @@ -16,6 +16,7 @@ import com.acupuncture.system.persist.dao.ExternalDao; import com.acupuncture.system.persist.mapper.*; import com.acupuncture.system.service.ExternalService; import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.ibatis.ognl.ASTInstanceof; import org.springframework.security.core.parameters.P; import org.springframework.stereotype.Service; @@ -294,23 +295,21 @@ public class ExternalServiceImpl implements ExternalService { } @Override - public void export(HttpServletResponse response) { + public void export(HttpServletResponse response, String startTime, String endTime) { +// PageHelper.startPage(1, 50); PmsTreatmentExample pmsTreatmentExample = new PmsTreatmentExample(); - pmsTreatmentExample.createCriteria().andDelFlagEqualTo((byte) 0); + PmsTreatmentExample.Criteria criteria = pmsTreatmentExample.createCriteria().andDelFlagEqualTo((byte) 0); + if (StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)) { + criteria.andCreateTimeBetween(DateUtil.parse(startTime), DateUtil.parse(endTime)); + } List pmsTreatments = pmsTreatmentMapper.selectByExample(pmsTreatmentExample); BigExcelWriter writer = new BigExcelWriter(); List header = new ArrayList<>(); - header.add("创建时间"); header.add("姓名"); header.add("编号"); - header.add("身高"); - header.add("体重"); - header.add("身高"); - header.add("体重"); - writer.writeHeadRow(header); - + int b = 0; if (CollectionUtil.isNotEmpty(pmsTreatments)) { int row = 0; for (int i = 0; i < pmsTreatments.size(); i++) { @@ -319,26 +318,66 @@ public class ExternalServiceImpl implements ExternalService { } row += 1; - writer.writeCellValue(0, row, DateUtil.format(pmsTreatments.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss")); - writer.writeCellValue(1, row, pmsTreatments.get(i).getName()); - writer.writeCellValue(2, row, pmsTreatments.get(i).getMemberId()); +// writer.writeCellValue(0, row, DateUtil.format(pmsTreatments.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss")); + writer.writeCellValue(0, row, pmsTreatments.get(i).getName()); + writer.writeCellValue(1, row, pmsTreatments.get(i).getMemberId()); UplRtcfInfoExample uplRtcfInfoExample = new UplRtcfInfoExample(); uplRtcfInfoExample.createCriteria().andMemberidEqualTo(pmsTreatments.get(i).getMemberId() + ""); List uplRtcfInfos = uplRtcfInfoMapper.selectByExample(uplRtcfInfoExample); if (CollectionUtil.isNotEmpty(uplRtcfInfos)) { - int n = 2; - for (UplRtcfInfo uplRtcfInfo : uplRtcfInfos) { - n += 1; - writer.writeCellValue(n, row, uplRtcfInfo.getHeight()); - n += 1; - writer.writeCellValue(n, row, uplRtcfInfo.getWeight()); + int n = 1; + for (int j = 0; j < uplRtcfInfos.size(); j++) { + if (j > b) { + b = j; + } + UplRtcfInfo uplRtcfInfo = uplRtcfInfos.get(j); + writer.writeCellValue((j * 19) + (n + 1), row, DateUtil.format(uplRtcfInfo.getCreateTime(), "yyyy-MM-dd HH:mm")); + writer.writeCellValue((j * 19) + (n + 2), row, uplRtcfInfo.getHeight()); + writer.writeCellValue((j * 19) + (n + 3), row, uplRtcfInfo.getWeight()); + writer.writeCellValue((j * 19) + (n + 4), row, uplRtcfInfo.getFat()); + writer.writeCellValue((j * 19) + (n + 5), row, uplRtcfInfo.getBone()); + writer.writeCellValue((j * 19) + (n + 6), row, uplRtcfInfo.getProtein()); + writer.writeCellValue((j * 19) + (n + 7), row, uplRtcfInfo.getWater()); + writer.writeCellValue((j * 19) + (n + 8), row, uplRtcfInfo.getMuscle()); + writer.writeCellValue((j * 19) + (n + 9), row, uplRtcfInfo.getSmm()); + writer.writeCellValue((j * 19) + (n + 10), row, uplRtcfInfo.getPbf()); + writer.writeCellValue((j * 19) + (n + 11), row, uplRtcfInfo.getBmi()); + writer.writeCellValue((j * 19) + (n + 12), row, uplRtcfInfo.getWhr()); + writer.writeCellValue((j * 19) + (n + 13), row, uplRtcfInfo.getVfi()); + writer.writeCellValue((j * 19) + (n + 14), row, uplRtcfInfo.getBodyAge()); + writer.writeCellValue((j * 19) + (n + 15), row, uplRtcfInfo.getScore()); + writer.writeCellValue((j * 19) + (n + 16), row, uplRtcfInfo.getBodyType()); + writer.writeCellValue((j * 19) + (n + 17), row, uplRtcfInfo.getLbm()); + writer.writeCellValue((j * 19) + (n + 18), row, uplRtcfInfo.getDiagnosis()); } } - } } + for (int i = 0; i <= b; i++) { + header.add("创建时间"); + header.add("身高"); + header.add("体重"); + header.add("脂肪"); + header.add("骨质"); + header.add("蛋白质"); + header.add("水分"); + header.add("肌肉"); + header.add("骨骼肌"); + header.add("体脂百分比"); + header.add("体质指数"); + header.add("腰臀比"); + header.add("内脏脂肪指数"); + header.add("身体年龄"); + header.add("健康评分"); + header.add("体型判定"); + header.add("瘦体重"); +// header.add("细胞 + header.add("诊断结论"); + header.add(""); + } + writer.writeHeadRow(header); String filename = StrUtil.format("患者身高体重信息-{}.xlsx", DateUtil.date().toString("yyyyMMdd")); //response为HttpServletResponse对象