From 473ccef00857b623821d6f1ec53ba89c6c81b7a2 Mon Sep 17 00:00:00 2001
From: xiezhijun <15270898033@163.com>
Date: Mon, 22 Feb 2021 19:30:33 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E9=A3=9F=E8=AE=A1=E7=AE=97=E5=99=A8?=
 =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E8=90=A5=E5=85=BB=E6=88=90=E5=88=86?=
 =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E7=83=AD=E9=87=8F=E6=AF=94=E4=BE=8B=E6=95=B0?=
 =?UTF-8?q?=E6=8D=AE=E8=AE=A1=E7=AE=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/stdiet/common/utils/HealthyUtils.java | 131 +++++++++++++++++-
 .../com/stdiet/common/utils/NumberUtils.java  |  17 +++
 .../domain/SysCustomerHeatStatistics.java     |   9 ++
 .../custom/domain/SysFoodHeatStatistics.java  |  12 ++
 .../dto/response/NutritionalCalories.java     |  72 ++++++++++
 .../SysCustomerHeatStatisticsMapper.java      |   3 +
 .../ISysCustomerHeatStatisticsService.java    |  15 ++
 .../SysCustomerHeatStatisticsServiceImpl.java |  84 +++++++++--
 .../SysFoodHeatStatisticsServiceImpl.java     |  98 +++++++++----
 .../SysCustomerHeatStatisticsMapper.xml       |   5 +-
 .../custom/SysFoodHeatStatisticsMapper.xml    |  16 ++-
 .../HeatStatisticsCalculate/index.vue         |  39 ++++--
 .../components/HeatStatisticsDrawer/index.vue |   2 +-
 .../foodHeatStatistics/investigate/index.vue  |  39 ++++--
 14 files changed, 477 insertions(+), 65 deletions(-)
 create mode 100644 stdiet-common/src/main/java/com/stdiet/common/utils/NumberUtils.java
 create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalCalories.java

diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/HealthyUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/HealthyUtils.java
index e9e07cf79..baff6a9a5 100644
--- a/stdiet-common/src/main/java/com/stdiet/common/utils/HealthyUtils.java
+++ b/stdiet-common/src/main/java/com/stdiet/common/utils/HealthyUtils.java
@@ -2,10 +2,22 @@ package com.stdiet.common.utils;
 
 public class HealthyUtils {
 
-    public static final double maxHeatEveryDayLess = 250.0;
+    public static final long maxHeatEveryDayLess = 250;
+
+    //每克蛋白质对应热量(千卡)
+    public static final int proteinHeat = 4;
+
+    //每克脂肪对应热量(千卡)
+    public static final int fatHeat = 9;
+
+    //每克碳水对应热量(千卡)
+    public static final int carbonWaterHeat = 4;
+
+    //营养成分比例
+    public static final Integer[] nutritionRate = {30, 20, 50};
 
     /**
-     * 计算每天最大摄入量
+     * 计算减脂每天最大摄入量(千卡)
      * @param age 年龄
      * @param tall 身高
      * @param weight 体重
@@ -15,6 +27,119 @@ public class HealthyUtils {
         age = age == null ? 0 : age;
         tall = tall == null ? 0 : tall;
         weight = weight == null ? 0.0 : weight;
-        return Math.round(655+(9.5*weight/2)+(1.8*tall)-(4.7*age) - maxHeatEveryDayLess);
+        return calculateMetabolizeHeat(age, tall, weight) - maxHeatEveryDayLess;
     }
+
+    /**
+     * 计算基础代谢BMR(千卡)
+     * @param age
+     * @param tall
+     * @param weight
+     * @return
+     */
+    public static Long calculateMetabolizeHeat(Integer age, Integer tall, Double weight){
+        return Math.round(655+(9.5*weight/2)+(1.8*tall)-(4.7*age));
+    }
+
+    /**
+     * 计算每公斤体重占比(千卡/公斤)
+     * @param metabolizeHeat 基础代谢BMR(千卡)
+     * @param weight 体重(斤)
+     * @return
+     */
+    public static double calculateHeatRateByWeight(long metabolizeHeat, double weight){
+        return NumberUtils.getNumberByRoundHalfUp(metabolizeHeat/weight*2, 2).doubleValue();
+    }
+
+    /**
+     * 计算每公斤体重占比目标范围
+     * @param heatRateByWeight 每公斤体重占比(千卡/公斤)
+     * @return
+     */
+    public static double[] calculateHeatTargetRate(double heatRateByWeight){
+        double[] heatArray = new double[2];
+        heatArray[0] = heatRateByWeight - 10;
+        heatArray[1] = heatRateByWeight - 5;
+        return heatArray;
+    }
+
+    /**
+     * 计算减脂热量控制范围(千卡)
+     * @param heatTargetRateArray 每公斤体重占比目标范围
+     * @param fatRateWeight 每公斤体重脂肪占比(克/公斤)
+     * @return
+     */
+    public static long[] calculateStandardHeatScopeRate(double[] heatTargetRateArray, double fatRateWeight){
+        long[] heatArray = new long[2];
+        heatArray[0] = Math.round(heatTargetRateArray[0] * fatRateWeight / 2);
+        heatArray[1] = Math.round(heatTargetRateArray[1] * fatRateWeight / 2);
+        return heatArray;
+    }
+
+
+    /**
+     * 根据蛋白质、脂肪、碳水质量计算热量
+     * @param proteinQuality 蛋白质质量(克)
+     * @param fatQuality 脂肪质量(克)
+     * @param carbonWaterQuality 碳水质量(克)
+     * @return
+     */
+    public static int calculateTotalHeatByProteinFatCarbonWater(Integer proteinQuality, Integer fatQuality, Integer carbonWaterQuality){
+        return calculateHeatByProteinQuality(proteinQuality) + calculateHeatByFatQuality(fatQuality) + calculateHeatByCarbonWaterQuality(carbonWaterQuality);
+    }
+
+    /**
+     * 根据蛋白质质量计算热量
+     * @return
+     */
+    public static int calculateHeatByProteinQuality(Integer proteinQuality){
+        proteinQuality = proteinQuality == null ? 0 : proteinQuality;
+        return proteinQuality * proteinHeat;
+    }
+
+    /**
+     * 根据脂肪质量计算热量
+     * @return
+     */
+    public static int calculateHeatByFatQuality(Integer fatQuality){
+        fatQuality = fatQuality == null ? 0 : fatQuality;
+        return fatQuality * fatHeat;
+    }
+
+    /**
+     * 根据碳水质量计算热量
+     * @return
+     */
+    public static int calculateHeatByCarbonWaterQuality(Integer carbonWaterQuality){
+        carbonWaterQuality = carbonWaterQuality == null ? 0 : carbonWaterQuality;
+        return carbonWaterQuality * carbonWaterHeat;
+    }
+
+    /**
+     * 根据身高计算标准体重
+     * @param tall 身高(厘米)
+     * @return
+     */
+    public static double calculateStandardWeight(int tall){
+        return (tall-107.5)*2;
+    }
+
+    /**
+     * 返回蛋白质、脂肪、碳水对应热量、质量
+     * @param metabolizeHeat
+     * @return
+     */
+    public static Integer[][] calculateNutritionHeatAndQuality(int metabolizeHeat){
+        Integer[] heatArray = new Integer[3];
+        Integer[] qualityArray = new Integer[3];
+       heatArray[0] = Math.round(nutritionRate[0] * metabolizeHeat /100);
+       heatArray[1] = Math.round(nutritionRate[1] * metabolizeHeat /100);
+       heatArray[2] = Math.round(nutritionRate[2] * metabolizeHeat /100);
+       qualityArray[0] = (int)Math.round(Double.parseDouble(heatArray[0]+"")/proteinHeat);
+       qualityArray[1] = (int)Math.round(Double.parseDouble(heatArray[1]+"")/fatHeat);
+       qualityArray[2] = (int)Math.round(Double.parseDouble(heatArray[2]+"")/carbonWaterHeat);
+       Integer[][] result = {heatArray, qualityArray};
+       return result;
+    }
+
 }
diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/NumberUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/NumberUtils.java
new file mode 100644
index 000000000..e89ec6e59
--- /dev/null
+++ b/stdiet-common/src/main/java/com/stdiet/common/utils/NumberUtils.java
@@ -0,0 +1,17 @@
+package com.stdiet.common.utils;
+
+import java.math.BigDecimal;
+
+public class NumberUtils {
+
+    /**
+     * 对double数字进行四舍五入,返回BigDecimal
+     * @param number 数字
+     * @param decimalPlaces 保留的小数点位数
+     * @return
+     */
+    public static BigDecimal getNumberByRoundHalfUp(double number, int decimalPlaces){
+        return BigDecimal.valueOf(number).setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP);
+    }
+
+}
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHeatStatistics.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHeatStatistics.java
index 003594e16..1827dfbf6 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHeatStatistics.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHeatStatistics.java
@@ -52,6 +52,15 @@ public class SysCustomerHeatStatistics extends BaseEntity
     //食材热量
     private Integer[] foodHeatList;
 
+    //食材蛋白质质量
+    private Integer[] proteinQualityList;
+
+    //食材脂肪质量
+    private Integer[] fatQualityList;
+
+    //食材碳水质量
+    private Integer[] carbonWaterQualityList;
+
     //具体食材集合
     private List<SysFoodHeatStatistics> foodHeatStatisticsList;
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysFoodHeatStatistics.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysFoodHeatStatistics.java
index 4865b2317..973fb208f 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysFoodHeatStatistics.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysFoodHeatStatistics.java
@@ -44,6 +44,18 @@ public class SysFoodHeatStatistics extends BaseEntity
     @Excel(name = "类型,0早 1中 2晚")
     private Integer edibleType;
 
+    /** 蛋白质质量,克 */
+    @Excel(name = "蛋白质质量,克")
+    private Integer proteinQuality;
+
+    /** 脂肪质量,克 */
+    @Excel(name = "脂肪质量,克")
+    private Integer fatQuality;
+
+    /** 碳水质量,克 */
+    @Excel(name = "碳水质量,克")
+    private Integer carbonWaterQuality;
+
     /** 热量数值 */
     @Excel(name = "热量数值")
     private Integer heatValue;
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalCalories.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalCalories.java
new file mode 100644
index 000000000..958e4e733
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/NutritionalCalories.java
@@ -0,0 +1,72 @@
+package com.stdiet.custom.dto.response;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class NutritionalCalories implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    //姓名
+    public String name;
+
+    //实际体重(斤)
+    public double weight;
+
+    //实际身高(厘米)
+    public int tall;
+
+    //年龄
+    public int age;
+
+    //标准体重(斤)
+    public double standardWeight;
+
+    //超重(斤)
+    public double overWeight;
+
+    //活动因子
+    public double activityFactor;
+
+    //基础代谢BMR(千卡)
+    public int metabolizeHeat;
+
+    //减脂最大摄入量(千卡)
+    public int maxIntakeHeat;
+
+    //不运动总热量(千卡)
+    public int withoutExerciseHeat;
+
+    //运动总热量(千卡)
+    public int exerciseHeat;
+
+    //每公斤体重占比(千卡/公斤)
+    public double everyWeightHeat;
+
+    //目标范围(千卡/公斤)
+    public double[] targetEveryWeightHeat;
+
+    //减脂热量标准范围(千卡/公斤)
+    public double[] standardEveryWeightHeat;
+
+    //蛋白质、脂肪、碳水比例
+    public Integer[] nutritionalRate;
+
+    //蛋白质、脂肪、碳水对应热量(千卡)
+    public Integer[]  nutritionalHeat;
+
+    //蛋白质、脂肪、碳水对应质量(克)
+    public Integer[] nutritionalQuality;
+
+    //每公斤体重对应蛋白质、脂肪、碳水占比(克/公斤)
+    public double[] weightNutritionalRate;
+
+    //蛋白质、脂肪、碳水已摄入热量(千卡)
+    public Integer[] ingestedNutritionalHeat;
+
+    //蛋白质、脂肪、碳水剩余可摄入热量
+    public Integer[] surplusNutritionalHeat;
+
+}
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHeatStatisticsMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHeatStatisticsMapper.java
index a47ff33eb..336cd42dc 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHeatStatisticsMapper.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHeatStatisticsMapper.java
@@ -1,7 +1,10 @@
 package com.stdiet.custom.mapper;
 
 import java.util.List;
