package com.bonus.canteen.core.nutrition.device.vo;

import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

@ApiModel("个人营养分析(自助查询机)")
public class PersonalNutritionAnalyseVO implements Serializable {
   @ApiModelProperty("人员姓名")
   private String custName;
   @ApiModelProperty("年龄")
   private Integer age;
   @ApiModelProperty("部门")
   private String orgFullName;
   @ApiModelProperty("热量实际摄入")
   private BigDecimal calories;
   @ApiModelProperty("蛋白质实际摄入")
   private BigDecimal protein;
   @ApiModelProperty("脂肪实际摄入")
   private BigDecimal fat;
   @ApiModelProperty("碳水化合物实际摄入")
   private BigDecimal carbohydrate;
   @ApiModelProperty("膳食纤维实际摄入")
   private BigDecimal dietaryFiber;
   @ApiModelProperty("胆固醇实际摄入")
   private BigDecimal cholesterol;
   @ApiModelProperty("热量推荐摄入")
   private BigDecimal referenceCalories;
   @ApiModelProperty("蛋白质推荐摄入")
   private BigDecimal referenceProtein;
   @ApiModelProperty("脂肪推荐摄入")
   private BigDecimal referenceFat;
   @ApiModelProperty("碳水化合物推荐摄入")
   private BigDecimal referenceCarbohydrate;
   @ApiModelProperty("膳食纤维推荐摄入")
   private BigDecimal referenceDietaryFiber;
   @ApiModelProperty("胆固醇推荐摄入")
   private BigDecimal referenceCholesterol;
   @ApiModelProperty("热量指数")
   private BigDecimal caloriesIndex;
   @ApiModelProperty("蛋白质指数")
   private BigDecimal proteinIndex;
   @ApiModelProperty("脂肪指数")
   private BigDecimal fatIndex;
   @ApiModelProperty("碳水化合物指数")
   private BigDecimal carbohydrateIndex;
   @ApiModelProperty("膳食纤维指数")
   private BigDecimal dietaryFiberIndex;
   @ApiModelProperty("胆固醇指数")
   private BigDecimal cholesterolIndex;

   public PersonalNutritionAnalyseVO() {
   }

