DotNet_Capstone_Project/.Net Capstone Project/PatientChartDto.cs

194 lines
6.1 KiB
C#

using ClinicalInsightsPro.API.Models;
namespace ClinicalInsightsPro.API.DTOs;
/// <summary>
/// Everything the dashboard's Chart tab needs in ONE payload.
///
/// The demographic fields at the top are the patient header; the five lists
/// below are the chart panels. dashboard.js reads chart.conditions.length,
/// chart.allergies.length, etc. — so these lists must ALWAYS be non-null,
/// even when empty. That is why each one is initialised to an empty list
/// instead of being left null.
/// </summary>
public class PatientChartDto
{
// ---- Patient header (shown above the chart panels) ----
public string PatientId { get; set; } = string.Empty;
public string FullName { get; set; } = string.Empty;
public int Age { get; set; }
public string MedicalRecordNumber { get; set; } = string.Empty;
public string IdentifierSystem { get; set; } = string.Empty;
public string IdentifierValue { get; set; } = string.Empty;
public string NameUse { get; set; } = string.Empty;
public string? Prefix { get; set; }
public string GivenName { get; set; } = string.Empty;
public string FamilyName { get; set; } = string.Empty;
public string TelecomSystem { get; set; } = "phone";
public string TelecomUse { get; set; } = "work";
public string TelecomValue { get; set; } = string.Empty;
public string Gender { get; set; } = string.Empty;
// Stored on Patient (not a FHIR field) so the dashboard can show them.
public string? BloodGroup { get; set; }
public string? Email { get; set; }
public DateTime BirthDate { get; set; }
public string AddressUse { get; set; } = "home";
public string AddressType { get; set; } = "both";
public string? AddressLine { get; set; }
public string City { get; set; } = string.Empty;
public string State { get; set; } = string.Empty;
public string PostalCode { get; set; } = string.Empty;
public string? MaritalStatusSystem { get; set; }
public string? MaritalStatusCode { get; set; }
public string? MaritalStatusDisplay { get; set; }
public string? ContactNameUse { get; set; }
public string? ContactPrefix { get; set; }
public string? ContactTelecomSystem { get; set; }
public string? ContactTelecomUse { get; set; }
public string? ContactTelecomValue { get; set; }
public string? ContactAddressUse { get; set; }
public string? ContactAddressType { get; set; }
public string? ContactAddressLine { get; set; }
public string? ContactCity { get; set; }
public string? ContactState { get; set; }
public string? ContactPostalCode { get; set; }
public string? ContactGender { get; set; }
public string? ContactOrganizationId { get; set; }
public DateTime? ContactPeriodStart { get; set; }
public DateTime? ContactPeriodEnd { get; set; }
public string? ManagingOrganizationId { get; set; }
public string? PhotoContentType { get; set; }
public string? PhotoUrl { get; set; }
public string? PhotoTitle { get; set; }
public string? GeneralPractitionerId { get; set; }
// ---- Chart panels ----
public List<ChartConditionDto> Conditions { get; set; } = new();
public List<ChartAllergyDto> Allergies { get; set; } = new();
public List<ChartMedicationDto> Medications { get; set; } = new();
public List<ChartObservationDto> Observations { get; set; } = new();
public List<ChartEncounterDto> Encounters { get; set; } = new();
}
// Each chart row DTO mirrors the columns that actually exist on the matching
// entity — no invented "substance"/"dosage"/"value" fields, so what the UI
// shows is exactly what is stored in PostgreSQL.
public class ChartConditionDto
{
public string Id { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public string Display { get; set; } = string.Empty;
public string ClinicalStatus { get; set; } = string.Empty;
public string VerificationStatus { get; set; } = string.Empty;
public string Severity { get; set; } = string.Empty;
public DateTime? OnsetDate { get; set; }
public DateTime? AbatementDate { get; set; }
public DateTime? RecordedDate { get; set; }
}
public class ChartAllergyDto
{
public string Id { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public string ClinicalStatus { get; set; } = string.Empty;
public string VerificationStatus { get; set; } = string.Empty;
public string? Criticality { get; set; }
public string? RecorderPractitionerId { get; set; }
}
public class ChartMedicationDto
{
public string Id { get; set; } = string.Empty;
public string MedicationCode { get; set; } = string.Empty;
public string? MedicationDisplay { get; set; }
public string Status { get; set; } = string.Empty;
public string Intent { get; set; } = string.Empty;
public string? Priority { get; set; }
}
public class ChartObservationDto
{
public string Id { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public string? Display { get; set; }
public string Status { get; set; } = string.Empty;
public string? CategoryDisplay { get; set; }
public string? InterpretationCode { get; set; }
public string? InterpretationDisplay { get; set; }
public DateTimeOffset? EffectiveDate { get; set; }
public string? NoteText { get; set; }
}
public class ChartEncounterDto
{
public string Id { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public string ClassCode { get; set; } = string.Empty;
public string ClassDisplay { get; set; } = string.Empty;
public string? TypeDisplay { get; set; }
public string? ServiceTypeDisplay { get; set; }
public DateTime PeriodStart { get; set; }
public DateTime PeriodEnd { get; set; }
}
public class PatientSummaryDto
{
public string Id { get; set; } = string.Empty;
public string FullName { get; set; } = string.Empty;
public int Age { get; set; }
public string Gender { get; set; } = string.Empty;
public string MedicalRecordNumber { get; set; } = string.Empty;
}