+
+import com.stdiet.custom.domain.SysCustomer;
 import com.stdiet.custom.domain.SysCustomerHeatStatistics;
+import com.stdiet.custom.dto.response.NutritionalCalories;
 
 /**
  * 外食热量统计Mapper接口
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHeatStatisticsService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHeatStatisticsService.java
index 007d85668..207a6b730 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHeatStatisticsService.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHeatStatisticsService.java
@@ -2,6 +2,7 @@ package com.stdiet.custom.service;
 
 import java.util.List;
 import com.stdiet.custom.domain.SysCustomerHeatStatistics;
+import com.stdiet.custom.dto.response.NutritionalCalories;
 
 /**
  * 外食热量统计Service接口
@@ -65,4 +66,18 @@ public interface ISysCustomerHeatStatisticsService
      * @return
      */
     public int calculateCustomerHeat(SysCustomerHeatStatistics sysCustomerHeatStatistics);
+
+    /**
+     * 根据日期查询是否客户热量统计
+     * @param sysCustomerHeatStatistics
+     * @return
+     */
+    SysCustomerHeatStatistics getCustomerHeatStatisticsByDate(SysCustomerHeatStatistics sysCustomerHeatStatistics);
+
+    /**
+     * 根据客户热量食材统计ID查询详情
+     * @param id
+     * @return
+     */
+    public NutritionalCalories getNutritionalCaloriesByCustomer(Long id);
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHeatStatisticsServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHeatStatisticsServiceImpl.java
index 3d26ebcd4..a0428ffec 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHeatStatisticsServiceImpl.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHeatStatisticsServiceImpl.java
@@ -1,14 +1,16 @@
 package com.stdiet.custom.service.impl;
 
+import java.math.BigDecimal;
 import java.util.List;
 import com.stdiet.common.utils.DateUtils;
 import com.stdiet.common.utils.HealthyUtils;
 import com.stdiet.custom.domain.SysCustomerHealthy;
 import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
 import com.stdiet.custom.domain.SysFoodHeatStatistics;
-import com.stdiet.custom.mapper.SysFoodHeatStatisticsMapper;
+import com.stdiet.custom.dto.response.NutritionalCalories;
 import com.stdiet.custom.service.ISysCustomerHealthyService;
 import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
+import com.stdiet.custom.service.ISysFoodHeatStatisticsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.stdiet.custom.mapper.SysCustomerHeatStatisticsMapper;
@@ -30,7 +32,7 @@ public class SysCustomerHeatStatisticsServiceImpl implements ISysCustomerHeatSta
     private SysCustomerHeatStatisticsMapper sysCustomerHeatStatisticsMapper;
 
     @Autowired
-    private SysFoodHeatStatisticsMapper sysFoodHeatStatisticsMapper;
+    private ISysFoodHeatStatisticsService sysFoodHeatStatisticsService;
 
     @Autowired
     private ISysCustomerPhysicalSignsService sysCustomerPhysicalSignsService;
@@ -112,6 +114,15 @@ public class SysCustomerHeatStatisticsServiceImpl implements ISysCustomerHeatSta
         return sysCustomerHeatStatisticsMapper.deleteSysCustomerHeatStatisticsById(id);
     }
 
