rama creada apartir de master en j
This commit is contained in:
@@ -2,23 +2,32 @@
|
||||
|
||||
namespace adas_core.Domain.Models.Observations;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an observation that captures a double-precision floating-point measurement or value.
|
||||
/// Inherits from the base <see cref="Observation"/> type, providing a specialized observation variant for numeric data of type <see cref="double"/>.
|
||||
/// </summary>
|
||||
public class DoubleObservation : Observation
|
||||
{
|
||||
public double? Value { get; set; }
|
||||
public double? LastValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="DoubleObservation"/> from a list of <see cref="PatientObservation"/> instances, using the first element's value as the primary <c>Value</c> and the second element's value as the <c>LastValue</c> when available.
|
||||
/// </summary>
|
||||
/// <param name="obs">The list of patient observations to convert. At least one element is required to produce a result.</param>
|
||||
/// <returns>A <see cref="DoubleObservation"/> populated with the converted double values, or <c>null</c> if the list is empty.</returns>
|
||||
public static DoubleObservation? From(List<PatientObservation> obs)
|
||||
{
|
||||
if (obs.Count > 0)
|
||||
{
|
||||
var val = new DoubleObservation
|
||||
if (obs.Count > 0)
|
||||
{
|
||||
Value = obs[0].Value.ToDouble()
|
||||
};
|
||||
if (obs.Count > 1) val.LastValue = obs[1].Value.ToDouble();
|
||||
return val;
|
||||
var val = new DoubleObservation
|
||||
{
|
||||
Value = obs[0].Value.ToDouble()
|
||||
};
|
||||
if (obs.Count > 1) val.LastValue = obs[1].Value.ToDouble();
|
||||
return val;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user