90 lines
2.4 KiB
C#
90 lines
2.4 KiB
C#
using adas_core.Domain.Enums;
|
|
using adas_core.Domain.Models.MongoModels;
|
|
using MongoDB.Bson;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
|
|
namespace adas_core.Domain.Models;
|
|
|
|
public class PatientObservation : BasePatientObservationValue
|
|
{
|
|
private string? _result;
|
|
|
|
public PatientObservation()
|
|
{
|
|
}
|
|
|
|
public PatientObservation(ObjectId patientId, object value, string? name)
|
|
{
|
|
PatientId = patientId;
|
|
Value = value;
|
|
Name = name;
|
|
}
|
|
|
|
public double? Max { get; set; }
|
|
|
|
public double? Min { get; set; }
|
|
|
|
public double? MaxWarn { get; set; }
|
|
|
|
public double? MinWarn { get; set; }
|
|
|
|
public string? WarnColor { get; set; }
|
|
|
|
public string? AlertColor { get; set; }
|
|
|
|
public bool ShowOnExpired { get; set; } = true;
|
|
public ObservationEnum.InsertMode InsertMode { get; set; } = ObservationEnum.InsertMode.Auto;
|
|
|
|
public bool? Persist { get; set; }
|
|
|
|
public string? ColorOnExpired { get; set; }
|
|
|
|
//MSH Time of HL7
|
|
public DateTime MessageTime { get; set; }
|
|
|
|
public string? Result
|
|
{
|
|
get => _result;
|
|
set => _result = value == "F" ? null : value;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
var items = ToListString();
|
|
items.Add($"value: {Value}");
|
|
if (Max != null) items.Add($"max: {Max}");
|
|
if (Min != null) items.Add($"min: {Min}");
|
|
if (MaxWarn != null) items.Add($"maxWarn: {MaxWarn}");
|
|
if (MinWarn != null) items.Add($"minWarn: {MinWarn}");
|
|
if (!string.IsNullOrEmpty(Result)) items.Add($"result: {Result}");
|
|
items.Add($"status: {Status}");
|
|
if (Expires != null) items.Add($"expires: {Expires}");
|
|
if (!ShowOnExpired) items.Add($"showOnExpired: {ShowOnExpired}");
|
|
if (ColorOnExpired != null) items.Add($"colorOnExpired: {ColorOnExpired}");
|
|
if (Persist != null) items.Add($"persist: {Persist}");
|
|
return "PatientObservation[" + string.Join(", ", items) + "]";
|
|
}
|
|
|
|
public PatientObservation DeepCopy()
|
|
{
|
|
return (PatientObservation)MemberwiseClone();
|
|
}
|
|
|
|
|
|
#region calculated properties
|
|
|
|
public StatusEnum.Type Status { get; set; } = StatusEnum.Type.Ok;
|
|
|
|
public int Level { get; set; }
|
|
|
|
public int? Expires { get; set; } //seconds
|
|
|
|
|
|
[BsonDefaultValue(false)] public bool Expired { get; set; }
|
|
|
|
public Dictionary<string, object>? UiConfiguration { get; set; }
|
|
|
|
public AlarmConfig? Alarm { get; set; }
|
|
|
|
#endregion
|
|
} |