diff --git a/running/pdf/healthyReport.pdf b/running/pdf/healthyReport.pdf new file mode 100644 index 000000000..bd2295f14 Binary files /dev/null and b/running/pdf/healthyReport.pdf differ diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java index b23ec1bab..1d9c91beb 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java @@ -3,6 +3,7 @@ package com.stdiet.custom.controller; import java.util.List; import com.stdiet.common.utils.StringUtils; +import com.stdiet.custom.dto.request.HealthyDetailRequest; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -109,4 +110,14 @@ public class SysCustomerHealthyController extends BaseController { return toAjax(sysCustomerHealthyService.deleteSysCustomerHealthyByIds(ids)); } + + /** + * 生成健康体征报告 + */ + @Log(title = "健康体征报告", businessType = BusinessType.INSERT) + @PostMapping("/generateHealthyReport") + public AjaxResult generateHealthyReport(@RequestBody HealthyDetailRequest healthyDetailRequest) + { + return sysCustomerHealthyService.generateHealthyReport(healthyDetailRequest); + } } \ No newline at end of file diff --git a/stdiet-common/src/main/java/com/stdiet/common/core/domain/entity/SysDictData.java b/stdiet-common/src/main/java/com/stdiet/common/core/domain/entity/SysDictData.java index 891da5078..87fdda38f 100644 --- a/stdiet-common/src/main/java/com/stdiet/common/core/domain/entity/SysDictData.java +++ b/stdiet-common/src/main/java/com/stdiet/common/core/domain/entity/SysDictData.java @@ -9,6 +9,8 @@ import com.stdiet.common.annotation.Excel.ColumnType; import com.stdiet.common.constant.UserConstants; import com.stdiet.common.core.domain.BaseEntity; +import java.util.List; + /** * 字典数据表 sys_dict_data * @@ -34,8 +36,10 @@ public class SysDictData extends BaseEntity @Excel(name = "字典键值") private String dictValue; - /** 字典类型 */ - @Excel(name = "字典类型") + private List dictValueList; + + /** 字典类型 */ + @Excel(name = "字典类型") private String dictType; /** 样式属性(其他样式扩展) */ @@ -153,7 +157,15 @@ public class SysDictData extends BaseEntity { this.status = status; } - + + public List getDictValueList() { + return dictValueList; + } + + public void setDictValueList(List dictValueList) { + this.dictValueList = dictValueList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 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 9f19c3fbe..3f18008a0 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 @@ -16,6 +16,9 @@ public class HealthyUtils { //营养成分比例 public static final Integer[] nutritionRate = {30, 20, 50}; + //默认活动因子 + public static final double activityFactor = 0.3; + /** * 计算减脂每天最大摄入量(千卡) * @param age 年龄 @@ -148,7 +151,7 @@ public class HealthyUtils { * @param weight 体重 * @return */ - public static final Double[] calculateNutritionEveryWeight(Integer[] nutritionQuality, double weight){ + public static Double[] calculateNutritionEveryWeight(Integer[] nutritionQuality, double weight){ Double[] nutritionEveryWeight = new Double[3]; nutritionEveryWeight[0] = NumberUtils.getNumberByRoundHalfUp(nutritionQuality[0]/weight*2,2).doubleValue(); nutritionEveryWeight[1] = NumberUtils.getNumberByRoundHalfUp(nutritionQuality[1]/weight*2,2).doubleValue(); @@ -156,5 +159,19 @@ public class HealthyUtils { return nutritionEveryWeight; } + /** + * 计算不运动热量、运动热量 + * @param metabolizeHeat + * @return + */ + public static Long[] calculateWithoutExerciseHeat(Integer metabolizeHeat){ + Long[] array = new Long[2]; + //不运动热量 + array[0] = Math.round(metabolizeHeat * (1 + activityFactor)); + //运动热量 + array[1] = Math.round(metabolizeHeat * (1 + 0.8)); + return array; + } + } diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/reflect/ReflectUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/reflect/ReflectUtils.java index 57559f1c1..b8cd10e16 100644 --- a/stdiet-common/src/main/java/com/stdiet/common/utils/reflect/ReflectUtils.java +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/reflect/ReflectUtils.java @@ -403,4 +403,22 @@ public class ReflectUtils } return new RuntimeException(msg, e); } + + /** + * 根据属性名获取属性值 + * + * @param fieldName + * @param object + * @return + */ + public static String getFieldValueByFieldName(String fieldName, Object object) { + try { + Field field = object.getClass().getDeclaredField(fieldName); + //设置对象的访问权限,保证对private的属性的访问 + field.setAccessible(true); + return field.get(object) == null ? "" : field.get(object).toString(); + } catch (Exception e) { + return ""; + } + } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHealthy.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHealthy.java index 21052d9f8..1b2bb182e 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHealthy.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHealthy.java @@ -433,6 +433,9 @@ public class SysCustomerHealthy extends BaseEntity //备注 private String remark; + /** 减脂指导 */ + private String guidance; + /** 湿气数据 */ @Excel(name = "湿气数据") private String moistureDate; diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/request/HealthyDetailRequest.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/request/HealthyDetailRequest.java new file mode 100644 index 000000000..afab4aba9 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/request/HealthyDetailRequest.java @@ -0,0 +1,396 @@ +package com.stdiet.custom.dto.request; + +import com.stdiet.common.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class HealthyDetailRequest implements Serializable { + + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 客户ID */ + private Long customerId; + + /** 加密的客户ID,非持久化字段 **/ + private String customerEncId; + + /** 客户姓名,非持久化字段 */ + @Excel(name = "客户姓名") + private String name; + + /** 客户手机号,非持久化字段 */ + @Excel(name = "客户手机号") + private String phone; + + /** 调理项目id */ + //@Excel(name = "调理项目id") + private String conditioningProjectId; + + /** 调理项目名称 ,非持久化字段*/ + @Excel(name = "调理项目") + private String conditioningProject; + + /** 0男 1女 2未知,默认2 */ + @Excel(name = "0男 1女 2未知,默认2") + private String sex; + + /** 年龄 */ + @Excel(name = "年龄") + private String age; + + /** 身高 */ + @Excel(name = "身高") + private String tall; + + /** 体重 */ + @Excel(name = "体重") + private String weight; + + /** 调味品种类,使用 , 隔开 */ + @Excel(name = "调味品种类,使用 , 隔开") + private String condiment; + + /** 其他调味品种类 */ + @Excel(name = "其他调味品种类") + private String otherCondiment; + + /** 喜好的烹调方式,使用 , 隔开 */ + @Excel(name = "喜好的烹调方式,使用 , 隔开") + private String cookingStyle; + + /** 烹调方式对应频次,每周几次,使用 , 隔开 */ + @Excel(name = "烹调方式对应频次,每周几次,使用 , 隔开") + private String cookingStyleRate; + + /** 洗菜方式,使用 , 隔开 */ + @Excel(name = "洗菜方式,使用 , 隔开") + private String washVegetablesStyle; + + /** 其他洗菜方式 */ + @Excel(name = "其他洗菜方式") + private String otherWashVegetablesStyle; + + /** 早餐习惯 */ + @Excel(name = "早餐习惯") + private String breakfastType; + + /** 早餐吃的食物 */ + @Excel(name = "早餐吃的食物") + private String breakfastFood; + + /** 午餐习惯,使用 , 隔开 */ + @Excel(name = "午餐习惯,使用 , 隔开") + private String lunchType; + + /** 晚餐习惯,使用 , 隔开 */ + @Excel(name = "晚餐习惯,使用 , 隔开") + private String dinner; + + /** 早餐当中素菜占比 */ + @Excel(name = "早餐当中素菜占比") + private String vegetableRate; + + /** 最常吃的肉类 */ + @Excel(name = "最常吃的肉类") + private String commonMeat; + + /** 晚餐时间(24小时制) */ + @Excel(name = "晚餐时间", readConverterExp = "2=4小时制") + private String dinnerTime; + + /** 每周吃夜宵次数,默认0 */ + @Excel(name = "每周吃夜宵次数,默认0") + private String supperNum; + + /** 夜宵通常吃的食物 */ + @Excel(name = "夜宵通常吃的食物") + private String supperFood; + + /** 食物的冷热偏好 */ + @Excel(name = "食物的冷热偏好") + private String dietHotAndCold; + + /** 食物的口味偏好,使用 , 隔开 */ + @Excel(name = "食物的口味偏好,使用 , 隔开") + private String dietFlavor; + + /** 平均每周吃生菜几次 */ + @Excel(name = "平均每周吃生菜几次") + private String vegetablesNum; + + /** 每周吃生菜的频次类型 */ + @Excel(name = "每周吃生菜的频次类型") + private String vegetablesRateType; + + /** 平均每天吃水果次数,默认0 */ + @Excel(name = "平均每天吃水果次数,默认0") + private String fruitsNum; + + /** 吃水果的时间段 */ + @Excel(name = "吃水果的时间段") + private String fruitsTime; + + /** 平时吃水果的频次 */ + @Excel(name = "平时吃水果的频次") + private String fruitsRate; + + /** 一餐吃几碗饭 */ + @Excel(name = "一餐吃几碗饭") + private String riceNum; + + /** 吃几成饱 */ + @Excel(name = "吃几成饱") + private String riceFull; + + /** 吃饭速度 */ + @Excel(name = "吃饭速度") + private String eatingSpeed; + + /** 常吃的零食,使用 , 隔开 */ + @Excel(name = "常吃的零食,使用 , 隔开") + private String snacks; + + /** 其他零食 */ + @Excel(name = "其他零食") + private String otherSnacks; + + /** 有无服用营养保健品,0无 1有 */ + @Excel(name = "有无服用营养保健品,0无 1有") + private String healthProductsFlag; + + /** 营养保健品品牌名 */ + @Excel(name = "营养保健品品牌名") + private String healthProductsBrand; + + /** 营养保健品产品名 */ + @Excel(name = "营养保健品产品名") + private String healthProductsName; + + /** 服用营养保健品频次,每周几次 */ + @Excel(name = "服用营养保健品频次,每周几次") + private String healthProductsWeekRate; + + /** 服用营养保健品频次,每天几次 */ + @Excel(name = "服用营养保健品频次,每天几次") + private String healthProductsDayRate; + + /** 每天的饮水量,单位:毫升 */ + @Excel(name = "每天的饮水量,单位:毫升") + private String waterNum; + + /** 喜欢喝什么水,使用 , 隔开 */ + @Excel(name = "喜欢喝什么水,使用 , 隔开") + private String waterType; + + /** 喝水习惯,使用 , 隔开 */ + @Excel(name = "喝水习惯,使用 , 隔开") + private String waterHabit; + + /** 常喝的饮品的每周频次,使用,隔开 */ + @Excel(name = "常喝的饮品的每周频次,使用,隔开") + private String drinksNum; + + /** 是否喝酒 */ + @Excel(name = "是否喝酒") + private String drinkWineFlag; + + /** 喝酒种类,使用,隔开 */ + @Excel(name = "喝酒种类,使用,隔开") + private String drinkWineClassify; + + /** 其他酒种类 */ + @Excel(name = "其他酒种类") + private String otherWineClassify; + + /** 对应酒的量 */ + @Excel(name = "对应酒的量") + private String drinkWineAmount; + + /** 是否抽烟,0否 1是,默认0 */ + @Excel(name = "是否抽烟,0否 1是,默认0") + private String smokeFlag; + + /** 抽烟频次和烟龄,戒烟几年,使用,隔开 */ + @Excel(name = "抽烟频次和烟龄,戒烟几年,使用,隔开") + private String smokeRate; + + /** 是否经常抽二手烟 0否 1是,默认0 */ + @Excel(name = "是否经常抽二手烟 0否 1是,默认0") + private String secondSmoke; + + /** 工作行业 */ + @Excel(name = "工作行业") + private String workIndustry; + + /** 工作性质,使用,隔开 */ + @Excel(name = "工作性质,使用,隔开") + private String workType; + + /** 排便次数 */ + @Excel(name = "排便次数") + private String defecationNum; + + /** 其他手动输入的排便次数 */ + @Excel(name = "其他手动输入的排便次数") + private String otherDefecationNum; + + /** 排便时间段,使用,隔开 */ + @Excel(name = "排便时间段,使用,隔开") + private String defecationTime; + + /** 排便的形状 */ + @Excel(name = "排便的形状") + private String defecationShape; + + /** 排便的气味 */ + @Excel(name = "排便的气味") + private String defecationSmell; + + /** 排便的速度 */ + @Excel(name = "排便的速度") + private String defecationSpeed; + + /** 排便的颜色 */ + @Excel(name = "排便的颜色") + private String defecationColor; + + /** 每周运动次数 */ + @Excel(name = "每周运动次数") + private String motionNum; + + /** 每次运动的时长,分钟 */ + private String motionDuration; + + /** 每天运动的时间,24小时制 */ + private String motionTime; + + /** 有氧运动项目,使用,隔开 */ + private String aerobicMotionClassify; + + /** 无氧运动项目,使用,隔开 */ + private String anaerobicMotionClassify; + + /** 无氧有氧项目,使用,隔开 */ + private String anaerobicAerobicMotionClassify; + + /** 其他运动项目,使用,隔开 */ + private String otherMotionClassify; + + private String motion; + + /** 运动场地,使用,隔开 */ + private String motionField; + + /** 其他运动场地 */ + private String otherMotionField; + + /** 睡觉时间,24小时制 */ + private String sleepTime; + + /** 睡眠质量 */ + private String sleepQuality; + + /** 是否有辅助入睡药物,0否 1是,默认0 */ + private String sleepDrugFlag; + + /** 辅助睡眠类药物名称 */ + private String sleepDrug; + + /** 是否经常熬夜(超过11点)0否 1是,默认0 */ + private String stayupLateFlag; + + /** 熬夜频次,每周几次 */ + private String stayupLateWeekNum; + + /** 家族疾病史,使用,隔开 */ + private String familyIllnessHistory; + + /** 其他家族病史 */ + private String otherFamilyIllnessHistory; + + /** 手术史,使用,隔开 */ + private String operationHistory; + + /** 其他手术史 */ + private String otherOperationHistory; + + /** 近期是否做过手术,0否 1是,默认0 */ + private String nearOperationFlag; + + /** 手术恢复情况 */ + private String recoveryeSituation; + + /** 是否长期服用药物,0否 1是,默认0 */ + private String longEatDrugFlag; + + /** 长期服用的药物,使用,隔开 */ + private String longEatDrugClassify; + + /** 其他长期服用的药物 */ + private String otherLongEatDrugClassify; + + /** 是否出现过过敏症状,0否 1是,默认0 */ + private String allergyFlag; + + /** 过敏症状 */ + private String allergySituation; + + /** 过敏源,使用,隔开 */ + private String allergen; + + /** 其他过敏源 */ + private String otherAllergen; + + /** 体检报告 */ + private String medicalReport; + + /** 体检报告名称 */ + private String medicalReportName; + + /** 南方人北方人,0南方 1北方 */ + private String position; + + /** 减脂经历方法 */ + @Excel(name = "减脂经历方法") + private String experience; + + /** 是否减脂反弹,0否 1是 */ + private String rebound; + + /** 减脂遇到的困难 */ + private String difficulty; + + /** 是否意识到生活习惯是减脂关键 0否 1是 */ + private String crux; + + /** 忌口或饮食食物 */ + private String dishesIngredient; + + /** 饮食习惯 */ + private String makeFoodType; + + /** 客户病史体征,使用,隔开 */ + private String physicalSigns; + + /** 其他病史体征 **/ + private String otherPhysicalSigns; + + /** 气血数据 */ + private String bloodData; + + //备注 + private String remark; + + /** 湿气数据 */ + private String moistureDate; + + + /** 减脂指导 **/ + private String guidance; + +} 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 index fc23e08bc..99f4d91e9 100644 --- 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 @@ -69,4 +69,23 @@ public class NutritionalCalories implements Serializable { //蛋白质、脂肪、碳水剩余可摄入热量 public Integer[] surplusNutritionalHeat; + + private String nutritionalHeat_one; + + private String nutritionalHeat_two; + + private String nutritionalHeat_three; + + private String nutritionalQuality_one; + + private String nutritionalQuality_two; + + private String nutritionalQuality_three; + + private String weightNutritionalRate_one; + + private String weightNutritionalRate_two; + + private String weightNutritionalRate_three; + } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java index c60456991..29acf80b2 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java @@ -2,6 +2,7 @@ package com.stdiet.custom.mapper; import java.util.List; +import com.stdiet.common.core.domain.entity.SysDictData; import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysCustomerHealthy; import org.apache.ibatis.annotations.Param; @@ -79,4 +80,12 @@ public interface SysCustomerHealthyMapper * @return */ int deleteCustomerHealthyByCustomerId(@Param("customerId")Long customerId); + + + /** + * 根据类型、键值集合查询字典类型 + * @param sysDictData + * @return + */ + public List selectDictDataByTypeAndValue(SysDictData sysDictData); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java index d3cff2b7c..6c383c955 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java @@ -3,6 +3,7 @@ package com.stdiet.custom.mapper; import java.util.List; import com.stdiet.custom.domain.SysRecipesPlan; import com.stdiet.custom.domain.SysRecipesPlanListInfo; +import org.apache.ibatis.annotations.Param; /** * 食谱计划Mapper接口 @@ -81,6 +82,13 @@ public interface SysRecipesPlanMapper */ List selectPlanListByCondition(SysRecipesPlan sysRecipesPlan); + /** + * 根据客户ID查询最后一天食谱计划 + * @param customerId + * @return + */ + SysRecipesPlan getLastDayRecipesPlan(@Param("customerId")Long customerId); + /** * 根据订单ID查询食谱计划 * @param sysRecipesPlan @@ -93,6 +101,13 @@ public interface SysRecipesPlanMapper List selectRecipesPlanListInfo(String outId); List selectPlanListByCusId(Long cusId); - + List selectRecipesModelList(SysRecipesPlan sysRecipesPlan); + + /** + * 批量更新食谱计划的开始时间、结束时间 + * @param list + * @return + */ + int updateMuchRecipesPlanDate(SysRecipesPlan sysRecipesPlan); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java index 16ddda9cb..65ded44e9 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java @@ -3,7 +3,9 @@ package com.stdiet.custom.service; import java.util.List; import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.common.core.domain.entity.SysDictData; import com.stdiet.custom.domain.SysCustomerHealthy; +import com.stdiet.custom.dto.request.HealthyDetailRequest; import org.apache.ibatis.annotations.Param; /** @@ -78,4 +80,18 @@ public interface ISysCustomerHealthyService * @return */ int deleteCustomerHealthyByCustomerId(Long customerId); + + /** + * 生成健康评估报告 + * @return + */ + AjaxResult generateHealthyReport(HealthyDetailRequest healthyDetailRequest); + + + /** + * 根据类型、键值集合查询字典类型 + * @param sysDictData + * @return + */ + public List selectDictDataByTypeAndValue(SysDictData sysDictData); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java index 146b1f68b..cffc8b111 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java @@ -99,6 +99,13 @@ public interface ISysRecipesPlanService */ Long getCusIdByOutId(String outId); + /** + * 根据客户ID查询最后一天食谱计划 + * @param customerId + * @return + */ + SysRecipesPlan getLastDayRecipesPlan(Long customerId); + /** * 通过outId查询食谱计划简要 * @param outId diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java index a3f1ea3c0..05d21b6d5 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java @@ -1,14 +1,22 @@ package com.stdiet.custom.service.impl; -import java.util.List; +import java.util.*; +import com.stdiet.common.config.RuoYiConfig; import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.common.core.domain.entity.SysDictData; +import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.bean.ObjectUtils; +import com.stdiet.common.utils.reflect.ReflectUtils; import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysCustomerPhysicalSigns; +import com.stdiet.custom.dto.request.HealthyDetailRequest; +import com.stdiet.custom.dto.response.NutritionalCalories; import com.stdiet.custom.service.ISysCustomerService; +import com.stdiet.custom.utils.NutritionalUtils; +import com.stdiet.custom.utils.PdfUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.stdiet.custom.mapper.SysCustomerHealthyMapper; @@ -141,4 +149,111 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService public int deleteCustomerHealthyByCustomerId(Long customerId){ return sysCustomerHealthyMapper.deleteCustomerHealthyByCustomerId(customerId); } + + /** + * 生成健康评估报告 + * @return + */ + @Override + public AjaxResult generateHealthyReport(HealthyDetailRequest healthyDetailRequest){ + AjaxResult ajaxResult = AjaxResult.error(); + String templatePath = "/home/workspace/ShengTangManage/running/pdf/healthyReport.pdf"; + //String templatePath = "D:\\contract\\healthyReport.pdf"; + String fileName = "healthyReport" + healthyDetailRequest.getCustomerId() + System.currentTimeMillis() + ".pdf"; + String filePath = RuoYiConfig.getDownloadPath() + fileName; + //查询客户健康信息 + SysCustomerHealthy sysCustomerHealthy = selectSysCustomerHealthyById(healthyDetailRequest.getId()); + if(sysCustomerHealthy != null){ + ajaxResult = PdfUtils.generatePdfFile(templatePath, filePath, getReportData(sysCustomerHealthy, healthyDetailRequest)); + ajaxResult.put("path", fileName); + } + return ajaxResult; + } + + public static final String[] healthyAttrNameAray = {"createTime","name","phone","conditioningProject","sex","age","tall","weight","position", + "experience","difficulty","rebound","crux","condiment","cookingStyle","cookingStyleRate","washVegetablesStyle", + "breakfastType","breakfastFood","lunchType","dinner","vegetableRate","commonMeat","dinnerTime","supperNum","supperFood", + "dietHotAndCold","dietFlavor","vegetablesNum","vegetablesRateType","fruitsNum","fruitsTime","fruitsRate","riceNum","riceFull", + "eatingSpeed","makeFoodType","snacks","healthProductsFlag","healthProductsBrand","healthProductsName", + "healthProductsWeekRate","dishesIngredient","waterNum","waterType","waterHabit", + "drinksNum","drinkWineFlag","drinkWineClassify","drinkWineAmount","smokeFlag","smokeRate", + "secondSmoke","workIndustry","workType","defecationNum","defecationTime","defecationShape", + "defecationSmell","defecationSpeed","defecationColor","motionNum","motionDuration","motionTime", + "motion","motionField","sleepTime","sleepQuality","sleepDrugFlag","sleepDrug","stayupLateFlag","stayupLateWeekNum", + "physicalSigns","moistureDate","bloodData","familyIllnessHistory","operationHistory","nearOperationFlag", + "recoveryeSituation","longEatDrugFlag","longEatDrugClassify","allergyFlag","allergySituation","allergen" + }; + + public static final String[] nutriAttrNameArray = {"standardWeight","overWeight","metabolizeHeat","activityFactor","withoutExerciseHeat", + "exerciseHeat","targetEveryWeightHeat","standardEveryWeightHeat","nutritionalHeat_one","nutritionalHeat_two","nutritionalHeat_three", + "nutritionalQuality_one","nutritionalQuality_two","nutritionalQuality_three", + "weightNutritionalRate_one","weightNutritionalRate_two","weightNutritionalRate_three" + }; + + private Map getReportData(SysCustomerHealthy sysCustomerHealthy, HealthyDetailRequest healthyDetailRequest){ + if(StringUtils.isNotEmpty(sysCustomerHealthy.getBloodData())){ + SysDictData param = new SysDictData(); + param.setDictType("sys_moisture_data"); + param.setDictValueList(Arrays.asList(sysCustomerHealthy.getBloodData().split(","))); + List bloodData = selectDictDataByTypeAndValue(param); + String bloodString = ""; + for (SysDictData blood : bloodData) { + bloodString += blood.getDictValue() + "、" +blood.getDictLabel() + "\n"; + } + healthyDetailRequest.setBloodData(bloodString); + } + if(StringUtils.isNotEmpty(sysCustomerHealthy.getMoistureDate())){ + SysDictData param = new SysDictData(); + param.setDictType("sys_blood_data"); + param.setDictValueList(Arrays.asList(sysCustomerHealthy.getBloodData().split(","))); + List moistureData = selectDictDataByTypeAndValue(param); + String moistureString = ""; + for (SysDictData moisture : moistureData) { + moistureString += moisture.getDictValue() + "、" + moisture.getDictLabel() + "\n"; + } + healthyDetailRequest.setMoistureDate(moistureString); + } + Map data = new HashMap<>(); + for (String key : healthyAttrNameAray) { + data.put(key, ReflectUtils.getFieldValueByFieldName(key, healthyDetailRequest)); + } + //减脂指导 + data.put("guidance", sysCustomerHealthy.getGuidance()); + //营养热量分析数据 + NutritionalCalories nutritionalCalories = NutritionalUtils.getNutritionalCaloriesData(sysCustomerHealthy); + nutritionalCalories.setNutritionalHeat_one(nutritionalCalories.getNutritionalHeat()[0].toString()); + nutritionalCalories.setNutritionalHeat_two(nutritionalCalories.getNutritionalHeat()[1].toString()); + nutritionalCalories.setNutritionalHeat_three(nutritionalCalories.getNutritionalHeat()[2].toString()); + nutritionalCalories.setNutritionalQuality_one(nutritionalCalories.getNutritionalQuality()[0].toString()); + nutritionalCalories.setNutritionalQuality_two(nutritionalCalories.getNutritionalQuality()[1].toString()); + nutritionalCalories.setNutritionalQuality_three(nutritionalCalories.getNutritionalQuality()[2].toString()); + nutritionalCalories.setWeightNutritionalRate_one(nutritionalCalories.getWeightNutritionalRate()[0].toString()); + nutritionalCalories.setWeightNutritionalRate_two(nutritionalCalories.getWeightNutritionalRate()[1].toString()); + nutritionalCalories.setWeightNutritionalRate_three(nutritionalCalories.getWeightNutritionalRate()[2].toString()); + for (String key : nutriAttrNameArray) { + if("targetEveryWeightHeat".equals(key)){ + data.put(key, nutritionalCalories.getTargetEveryWeightHeat()[0].intValue()+"-"+nutritionalCalories.getTargetEveryWeightHeat()[1].intValue()); + continue; + } + if("standardEveryWeightHeat".equals(key)){ + data.put(key, nutritionalCalories.getStandardEveryWeightHeat()[0].intValue()+"-"+nutritionalCalories.getStandardEveryWeightHeat()[1].intValue()); + continue; + } + data.put(key, ReflectUtils.getFieldValueByFieldName(key, nutritionalCalories)); + } + data.put("company","深圳胜唐体控有限公司"); + data.put("date", DateUtils.getDate()); + return data; + } + + + /** + * 根据类型、键值集合查询字典类型 + * @param sysDictData + * @return + */ + @Override + public List selectDictDataByTypeAndValue(SysDictData sysDictData){ + return sysCustomerHealthyMapper.selectDictDataByTypeAndValue(sysDictData); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java index 70d942f57..c822e243c 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java @@ -188,18 +188,27 @@ public class SysOrderServiceImpl implements ISysOrderService { sysOrder.setUpdateBy(SecurityUtils.getUsername()); sysOrder.setUpdateTime(DateUtils.getNowDate()); //体验单 - /*if("2".equals(sysOrder.getOrderType())){ - - }*/ - + if("2".equals(sysOrder.getOrderType())){ + sysOrder.setAfterSaleId(null); + sysOrder.setNutritionistId(null); + sysOrder.setNutriAssisId(null); + } + //提成单 + if(sysOrder.getAfterSaleCommissOrder().intValue() == 1){ + sysOrder.setAfterSaleId(null); + sysOrder.setNutritionistId(null); + sysOrder.setNutriAssisId(null); + sysOrder.setPlannerId(null); + sysOrder.setPlannerAssisId(null); + sysOrder.setOperatorId(null); + sysOrder.setOperatorAssisId(null); + } //更新订单 int row = sysOrderMapper.updateSysOrder(sysOrder); // 审核后的订单才生成食谱 - if (row > 0 && oldSysOrder.getReviewStatus().equals("no") && sysOrder.getReviewStatus().equals("yes")) { + if (row > 0 && isNeedRegenerateRecipesPlan(oldSysOrder, sysOrder)) { //异步更新食谱计划 - if (isNeedRegenerateRecipesPlan(oldSysOrder, sysOrder)) { - sysRecipesPlanService.regenerateRecipesPlan(sysOrder.getOrderId()); - } + sysRecipesPlanService.regenerateRecipesPlan(sysOrder.getOrderId()); } return row; } @@ -212,6 +221,9 @@ public class SysOrderServiceImpl implements ISysOrderService { * @return */ private boolean isNeedRegenerateRecipesPlan(SysOrder oldSysOrder, SysOrder newSysOrder) { + if(oldSysOrder.getReviewStatus().equals("no") && newSysOrder.getReviewStatus().equals("yes")){ + return true; + } if (oldSysOrder.getServeTimeId() != null && newSysOrder.getServeTimeId() != null && oldSysOrder.getServeTimeId().intValue() != newSysOrder.getServeTimeId().intValue()) { return true; } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java index 40f9e6e77..29ba4025d 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java @@ -2,6 +2,7 @@ package com.stdiet.custom.service.impl; import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.SynchrolockUtil; +import com.stdiet.common.utils.sign.Md5Utils; import com.stdiet.custom.domain.SysOrder; import com.stdiet.custom.domain.SysOrderPause; import com.stdiet.custom.domain.SysRecipesPlan; @@ -30,6 +31,7 @@ import java.util.List; @Service("sysRecipesPlanService") @Transactional public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { + public static final String generateRecipesPlanLockKey = "generateRecipesPlanLock::%s"; @Autowired private SysRecipesPlanMapper sysRecipesPlanMapper; @@ -121,45 +123,45 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { @Override @Async public void regenerateRecipesPlan(Long orderId) { + try{ + Thread.sleep(5000); + }catch (Exception e){ + e.printStackTrace(); + } if (orderId == null || orderId <= 0) { return; } SysOrder sysOrder = sysOrderService.selectSysOrderById(orderId); - //订单为空、金额小于0不进行食谱生成、更新,只对2021年开始的订单进行食谱计划生成,判断订单金额、开始时间、结束时间,为空则直接返回,不重新生成食谱计划 - if (sysOrder == null && DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear() < 2021 + //订单为空、金额小于0、订单未审核不进行食谱生成、更新,只对2021年开始的订单进行食谱计划生成,判断订单金额、开始时间、结束时间,为空则直接返回,不重新生成食谱计划 + if (sysOrder == null || !sysOrder.getReviewStatus().equals("yes") || DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear() < 2021 || sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) { return; } -// System.out.println(DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear()); + //判断是否提成单,拆分单中的副单,体验单 + if(sysOrder.getAfterSaleCommissOrder().intValue() == 1 || ("1".equals(sysOrder.getOrderType()) && sysOrder.getMainOrderId().intValue() == 1) || + "2".equals(sysOrder.getOrderType())){ + System.out.println("---------------------不生成食谱------------------------"); + return; + } try { //获取redis中该订单对应的锁 if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, orderId))) { + //判断是否已存在食谱计划 SysRecipesPlan queryParam = new SysRecipesPlan(); queryParam.setOrderId(orderId); List oldRecipesPlanList = sysRecipesPlanMapper.selectSysRecipesPlanList(queryParam); - //判断是否已存在食谱 - if (oldRecipesPlanList != null && oldRecipesPlanList.size() > 0) { - Long[] orderIdArray = new Long[1]; - orderIdArray[0] = orderId; - //删除该订单对于食谱 - delRecipesPlanByOrderId(orderIdArray); - } -// //判断订单金额、开始时间、结束时间,为空则直接返回,不重新生成食谱计划 -// if (sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) { -// return; -// } SysOrderPause pauseParam = new SysOrderPause(); pauseParam.setOrderId(sysOrder.getOrderId()); //暂停记录列表 List pauseList = sysOrderPauseService.selectSysOrderPauseList(pauseParam); - List planList = generatePlan(sysOrder, oldRecipesPlanList, - DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList); - if (planList != null && planList.size() > 0) { - sysRecipesPlanMapper.insertBatch(planList); + List planList = generatePlan(sysOrder, oldRecipesPlanList, DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList); + if(oldRecipesPlanList != null && oldRecipesPlanList.size() > 0){ + updateOrAddRecipesPlan(oldRecipesPlanList, planList); + }else{ + if (planList != null && planList.size() > 0) { + sysRecipesPlanMapper.insertBatch(planList); + } } - /*for (SysRecipesPlan sysRecipesPlan : planList) { - getTestDate(sysRecipesPlan.getStartDate(), sysRecipesPlan.getEndDate()); - }*/ } } catch (Exception e) { e.printStackTrace(); @@ -169,26 +171,64 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { } } - public void getTestDate(Date date, Date date2) { - LocalDate d = DateUtils.dateToLocalDate(date); - LocalDate d2 = DateUtils.dateToLocalDate(date2); - String s1 = d.getYear() + "-" + d.getMonthValue() + "-" + d.getDayOfMonth(); - String s2 = d2.getYear() + "-" + d2.getMonthValue() + "-" + d2.getDayOfMonth(); - System.out.println(s1 + " " + s2); + /** + * 更新食谱计划,删除旧食谱中多余的,添加新食谱中多的 + * @param oldRecipesPlanList + * @param newRecipesPlanList + */ + private void updateOrAddRecipesPlan(List oldRecipesPlanList, List newRecipesPlanList){ + int newSize = newRecipesPlanList.size(); + int index = 0; + List addList = new ArrayList<>(); + List updateList = new ArrayList<>(); + List delList = new ArrayList<>(); + for (SysRecipesPlan plan : oldRecipesPlanList) { + if(index < newSize){ + plan.setStartDate(newRecipesPlanList.get(index).getStartDate()); + plan.setEndDate(newRecipesPlanList.get(index).getEndDate()); + updateList.add(plan); + }else{ + delList.add(plan.getId()); + } + index++; + } + if(newSize > oldRecipesPlanList.size()){ + addList = newRecipesPlanList.subList(oldRecipesPlanList.size(),newSize); + } + //更新 + if(updateList.size() > 0){ + for (SysRecipesPlan plan : updateList) { + sysRecipesPlanMapper.updateSysRecipesPlan(plan); + } + } + //删除多余的食谱计划 + if(delList.size() > 0){ + sysRecipesPlanMapper.deleteSysRecipesPlanByIds(delList.toArray(new Long[delList.size()])); + } + //添加新的 + if(addList.size() > 0){ + sysRecipesPlanMapper.insertBatch(addList); + } } /** * 根据订单ID、订单开始服务时间、结束时间、暂停列表生成食谱计划列表 * * @param sysOrder 订单对象 - * @param oldRecipesPlanList 旧的食谱计划 * @param serverStartDate 服务开始时间 * @param serverEndDate 服务结束时间 * @param pauseList 暂停列表 * @return */ - public List generatePlan(SysOrder sysOrder, List oldRecipesPlanList, - LocalDate serverStartDate, LocalDate serverEndDate, List pauseList) { + private List generatePlan(SysOrder sysOrder, List oldRecipesPlanList, LocalDate serverStartDate, LocalDate serverEndDate, List pauseList) { + //查询该客户最后一次食谱计划对应天数 + int oldStartNumDay = 0; + if(oldRecipesPlanList.size() == 0){ + SysRecipesPlan lastSysRecipesPlan = getLastDayRecipesPlan(sysOrder.getCusId()); + oldStartNumDay = lastSysRecipesPlan == null || lastSysRecipesPlan.getEndNumDay() == null ? 0 : lastSysRecipesPlan.getEndNumDay().intValue(); + }else{ + oldStartNumDay = oldRecipesPlanList.get(0).getStartNumDay() - 1; + } List planList = new ArrayList<>(); boolean breakFlag = false; LocalDate planStartDate = serverStartDate; @@ -207,17 +247,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { sysRecipesPlan.setEndDate(DateUtils.localDateToDate(planEndDate)); sysRecipesPlan.setOrderId(sysOrder.getOrderId()); sysRecipesPlan.setCusId(sysOrder.getCusId()); - /*//当开始时间小于等于当前时间,默认为已发送,发送时间为前一天 - if(ChronoUnit.DAYS.between(planStartDate, LocalDate.now()) >= 0){ - sysRecipesPlan.setSendFlag(1); - sysRecipesPlan.setSendTime(DateUtils.localDateToDate(LocalDate.now().minusDays(1))); - }*/ - //将旧食谱计划中的发送状态、发送时间、食谱复制到新食谱计划中 - boolean existFlag = oldRecipesPlanList.size() >= planList.size() + 1; - sysRecipesPlan.setSendFlag(existFlag ? oldRecipesPlanList.get(planList.size()).getSendFlag() : 0); - sysRecipesPlan.setSendTime(existFlag ? oldRecipesPlanList.get(planList.size()).getSendTime() : null); - sysRecipesPlan.setRecipesId(existFlag ? oldRecipesPlanList.get(planList.size()).getRecipesId() : null); - + sysRecipesPlan.setOutId(Md5Utils.hash(String.valueOf(sysOrder.getCusId()))); + oldStartNumDay += 1; + sysRecipesPlan.setStartNumDay(oldStartNumDay); + oldStartNumDay += 6; + sysRecipesPlan.setEndNumDay(oldStartNumDay); planList.add(sysRecipesPlan); planStartDate = planEndDate.plusDays(1); @@ -238,7 +272,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { * @param pauseList 暂停列表 * @return */ - public long getPauseDayeCount(LocalDate planStartDate, LocalDate planEndDate, List pauseList) { + private long getPauseDayeCount(LocalDate planStartDate, LocalDate planEndDate, List pauseList) { long pauseDay = 0; //判断这个时间内是否存在暂停 if (pauseList != null && pauseList.size() > 0) { @@ -293,6 +327,15 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { return sysRecipesPlanMapper.selectPlanListByOrderId(sysRecipesPlan); } + /** + * 根据客户ID查询最后一天食谱计划 + * @param customerId + * @return + */ + public SysRecipesPlan getLastDayRecipesPlan(Long customerId){ + return sysRecipesPlanMapper.getLastDayRecipesPlan(customerId); + } + @Override public Long getCusIdByOutId(String outId) { return sysRecipesPlanMapper.getCusIdByOutId(outId); diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/utils/NutritionalUtils.java b/stdiet-custom/src/main/java/com/stdiet/custom/utils/NutritionalUtils.java index e1a89986b..b253bcf45 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/utils/NutritionalUtils.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/utils/NutritionalUtils.java @@ -32,6 +32,13 @@ public class NutritionalUtils { nutritionalCalories.setNutritionalHeat(nutritionalHeatAndQuality[0]); nutritionalCalories.setNutritionalQuality(nutritionalHeatAndQuality[1]); nutritionalCalories.setWeightNutritionalRate(HealthyUtils.calculateNutritionEveryWeight(nutritionalHeatAndQuality[1], nutritionalCalories.getWeight())); + //活动因子 + nutritionalCalories.setActivityFactor(HealthyUtils.activityFactor); + Long[] heatArray = HealthyUtils.calculateWithoutExerciseHeat(nutritionalCalories.getMetabolizeHeat()); + //不运动热量 + nutritionalCalories.setWithoutExerciseHeat(heatArray[0].intValue()); + //运动热量 + nutritionalCalories.setExerciseHeat(heatArray[1].intValue()); } return nutritionalCalories; } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/utils/PdfUtils.java b/stdiet-custom/src/main/java/com/stdiet/custom/utils/PdfUtils.java new file mode 100644 index 000000000..41c96e36a --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/utils/PdfUtils.java @@ -0,0 +1,70 @@ +package com.stdiet.custom.utils; + +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.pdf.*; +import com.itextpdf.text.Document; +import com.stdiet.common.core.domain.AjaxResult; + +import java.io.ByteArrayOutputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Map; + +public class PdfUtils { + + /** + * 生成PDF + * @param templatePath PDF模板文件路径 + * @param filePath 目标文件路径 + * @param data 数据 + * @return + */ + public static AjaxResult generatePdfFile(String templatePath, String filePath, Map data){ + AjaxResult ajaxResult = AjaxResult.success(); + + PdfReader reader; + FileOutputStream out; + ByteArrayOutputStream bos; + PdfStamper stamper; + + try { + out = new FileOutputStream(filePath);// 输出流到新的pdf,没有b2.pdf时会创建 + reader = new PdfReader(templatePath);// 读取pdf模板 + bos = new ByteArrayOutputStream(); + stamper = new PdfStamper(reader, bos); + AcroFields form = stamper.getAcroFields(); + + form.addSubstitutionFont(BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED)); + for(String key : data.keySet()){ + form.setField(key, data.get(key), true); + } + stamper.setFormFlattening(true);// 如果为false那么生成的PDF文件还能编辑,一定要设为true + stamper.close(); + + Document doc = new Document(); + + PdfCopy copy = new PdfCopy(doc, out); + doc.open(); + PdfImportedPage importPage = null; + for (int i = 1; i <= reader.getNumberOfPages(); i++) { + importPage = copy + .getImportedPage(new PdfReader(bos.toByteArray()), i); + copy.addPage(importPage); + } + doc.close(); + + //Runtime.getRuntime().exec("chmod 644 " + filePath); + } catch (FileNotFoundException e) { + e.printStackTrace(); + ajaxResult = AjaxResult.error(); + } catch (IOException e) { + e.printStackTrace(); + ajaxResult = AjaxResult.error(); + } catch (DocumentException e) { + e.printStackTrace(); + ajaxResult = AjaxResult.error(); + } + return ajaxResult; + } +} diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml index 7f32de28e..437aedd3f 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml @@ -112,6 +112,7 @@ + @@ -123,7 +124,7 @@ select sch.id, customer_id, conditioning_project_id, sex, age, weight, tall, condiment, other_condiment, cooking_style, cooking_style_rate, wash_vegetables_style, other_wash_vegetables_style, breakfast_type, breakfast_food, lunch_type, dinner, vegetable_rate, common_meat, dinner_time, supper_num, supper_food, diet_hot_and_cold, diet_flavor, vegetables_num, vegetables_rate_type, fruits_num, fruits_time, fruits_rate, rice_num, rice_full, eating_speed, snacks, other_snacks, health_products_flag, health_products_brand, health_products_name, health_products_week_rate, health_products_day_rate, water_num, water_type, water_habit, drinks_num, drink_wine_flag, drink_wine_classify, other_wine_classify, drink_wine_amount, smoke_flag, smoke_rate, second_smoke, work_industry, work_type, defecation_num, other_defecation_num, defecation_time, defecation_shape, defecation_smell, defecation_speed, defecation_color, motion_num, motion_duration, motion_time, aerobic_motion_classify, anaerobic_motion_classify, anaerobic_aerobic_motion_classify, other_motion_classify, motion_field, other_motion_field, sleep_time, sleep_quality, sleep_drug_flag, sleep_drug, stayup_late_flag, stayup_late_week_num, family_illness_history, other_family_illness_history, operation_history, other_operation_history, near_operation_flag, recoverye_situation, long_eat_drug_flag, long_eat_drug_classify, other_long_eat_drug_classify, allergy_flag, allergy_situation, allergen, other_allergen, medical_report, medical_report_name, - position,experience,rebound,difficulty,crux,dishes_ingredient,make_food_type,physical_signs_id,other_physical_signs,blood_data,moisture_date,sch.remark, + position,experience,rebound,difficulty,crux,dishes_ingredient,make_food_type,physical_signs_id,other_physical_signs,blood_data,moisture_date,sch.remark,sch.guidance, sch.create_time, sch.create_by,sch. update_time, sch.update_by, sch.del_flag @@ -261,6 +262,7 @@ blood_data, moisture_date, remark, + guidance, create_time, create_by, update_time, @@ -369,6 +371,7 @@ #{bloodData}, #{moistureDate}, #{remark}, + #{guidance}, #{createTime}, #{createBy}, #{updateTime}, @@ -480,6 +483,7 @@ blood_data = #{bloodData}, moisture_date = #{moistureDate}, remark = #{remark}, + guidance = #{guidance}, create_time = #{createTime}, create_by = #{createBy}, update_time = #{updateTime}, @@ -517,4 +521,20 @@ update sys_customer_healthy set del_flag = 1 where customer_id = #{customerId} + + + + + + + + + + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml index 2b98a4ca1..49e4a3da7 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml @@ -52,6 +52,8 @@ and send_flag = #{sendFlag} and send_time = #{sendTime} and review_status = #{reviewStatus} + + order by id ASC + + + insert into sys_recipes_plan order_id, cus_id, + out_id, start_date, end_date, start_num_day, @@ -81,6 +90,7 @@ #{orderId}, #{cusId}, + #{outId}, #{startDate}, #{endDate}, #{startNumDay}, @@ -102,6 +112,7 @@ order_id = #{orderId}, cus_id = #{cusId}, + out_id = #{outId}, start_date = #{startDate}, end_date = #{endDate}, start_num_day = #{startNumDay}, @@ -133,10 +144,10 @@ INSERT INTO sys_recipes_plan - (order_id, cus_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, recipes_id) + (order_id, cus_id, out_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, recipes_id) VALUES - (#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay}, + (#{plan.orderId}, #{plan.cusId}, #{plan.outId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay}, #{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId}) @@ -234,4 +245,11 @@ select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} order by num_day asc + +   + + update sys_recipes_plan set start_date = #{startDate},end_date = #{endDate} where id = #{id} + \ No newline at end of file diff --git a/stdiet-ui/src/api/custom/healthy.js b/stdiet-ui/src/api/custom/healthy.js index 473401e9c..f4b718818 100644 --- a/stdiet-ui/src/api/custom/healthy.js +++ b/stdiet-ui/src/api/custom/healthy.js @@ -61,4 +61,14 @@ export function download(fileName) { }) } +// 生成健康体征报告 +export function generateHealthyReport(healthyDetail) { + return request({ + url: '/custom/healthy/generateHealthyReport', + method: 'post', + data: healthyDetail + }) +} + + diff --git a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue index be164b16f..d7702d4dd 100644 --- a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue +++ b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue @@ -3,6 +3,8 @@
+ 下载报告 + 减脂指导 修改备注 修改信息 删除信息 @@ -24,6 +26,15 @@ + + + + + + + +
@@ -71,23 +82,28 @@ + + diff --git a/stdiet-ui/src/components/PhysicalSignsGuidance/index.vue b/stdiet-ui/src/components/PhysicalSignsGuidance/index.vue new file mode 100644 index 000000000..fc3356095 --- /dev/null +++ b/stdiet-ui/src/components/PhysicalSignsGuidance/index.vue @@ -0,0 +1,88 @@ + + + +