Files
AI-Health/backend/src/Health.Domain/Entities/medication.cs
MingNian cd65bc4d65 fix: 用药模块重做 + 运动计划不限7天 + 打卡可切换 + 删除修复
- 用药: 重写列表页(标签筛选+详情弹窗+打卡切换+滑动删除)
- 用药: 重写编辑页(选择器替代输入+同列布局+频率改为每天几次)
- 用药: 加Notes字段+DELETE端点+修复重复端点
- 运动: 不限7天, startDate+索引推算当天
- 打卡: 药/运动打卡可切换(点✓取消)
- 删除: 修复滑动删除热区, 一次点击即删除
- 侧边栏: 一键清理历史对话
- 饮食/运动/用药/问诊 API路径加/api/前缀
- 通知时机修正: 新建计划不再提前弹窗
2026-06-04 21:15:23 +08:00

43 lines
1.3 KiB
C#

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 string? Notes { 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!;
}