Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop

This commit is contained in:
jrojas
2026-06-26 09:52:35 +02:00
commit 319fd3dfb0
746 changed files with 106610 additions and 0 deletions
@@ -0,0 +1,20 @@
namespace adas_core.Domain.Models.Pumps;
public abstract class CommonPumpTypes
{
// Tipos auxiliares para valores con unidades (idénticos a PatientPumpObservation pero anidados aquí)
public class PumpValue
{
public double? Value { get; set; }
public string? Units { get; set; }
public override string ToString() => $"{{Value: {Value}, Units: {Units}}}";
}
public class SyringeDetails
{
public string? Type { get; set; }
public string? Manufacturer { get; set; }
public PumpValue? Volume { get; set; }
}
}
@@ -0,0 +1,37 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.Pumps;
public class PumpAlarmEvent
{
public ObjectId Id { get; set; }
// Dispositivo / contexto
public string? DeviceId { get; set; }
public string? RackId { get; set; }
public string? DeviceTypeMdc { get; set; }
public string? InfusionId { get; set; }
public DateTime Time { get; set; }
public ObjectId? PatientId { get; set; }
// Alarma
public PumpEnum.AlarmType? AlarmType { get; set; }
public string? AlarmDescription { get; set; }
public string? AlarmState { get; set; } // active/inactive/latched
public string? AlarmInactivationState { get; set; } // enabled / alert-acknowledged~audio-paused
public string? AlarmPriority { get; set; } // PL/PM/PH
public string? AlarmTypeMdc { get; set; } // e.g., "ST"
public PumpEnum.EventPhase? EventPhase { get; set; } // start/continue/end
public string? AlertSourceMdc { get; set; } // p.ej. MDC_DEV_PUMP_INFUS_SYRINGE_VMD
// Ubicación física / red (opcionales)
public string? DeviceIp { get; set; }
public string? PillarAssembly { get; set; }
public string? PillarRackSlot { get; set; }
}
@@ -0,0 +1,39 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.Pumps
{
/// <summary>
/// Estado actual de alarmas activas por bomba.
/// Una fila por alarma activa (DeviceId + AlarmType o AlarmCodeMdc).
/// Se actualiza vía PumpService: start/continue → upsert, end → delete.
/// </summary>
public class PumpAlarmState
{
public ObjectId Id { get; set; }
// Bomba
public string? DeviceId { get; set; }
// Paciente (si la bomba lo envía)
public ObjectId? PatientId { get; set; }
// Tipo / Identificador de alarma
public PumpEnum.AlarmType? AlarmType { get; set; }
public string? AlarmCodeMdc { get; set; }
// Estado actual
public string? AlarmDescription { get; set; }
public string? AlarmPriority { get; set; } // PL/PM/PH
public string? AlarmState { get; set; } // active / inactive / latched
public PumpEnum.EventPhase? LastPhase { get; set; } // start / continue / end
// Timestamps
public DateTime FirstSeen { get; set; } = DateTime.UtcNow;
public DateTime LastUpdated { get; set; } = DateTime.UtcNow;
// Contexto (opcional)
public string? AlertSourceMdc { get; set; }
public string? InfusionId { get; set; }
}
}
@@ -0,0 +1,108 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.Pumps
{
/// <summary>
/// Datos unificados de entrada (del HL7): transporta la información
/// de observaciones (PCD-01/10), alarmas (PCD-04) y eventos. El servicio
/// decidirá cómo dividir y persistir en las colecciones destino.
/// </summary>
public class PumpObservation
{
public ObjectId Id { get; set; }
public ObjectId? PatientId { get; set; }
public DateTime Time { get; set; }
// Identificadores / dispositivo
public string? DeviceId { get; set; }
public string? RackId { get; set; }
public string? DeviceTypeMdc { get; set; }
// Infusión / tiempo
public string? InfusionId { get; set; }
/// <summary>Tipo semántico de este DTO: Observation (PCD-01/10) o Alarm (PCD-04).</summary>
public PumpEnum.PumpMessageType MessageType { get; set; }
#region PROPIEDADES DE LA CLASE ORIGINAL
//necesarios para que funcione Alaris
//TODO verificar
public int? TotalAux { get; set; }
public CommonPumpTypes.PumpValue? Pressure { get; set; }
public CommonPumpTypes.PumpValue? DiluentVolume { get; set; }
public CommonPumpTypes.PumpValue? PatientHeight { get; set; }
public int GatewayNumber { get; set; }
public int? Expires { get; set; }
public Dictionary<string, object>? UiConfiguration { get; set; }
public CommonPumpTypes.PumpValue? BasalRate { get; set; }
public string? Code { get; set; }
public string? Name { get; set; }
public int? Number { get; set; }
public int? Total { get; set; }
public bool? IsAux { get; set; }
public PumpEnum.AlarmMode? AlarmMode { get; set; }
#endregion
// ============================
// OBSERVACIONES (PCD-01 / 10)
// ============================
public bool? IsInfusing { get; set; }
public PumpEnum.InfusingStatus? InfusingStatus { get; set; }
public PumpEnum.Status? Status { get; set; }
public PumpEnum.Mode? PumpMode { get; set; }
public string? ActiveSourceInfo { get; set; } // Primary/Clinician/Loading/Priming
public string? InfusionModeDetail { get; set; } // Texto del modo
public string? NotDeliveringReason { get; set; }
public string? Source { get; set; } // primary-source, clinician-source...
public CommonPumpTypes.PumpValue? FlowFluid { get; set; } // actual
public CommonPumpTypes.PumpValue? Rate { get; set; } // programada
public CommonPumpTypes.PumpValue? VolumeInfused { get; set; } // segmento
public CommonPumpTypes.PumpValue? FluidDelivTotal { get; set; } // total
public CommonPumpTypes.PumpValue? FluidDelivTotalSet { get; set; } // acumulado
public CommonPumpTypes.PumpValue? VolumeRemaining { get; set; }
public CommonPumpTypes.PumpValue? Vtbi { get; set; }
public CommonPumpTypes.PumpValue? TimeRemaining { get; set; } // seg
public CommonPumpTypes.PumpValue? TimeProgrammed { get; set; } // seg
// Medicación / dosis
public string? DrugName { get; set; }
public string? DrugId { get; set; }
public CommonPumpTypes.PumpValue? Concentration { get; set; }
public CommonPumpTypes.PumpValue? DoseRate { get; set; }
public CommonPumpTypes.PumpValue? DrugAmount { get; set; } // TBI
public CommonPumpTypes.PumpValue? DrugDoseDelivered { get; set; } // total
public CommonPumpTypes.PumpValue? PatientWeight { get; set; }
public CommonPumpTypes.SyringeDetails? Syringe { get; set; }
// Ubicación física / red
public string? DeviceIp { get; set; }
public string? PillarAssembly { get; set; } // "1,1,4,pillar-orientation-vertical,slot-rackdirection-down"
public string? PillarRackSlot { get; set; } // "1,2,3,NA"
// ============================
// ALARMAS (PCD-04)
// ============================
public PumpEnum.AlarmType? AlarmType { get; set; }
public string? AlarmDescription { get; set; }
public string? AlarmState { get; set; } // active/inactive/latched
public string? AlarmInactivationState { get; set; } // enabled / alert-acknowledged~audio-paused
public string? AlarmPriority { get; set; } // PL/PM/PH
public string? AlarmTypeMdc { get; set; } // e.g., "ST"
public PumpEnum.EventPhase? EventPhase { get; set; } // start/continue/end
public string? AlertSourceMdc { get; set; }
// ============================
// EVENTOS (PCD-10)
// ============================
public PumpEnum.Event? Event { get; set; }
}
}
@@ -0,0 +1,82 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.Pumps
{
/// <summary>
/// Snapshot vivo de la bomba, indexado por DeviceId.
/// Se sobrescribe con cada mensaje del HL7.
/// Contiene siempre el último valor conocido de la bomba.
/// </summary>
public class PumpState
{
public ObjectId Id { get; set; }
// Identificación bomba
public string? DeviceId { get; set; }
public string? RackId { get; set; }
public string? DeviceTypeMdc { get; set; }
// Ubicación física
public string? DeviceIp { get; set; }
public string? PillarAssembly { get; set; }
public string? PillarRackSlot { get; set; }
// Paciente asociado (si existe)
public ObjectId? PatientId { get; set; }
// Infusión activa
public string? InfusionId { get; set; }
public DateTime LastUpdated { get; set; }
// Estado general
public bool IsInfusing { get; set; }
public PumpEnum.InfusingStatus? InfusingStatus { get; set; }
public PumpEnum.Status? Status { get; set; }
public PumpEnum.Mode? PumpMode { get; set; }
public string? InfusionModeDetail { get; set; }
public string? ActiveSourceInfo { get; set; }
public string? NotDeliveringReason { get; set; }
public string? Source { get; set; }
// Métricas
public CommonPumpTypes.PumpValue? FlowFluid { get; set; }
public CommonPumpTypes.PumpValue? Rate { get; set; }
public CommonPumpTypes.PumpValue? VolumeInfused { get; set; }
public CommonPumpTypes.PumpValue? FluidDelivTotal { get; set; }
public CommonPumpTypes.PumpValue? FluidDelivTotalSet { get; set; }
public CommonPumpTypes.PumpValue? VolumeRemaining { get; set; }
public CommonPumpTypes.PumpValue? Vtbi { get; set; }
public CommonPumpTypes.PumpValue? TimeRemaining { get; set; }
public CommonPumpTypes.PumpValue? TimeProgrammed { get; set; }
// Medicación
public string? DrugName { get; set; }
public string? DrugId { get; set; }
public CommonPumpTypes.PumpValue? Concentration { get; set; }
public CommonPumpTypes.PumpValue? DoseRate { get; set; }
public CommonPumpTypes.PumpValue? DrugAmount { get; set; }
public CommonPumpTypes.PumpValue? DrugDoseDelivered { get; set; }
public CommonPumpTypes.PumpValue? PatientWeight { get; set; }
public CommonPumpTypes.SyringeDetails? Syringe { get; set; }
// Última alarma recibida
public PumpEnum.AlarmType? AlarmType { get; set; }
public string? AlarmDescription { get; set; }
public string? AlarmState { get; set; }
public string? AlarmInactivationState { get; set; }
public string? AlarmPriority { get; set; }
public string? AlarmCodeMdc { get; set; }
// Evento último
public PumpEnum.Event? Event { get; set; }
public PumpEnum.EventPhase? EventPhase { get; set; }
// Comunicación / Relay
public string? CommStatus { get; set; }
public string? RelayState { get; set; }
public string? RelayGuid { get; set; }
}
}