   public BigDecimal getCaloriesIndex() {
      if (!ObjectUtil.isNull(this.referenceCalories) && this.referenceCalories.compareTo(BigDecimal.ZERO) != 0) {
         return !ObjectUtil.isNull(this.calories) && this.calories.compareTo(BigDecimal.ZERO) != 0 ? this.calories.divide(this.referenceCalories, 2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
      } else {
         return BigDecimal.ONE;
      }
   }

   public BigDecimal getProteinIndex() {
      if (!ObjectUtil.isNull(this.referenceProtein) && this.referenceProtein.compareTo(BigDecimal.ZERO) != 0) {
         return !ObjectUtil.isNull(this.protein) && this.protein.compareTo(BigDecimal.ZERO) != 0 ? this.protein.divide(this.referenceProtein, 2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
      } else {
         return BigDecimal.ONE;
      }
   }

   public BigDecimal getFatIndex() {
      if (!ObjectUtil.isNull(this.referenceFat) && this.referenceFat.compareTo(BigDecimal.ZERO) != 0) {
         return !ObjectUtil.isNull(this.fat) && this.fat.compareTo(BigDecimal.ZERO) != 0 ? this.fat.divide(this.referenceFat, 2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
      } else {
         return BigDecimal.ONE;
      }
   }

   public BigDecimal getCarbohydrateIndex() {
      if (!ObjectUtil.isNull(this.referenceCarbohydrate) && this.referenceCarbohydrate.compareTo(BigDecimal.ZERO) != 0) {
         return !ObjectUtil.isNull(this.carbohydrate) && this.carbohydrate.compareTo(BigDecimal.ZERO) != 0 ? this.carbohydrate.divide(this.referenceCarbohydrate, 2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
      } else {
         return BigDecimal.ONE;
      }
   }

   public BigDecimal getDietaryFiberIndex() {
      if (!ObjectUtil.isNull(this.referenceDietaryFiber) && this.referenceDietaryFiber.compareTo(BigDecimal.ZERO) != 0) {
         return !ObjectUtil.isNull(this.dietaryFiber) && this.dietaryFiber.compareTo(BigDecimal.ZERO) != 0 ? this.dietaryFiber.divide(this.referenceDietaryFiber, 2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
      } else {
         return BigDecimal.ONE;
      }
   }

   public BigDecimal getCholesterolIndex() {
      if (!ObjectUtil.isNull(this.referenceCholesterol) && this.referenceCholesterol.compareTo(BigDecimal.ZERO) != 0) {
         return !ObjectUtil.isNull(this.cholesterol) && this.cholesterol.compareTo(BigDecimal.ZERO) != 0 ? this.cholesterol.divide(this.referenceCholesterol, 2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
      } else {
         return BigDecimal.ONE;
      }
   }

   public static PersonalNutritionAnalyseVOBuilder builder() {
      return new PersonalNutritionAnalyseVOBuilder();
   }

   public String getCustName() {
      return this.custName;
   }

   public Integer getAge() {
      return this.age;
   }

   public String getOrgFullName() {
      return this.orgFullName;
   }

   public BigDecimal getCalories() {
      return this.calories;
   }

   public BigDecimal getProtein() {
      return this.protein;
   }

   public BigDecimal getFat() {
      return this.fat;
   }

   public BigDecimal getCarbohydrate() {
      return this.carbohydrate;
   }

   public BigDecimal getDietaryFiber() {
      return this.dietaryFiber;
   }

   public BigDecimal getCholesterol() {
      return this.cholesterol;
   }

   public BigDecimal getReferenceCalories() {
      return this.referenceCalories;
   }

   public BigDecimal getReferenceProtein() {
      return this.referenceProtein;
   }

   public BigDecimal getReferenceFat() {
      return this.referenceFat;
   }

   public BigDecimal getReferenceCarbohydrate() {
      return this.referenceCarbohydrate;
   }

   public BigDecimal getReferenceDietaryFiber() {
      return this.referenceDietaryFiber;
   }

   public BigDecimal getReferenceCholesterol() {
      return this.referenceCholesterol;
   }

   public void setCustName(final String custName) {
      this.custName = custName;
   }

   public void setAge(final Integer age) {
      this.age = age;
   }

   public void setOrgFullName(final String orgFullName) {
      this.orgFullName = orgFullName;
   }

   public void setCalories(final BigDecimal calories) {
      this.calories = calories;
   }

   public void setProtein(final BigDecimal protein) {
      this.protein = protein;
   }

   public void setFat(final BigDecimal fat) {
      this.fat = fat;
   }

   public void setCarbohydrate(final BigDecimal carbohydrate) {
      this.carbohydrate = carbohydrate;
   }

   public void setDietaryFiber(final BigDecimal dietaryFiber) {
      this.dietaryFiber = dietaryFiber;
   }

   public void setCholesterol(final BigDecimal cholesterol) {
      this.cholesterol = cholesterol;
   }

   public void setReferenceCalories(final BigDecimal referenceCalories) {
      this.referenceCalories = referenceCalories;
   }

   public void setReferenceProtein(final BigDecimal referenceProtein) {
      this.referenceProtein = referenceProtein;
   }

   public void setReferenceFat(final BigDecimal referenceFat) {
      this.referenceFat = referenceFat;
   }

   public void setReferenceCarbohydrate(final BigDecimal referenceCarbohydrate) {
      this.referenceCarbohydrate = referenceCarbohydrate;
   }

   public void setReferenceDietaryFiber(final BigDecimal referenceDietaryFiber) {
      this.referenceDietaryFiber = referenceDietaryFiber;
   }

   public void setReferenceCholesterol(final BigDecimal referenceCholesterol) {
      this.referenceCholesterol = referenceCholesterol;
   }

   public void setCaloriesIndex(final BigDecimal caloriesIndex) {
      this.caloriesIndex = caloriesIndex;
   }

   public void setProteinIndex(final BigDecimal proteinIndex) {
      this.proteinIndex = proteinIndex;
   }

   public void setFatIndex(final BigDecimal fatIndex) {
      this.fatIndex = fatIndex;
   }

   public void setCarbohydrateIndex(final BigDecimal carbohydrateIndex) {
      this.carbohydrateIndex = carbohydrateIndex;
   }

   public void setDietaryFiberIndex(final BigDecimal dietaryFiberIndex) {
      this.dietaryFiberIndex = dietaryFiberIndex;
   }

   public void setCholesterolIndex(final BigDecimal cholesterolIndex) {
      this.cholesterolIndex = cholesterolIndex;
   }

   public PersonalNutritionAnalyseVO(final String custName, final Integer age, final String orgFullName, final BigDecimal calories, final BigDecimal protein, final BigDecimal fat, final BigDecimal carbohydrate, final BigDecimal dietaryFiber, final BigDecimal cholesterol, final BigDecimal referenceCalories, final BigDecimal referenceProtein, final BigDecimal referenceFat, final BigDecimal referenceCarbohydrate, final BigDecimal referenceDietaryFiber, final BigDecimal referenceCholesterol, final BigDecimal caloriesIndex, final BigDecimal proteinIndex, final BigDecimal fatIndex, final BigDecimal carbohydrateIndex, final BigDecimal dietaryFiberIndex, final BigDecimal cholesterolIndex) {
      this.custName = custName;
      this.age = age;
      this.orgFullName = orgFullName;
      this.calories = calories;
      this.protein = protein;
      this.fat = fat;
      this.carbohydrate = carbohydrate;
      this.dietaryFiber = dietaryFiber;
      this.cholesterol = cholesterol;
      this.referenceCalories = referenceCalories;
      this.referenceProtein = referenceProtein;
      this.referenceFat = referenceFat;
      this.referenceCarbohydrate = referenceCarbohydrate;
      this.referenceDietaryFiber = referenceDietaryFiber;
      this.referenceCholesterol = referenceCholesterol;
      this.caloriesIndex = caloriesIndex;
      this.proteinIndex = proteinIndex;
      this.fatIndex = fatIndex;
      this.carbohydrateIndex = carbohydrateIndex;
      this.dietaryFiberIndex = dietaryFiberIndex;
      this.cholesterolIndex = cholesterolIndex;
   }

   public static class PersonalNutritionAnalyseVOBuilder {
      private String custName;
      private Integer age;
      private String orgFullName;
      private BigDecimal calories;
      private BigDecimal protein;
      private BigDecimal fat;
      private BigDecimal carbohydrate;
      private BigDecimal dietaryFiber;
      private BigDecimal cholesterol;
      private BigDecimal referenceCalories;
      private BigDecimal referenceProtein;
      private BigDecimal referenceFat;
      private BigDecimal referenceCarbohydrate;
      private BigDecimal referenceDietaryFiber;
      private BigDecimal referenceCholesterol;
      private BigDecimal caloriesIndex;
      private BigDecimal proteinIndex;
      private BigDecimal fatIndex;
      private BigDecimal carbohydrateIndex;
      private BigDecimal dietaryFiberIndex;
      private BigDecimal cholesterolIndex;

      PersonalNutritionAnalyseVOBuilder() {
      }

      public PersonalNutritionAnalyseVOBuilder custName(final String custName) {
         this.custName = custName;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder age(final Integer age) {
         this.age = age;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder orgFullName(final String orgFullName) {
         this.orgFullName = orgFullName;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder calories(final BigDecimal calories) {
         this.calories = calories;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder protein(final BigDecimal protein) {
         this.protein = protein;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder fat(final BigDecimal fat) {
         this.fat = fat;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder carbohydrate(final BigDecimal carbohydrate) {
         this.carbohydrate = carbohydrate;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder dietaryFiber(final BigDecimal dietaryFiber) {
         this.dietaryFiber = dietaryFiber;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder cholesterol(final BigDecimal cholesterol) {
         this.cholesterol = cholesterol;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder referenceCalories(final BigDecimal referenceCalories) {
         this.referenceCalories = referenceCalories;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder referenceProtein(final BigDecimal referenceProtein) {
         this.referenceProtein = referenceProtein;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder referenceFat(final BigDecimal referenceFat) {
         this.referenceFat = referenceFat;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder referenceCarbohydrate(final BigDecimal referenceCarbohydrate) {
         this.referenceCarbohydrate = referenceCarbohydrate;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder referenceDietaryFiber(final BigDecimal referenceDietaryFiber) {
         this.referenceDietaryFiber = referenceDietaryFiber;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder referenceCholesterol(final BigDecimal referenceCholesterol) {
         this.referenceCholesterol = referenceCholesterol;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder caloriesIndex(final BigDecimal caloriesIndex) {
         this.caloriesIndex = caloriesIndex;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder proteinIndex(final BigDecimal proteinIndex) {
         this.proteinIndex = proteinIndex;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder fatIndex(final BigDecimal fatIndex) {
         this.fatIndex = fatIndex;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder carbohydrateIndex(final BigDecimal carbohydrateIndex) {
         this.carbohydrateIndex = carbohydrateIndex;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder dietaryFiberIndex(final BigDecimal dietaryFiberIndex) {
         this.dietaryFiberIndex = dietaryFiberIndex;
         return this;
      }

      public PersonalNutritionAnalyseVOBuilder cholesterolIndex(final BigDecimal cholesterolIndex) {
         this.cholesterolIndex = cholesterolIndex;
         return this;
      }

      public PersonalNutritionAnalyseVO build() {
         return new PersonalNutritionAnalyseVO(this.custName, this.age, this.orgFullName, this.calories, this.protein, this.fat, this.carbohydrate, this.dietaryFiber, this.cholesterol, this.referenceCalories, this.referenceProtein, this.referenceFat, this.referenceCarbohydrate, this.referenceDietaryFiber, this.referenceCholesterol, this.caloriesIndex, this.proteinIndex, this.fatIndex, this.carbohydrateIndex, this.dietaryFiberIndex, this.cholesterolIndex);
      }

   }
}