+    /**
+     * 根据日期查询是否客户热量统计
+     * @param sysCustomerHeatStatistics
+     * @return
+     */
+    public SysCustomerHeatStatistics getCustomerHeatStatisticsByDate(SysCustomerHeatStatistics sysCustomerHeatStatistics){
+        return sysCustomerHeatStatisticsMapper.getCustomerHeatStatisticsByDate(sysCustomerHeatStatistics);
+    }
+
     /**
      * 更新食材热量并计算当天总热量
      * @param sysCustomerHeatStatistics
@@ -121,34 +132,81 @@ public class SysCustomerHeatStatisticsServiceImpl implements ISysCustomerHeatSta
     public int calculateCustomerHeat(SysCustomerHeatStatistics sysCustomerHeatStatistics){
         Long[] foodHeatId = sysCustomerHeatStatistics.getFoodHeatIdList();
         Integer[] foodHeat = sysCustomerHeatStatistics.getFoodHeatList();
-        if(foodHeatId != null && foodHeatId.length > 0 && foodHeat != null && foodHeat.length == foodHeatId.length){
+        if(foodHeatId != null && foodHeatId.length > 0){
             SysFoodHeatStatistics sysFoodHeatStatistics = new SysFoodHeatStatistics();
             int totalHeatCalue = 0;
             for (int i = 0; i < foodHeatId.length; i++) {
                 sysFoodHeatStatistics.setId(foodHeatId[i]);
-                sysFoodHeatStatistics.setHeatValue(foodHeat[i]);
-                sysFoodHeatStatisticsMapper.updateSysFoodHeatStatistics(sysFoodHeatStatistics);
-                totalHeatCalue += foodHeat[i];
+                sysFoodHeatStatistics.setProteinQuality(sysCustomerHeatStatistics.getProteinQualityList()[i]);
+                sysFoodHeatStatistics.setFatQuality(sysCustomerHeatStatistics.getFatQualityList()[i]);
+                sysFoodHeatStatistics.setCarbonWaterQuality(sysCustomerHeatStatistics.getCarbonWaterQualityList()[i]);
+                //根据蛋白质、脂肪、碳水计算热量
+                sysFoodHeatStatistics.setHeatValue(HealthyUtils.calculateTotalHeatByProteinFatCarbonWater(sysCustomerHeatStatistics.getProteinQualityList()[i],
+                        sysCustomerHeatStatistics.getFatQualityList()[i], sysCustomerHeatStatistics.getCarbonWaterQualityList()[i]));
+                sysFoodHeatStatisticsService.updateSysFoodHeatStatistics(sysFoodHeatStatistics);
+                totalHeatCalue += sysFoodHeatStatistics.getHeatValue();
             }
             sysCustomerHeatStatistics.setHeatValue(totalHeatCalue);
-            Long maxHeatValue = getMaxHeatValue(sysCustomerHeatStatistics.getCustomerId());
-            sysCustomerHeatStatistics.setMaxHeatValue(maxHeatValue.intValue());
-            sysCustomerHeatStatistics.setHeatGap(maxHeatValue.intValue() - totalHeatCalue);
+            sysCustomerHeatStatistics.setHeatGap(sysCustomerHeatStatistics.getMaxHeatValue() - totalHeatCalue);
             return sysCustomerHeatStatisticsMapper.updateSysCustomerHeatStatistics(sysCustomerHeatStatistics);
         }
         return 0;
     }
 
-    public long getMaxHeatValue(Long customerId){
+    /**
+     * 根据客户热量食材统计ID查询详情
+     * @param id
+     * @return
+     */
+    public NutritionalCalories getNutritionalCaloriesByCustomer(Long id){
+        NutritionalCalories nutritionalCalories = new NutritionalCalories();
+        SysCustomerHeatStatistics sysCustomerHeatStatistics = sysCustomerHeatStatisticsMapper.selectSysCustomerHeatStatisticsById(id);
+        if(sysCustomerHeatStatistics != null){
+            SysCustomerHealthy sysCustomerHealthy = getSysCustomerHealthy(sysCustomerHeatStatistics.getCustomerId());
+            if(sysCustomerHealthy != null){
+                nutritionalCalories.setName(sysCustomerHealthy.getName());
+                nutritionalCalories.setAge(sysCustomerHealthy.getAge().intValue());
+                nutritionalCalories.setTall(sysCustomerHealthy.getTall());
+                nutritionalCalories.setWeight(sysCustomerHealthy.getWeight().doubleValue());
+                nutritionalCalories.setStandardWeight(HealthyUtils.calculateStandardWeight(nutritionalCalories.getTall()));
+                double overHeight = nutritionalCalories.getWeight() - nutritionalCalories.getStandardWeight();
+                overHeight = overHeight > 0 ? overHeight : 0;
+                nutritionalCalories.setOverWeight(overHeight);
+                nutritionalCalories.setMetabolizeHeat(HealthyUtils.calculateMetabolizeHeat(nutritionalCalories.getAge(), nutritionalCalories.getTall(), nutritionalCalories.getWeight()).intValue());
+                nutritionalCalories.setMaxIntakeHeat(sysCustomerHeatStatistics.getMaxHeatValue());
+                nutritionalCalories.setEveryWeightHeat(HealthyUtils.calculateHeatRateByWeight(nutritionalCalories.getMetabolizeHeat(), nutritionalCalories.getWeight()));
+                nutritionalCalories.setTargetEveryWeightHeat(HealthyUtils.calculateHeatTargetRate(nutritionalCalories.getEveryWeightHeat()));
+                //nutritionalCalories.setStandardEveryWeightHeat(HealthyUtils.calculateHeatTargetRate() );
+                nutritionalCalories.setNutritionalRate(HealthyUtils.nutritionRate);
+                Integer[][] nutritionalHeatAndQuality = HealthyUtils.calculateNutritionHeatAndQuality(nutritionalCalories.getMetabolizeHeat());
+                nutritionalCalories.setNutritionalHeat(nutritionalHeatAndQuality[0]);
+                nutritionalCalories.setNutritionalQuality(nutritionalHeatAndQuality[1]);
+            }
+        }
+        return nutritionalCalories;
+    }
+
+    /**
+     * 根据用户ID查询该用户每天最大摄入量
+     * @param customerId
+     * @return
+     */
+    private SysCustomerHealthy getSysCustomerHealthy(Long customerId){
         SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(customerId);
         if(sysCustomerHealthy != null){
-            return HealthyUtils.calculateMaxHeatEveryDay(sysCustomerHealthy.getAge().intValue(),sysCustomerHealthy.getTall(),sysCustomerHealthy.getWeight().doubleValue());
+            return sysCustomerHealthy;
         }
         //查询体征信息
         SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(customerId);
         if(sysCustomerPhysicalSigns != null){
-            return HealthyUtils.calculateMaxHeatEveryDay(sysCustomerPhysicalSigns.getAge().intValue(),sysCustomerPhysicalSigns.getTall(),sysCustomerPhysicalSigns.getWeight().doubleValue());
+            sysCustomerHealthy = new SysCustomerHealthy();
+            sysCustomerHealthy.setName(sysCustomerPhysicalSigns.getName());
+            sysCustomerHealthy.setTall(sysCustomerPhysicalSigns.getTall());
+            sysCustomerHealthy.setAge(sysCustomerPhysicalSigns.getAge().longValue());
+            sysCustomerHealthy.setWeight(BigDecimal.valueOf(sysCustomerPhysicalSigns.getWeight()));
         }
-        return 0;
+        return sysCustomerHealthy;
     }
