Files
draletaha/DrSousan.Api/Models/Models.cs
T
soroush.asadi 3780dcccf2
CI/CD / CI · dotnet build (push) Successful in 59s
CI/CD / Deploy · drsousan (push) Successful in 1m33s
feat: patient management system + health landing page
Backend:
- Patient model: name, phone, email, age, weight, height, gender,
  blood type, disease history, allergies, medications, notes, category
- PatientVisit model: title, content, prescription, visit type,
  visit/next-visit dates, linked to patient (cascade delete)
- HealthRequest model: public form submissions for beauty/health care
- Runtime SQLite migrations for all 3 new tables
- Full CRUD API: /api/patients, /api/patients/{id}/visits,
  /api/health-requests (public POST + admin GET/PUT/DELETE)

Admin panel:
- 'پرونده بیماران' page: list, search, filter by category (beauty/health)
- Patient profile page: personal info + medical history + visits timeline
- Add/edit patient modal with all medical fields
- Add visit modal: type, date, clinical notes, prescription, next visit
- 'درخواست‌ها' page: manage public health requests, mark as handled
- Badge counter for unhandled requests in sidebar

Frontend (SEO):
- New #health-care section with Schema.org MedicalClinic markup
- Two category cards: زیبایی پوست and سلامت عمومی
- Feature lists with checkmarks per category
- Inline request form that submits to /api/health-request
- Mobile responsive (single column on small screens)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-06-02 12:27:16 +03:30

