健康体征报告
This commit is contained in:
parent
912300838a
commit
488a149ec3
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 java.util.List;
|
||||||
|
|
||||||
import com.stdiet.common.utils.StringUtils;
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.custom.dto.request.HealthyDetailRequest;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -109,4 +110,14 @@ public class SysCustomerHealthyController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(sysCustomerHealthyService.deleteSysCustomerHealthyByIds(ids));
|
return toAjax(sysCustomerHealthyService.deleteSysCustomerHealthyByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成健康体征报告
|
||||||
|
*/
|
||||||
|
@Log(title = "健康体征报告", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/generateHealthyReport")
|
||||||
|
public AjaxResult generateHealthyReport(@RequestBody HealthyDetailRequest healthyDetailRequest)
|
||||||
|
{
|
||||||
|
return sysCustomerHealthyService.generateHealthyReport(healthyDetailRequest);
|
||||||
|
}
|
||||||
}
|
}
|
@ -16,6 +16,9 @@ public class HealthyUtils {
|
|||||||
//营养成分比例
|
//营养成分比例
|
||||||
public static final Integer[] nutritionRate = {30, 20, 50};
|
public static final Integer[] nutritionRate = {30, 20, 50};
|
||||||
|
|
||||||
|
//默认活动因子
|
||||||
|
public static final double activityFactor = 0.3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算减脂每天最大摄入量(千卡)
|
* 计算减脂每天最大摄入量(千卡)
|
||||||
* @param age 年龄
|
* @param age 年龄
|
||||||
@ -148,7 +151,7 @@ public class HealthyUtils {
|
|||||||
* @param weight 体重
|
* @param weight 体重
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static final Double[] calculateNutritionEveryWeight(Integer[] nutritionQuality, double weight){
|
public static Double[] calculateNutritionEveryWeight(Integer[] nutritionQuality, double weight){
|
||||||
Double[] nutritionEveryWeight = new Double[3];
|
Double[] nutritionEveryWeight = new Double[3];
|
||||||
nutritionEveryWeight[0] = NumberUtils.getNumberByRoundHalfUp(nutritionQuality[0]/weight*2,2).doubleValue();
|
nutritionEveryWeight[0] = NumberUtils.getNumberByRoundHalfUp(nutritionQuality[0]/weight*2,2).doubleValue();
|
||||||
nutritionEveryWeight[1] = NumberUtils.getNumberByRoundHalfUp(nutritionQuality[1]/weight*2,2).doubleValue();
|
nutritionEveryWeight[1] = NumberUtils.getNumberByRoundHalfUp(nutritionQuality[1]/weight*2,2).doubleValue();
|
||||||
@ -156,5 +159,19 @@ public class HealthyUtils {
|
|||||||
return nutritionEveryWeight;
|
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);
|
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).toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,390 @@
|
|||||||
|
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 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;
|
||||||
|
|
||||||
|
/** 客户病史体征id,使用,隔开 */
|
||||||
|
private String physicalSignsId;
|
||||||
|
|
||||||
|
/** 其他病史体征 **/
|
||||||
|
private String otherPhysicalSigns;
|
||||||
|
|
||||||
|
/** 气血数据 */
|
||||||
|
private String bloodData;
|
||||||
|
|
||||||
|
//备注
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/** 湿气数据 */
|
||||||
|
private String moistureDate;
|
||||||
|
|
||||||
|
}
|
@ -69,4 +69,23 @@ public class NutritionalCalories implements Serializable {
|
|||||||
//蛋白质、脂肪、碳水剩余可摄入热量
|
//蛋白质、脂肪、碳水剩余可摄入热量
|
||||||
public Integer[] surplusNutritionalHeat;
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
import com.stdiet.custom.domain.SysCustomerHealthy;
|
import com.stdiet.custom.domain.SysCustomerHealthy;
|
||||||
|
import com.stdiet.custom.dto.request.HealthyDetailRequest;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,4 +79,10 @@ public interface ISysCustomerHealthyService
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteCustomerHealthyByCustomerId(Long customerId);
|
int deleteCustomerHealthyByCustomerId(Long customerId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成健康评估报告
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult generateHealthyReport(HealthyDetailRequest healthyDetailRequest);
|
||||||
}
|
}
|
@ -1,14 +1,22 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.stdiet.common.config.RuoYiConfig;
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
import com.stdiet.common.utils.StringUtils;
|
import com.stdiet.common.utils.StringUtils;
|
||||||
import com.stdiet.common.utils.bean.ObjectUtils;
|
import com.stdiet.common.utils.bean.ObjectUtils;
|
||||||
|
import com.stdiet.common.utils.reflect.ReflectUtils;
|
||||||
import com.stdiet.common.utils.sign.AesUtils;
|
import com.stdiet.common.utils.sign.AesUtils;
|
||||||
import com.stdiet.custom.domain.SysCustomer;
|
import com.stdiet.custom.domain.SysCustomer;
|
||||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
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.service.ISysCustomerService;
|
||||||
|
import com.stdiet.custom.utils.NutritionalUtils;
|
||||||
|
import com.stdiet.custom.utils.PdfUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.stdiet.custom.mapper.SysCustomerHealthyMapper;
|
import com.stdiet.custom.mapper.SysCustomerHealthyMapper;
|
||||||
@ -141,4 +149,72 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
|
|||||||
public int deleteCustomerHealthyByCustomerId(Long customerId){
|
public int deleteCustomerHealthyByCustomerId(Long customerId){
|
||||||
return sysCustomerHealthyMapper.deleteCustomerHealthyByCustomerId(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){
|
||||||
|
Map<String,String> data = new HashMap<>();
|
||||||
|
for (String key : healthyAttrNameAray) {
|
||||||
|
data.put(key, ReflectUtils.getFieldValueByFieldName(key, healthyDetailRequest));
|
||||||
|
}
|
||||||
|
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].toString()+"-"+nutritionalCalories.getTargetEveryWeightHeat()[1].toString());
|
||||||
|
}
|
||||||
|
if("standardEveryWeightHeat".equals(key)){
|
||||||
|
data.put(key, nutritionalCalories.getStandardEveryWeightHeat()[0].toString()+"-"+nutritionalCalories.getStandardEveryWeightHeat()[1].toString());
|
||||||
|
}
|
||||||
|
data.put(key, ReflectUtils.getFieldValueByFieldName(key, nutritionalCalories));
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
@ -32,6 +32,13 @@ public class NutritionalUtils {
|
|||||||
nutritionalCalories.setNutritionalHeat(nutritionalHeatAndQuality[0]);
|
nutritionalCalories.setNutritionalHeat(nutritionalHeatAndQuality[0]);
|
||||||
nutritionalCalories.setNutritionalQuality(nutritionalHeatAndQuality[1]);
|
nutritionalCalories.setNutritionalQuality(nutritionalHeatAndQuality[1]);
|
||||||
nutritionalCalories.setWeightNutritionalRate(HealthyUtils.calculateNutritionEveryWeight(nutritionalHeatAndQuality[1], nutritionalCalories.getWeight()));
|
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;
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -61,4 +61,14 @@ export function download(fileName) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成健康体征报告
|
||||||
|
export function generateHealthyReport(healthyDetail) {
|
||||||
|
return request({
|
||||||
|
url: '/custom/healthy/generateHealthyReport',
|
||||||
|
method: 'post',
|
||||||
|
data: healthyDetail
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<div v-if="showFlag">
|
<div v-if="showFlag">
|
||||||
<div style="float:right;margin-top:-10px;margin-bottom: 10px;" v-show="dataList.length > 0">
|
<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 v-hasPermi="['custom:healthy:edit']" type="info" v-show="dataType == 0" @click="handleEditRemarkClick()" 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 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>
|
<el-button type="danger" v-hasPermi="['custom:healthy:remove']" @click="handleDelete()" plain>删除信息</el-button>
|
||||||
@ -75,6 +76,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getCustomerPhysicalSignsByCusId,delCustomerHealthy } from "@/api/custom/customer";
|
import { getCustomerPhysicalSignsByCusId,delCustomerHealthy } from "@/api/custom/customer";
|
||||||
|
import { generateHealthyReport } from "@/api/custom/healthy";
|
||||||
import TableDetailMessage from "@/components/TableDetailMessage";
|
import TableDetailMessage from "@/components/TableDetailMessage";
|
||||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||||
import * as healthyData from "@/utils/healthyData";
|
import * as healthyData from "@/utils/healthyData";
|
||||||
@ -203,7 +205,8 @@ export default {
|
|||||||
["medicalReport_one","medicalReport_two","medicalReport_three"]
|
["medicalReport_one","medicalReport_two","medicalReport_three"]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
copyValue: ""
|
copyValue: "",
|
||||||
|
detailHealthy: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -252,6 +255,7 @@ export default {
|
|||||||
onClosed() {
|
onClosed() {
|
||||||
this.dataList = [];
|
this.dataList = [];
|
||||||
this.data = null;
|
this.data = null;
|
||||||
|
this.detailHealthy = null;
|
||||||
//this.enc_id = "";
|
//this.enc_id = "";
|
||||||
this.copyValue = "";
|
this.copyValue = "";
|
||||||
},
|
},
|
||||||
@ -384,6 +388,7 @@ export default {
|
|||||||
detailHealthy.medicalReport_one = medicalReportPathArray.length > 0 ? (medicalReportNameArray.length > 0 ? medicalReportNameArray[0] : "体检报告(1)") : "";
|
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_two = medicalReportPathArray.length > 1 ? (medicalReportNameArray.length > 1 ? medicalReportNameArray[1] : "体检报告(2)") : "";
|
||||||
detailHealthy.medicalReport_three = medicalReportPathArray.length > 2 ? (medicalReportNameArray.length > 2 ? medicalReportNameArray[2] : "体检报告(3)") : "";
|
detailHealthy.medicalReport_three = medicalReportPathArray.length > 2 ? (medicalReportNameArray.length > 2 ? medicalReportNameArray[2] : "体检报告(3)") : "";
|
||||||
|
this.detailHealthy = detailHealthy;
|
||||||
for(let i = 0; i < this.healthyTitleData.length; i++){
|
for(let i = 0; i < this.healthyTitleData.length; i++){
|
||||||
let stepArray = [];
|
let stepArray = [];
|
||||||
for(let j= 0; j < this.healthyTitleData[i].length; j++){
|
for(let j= 0; j < this.healthyTitleData[i].length; j++){
|
||||||
@ -426,6 +431,14 @@ export default {
|
|||||||
downloadFile(fileName){
|
downloadFile(fileName){
|
||||||
this.downloadResource(fileName);
|
this.downloadResource(fileName);
|
||||||
},
|
},
|
||||||
|
generateReport(){
|
||||||
|
//this.detailHealthy.customerId = this.data.id;
|
||||||
|
generateHealthyReport(this.detailHealthy).then((res) => {
|
||||||
|
if(res.code == 200 && res.path != null){
|
||||||
|
this.download(res.path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
trimComma(str){
|
trimComma(str){
|
||||||
if(str.startsWith(",") || str.startsWith(",")){
|
if(str.startsWith(",") || str.startsWith(",")){
|
||||||
str = str.substring(1,str.length);
|
str = str.substring(1,str.length);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user