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 d21ad29b8..73868fe42 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 @@ -241,4 +241,9 @@ public class ExternalController { return JsonResponse.ok(externalService.getWeightHeight(dto.getWeightMachineId())); } + @ApiOperation("查询身高体重") + @PostMapping("/export") + public void export(HttpServletResponse response){ + externalService.export(response); + } } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/JszController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/JszController.java new file mode 100644 index 000000000..838f53c53 --- /dev/null +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/JszController.java @@ -0,0 +1,91 @@ +package com.acupuncture.web.controller.web; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import com.acupuncture.common.annotation.Anonymous; +import com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.enums.DataSourceType; +import com.acupuncture.system.domain.dto.ExternalDto; +import com.acupuncture.system.domain.dto.JszDto; +import com.acupuncture.system.domain.vo.ExternalVo; +import com.acupuncture.system.domain.vo.JszVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zzc + * @Package com.acupuncture.web.controller.web + * @Date 2025/6/26 13:40 + * @description: + */ +@Slf4j +@Api(tags = "外部接口") +@RestController +@RequestMapping("") +public class JszController { + + @Anonymous + @ApiOperation("获取人员信息") + @GetMapping("/getUserInfo") + @DataSource(DataSourceType.MASTER) + public Object test(@RequestParam("uid") String uid) { + log.info("获肌少症取人员信息:{}", uid); + JszVo.MemberResult memberResult = new JszVo.MemberResult(); + memberResult.setTitle("personInfo"); + memberResult.setGID("TFHT"); + memberResult.setUID("1"); + memberResult.setName("张三"); + memberResult.setSex("1"); //(男1,女2) + memberResult.setHeight("175.6"); + memberResult.setBirthYear("1990"); + memberResult.setPhone("123456"); + if (memberResult == null) { + return "no person"; + } + return memberResult; + } + + @Anonymous + @ApiOperation("运动机能类数据的实时传输") + @PostMapping("/ydjnlsj") + public Object ydjnlsj(@RequestBody String str) { + log.info("str:{}", str); + JSONObject object = new JSONObject(str); + JszDto.Ydjnlsj ydjnlsj = BeanUtil.copyProperties(object, JszDto.Ydjnlsj.class); + + log.info("运动机能类数据的实时传输:{}", ydjnlsj); +// List list = dto.getList(); + + return "upload ok"; + } + + @Anonymous + @ApiOperation("体成分数据的实时上传") + @PostMapping("/tcfsj") + public Object tcfsj(@RequestBody String str) { + log.info("str:{}", str); + JSONObject object = new JSONObject(str); + JszDto.Tcfsj tcfsj = BeanUtil.copyProperties(object, JszDto.Tcfsj.class); + + log.info("运动机能类数据的实时传输:{}", tcfsj); +// List list = dto.getList(); + + return "upload ok"; + } + + @Anonymous + @ApiOperation("6.报告图片上传") + @PostMapping(value = "/uploadFile", consumes = "multipart/form-data") + public Object uploadFile(MultipartFile image) { + log.info("报告图片上传"); + + return "uploadReport ok"; + } +} diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/JszDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/JszDto.java new file mode 100644 index 000000000..b78ca33fc --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/JszDto.java @@ -0,0 +1,138 @@ +package com.acupuncture.system.domain.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @Author zzc + * @Package com.acupuncture.system.domain.dto + * @Date 2025/6/26 14:00 + * @description: + */ +public class JszDto { + + @Data + @ApiModel("运动机能类数据") + public static class Ydjnlsj { + @JsonProperty(value = "Title") + private String Title; //标题:CURRENT_FIT_DATA指当前体质测试类数据 + @JsonProperty(value = "UUID") + private String UUID; //单位代码(或科室代码、项目代码) + @JsonProperty(value = "UID") + private String UID; //人员编号 + @JsonProperty(value = "TestID") + private String TestID; //测试序号(时间戳) + @JsonProperty(value = "TestDate") + private String TestDate; //测试日期 + @JsonProperty(value = "Name") + private String Name; //测试者姓名 + @JsonProperty(value = "Sex") + private String Sex; //测试者性别,男1女2 + @JsonProperty(value = "BirthYear") + private String BirthYear; //测试者出生年份 + @JsonProperty(value = "Item") + private String Item; //测试项目标识,如"Grip"代表握力 + @JsonProperty(value = "Value") + private String Value; //测试值 + } + + @Data + @ApiModel("体成分数据的实时上传") + public static class Tcfsj { + @JsonProperty(value = "Title") + private String Title; //标题:BCA_DATA指体成分测试类数据 + @JsonProperty(value = "UUID") + private String UUID; //单位代码(或科室代码、项目代码) + @JsonProperty(value = "UID") + private String UID; //人员编码 + @JsonProperty(value = "TestID") + private String TestID; //测试序号(时间戳) + @JsonProperty(value = "TestDate") + private String TestDate; //测试日期 + @JsonProperty(value = "Name") + private String Name; //测试者姓名 + @JsonProperty(value = "Sex") + private String Sex; //测试者性别,男1女2 + @JsonProperty(value = "Weight") + private String Weight; //体重 + @JsonProperty(value = "Fat") + private String Fat; //脂肪 + @JsonProperty(value = "Bone") + private String Bone; //骨质 + @JsonProperty(value = "Protein") + private String Protein; //蛋白质 + @JsonProperty(value = "Water") + private String Water; //水分 + @JsonProperty(value = "Muscle") + private String Muscle; //肌肉 + @JsonProperty(value = "SMM") + private String SMM; //骨骼肌 + @JsonProperty(value = "PBF") + private String PBF; //体脂百分比 + @JsonProperty(value = "BMI") + private String BMI; //体质指数 + @JsonProperty(value = "BMR") + private String BMR; //基础代谢 + @JsonProperty(value = "Edema") + private String Edema; //水肿系数(2位小数) + @JsonProperty(value = "VFI") + private String VFI; //内脏脂肪指数 + @JsonProperty(value = "BodyAge") + private String BodyAge; //身体年龄 + @JsonProperty(value = "Score") + private String Score; //健康评分 + @JsonProperty(value = "BodyType") + private String BodyType; //体型 + @JsonProperty(value = "Standard_weight") + private String Standard_weight; //目标体重 + @JsonProperty(value = "Weight_control") + private String Weight_control; //体重控制 + @JsonProperty(value = "Fat_control") + private String Fat_control; //脂肪控制量 + @JsonProperty(value = "Muscle_control") + private String Muscle_control; //肌肉控制量 + @JsonProperty(value = "ASMI") + private String ASMI; //四肢骨骼肌指数 +// @JsonProperty(value = "Value") +// private String Edema; //水肿系数(2位小数) + @JsonProperty(value = "LBM") + private String LBM; //瘦体重(去脂体重) + @JsonProperty(value = "ICW") + private String ICW; //细胞内液 + @JsonProperty(value = "ECW") + private String ECW; //细胞外液 + @JsonProperty(value = "LiverRisk") + private String LiverRisk; //脂肪肝风险系数 + @JsonProperty(value = "TR_fat") + private String TR_fat; //躯干脂肪量 + @JsonProperty(value = "LA_fat") + private String LA_fat; //左上肢脂肪 + @JsonProperty(value = "RA_fat") + private String RA_fat; //右上肢脂肪 + @JsonProperty(value = "LL_fat") + private String LL_fat; //左下肢脂肪 + @JsonProperty(value = "RL_fat") + private String RL_fat; //右下肢脂肪 + @JsonProperty(value = "TR_water") + private String TR_water; //躯干水分量 + @JsonProperty(value = "LA_water") + private String LA_water; //左上肢水分 + @JsonProperty(value = "RA_water") + private String RA_water; //右上肢水分 + @JsonProperty(value = "LL_water") + private String LL_water; //左下肢水分 + @JsonProperty(value = "RL_water") + private String RL_water; //右下肢水分 + @JsonProperty(value = "TR_muscle") + private String TR_muscle; //躯干肌肉量 + @JsonProperty(value = "LA_muscle") + private String LA_muscle; //左上肢肌肉 + @JsonProperty(value = "RA_muscle") + private String RA_muscle; //右上肢肌肉 + @JsonProperty(value = "LL_muscle") + private String LL_muscle; //左下肢肌肉 + @JsonProperty(value = "RL_muscle") + private String RL_muscle; //右下肢肌肉 + } +} diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/JszVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/JszVo.java new file mode 100644 index 000000000..94a151c3a --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/JszVo.java @@ -0,0 +1,34 @@ +package com.acupuncture.system.domain.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +/** + * @Author zzc + * @Package com.acupuncture.system.domain.vo + * @Date 2025/6/26 13:45 + * @description: + */ +public class JszVo { + + @Data + public static class MemberResult { + @JsonProperty(value = "Title") + private String Title; //标题 + @JsonProperty(value = "GID") + private String GID; //组别代码(可为空) + @JsonProperty(value = "UID") + private String UID; //人员编号 + @JsonProperty(value = "Name") + private String Name; //姓名 + @JsonProperty(value = "Sex") + private String Sex; //性别 (男1,女2) + @JsonProperty(value = "Height") + private String Height; //身高(cm) + @JsonProperty(value = "BirthYear") + private String BirthYear; //出生年 + @JsonProperty(value = "Phone") + private String Phone; //电话(可为空) + } + +} 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 851d42749..8a61ff448 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 @@ -7,6 +7,7 @@ import com.acupuncture.system.domain.po.UplRtcfInfo; import com.acupuncture.system.domain.vo.ExternalVo; import com.acupuncture.system.domain.vo.UplRtcfInfoVo; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -62,4 +63,6 @@ public interface ExternalService { void dmh(String str); HmsWeightHeight getWeightHeight(String weightMachineId); + + void export(HttpServletResponse response); } 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 49ba9ced0..ff909bcb4 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 @@ -2,8 +2,11 @@ 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.IoUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.poi.excel.BigExcelWriter; import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.system.domain.dto.ExternalDto; import com.acupuncture.system.domain.po.*; @@ -14,10 +17,15 @@ import com.acupuncture.system.persist.mapper.*; import com.acupuncture.system.service.ExternalService; import com.github.pagehelper.PageHelper; import org.apache.ibatis.ognl.ASTInstanceof; +import org.springframework.security.core.parameters.P; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.regex.Matcher; @@ -47,6 +55,7 @@ public class ExternalServiceImpl implements ExternalService { @Resource private PmsPatientMapper patientMapper; + @Override public ExternalVo.Result query(String from, String memberid) { ExternalDto.Query query = new ExternalDto.Query(); @@ -283,4 +292,72 @@ public class ExternalServiceImpl implements ExternalService { } return null; } + + @Override + public void export(HttpServletResponse response) { + PmsTreatmentExample pmsTreatmentExample = new PmsTreatmentExample(); + pmsTreatmentExample.createCriteria().andDelFlagEqualTo((byte) 0); + 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); + + + if (CollectionUtil.isNotEmpty(pmsTreatments)) { + int row = 0; + for (int i = 0; i < pmsTreatments.size(); i++) { + if (pmsTreatments.get(i).getMemberId() == null) { + continue; + } + 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()); + + 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()); + } + } + + } + } + + 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); + } + + } }