58 lines
2.3 KiB
C#
58 lines
2.3 KiB
C#
using adas_core.Domain.Models.Masters;
|
|
using MongoDB.Bson;
|
|
|
|
namespace adas_core.Domain.Models.MongoModels;
|
|
|
|
/// <summary>
|
|
/// Represents an admission, typically encapsulating data and behavior related to the process of admitting an entity, such as a student or patient, into an institution or system.
|
|
/// </summary>
|
|
public class Admission
|
|
{
|
|
public ObjectId Id { get; set; }
|
|
public DateTime AdmissionDate { get; set; }
|
|
public string Nhc { get; set; } = string.Empty;
|
|
public ObjectId UnitId { get; set; }
|
|
public ObjectId? PointOfCareId { get; set; }
|
|
public Person? Person { get; set; }
|
|
|
|
public OptionList? Origin { get; set; }
|
|
public string? OriginAux { get; set; }
|
|
|
|
public OptionList? Diagnosis { get; set; }
|
|
public string? DiagnosisAux { get; set; }
|
|
|
|
public List<OptionList>? Allergies { get; set; }
|
|
public OptionList? Insulation { get; set; }
|
|
public List<OptionList>? LanguageBarrier { get; set; }
|
|
public OptionList? PassiveSitting { get; set; }
|
|
|
|
#region UnMap
|
|
|
|
public PatientLocation? PatientLocation { get; set; }
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// Returns a human-readable string representation of the Admission, conditionally including NHC, Person, Admission Date, location, Origin, Diagnosis, and any associated Allergies only when they are present.
|
|
/// </summary>
|
|
/// <returns>A formatted string in the form "Admission [...]" summarizing the Admission's key properties.</returns>
|
|
public override string ToString()
|
|
{
|
|
List<string> items = [];
|
|
|
|
if (!string.IsNullOrEmpty(Nhc)) items.Add($"NHC: {Nhc}");
|
|
if (Person != null) items.Add($", Person: {Person}");
|
|
items.Add($"Admission Date: {AdmissionDate}");
|
|
if (PointOfCareId != null) items.Add($"Location: {PointOfCareId}");
|
|
if (PatientLocation != null) items.Add($"Location: {PatientLocation}");
|
|
if (Origin != null) items.Add($", Origin: {Origin.Name}");
|
|
if (Diagnosis != null) items.Add($", Diagnosis; {Diagnosis.Name}");
|
|
if (Allergies != null)
|
|
{
|
|
items.Add("Allergies:");
|
|
Allergies.ForEach(a => items.Add($", Allergy; {a.Name}"));
|
|
}
|
|
|
|
return "Admission [" + string.Join(", ", items) + "]";
|
|
}
|
|
} |