+
+
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysFoodHeatStatisticsServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysFoodHeatStatisticsServiceImpl.java
index 2129b7cda..e727ae8f2 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysFoodHeatStatisticsServiceImpl.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysFoodHeatStatisticsServiceImpl.java
@@ -1,17 +1,19 @@
 package com.stdiet.custom.service.impl;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 
 import com.alibaba.fastjson.JSON;
 import com.stdiet.common.utils.DateUtils;
+import com.stdiet.common.utils.HealthyUtils;
 import com.stdiet.common.utils.StringUtils;
 import com.stdiet.common.utils.sign.AesUtils;
+import com.stdiet.custom.domain.SysCustomerHealthy;
 import com.stdiet.custom.domain.SysCustomerHeatStatistics;
+import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
 import com.stdiet.custom.dto.request.FoodHeatCalculatorRequest;
-import com.stdiet.custom.mapper.SysCustomerHeatStatisticsMapper;
+import com.stdiet.custom.service.ISysCustomerHealthyService;
+import com.stdiet.custom.service.ISysCustomerHeatStatisticsService;
+import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.stdiet.custom.mapper.SysFoodHeatStatisticsMapper;
@@ -19,6 +21,8 @@ import com.stdiet.custom.domain.SysFoodHeatStatistics;
 import com.stdiet.custom.service.ISysFoodHeatStatisticsService;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.xml.crypto.Data;
+
 /**
  * 外食热量统计Service业务层处理
  *
@@ -33,7 +37,13 @@ public class SysFoodHeatStatisticsServiceImpl implements ISysFoodHeatStatisticsS
     private SysFoodHeatStatisticsMapper sysFoodHeatStatisticsMapper;
 
     @Autowired
-    private SysCustomerHeatStatisticsMapper sysCustomerHeatStatisticsMapper;
+    private ISysCustomerHeatStatisticsService sysCustomerHeatStatisticsService;
+
+    @Autowired
+    private ISysCustomerPhysicalSignsService sysCustomerPhysicalSignsService;
+
+    @Autowired
+    private ISysCustomerHealthyService sysCustomerHealthyService;
 
     /**
      * 查询外食热量统计
@@ -118,29 +128,67 @@ public class SysFoodHeatStatisticsServiceImpl implements ISysFoodHeatStatisticsS
     public int addMuchFoodHeat(FoodHeatCalculatorRequest foodHeatCalculatorRequest){
         //客户ID解密
         String customerId = StringUtils.isNotEmpty(foodHeatCalculatorRequest.getCustomerEncId()) ? AesUtils.decrypt(foodHeatCalculatorRequest.getCustomerEncId(), null) : "";
-        if(StringUtils.isEmpty(customerId)){
+        if(StringUtils.isEmpty(customerId) || StringUtils.isEmpty(foodHeatCalculatorRequest.getIngredientArray())){
             return 0;
         }
-        //先判断该日期下是否已存在
-        SysCustomerHeatStatistics sysCustomerHeatStatistics = new SysCustomerHeatStatistics();
-        sysCustomerHeatStatistics.setCustomerId(Long.parseLong(customerId));
-        sysCustomerHeatStatistics.setEdibleDate(new Date());
-        SysCustomerHeatStatistics customerHeatResult = sysCustomerHeatStatisticsMapper.getCustomerHeatStatisticsByDate(sysCustomerHeatStatistics);
-        if(customerHeatResult == null){
-            sysCustomerHeatStatisticsMapper.insertSysCustomerHeatStatistics(sysCustomerHeatStatistics);
-        }else{
-            sysCustomerHeatStatistics.setId(customerHeatResult.getId());
+        List<HashMap> foodHeatList = JSON.parseArray(foodHeatCalculatorRequest.getIngredientArray(), HashMap.class);
+        if(foodHeatList == null || foodHeatList.size() == 0){
+            return 0;
         }
-        if(sysCustomerHeatStatistics.getId() != null){
-            List<SysFoodHeatStatistics> list = new ArrayList<>();
-            if(StringUtils.isNotEmpty(foodHeatCalculatorRequest.getIngredientArray())){
-                List<HashMap> foodHeatList = JSON.parseArray(foodHeatCalculatorRequest.getIngredientArray(), HashMap.class);
-                for(HashMap map : foodHeatList){
-                    map.put("customerHeatId", sysCustomerHeatStatistics.getId());
-                }
-                return sysFoodHeatStatisticsMapper.insertFoodHeatBatch(foodHeatList);
+        Map<String, List<HashMap>> dateFoodMap = new HashMap<>();
+        //根据日期分类
+        for(HashMap map : foodHeatList){
+            String edibleDate = map.get("edibleDate").toString();
+            if(dateFoodMap.containsKey(edibleDate)){
+                dateFoodMap.get(edibleDate).add(map);
+            }else{
+                List<HashMap> list = new ArrayList<>();
+                list.add(map);
+                dateFoodMap.put(edibleDate, list);
             }
         }
-        return 0;
+        int row = 0;
+        int maxHeatValue = getMaxHeatValue(Long.parseLong(customerId)).intValue();
+        for (String dateKey : dateFoodMap.keySet()) {
+            //先判断该日期下是否已存在
+            SysCustomerHeatStatistics sysCustomerHeatStatistics = new SysCustomerHeatStatistics();
+            sysCustomerHeatStatistics.setCustomerId(Long.parseLong(customerId));
+            sysCustomerHeatStatistics.setEdibleDate(DateUtils.parseDate(dateKey));
+            SysCustomerHeatStatistics customerHeatResult = sysCustomerHeatStatisticsService.getCustomerHeatStatisticsByDate(sysCustomerHeatStatistics);
+            if(customerHeatResult == null){
+                sysCustomerHeatStatistics.setMaxHeatValue(maxHeatValue);
+                sysCustomerHeatStatisticsService.insertSysCustomerHeatStatistics(sysCustomerHeatStatistics);
+            }else{
+                sysCustomerHeatStatistics.setId(customerHeatResult.getId());
+            }
+            if(sysCustomerHeatStatistics.getId() != null){
+                for(HashMap map : dateFoodMap.get(dateKey)){
+                    map.put("customerHeatId", sysCustomerHeatStatistics.getId());
+                    map.put("number", map.get("number") != null && "".equals(map.get("number").toString().trim()) ? null : map.get("number"));
+                    map.put("unit", map.get("unit") != null && "".equals(map.get("unit").toString().trim()) ? null : map.get("unit"));
+                    map.put("quantity", map.get("quantity") != null && "".equals(map.get("quantity").toString().trim()) ? null : map.get("quantity"));
+                }
+                row = sysFoodHeatStatisticsMapper.insertFoodHeatBatch(dateFoodMap.get(dateKey));
+            }
+        }
+        return row;
+    }
+
+    /**
+     * 根据用户ID查询该用户每天最大摄入量
+     * @param customerId
+     * @return
+     */
+    private Long getMaxHeatValue(Long customerId){
+        SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(customerId);
+        if(sysCustomerHealthy != null){
+            return HealthyUtils.calculateMaxHeatEveryDay(sysCustomerHealthy.getAge().intValue(),sysCustomerHealthy.getTall(),sysCustomerHealthy.getWeight().doubleValue());
+        }
+        //查询体征信息
+        SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(customerId);
+        if(sysCustomerPhysicalSigns != null){
+            return HealthyUtils.calculateMaxHeatEveryDay(sysCustomerPhysicalSigns.getAge().intValue(),sysCustomerPhysicalSigns.getTall(),sysCustomerPhysicalSigns.getWeight().doubleValue());
+        }
+        return 0L;
     }
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHeatStatisticsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHeatStatisticsMapper.xml
index 671fac2c7..edb9d6ef8 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHeatStatisticsMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHeatStatisticsMapper.xml
@@ -124,7 +124,10 @@
         <result property="number"    column="number"    />
         <result property="quantity"    column="quantity"    />
         <result property="edibleType"    column="edible_type"    />
