From 172dd0dcd3ebd157d488a5ff5d4311b857cc58d0 Mon Sep 17 00:00:00 2001 From: ryoeiken <754264374@qq.com> Date: Tue, 12 Jan 2021 15:05:38 +0800 Subject: [PATCH] =?UTF-8?q?api=EF=BC=9A=E4=BB=8A=E6=98=8E=E6=97=A5?= =?UTF-8?q?=E6=8A=A5=E9=A4=90=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fantang/controller/ClientController.java | 25 +++++++++++++++++++ .../controller/ClientPatientController.java | 12 +++++++++ .../fantang/domain/FtReportMealsDao.java | 10 +++++--- .../fantang/mapper/FtFoodDemandDaoMapper.java | 22 +++++++++++++--- .../service/IFtFoodDemandDaoService.java | 3 +++ .../impl/FtFoodDemandDaoServiceImpl.java | 6 +++++ 6 files changed, 70 insertions(+), 8 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java index 43bfe0b82..48954febb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java @@ -527,6 +527,31 @@ public class ClientController extends BaseController { } + /** + * 今日员工报餐统计 + */ + @GetMapping("/getStatisticsOrderOfToday") + public AjaxResult getStatisticsOrderOfToday() { + + Date today = new Date(); + + return orderDaoService.statisGetOrderOfDate(today); + } + + /** + * 明日员工报餐统计 + */ + @GetMapping("/getStatisticsOrderOfTomorrow") + public AjaxResult getStatisticsReportMealsOfTomorrow() { + + Date today = new Date(); + Date tomorrow = DateUtil.offsetDay(today, 1); + + return orderDaoService.statisGetOrderOfDate(tomorrow); + } + + + /** * 人脸识别设备心跳信号 * @param request diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java index 73d70620c..5770aa0e6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java @@ -170,6 +170,18 @@ public class ClientPatientController extends BaseController { return AjaxResult.success(list); } + + /** + * 明日(未报)病患报餐统计 + */ + @GetMapping("/getStatisticsReportMealsOfTomorrow") + public AjaxResult getStatisticsReportMealsOfTomorrow() { + + List list = iFtFoodDemandDaoService.getStatisticsFoodDemand(); + + return AjaxResult.success(list); + } + /** * 病患报餐周统计 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtReportMealsDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtReportMealsDao.java index f3d4e6927..4e92f0135 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtReportMealsDao.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtReportMealsDao.java @@ -125,12 +125,14 @@ public class FtReportMealsDao implements Serializable { * 当前报餐总价 */ private BigDecimal totalPrice; - + private Boolean vegetables; - + private Boolean meat; - + private Boolean rice; - + private Integer egg; + + private Integer total; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtFoodDemandDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtFoodDemandDaoMapper.java index abd5776ad..5e89853f2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtFoodDemandDaoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtFoodDemandDaoMapper.java @@ -3,6 +3,7 @@ package com.ruoyi.system.fantang.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.system.fantang.domain.FtFoodDemandDao; import com.ruoyi.system.fantang.domain.FtOrderDao; +import com.ruoyi.system.fantang.domain.FtReportMealsDao; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -32,16 +33,29 @@ public interface FtFoodDemandDaoMapper extends BaseMapper { "\ta.type \n" + "FROM\n" + "\tft_report_meals a\n" + - "\tLEFT JOIN ft_food_demand b ON a.patient_id = b.patient_id\n" + "\tLEFT JOIN ft_patient c ON a.patient_id = c.patient_id\n" + "\tLEFT JOIN ft_depart d ON c.depart_id = d.depart_id \n" + "WHERE\n" + - "\tb.flag = 1 \n" + - "\tAND a.type = b.type \n" + - "\tAND c.depart_id = d.depart_id and a.create_at BETWEEN #{start} and #{end}\n" + + "\tc.depart_id = d.depart_id and a.create_at BETWEEN #{start} and #{end}\n" + "\t\n" + "GROUP BY\n" + "\td.depart_name,\n" + "\ta.type") List getStatisticsOfDate(@Param("start") String start, @Param("end") String end); + + @Select("SELECT\n" + + "\ta.type,\n" + + "\tc.depart_name,\n" + + "\tCOUNT(*) AS total \n" + + "FROM\n" + + "\tft_food_demand a\n" + + "\tLEFT JOIN ft_patient b ON b.patient_id = a.patient_id\n" + + "\tLEFT JOIN ft_depart c ON c.depart_id = b.depart_id \n" + + "WHERE\n" + + "\tb.depart_id = c.depart_id \n" + + "\tAND flag = 1 \n" + + "GROUP BY\n" + + "\ta.type,\n" + + "\tc.depart_name") + List getStatisticsFoodDemand(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtFoodDemandDaoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtFoodDemandDaoService.java index cc4fbc6b1..8bdd9e8a2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtFoodDemandDaoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtFoodDemandDaoService.java @@ -3,6 +3,7 @@ package com.ruoyi.system.fantang.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.system.fantang.domain.FtFoodDemandDao; import com.ruoyi.system.fantang.domain.FtOrderDao; +import com.ruoyi.system.fantang.domain.FtReportMealsDao; import java.util.Date; import java.util.List; @@ -27,4 +28,6 @@ public interface IFtFoodDemandDaoService extends IService { List getStatisticsOfWeek(Date day); List getStatisticsOfMonth(Date day); + + List getStatisticsFoodDemand(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtFoodDemandDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtFoodDemandDaoServiceImpl.java index 3090e5899..61c6d391b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtFoodDemandDaoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtFoodDemandDaoServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.fantang.domain.FtFoodDemandDao; import com.ruoyi.system.fantang.domain.FtOrderDao; +import com.ruoyi.system.fantang.domain.FtReportMealsDao; import com.ruoyi.system.fantang.mapper.FtFoodDemandDaoMapper; import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService; import org.springframework.stereotype.Service; @@ -60,4 +61,9 @@ public class FtFoodDemandDaoServiceImpl extends ServiceImpl getStatisticsOfMonth(Date day) { return this.baseMapper.getStatisticsOfDate(DateUtil.beginOfMonth(day).toString(), DateUtil.endOfMonth(day).toString()); } + + @Override + public List getStatisticsFoodDemand() { + return this.baseMapper.getStatisticsFoodDemand(); + } }