rama creada apartir de master en j
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
namespace adas_core.Domain.Models.Observations;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a complete observation as a specialized form of the <see cref="Observation"/> base class.
|
||||
/// </summary>
|
||||
public class FullObservation : Observation
|
||||
{
|
||||
public DateTime LastObservationDate;
|
||||
@@ -17,19 +20,24 @@ public class FullObservation : Observation
|
||||
public double? MinWarn { get; set; }
|
||||
public double? MaxWarn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="FullObservation"/> from a list of <see cref="PatientObservation"/> records, using the first entry's data and, when available, the second entry's value and time as the last observation. Returns <c>null</c> when the provided list is empty.
|
||||
/// </summary>
|
||||
/// <param name="obs">The list of patient observations to convert; only the first two entries are used when present.</param>
|
||||
/// <returns>A <see cref="FullObservation"/> built from the first observation, or <c>null</c> if <paramref name="obs"/> contains no items.</returns>
|
||||
public static FullObservation? From(List<PatientObservation> obs)
|
||||
{
|
||||
if (obs.Count > 0)
|
||||
return new FullObservation
|
||||
{
|
||||
Text = obs[0].Name,
|
||||
Value = obs[0].Value,
|
||||
Min = obs[0].Min,
|
||||
Max = obs[0].Max,
|
||||
ObservationDate = obs[0].Time,
|
||||
LastValue = obs.Count > 1 ? obs[1].Value : null,
|
||||
LastObservationDate = obs.Count > 1 ? obs[1].Time : DateTime.MinValue
|
||||
};
|
||||
return null;
|
||||
}
|
||||
{
|
||||
if (obs.Count > 0)
|
||||
return new FullObservation
|
||||
{
|
||||
Text = obs[0].Name,
|
||||
Value = obs[0].Value,
|
||||
Min = obs[0].Min,
|
||||
Max = obs[0].Max,
|
||||
ObservationDate = obs[0].Time,
|
||||
LastValue = obs.Count > 1 ? obs[1].Value : null,
|
||||
LastObservationDate = obs.Count > 1 ? obs[1].Time : DateTime.MinValue
|
||||
};
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user