Browse Source

添加体成分历史数据导出功能

new
zhengzhic18@163.com 5 months ago
parent
commit
21b8f31ddf
  1. 4
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java
  2. 7
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java
  3. 2
      acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java
  4. 77
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java

4
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java

@ -243,7 +243,7 @@ public class ExternalController {
@ApiOperation("查询身高体重") @ApiOperation("查询身高体重")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response){ public void export(HttpServletResponse response, @RequestBody ExternalDto.Export dto){
externalService.export(response); externalService.export(response, dto.getStartTime(), dto.getEndTime());
} }
} }

7
acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java

@ -220,4 +220,11 @@ public class ExternalDto {
private String from; private String from;
private String memberid; private String memberid;
} }
@Data
public static class Export{
private String startTime;
private String endTime;
}
} }

2
acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java

@ -64,5 +64,5 @@ public interface ExternalService {
HmsWeightHeight getWeightHeight(String weightMachineId); HmsWeightHeight getWeightHeight(String weightMachineId);
void export(HttpServletResponse response); void export(HttpServletResponse response, String startTime, String endTime);
} }

77
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.persist.mapper.*;
import com.acupuncture.system.service.ExternalService; import com.acupuncture.system.service.ExternalService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.ognl.ASTInstanceof; import org.apache.ibatis.ognl.ASTInstanceof;
import org.springframework.security.core.parameters.P; import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -294,23 +295,21 @@ public class ExternalServiceImpl implements ExternalService {
} }
@Override @Override
public void export(HttpServletResponse response) { public void export(HttpServletResponse response, String startTime, String endTime) {
// PageHelper.startPage(1, 50);
PmsTreatmentExample pmsTreatmentExample = new PmsTreatmentExample(); 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<PmsTreatment> pmsTreatments = pmsTreatmentMapper.selectByExample(pmsTreatmentExample); List<PmsTreatment> pmsTreatments = pmsTreatmentMapper.selectByExample(pmsTreatmentExample);
BigExcelWriter writer = new BigExcelWriter(); BigExcelWriter writer = new BigExcelWriter();
List<String> header = new ArrayList<>(); List<String> header = new ArrayList<>();
header.add("创建时间");
header.add("姓名"); header.add("姓名");
header.add("编号"); header.add("编号");
header.add("身高");
header.add("体重");
header.add("身高");
header.add("体重");
writer.writeHeadRow(header);
int b = 0;
if (CollectionUtil.isNotEmpty(pmsTreatments)) { if (CollectionUtil.isNotEmpty(pmsTreatments)) {
int row = 0; int row = 0;
for (int i = 0; i < pmsTreatments.size(); i++) { for (int i = 0; i < pmsTreatments.size(); i++) {
@ -319,26 +318,66 @@ public class ExternalServiceImpl implements ExternalService {
} }
row += 1; row += 1;
writer.writeCellValue(0, row, DateUtil.format(pmsTreatments.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss")); // 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(0, row, pmsTreatments.get(i).getName());
writer.writeCellValue(2, row, pmsTreatments.get(i).getMemberId()); writer.writeCellValue(1, row, pmsTreatments.get(i).getMemberId());
UplRtcfInfoExample uplRtcfInfoExample = new UplRtcfInfoExample(); UplRtcfInfoExample uplRtcfInfoExample = new UplRtcfInfoExample();
uplRtcfInfoExample.createCriteria().andMemberidEqualTo(pmsTreatments.get(i).getMemberId() + ""); uplRtcfInfoExample.createCriteria().andMemberidEqualTo(pmsTreatments.get(i).getMemberId() + "");
List<UplRtcfInfo> uplRtcfInfos = uplRtcfInfoMapper.selectByExample(uplRtcfInfoExample); List<UplRtcfInfo> uplRtcfInfos = uplRtcfInfoMapper.selectByExample(uplRtcfInfoExample);
if (CollectionUtil.isNotEmpty(uplRtcfInfos)) { if (CollectionUtil.isNotEmpty(uplRtcfInfos)) {
int n = 2; int n = 1;
for (UplRtcfInfo uplRtcfInfo : uplRtcfInfos) { for (int j = 0; j < uplRtcfInfos.size(); j++) {
n += 1; if (j > b) {
writer.writeCellValue(n, row, uplRtcfInfo.getHeight()); b = j;
n += 1; }
writer.writeCellValue(n, row, uplRtcfInfo.getWeight()); 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")); String filename = StrUtil.format("患者身高体重信息-{}.xlsx", DateUtil.date().toString("yyyyMMdd"));
//response为HttpServletResponse对象 //response为HttpServletResponse对象

Loading…
Cancel
Save