using Nirvana.Common; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace YBDevice.Entity { /// /// 添加测量记录 /// public class InsertResultDataS2SDto : InsertResultC2SDto { /// /// 设备类型 /// public int DevType { get; set; } /// /// 设备所属的服务商ID /// public int BusinessId { get; set; } /// /// 设备最近测量时间 /// public DateTime? DeviceLastHeartTime { get; set; } } /// /// 更新用户身高资料 /// public class UpdateUserHeightDataS2SDto { /// /// 身高值,厘米 /// public decimal Height { get; set; } /// /// 家庭成员ID /// public int familyid { get; set; } /// /// 设备类型 /// public int DevType { get; set; } /// /// 最新的身高值 /// public decimal LastHeight { get; set; } /// /// 最新身高测量时间 /// public DateTime? LastResultHeightTime { get; set; } /// /// 半年前的身高值 /// public decimal HalfYearHeight { get; set; } /// /// 一年前的身高值 /// public decimal YearHeight { get; set; } } /// /// 更新数据 /// public class UpdateRealDataS2SDtO { /// /// 用户是否认领,true-认领,false-不认领 /// public bool IsUserTake { get; set; } = false; /// /// 体重值,单位为KG /// public decimal weight { get; set; } = 0; /// /// 身高,单位为厘米 /// public decimal height { get; set; } = 0; /// /// 家庭成员ID /// public int familyid { get; set; } /// /// 测量时间 /// public DateTime CreateTime { get; set; } /// /// 用户ID /// public int UserId { get; set; } = 0; /// /// 来源,1-蓝牙传输,2-手动记录,3-扫码记录 /// public int SourceType { get; set; } = 1; /// /// 测量记录ID /// public Guid ResultId { get; set; } /// /// 设备ID /// public int DevId { get; set; } /// /// 设备类型 /// public int DevType { get; set; } /// /// 设备最近的测量时间 /// public DateTime? DeviceLastHeartTime { get; set; } /// /// 设备所属的服务商 /// public int BusinessId { get; set; } } /// /// 八电极数据提交 /// public class MeasureBodySubmitC2SDto : MeasureSubmitS2SDto { /// /// 左手阻抗 /// public decimal LeftHandImp { get; set; } /// /// 右手阻抗 /// public decimal RightHandImp { get; set; } /// /// 左脚阻抗 /// public decimal LeftFootImp { get; set; } /// /// 右脚阻抗 /// public decimal RightFootImp { get; set; } /// /// 身高,单位为厘米/英尺 /// public string height { get; set; } /// /// 设备类型,1-L06,2-L08 /// public int Type { get; set; } = 1; /// /// 验证 /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (familyid <= 0) { yield return new ValidationResult("请先选择家庭成员", new[] { nameof(familyid) }); } if (string.IsNullOrEmpty(height) || !ValidateHeight()) { yield return new ValidationResult("请先输入正确的身高值", new[] { nameof(height) }); } } /// /// 身高验证 /// /// private bool ValidateHeight() { string h = height.ToLower(); if (h.Contains("cm") || h.Contains("ft")) { return true; } decimal dh = 0; if (Decimal.TryParse(height, out dh) && dh > 0) { return true; } return false; } } /// /// 添加测量记录的数据 /// public class MeasureSubmitS2SDto { /// /// 头围,cm /// public decimal Head { get; set; } /// /// 体重值,单位为KG、jin、LB、st,g /// [Required(ErrorMessage = "体重值不可小于0")] public string weight { get; set; } /// /// 阻抗值 /// public decimal imp { get; set; } = 0; /// /// 设备码 /// [Required(ErrorMessage = "设备码不可为空")] public string ecode { get; set; } = ""; /// /// 家庭成员ID /// public int familyid { get; set; } } /// /// 添加测量记录,身高带有单位 /// public class MeasureOfUnitSubmitModel : MeasureSubmitS2SDto, IValidatableObject { /// /// 身高,单位为厘米/英尺 /// public string height { get; set; } /// /// 验证 /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (familyid <= 0) { yield return new ValidationResult("请先选择家庭成员", new[] { nameof(familyid) }); } if (string.IsNullOrEmpty(height) || !ValidateHeight()) { yield return new ValidationResult("请先输入正确的身高值", new[] { nameof(height) }); } } /// /// 身高验证 /// /// private bool ValidateHeight() { string h = height.ToLower(); if (h.Contains("cm") || h.Contains("ft")) { return true; } decimal dh = 0; if (Decimal.TryParse(height, out dh) && dh > 0) { return true; } return false; } } /// /// 添加测量记录 /// public class MeasureSubmitModel : MeasureSubmitS2SDto, IValidatableObject { /// /// 身高,单位为厘米 /// [Range(50, 250, ErrorMessage = "身高值只能在50-250厘米之间")] public decimal height { get; set; } = 0; /// /// 验证 /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (familyid <= 0) { yield return new ValidationResult("请先选择家庭成员", new[] { nameof(familyid) }); } } } /// /// 添加测量记录 /// public class InsertResultC2SDto { /// /// 头围 /// public decimal Head { get; set; } = 0; /// /// 体重值,单位为KG /// public decimal weight { get; set; } = 0; /// /// 阻抗值 /// public decimal imp { get; set; } = 0; /// /// 身高,单位为厘米 /// public decimal height { get; set; } = 0; /// /// 设备码 /// public string ecode { get; set; } = ""; /// /// 家庭成员ID /// public int familyid { get; set; } /// /// 来源,1-蓝牙传输,2-手动记录,3-扫码记录 /// public int SourceType { get; set; } = 1; /// /// 设备ID /// public int DevId { get; set; } = 0; /// /// 左手阻抗 /// public System.Decimal LeftArmImp { get; set; } = 0; /// /// 右手阻抗 /// public System.Decimal RightArmImp { get; set; } = 0; /// /// 左脚阻抗 /// public System.Decimal LeftLegImp { get; set; } = 0; /// /// 右脚阻抗 /// public System.Decimal RightLegImp { get; set; } = 0; /// /// 用户是否认领,true-认领,false-不认领 /// public bool IsUserTake { get; set; } = true; /// /// 用户ID /// public int UserId { get; set; } = 0; /// /// 记录ID /// public Guid ResultId { get; set; } /// /// 用户fansid /// public Guid? fansid { get; set; } = null; /// /// 订单ID /// public Guid? orderid { get; set; } = null; /// /// 公众号id /// public string publicid { get; set; } = ""; /// /// 记录时间 /// public DateTime? CreateTime { get; set; } = null; } /// /// 增加新的体脂计算 /// public class MeasureCalcDto : MeasureDataSubmitModel { /// /// 是否重新计算肥胖等级 /// public int IsCalc { get; set; } = 0; /// /// 年龄 /// public int age { get; set; } /// /// 性别,1-男,2-女,0-未知 /// public GenderType sex { get; set; } } /// /// 添加测量记录 /// public class MeasureDataSubmitModel : MeasureSubmitModel { /// /// 体龄 /// public int bodyage { get; set; } = 0; /// /// 脂肪率 /// public decimal fat_r { get; set; } = 0; /// /// 肌肉率 /// public decimal muscle { get; set; } = 0; /// /// 水份 /// public decimal water { get; set; } = 0; /// /// 骨重 /// public decimal bone { get; set; } = 0; /// /// 基础代谢 /// public decimal kcal { get; set; } = 0; /// /// 内脂 /// public decimal visceral { get; set; } = 0; /// /// 蛋白率 /// public decimal protein { get; set; } = 0; /// /// BMI /// public decimal bmi { get; set; } = 0; /// /// 皮下脂肪 /// public decimal sfr { get; set; } = 0; /// /// 肥胖等级,参考等级枚举 /// public string fatlevlval { get; set; } = ""; /// /// 标准体重 /// public decimal StandardWeight { get; set; } = 0; /// /// 脂肪量 /// public decimal fat_w { get; set; } = 0; /// /// 去脂体重 /// public decimal lbm { get; set; } = 0; /// /// 肌肉量 /// public decimal muscleval { get; set; } = 0; /// /// 蛋白量 /// public decimal proteinval { get; set; } = 0; } /// /// 用户手动增加测量记录 /// public class UserMeasureSubmitModel : IValidatableObject { /// /// 体重值,单位为KG /// public decimal weight { get; set; } /// /// 身高,CM /// public decimal Height { get; set; } = 0; /// /// 头围,CM /// public decimal Head { get; set; } = 0; /// /// 测量时间 /// [Required(ErrorMessage = "请选择测量时间")] public string time { get; set; } /// /// 家庭成员ID /// public int familyid { get; set; } /// /// 设备类型 /// public int DevType { get; set; } = 1; /// /// 验证 /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (familyid <= 0) { yield return new ValidationResult("请先选择家庭成员", new[] { nameof(familyid) }); } if (weight <= 0) { yield return new ValidationResult("体重不可小于0", new[] { nameof(weight) }); } if (time.ToDate() > DateTime.Now.Date) { yield return new ValidationResult("时间不可大于今天", new[] { nameof(time) }); } } } /// /// 用户测量信息 /// public class UserMeasureModel : MeasureStand { /// /// 脂肪率 /// public decimal fat_r { get; set; } = 0; /// /// 肌肉率 /// public decimal muscle { get; set; } = 0; /// /// 水份,重量 /// public decimal water { get; set; } = 0; /// /// 骨重 /// public decimal bone { get; set; } = 0; /// /// 基础代谢 /// public decimal kcal { get; set; } = 0; /// /// 脂肪重量 /// public decimal fat_w { get; set; } = 0; /// /// 内脂 /// public decimal visceral { get; set; } = 0; /// /// 蛋白质,蛋白率,单位% /// public decimal protein { get; set; } = 0; /// /// 体龄 /// public int bodyage { get; set; } = 0; /// /// BMI /// public decimal bmi { get; set; } = 0; /// /// 分数 /// public decimal cmi { get; set; } = 0; /// /// 皮下脂肪率,% /// public decimal sfr { get; set; } = 0; /// /// 皮下脂肪量,KG /// public decimal sfrval { get; set; } = 0; /// /// 骨骼肌量,kg /// public decimal skeletalmuscle { get; set; } = 0; /// /// 肌肉量 /// public decimal muscleval { get; set; } = 0; /// /// 蛋白量 /// public decimal proteinval { get; set; } = 0; /// /// 去脂体重 /// public decimal lbm { get; set; } = 0; /// /// 体型,参考体型枚举 /// public string body { get; set; } = ""; /// /// 肥胖等级,参考等级枚举 /// public string fatlevlval { get; set; } = ""; /// /// 体重 /// public decimal weight { get; set; } = 0; /// /// 身高 /// public decimal height { get; set; } = 0; } /// /// 测量项标准 /// public class MeasureStand : MeasureLevel { /// /// 标准体重 /// public string standardWeight { get; set; } = ""; /// /// 脂肪率标准范围 /// public string standardfat_r { get; set; } = ""; /// /// 肌肉率标准范围 /// public string standardmuscle { get; set; } = ""; /// /// 水份标准范围 /// public string standardwater { get; set; } = ""; /// /// 骨重标准范围 /// public string standardbone { get; set; } = ""; /// /// 基础代谢标准范围 /// public string standardkcal { get; set; } = ""; /// /// 脂肪重量标准范围 /// public string standardfat_w { get; set; } = ""; /// /// 内脂标准范围 /// public string standardviscera { get; set; } = ""; /// /// 蛋白质标准范围 /// public string standardprotein { get; set; } = ""; /// /// 体龄 /// public string standardbodyage { get; set; } = ""; /// /// bmi标准范围 /// public string standardbmi { get; set; } = ""; /// /// 皮下脂肪标准范围 /// public string standardsfr { get; set; } = ""; /// /// 体型标准范围 /// public string standardbody { get; set; } = ""; /// /// 肌肉量标准范围 /// public string standardmuscleval { get; set; } = ""; /// /// 蛋白量标准范围 /// public string standardproteinval { get; set; } = ""; /// /// 去脂体重标准范围 /// public string standardlbm { get; set; } = ""; /// /// 肥胖范围 /// public string standardfatlevel { get; set; } = ""; } /// /// 测量项等级 /// public class MeasureLevel { /// /// 脂肪率标准 /// public string fat_rLevel { get; set; } = ""; /// /// 肌肉率标准 /// public string muscleLevel { get; set; } = ""; /// /// 水份标准 /// public string waterLevel { get; set; } = ""; /// /// 骨量标准 /// public string boneLevel { get; set; } = ""; /// /// 基础代谢标准 /// public string kcalLevel { get; set; } = ""; /// /// 脂肪重量标准 /// public string fat_wLevel { get; set; } = ""; /// /// 内脂等级 /// public string visceralLevel { get; set; } = ""; /// /// 蛋白率标准 /// public string proteinLevel { get; set; } = ""; /// /// 体龄标准 /// public string bodyageLevel { get; set; } = ""; /// /// bmi标准 /// public string bmiLevel { get; set; } = ""; /// /// 肌肉量标准,和肌肉率一致 /// public string musulevalLevel { get; set; } = ""; /// /// 蛋白量标准,和蛋白率一致 /// public string proteinvalLevel { get; set; } = ""; /// /// 皮下脂肪标准 /// public string sfrLevel { get; set; } = ""; /// /// 体型标准 /// public string bodylevel { get; set; } = ""; /// /// 肥胖等级标准 /// public string fatLevel { get; set; } = ""; /// /// 骨骼肌量标准 /// public string skeletalmuscleLevel { get; set; } = ""; } /// /// 测量结果范围值 /// public class MeasureInfoItemValue { /// /// 最大值 /// public decimal maxvalue { get; set; } /// /// 最小值 /// public decimal minvalue { get; set; } /// /// 标准描述 /// public string text { get; set; } = ""; /// /// 颜色代码 /// public string color { get; set; } = ""; /// /// 所处的等级对应值 /// public int Level { get; set; } = 0; } /// /// 测量信息项 /// public class MeasureInfoItem { /// /// 测量项,bmi.fat_r. /// public string name { get; set; } /// /// 结果值 /// public decimal value { get; set; } /// /// 对比上一次的差值,正数增加,负数减少 /// public decimal lastvalue { get; set; } /// /// 按次历史记录列表 /// public List list { get; set; } /// /// 按天历史记录列表 /// public List daylist { get; set; } /// /// 标准范围,从最低标准升序排列 /// public List slist { get; set; } /// /// 当前颜色代码 /// public string Color { get; set; } } /// /// 历史结果 /// public class MeasureHisItem { /// /// 值 /// public string value { get; set; } /// /// 时间 /// public string time { get; set; } } /// /// 用户测量详细测量结果 /// public class UserMeasureInfo : UserMeasureModel { /// /// 历史记录值 /// public List list { get; set; } /// /// 是否为演示数据,true-是,false-否 /// public bool IsTest { get; set; } = false; } /// /// 历史记录 /// public class MeasureModels : UserMeasureModel { /// /// 测量记录ID /// public string resultid { get; set; } /// /// 时间戳 /// public string timestamp { get; set; } } /// /// 手动添加的记录列表 /// public class AddResultList { /// /// 记录ID /// public Guid Id { get; set; } /// /// 身高,CM /// public decimal Height { get; set; } /// /// 体重,KG /// public decimal Weight { get; set; } /// /// 测量时间 /// public string ResultTime { get; set; } /// /// 添加时间 /// public string CreateTime { get; set; } } /// /// 测量历史记录 /// public class MeasureHisList { /// /// 测量时间 /// public string createtime { get; set; } /// /// 身高 /// public decimal Height { get; set; } /// /// 脂肪率 /// public decimal fat_r { get; set; } /// /// 肌肉率 /// public decimal muscle { get; set; } /// /// 水份 /// public decimal water { get; set; } /// /// 骨重 /// public decimal bone { get; set; } /// /// 基础代谢 /// public decimal kcal { get; set; } /// /// 脂肪重量 /// public decimal fat_w { get; set; } /// /// 内脂 /// public decimal visceral { get; set; } /// /// 蛋白质 /// public decimal protein { get; set; } /// /// 体龄 /// public int bodyage { get; set; } /// /// bmi /// public decimal bmi { get; set; } /// /// 分数 /// public decimal cmi { get; set; } /// /// 皮下脂肪 /// public decimal sfr { get; set; } /// /// 肌肉量 /// public decimal muscleval { get; set; } /// /// 蛋白量 /// public decimal proteinval { get; set; } /// /// 去脂体重 /// public decimal lbm { get; set; } /// /// 体型,参考体型枚举 /// public string body { get; set; } /// /// 肥胖等级,参考等级枚举 /// public string fatlevel { get; set; } /// /// 体重 /// public decimal weight { get; set; } /// /// 年龄 /// public string Age { get; set; } /// /// 月龄 /// public int Month { get; set; } /// /// 记录ID /// public Guid Id { get; set; } } /// /// 用户测量记录 /// public class UserResultDto : YB_nMeasureResult { /// /// 粉丝昵称 /// public string NickName { get; set; } /// /// 设备ID /// public int EquId { get; set; } /// /// 设备序列号 /// public string FacEcode { get; set; } /// /// 设备名称 /// public string DevName { get; set; } /// /// 商户名称 /// public string BusinessName { get; set; } /// /// 商户ID /// public string BusinessId { get; set; } /// /// 用户ID /// public int UserId { get; set; } } /// /// 测量数据 /// public class MeasureDataDto { /// /// 昵称 /// public string NickName { get; set; } /// /// 设备序列号 /// public string FacEcode { get; set; } /// /// 设备名称 /// public string DevName { get; set; } /// /// 商户名称 /// public string BusinessName { get; set; } } }