外食计算器优化,营养成分以及热量比例数据计算
This commit is contained in:
@ -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;
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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接口
|
||||
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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}
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user