From 523e3c84994c5810253aa0414e53fc0b2ec17eea Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Wed, 5 Feb 2025 16:40:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=81=A5=E5=BA=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=EF=BC=8C=E5=90=83=E5=A5=B6=E9=87=8F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=8E=A5=E5=8F=A3=E6=96=B0=E5=A2=9E=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StatisticAnalysisController.java | 8 + .../vo/HealthMilkPowderStatisticVo.java | 150 ++++++++++++ .../mapper/StatisticAnalysisMapper.java | 22 +- .../service/IStatisticAnalysisService.java | 3 + .../service/impl/StatisticAnalysisImpl.java | 48 ++++ .../mapper/health/StatisticAnalysisMapper.xml | 220 ++++++++++++++++++ 6 files changed, 447 insertions(+), 4 deletions(-) create mode 100644 intc-modules/intc-health/src/main/java/com/intc/health/domain/vo/HealthMilkPowderStatisticVo.java diff --git a/intc-modules/intc-health/src/main/java/com/intc/health/controller/StatisticAnalysisController.java b/intc-modules/intc-health/src/main/java/com/intc/health/controller/StatisticAnalysisController.java index acf64d1..6e58e80 100644 --- a/intc-modules/intc-health/src/main/java/com/intc/health/controller/StatisticAnalysisController.java +++ b/intc-modules/intc-health/src/main/java/com/intc/health/controller/StatisticAnalysisController.java @@ -61,4 +61,12 @@ public class StatisticAnalysisController extends BaseController { } + @ApiOperation("吃奶统计分析") + @GetMapping("/milkPowderAnalysis") + public Map getMilkPowderAnalysis(AnalysisDto analysisDto){ + Map resultMap = iStatisticAnalysisService.getMilkPowderAnalysis(analysisDto); + return AjaxResult.success(resultMap); + } + + } diff --git a/intc-modules/intc-health/src/main/java/com/intc/health/domain/vo/HealthMilkPowderStatisticVo.java b/intc-modules/intc-health/src/main/java/com/intc/health/domain/vo/HealthMilkPowderStatisticVo.java new file mode 100644 index 0000000..ec551e6 --- /dev/null +++ b/intc-modules/intc-health/src/main/java/com/intc/health/domain/vo/HealthMilkPowderStatisticVo.java @@ -0,0 +1,150 @@ +package com.intc.health.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 吃奶记录Vo对象 health_milk_powder_record + * + * @author tianyongbao + * @date 2025-02-01 + */ +@ApiModel("吃奶记录Vo对象") +@Data +public class HealthMilkPowderStatisticVo +{ + /** 人员名称 */ + @ApiModelProperty(value="人员姓名)") + private String personName; + + /** 人员ID */ + @ApiModelProperty(value="人员ID)") + private Long personId; + + /** 今日次数 */ + @ApiModelProperty(value="今日次数)") + private int todayCount; + + /** 今日吃奶量 */ + @ApiModelProperty(value="今日吃奶量)") + private double todayConsumption; + + /** 今日平均吃奶量 */ + @ApiModelProperty(value="今日平均吃奶量)") + private double todayPerConsumption; + + /** 近7日次数 */ + @ApiModelProperty(value="近7日次数)") + private int sevenDayCount; + + /** 近7日吃奶量 */ + @ApiModelProperty(value="近7日吃奶量)") + private double sevenDayConsumption; + + /** 近7日平均吃奶量 */ + @ApiModelProperty(value="近7日平均吃奶量)") + private double sevenDayPerConsumption; + + /** 近1月次数 */ + @ApiModelProperty(value="近1月次数)") + private int oneMonthCount; + + /** 近1月吃奶量 */ + @ApiModelProperty(value="近1月吃奶量)") + private double oneMonthConsumption; + + /** 近1月平均吃奶量 */ + @ApiModelProperty(value="近1月平均吃奶量)") + private double oneMonthPerConsumption; + + + /** 近3月次数 */ + @ApiModelProperty(value="近3月次数)") + private int threeMonthCount; + + /** 近3月吃奶量 */ + @ApiModelProperty(value="近3月吃奶量)") + private double threeMonthConsumption; + + /** 近3月平均吃奶量 */ + @ApiModelProperty(value="近3月平均吃奶量)") + private double threeMonthPerConsumption; + + /** 近6月次数 */ + @ApiModelProperty(value="近6月次数)") + private int sixMonthCount; + + /** 近6月吃奶量 */ + @ApiModelProperty(value="近6月吃奶量)") + private double sixMonthConsumption; + + /** 近6月平均吃奶量 */ + @ApiModelProperty(value="近6月平均吃奶量)") + private double sixMonthPerConsumption; + + /** 近1年次数 */ + @ApiModelProperty(value="近1年次数)") + private int oneYearCount; + + /** 近1年吃奶量 */ + @ApiModelProperty(value="近1年吃奶量)") + private double oneYearConsumption; + + /** 近1年平均吃奶量 */ + @ApiModelProperty(value="近1年平均吃奶量)") + private double oneYearPerConsumption; + + + /** 近2年次数 */ + @ApiModelProperty(value="近2年次数)") + private int twoYearCount; + + /** 近2年吃奶量 */ + @ApiModelProperty(value="近2年吃奶量)") + private double twoYearConsumption; + + /** 近2年平均吃奶量 */ + @ApiModelProperty(value="近2年平均吃奶量)") + private double twoYearPerConsumption; + + /** 近3年次数 */ + @ApiModelProperty(value="近3年次数)") + private int threeYearCount; + + /** 近3年吃奶量 */ + @ApiModelProperty(value="近3年吃奶量)") + private double threeYearConsumption; + + /** 近3年平均吃奶量 */ + @ApiModelProperty(value="近3年平均吃奶量)") + private double threeYearPerConsumption; + + /** 近5年次数 */ + @ApiModelProperty(value="近5年次数)") + private int fiveYearCount; + + /** 近5年吃奶量 */ + @ApiModelProperty(value="近5年吃奶量)") + private double fiveYearConsumption; + + /** 近5年平均吃奶量 */ + @ApiModelProperty(value="近5年平均吃奶量)") + private double fiveYearPerConsumption; + + /** 总次数 */ + @ApiModelProperty(value="总次数)") + private int totalCount; + + /** 总吃奶量 */ + @ApiModelProperty(value="总吃奶量)") + private double totalConsumption; + + /** 总平均吃奶量 */ + @ApiModelProperty(value="总平均吃奶量)") + private double totalPerConsumption; + + + + +} diff --git a/intc-modules/intc-health/src/main/java/com/intc/health/mapper/StatisticAnalysisMapper.java b/intc-modules/intc-health/src/main/java/com/intc/health/mapper/StatisticAnalysisMapper.java index d81b522..830a5a0 100644 --- a/intc-modules/intc-health/src/main/java/com/intc/health/mapper/StatisticAnalysisMapper.java +++ b/intc-modules/intc-health/src/main/java/com/intc/health/mapper/StatisticAnalysisMapper.java @@ -3,11 +3,9 @@ package com.intc.health.mapper; import com.intc.common.datascope.annotation.DataScope; import com.intc.health.domain.dto.HealthDoctorRecordDto; import com.intc.health.domain.dto.HealthMarRecordDto; +import com.intc.health.domain.dto.HealthMilkPowderRecordDto; import com.intc.health.domain.dto.HealthRecordDto; -import com.intc.health.domain.vo.HealthDoctorRecordVo; -import com.intc.health.domain.vo.HealthMarRecordVo; -import com.intc.health.domain.vo.HealthRecordVo; -import com.intc.health.domain.vo.HealthStaticPersonVo; +import com.intc.health.domain.vo.*; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -159,6 +157,22 @@ public interface StatisticAnalysisMapper { public List selectDepartStaticList(HealthDoctorRecordDto dto); + /** + * 查询用药记录 + * + * @param healthMilkPowderRecordDto + * @return 收支集合 + */ + @DataScope(businessAlias = "hp") + public HealthMilkPowderStatisticVo selectMilkPowderStatistic(HealthMilkPowderRecordDto healthMilkPowderRecordDto); + /** + * 查询用药记录 + * + * @param healthMilkPowderRecordDto + * @return 收支集合 + */ + @DataScope(businessAlias = "hmpr") + public List selectMilkPowderDayStatistic(HealthMilkPowderRecordDto healthMilkPowderRecordDto); } diff --git a/intc-modules/intc-health/src/main/java/com/intc/health/service/IStatisticAnalysisService.java b/intc-modules/intc-health/src/main/java/com/intc/health/service/IStatisticAnalysisService.java index b32e7e6..1cb9763 100644 --- a/intc-modules/intc-health/src/main/java/com/intc/health/service/IStatisticAnalysisService.java +++ b/intc-modules/intc-health/src/main/java/com/intc/health/service/IStatisticAnalysisService.java @@ -23,4 +23,7 @@ public interface IStatisticAnalysisService { public Map getDoctorAnalysis(AnalysisDto analysisDto); + public Map getMilkPowderAnalysis(AnalysisDto analysisDto); + + } diff --git a/intc-modules/intc-health/src/main/java/com/intc/health/service/impl/StatisticAnalysisImpl.java b/intc-modules/intc-health/src/main/java/com/intc/health/service/impl/StatisticAnalysisImpl.java index 802d4e4..127e2e3 100644 --- a/intc-modules/intc-health/src/main/java/com/intc/health/service/impl/StatisticAnalysisImpl.java +++ b/intc-modules/intc-health/src/main/java/com/intc/health/service/impl/StatisticAnalysisImpl.java @@ -342,6 +342,7 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService { } ArrayList> temperatureList = new ArrayList<>(); + Collections.reverse(temperatureRecordVoList); for (HealthTemperatureRecordVo vo:temperatureRecordVoList ) { Map datamap = new HashMap<>(); @@ -738,4 +739,51 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService { return map; } + @Override + public Map getMilkPowderAnalysis(AnalysisDto analysisDto) { + //返回数据 + HashMap map = new HashMap<>(); + DecimalFormat decimalFormat = new DecimalFormat("#.##"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + HealthMilkPowderRecordDto dto=new HealthMilkPowderRecordDto(); + dto.setPersonId(analysisDto.getId()); + //获取数据 + dto.setEndTime(analysisDto.getEndTime()); + dto.setStartTime(analysisDto.getStartTime()); + HealthMilkPowderStatisticVo milkPowderStatisticVo= statisticAnalysisMapper.selectMilkPowderStatistic(dto); + if(milkPowderStatisticVo.getTodayCount()!=0) { + milkPowderStatisticVo.setTodayPerConsumption(milkPowderStatisticVo.getTodayConsumption() / milkPowderStatisticVo.getTodayCount()); + } + milkPowderStatisticVo.setSevenDayPerConsumption(Double.parseDouble(decimalFormat.format(milkPowderStatisticVo.getSevenDayConsumption()/7))); + //列表 + map.put("milkPowderStatistic",milkPowderStatisticVo); + + List list=statisticAnalysisMapper.selectMilkPowderDayStatistic(dto); + + + ArrayList> milkPowderList = new ArrayList<>(); + ArrayList> milkPowderTableList = new ArrayList<>(); + for (HealthMilkPowderRecordVo vo:list + ) { + Map datamap = new HashMap<>(); + datamap.put("time", dateFormat.format(vo.getSucklesTime())); + datamap.put("value", vo.getConsumption()); + milkPowderTableList.add(datamap); + } + Collections.reverse(list); + for (HealthMilkPowderRecordVo vo:list + ) { + Map datamap = new HashMap<>(); + datamap.put("time", dateFormat.format(vo.getSucklesTime())); + datamap.put("value", vo.getConsumption()); + milkPowderList.add(datamap); + } + + + //列表 + map.put("milkPowderTableList",milkPowderTableList); + map.put("milkPowderList",milkPowderList); + + return map; + } } diff --git a/intc-modules/intc-health/src/main/resources/mapper/health/StatisticAnalysisMapper.xml b/intc-modules/intc-health/src/main/resources/mapper/health/StatisticAnalysisMapper.xml index 03de897..ff6d343 100644 --- a/intc-modules/intc-health/src/main/resources/mapper/health/StatisticAnalysisMapper.xml +++ b/intc-modules/intc-health/src/main/resources/mapper/health/StatisticAnalysisMapper.xml @@ -599,5 +599,225 @@ group by hmr.departments order by count(hmr.departments) desc + + \ No newline at end of file