Initial commit: HealthManager full-stack health management platform
Backend: .NET 10 + PostgreSQL + EF Core + JWT + SignalR Frontend patient: React 19 + TypeScript + Vite (mobile H5) Frontend doctor: React 19 + TypeScript + Vite (desktop web)
This commit is contained in:
19
backend/src/HealthManager.Domain/Entities/Consultation.cs
Normal file
19
backend/src/HealthManager.Domain/Entities/Consultation.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class Consultation
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid PatientId { get; set; }
|
||||
public Guid DoctorId { get; set; }
|
||||
public string? Subject { get; set; }
|
||||
public string Status { get; set; } = "active"; // active, closed
|
||||
public DateTime StartedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? ClosedAt { get; set; }
|
||||
public Guid? ClosedBy { get; set; }
|
||||
public string? Summary { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User Patient { get; set; } = null!;
|
||||
public User Doctor { get; set; } = null!;
|
||||
public ICollection<ConsultationMessage> Messages { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class ConsultationMessage
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid ConsultationId { get; set; }
|
||||
public Guid SenderId { get; set; }
|
||||
public string SenderRole { get; set; } = string.Empty; // patient, doctor, system
|
||||
public string ContentType { get; set; } = "text"; // text, image, file, template
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public string? ImageUrl { get; set; }
|
||||
public string? FileUrl { get; set; }
|
||||
public bool IsRead { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public Consultation Consultation { get; set; } = null!;
|
||||
public User Sender { get; set; } = null!;
|
||||
}
|
||||
18
backend/src/HealthManager.Domain/Entities/Device.cs
Normal file
18
backend/src/HealthManager.Domain/Entities/Device.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class Device
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid? UserId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string? MacAddress { get; set; }
|
||||
public string? SerialNumber { get; set; }
|
||||
public bool IsBound { get; set; }
|
||||
public DateTime? BoundAt { get; set; }
|
||||
public DateTime? LastSyncAt { get; set; }
|
||||
public int? BatteryLevel { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User? User { get; set; }
|
||||
}
|
||||
16
backend/src/HealthManager.Domain/Entities/DietRecord.cs
Normal file
16
backend/src/HealthManager.Domain/Entities/DietRecord.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class DietRecord
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public string MealType { get; set; } = string.Empty; // breakfast, lunch, dinner, snack
|
||||
public string FoodName { get; set; } = string.Empty;
|
||||
public string? Portion { get; set; }
|
||||
public int? Calories { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public DateOnly RecordedAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
16
backend/src/HealthManager.Domain/Entities/ExerciseRecord.cs
Normal file
16
backend/src/HealthManager.Domain/Entities/ExerciseRecord.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class ExerciseRecord
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public string ExerciseType { get; set; } = string.Empty;
|
||||
public int DurationMin { get; set; }
|
||||
public string? Intensity { get; set; } // low, moderate, high
|
||||
public int? CaloriesBurned { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public DateOnly RecordedAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
19
backend/src/HealthManager.Domain/Entities/FollowUp.cs
Normal file
19
backend/src/HealthManager.Domain/Entities/FollowUp.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class FollowUp
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid PatientId { get; set; }
|
||||
public Guid? DoctorId { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string? Description { get; set; }
|
||||
public DateTime ScheduledAt { get; set; }
|
||||
public string Status { get; set; } = "upcoming"; // upcoming, completed, cancelled, rescheduled
|
||||
public string? Notes { get; set; }
|
||||
public bool ReminderEnabled { get; set; } = true;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User Patient { get; set; } = null!;
|
||||
public User? Doctor { get; set; }
|
||||
}
|
||||
18
backend/src/HealthManager.Domain/Entities/HealthRecord.cs
Normal file
18
backend/src/HealthManager.Domain/Entities/HealthRecord.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class HealthRecord
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public string Type { get; set; } = string.Empty; // blood_pressure, heart_rate, blood_sugar, spo2, weight, steps
|
||||
public JsonDocument Value { get; set; } = null!;
|
||||
public string Unit { get; set; } = string.Empty;
|
||||
public DateTime RecordedAt { get; set; }
|
||||
public string Source { get; set; } = "manual"; // manual, device, doctor
|
||||
public string? Notes { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
22
backend/src/HealthManager.Domain/Entities/Medication.cs
Normal file
22
backend/src/HealthManager.Domain/Entities/Medication.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class Medication
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public Guid? DoctorId { get; set; }
|
||||
public string DrugName { get; set; } = string.Empty;
|
||||
public string Dosage { get; set; } = string.Empty;
|
||||
public string Frequency { get; set; } = string.Empty;
|
||||
public List<string> TimeSlots { get; set; } = [];
|
||||
public DateOnly StartDate { get; set; }
|
||||
public DateOnly? EndDate { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public string Status { get; set; } = "active"; // active, completed, stopped
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
public User? Doctor { get; set; }
|
||||
public ICollection<MedicationRecord> Records { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class MedicationRecord
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid MedicationId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public string TimeSlot { get; set; } = string.Empty;
|
||||
public DateTime? TakenAt { get; set; }
|
||||
public bool IsTaken { get; set; }
|
||||
public string? SkippedReason { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public Medication Medication { get; set; } = null!;
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
16
backend/src/HealthManager.Domain/Entities/Notification.cs
Normal file
16
backend/src/HealthManager.Domain/Entities/Notification.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class Notification
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public string Type { get; set; } = string.Empty; // medication_reminder, followup_reminder, consultation_new, report_completed, health_alert, system
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public Guid? RelatedId { get; set; }
|
||||
public bool IsRead { get; set; }
|
||||
public DateTime? ReadAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class QuickReplyTemplate
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid DoctorId { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public string? Category { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public User Doctor { get; set; } = null!;
|
||||
}
|
||||
13
backend/src/HealthManager.Domain/Entities/RefreshToken.cs
Normal file
13
backend/src/HealthManager.Domain/Entities/RefreshToken.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public 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 DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? RevokedAt { get; set; }
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
22
backend/src/HealthManager.Domain/Entities/Report.cs
Normal file
22
backend/src/HealthManager.Domain/Entities/Report.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class Report
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid PatientId { get; set; }
|
||||
public Guid? DoctorId { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Category { get; set; } = string.Empty;
|
||||
public List<string> ImageUrls { get; set; } = [];
|
||||
public string Status { get; set; } = "pending"; // pending, interpreting, completed
|
||||
public string? RiskLevel { get; set; } // normal, attention, abnormal
|
||||
public string? Summary { get; set; }
|
||||
public string? Suggestions { get; set; }
|
||||
public Guid UploadedBy { get; set; }
|
||||
public DateTime UploadedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? CompletedAt { get; set; }
|
||||
|
||||
public User Patient { get; set; } = null!;
|
||||
public User? Doctor { get; set; }
|
||||
public ICollection<ReportItem> Items { get; set; } = [];
|
||||
}
|
||||
15
backend/src/HealthManager.Domain/Entities/ReportItem.cs
Normal file
15
backend/src/HealthManager.Domain/Entities/ReportItem.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class ReportItem
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid ReportId { get; set; }
|
||||
public string ItemName { get; set; } = string.Empty;
|
||||
public string ResultValue { get; set; } = string.Empty;
|
||||
public string? Unit { get; set; }
|
||||
public string? ReferenceRange { get; set; }
|
||||
public bool IsAbnormal { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
public Report Report { get; set; } = null!;
|
||||
}
|
||||
41
backend/src/HealthManager.Domain/Entities/User.cs
Normal file
41
backend/src/HealthManager.Domain/Entities/User.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace HealthManager.Domain.Entities;
|
||||
|
||||
public class User
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Role { get; set; } = string.Empty; // patient, doctor, admin
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string PasswordHash { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string? AvatarUrl { get; set; }
|
||||
|
||||
// Patient fields
|
||||
public string? Gender { get; set; }
|
||||
public DateOnly? Birthday { get; set; }
|
||||
public decimal? HeightCm { get; set; }
|
||||
public decimal? WeightKg { get; set; }
|
||||
public List<string>? MedicalHistory { get; set; }
|
||||
public DateOnly? StentDate { get; set; }
|
||||
public string? StentType { get; set; }
|
||||
|
||||
// Doctor fields
|
||||
public string? Department { get; set; }
|
||||
public string? Title { get; set; }
|
||||
public List<string>? Specialty { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public bool IsAvailable { get; set; } = true;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public bool IsDeleted { get; set; }
|
||||
public DateTime? DeletedAt { get; set; }
|
||||
|
||||
// Navigation
|
||||
public ICollection<RefreshToken> RefreshTokens { get; set; } = [];
|
||||
public ICollection<HealthRecord> HealthRecords { get; set; } = [];
|
||||
public ICollection<Medication> Medications { get; set; } = [];
|
||||
public ICollection<MedicationRecord> MedicationRecords { get; set; } = [];
|
||||
public ICollection<ExerciseRecord> ExerciseRecords { get; set; } = [];
|
||||
public ICollection<DietRecord> DietRecords { get; set; } = [];
|
||||
public ICollection<Notification> Notifications { get; set; } = [];
|
||||
}
|
||||
Reference in New Issue
Block a user