chore: 全面规范化代码,遵循 CLAUDE.md 编码规范

- C# 文件命名改为 snake_case(28 个文件重命名)
- C# 类转换为主构造函数(8 个类)
- 空 catch 添加异常类型(2 处)
- 新建 GlobalUsings.cs(Health.Infrastructure、Health.WebApi)
- Flutter 移除 go_router,改用 Riverpod 路由栈
- Flutter 移除 flutter_secure_storage,改用 sqflite 持久化
- 修复 Flutter 构建路径(Flutter SDK 迁至 D 盘)
- 后端端口改为 0.0.0.0:5000,支持局域网访问
This commit is contained in:
MingNian
2026-06-02 12:41:06 +08:00
parent 14d7c30d3d
commit 6e69f1085e
47 changed files with 342 additions and 428 deletions

View File

@@ -0,0 +1,41 @@
using Health.Domain.Enums;
namespace Health.Domain.Entities;
/// <summary>
/// 用药计划
/// </summary>
public sealed class Medication
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string Name { get; set; } = string.Empty;
public string? Dosage { get; set; }
public MedicationFrequency Frequency { get; set; }
public List<TimeOnly> TimeOfDay { get; set; } = []; // PostgreSQL TIME[] 数组
public DateOnly? StartDate { get; set; }
public DateOnly? EndDate { get; set; }
public bool IsActive { get; set; } = true;
public MedicationSource Source { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public User User { get; set; } = null!;
public ICollection<MedicationLog> Logs { get; set; } = [];
}
/// <summary>
/// 用药打卡记录
/// </summary>
public sealed class MedicationLog
{
public Guid Id { get; set; }
public Guid MedicationId { get; set; }
public Guid UserId { get; set; }
public MedicationLogStatus Status { get; set; }
public TimeOnly ScheduledTime { get; set; }
public DateTime? ConfirmedAt { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public Medication Medication { get; set; } = null!;
}