+        <result property="proteinQuality"    column="protein_quality"    />
         <result property="heatValue"    column="heat_value"    />
+        <result property="fatQuality"    column="fat_quality"    />
+        <result property="carbonWaterQuality"    column="carbon_water_quality"    />
         <result property="createTime"    column="create_time"    />
         <result property="createBy"    column="create_by"    />
         <result property="updateTime"    column="update_time"    />
@@ -135,7 +138,7 @@
     </resultMap>
 
     <select id="selectSysFoodHeatStatisticsList" parameterType="Long" resultMap="SysFoodHeatStatisticsResult">
-        select sfhs.id, sfhs.customer_heat_id, sfhs.ingredient, sfhs.unit, sfhs.number, sfhs.quantity, sfhs.edible_type, sfhs.heat_value,cusUnit.dict_label as unitName
+        select sfhs.id, sfhs.customer_heat_id, sfhs.ingredient, sfhs.unit, sfhs.number, sfhs.quantity, sfhs.edible_type, sfhs.protein_quality, sfhs.fat_quality, sfhs.carbon_water_quality,sfhs.heat_value,cusUnit.dict_label as unitName
         from sys_food_heat_statistics as  sfhs
         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_cus_unit') AS cusUnit ON cusUnit.dict_value = sfhs.unit
         where sfhs.del_flag = 0 and customer_heat_id = #{id}
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysFoodHeatStatisticsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysFoodHeatStatisticsMapper.xml
index 515d1a7d3..29ee0f101 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysFoodHeatStatisticsMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysFoodHeatStatisticsMapper.xml
@@ -12,7 +12,10 @@
         <result property="number"    column="number"    />
         <result property="quantity"    column="quantity"    />
         <result property="edibleType"    column="edible_type"    />
+        <result property="proteinQuality"    column="protein_quality"    />
         <result property="heatValue"    column="heat_value"    />
+        <result property="fatQuality"    column="fat_quality"    />
+        <result property="carbonWaterQuality"    column="carbon_water_quality"    />
         <result property="createTime"    column="create_time"    />
         <result property="createBy"    column="create_by"    />
         <result property="updateTime"    column="update_time"    />
@@ -23,11 +26,11 @@
     </resultMap>
 
     <sql id="selectSysFoodHeatStatisticsVo">
-        select id, customer_heat_id, ingredient, unit, number, quantity, edible_type, heat_value, create_time, create_by, update_time, update_by, del_flag from sys_food_heat_statistics
+        select id, customer_heat_id, ingredient, unit, number, quantity, edible_type, protein_quality, heat_value, fat_quality, carbon_water_quality,create_time, create_by, update_time, update_by, del_flag from sys_food_heat_statistics
     </sql>
 
     <select id="selectSysFoodHeatStatisticsList" parameterType="SysFoodHeatStatistics" resultMap="SysFoodHeatStatisticsResult">
-        select sfhs.id, sfhs.customer_heat_id, sfhs.ingredient, sfhs.unit, sfhs.number, sfhs.quantity, sfhs.edible_type, sfhs.heat_value,cusUnit.dict_label as unitName
+        select sfhs.id, sfhs.customer_heat_id, sfhs.ingredient, sfhs.unit, sfhs.number, sfhs.quantity, sfhs.edible_type, sfhs.protein_quality, sfhs.fat_quality, sfhs.carbon_water_quality,sfhs.heat_value,cusUnit.dict_label as unitName
         from sys_food_heat_statistics as  sfhs
         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_cus_unit') AS cusUnit ON cusUnit.dict_value = sfhs.unit
         where sfhs.del_flag = 0
