feat: initialize Evergreen Health backend
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
using SqlSugar;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Evergreen.Health.Application.Health.Entities;
|
||||
|
||||
public enum HealthUserStatus { Disabled = 0, Enabled = 1 }
|
||||
|
||||
[SugarTable("health_user", "健康端用户")]
|
||||
[SugarIndex("idx_health_user_phone", nameof(Phone), OrderByType.Asc, IsUnique = true)]
|
||||
public sealed class HealthUser : EntityBaseDel
|
||||
{
|
||||
[SugarColumn(ColumnDescription = "手机号", Length = 20)]
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "密码摘要", Length = 256)]
|
||||
[JsonIgnore, Newtonsoft.Json.JsonIgnore]
|
||||
public string PasswordHash { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "姓名或昵称", Length = 50)]
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "头像", Length = 500, IsNullable = true)]
|
||||
public string? AvatarUrl { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "状态")]
|
||||
public HealthUserStatus Status { get; set; } = HealthUserStatus.Enabled;
|
||||
|
||||
[SugarColumn(ColumnDescription = "最后登录时间", IsNullable = true)]
|
||||
public DateTime? LastLoginTime { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "最后登录IP", Length = 64, IsNullable = true)]
|
||||
public string? LastLoginIp { get; set; }
|
||||
}
|
||||
|
||||
[SugarTable("health_profile", "用户健康档案")]
|
||||
[SugarIndex("idx_health_profile_user", nameof(UserId), OrderByType.Asc, IsUnique = true)]
|
||||
public sealed class HealthProfile : EntityBase
|
||||
{
|
||||
[SugarColumn(ColumnDescription = "健康用户Id")]
|
||||
public long UserId { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "出生日期", IsNullable = true)]
|
||||
public DateTime? Birthday { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "性别", Length = 20, IsNullable = true)]
|
||||
public string? Gender { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "身高厘米", DecimalDigits = 1, IsNullable = true)]
|
||||
public decimal? HeightCm { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "体重千克", DecimalDigits = 1, IsNullable = true)]
|
||||
public decimal? WeightKg { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "平均睡眠小时", DecimalDigits = 1, IsNullable = true)]
|
||||
public decimal? AverageSleepHours { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "每日运动分钟", IsNullable = true)]
|
||||
public int? DailyExerciseMinutes { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "饮食偏好", Length = 500, IsNullable = true)]
|
||||
public string? DietPreference { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "健康目标", Length = 500, IsNullable = true)]
|
||||
public string? HealthGoal { get; set; }
|
||||
}
|
||||
|
||||
[SugarTable("health_module_selection", "用户健康板块选择")]
|
||||
[SugarIndex("idx_health_module_user_code", nameof(UserId), OrderByType.Asc, nameof(ModuleCode), OrderByType.Asc, IsUnique = true)]
|
||||
public sealed class HealthModuleSelection : EntityBase
|
||||
{
|
||||
[SugarColumn(ColumnDescription = "健康用户Id")]
|
||||
public long UserId { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "板块编码", Length = 32)]
|
||||
public string ModuleCode { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "是否启用")]
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
}
|
||||
|
||||
[SugarTable("health_plan", "个性化健康方案")]
|
||||
[SugarIndex("idx_health_plan_user", nameof(UserId), OrderByType.Asc)]
|
||||
public sealed class HealthPlan : EntityBase
|
||||
{
|
||||
[SugarColumn(ColumnDescription = "健康用户Id")]
|
||||
public long UserId { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "方案版本")]
|
||||
public int Version { get; set; } = 1;
|
||||
|
||||
[SugarColumn(ColumnDescription = "方案标题", Length = 100)]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "方案摘要", Length = 1000)]
|
||||
public string Summary { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "参数JSON", ColumnDataType = "text")]
|
||||
public string ParametersJson { get; set; } = "[]";
|
||||
|
||||
[SugarColumn(ColumnDescription = "当前方案")]
|
||||
public bool IsCurrent { get; set; } = true;
|
||||
}
|
||||
|
||||
[SugarTable("health_device_binding", "健康用户设备绑定")]
|
||||
[SugarIndex("idx_health_device_user_entity", nameof(UserId), OrderByType.Asc, nameof(EntityId), OrderByType.Asc, IsUnique = true)]
|
||||
public sealed class HealthDeviceBinding : EntityBase
|
||||
{
|
||||
[SugarColumn(ColumnDescription = "健康用户Id")]
|
||||
public long UserId { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "Home Assistant实体Id", Length = 200)]
|
||||
public string EntityId { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "显示名称", Length = 100)]
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "设备类型", Length = 50, IsNullable = true)]
|
||||
public string? DeviceType { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "是否启用")]
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
}
|
||||
|
||||
[SugarTable("health_scene_execution", "健康场景执行记录")]
|
||||
[SugarIndex("idx_health_scene_user", nameof(UserId), OrderByType.Asc)]
|
||||
public sealed class HealthSceneExecution : EntityBase
|
||||
{
|
||||
[SugarColumn(ColumnDescription = "健康用户Id")]
|
||||
public long UserId { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "场景编码", Length = 50)]
|
||||
public string SceneCode { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "场景名称", Length = 100)]
|
||||
public string SceneName { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "执行状态", Length = 32)]
|
||||
public string Status { get; set; } = string.Empty;
|
||||
|
||||
[SugarColumn(ColumnDescription = "执行详情", ColumnDataType = "text", IsNullable = true)]
|
||||
public string? Detail { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user