188 lines
9.1 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace DrSousan.Api.Models;
// ─── Site Settings (key-value store per section) ─────────────────────────────
public class SiteSetting
{
public int Id { get; set; }
[MaxLength(100)] public string Key { get; set; } = "";
public string Value { get; set; } = "";
[MaxLength(50)] public string Section { get; set; } = "";
}
// ─── Service card ─────────────────────────────────────────────────────────────
public class Service
{
public int Id { get; set; }
[MaxLength(200)] public string Title { get; set; } = "";
public string Description { get; set; } = "";
[MaxLength(500)] public string IconSvg { get; set; } = "";
[MaxLength(500)] public string BeforeImageUrl { get; set; } = "";
[MaxLength(500)] public string AfterImageUrl { get; set; } = "";
public int Order { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── Gallery item ─────────────────────────────────────────────────────────────
public class GalleryItem
{
public int Id { get; set; }
[MaxLength(500)] public string ImageUrl { get; set; } = "";
[MaxLength(500)] public string BeforeImageUrl { get; set; } = "";
[MaxLength(500)] public string AfterImageUrl { get; set; } = "";
[MaxLength(100)] public string Category { get; set; } = "";
[MaxLength(300)] public string Caption { get; set; } = "";
public int Order { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── Testimonial ──────────────────────────────────────────────────────────────
public class Testimonial
{
public int Id { get; set; }
[MaxLength(100)] public string AuthorName { get; set; } = "";
[MaxLength(10)] public string AuthorEmoji { get; set; } = "👩";
public string Text { get; set; } = "";
public int Rating { get; set; } = 5;
[MaxLength(50)] public string Date { get; set; } = "";
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── Blog category ────────────────────────────────────────────────────────────
public class BlogCategory
{
public int Id { get; set; }
[MaxLength(100)] public string Name { get; set; } = "";
[MaxLength(120)] public string Slug { get; set; } = "";
public string Description { get; set; } = "";
public ICollection<BlogPost> Posts { get; set; } = new List<BlogPost>();
}
// ─── Blog post ────────────────────────────────────────────────────────────────
public class BlogPost
{
public int Id { get; set; }
// Content
[MaxLength(300)] public string Title { get; set; } = "";
[MaxLength(320)] public string Slug { get; set; } = "";
public string Excerpt { get; set; } = "";
public string Content { get; set; } = "";
[MaxLength(500)] public string FeaturedImage { get; set; } = "";
[MaxLength(100)] public string Author { get; set; } = "دکتر سوسن آل‌طه";
// SEO
[MaxLength(70)] public string MetaTitle { get; set; } = "";
[MaxLength(160)] public string MetaDescription { get; set; } = "";
[MaxLength(100)] public string FocusKeyword { get; set; } = "";
public string Keywords { get; set; } = ""; // comma-separated
[MaxLength(500)] public string OgImage { get; set; } = "";
// Schema.org
[MaxLength(50)] public string ArticleType { get; set; } = "MedicalWebPage";
// Status
public bool IsPublished { get; set; } = false;
public DateTime? PublishedAt { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Metrics
public int ViewCount { get; set; } = 0;
public int ReadingTimeMinutes { get; set; } = 5;
// Relations
public int? CategoryId { get; set; }
public BlogCategory? Category { get; set; }
}
// ─── Blog comment ────────────────────────────────────────────────────────────
public class Comment
{
public int Id { get; set; }
[MaxLength(100)] public string AuthorName { get; set; } = "";
[MaxLength(200)] public string AuthorEmail { get; set; } = "";
public string Body { get; set; } = "";
public bool IsApproved { get; set; } = false;
public bool IsAdminReply { get; set; } = false;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Post relation
public int BlogPostId { get; set; }
public BlogPost? Post { get; set; }
// Self-referential reply
public int? ParentId { get; set; }
public Comment? Parent { get; set; }
public ICollection<Comment> Replies { get; set; } = new List<Comment>();
}
// ─── FAQ ─────────────────────────────────────────────────────────────────────
public class Faq
{
public int Id { get; set; }
public string Question { get; set; } = "";
public string Answer { get; set; } = "";
public int Order { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── Patient ──────────────────────────────────────────────────────────────────
public class Patient
{
public int Id { get; set; }
[MaxLength(150)] public string FullName { get; set; } = "";
[MaxLength(20)] public string PhoneNumber { get; set; } = "";
[MaxLength(200)] public string Email { get; set; } = "";
public int Age { get; set; }
public decimal Weight { get; set; } // kg
public decimal Height { get; set; } // cm
[MaxLength(10)] public string Gender { get; set; } = ""; // مرد / زن
[MaxLength(10)] public string BloodType { get; set; } = "";
public string DiseaseHistory { get; set; } = "";
public string Allergies { get; set; } = "";
public string Medications { get; set; } = "";
public string Notes { get; set; } = "";
[MaxLength(20)] public string Category { get; set; } = "beauty"; // beauty | health
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public ICollection<PatientVisit> Visits { get; set; } = new List<PatientVisit>();
}
// ─── Patient Visit / Doctor Note ──────────────────────────────────────────────
public class PatientVisit
{
public int Id { get; set; }
public int PatientId { get; set; }
public Patient? Patient { get; set; }
[MaxLength(300)] public string Title { get; set; } = "";
public string Content { get; set; } = "";
public string Prescription { get; set; } = ""; // دارو / تجویز
[MaxLength(50)] public string VisitType { get; set; } = "ویزیت"; // ویزیت | آزمایش | پروسیجر
public DateTime VisitDate { get; set; } = DateTime.UtcNow;
public DateTime? NextVisitDate { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── Health / Appointment Request (public form) ───────────────────────────────
public class HealthRequest
{
public int Id { get; set; }
[MaxLength(150)] public string FullName { get; set; } = "";
[MaxLength(20)] public string PhoneNumber { get; set; } = "";
[MaxLength(200)] public string Email { get; set; } = "";
public string Message { get; set; } = "";
[MaxLength(20)] public string Category { get; set; } = "beauty"; // beauty | health
public bool IsHandled { get; set; } = false;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
// ─── DTOs ─────────────────────────────────────────────────────────────────────
public record LoginRequest(string Username, string Password);
public record ChangePasswordRequest(string CurrentPassword, string NewPassword);
public record SettingDto(string Key, string Value);
public record BulkSettingsDto(Dictionary<string, string> Settings);