@@ -47,7 +50,10 @@
             <if test="number != null">number,</if>
             <if test="quantity != null">quantity,</if>
             <if test="edibleType != null">edible_type,</if>
+            <if test="proteinQuality != null">protein_quality,</if>
             <if test="heatValue != null">heat_value,</if>
+            <if test="fatQuality != null">fat_quality,</if>
+            <if test="carbonWaterQuality != null">carbon_water_quality,</if>
             <if test="createTime != null">create_time,</if>
             <if test="createBy != null">create_by,</if>
             <if test="updateTime != null">update_time,</if>
@@ -61,7 +67,10 @@
             <if test="number != null">#{number},</if>
             <if test="quantity != null">#{quantity},</if>
             <if test="edibleType != null">#{edibleType},</if>
+            <if test="proteinQuality != null">#{proteinQuality},</if>
             <if test="heatValue != null">#{heatValue},</if>
+            <if test="fatQuality != null">#{fatQuality},</if>
+            <if test="carbonWaterQuality != null">#{carbonWaterQuality},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
@@ -79,7 +88,10 @@
             <if test="number != null">number = #{number},</if>
             <if test="quantity != null">quantity = #{quantity},</if>
             <if test="edibleType != null">edible_type = #{edibleType},</if>
+            <if test="proteinQuality != null">protein_quality = #{proteinQuality},</if>
             <if test="heatValue != null">heat_value = #{heatValue},</if>
+            <if test="fatQuality != null">fat_quality = #{fatQuality},</if>
+            <if test="carbonWaterQuality != null">carbon_water_quality = #{carbonWaterQuality},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
diff --git a/stdiet-ui/src/components/HeatStatisticsCalculate/index.vue b/stdiet-ui/src/components/HeatStatisticsCalculate/index.vue
index ce2147a34..f26041425 100644
--- a/stdiet-ui/src/components/HeatStatisticsCalculate/index.vue
+++ b/stdiet-ui/src/components/HeatStatisticsCalculate/index.vue
@@ -1,13 +1,18 @@
 <template>
   <!-- 计算食材热量对话框 -->
-  <el-dialog :title="title" :visible.sync="open" width="750px" append-to-body>
+  <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
     <el-form ref="form" :model="form" label-position="top" :rules="rules" label-width="100px">
 
       <el-form-item v-for="(item,index) in foodHeatList" label="" class="margin-left">
         <div>
-          <span>食材名称:</span><el-input style="width:30%" placeholder="" :readonly="true" :value="item.ingredient"/>
-          <span style="margin-left: 10px">份量:</span><el-input style="width:25%" placeholder="" :readonly="true"  :value="getNumberString(item)"/>
-          <span style="margin-left: 10px">热量:</span><el-input style="width:15%" type="number" placeholder="" v-model="item.heatValue"/><span>千卡</span>
+          <span>食材名称:</span><el-input style="width:20%" placeholder="" :readonly="true" :value="item.ingredient"/>
+          <span style="margin-left: 10px">份量:</span><el-input style="width:20%" placeholder="" :readonly="true"  :value="getNumberString(item)"/>
+          <!--<span style="margin-left: 10px">热量:</span><el-input style="width:15%" type="number" placeholder="" v-model="item.heatValue"/><span>千卡</span>-->
+          <span style="margin-left: 10px">蛋白质/脂肪/碳水:</span>
+          <el-input style="width:10%" placeholder="" v-model="item.proteinQuality"/>
+          <el-input style="width:10%;margin-left: 5px" placeholder="" v-model="item.fatQuality"/>
+          <el-input style="width:10%;margin-left: 5px" placeholder="" v-model="item.carbonWaterQuality"/>
+          <span style="margin-left: 5px">克</span>
         </div>
       </el-form-item>
     </el-form>
