commit
7539ec6b7f
BIN
running/pdf/healthyReport.pdf
Normal file
BIN
running/pdf/healthyReport.pdf
Normal file
Binary file not shown.
@ -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);
|
||||
}
|
||||
}
|
@ -57,6 +57,12 @@ public class SysRecipesPlanController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:list')")
|
||||
@GetMapping(value = "/list/{cusId}")
|
||||
public AjaxResult getAllPlanByCusId(@PathVariable Long cusId) {
|
||||
return AjaxResult.success(sysRecipesPlanService.selectPlanListByCusId(cusId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取食谱计划详细信息
|
||||
*/
|
||||
|
@ -0,0 +1,68 @@
|
||||
package com.stdiet.web.controller.custom;
|
||||
|
||||
import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.page.TableDataInfo;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||
import com.stdiet.custom.service.ISysRecipesPlanModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱模板
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/recipes/model")
|
||||
public class SysRecipesPlanModelController extends BaseController {
|
||||
@Autowired
|
||||
private ISysRecipesPlanModelService iSysRecipesPlanModelService;
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesModel:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
startPage();
|
||||
List<SysRecipesPlanModel> list = iSysRecipesPlanModelService.selectRecipesModelListByCondition(sysRecipesPlanModel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesModel:edit')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
return toAjax(iSysRecipesPlanModelService.insertRecipsesModel(sysRecipesPlanModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sysRecipesPlanModel
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:list')")
|
||||
@PutMapping(value = "/update")
|
||||
public AjaxResult update(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
return toAjax(iSysRecipesPlanModelService.updateRecipesModel(sysRecipesPlanModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:query')")
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
public AjaxResult delete(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iSysRecipesPlanModelService.removeRecipesModel(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -34,16 +34,31 @@ public class SysWapController extends BaseController {
|
||||
return AjaxResult.success(iSysWapServices.getRecipesPlanListInfo(outId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param outId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/healthyInfo/{outId}")
|
||||
public AjaxResult healthy(@PathVariable String outId) {
|
||||
return AjaxResult.success(iSysWapServices.getHealthyDataByOutId(outId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某天食谱菜品
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/recipes/menu/{id}")
|
||||
public AjaxResult dayilyMenu(@PathVariable Long id) {
|
||||
return AjaxResult.success(iSysRecipesService.selectDishesByMenuId(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统字典
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/dict/{dictType}")
|
||||
public AjaxResult sysDict(@PathVariable String dictType) {
|
||||
return AjaxResult.success(iSysDictTypeService.selectDictDataByType(dictType));
|
||||
|
@ -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<String> dictValueList;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/** 样式属性(其他样式扩展) */
|
||||
@ -153,7 +157,15 @@ public class SysDictData extends BaseEntity
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getDictValueList() {
|
||||
return dictValueList;
|
||||
}
|
||||
|
||||
public void setDictValueList(List<String> dictValueList) {
|
||||
this.dictValueList = dictValueList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -433,6 +433,9 @@ public class SysCustomerHealthy extends BaseEntity
|
||||
//备注
|
||||
private String remark;
|
||||
|
||||
/** 减脂指导 */
|
||||
private String guidance;
|
||||
|
||||
/** 湿气数据 */
|
||||
@Excel(name = "湿气数据")
|
||||
private String moistureDate;
|
||||
|
@ -28,6 +28,11 @@ public class SysRecipesPlan {
|
||||
|
||||
private Long cusId;
|
||||
|
||||
/**
|
||||
* 对外的用户id
|
||||
*/
|
||||
private String outId;
|
||||
|
||||
//客户ID
|
||||
// private Long customerId;
|
||||
|
||||
@ -132,4 +137,7 @@ public class SysRecipesPlan {
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
// 0-普通 1-模板
|
||||
private Integer type;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SysRecipesPlanModel {
|
||||
Long id;
|
||||
|
||||
Long nutritionistId;
|
||||
|
||||
Long nutriAssisId;
|
||||
|
||||
Long planId;
|
||||
|
||||
String remark;
|
||||
|
||||
Date updateTime;
|
||||
|
||||
Date createTime;
|
||||
|
||||
String updateBy;
|
||||
|
||||
String createBy;
|
||||
|
||||
Long recipesId;
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData);
|
||||
}
|
@ -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<SysRecipesPlan> selectPlanListByCondition(SysRecipesPlan sysRecipesPlan);
|
||||
|
||||
/**
|
||||
* 根据客户ID查询最后一天食谱计划
|
||||
* @param customerId
|
||||
* @return
|
||||
*/
|
||||
SysRecipesPlan getLastDayRecipesPlan(@Param("customerId")Long customerId);
|
||||
|
||||
/**
|
||||
* 根据订单ID查询食谱计划
|
||||
* @param sysRecipesPlan
|
||||
@ -88,9 +96,18 @@ public interface SysRecipesPlanMapper
|
||||
*/
|
||||
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
|
||||
|
||||
List<SysRecipesPlan> selectPlanListByOutId(String outId);
|
||||
|
||||
Long getCusIdByOutId(String outId);
|
||||
|
||||
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
|
||||
|
||||
List<SysRecipesPlan> selectPlanListByCusId(Long cusId);
|
||||
|
||||
List<SysRecipesPlan> selectRecipesModelList(SysRecipesPlan sysRecipesPlan);
|
||||
|
||||
/**
|
||||
* 批量更新食谱计划的开始时间、结束时间
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
int updateMuchRecipesPlanDate(SysRecipesPlan sysRecipesPlan);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Mapper接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
public interface SysRecipesPlanModelMapper
|
||||
{
|
||||
List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int removeRecipesModel(Long id);
|
||||
}
|
@ -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<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Service接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
public interface ISysRecipesPlanModelService
|
||||
{
|
||||
|
||||
List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int removeRecipesModel(Long id);
|
||||
}
|
@ -91,10 +91,33 @@ public interface ISysRecipesPlanService
|
||||
*/
|
||||
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
|
||||
|
||||
List<SysRecipesPlan> selectPlanListByOutId(String outId);
|
||||
|
||||
/**
|
||||
* 通过outId查询cusId
|
||||
* @param outId
|
||||
* @return
|
||||
*/
|
||||
Long getCusIdByOutId(String outId);
|
||||
|
||||
/**
|
||||
* 根据客户ID查询最后一天食谱计划
|
||||
* @param customerId
|
||||
* @return
|
||||
*/
|
||||
SysRecipesPlan getLastDayRecipesPlan(Long customerId);
|
||||
|
||||
/**
|
||||
* 通过outId查询食谱计划简要
|
||||
* @param outId
|
||||
* @return
|
||||
*/
|
||||
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
|
||||
|
||||
/**
|
||||
* 通过客户id查询食谱计划
|
||||
* @param cusId
|
||||
* @return
|
||||
*/
|
||||
List<SysRecipesPlan> selectPlanListByCusId(Long cusId);
|
||||
|
||||
}
|
@ -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<String,String> 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<SysDictData> 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<SysDictData> moistureData = selectDictDataByTypeAndValue(param);
|
||||
String moistureString = "";
|
||||
for (SysDictData moisture : moistureData) {
|
||||
moistureString += moisture.getDictValue() + "、" + moisture.getDictLabel() + "\n";
|
||||
}
|
||||
healthyDetailRequest.setMoistureDate(moistureString);
|
||||
}
|
||||
Map<String,String> 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<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData){
|
||||
return sysCustomerHealthyMapper.selectDictDataByTypeAndValue(sysDictData);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -0,0 +1,67 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.SecurityUtils;
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||
import com.stdiet.custom.mapper.SysRecipesPlanModelMapper;
|
||||
import com.stdiet.custom.service.ISysRecipesPlanModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Service业务层处理
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
@Service("sysRecipesPlanModelService")
|
||||
@Transactional
|
||||
public class SysRecipesPlanModelServiceImpl implements ISysRecipesPlanModelService {
|
||||
|
||||
@Autowired
|
||||
SysRecipesPlanModelMapper sysRecipesPlanModelMapper;
|
||||
|
||||
@Autowired
|
||||
SysRecipesPlanMapper sysRecipesPlanMapper;
|
||||
|
||||
@Override
|
||||
public List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
return sysRecipesPlanModelMapper.selectRecipesModelListByCondition(sysRecipesPlanModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||
sysRecipesPlan.setStartNumDay(1);
|
||||
sysRecipesPlan.setEndNumDay(7);
|
||||
sysRecipesPlan.setType(1);
|
||||
int rows = sysRecipesPlanMapper.insertSysRecipesPlan(sysRecipesPlan);
|
||||
if (rows > 0) {
|
||||
sysRecipesPlanModel.setCreateBy(SecurityUtils.getUsername());
|
||||
sysRecipesPlanModel.setCreateTime(DateUtils.getNowDate());
|
||||
sysRecipesPlanModel.setPlanId(sysRecipesPlan.getId());
|
||||
return sysRecipesPlanModelMapper.insertRecipsesModel(sysRecipesPlanModel);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
sysRecipesPlanModel.setUpdateBy(SecurityUtils.getUsername());
|
||||
sysRecipesPlanModel.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysRecipesPlanModelMapper.updateRecipesModel(sysRecipesPlanModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeRecipesModel(Long id) {
|
||||
return sysRecipesPlanModelMapper.removeRecipesModel(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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<SysRecipesPlan> 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<SysOrderPause> pauseList = sysOrderPauseService.selectSysOrderPauseList(pauseParam);
|
||||
List<SysRecipesPlan> planList = generatePlan(sysOrder, oldRecipesPlanList,
|
||||
DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList);
|
||||
if (planList != null && planList.size() > 0) {
|
||||
sysRecipesPlanMapper.insertBatch(planList);
|
||||
List<SysRecipesPlan> 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<SysRecipesPlan> oldRecipesPlanList, List<SysRecipesPlan> newRecipesPlanList){
|
||||
int newSize = newRecipesPlanList.size();
|
||||
int index = 0;
|
||||
List<SysRecipesPlan> addList = new ArrayList<>();
|
||||
List<SysRecipesPlan> updateList = new ArrayList<>();
|
||||
List<Long> 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<SysRecipesPlan> generatePlan(SysOrder sysOrder, List<SysRecipesPlan> oldRecipesPlanList,
|
||||
LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList) {
|
||||
private List<SysRecipesPlan> generatePlan(SysOrder sysOrder, List<SysRecipesPlan> oldRecipesPlanList, LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> 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<SysRecipesPlan> 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<SysOrderPause> pauseList) {
|
||||
private long getPauseDayeCount(LocalDate planStartDate, LocalDate planEndDate, List<SysOrderPause> pauseList) {
|
||||
long pauseDay = 0;
|
||||
//判断这个时间内是否存在暂停
|
||||
if (pauseList != null && pauseList.size() > 0) {
|
||||
@ -293,9 +327,13 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
return sysRecipesPlanMapper.selectPlanListByOrderId(sysRecipesPlan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysRecipesPlan> selectPlanListByOutId(String outId) {
|
||||
return sysRecipesPlanMapper.selectPlanListByOutId(outId);
|
||||
/**
|
||||
* 根据客户ID查询最后一天食谱计划
|
||||
* @param customerId
|
||||
* @return
|
||||
*/
|
||||
public SysRecipesPlan getLastDayRecipesPlan(Long customerId){
|
||||
return sysRecipesPlanMapper.getLastDayRecipesPlan(customerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -308,4 +346,13 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
return sysRecipesPlanMapper.selectRecipesPlanListInfo(outId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysRecipesPlan> selectPlanListByCusId(Long cusId) {
|
||||
return sysRecipesPlanMapper.selectPlanListByCusId(cusId);
|
||||
}
|
||||
|
||||
public List<SysRecipesPlan> selectRecipesModelList(SysRecipesPlan sysRecipesPlan) {
|
||||
return sysRecipesPlanMapper.selectRecipesModelList(sysRecipesPlan);
|
||||
}
|
||||
|
||||
}
|
@ -54,6 +54,7 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
|
||||
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||
sysRecipesPlan.setId(sysRecipes.getPlanId());
|
||||
sysRecipesPlan.setRecipesId(sysRecipes.getId());
|
||||
sysRecipesPlan.setReviewStatus(1);
|
||||
sysRecipesPlanMapper.updateSysRecipesPlan(sysRecipesPlan);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<String,String> 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;
|
||||
}
|
||||
}
|
@ -112,6 +112,7 @@
|
||||
<result property="bloodData" column="blood_data" />
|
||||
<result property="moistureDate" column="moisture_date" />
|
||||
<result property="remark" column="remark"></result>
|
||||
<result property="guidance" column="guidance" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
@ -123,7 +124,7 @@
|
||||
|
||||
<sql id="selectSysCustomerHealthyVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
@ -261,6 +262,7 @@
|
||||
<if test="bloodData != null">blood_data,</if>
|
||||
<if test="moistureDate != null">moisture_date,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="guidance != null">guidance,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
@ -369,6 +371,7 @@
|
||||
<if test="bloodData != null">#{bloodData},</if>
|
||||
<if test="moistureDate != null">#{moistureDate},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="guidance != null">#{guidance},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
@ -480,6 +483,7 @@
|
||||
<if test="bloodData != null">blood_data = #{bloodData},</if>
|
||||
<if test="moistureDate != null">moisture_date = #{moistureDate},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="guidance != null">guidance = #{guidance},</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>
|
||||
@ -517,4 +521,20 @@
|
||||
update sys_customer_healthy set del_flag = 1 where customer_id = #{customerId}
|
||||
</update>
|
||||
|
||||
<resultMap type="SysDictData" id="SysDictDataResult">
|
||||
<id property="dictCode" column="dict_code" />
|
||||
<result property="dictSort" column="dict_sort" />
|
||||
<result property="dictLabel" column="dict_label" />
|
||||
<result property="dictValue" column="dict_value" />
|
||||
<result property="dictType" column="dict_type" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectDictDataByTypeAndValue" parameterType="SysDictData" resultMap="SysDictDataResult">
|
||||
select dict_code, dict_sort, dict_label, dict_value, dict_type from sys_dict_data
|
||||
where status = '0' and dict_type = #{dictType}
|
||||
and dict_value in <foreach collection="dictValueList" item="item" index="index"
|
||||
open="(" separator="," close=")">#{item}</foreach>
|
||||
order by dict_sort asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -5,52 +5,55 @@
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysRecipesPlanMapper">
|
||||
|
||||
<resultMap type="SysRecipesPlan" id="SysRecipesPlanResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="orderId" column="order_id" />
|
||||
<result property="startDate" column="start_date" />
|
||||
<result property="endDate" column="end_date" />
|
||||
<result property="startNumDay" column="start_num_day" />
|
||||
<result property="endNumDay" column="end_num_day" />
|
||||
<result property="recipesId" column="recipes_id" />
|
||||
<result property="sendFlag" column="send_flag" />
|
||||
<result property="sendTime" column="send_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="cusId" column="cus_id" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="orderId" column="order_id"/>
|
||||
<result property="startDate" column="start_date"/>
|
||||
<result property="endDate" column="end_date"/>
|
||||
<result property="startNumDay" column="start_num_day"/>
|
||||
<result property="endNumDay" column="end_num_day"/>
|
||||
<result property="recipesId" column="recipes_id"/>
|
||||
<result property="sendFlag" column="send_flag"/>
|
||||
<result property="sendTime" column="send_time"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="cusId" column="cus_id"/>
|
||||
<result property="outId" column="out_id"/>
|
||||
<!-- 非持久化字段 -->
|
||||
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
||||
<result property="customer" column="customer" /><!-- 客户姓名 -->
|
||||
<result property="phone" column="phone" />
|
||||
<result property="reviewStatus" column="review_status" />
|
||||
<result property="orderStartDate" column="order_start_date" />
|
||||
<result property="orderEndDate" column="order_end_date" />
|
||||
<result property="nutritionistId" column="nutritionist_id" />
|
||||
<result property="nutritionist" column="nutritionist" />
|
||||
<result property="nutritionistAssisId" column="nutritionist_assis_id" />
|
||||
<result property="nutritionistAssis" column="nutritionist_assis" />
|
||||
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
||||
<result property="customer" column="customer"/><!-- 客户姓名 -->
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="reviewStatus" column="review_status"/>
|
||||
<result property="orderStartDate" column="order_start_date"/>
|
||||
<result property="orderEndDate" column="order_end_date"/>
|
||||
<result property="nutritionistId" column="nutritionist_id"/>
|
||||
<result property="nutritionist" column="nutritionist"/>
|
||||
<result property="nutritionistAssisId" column="nutritionist_assis_id"/>
|
||||
<result property="nutritionistAssis" column="nutritionist_assis"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
<sql id="selectSysRecipesPlanVo">
|
||||
select id, order_id, cus_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, create_time, create_by, update_time, update_by, del_flag, review_status from sys_recipes_plan
|
||||
</sql>
|
||||
|
||||
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
<include refid="selectSysRecipesPlanVo"/> where del_flag = 0
|
||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
<if test="cusId != null "> and cus_id = #{cusId}</if>
|
||||
<if test="startDate != null "> and start_date = #{startDate}</if>
|
||||
<if test="endDate != null "> and end_date = #{endDate}</if>
|
||||
<if test="startNumDay != null "> and start_num_day = #{startNumDay}</if>
|
||||
<if test="endNumDay != null "> and end_num_day = #{endNumDay}</if>
|
||||
<if test="recipesId != null "> and recipes_id = #{recipesId}</if>
|
||||
<if test="sendFlag != null "> and send_flag = #{sendFlag}</if>
|
||||
<if test="sendTime != null "> and send_time = #{sendTime}</if>
|
||||
<if test="reviewStatus != null "> and review_status = #{reviewStatus}</if>
|
||||
<include refid="selectSysRecipesPlanVo"/>
|
||||
where del_flag = 0
|
||||
<if test="orderId != null ">and order_id = #{orderId}</if>
|
||||
<if test="cusId != null ">and cus_id = #{cusId}</if>
|
||||
<if test="startDate != null ">and start_date = #{startDate}</if>
|
||||
<if test="endDate != null ">and end_date = #{endDate}</if>
|
||||
<if test="startNumDay != null ">and start_num_day = #{startNumDay}</if>
|
||||
<if test="endNumDay != null ">and end_num_day = #{endNumDay}</if>
|
||||
<if test="recipesId != null ">and recipes_id = #{recipesId}</if>
|
||||
<if test="sendFlag != null ">and send_flag = #{sendFlag}</if>
|
||||
<if test="sendTime != null ">and send_time = #{sendTime}</if>
|
||||
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
|
||||
<!-- 请勿轻易修改排序方式,会影响食谱生成等逻辑 -->
|
||||
order by id ASC
|
||||
</select>
|
||||
|
||||
<select id="selectSysRecipesPlanById" parameterType="Long" resultMap="SysRecipesPlanResult">
|
||||
@ -58,11 +61,18 @@
|
||||
where id = #{id} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询是否存在该用户最后一天食谱 -->
|
||||
<select id="getLastDayRecipesPlan" resultMap="SysRecipesPlanResult" parameterType="Long">
|
||||
<include refid="selectSysRecipesPlanVo"/>
|
||||
where cus_id = #{customerId} and del_flag = 0 order by end_num_day DESC limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertSysRecipesPlan" parameterType="SysRecipesPlan" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_recipes_plan
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="orderId != null">order_id,</if>
|
||||
<if test="cusId != null">cus_id,</if>
|
||||
<if test="outId != null">out_id,</if>
|
||||
<if test="startDate != null">start_date,</if>
|
||||
<if test="endDate != null">end_date,</if>
|
||||
<if test="startNumDay != null">start_num_day,</if>
|
||||
@ -80,6 +90,7 @@
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderId != null">#{orderId},</if>
|
||||
<if test="cusId != null">#{cusId},</if>
|
||||
<if test="outId != null">#{outId},</if>
|
||||
<if test="startDate != null">#{startDate},</if>
|
||||
<if test="endDate != null">#{endDate},</if>
|
||||
<if test="startNumDay != null">#{startNumDay},</if>
|
||||
@ -101,6 +112,7 @@
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="orderId != null">order_id = #{orderId},</if>
|
||||
<if test="cusId != null">cus_id = #{cusId},</if>
|
||||
<if test="outId != null">out_id = #{outId},</if>
|
||||
<if test="startDate != null">start_date = #{startDate},</if>
|
||||
<if test="endDate != null">end_date = #{endDate},</if>
|
||||
<if test="startNumDay != null">start_num_day = #{startNumDay},</if>
|
||||
@ -132,39 +144,45 @@
|
||||
<!-- 批量插入食谱计划 -->
|
||||
<insert id="insertBatch">
|
||||
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
|
||||
<foreach collection ="list" item="plan" separator =",">
|
||||
(#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay}, #{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
|
||||
</foreach >
|
||||
<foreach collection="list" item="plan" separator=",">
|
||||
(#{plan.orderId}, #{plan.cusId}, #{plan.outId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay},
|
||||
#{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据订单ID删除对应食谱计划 -->
|
||||
<update id="delRecipesPlanByOrderId" parameterType="String">
|
||||
delete from sys_recipes_plan where order_id in
|
||||
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||
delete from sys_recipes_plan where order_id in
|
||||
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 食谱计划、订单表联查 -->
|
||||
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone,
|
||||
SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone,
|
||||
su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,
|
||||
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
|
||||
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
|
||||
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND su_nutritionist_assis.del_flag = 0
|
||||
WHERE srp.del_flag = 0 and sr.del_flag = 0
|
||||
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
||||
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer, srp.review_status
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
|
||||
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
|
||||
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND su_nutritionist_assis.del_flag = 0
|
||||
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.type = 0
|
||||
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like concat('%',#{customer},'%'))</if>
|
||||
<if test="nutritionistId != null">AND su_nutritionist.user_id = #{nutritionistId}</if>
|
||||
<if test="nutritionistAssisId != null">AND su_nutritionist_assis.user_id = #{nutritionistAssisId}</if>
|
||||
<if test="startDate != null and endDate != null ">AND srp.start_date BETWEEN date_format(#{startDate},'%y%m%d') AND date_format(#{endDate},'%y%m%d') </if>
|
||||
ORDER BY srp.order_id DESC,srp.id ASC
|
||||
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like
|
||||
concat('%',#{customer},'%'))
|
||||
</if>
|
||||
<if test="nutritionistId != null">AND su_nutritionist.user_id = #{nutritionistId}</if>
|
||||
<if test="nutritionistAssisId != null">AND su_nutritionist_assis.user_id = #{nutritionistAssisId}</if>
|
||||
<if test="reviewStatus != null">AND srp.review_status = #{reviewStatus}</if>
|
||||
<if test="startDate != null and endDate != null ">AND srp.start_date BETWEEN date_format(#{startDate},'%y%m%d')
|
||||
AND date_format(#{endDate},'%y%m%d')
|
||||
</if>
|
||||
ORDER BY srp.order_id DESC,srp.id ASC
|
||||
</select>
|
||||
<!-- 食谱计划、订单表联查 -->
|
||||
<!--<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
@ -186,17 +204,18 @@
|
||||
|
||||
<!-- 根据订单ID查询食谱计划 -->
|
||||
<select id="selectPlanListByOrderId" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
SELECT srp.id,srp.order_id,sr.customer,sr.phone, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.order_id = #{orderId}
|
||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||
ORDER BY srp.id ASC
|
||||
SELECT srp.id,srp.order_id,sr.customer,sr.phone, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.order_id = #{orderId}
|
||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||
ORDER BY srp.id ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据outId查询食谱计划-->
|
||||
<select id="selectPlanListByOutId" parameterType="String" resultMap="SysRecipesPlanResult">
|
||||
select cus_id, recipes_id, start_num_day, end_num_day from sys_recipes_plan where out_id=#{outId} order by create_time desc
|
||||
<!-- 根据cusId查询食谱计划-->
|
||||
<select id="selectPlanListByCusId" parameterType="Long" resultMap="SysRecipesPlanResult">
|
||||
select id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, review_status from sys_recipes_plan
|
||||
where cus_id=#{cusId} order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
|
||||
@ -204,14 +223,15 @@
|
||||
</select>
|
||||
|
||||
<resultMap id="SysRecipesPlanListInfoResult" type="SysRecipesPlanListInfo">
|
||||
<result property="id" column="id" />
|
||||
<result property="startDate" column="start_date" />
|
||||
<result property="endDate" column="end_date" />
|
||||
<result property="startNumDay" column="start_num_day" />
|
||||
<result property="endNumDay" column="end_num_day" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="startDate" column="start_date"/>
|
||||
<result property="endDate" column="end_date"/>
|
||||
<result property="startNumDay" column="start_num_day"/>
|
||||
<result property="endNumDay" column="end_num_day"/>
|
||||
<association property="menus" column="recipes_id" select="selectMenuIds"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通过outId查询食谱计划简要-->
|
||||
<select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult">
|
||||
select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId}
|
||||
</select>
|
||||
@ -224,4 +244,12 @@
|
||||
<select id="selectMenuIds" parameterType="Long" resultMap="SysRecipesResult">
|
||||
select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} order by num_day asc
|
||||
</select>
|
||||
|
||||
<!-- 批量修改食谱计划 -->
|
||||
<update id="updateMuchRecipesPlanDate" parameterType="SysRecipesPlan">
|
||||
<!--<foreach collection="list" item="item" separator=";" open="" close="">
|
||||
|
||||
</foreach>-->
|
||||
update sys_recipes_plan set start_date = #{startDate},end_date = #{endDate} where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysRecipesPlanModelMapper">
|
||||
|
||||
<resultMap type="SysRecipesPlanModel" id="SysRecipesModelResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="planId" column="plan_id"/>
|
||||
<result property="nutritionistId" column="nutritionist_id"/>
|
||||
<result property="nutriAssisId" column="nutri_assis_id"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="recipesId" column="recipes_id"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectRecipesModelListByCondition" parameterType="SysRecipesPlanModel" resultMap="SysRecipesModelResult">
|
||||
select srpm.id, srpm.nutritionist_id, srpm.nutri_assis_id, srpm.remark, srpm.update_time,
|
||||
srpm.create_time, srpm.update_by, srpm.create_by, srpm.plan_id, srp.recipes_id, srp.review_status
|
||||
from sys_recipes_plan_model srpm
|
||||
left join sys_recipes_plan srp on srp.id = srpm.plan_id
|
||||
where del_flag = 0
|
||||
<if test="nutriAssisId != null ">and nutri_assis_id = #{nutriAssisId}</if>
|
||||
<if test="nutritionistId != null ">and nutritionist_id = #{nutritionistId}</if>
|
||||
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
|
||||
order by srpm.create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="insertRecipsesModel" parameterType="SysRecipesPlanModel" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_recipes_plan_model
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="nutriAssisId != null">nutri_assis_id,</if>
|
||||
<if test="nutritionistId != null">nutritionist_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="reviewStatus != null">review_status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="nutriAssisId != null">#{nutriAssisId},</if>
|
||||
<if test="nutritionistId != null">#{nutritionistId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRecipesModel" parameterType="SysRecipesPlanModel">
|
||||
update sys_recipes_plan_model
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="nutriAssisId != null">nutri_assis_id = #{nutriAssisId},</if>
|
||||
<if test="nutritionistId != null">nutritionist_id = #{nutritionistId},</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>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="removeRecipesModel" parameterType="Long">
|
||||
update sys_recipes_plan_model set del_flag=1 where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -61,4 +61,14 @@ export function download(fileName) {
|
||||
})
|
||||
}
|
||||
|
||||
// 生成健康体征报告
|
||||
export function generateHealthyReport(healthyDetail) {
|
||||
return request({
|
||||
url: '/custom/healthy/generateHealthyReport',
|
||||
method: 'post',
|
||||
data: healthyDetail
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,36 +1,43 @@
|
||||
import request from '@/utils/request'
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 查询食谱计划列表
|
||||
export function listRecipesPlan(query) {
|
||||
return request({
|
||||
url: '/recipes/recipesPlan/list',
|
||||
method: 'get',
|
||||
url: "/recipes/recipesPlan/list",
|
||||
method: "get",
|
||||
params: query
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 查询食谱计划详细
|
||||
export function getRecipesPlan(id) {
|
||||
return request({
|
||||
url: '/recipes/recipesPlan/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
url: "/recipes/recipesPlan/" + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 修改食谱计划
|
||||
export function updateRecipesPlan(data) {
|
||||
return request({
|
||||
url: '/recipes/recipesPlan',
|
||||
method: 'put',
|
||||
url: "/recipes/recipesPlan",
|
||||
method: "put",
|
||||
data: data
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 导出食谱计划
|
||||
export function exportRecipesPlan(query) {
|
||||
return request({
|
||||
url: '/recipes/recipesPlan/export',
|
||||
method: 'get',
|
||||
url: "/recipes/recipesPlan/export",
|
||||
method: "get",
|
||||
params: query
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export function listRecipesPlanByCusId(id) {
|
||||
return request({
|
||||
url: "/recipes/recipesPlan/list/" + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
33
stdiet-ui/src/api/custom/recipesPlanModel.js
Normal file
33
stdiet-ui/src/api/custom/recipesPlanModel.js
Normal file
@ -0,0 +1,33 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function listRecipesModel(query) {
|
||||
return request({
|
||||
url: "/recipes/model/list",
|
||||
method: "get",
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
export function addRecipesModel(data){
|
||||
return request({
|
||||
url: "/recipes/model/add",
|
||||
method: "post",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function updateRecipesModel(data) {
|
||||
return request({
|
||||
url: "/recipes/model/update",
|
||||
method: "put",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function deleteRecipesModel(id) {
|
||||
return request({
|
||||
url: "/recipes/model/delete/" + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
@ -3,6 +3,8 @@
|
||||
<div v-if="showFlag">
|
||||
<div style="float:right;margin-top:-10px;margin-bottom: 10px;" v-show="dataList.length > 0">
|
||||
<!-- 只有新版健康评估信息才可修改,旧的体征数据不支持修改 -->
|
||||
<el-button type="info" v-show="dataType == 0" @click="generateReport()" plain>下载报告</el-button>
|
||||
<el-button type="info" v-show="dataType == 0" @click="handleEditGuidanceClick()" plain>减脂指导</el-button>
|
||||
<el-button v-hasPermi="['custom:healthy:edit']" type="info" v-show="dataType == 0" @click="handleEditRemarkClick()" plain>修改备注</el-button>
|
||||
<el-button v-hasPermi="['custom:healthy:edit']" type="warning" v-show="dataType == 0" @click="handleEditHealthyClick()" plain>修改信息</el-button>
|
||||
<el-button type="danger" v-hasPermi="['custom:healthy:remove']" @click="handleDelete()" plain>删除信息</el-button>
|
||||
@ -24,6 +26,15 @@
|
||||
<auto-hide-message :data="scope.row.remarkValue" :maxLength="100"/></template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 指导 -->
|
||||
<el-table :data="guidanceList" :show-header="false" border :cell-style="remarkColumnStyle" style="width: 100%;">
|
||||
<el-table-column width="140" prop="guidanceTitle">
|
||||
</el-table-column>
|
||||
<el-table-column prop="guidanceValue">
|
||||
<template slot-scope="scope">
|
||||
<auto-hide-message :data="scope.row.guidanceValue" :maxLength="100"/></template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- 其他信息 -->
|
||||
<div style="height:400px;overflow: auto">
|
||||
@ -71,23 +82,28 @@
|
||||
<physicalSigns-edit ref="physicalSignsEditDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-edit>
|
||||
<!-- 编辑备注 -->
|
||||
<physicalSigns-remark ref="physicalSignsRemarkDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-remark>
|
||||
<!-- 编辑减脂指导 -->
|
||||
<physicalSigns-guidance ref="physicalSignsGuidanceDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-guidance>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { getCustomerPhysicalSignsByCusId,delCustomerHealthy } from "@/api/custom/customer";
|
||||
import { generateHealthyReport } from "@/api/custom/healthy";
|
||||
import TableDetailMessage from "@/components/TableDetailMessage";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import * as healthyData from "@/utils/healthyData";
|
||||
import Clipboard from 'clipboard';
|
||||
import PhysicalSignsEdit from "@/components/PhysicalSignsEdit";
|
||||
import PhysicalSignsRemark from "@/components/PhysicalSignsRemark";
|
||||
import PhysicalSignsGuidance from "@/components/PhysicalSignsGuidance";
|
||||
export default {
|
||||
name: "PhysicalSignsDialog",
|
||||
components: {
|
||||
"auto-hide-message": AutoHideMessage,
|
||||
"table-detail-message": TableDetailMessage,
|
||||
"physicalSigns-edit":PhysicalSignsEdit,
|
||||
"physicalSigns-remark":PhysicalSignsRemark
|
||||
"physicalSigns-remark":PhysicalSignsRemark,
|
||||
"physicalSigns-guidance":PhysicalSignsGuidance
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -99,6 +115,7 @@ export default {
|
||||
dataType: 0,
|
||||
healthyData: null,
|
||||
remarkList:[{"remarkTitle": "备注信息", "remarkValue": ""}],
|
||||
guidanceList:[{"guidanceTitle": "减脂指导", "guidanceValue": ""}],
|
||||
// 体征标题
|
||||
signTitleData: [
|
||||
["创建时间", "姓名", "年龄"],
|
||||
@ -203,7 +220,8 @@ export default {
|
||||
["medicalReport_one","medicalReport_two","medicalReport_three"]
|
||||
]
|
||||
],
|
||||
copyValue: ""
|
||||
copyValue: "",
|
||||
detailHealthy: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -239,6 +257,7 @@ export default {
|
||||
if(this.dataType == 0){
|
||||
this.healthyData = Object.assign({}, res.data.customerHealthy);
|
||||
this.remarkList[0].remarkValue = this.healthyData.remark;
|
||||
this.guidanceList[0].guidanceValue = this.healthyData.guidance;
|
||||
this.getDataListByHealthyMessage(res.data.customerHealthy);
|
||||
}else{
|
||||
this.getDataListBySignMessage(res.data.customerHealthy)
|
||||
@ -252,6 +271,7 @@ export default {
|
||||
onClosed() {
|
||||
this.dataList = [];
|
||||
this.data = null;
|
||||
this.detailHealthy = null;
|
||||
//this.enc_id = "";
|
||||
this.copyValue = "";
|
||||
},
|
||||
@ -358,7 +378,7 @@ export default {
|
||||
});
|
||||
}
|
||||
detailHealthy.motion = this.trimComma(motionStr + (detailHealthy.otherMotionClassify ? ( ","+ detailHealthy.otherMotionClassify) : ""));
|
||||
detailHealthy.motionField += this.trimComma(detailHealthy.otherMotionField ? (","+detailHealthy.otherMotionField) : "");
|
||||
detailHealthy.motionField = this.trimComma(detailHealthy.motionField + (detailHealthy.otherMotionField ? (","+detailHealthy.otherMotionField) : ""));
|
||||
detailHealthy.sleepDrugFlag = detailHealthy.sleepDrugFlag == 1 ? "有" : "无";
|
||||
detailHealthy.stayupLateFlag = detailHealthy.stayupLateFlag == 1 ? "有" : "无";
|
||||
detailHealthy.stayupLateWeekNum += "次/周";
|
||||
@ -370,20 +390,20 @@ export default {
|
||||
}*/
|
||||
physicalSigns += "," + (detailHealthy.otherPhysicalSigns ? detailHealthy.otherPhysicalSigns : "");
|
||||
detailHealthy.physicalSigns = this.trimComma(physicalSigns);
|
||||
detailHealthy.familyIllnessHistory += this.trimComma(detailHealthy.otherFamilyIllnessHistory ? ("," + detailHealthy.otherFamilyIllnessHistory) : "");
|
||||
detailHealthy.operationHistory += this.trimComma(detailHealthy.otherOperationHistory ? ("," + detailHealthy.otherOperationHistory) : "");
|
||||
detailHealthy.familyIllnessHistory = this.trimComma(detailHealthy.familyIllnessHistory + ","+ (detailHealthy.otherFamilyIllnessHistory ? detailHealthy.otherFamilyIllnessHistory : ""));
|
||||
detailHealthy.operationHistory = this.trimComma(detailHealthy.operationHistory + ","+ (detailHealthy.otherOperationHistory ? detailHealthy.otherOperationHistory : ""));
|
||||
detailHealthy.nearOperationFlag = detailHealthy.nearOperationFlag == 1 ? "有" : "无";
|
||||
detailHealthy.longEatDrugFlag = detailHealthy.longEatDrugFlag == 1 ? "有" : "无";
|
||||
detailHealthy.longEatDrugClassify += detailHealthy.otherLongEatDrugClassify ? ("," + detailHealthy.otherLongEatDrugClassify) : "";
|
||||
detailHealthy.longEatDrugClassify = this.trimComma(detailHealthy.longEatDrugClassify + "," + (detailHealthy.otherLongEatDrugClassify ? detailHealthy.otherLongEatDrugClassify : ""));
|
||||
detailHealthy.allergyFlag = detailHealthy.allergyFlag == 1 ? "有" : "无";
|
||||
detailHealthy.allergen += detailHealthy.otherAllergen ? ("," +detailHealthy.otherAllergen) : "";
|
||||
detailHealthy.allergen = this.trimComma(detailHealthy.allergen);
|
||||
detailHealthy.allergen = this.trimComma(detailHealthy.allergen + "," + (detailHealthy.otherAllergen ? detailHealthy.otherAllergen : ""));
|
||||
let medicalReportPathArray = detailHealthy.medicalReport ? detailHealthy.medicalReport.split(",") : [];
|
||||
let medicalReportNameArray = detailHealthy.medicalReportName ? detailHealthy.medicalReportName.split(",") : [];
|
||||
this.medicalReportPathArray = medicalReportPathArray;
|
||||
detailHealthy.medicalReport_one = medicalReportPathArray.length > 0 ? (medicalReportNameArray.length > 0 ? medicalReportNameArray[0] : "体检报告(1)") : "";
|
||||
detailHealthy.medicalReport_two = medicalReportPathArray.length > 1 ? (medicalReportNameArray.length > 1 ? medicalReportNameArray[1] : "体检报告(2)") : "";
|
||||
detailHealthy.medicalReport_three = medicalReportPathArray.length > 2 ? (medicalReportNameArray.length > 2 ? medicalReportNameArray[2] : "体检报告(3)") : "";
|
||||
this.detailHealthy = detailHealthy;
|
||||
for(let i = 0; i < this.healthyTitleData.length; i++){
|
||||
let stepArray = [];
|
||||
for(let j= 0; j < this.healthyTitleData[i].length; j++){
|
||||
@ -426,6 +446,28 @@ export default {
|
||||
downloadFile(fileName){
|
||||
this.downloadResource(fileName);
|
||||
},
|
||||
generateReport(){
|
||||
let data = this.detailHealthy;
|
||||
if(!this.guidanceList[0].guidanceValue || this.guidanceList[0].guidanceValue.length == 0){
|
||||
this.$confirm("该客户还未添加减脂指导,是否确认下载报告?", "警告", {
|
||||
confirmButtonText: "确定", cancelButtonText: "取消", type: "warning"
|
||||
})
|
||||
.then(function(){
|
||||
return generateHealthyReport(data);
|
||||
})
|
||||
.then((response) => {
|
||||
if(response.code == 200 && response.path != null){
|
||||
this.download(response.path);
|
||||
}
|
||||
}).catch(function () {});
|
||||
}else{
|
||||
generateHealthyReport(data).then((res) => {
|
||||
if(res.code == 200 && res.path != null){
|
||||
this.download(res.path);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
trimComma(str){
|
||||
if(str.startsWith(",") || str.startsWith(",")){
|
||||
str = str.substring(1,str.length);
|
||||
@ -467,7 +509,11 @@ export default {
|
||||
},
|
||||
handleEditRemarkClick(){
|
||||
this.$refs["physicalSignsRemarkDialog"].showDialog(this.data, this.healthyData);
|
||||
},
|
||||
handleEditGuidanceClick(){
|
||||
this.$refs["physicalSignsGuidanceDialog"].showDialog(this.data, this.healthyData);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
88
stdiet-ui/src/components/PhysicalSignsGuidance/index.vue
Normal file
88
stdiet-ui/src/components/PhysicalSignsGuidance/index.vue
Normal file
@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<el-dialog :visible.sync="visible" :title="title" width="500px" append-to-body @closed="onClosed">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-position="top" label-width="100px">
|
||||
<el-form-item label="" prop="guidance" >
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="8"
|
||||
maxlength="300"
|
||||
show-word-limit
|
||||
placeholder="请输入减脂指导"
|
||||
v-model="form.guidance">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submit()">确 定</el-button>
|
||||
<el-button @click="onClosed()">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
||||
import { updateHealthy } from "@/api/custom/healthy";
|
||||
export default {
|
||||
name: "PhysicalSignsGuidance",
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
title: "",
|
||||
data: undefined,
|
||||
form: {
|
||||
id: null,
|
||||
guidance: null
|
||||
},
|
||||
rules: {
|
||||
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
showDialog(data, healthy) {
|
||||
this.data = data;
|
||||
this.title = "修改"+`「${data.name}」`+"减脂指导";
|
||||
this.form.id = healthy.id;
|
||||
this.form.guidance = healthy.guidance;
|
||||
this.visible = true;
|
||||
},
|
||||
onClosed() {
|
||||
this.visible = false;
|
||||
this.data = null;
|
||||
},
|
||||
submit(){
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.editCustomerHealthy();
|
||||
} else {
|
||||
this.$message({message: "数据未填写完整", type: "warning"});
|
||||
}
|
||||
});
|
||||
},
|
||||
editCustomerHealthy(){
|
||||
updateHealthy(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.onClosed();
|
||||
this.$emit('refreshHealthyData');
|
||||
}
|
||||
}).catch(function() {
|
||||
console.log("error");
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.margin-top-20{
|
||||
margin-top:20px;
|
||||
}
|
||||
.p_title_1{
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
@ -6,19 +6,60 @@
|
||||
@closed="handleOnClosed"
|
||||
size="40%"
|
||||
>
|
||||
<div class="app-container">
|
||||
<div class="app-container recipes_plan_drawer_wrapper">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-if="cusOutId"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
icon="el-icon-share"
|
||||
size="mini"
|
||||
@click="handleInnerOpen"
|
||||
class="copyBtn"
|
||||
:data-clipboard-text="copyValue"
|
||||
@click="handleOnRecipesLinkClick"
|
||||
>客户食谱链接
|
||||
</el-button>
|
||||
|
||||
<el-button icon="el-icon-view" size="mini" @click="handleInnerOpen"
|
||||
>查看暂停记录
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="planList" v-loading="planLoading" height="90%">
|
||||
<el-table-column label="审核状态" align="center" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.reviewStatus ? 'success' : 'danger'">{{
|
||||
`${scope.row.reviewStatus ? "已审核" : "未审核"}`
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ `第${scope.row.startNumDay} 至 ${scope.row.endNumDay}天` }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="日期" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ `${scope.row.startDate} 至 ${scope.row.endDate}` }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
:icon="
|
||||
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||
"
|
||||
@click="handleOnRecipesEditClick(scope.row)"
|
||||
>
|
||||
{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 暂停记录抽屉 -->
|
||||
<el-drawer
|
||||
:title="innerTitle"
|
||||
:append-to-body="true"
|
||||
@ -34,7 +75,7 @@
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleInnerOpen"
|
||||
>查看暂停记录
|
||||
>增加暂停记录
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -44,6 +85,8 @@
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import Clipboard from "clipboard";
|
||||
import { listRecipesPlanByCusId } from "@/api/custom/recipesPlan";
|
||||
export default {
|
||||
name: "RecipesPlanDrawer",
|
||||
data() {
|
||||
@ -52,25 +95,59 @@ export default {
|
||||
innerVisible: false,
|
||||
title: "",
|
||||
innerTitle: "",
|
||||
cusOutId: "",
|
||||
copyValue: "",
|
||||
planLoading: false,
|
||||
planList: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
showDrawer(data) {
|
||||
// console.log(data);
|
||||
this.data = data;
|
||||
if (!this.data) {
|
||||
return;
|
||||
}
|
||||
this.visible = true;
|
||||
this.title = `「${this.data.name}」食谱计划`;
|
||||
this.planLoading = true;
|
||||
listRecipesPlanByCusId(data.id).then((response) => {
|
||||
this.planList = response.data;
|
||||
this.cusOutId = response.data.reduce((str, cur) => {
|
||||
if (!str && cur.recipesId) {
|
||||
str = cur.outId;
|
||||
}
|
||||
return str;
|
||||
}, "");
|
||||
console.log(this.planList);
|
||||
this.planLoading = false;
|
||||
});
|
||||
},
|
||||
handleOnClosed() {
|
||||
this.data = undefined;
|
||||
this.cusOutId = "";
|
||||
},
|
||||
handleInnerOpen() {
|
||||
this.innerVisible = true;
|
||||
this.innerTitle = `「${this.data.name}」暂停记录`;
|
||||
},
|
||||
handleOnRecipesLinkClick() {
|
||||
this.copyValue =
|
||||
window.location.origin.replace("manage", "sign") +
|
||||
"/recipes/detail/" +
|
||||
this.cusOutId;
|
||||
new Clipboard(".copyBtn");
|
||||
this.$message({
|
||||
message: "拷贝成功",
|
||||
type: "success",
|
||||
});
|
||||
},
|
||||
handleOnInnerClosed() {},
|
||||
handleOnRecipesEditClick(data) {
|
||||
// console.log(data);
|
||||
const { id, name } = this.data;
|
||||
window.open("/recipes/build/" + name + "/" + id, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -78,4 +155,8 @@ export default {
|
||||
/deep/ :focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.recipes_plan_drawer_wrapper {
|
||||
height: calc(100vh - 77px);
|
||||
}
|
||||
</style>
|
||||
|
@ -140,9 +140,10 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: "/recipes/build",
|
||||
path: "/recipes/build/:name/:planId",
|
||||
component: resolve => require(["@/views/custom/recipesBuild"], resolve),
|
||||
name: "RecipiesBuild",
|
||||
props: true,
|
||||
meta: { title: "食谱制作" },
|
||||
hidden: true
|
||||
},
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
deleteDishesApi,
|
||||
addRecipesApi
|
||||
} from "@/api/custom/recipes";
|
||||
import { getRecipesPlan, updateRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
|
||||
const oriState = {
|
||||
@ -23,7 +24,8 @@ const oriState = {
|
||||
typeOptions: [],
|
||||
currentDay: -1,
|
||||
startNum: 0,
|
||||
endNum: 0
|
||||
endNum: 0,
|
||||
reviewStatus: 0
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
@ -72,32 +74,55 @@ const mutations = {
|
||||
|
||||
const actions = {
|
||||
async init({ commit, dispatch }, payload) {
|
||||
return new Promise((res, rej) => {
|
||||
// console.log(payload);
|
||||
//
|
||||
commit("updateStateData", payload);
|
||||
//
|
||||
getDicts("cus_cus_unit").then(response => {
|
||||
commit("updateStateData", { cusUnitOptions: response.data });
|
||||
});
|
||||
getDicts("cus_cus_weight").then(response => {
|
||||
commit("updateStateData", { cusWeightOptions: response.data });
|
||||
});
|
||||
getDicts("cus_dishes_type").then(response => {
|
||||
commit("updateStateData", { typeOptions: response.data });
|
||||
});
|
||||
// console.log(payload);
|
||||
const planResponse = await getRecipesPlan(payload.planId);
|
||||
const {
|
||||
startNumDay,
|
||||
endNumDay,
|
||||
recipesId,
|
||||
cusId,
|
||||
reviewStatus
|
||||
} = planResponse.data;
|
||||
commit("updateStateData", {
|
||||
cusId,
|
||||
recipesId,
|
||||
reviewStatus,
|
||||
planId: payload.planId,
|
||||
startNum: startNumDay,
|
||||
endNum: endNumDay
|
||||
});
|
||||
|
||||
getDicts("cus_cus_unit").then(response => {
|
||||
commit("updateStateData", { cusUnitOptions: response.data });
|
||||
});
|
||||
getDicts("cus_cus_weight").then(response => {
|
||||
commit("updateStateData", { cusWeightOptions: response.data });
|
||||
});
|
||||
getDicts("cus_dishes_type").then(response => {
|
||||
commit("updateStateData", { typeOptions: response.data });
|
||||
});
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
// 健康数据
|
||||
if (payload.cusId) {
|
||||
dispatch("getHealthyData", payload).catch(err => rej(err));
|
||||
if (cusId) {
|
||||
dispatch("getHealthyData", { cusId }).catch(err => rej(err));
|
||||
}
|
||||
|
||||
// 食谱数据
|
||||
if (payload.recipesId) {
|
||||
dispatch("getRecipesInfo", payload).catch(err => rej(err));
|
||||
if (recipesId) {
|
||||
dispatch("getRecipesInfo", { recipesId }).catch(err => rej(err));
|
||||
}
|
||||
});
|
||||
},
|
||||
async updateReviewStatus({ commit, state }, payload) {
|
||||
const response = await updateRecipesPlan({
|
||||
id: state.planId,
|
||||
reviewStatus: payload.reviewStatus
|
||||
});
|
||||
if (response.code === 200) {
|
||||
commit("updateStateData", payload);
|
||||
}
|
||||
},
|
||||
async getHealthyData({ commit }, payload) {
|
||||
commit("updateStateData", { healthDataLoading: true });
|
||||
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
|
||||
@ -127,16 +152,14 @@ const actions = {
|
||||
const recipesDataResult = await getRecipesApi(payload.recipesId);
|
||||
let recipesData = [];
|
||||
if (recipesDataResult.code === 200) {
|
||||
const { endNum, startNum } = state;
|
||||
let length = null;
|
||||
if (endNum && startNum) {
|
||||
length = endNum - startNum;
|
||||
}
|
||||
const { endNum, startNum, recipesId } = state;
|
||||
// 计算
|
||||
let length = endNum - startNum;
|
||||
recipesData = recipesDataResult.data.reduce((outArr, dayData, idx) => {
|
||||
if (!length || (length && length >= idx)) {
|
||||
if (!recipesId || length >= idx) {
|
||||
outArr.push({
|
||||
id: dayData.id,
|
||||
numDay: startNum ? startNum + idx : dayData.numDay,
|
||||
numDay: !recipesId ? startNum + idx : dayData.numDay,
|
||||
dishes: dayData.dishes.reduce((arr, cur) => {
|
||||
if (
|
||||
cur.dishesId > -1 &&
|
||||
|
@ -29,7 +29,6 @@ service.interceptors.request.use(config => {
|
||||
service.interceptors.response.use(res => {
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.data.code || 200;
|
||||
console.log(res)
|
||||
// 获取错误信息
|
||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||
if (code === 401) {
|
||||
|
@ -4,6 +4,31 @@
|
||||
:style="`height: ${collapse ? 30 : 200}px`"
|
||||
>
|
||||
<div class="header">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
trigger="click"
|
||||
title="修改审核状态"
|
||||
style="margin-right: 12px"
|
||||
v-hasPermi="['recipes:recipesPlan:review']"
|
||||
>
|
||||
<div>
|
||||
<el-button size="mini" type="success" @click="hanldeOnReveiwChange(2)"
|
||||
>审核通过</el-button
|
||||
>
|
||||
<el-button size="mini" type="danger" @click="hanldeOnReveiwChange(1)"
|
||||
>未审核通过</el-button
|
||||
>
|
||||
</div>
|
||||
<el-button
|
||||
slot="reference"
|
||||
size="mini"
|
||||
v-if="reviewStatus"
|
||||
@click="handleReview"
|
||||
:type="reviewStatus === 1 ? 'danger' : 'success'"
|
||||
>
|
||||
{{ reviewStatus === 1 ? "未审核" : "已审核" }}
|
||||
</el-button>
|
||||
</el-popover>
|
||||
<el-button
|
||||
v-if="!recipesId"
|
||||
size="mini"
|
||||
@ -11,9 +36,15 @@
|
||||
@click="handleOnSave"
|
||||
>生成食谱</el-button
|
||||
>
|
||||
<el-button size="mini" type="text" @click="handleCollapseClick">{{
|
||||
`${collapse ? "展开分析" : "收起分析"}`
|
||||
}}</el-button>
|
||||
<el-button size="mini" type="text" @click="handleCollapseClick">
|
||||
{{ `${collapse ? "展开" : "收起"}` }}
|
||||
<em
|
||||
class="el-icon-arrow-down arrow_icon"
|
||||
:style="
|
||||
collapse ? 'transform: rotate(-180deg);' : 'transform: unset;'
|
||||
"
|
||||
/>
|
||||
</el-button>
|
||||
</div>
|
||||
<div
|
||||
class="content"
|
||||
@ -53,7 +84,7 @@ export default {
|
||||
},
|
||||
props: ["collapse", "data"],
|
||||
computed: {
|
||||
...mapState(["recipesId"]),
|
||||
...mapState(["recipesId", "reviewStatus"]),
|
||||
},
|
||||
methods: {
|
||||
handleCollapseClick() {
|
||||
@ -67,7 +98,10 @@ export default {
|
||||
},
|
||||
});
|
||||
},
|
||||
...mapActions(["saveRecipes"]),
|
||||
hanldeOnReveiwChange(reviewStatus) {
|
||||
this.updateReviewStatus({ reviewStatus });
|
||||
},
|
||||
...mapActions(["saveRecipes", "updateReviewStatus"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -79,6 +113,11 @@ export default {
|
||||
.header {
|
||||
text-align: right;
|
||||
height: 30px;
|
||||
|
||||
.arrow_icon {
|
||||
transition: all 0.3s;
|
||||
transform-origin: center center;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
|
@ -12,7 +12,7 @@
|
||||
<el-table-column prop="type" :width="100" align="center">
|
||||
<template slot="header">
|
||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||
<div>{{ name }}</div>
|
||||
<!-- <div>{{ name }}</div> -->
|
||||
<div>{{ `第${numDay}天` }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="recipes_build_wrapper" v-title :data-title="$route.query.name">
|
||||
<div class="recipes_build_wrapper" v-title :data-title="name">
|
||||
<div class="left" v-loading="recipesDataLoading">
|
||||
<RecipesView
|
||||
v-if="!!recipesData.length"
|
||||
@ -35,14 +35,8 @@ export default {
|
||||
return {};
|
||||
},
|
||||
mounted() {
|
||||
const { cusId, planId, startNum, endNum, recipesId } = this.$route.query;
|
||||
|
||||
this.init({
|
||||
cusId,
|
||||
planId,
|
||||
startNum: parseInt(startNum),
|
||||
endNum: parseInt(endNum),
|
||||
recipesId,
|
||||
planId: this.planId,
|
||||
}).catch((err) => {
|
||||
this.$message.error(err.message);
|
||||
});
|
||||
@ -57,7 +51,7 @@ export default {
|
||||
RecipesView,
|
||||
RecommondView,
|
||||
},
|
||||
// props: ["cusId", "planId", "recipesId", "startDate", "endDate"],
|
||||
props: ["name", "planId"],
|
||||
computed: {
|
||||
...mapState([
|
||||
"healthyData",
|
||||
|
331
stdiet-ui/src/views/custom/recipesModel/index.vue
Normal file
331
stdiet-ui/src/views/custom/recipesModel/index.vue
Normal file
@ -0,0 +1,331 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
>
|
||||
<el-form-item label="营养师" prop="nutritionistId">
|
||||
<el-select
|
||||
v-model="queryParams.nutritionistId"
|
||||
placeholder="请选择营养师"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in nutritionistIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师助理" prop="nutritionistAssisId">
|
||||
<el-select
|
||||
v-model="queryParams.nutritionistAssisId"
|
||||
placeholder="请选择营养师助理"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in nutriAssisIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="reviewStatus">
|
||||
<el-select
|
||||
v-model="queryParams.reviewStatus"
|
||||
placeholder="请选审核状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in reviewStatusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="recipesPlanList">
|
||||
<el-table-column label="审核状态" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="
|
||||
!scope.row.reviewStatus
|
||||
? 'info'
|
||||
: scope.row.reviewStatus === 1
|
||||
? 'danger'
|
||||
: 'success'
|
||||
"
|
||||
>{{
|
||||
`${
|
||||
!scope.row.reviewStatus
|
||||
? "未制作"
|
||||
: scope.row.reviewStatus == 1
|
||||
? "未审核"
|
||||
: "已审核"
|
||||
}`
|
||||
}}</el-tag
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="营养师"
|
||||
align="center"
|
||||
prop="nutritionist"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
label="营养师助理"
|
||||
align="center"
|
||||
width="100"
|
||||
prop="nutritionistAssis"
|
||||
/>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
width="100"
|
||||
prop="create_time"
|
||||
/>
|
||||
<el-table-column label="备注" prop="remark" align="center" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
width="300"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
v-hasPermi="['recipes:recipesPlan:edit']"
|
||||
:icon="`${
|
||||
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||
}`"
|
||||
@click="handleBuild(scope.row)"
|
||||
>{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listRecipesModel,
|
||||
addRecipesModel,
|
||||
updateRecipesModel,
|
||||
deleteRecipesModel,
|
||||
} from "@/api/custom/recipesPlanModel";
|
||||
import dayjs from "dayjs";
|
||||
import store from "@/store";
|
||||
import { mapState } from "vuex";
|
||||
|
||||
const userId = store.getters && store.getters.userId;
|
||||
export default {
|
||||
name: "recipesPlan",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 食谱计划表格数据
|
||||
recipesPlanList: [],
|
||||
orderDialog: undefined,
|
||||
reviewStatusOptions: [
|
||||
{ dictValue: 0, dictLabel: "未制作" },
|
||||
{ dictValue: 1, dictLabel: "未审核" },
|
||||
{ dictValue: 2, dictLabel: "已审核" },
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
nutritionistId: null,
|
||||
nutritionistAssisId: null,
|
||||
reviewStatus: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {},
|
||||
//食谱开始时间范围
|
||||
planStartDateScope: [nextDate, nextDate],
|
||||
//订单对于所有计划安排数据
|
||||
allRecipesPlanList: [],
|
||||
//订单弹窗状态
|
||||
allRecipesPlanOpen: false,
|
||||
allRecipesPlanTitle: "",
|
||||
//订单弹窗中查询参数
|
||||
allRecipesPlanQueryParam: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderId: null,
|
||||
sendFlag: 0,
|
||||
},
|
||||
//订单弹窗中列表数据的总条数
|
||||
allRecipesPlanTotal: 0,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
// "order-dialog": OrderDetail,
|
||||
// body_sign_dialog: BodySignDetail,
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
//营养师
|
||||
nutritionistIdOptions: (state) =>
|
||||
state.global.nutritionistIdOptions.slice(1),
|
||||
//营养师助理
|
||||
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
nutritionistIdOptions: function (val, oldVal) {
|
||||
if (val.length && !oldVal.length) {
|
||||
const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||
if (tarObj) {
|
||||
this.queryParams.nutritionistId = userId;
|
||||
}
|
||||
}
|
||||
},
|
||||
nutriAssisIdOptions: function (val, oldVal) {
|
||||
if (val.length && !oldVal.length) {
|
||||
const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||
if (tarObj) {
|
||||
this.queryParams.nutritionistAssisId = userId;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询食谱计划列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (
|
||||
this.planStartDateScope != null &&
|
||||
this.planStartDateScope.length > 0
|
||||
) {
|
||||
this.queryParams.startDate = dayjs(this.planStartDateScope[0]).format(
|
||||
"YYYY-MM-DD"
|
||||
);
|
||||
this.queryParams.endDate = dayjs(this.planStartDateScope[1]).format(
|
||||
"YYYY-MM-DD"
|
||||
);
|
||||
} else {
|
||||
this.queryParams.startDate = null;
|
||||
this.queryParams.endDate = null;
|
||||
}
|
||||
listRecipesPlan(this.queryParams).then((response) => {
|
||||
this.recipesPlanList = response.rows;
|
||||
this.recipesPlanList.forEach(function (item, index) {
|
||||
item.scopeDate =
|
||||
dayjs(item.startDate).format("YYYY-MM-DD") +
|
||||
" 至 " +
|
||||
dayjs(item.endDate).format("YYYY-MM-DD");
|
||||
item.scopeDay = `第${item.startNumDay} 至 ${item.endNumDay}天`;
|
||||
});
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
orderId: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
recipesId: null,
|
||||
sendFlag: null,
|
||||
sendTime: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.planStartDateScope = [nextDate, nextDate];
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm("是否确认导出所有食谱计划数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return exportRecipesPlan(queryParams);
|
||||
})
|
||||
.then((response) => {
|
||||
this.download(response.msg);
|
||||
})
|
||||
.catch(function () {});
|
||||
},
|
||||
handleBuild(data) {
|
||||
// console.log(data);
|
||||
const { id, customer } = data;
|
||||
window.open("/recipes/build/" + customer + "/" + id, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -14,11 +14,7 @@
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="食谱开始日期范围"
|
||||
prop="planStartDateScope"
|
||||
label-width="130px"
|
||||
>
|
||||
<el-form-item label="日期" prop="planStartDateScope">
|
||||
<el-date-picker
|
||||
v-model="planStartDateScope"
|
||||
type="daterange"
|
||||
@ -58,6 +54,21 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="reviewStatus">
|
||||
<el-select
|
||||
v-model="queryParams.reviewStatus"
|
||||
placeholder="请选审核状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in reviewStatusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
@ -78,17 +89,6 @@
|
||||
>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['recipes:recipesPlan:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
@ -99,19 +99,35 @@
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!--<div><span style="margin-left:10px;font-size:16px;color:#E6A23C;font-family:PingFang SC">备注:2021年1月开始的订单才会自动生成食谱计划</span></div>-->
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="recipesPlanList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table v-loading="loading" :data="recipesPlanList">
|
||||
<el-table-column label="审核状态" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="
|
||||
!scope.row.reviewStatus
|
||||
? 'info'
|
||||
: scope.row.reviewStatus === 1
|
||||
? 'danger'
|
||||
: 'success'
|
||||
"
|
||||
>{{
|
||||
`${
|
||||
!scope.row.reviewStatus
|
||||
? "未制作"
|
||||
: scope.row.reviewStatus == 1
|
||||
? "未审核"
|
||||
: "已审核"
|
||||
}`
|
||||
}}</el-tag
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
||||
<el-table-column
|
||||
label="客户手机号"
|
||||
@ -120,15 +136,15 @@
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column
|
||||
label="食谱日期范围"
|
||||
label="计划"
|
||||
align="center"
|
||||
prop="scopeDate"
|
||||
prop="scopeDay"
|
||||
width="200"
|
||||
/>
|
||||
<el-table-column
|
||||
label="食谱天数范围"
|
||||
label="日期"
|
||||
align="center"
|
||||
prop="scopeDay"
|
||||
prop="scopeDate"
|
||||
width="200"
|
||||
/>
|
||||
<el-table-column label="营养师" align="center" prop="nutritionist" />
|
||||
@ -138,26 +154,6 @@
|
||||
prop="nutritionistAssis"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column label="是否发送" align="center" prop="sendFlag">
|
||||
<!--<template slot-scope="scope">
|
||||
<span>{{ scope.row.sendFlag == 1 ? "已发送" : "未发送"}}</span>
|
||||
</template>(.sendFlag == 1) ? 'success' : 'warning'-->
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="getTagType(scope.row)" disable-transitions>
|
||||
{{ scope.row.sendFlag == 1 ? "已发送" : "未发送" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="食谱发送时间"
|
||||
align="center"
|
||||
prop="sendTime"
|
||||
width="180"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.sendTime, "{y}-{m}-{d}") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
@ -168,45 +164,12 @@
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['recipes:recipesPlan:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="
|
||||
allRecipesPlanQueryParam.orderId = scope.row.orderId;
|
||||
getAllPlanByOrderId();
|
||||
"
|
||||
>查看完整计划
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="getOrderDetail(scope.row)"
|
||||
v-hasPermi="['custom:order:query']"
|
||||
>查看订单
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="getCustomerSign(scope.row)"
|
||||
v-hasPermi="['custom:customer:query']"
|
||||
>查看体征
|
||||
</el-button> -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
:icon="`${
|
||||
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||
}`"
|
||||
@click="handleBuild(scope.row)"
|
||||
>{{ `${scope.row.recipesId ? "编辑" : "制作"}食谱` }}</el-button
|
||||
>{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -219,121 +182,11 @@
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改食谱计划对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item
|
||||
label="食谱是否已发送"
|
||||
prop="sendFlag"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-select v-model="form.sendFlag" placeholder="请选择">
|
||||
<el-option label="否" :value="parseInt('0')" />
|
||||
<el-option label="是" :value="parseInt('1')" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看完整计划 -->
|
||||
<el-dialog
|
||||
:title="allRecipesPlanTitle"
|
||||
:visible.sync="allRecipesPlanOpen"
|
||||
width="800px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form
|
||||
:model="allRecipesPlanQueryParam"
|
||||
ref="allPlanQueryFrom"
|
||||
:inline="true"
|
||||
>
|
||||
<el-form-item label="发送状态" prop="sendFlag">
|
||||
<el-select
|
||||
v-model="allRecipesPlanQueryParam.sendFlag"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option label="全部" :value="null" />
|
||||
<el-option label="未发送" :value="parseInt('0')" />
|
||||
<el-option label="已发送" :value="parseInt('1')" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="getAllPlanByOrderId()"
|
||||
>搜索</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="allRecipesPlanList" width="700px">
|
||||
<!-- <el-table-column label="客户姓名" align="center" prop="customer" /> -->
|
||||
<!--<el-table-column label="营养师名称" align="center" prop="nutritionist" />
|
||||
<el-table-column label="营养师助理名称" align="center" prop="nutritionistAssis" />-->
|
||||
|
||||
<el-table-column
|
||||
label="食谱时间范围"
|
||||
align="center"
|
||||
prop="scopeDate"
|
||||
width="250"
|
||||
/>
|
||||
<el-table-column label="食谱是否发送" align="center" prop="sendFlag">
|
||||
<!--<template slot-scope="scope">
|
||||
<span>{{ scope.row.sendFlag == 1 ? "已发送" : "未发送"}}</span>
|
||||
</template>(.sendFlag == 1) ? 'success' : 'warning'-->
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="getTagType(scope.row)" disable-transitions>
|
||||
{{ scope.row.sendFlag == 1 ? "已发送" : "未发送" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="食谱发送时间"
|
||||
align="center"
|
||||
prop="sendTime"
|
||||
width="180"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.sendTime, "{y}-{m}-{d}") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="allRecipesPlanTotal > 0"
|
||||
:total="allRecipesPlanTotal"
|
||||
:page.sync="allRecipesPlanQueryParam.pageNum"
|
||||
:limit.sync="allRecipesPlanQueryParam.pageSize"
|
||||
@pagination="getAllPlanByOrderId"
|
||||
/>
|
||||
<!--<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="allRecipesPlanOpen = false">关 闭</el-button>
|
||||
</div>-->
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看订单 -->
|
||||
<!-- <order-dialog ref="orderDialog" /> -->
|
||||
<!-- 查看体征 -->
|
||||
<!-- <body_sign_dialog ref="bodySignDialog" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
exportRecipesPlan,
|
||||
getRecipesPlan,
|
||||
listRecipesPlan,
|
||||
updateRecipesPlan,
|
||||
} from "@/api/custom/recipesPlan";
|
||||
import { getOptions } from "@/api/custom/order";
|
||||
// import OrderDetail from "@/components/OrderDetail";
|
||||
// import BodySignDetail from "@/components/BodySignDetail";
|
||||
import { exportRecipesPlan, listRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import dayjs from "dayjs";
|
||||
import store from "@/store";
|
||||
import { mapState } from "vuex";
|
||||
@ -359,11 +212,12 @@ export default {
|
||||
total: 0,
|
||||
// 食谱计划表格数据
|
||||
recipesPlanList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
orderDialog: undefined,
|
||||
reviewStatusOptions: [
|
||||
{ dictValue: 0, dictLabel: "未制作" },
|
||||
{ dictValue: 1, dictLabel: "未审核" },
|
||||
{ dictValue: 2, dictLabel: "已审核" },
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -373,6 +227,7 @@ export default {
|
||||
endDate: null,
|
||||
nutritionistId: null,
|
||||
nutritionistAssisId: null,
|
||||
reviewStatus: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@ -461,33 +316,8 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 查询客户体征 */
|
||||
getCustomerSign(row) {
|
||||
this.$refs.bodySignDialog.showDialog(row.phone);
|
||||
},
|
||||
getAllPlanByOrderId() {
|
||||
if (this.allRecipesPlanQueryParam.sendFlag === "") {
|
||||
this.allRecipesPlanQueryParam.sendFlag = null;
|
||||
}
|
||||
listRecipesPlan(this.allRecipesPlanQueryParam).then((response) => {
|
||||
this.allRecipesPlanList = response.rows;
|
||||
this.allRecipesPlanList.forEach(function (item, index) {
|
||||
item.scopeDate =
|
||||
dayjs(item.startDate).format("YYYY-MM-DD") +
|
||||
" 到 " +
|
||||
dayjs(item.endDate).format("YYYY-MM-DD");
|
||||
});
|
||||
this.allRecipesPlanOpen = true;
|
||||
this.allRecipesPlanTitle = `「${this.allRecipesPlanList[0].customer}」食谱计划表`;
|
||||
this.allRecipesPlanTotal = response.total;
|
||||
});
|
||||
},
|
||||
getOrderDetail(row) {
|
||||
this.$refs.orderDialog.showDialog(row.orderId);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
@ -519,39 +349,6 @@ export default {
|
||||
this.planStartDateScope = [nextDate, nextDate];
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getRecipesPlan(id).then((response) => {
|
||||
this.form.id = response.data.id;
|
||||
this.form.sendFlag = response.data.sendFlag;
|
||||
this.open = true;
|
||||
this.title = "修改食谱计划";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateRecipesPlan(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
@ -568,67 +365,10 @@ export default {
|
||||
})
|
||||
.catch(function () {});
|
||||
},
|
||||
getTagType(row) {
|
||||
if (row.sendFlag == 1) {
|
||||
return "success";
|
||||
}
|
||||
return "danger";
|
||||
/* if(dayjs(row.startDate+"").diff(dayjs(),'day') <= 1){
|
||||
return "danger";
|
||||
}
|
||||
return '';*/
|
||||
},
|
||||
// 自定义列背景色
|
||||
columnStyle({ row, column, rowIndex, columnIndex }) {
|
||||
if (
|
||||
columnIndex == 0 ||
|
||||
columnIndex == 2 ||
|
||||
columnIndex == 4 ||
|
||||
columnIndex == 6
|
||||
) {
|
||||
//第三第四列的背景色就改变了2和3都是列数的下标
|
||||
return "background:#f3f6fc;font-weight:bold";
|
||||
} else {
|
||||
return "background:#ffffff;";
|
||||
}
|
||||
},
|
||||
// 和并列
|
||||
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex % 4 === 0) {
|
||||
return {
|
||||
rowspan: 4,
|
||||
colspan: 1,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
handleBuild(data) {
|
||||
// console.log(data);
|
||||
const { id, cusId, recipesId, customer, startNumDay, endNumDay } = data;
|
||||
|
||||
const queryParam = {
|
||||
planId: id,
|
||||
cusId,
|
||||
name: customer,
|
||||
};
|
||||
if (recipesId) {
|
||||
queryParam.recipesId = recipesId;
|
||||
} else {
|
||||
queryParam.startNum = startNumDay;
|
||||
queryParam.endNum = endNumDay;
|
||||
}
|
||||
const routeUrl = this.$router.resolve({
|
||||
path: "/recipes/build",
|
||||
query: queryParam,
|
||||
});
|
||||
window.open(routeUrl.href, "_blank");
|
||||
// this.$router.push({ path: "/recipes/build", query: queryParam });
|
||||
const { id, customer } = data;
|
||||
window.open("/recipes/build/" + customer + "/" + id, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user