Files
AI-Health/backend/src/Health.Domain/Entities/support_entities.cs
MingNian 53ce19e8c3 feat: 健康录入提醒 + 多指标异常 + 用药漏服 + UI 优化
后端
- NotificationPreference 增加健康录入提醒总开关和 5 子项(血压/心率/血糖/血氧/体重)
- EF 迁移 AddHealthRecordReminder
- 新增 GET/PUT /api/notification-prefs
- 新增 HealthRecordReminderService 每天 9 点/12 点扫描未录入用户推送提醒

前端
- 通知偏好对接真实后端 API
- 设置页新增「健康录入提醒」总开关+5 子项
- 通知中心右上角加齿轮跳设置页
- 今日健康卡片:4 项异常检测+多项合并;用药只显漏服并按时间窗口区分文案
- 侧边栏头像改圆形白底灰图标,去掉紫色品牌渐变
- 整体背景统一浅灰白 #F6F8FC,去掉浅紫渐变
- 设置页简化(去掉分组/彩色图标方块)
- 健康档案保存按钮移到右上角,TextButton 全局默认黑色
- API baseUrl 跟随网络环境
2026-06-24 22:11:21 +08:00

136 lines
4.5 KiB
C#

using Health.Domain.Enums;
using System.ComponentModel.DataAnnotations.Schema;
namespace Health.Domain.Entities;
/// <summary>
/// 复查/随访计划
/// </summary>
public sealed class FollowUp
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string Title { get; set; } = string.Empty;
public string? DoctorName { get; set; }
public string? Department { get; set; }
public DateTime ScheduledAt { get; set; }
public string? Notes { get; set; }
public FollowUpStatus Status { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public User User { get; set; } = null!;
}
/// <summary>
/// 健康档案
/// </summary>
public sealed class HealthArchive
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string? Diagnosis { get; set; } // 主要诊断
public string? SurgeryType { get; set; } // 手术类型
public DateOnly? SurgeryDate { get; set; } // 手术日期
public List<string> Allergies { get; set; } = []; // 过敏信息
public List<string> DietRestrictions { get; set; } = []; // 饮食限制
public List<string> ChronicDiseases { get; set; } = []; // 慢病史
public string? FamilyHistory { get; set; } // 家族病史
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public User User { get; set; } = null!;
public ICollection<HealthArchiveSurgery> Surgeries { get; set; } = [];
}
public sealed class HealthArchiveSurgery
{
public Guid Id { get; set; }
public Guid HealthArchiveId { get; set; }
public string Type { get; set; } = string.Empty;
public DateOnly? Date { get; set; }
public int SortOrder { get; set; }
public HealthArchive HealthArchive { get; set; } = null!;
}
/// <summary>
/// 刷新令牌
/// </summary>
public sealed class RefreshToken
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string Token { get; set; } = string.Empty;
public DateTime ExpiresAt { get; set; }
public bool IsRevoked { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
/// <summary>
/// 短信验证码
/// </summary>
public sealed class VerificationCode
{
public Guid Id { get; set; }
public string Phone { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public DateTime ExpiresAt { get; set; }
public bool IsUsed { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
/// <summary>
/// 通知偏好
/// </summary>
public sealed class NotificationPreference
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public bool MedicationReminder { get; set; } = true;
public bool FollowUpReminder { get; set; } = true;
public bool DoctorReply { get; set; } = true;
public bool AbnormalAlert { get; set; } = true;
// 健康录入提醒——总开关 + 5 子项
public bool HealthRecordReminder { get; set; } = true;
public bool HealthRecordReminderBloodPressure { get; set; } = true;
public bool HealthRecordReminderHeartRate { get; set; } = true;
public bool HealthRecordReminderGlucose { get; set; } = true;
public bool HealthRecordReminderSpO2 { get; set; } = true;
public bool HealthRecordReminderWeight { get; set; } = true;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public User User { get; set; } = null!;
}
/// <summary>
/// 设备推送 token
/// </summary>
public sealed class DeviceToken
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public string Platform { get; set; } = string.Empty; // ios / android
public string PushToken { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public User User { get; set; } = null!;
}
public sealed class UserNotification
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public Guid SourceId { get; set; }
public string Type { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public string Severity { get; set; } = "info";
public string? ActionType { get; set; }
public string? ActionTargetId { get; set; }
public bool IsRead { get; set; }
public DateTime? ReadAt { get; set; }
public bool IsDeleted { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}