@@ -29,6 +34,7 @@
     },
     props: {},
     data() {
+
       return {
         // 弹出层标题
         title: "",
@@ -62,7 +68,7 @@
         getFoodHeatStatistics(id).then((response) => {
            //let contractDetail = response.data;
             this.heatData = response.data;
-           this.foodHeatList = response.data.foodHeatStatisticsList != null ? response.data.foodHeatStatisticsList : [];
+            this.foodHeatList = response.data.foodHeatStatisticsList != null ? response.data.foodHeatStatisticsList : [];
         });
       },
       getNumberString(foodData){
@@ -87,23 +93,34 @@
       },
       /** 提交按钮 */
       submitForm() {
+        var reg = /^([1-9]\d*|[0]{1,1})$/;
         if(this.foodHeatList.length == 0){
            return;
         }
         let obj = {};
-        obj.foodHeatIdList = [];
-        obj.foodHeatList = [];
         obj.id = this.heatData.id;
         obj.customerId = this.heatData.customerId;
+        obj.maxHeatValue = this.heatData.maxHeatValue;
+        obj.foodHeatIdList = [];
+        obj.proteinQualityList = [];
+        obj.fatQualityList = [];
+        obj.carbonWaterQualityList = [];
+        let verifyFlag = true;
         this.foodHeatList.forEach((item,index) => {
           obj.foodHeatIdList.push(item.id);
-          if(!/^[1-9]\d*$/.test(item.heatValue)){
-            obj.foodHeatList.push(0);
+          if(!reg.test(item.proteinQuality) || !reg.test(item.fatQuality) || !reg.test(item.carbonWaterQuality)){
+              verifyFlag = false;
           }else{
-            obj.foodHeatList.push(item.heatValue);
+            obj.proteinQualityList.push(item.proteinQuality);
+            obj.fatQualityList.push(item.fatQuality);
+            obj.carbonWaterQualityList.push(item.carbonWaterQuality);
           }
         });
-        console.log(obj.foodHeatIdList.length);
+        if(!verifyFlag){
+          this.$message({message: "填写的数值格式错误", type: "warning"});
+          return;
+        }
+        //console.log(obj.foodHeatIdList.length);
         addFoodHeatData(obj).then(response => {
           if (response.code === 200) {
             this.msgSuccess("提交成功");
diff --git a/stdiet-ui/src/components/HeatStatisticsDrawer/index.vue b/stdiet-ui/src/components/HeatStatisticsDrawer/index.vue
index 708777aae..e28b1e55c 100644
--- a/stdiet-ui/src/components/HeatStatisticsDrawer/index.vue
+++ b/stdiet-ui/src/components/HeatStatisticsDrawer/index.vue
@@ -27,7 +27,7 @@
           </el-table-column>
           <el-table-column label="质量(克)" align="center" prop="quantity" />-->
 
-          <el-table-column label="最大摄入量" align="center" prop="maxHeatValue" />
+          <el-table-column label="可摄入量" align="center" prop="maxHeatValue" />
           <el-table-column label="食材热量" align="center" prop="heatValue" />
           <el-table-column label="热量缺口" align="center" prop="heatGap" />
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
diff --git a/stdiet-ui/src/views/custom/foodHeatStatistics/investigate/index.vue b/stdiet-ui/src/views/custom/foodHeatStatistics/investigate/index.vue
index 78f2f96bb..4694bf971 100644
--- a/stdiet-ui/src/views/custom/foodHeatStatistics/investigate/index.vue
+++ b/stdiet-ui/src/views/custom/foodHeatStatistics/investigate/index.vue
@@ -35,6 +35,16 @@
           </el-tag>
         </el-form-item>
         <div>
+          <el-form-item label="日期" prop="edibleDate">
+          <el-date-picker
+            v-model="form.edibleDate"
+            type="date"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+            :picker-options="pickerOptions"
+            placeholder="选择日期">
+          </el-date-picker>
+          </el-form-item>
           <el-form-item label="食材名称" prop="ingredient">
             <el-input v-model="form.ingredient"  placeholder="请输入食材名称" maxlength="20"/>
           </el-form-item>
@@ -64,6 +74,8 @@
 </template>
 <script>
   import { getDictData,getCustomerBaseMessage,addFoodHeatStatistics } from "@/api/custom/customerInvestigation";
+  import dayjs from "dayjs";
+  const nowDate = dayjs().format("YYYY-MM-DD");
   const logo = require("@/assets/logo/st_logo.png");
   export default {
     name: "index",
@@ -93,6 +105,7 @@
            phone: null
         },
         form: {
+          edibleDate: nowDate,
           ingredient: null,
           number: null,
           unit: null,
@@ -100,9 +113,7 @@
         },
         rules: {
           ingredient: [{ required: true, trigger: "blur", message: "请输入食材名称" }],
-          /*numberUnit: [
-            { required: false, trigger: "blur", validator: checkNumberUnit }
-          ],*/
+          edibleDate: [{ required: true, trigger: "blur", message: "请选择日期" }]
         },
         ingredientTagArray:[
 
@@ -111,7 +122,12 @@
 
         ],
         //通俗计量单位
-        cusUnitOptions:[]
+        cusUnitOptions:[],
+        pickerOptions: {
+          disabledDate(time) {
+            return time.getTime() > Date.now();
+          },
+        },
       };
     },
     components: {
@@ -158,8 +174,9 @@
         });
       },
       verify(){
+        var reg = /^([1-9]\d*|[0]{1,1})$/;
         if(this.form.number != null && this.form.number != ""){
-           if(!/^[1-9]\d*$/.test(this.form.number+"")){
+           if(!reg.test(this.form.number+"")){
              this.$message({message: "通俗计量的数量格式错误", type: "warning"});
              return false;
            }
@@ -168,7 +185,7 @@
              return false;
            }
         }
-        if(this.form.quantity != null && this.form.quantity != "" && !/^[1-9]\d*$/.test(this.form.quantity)){
+        if(this.form.quantity != null && this.form.quantity != "" && !reg.test(this.form.quantity)){
           this.$message({message: "重量格式错误", type: "warning"});
           return false;
         }
@@ -180,6 +197,7 @@
       },
       reset(){
          this.form = {
+           edibleDate: nowDate,
            ingredient: null,
            number: null,
            unit: null,
@@ -192,13 +210,15 @@
       submit(){
         if (this.submitFlag) {
           this.$message({
-            message: "请勿频繁提交,1分钟后重试",
+            message: "请勿频繁提交,一分钟后重试",
             type: "warning",
           });
           return;
         }
-        this.timer = setTimeout(this.againSumbit,1000*60);
-        if(this.form.ingredient && this.verify() && this.ingredientTagArray.indexOf(this.form.ingredient.trim()) == -1){
+        if(this.form.ingredient && this.ingredientTagArray.indexOf(this.form.ingredient.trim()) == -1){
+          if(!this.verify()){
+            return;
+          }
           this.ingredientArray.push(this.form);
           this.ingredientTagArray.push(this.form.ingredient);
           this.reset();
@@ -207,6 +227,7 @@
           this.$message({message: "还未添加食材数据,无法提交", type: "warning"});
           return;
         }
+        this.timer = setTimeout(this.againSumbit,1000*60);
         let submitObject = {};
         submitObject.ingredientArray = JSON.stringify(this.ingredientArray);
         submitObject.customerEncId = this.customer.customerEncId;