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,75 @@
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Pumps;
using MongoDB.Bson;
using Newtonsoft.Json;
namespace adas_core.Domain.Models;
public class AdmPanelRequest
{
public string? Type { get; set; }
public string? PatientNumber { get; set; }
public Person? Patient { get; set; }
public string? PatientId { get; set; }
public string? Id { get; set; }
public DateTime? AdmTime { get; set; }
public DateTime? DisTime { get; set; }
public PatientLocation? Location { get; set; }
public ObjectId? PointOfCareId { get; set; }
public ObjectId? UnitId { get; set; }
// ADT
public PatientLocation? OldLocation { get; set; }
public Person? AttendingDoctor { get; set; }
public string? OldPatientNumber { get; set; }
// ORU
public ObservationData? ObservationData { get; set; }
public ObservationData? ObsertationData
{
get => ObservationData;
set => ObservationData = value;
}
public List<PatientObservation>? Observations { get; set; }
public PatientObservation? Observation { get; set; }
public List<PumpObservation>? PumpObservations { get; set; }
public PumpObservation? PumpObservation { get; set; }
public string SectionId { get; set; } = string.Empty;
public string SectionItemGroup { get; set; } = string.Empty;
public Box? SectionItemBoxUpdated { get; set; }
public Dictionary<string, object>? SectionItems { get; set; }
public override string? ToString()
{
try
{
return JsonConvert.SerializeObject(this, Formatting.None);
}
catch
{
return base.ToString();
}
}
}
+118
View File
@@ -0,0 +1,118 @@
using adas_core.Domain.Models.Masters;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Pumps;
using adas_core.Domain.Models.Recording;
using Newtonsoft.Json;
namespace adas_core.Domain.Models;
public class ApiRequest
{
// SIU
public PatientAppointment? Appointment;
// SIU
public List<PatientAppointment>? Appointments;
// OMP
public PatientTreatment? Treatment;
public List<PatientTreatment>? Treatments;
public string? TraceId { get; set; }
public string? TraceMessageId { get; set; }
public string? Type { get; set; }
public string? PatientNumber { get; set; }
public Person? Patient { get; set; }
public string? PatientId { get; set; }
public DateTime? AdmTime { get; set; }
public DateTime? DisTime { get; set; }
public PatientLocation? Location { get; set; }
//Chat
public ChatMessage? ChatMessage { get; set; }
//Recording
public RecordingData? Recording { get; set; }
//SurgeryRoomAlert
public PatientLocation? AlertLocationFrom { get; set; }
public PatientLocation? AlertLocationTo { get; set; }
// ADT
public PatientLocation? OldLocation { get; set; }
public Person? AttendingDoctor { get; set; }
public string? OldPatientNumber { get; set; }
// ORU
public ObservationData? ObservationData { get; set; }
public ObservationData? ObsertationData
{
get => ObservationData;
set => ObservationData = value;
}
public List<PatientObservation>? Observations { get; set; }
public PatientObservation? Observation { get; set; }
public List<PatientObservationAlarm>? Alarms { get; set; }
public List<PumpObservation>? PumpObservations { get; set; }
public PumpObservation? PumpObservation { get; set; }
//DG1
public List<PatientDiagnosis>? Diagnosis { get; set; }
// ALERTS
public List<PatientRecordingAlert>? RecordingAlerts { get; set; }
public PatientRecordingAlert? RecordingAlert { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
//ICCA db sync
public List<PatientIcca>? IccaPatients { get; set; }
public string? Facility { get; set; }
//NursePlan
public Admission? Admission { get; set; }
public Discharge? Discharge { get; set; }
public MasterList? MasterList { get; set; }
public Notice? Notice { get; set; }
public bool RequestFromPanel { get; set; }
public override string? ToString()
{
try
{
return JsonConvert.SerializeObject(this, Formatting.None);
}
catch
{
return base.ToString();
}
}
}
@@ -0,0 +1,489 @@
using System.Text.Json;
using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.AppSettings;
public class ApiSettings
{
public const string Api = "ApiSettings";
public string? Customize { get; set; }
public PointOfCareMapping? PointOfCareMapping { get; set; }
public ConfigObservationSettings? ConfigObservation { get; set; }
public RetentionPolicy RetentionPolicy { get; set; }
public int RetentionPolicyValue { get; set; }
//public CacheSettings? CacheSettings { get; set; }
public bool CreatePatientWithOru { get; set; }
public bool PushPatientWithOru { get; set; }
public bool CreatePatientWithSiu { get; set; }
public bool CreatePatientWithoutLocation { get; set; }
public bool CreatePatientWithoutPatientNumber { get; set; }
public bool CreatePatientWithLocation { get; set; }
public bool CreatePatientWithAdtA08 { get; set; }
public bool UpdatePatientDataWithOru { get; set; }
public bool UpdatePatientDataWithAdtA02 { get; set; }
public bool UpdatePatientLocationWithOru { get; set; }
public bool UpdatePatientNumberWithOru { get; set; }
public bool ActivateSchedulerCheckNewsJob { get; set; }
public int CheckNewsJobIntervalMinutes { get; set; } = 15;
public string? PatientsAppointments { get; set; }
public string? PatientsDiagnosis { get; set; }
public string? PatientsObservations { get; set; }
public string? PatientsAlarms { get; set; }
public string? Patients { get; set; }
public string? PoCSettings { get; set; }
public string? PumpObservations { get; set; }
public string? PumpStates { get; set; }
public string? PumpAlarmEvent { get; set; }
public string? PumpAlarmState { get; set; }
public string? PatientsRecordingAlerts { get; set; }
public string? PatientsTreatments { get; set; }
public string Mappings { get; set; } = "mappings";
public string? ConfigSections { get; set; }
public string? Units { get; set; } = "units";
public string? ConfigObservations { get; set; }
public string? HistoricalConfigChanges { get; set; }
public string Admissions { get; set; } = "admissions";
public string Discharges { get; set; } = "discharges";
public string Notices { get; set; } = "notices";
public string Locations { get; set; } = "pointOfCares";
public string Relays { get; set; } = "relays";
public string Cameras { get; set; } = "cameras";
public string LightBeacons { get; set; } = "light_beacons";
public string Displays { get; set; } = "displays";
public string DisplaysConfig { get; set; } = "config_displays";
public string DisplayCardConfig { get; set; } = "config_displays_card";
public string DisplayDetailConfig { get; set; } = "config_displays_detail";
public string DisplayChartConfig { get; set; } = "config_displays_chart";
public string Authorizations { get; set; } = "authorizations";
public string AltableOptionList { get; set; } = "list_altable";
public string AllergyList { get; set; } = "list_allergy";
public string DestinationList { get; set; } = "list_destinations";
public string DiagnosisList { get; set; } = "list_diagnosis";
public string DischargeStatusList { get; set; } = "list_dischargeStatus";
public string DoctorList { get; set; } = "list_doctor";
public string DoctorTypeList { get; set; } = "list_doctorType";
public string InternalDestinationList { get; set; } = "list_internalDestination";
public string InsulationList { get; set; } = "list_insulation";
public string LanguageBarrierList { get; set; } = "list_languageBarrier";
public string MobilityOptionList { get; set; } = "list_mobility";
public string OriginList { get; set; } = "list_origin";
public string PatientStatusList { get; set; } = "list_patientStatus";
public string ProcedureList { get; set; } = "list_procedure";
public string TestList { get; set; } = "list_test";
public string ServiceList { get; set; } = "list_service";
public string TherapeuticCeilingList { get; set; } = "list_therapeuticCeiling";
public string TreatmentList { get; set; } = "list_treatment";
public string VisitOptionList { get; set; } = "list_visitOption";
public string AccessControlList { get; set; } = "list_accessControl";
public string PassiveSittingList { get; set; } = "list_passiveSitting";
public string GenericList { get; set; } = "list_generic";
public string? ConfigUnits { get; set; }
public bool ConfigUnitsRequired { get; set; } = true;
public string? ConfigUnitsKey { get; set; }
public string? ConfigPumps { get; set; }
public bool ConfigPumpsRequired { get; set; } = true;
public string? ConfigPumpsKey { get; set; }
public string? ServiceConfig { get; set; }
public string Users { get; set; } = "users";
public string? Medicines { get; set; }
public string? Devices { get; set; }
public string? ArchivePatientsAppointments { get; set; }
public string? ArchivePatientsDiagnosis { get; set; }
public string? ArchivePatientsObservations { get; set; }
public string? ArchivePatient { get; set; }
public string? ArchivePatientsPumpobservations { get; set; }
public string? ArchivePatientsRecordingalerts { get; set; }
public string? ArchivePatientsTreatments { get; set; }
public string? ArchivePatientProcedure { get; set; }
public string? PatientCarePlan { get; set; }
public bool CretatePatientWithoutPatientNumber { get; set; }
public bool ArchivePatientWithOru { get; set; }
public string? OnArchivePatientAction { get; set; }
public int? ArchivePatientsWithoutObservationsSinceHours { get; set; }
public int? CheckInactivePatientSchedulerIntervalHours { get; set; }
public int? CheckActiveTreatmentsSchedulerIntervalMinutes { get; set; }
public int? CheckActiveAppointmentsSchedulerIntervalMinutes { get; set; }
public int? GetProvidersObservationsSchedulerIntervalMinutes { get; set; }
public int? SinceDischargeTimeToArchive { get; set; }
public int? CheckErrorQueues { get; set; }
public bool ActivateCheckExpiredAlerts { get; set; } = true;
public bool ActivateSchedulerCheckExpiredObservation { get; set; }
public bool ActivateSchedulerGetProvidersObservations { get; set; }
public bool ActivateCheckInactivePatients { get; set; }
public bool ActivateSchedulerCheckOpiateBoluses { get; set; }
public bool ActivateSchedulerCheckActiveTreatmentsJob { get; set; }
public bool ActivateSchedulerCheckActiveAppointmentsJob { get; set; }
public bool ActivateSchedulerCheckHydricBalance { get; set; }
public int? SchedulerCheckExpiredObservationsIntervalMinutes { get; set; }
public int? SchedulerCheckExpiredAlertsIntervalSeconds { get; set; }
public bool StartRecordingWithoutPatientNumber { get; set; } = true;
public List<string>? Shift { get; set; }
public bool FindPatientByLocationWithoutId { get; set; }
public bool PersistObservationCodes { get; set; }
public string? IccaFacility { get; set; }
public List<string>? SendingFacility { get; set; }
public List<string> AllergiesCode { get; set; } = [];
public List<string> DrainageCode { get; set; } = [];
public List<string> PositionCode { get; set; } = [];
public List<string> IsolationCode { get; set; } = [];
public List<string>? HighFrequencyVentilation { get; set; }
public List<string>? InvasiveVentilation { get; set; }
public List<string>? NonInvasiveVentilation { get; set; }
public List<string>? Ecmo { get; set; }
public List<string>? Surgery { get; set; }
public List<string>? Sedation { get; set; }
public List<string>? AntibioticList { get; set; }
public List<string>? AnxiolyticList { get; set; }
public List<string>? AntipsicoticList { get; set; }
public List<string>? AntidepressantsList { get; set; }
public List<string>? NeuroMedicationList { get; set; }
public List<string>? SerumCrystalloidList { get; set; }
public List<string>? SerumColloidList { get; set; }
public List<string>? AntihypertensivesList { get; set; }
public List<string>? SurgeryText { get; set; }
public List<string>? Transcutaneous { get; set; }
public List<string>? RegionalBrainSaturation { get; set; }
public List<string>? MedicationBolus { get; set; }
public List<string>? NotesIndicatingMedication { get; set; }
public List<string>? IntravenousLinesCode { get; set; }
public List<string>? Electroencephalogram { get; set; }
public List<string>? Respiratory { get; set; }
public List<string>? Oni { get; set; }
public List<string>? PumPressureAlarm { get; set; }
public List<string>? VolumetricAirOcclusionAlarm { get; set; }
public List<string>? VolumetricAirInLineAlarm { get; set; }
public List<string>? EndContinuousInfusionAlarm { get; set; }
public List<string>? InotropicEndInfusionAlarm { get; set; }
public List<string>? InotropicMedicines { get; set; }
public int IgnoreCalcObservationsOlderInMinutesThan { get; set; }
public int PumpExpiresSeconds { get; set; } = 60;
public bool SendPumpsZero { get; set; } = true;
public string? BalizaUrl { get; set; }
public string? BalizaPassword { get; set; }
public string? DiagnosisSystem { get; set; }
public List<string> DiagnosisCode { get; set; } = [];
public string[]? PathUpdateFiles { get; set; }
public int? TimeToSendGroupedObs { get; set; }
public string[]? PathToDisplayAssets { get; set; }
public List<string>? DefaultIdRecord { get; set; }
public bool CalculateExtremeEvents { get; set; } = true;
public double CalculateRespRateVentExpires { get; set; } = 2;
public bool ActivateExpireAlertsTimer { get; set; }
public int ExpireAlertIntervalSeconds { get; set; } = 5;
public ArchiveNurseData ArchiveNurseData { get; set; } = new();
public List<MappingInterventions>? MappingInterventions { get; set; }
public Dictionary<string, int>? ComplexityMappingObservation { get; set; }
public string? NoCalculateStatusWithCodingSystem { get; set; }
}
public class ArchiveNurseData
{
public bool Active { get; set; } = false;
public ArchiveNurseDataConfig ArchiveTest { get; set; } = new();
public ArchiveNurseDataConfig ArchiveProcedure { get; set; } = new();
public ArchiveNurseDataConfig ArchiveTreatment { get; set; } = new();
public int IntervalMinutes { get; set; } = 15;
}
public class ArchiveNurseDataConfig
{
public bool Active { get; set; } = false;
public int EndDateAfterMinutes { get; set; } = 60;
}
public class PointOfCareMapping
{
public string? Key { get; set; }
public bool Required { get; set; }
public int? Refresh { get; set; } = 600; //10min
}
public class ConfigObservationSettings
{
public bool IgnoreUnknownObservation { get; set; }
public bool IgnoreUnknownTreatment { get; set; }
public int? Refresh { get; set; }
}
#region CCC mapping config
public class InterventionsCodes
{
private object? _finalValue;
private object? _initialValue;
public object? InitialValue
{
get => _initialValue switch
{
double d => d,
string s => s,
int i => (double)i,
_ => null
};
set
{
switch (value)
{
case double:
case string:
_initialValue = value;
break;
case int intValue:
_initialValue = (double)intValue;
break;
case JsonElement element:
switch (element.ValueKind)
{
case JsonValueKind.Number:
_initialValue = element.GetDouble();
return;
case JsonValueKind.String:
_initialValue = element.GetString();
break;
default:
throw new ArgumentOutOfRangeException();
}
break;
default:
{
if (value != null)
try
{
_initialValue = Convert.ToDouble(value);
}
catch (FormatException)
{
try
{
_initialValue = value.ToString();
}
catch (Exception ex)
{
throw new ArgumentException(
$"The value must be a double or a string. Received type: {value.GetType()}, Value: {value}, Error: {ex.Message}");
}
}
catch (Exception ex)
{
throw new ArgumentException(
$"The value must be a double or a string. Received type: {value.GetType()}, Value: {value}, Error: {ex.Message}");
}
else
_initialValue = null;
break;
}
}
}
}
public object? FinalValue
{
get => _finalValue switch
{
double d => d,
string s => s,
_ => null
};
set
{
// Apply the same JsonElement handling logic here as well
if (value is double)
_finalValue = value;
else if (value is string)
_finalValue = value;
else if (value is JsonElement element)
switch (element.ValueKind)
{
case JsonValueKind.Number:
_finalValue = element.GetDouble();
return;
case JsonValueKind.String:
_finalValue = element.GetString();
break;
default:
throw new ArgumentOutOfRangeException();
}
else if (value != null)
try
{
_finalValue = Convert.ToDouble(value);
}
catch (FormatException)
{
try
{
_finalValue = value.ToString();
}
catch (Exception ex)
{
throw new ArgumentException(
$"The value must be a double or a string. Received type: {value.GetType()}, Value: {value}, Error: {ex.Message}");
}
}
catch (Exception ex)
{
throw new ArgumentException(
$"The value must be a double or a string. Received type: {value.GetType()}, Value: {value}, Error: {ex.Message}");
}
else
_finalValue = null;
}
}
}
public class InterventionsValues
{
private object? _finalValue;
private object? _initialValue;
public object? InitialValue
{
get => _initialValue switch
{
double d => d,
string s => s,
_ => null
};
set
{
if (value is double)
_initialValue = value;
else if (value is string)
_initialValue = value;
else if (value is JsonElement element)
switch (element.ValueKind)
{
case JsonValueKind.Number:
_initialValue = element.GetDouble();
return;
case JsonValueKind.String:
_initialValue = element.GetString();
break;
}
else if (value != null)
try
{
_initialValue = Convert.ToDouble(value);
}
catch (FormatException)
{
try
{
_initialValue = value.ToString();
}
catch (Exception ex)
{
throw new ArgumentException(
$"The value must be a double or a string. Received type: {value.GetType()}, Value: {value}, Error: {ex.Message}");
}
}
catch (Exception ex)
{
throw new ArgumentException(
$"The value must be a double or a string. Received type: {value.GetType()}, Value: {value}, Error: {ex.Message}");
}
else
_initialValue = null;
}
}
public object? FinalValue
{
get => _finalValue switch
{
double d => d,
string s => s,
_ => null
};
set
{
if (value is double)
_finalValue = value;
else if (value is string)
_finalValue = value;
else if (value is JsonElement element)
switch (element.ValueKind)
{
case JsonValueKind.Number:
_finalValue = element.GetDouble();
return;
case JsonValueKind.String:
_finalValue = element.GetString();
break;
}
else if (value != null)
try
{
_finalValue = Convert.ToDouble(value);
}
catch (FormatException)
{
try
{
_finalValue = value.ToString();
}
catch (Exception ex)
{
throw new ArgumentException(
$"The value must be a double or a string. Received type: {value.GetType()}, Value: {value}, Error: {ex.Message}");
}
}
catch (Exception ex)
{
throw new ArgumentException(
$"The value must be a double or a string. Received type: {value.GetType()}, Value: {value}, Error: {ex.Message}");
}
else
_finalValue = null;
}
}
public int ValueContributed { get; set; } = 0;
}
public class MappingInterventions
{
public string? Type { get; set; }
public string? Group { get; set; }
public string? Name { get; set; }
public ObservationEnum.Category? Category { get; set; }
public List<InterventionsCodes> Codes { get; set; } = [];
public List<InterventionsValues>? Value { get; set; }
}
#endregion
@@ -0,0 +1,50 @@
using adas_core.Domain.Models.MongoModels;
namespace adas_core.Domain.Models.AppSettings;
public class AuthSettings
{
public JwtConfig? JwtConfig { get; set; }
public UsersWhiteListConfig UsersWhiteListConfig { get; set; } = [];
public List<string> LoginMethods { get; set; } = [];
}
public class JwtConfig : JwtExtConfig
{
public string? Issuer { get; set; }
public bool ValidateIssuer { get; set; } = true;
public int TokenValidityInMinutes { get; set; } = 10;
public int RefreshTokenValidityInMinutes { get; set; } = 1440;
public Dictionary<string, JwtExtConfig>? ExternalProviders { get; set; } = null;
}
public class JwtExtConfig
{
public string? Key { get; set; }
public string? Audience { get; set; }
public bool ValidateAudience { get; set; } = true;
}
public class UsersWhiteListConfig : List<string>
{
public bool IsValid(User user)
{
return this.Any(username => username.ToLowerInvariant().Equals(user.UserName.ToLowerInvariant()));
}
}
public class ValidGroupsConfig : List<ValidGroup>
{
public bool IsValid(User? user)
{
return user != null;
}
}
public class ValidGroup
{
public string? Name { get; set; }
public bool IsRegex { get; set; } = false;
}
@@ -0,0 +1,29 @@
namespace adas_core.Domain.Models.AppSettings;
public class AutoRecordingSettings
{
public AutoStart? AutoStart { get; set; }
public AutoStop? AutoStop { get; set; }
public MustSendAlert? MustSendAlert { get; set; }
}
public class AutoStart
{
public int BlueCode { get; set; }
public int HemoFilterAlert { get; set; }
public int RespirationAlert { get; set; }
}
public class AutoStop
{
public int BlueCode { get; set; }
public int HemoFilterAlert { get; set; }
public int RespirationAlert { get; set; }
}
public class MustSendAlert
{
public bool BlueCode { get; set; }
public bool HemoFilterAlert { get; set; }
public bool RespirationAlert { get; set; }
}
@@ -0,0 +1,68 @@
using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.AppSettings;
public class CacheSettings
{
/// <summary>
/// Activa o desactiva por completo el sistema de caché.
/// Si es false, se usará NoCacheService para todas las entidades.
/// </summary>
public bool IsEnabled { get; set; } = true;
// Cada propiedad define cómo debe cachearse la entidad correspondiente:
// CacheMode None → no cachea nunca
// CacheMode Cache → in-memory (CacheService)
// CacheMode Redis → RedisService
public CacheEnum.Mode Patients { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode Displays { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode PumpObservations { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode Appointments { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode PointOfCares { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode GroupedObservations { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode PatientObservations { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode ConfigObservations { get; set; } = CacheEnum.Mode.Cache;
// Configuración específica del backend InMemory
public InMemorySettings InMemory { get; set; } = new();
// Configuración específica del backend Redis
public RedisSettings Redis { get; set; } = new();
}
// -------------------- InMemory Cache --------------------
public class InMemorySettings
{
public TtlSettings Ttl { get; set; } = new();
}
// -------------------- TTL por entidad --------------------
public class TtlSettings
{
public int? GlobalSeconds { get; set; }
public int? PatientsSeconds { get; set; }
public int? DisplaysSeconds { get; set; }
public int? PumpObservationsSeconds { get; set; }
public int? AppointmentsSeconds { get; set; }
public int? ConfigObservationsSeconds { get; set; }
public int? PointOfCaresSeconds { get; set; }
public int? GroupedObservationsSeconds { get; set; }
public int? PatientObservationsSeconds { get; set; }
}
@@ -0,0 +1,12 @@
namespace adas_core.Domain.Models.AppSettings;
public class DatabaseSettings
{
public const string Database = "DatabaseSettings";
public string? ConnectionString { get; set; }
public string? DatabaseName { get; set; }
public int MaxConnectionPoolSize { get; set; } = 200;
public int MinConnectionPoolSize { get; set; } = 20;
public int MaxConnectionIdleTime { get; set; } = 60;
}
@@ -0,0 +1,141 @@
namespace adas_core.Domain.Models.AppSettings;
public class ListSettings
{
public ListSettingItem AltableOptionList { get; set; } = new()
{
ManualObservationName = "AltableOptionObs",
AutoObservationName = []
};
public ListSettingItem AllergyList { get; set; } = new()
{
ManualObservationName = "AllergyObs",
AutoObservationName = []
};
public ListSettingItem DestinationList { get; set; } = new()
{
ManualObservationName = "DestinationObs",
AutoObservationName = []
};
public ListSettingItem DiagnosisList { get; set; } = new()
{
ManualObservationName = "DiagnosisObs",
AutoObservationName = []
};
public ListSettingItem DischargeStatusList { get; set; } = new()
{
ManualObservationName = "DischargeStatusObs",
AutoObservationName = []
};
public ListSettingItem DoctorList { get; set; } = new()
{
ManualObservationName = "DoctorObs",
AutoObservationName = []
};
public ListSettingItem DoctorTypeList { get; set; } = new()
{
ManualObservationName = "DoctorTypeObs",
AutoObservationName = []
};
public ListSettingItem InternalDestinationList { get; set; } = new()
{
ManualObservationName = "InternalDestinationObs",
AutoObservationName = []
};
public ListSettingItem InsulationList { get; set; } = new()
{
ManualObservationName = "InsulationObs",
AutoObservationName = []
};
public ListSettingItem LanguageBarrierList { get; set; } = new()
{
ManualObservationName = "LanguageBarrierObs",
AutoObservationName = []
};
public ListSettingItem PassiveSittingList { get; set; } = new()
{
ManualObservationName = "PassiveSittingObs",
AutoObservationName = []
};
public ListSettingItem GenericList { get; set; } = new()
{
ManualObservationName = "GenericObs",
AutoObservationName = []
};
public ListSettingItem MobilityOptionList { get; set; } = new()
{
ManualObservationName = "MobilityOptionObs",
AutoObservationName = []
};
public ListSettingItem OriginList { get; set; } = new()
{
ManualObservationName = "OriginObs",
AutoObservationName = []
};
public ListSettingItem PatientStatusList { get; set; } = new()
{
ManualObservationName = "PatientStatusObs",
AutoObservationName = []
};
public ListSettingItem ProcedureList { get; set; } = new()
{
ManualObservationName = "ProcedureObs",
AutoObservationName = []
};
public ListSettingItem ServiceList { get; set; } = new()
{
ManualObservationName = "ServiceObs",
AutoObservationName = []
};
public ListSettingItem TherapeuticCeilingList { get; set; } = new()
{
ManualObservationName = "TherapeuticCeilingObs",
AutoObservationName = []
};
public ListSettingItem TreatmentList { get; set; } = new()
{
ManualObservationName = "TreatmentObs",
AutoObservationName = []
};
public ListSettingItem VisitOptionList { get; set; } = new()
{
ManualObservationName = "VisitOptionObs",
AutoObservationName = []
};
public ListSettingItem AccessControlList { get; set; } = new()
{
ManualObservationName = "AccessControlObs",
AutoObservationName = []
};
public ListSettingItem TestList { get; set; } = new()
{
ManualObservationName = "TestObs",
AutoObservationName = []
};
}
public class ListSettingItem
{
public string? ManualObservationName { get; set; }
public List<string> AutoObservationName { get; set; } = [];
}
@@ -0,0 +1,339 @@
namespace adas_core.Domain.Models.AppSettings;
public class PermissionSettings
{
public SourcePermissions Admin { get; set; } = new(
new DisplayPermissionTypes(
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
true
),
new DisplayPermissionTypes(
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
true
),
new PanelPermissionTypes(
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
true
)
);
public SourcePermissions Developer { get; set; } = new(
new DisplayPermissionTypes(
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
true
),
new DisplayPermissionTypes(
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
true
),
new PanelPermissionTypes(
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
new UserActions(true, true, true, true, true),
true
)
);
public SourcePermissions DoctorChief { get; set; } = new(
new DisplayPermissionTypes(
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, false, false, true, false),
false
),
new DisplayPermissionTypes(
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
false
),
new PanelPermissionTypes(
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
false
)
);
public SourcePermissions Doctor { get; set; } = new(
new DisplayPermissionTypes(
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
false
),
new DisplayPermissionTypes(
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
false
),
new PanelPermissionTypes(
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
false
)
);
public SourcePermissions NursingSupervisor { get; set; } = new(
new DisplayPermissionTypes(
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, false, false, true, false),
false
),
new DisplayPermissionTypes(
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
false
),
new PanelPermissionTypes(
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
new UserActions(false, true, false, true, false),
false
)
);
public SourcePermissions Nurse { get; set; } = new(
new DisplayPermissionTypes(
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
false
),
new DisplayPermissionTypes(
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
false
),
new PanelPermissionTypes(
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
false
)
);
public SourcePermissions Guest { get; set; } = new(
new DisplayPermissionTypes(
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
false
),
new DisplayPermissionTypes(
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
new UserActions(false, false, false, true, false),
false
),
new PanelPermissionTypes(
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
new UserActions(false, false, false, true, true),
false
)
);
}
public class SourcePermissions(
DisplayPermissionTypes unit,
DisplayPermissionTypes display,
PanelPermissionTypes panel)
{
public DisplayPermissionTypes Unit { get; set; } = unit;
public DisplayPermissionTypes Display { get; set; } = display;
public PanelPermissionTypes Panel { get; set; } = panel;
}
public class DisplayPermissionTypes(
UserActions admissions,
UserActions discharges,
UserActions obs,
UserActions demographicData,
UserActions boxBlocking,
UserActions notices,
UserActions cell,
bool useDemoMode)
{
public UserActions Admissions { get; set; } = admissions;
public UserActions Discharges { get; set; } = discharges;
public UserActions Obs { get; set; } = obs;
public UserActions Cell { get; set; } = cell;
public UserActions DemographicData { get; set; } = demographicData;
public UserActions BoxBlocking { get; set; } = boxBlocking;
public UserActions Notices { get; set; } = notices;
public bool UseDemoMode { get; set; } = useDemoMode;
}
public class PanelPermissionTypes(
UserActions units,
UserActions displays,
UserActions displayConfigs,
UserActions masterLists,
UserActions treatments,
UserActions patients,
UserActions medicines,
UserActions pumps,
UserActions users,
UserActions configObservations,
UserActions observations,
UserActions audits,
bool useDemoMode)
{
public UserActions Units { get; set; } = units;
public UserActions Displays { get; set; } = displays;
public UserActions DisplayConfigs { get; set; } = displayConfigs;
public UserActions MasterLists { get; set; } = masterLists;
public UserActions Treatments { get; set; } = treatments;
public UserActions Patients { get; set; } = patients;
public UserActions Medicines { get; set; } = medicines;
public UserActions Pumps { get; set; } = pumps;
public UserActions Users { get; set; } = users;
public UserActions ConfigObservations { get; set; } = configObservations;
public UserActions Observations { get; set; } = observations;
public UserActions Audits { get; set; } = audits;
public bool UseDemoMode { get; set; } = useDemoMode;
}
public class UserActions(bool create, bool update, bool delete, bool read, bool execute)
{
public bool Create { get; set; } = create;
public bool Update { get; set; } = update;
public bool Delete { get; set; } = delete;
public bool Read { get; set; } = read;
public bool Execute { get; set; } = execute;
}
@@ -0,0 +1,15 @@
namespace adas_core.Domain.Models.AppSettings;
public class RabbitMqSettings
{
public string ConnectionString { get; set; } = string.Empty;
public string PatientsQueue { get; set; } = "patients";
public string TreatmentsQueue { get; set; } = "treatments";
public string ObservationsQueue { get; set; } = "observations";
public string PumpsQueue { get; set; } = "pumps";
public string RecordingQueue { get; set; } = "recordings";
public string AppointmentsQueue { get; set; } = "appointments";
public int MaxRetries { get; set; } = 2;
public string RecordingAlertQueue { get; set; } = "recordingAlert";
public string AlarmObservationQueue { get; set; } = "alarms";
}
@@ -0,0 +1,11 @@
namespace adas_core.Domain.Models.AppSettings;
public class RecordingSettings
{
public const string Recording = "RecordingSettings";
public string RecordingApiUrl { get; set; } = "";
public string RecordingOrApiClientId { get; set; } = "";
public string RecordingOrApiClientSecret { get; set; } = "";
public int HttpClientTimeout { get; set; } = 6;
}
@@ -0,0 +1,83 @@
namespace adas_core.Domain.Models.AppSettings
{
/// <summary>
/// Configuración Redis.
/// No contiene lógica de qué entidades usan Redis (eso está en CacheSettings).
/// Esta clase solo define:
/// - Conexión
/// - Cluster/Scalability
/// - SSL/password
/// - TTL global y por entidad
/// - Generación de claves CacheKeys
/// </summary>
public class RedisSettings
{
// Conexión y networking
public string? ConnectionString { get; set; }
public bool EnableScalable { get; set; }
public bool Ssl { get; set; }
public string? Password { get; set; }
public IEnumerable<RedisEndpoint> Endpoints { get; set; } = [];
public string ChannelPrefix { get; set; } = "MedDisCore";
// TTL global y TTL específico por entidad
// (no determina si la entidad se cachea o no)
public int? ExpireKeyInSeconds { get; set; }
public TtlSettings Ttl { get; set; } = new();
// Submodelos
public class RedisEndpoint
{
public string Host { get; set; } = null!;
public int Port { get; set; }
}
// CacheKeys: claves estandarizadas y unificadas para todas las entidades
// Estas claves son fundamentales para:
public static class CacheKeys
{
// ----------------- Patients -----------------
public static string Patient(string patientId)
=> $"patients:{patientId}";
// ----------------- ConfigDisplays -----------------
public static string ConfigDisplay(string id)
=> $"configDisplays:{id}";
public static string ConfigDisplaysAll()
=> "configDisplays:all";
// ----------------- PumpObservations -----------------
public static string PumpObservation(string obsId)
=> $"pumpObs:{obsId}";
public static string PumpDaily(string pumpId, DateTime date)
=> $"pumpObs:pump:{pumpId}:{date:yyyyMMdd}";
// ----------------- Appointments -----------------
public static string Appointment(string apptId)
=> $"appointments:{apptId}";
public static string AppointmentsByPatientDay(string patientId, DateTime date)
=> $"appointments:patient:{patientId}:{date:yyyyMMdd}";
public static string AppointmentsByPatientMonth(string patientId, DateTime date)
=> $"appointments:patient:{patientId}:{date:yyyyMM}";
// ----------------- GroupedObservations -----------------
public static string GroupedObservationsByPatient(string patientId, string? groupedField)
=> $"groupedObs:{groupedField}:patient:{patientId}";
public static string GroupedObservationsByPatientDay(string patientId, string groupedField, DateTime date)
=> $"groupedObs:{groupedField}:patient:{patientId}:{date:yyyyMMdd}";
public static string GroupedObservationsByPatientMonth(string patientId, string groupedField, DateTime date)
=> $"groupedObs:{groupedField}:patient:{patientId}:{date:yyyyMM}";
public static string GroupedObservationsLatest(string patientId, string groupedField, int take)
=> $"groupedObs:{groupedField}:patient:{patientId}:latest:{take}";
}
}
}
@@ -0,0 +1,119 @@
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace adas_core.Domain.Models;
public class BasePatientObservation : JsonConverter
{
public ObjectId Id { get; set; }
public ObjectId PatientId { get; set; }
public ObjectId? UserId { get; set; }
public string? ClinicalEpisode { get; set; }
public Patient? Patient { get; set; }
public string? SystemId { get; set; }
public string? Code { get; set; }
public string? CodingSystem { get; set; }
public ParentDataClass? ParentData { get; set; }
public DateTime Time { get; set; }
public DateTime? EndTime { get; set; }
public string? Name { get; set; }
public string? Units { get; set; }
public bool CheckObservations { get; set; }
public List<ConfigObservation>? CreateObservation { get; set; }
public string? ToJsonString()
{
try
{
return JsonConvert.SerializeObject(this, Formatting.None);
}
catch
{
return base.ToString();
}
}
public override string ToString()
{
List<string> items =
[
$"id: {Id}",
$"patientid: {PatientId}"
];
if (!string.IsNullOrEmpty(SystemId)) items.Add($", systemId: {SystemId}");
if (!string.IsNullOrEmpty(Code)) items.Add($"code: {Code}");
if (!string.IsNullOrEmpty(CodingSystem)) items.Add($"codingSystem: {CodingSystem}");
items.Add($"time: {Time}");
if (EndTime.HasValue) items.Add($"endTime: {EndTime.Value}");
if (!string.IsNullOrEmpty(Name)) items.Add($"name: {Name}");
if (!string.IsNullOrEmpty(Units)) items.Add($"unit: {Units}");
items.Add($"checkObservations: {CheckObservations}");
CreateObservation?.ForEach(o => items.Add(o.ToString()));
return "BasePatientObservation[" + string.Join(", ", items) + "]";
}
public List<string> ToListString()
{
List<string> items =
[
$"id: {Id}",
$"patientid: {PatientId}"
];
if (!string.IsNullOrEmpty(SystemId)) items.Add($"systemId: {SystemId}");
if (!string.IsNullOrEmpty(Code)) items.Add($"code: {Code}");
if (!string.IsNullOrEmpty(CodingSystem)) items.Add($"codingSystem: {CodingSystem}");
items.Add($"time: {Time}");
if (!string.IsNullOrEmpty(Name)) items.Add($"name: {Name}");
return items;
}
public override bool CanConvert(Type objectType)
{
return objectType == typeof(BasePatientObservation);
}
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
if (value == null) return;
var jo = JObject.FromObject(value);
jo.Property("Id")?.Remove();
jo.Property("Patient")?.Remove();
jo.WriteTo(writer);
}
public override object ReadJson(JsonReader reader, Type objectType, object? existingValue,
JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
public class ParentDataClass
{
public string? Code { get; set; }
public string? CodingSystem { get; set; }
public string? Name { get; set; }
}
@@ -0,0 +1,6 @@
namespace adas_core.Domain.Models;
public abstract class BasePatientObservationValue : BasePatientObservation
{
public object Value { get; set; } = new();
}
@@ -0,0 +1,273 @@
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
using MongoDB.Bson.IO;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using Newtonsoft.Json.Linq;
namespace adas_core.Domain.Models.BsonConverters;
public class DictionaryBsonConverter : SerializerBase<Dictionary<string, object>>
{
public override Dictionary<string, object> Deserialize(BsonDeserializationContext context,
BsonDeserializationArgs args)
{
var reader = context.Reader;
var stepsDictionary = new Dictionary<string, object>();
if (reader.CurrentBsonType == BsonType.Document)
{
reader.ReadStartDocument();
while (reader.ReadBsonType() != BsonType.EndOfDocument)
{
var key = reader.ReadName();
switch (key.ToUpper())
{
case "STEPS":
var stepList = BsonSerializer.Deserialize<List<Step>>(reader);
stepsDictionary[key] = stepList;
break;
case "BEACONS":
var beaconList = BsonSerializer.Deserialize<List<LightBeacon>>(reader);
stepsDictionary[key] = beaconList;
break;
case "CAMERAS":
var cameraList = BsonSerializer.Deserialize<List<Camera>>(reader);
stepsDictionary[key] = cameraList;
break;
case "RELAY":
var relayList = BsonSerializer.Deserialize<Relay>(reader);
stepsDictionary[key] = relayList;
break;
default:
switch (reader.CurrentBsonType)
{
case BsonType.Int32:
case BsonType.Int64:
stepsDictionary[key] = BsonSerializer.Deserialize<long>(reader);
break;
case BsonType.Double:
stepsDictionary[key] = BsonSerializer.Deserialize<double>(reader);
break;
case BsonType.String:
stepsDictionary[key] = BsonSerializer.Deserialize<string>(reader);
break;
case BsonType.Boolean:
stepsDictionary[key] = BsonSerializer.Deserialize<bool>(reader);
break;
case BsonType.Array:
reader.ReadStartArray();
var arrayItems = new List<object>();
while (reader.ReadBsonType() != BsonType.EndOfDocument)
switch (reader.CurrentBsonType)
{
case BsonType.String:
arrayItems.Add(BsonSerializer.Deserialize<string>(reader));
break;
case BsonType.Int32:
arrayItems.Add(BsonSerializer.Deserialize<int>(reader));
break;
case BsonType.Int64:
arrayItems.Add(BsonSerializer.Deserialize<long>(reader));
break;
case BsonType.Boolean:
arrayItems.Add(BsonSerializer.Deserialize<bool>(reader));
break;
case BsonType.Double:
arrayItems.Add(BsonSerializer.Deserialize<double>(reader));
break;
case BsonType.ObjectId:
arrayItems.Add(BsonSerializer.Deserialize<ObjectId>(reader));
break;
case BsonType.DateTime:
arrayItems.Add(BsonSerializer.Deserialize<DateTime>(reader));
break;
default:
reader.SkipValue();
break;
}
reader.ReadEndArray();
stepsDictionary[key] = arrayItems;
break;
default:
var bsonDoc = BsonSerializer.Deserialize<BsonDocument>(reader);
stepsDictionary[key] = bsonDoc.ToDictionary();
break;
}
break;
}
}
reader.ReadEndDocument();
}
return stepsDictionary;
}
public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args,
Dictionary<string, object> value)
{
var writer = context.Writer;
writer.WriteStartDocument();
foreach (var item in value)
{
if (TrySerializeKeyValuePair(item, writer)) continue;
// Si llegamos a este punto, encontramos un tipo no soportado.
writer.WriteName(item.Key);
writer.WriteNull(); // Escribe un valor null si el tipo no es soportado.
}
writer.WriteEndDocument();
}
private static bool TrySerializeKeyValuePair(KeyValuePair<string, object> item, IBsonWriter writer)
{
writer.WriteName(item.Key);
switch (item.Key)
{
case "steps":
if (item.Value is JArray jSteps)
{
var steps = jSteps.ToObject<List<Step>>();
BsonSerializer.Serialize(writer, typeof(List<Step>), steps);
return true;
}
break;
case "beacons":
if (item.Value is JArray jBeaconConfigs)
{
var beaconConfigs = jBeaconConfigs.ToObject<List<LightBeacon>>();
BsonSerializer.Serialize(writer, typeof(List<LightBeacon>), beaconConfigs);
return true;
}
break;
case "cameras":
if (item.Value is JArray jCamerasConfigs)
{
var cameraConfigs = jCamerasConfigs.ToObject<List<Camera>>();
BsonSerializer.Serialize(writer, typeof(List<Camera>), cameraConfigs);
return true;
}
break;
case "relay":
if (item.Value is JObject jRelayConfigs)
{
var relayConfigs = jRelayConfigs.ToObject<Relay>();
BsonSerializer.Serialize(writer, relayConfigs);
return true;
}
break;
case "uiFontProperties":
{
if (item.Value is JObject jUiFontData)
{
var uiFontData = jUiFontData.ToObject<UiFontData>();
BsonSerializer.Serialize(writer, uiFontData);
return true;
}
}
break;
default:
if (item.Value is Dictionary<string, object> nestedDictionary)
{
var bsonDoc = new BsonDocument(nestedDictionary);
BsonSerializer.Serialize(writer, bsonDoc);
return true;
}
if (item.Value is JArray jArray)
{
var listObjects = jArray.ToObject<List<object>>();
BsonSerializer.Serialize(writer, listObjects);
return true;
}
// Para otros tipos primitivos, utilizamos BsonValue.Create
try
{
var bsonValue = BsonValue.Create(item.Value);
switch (bsonValue.BsonType)
{
case BsonType.String:
writer.WriteString(bsonValue.AsString);
break;
case BsonType.Int32:
writer.WriteInt32(bsonValue.AsInt32);
break;
case BsonType.Int64:
writer.WriteInt64(bsonValue.AsInt64);
break;
case BsonType.Double:
writer.WriteDouble(bsonValue.AsDouble);
break;
case BsonType.Boolean:
writer.WriteBoolean(bsonValue.AsBoolean);
break;
case BsonType.Array:
writer.WriteStartArray();
foreach (var arrayValue in bsonValue.AsBsonArray)
switch (arrayValue.BsonType)
{
case BsonType.String:
writer.WriteString(arrayValue.AsString);
break;
case BsonType.Int32:
writer.WriteInt32(arrayValue.AsInt32);
break;
case BsonType.Int64:
writer.WriteInt64(arrayValue.AsInt64);
break;
case BsonType.Double:
writer.WriteDouble(arrayValue.AsDouble);
break;
case BsonType.Boolean:
writer.WriteBoolean(arrayValue.AsBoolean);
break;
default:
throw new BsonSerializationException(
$"No se puede serializar el tipo Bson en el array: {arrayValue.BsonType}");
}
writer.WriteEndArray();
break;
default:
throw new NotSupportedException($"BsonType {bsonValue.BsonType} no es compatible.");
}
return true;
}
catch (ArgumentException)
{
return false;
}
}
return false;
}
}
@@ -0,0 +1,61 @@
using adas_core.Domain.Models.MongoModels;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace adas_core.Domain.Models.BsonConverters;
public class DictionaryConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType == typeof(Dictionary<string, object>);
}
public override object ReadJson(JsonReader reader, Type objectType, object? existingValue,
JsonSerializer serializer)
{
var jo = JObject.Load(reader);
Dictionary<string, object> stepsDictionary = new();
foreach (var item in jo)
{
var key = item.Key;
switch (item.Key)
{
case "Steps":
var valueStep = item.Value?.ToObject<List<Step>>(serializer);
stepsDictionary.Add(key, valueStep ?? []);
break;
case "beacons":
var valueBeacon = item.Value?.ToObject<List<LightBeacon>>(serializer);
stepsDictionary.Add(key, valueBeacon ?? []);
break;
case "relay":
var valueRelay = item.Value?.ToObject<Relay>(serializer);
stepsDictionary.Add(key, valueRelay ?? new Relay());
break;
case "cameras":
var valueCameras = item.Value?.ToObject<List<Camera>>(serializer);
stepsDictionary.Add(key, valueCameras ?? []);
break;
default:
var valueDefault = item.Value?.ToObject<object>(serializer);
stepsDictionary.Add(key, valueDefault ?? new object());
break;
}
}
return stepsDictionary;
}
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
if (value == null)
return;
var stepsDictionary = (Dictionary<string, object>)value;
var jo = new JObject();
foreach (var item in stepsDictionary) jo.Add(item.Key, JToken.FromObject(item.Value, serializer));
jo.WriteTo(writer);
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace adas_core.Domain.Models;
public class ChartValue
{
public List<string> Labels { get; set; } = [];
public Dictionary<string, List<double>> Series { get; set; } = new();
}
+12
View File
@@ -0,0 +1,12 @@
namespace adas_core.Domain.Models;
public class ChatMessage
{
public PatientLocation? LocationFrom { get; set; }
public PatientLocation? LocationTo { get; set; }
public DateTime? MessageTime { get; set; }
public string? Message { get; set; }
}
+10
View File
@@ -0,0 +1,10 @@
namespace adas_core.Domain.Models;
public class Code
{
public string Identifier { get; set; } = string.Empty;
public string Text { get; set; } = string.Empty;
public string CodingSystem { get; set; } = string.Empty;
}
+38
View File
@@ -0,0 +1,38 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Utils;
namespace adas_core.Domain.Models;
public class CodeAction
{
public ActionsEnum.ResourceAction Action { get; set; }
public required Code Code { get; set; }
public static List<Code>? Apply(List<CodeAction> actions)
{
return Apply(null, actions);
}
public static List<Code>? Apply(List<Code>? source, List<CodeAction>? actions)
{
source ??= [];
(actions ?? []).ForEach(s =>
{
switch (s.Action)
{
case ActionsEnum.ResourceAction.Add:
if (!source.Contains(s.Code)) source.Add(s.Code);
break;
case ActionsEnum.ResourceAction.Delete:
if (source.Contains(s.Code)) source.Remove(s.Code);
break;
case ActionsEnum.ResourceAction.Update:
if (source.Contains(s.Code)) source[source.IndexOf(s.Code)] = s.Code;
else source.Add(s.Code);
break;
}
});
return CollectionsUtils.NullIfEmpty(source);
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace adas_core.Domain.Models;
public class CodeStatus
{
public Code? Code { get; set; }
public string? Status { get; set; }
public DateTime? AdministrationTime { get; set; }
public DateTime? EndAdministrationTime { get; set; }
}
@@ -0,0 +1,15 @@
namespace adas_core.Domain.Models.DTO;
public class AppointmentDto
{
public string PatientNumber { get; set; } = string.Empty;
public PatientLocation? Location { get; set; }
public List<PatientAppointment>? Appointments { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
}
+8
View File
@@ -0,0 +1,8 @@
namespace adas_core.Domain.Models.DTO;
public class AssetDto
{
public string? Name { get; set; }
public string? Extension { get; set; }
public string? Path { get; set; }
}
@@ -0,0 +1,7 @@
namespace adas_core.Domain.Models.DTO;
public class ConfigObservationDto
{
public string Id { get; set; } = string.Empty;
public long ItemCount { get; set; }
}
@@ -0,0 +1,9 @@
using adas_core.Domain.Models.MongoModels;
namespace adas_core.Domain.Models.DTO;
public class CreateUserWithAuthDto
{
public User User { get; set; } = new();
public List<Authorization> Authorizations { get; set; } = [];
}
+28
View File
@@ -0,0 +1,28 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO;
public class DeviceDto
{
public DeviceEvent? Event { get; set; }
public DeviceType DeviceType { get; set; }
public string? MacAddr { get; set; }
public string? SerialNumber { get; set; }
public string? Name { get; set; }
public int? Battery { get; set; }
public string? Color { get; set; }
public bool Connected { get; set; }
public bool Ready { get; set; }
public string? Uuid { get; set; }
public string? Key { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public List<ObjectId>? PointOfCareIds { get; set; } = new();
public DeviceSettings? Settings { get; set; }
}
public class DeviceEvent
{
public ClickType? ClickType { get; set; }
}
@@ -0,0 +1,18 @@
namespace adas_core.Domain.Models.DTO;
public class DiagnosisDto
{
public string PatientNumber { get; set; } = string.Empty;
public PatientLocation? Location { get; set; }
public ObservationData? ObservationData { get; set; }
public List<PatientObservation>? Observations { get; set; }
public List<PatientDiagnosis>? Diagnosis { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
}
@@ -0,0 +1,104 @@
namespace adas_core.Domain.Models.DTO.Display;
public class ColorConfigDto
{
public LevelColors? Level { get; set; }
public TextColors? Text { get; set; }
public ArrowColors? Arrow { get; set; }
public IndicatorColors? Indicator { get; set; }
public GraphColors? Graph { get; set; }
public StatusBoxNumberColors? BoxNumber { get; set; }
public TherapyColors? Therapy { get; set; }
public TestColors? Test { get; set; }
public ProcedureColors? Procedure { get; set; }
public class AppearanceSettings
{
public string? TextColor { get; set; }
public string? BackgroundColor { get; set; }
public string? Icon { get; set; }
public string? IconDefault { get; set; }
public double? IconInvertColor { get; set; }
}
public class StatusBoxNumberColors
{
public AppearanceSettings? Reserved { get; set; }
public AppearanceSettings? InUse { get; set; }
public AppearanceSettings? Available { get; set; }
public AppearanceSettings? Locked { get; set; }
public AppearanceSettings? Transferable { get; set; }
public AppearanceSettings? Exitus { get; set; }
public AppearanceSettings? Altable { get; set; }
}
public class TherapyColors
{
public AppearanceSettings? Default { get; set; }
public AppearanceSettings? Initialized { get; set; }
public AppearanceSettings? Finished { get; set; }
public AppearanceSettings? InProgress { get; set; }
}
public class TestColors
{
public AppearanceSettings? Default { get; set; }
public AppearanceSettings? Initialized { get; set; }
public AppearanceSettings? Finished { get; set; }
public AppearanceSettings? Expired { get; set; }
}
public class ProcedureColors
{
public AppearanceSettings? Default { get; set; }
public AppearanceSettings? Initialized { get; set; }
public AppearanceSettings? Finished { get; set; }
public AppearanceSettings? Expired { get; set; }
}
public class LevelColors
{
public string? Level1 { get; set; }
public string? Level2 { get; set; }
public string? Level3 { get; set; }
public string? Level4 { get; set; }
public string? Level5 { get; set; }
}
public class TextColors
{
public string? Normal { get; set; }
public string? Warning { get; set; }
public string? Alert { get; set; }
public string? Improve { get; set; }
public string? Expired { get; set; }
}
public class ArrowColors
{
public string? Normal { get; set; }
public string? Warning { get; set; }
public string? Alert { get; set; }
public string? Improve { get; set; }
}
public class IndicatorColors
{
public string? Empty { get; set; }
public string? Warning { get; set; }
public string? Normal { get; set; }
public string? Alert { get; set; }
public string? Background { get; set; }
public string? EmptyBackground { get; set; }
}
public class GraphColors
{
public string? Normal { get; set; }
public string? Warning { get; set; }
public string? Alert { get; set; }
}
}
@@ -0,0 +1,23 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO.Display;
public class CreateDisplayConfigDto
{
public DisplayConfigEnums.DisplayType Type { get; set; } =
DisplayConfigEnums.DisplayType
.Unknown; // Lista de unidades a las que se puede subscriber el cliente par recibir las actualizaciones de la seccion
public string? Hospital { get; set; }
public string? DisplayConfigIdTemplate { get; set; }
}
public class CreateDisplayConfigCardDto
{
public CardConfig? CardConfig { get; set; }
public CardDetailsConfig? DetailConfig { get; set; }
public ChartConfig? ChartConfig { get; set; }
public ObjectId? DisplayConfigId { get; set; }
}
@@ -0,0 +1,29 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.GroupedObservations;
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO.Display;
public class DisplayConfigDto
{
public ObjectId Id { get; set; }
public DisplayConfigEnums.DisplayType Type { get; set; } = DisplayConfigEnums.DisplayType.Unknown;
public CardConfig? CardConfig { get; set; }
public ObjectId? CardConfigId { get; set; }
public ObjectId? DetailConfigId { get; set; }
public HomeConfig? HomeConfig { get; set; }
public HeaderConfig? HeaderConfig { get; set; }
public CardDetailsConfig? DetailConfig { get; set; }
public List<ObjectId>? DisplaySectionIdList { get; set; }
public string? Hospital { get; set; }
public List<Field>? FieldList { get; set; }
public List<GroupedField>? GroupedFieldList { get; set; }
#region NotMapped
public List<MinimalDisplaySection>? DisplaySectionList { get; set; }
#endregion
}
@@ -0,0 +1,7 @@
namespace adas_core.Domain.Models.DTO.Display;
public class DisplayConfigLocationDto
{
public string? DisplayName { get; set; }
public string? UnitName { get; set; }
}
@@ -0,0 +1,11 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO.Display;
public class DisplayConfigSummary
{
public ObjectId Id { get; set; }
public string? Name { get; set; }
public DisplayConfigEnums.DisplayType Type { get; set; }
}
@@ -0,0 +1,12 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO.Display;
public class DisplayMinimalDto(MongoModels.Display display)
{
public ObjectId Id { get; set; } = display.Id;
public string Name { get; set; } = display.Name;
public DisplayConfigEnums.DisplayType Type { get; set; } = display.Type;
}
@@ -0,0 +1,10 @@
using adas_core.Domain.Models.MongoModels;
namespace adas_core.Domain.Models.DTO.Display;
public class DisplayNurseDto : DisplayConfigDto
{
public List<BannerItem>? HomeBanner { get; set; }
public ColorConfig? ColorConfig { get; set; }
public FormConfig? FormConfig { get; set; }
}
@@ -0,0 +1,9 @@
using adas_core.Domain.Models.AppSettings;
namespace adas_core.Domain.Models.DTO.Display;
public class DisplayWithPermissionsDto
{
public DisplayPermissionTypes? Permissions { get; set; }
public MongoModels.Display? Display { get; set; }
}
@@ -0,0 +1,9 @@
using adas_core.Domain.Models.MongoModels;
namespace adas_core.Domain.Models.DTO.Display;
public class MinimalDisplayListDto
{
public List<MinimalDisplaySection> DisplayNurse { get; set; } = [];
public List<MinimalDisplaySection> SmartDisplay { get; set; } = [];
}
@@ -0,0 +1,22 @@
using adas_core.Domain.Models.GroupedObservations;
using adas_core.Domain.Models.MongoModels;
namespace adas_core.Domain.Models.DTO.Display;
public class SmartDisplayDto : DisplayConfigDto
{
public bool? HasCameras { get; set; }
public bool? HasSound { get; set; }
public bool? IsRotationEnabled { get; set; }
public bool? CanChangeCameraMode { get; set; }
public bool? CamerasAreActive { get; set; }
public string? CameraStreamType { get; set; }
public List<Sensor>? SensorList { get; set; }
public string? ObservationForIndicator { get; set; }
public List<Field>? AlarmFieldList { get; set; }
public List<GroupedField>? RequestGroupedFieldList { get; set; }
public bool? Pumps { get; set; }
public List<ChartConfig>? ChartConfig { get; set; }
public GraphLayout? GraphLayout { get; set; }
public List<CardRotatingLayout>? CardRotatingLayout { get; set; }
}
@@ -0,0 +1,6 @@
namespace adas_core.Domain.Models.DTO.Display;
public class UpdateDisplayConfigNameDto
{
public string DisplayName { get; set; } = string.Empty;
}
@@ -0,0 +1,13 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO;
public class MasterListDto
{
public ObjectId Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public MasterListType ListType { get; set; }
public int Options { get; set; }
}
@@ -0,0 +1,21 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.Masters;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO;
public class MasterListWithPaginatedOptionsDto(MasterList masterList, int pageSize, List<UnitInfoDto> units)
{
public ObjectId Id { get; set; } = masterList.Id;
public string Name { get; set; } = masterList.Name;
public string Description { get; set; } = masterList.Description;
public MasterListType ListType { get; set; } = masterList.ListType;
public bool CanAddElement { get; set; } = masterList.CanAddElement;
public OptionListDetails? OptionListDetails { get; set; } = masterList.OptionListDetails;
public int TotalOptionsCount { get; set; } = masterList.Options.Count();
public List<OptionList> Options { get; set; } = masterList.Options.Take(pageSize).ToList();
public List<UnitInfoDto> Units { get; set; } = units;
public LocaleEnum? DefaultLocale { get; set; } = masterList.DefaultLocale;
}
@@ -0,0 +1,21 @@
namespace adas_core.Domain.Models.DTO;
public class ObservationAlarmDto
{
public string? PatientNumber { get; set; }
public PatientLocation? Location { get; set; }
public List<PatientObservationAlarm>? Alarms { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
public ObservationData? ObservationData { get; set; }
public ObservationData? ObsertationData
{
get => ObservationData;
set => ObservationData = value;
}
}
@@ -0,0 +1,18 @@
namespace adas_core.Domain.Models.DTO;
public class ObservationDto
{
public string PatientNumber { get; set; } = string.Empty;
public PatientLocation? Location { get; set; }
public ObservationData? ObservationData { get; set; }
public List<PatientObservation>? Observations { get; set; }
public List<PatientDiagnosis>? Diagnosis { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
}
@@ -0,0 +1,9 @@
using adas_core.Domain.Models.Filter;
namespace adas_core.Domain.Models.DTO;
public class PaginationPairDto
{
public PaginationFilter ListFilter { get; set; } = new();
public PaginationFilter OptionFilter { get; set; } = new();
}
+15
View File
@@ -0,0 +1,15 @@
namespace adas_core.Domain.Models.DTO;
public class PatientDto
{
public string PatientNumber { get; set; } = string.Empty;
public PatientLocation? Location { get; set; }
public Person? Patient { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
}
@@ -0,0 +1,16 @@
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO;
public class PocAndUnitDto
{
public List<MinimalPocAndUnitDto> PocList { get; set; } = [];
}
public class MinimalPocAndUnitDto
{
public string? PocName { get; set; }
public ObjectId PocId { get; set; }
public string? UnitName { get; set; }
public ObjectId UnitId { get; set; }
}
@@ -0,0 +1,45 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
using LightBeacon = adas_core.Domain.Models.MongoModels.LightBeacon;
namespace adas_core.Domain.Models.DTO;
public class PointOfCareDto
{
public ObjectId Id { get; set; }
public string Room { get; set; } = string.Empty;
public string Bed { get; set; } = string.Empty;
public string? Hall { get; set; } = string.Empty;
public ObjectId UnitId { get; set; }
public PointOfCareConfigurationDto? Configuration { get; set; }
public StatusEnum.PointOfCare Status { get; set; }
public ObjectId? AdmissionId { get; set; }
#region Unmap
public string UnitName { get; set; } = string.Empty;
public Unit? Unit { get; set; }
public PatientLocation Location => new(UnitName, Bed, Room);
public List<PatientObservation> Observations { get; set; } = [];
public bool? HasPatient { get; set; }
public ObjectId? Patientid { get; set; }
public Patient? Patient { get; set; }
public bool? IsActive { get; set; }
public bool? IsVisible { get; set; }
public Admission? Admission { get; set; }
#endregion
}
public class PointOfCareConfigurationDto
{
public List<LightBeacon> BeaconList { get; set; } = [];
public List<Camera> CameraList { get; set; } = [];
public List<Relay>? RelayList { get; set; }
public string? Type { get; set; }
// Esta parte hay que tenerla en cuenta al momento de lanzar las grabaciones automaticas y manuales para la API de OR
// OR espera recibir roomId
public int? Id { get; set; }
}
+17
View File
@@ -0,0 +1,17 @@
using adas_core.Domain.Models.Pumps;
namespace adas_core.Domain.Models.DTO;
public class PumpDto
{
public string PatientNumber { get; set; } = string.Empty;
public PatientLocation? Location { get; set; }
public List<PumpObservation>? PumpObservations { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
}
@@ -0,0 +1,17 @@
using adas_core.Domain.Models.Recording;
namespace adas_core.Domain.Models.DTO;
public class RecordingAlertDto
{
public string? PatientNumber { get; set; }
public PatientLocation? Location { get; set; }
public List<PatientRecordingAlert>? RecordingAlerts { get; set; }
public RecordingData? RecordingData { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
}
@@ -0,0 +1,16 @@
namespace adas_core.Domain.Models.DTO;
public class TreatmentDto
{
public string PatientNumber { get; set; } = string.Empty;
public PatientLocation? Location { get; set; }
public List<PatientTreatment>? Treatments { get; set; }
public PatientTreatment? Treatment { get; set; }
public DateTime MessageTime { get; set; }
public bool WaitResult { get; set; }
}
@@ -0,0 +1,31 @@
using System.Text.Json.Serialization;
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO;
public class UnitInfoDto
{
[JsonConstructor]
public UnitInfoDto()
{
}
public UnitInfoDto(Unit? unit)
{
Id = unit?.Id;
Name = unit?.Name ?? string.Empty;
Title = unit?.Name ?? string.Empty;
}
public ObjectId? Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string? ConfigObservationId { get; set; }
public long? Admissions { get; set; }
public long? Discharges { get; set; }
public long? Displays { get; set; }
public long? Patients { get; set; }
public long? PointOfCares { get; set; }
public long? VirtualPointOfCares { get; set; }
}
@@ -0,0 +1,7 @@
namespace adas_core.Domain.Models.DTO;
public class UpdateListNameAndDescriptionDto
{
public string? Name { get; set; }
public string? Description { get; set; }
}
@@ -0,0 +1,9 @@
using adas_core.Domain.Models.Masters;
namespace adas_core.Domain.Models.DTO;
public class UpdateMasterListDetailsDto
{
public bool? CanAddElement { get; set; }
public OptionListDetails? OptionListDetails { get; set; }
}
@@ -0,0 +1,9 @@
using adas_core.Domain.Models.MongoModels;
namespace adas_core.Domain.Models.DTO;
public class UpdateObservationDto
{
public ConfigObservation? OldConfigObservationItem { get; set; }
public ConfigObservation? NewConfigObservationItem { get; set; }
}
@@ -0,0 +1,10 @@
using adas_core.Domain.Models.Masters;
namespace adas_core.Domain.Models.DTO;
public class UpdateOptionMasterListDto
{
public OptionList? UpdatedOption { get; set; }
public OptionList? OldOption { get; set; }
public string? OptionId { get; set; }
}
@@ -0,0 +1,7 @@
namespace adas_core.Domain.Models.DTO;
public class UpdatePasswordDto
{
public string OldPassword { get; set; } = string.Empty;
public string NewPassword { get; set; } = string.Empty;
}
@@ -0,0 +1,38 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.DTO;
public class UpdateUnitIdListDto
{
public ObjectId UnitId { get; set; }
public List<MasterListData> MasterListData { get; set; } = [];
public override string ToString()
{
List<string> items = [];
items.AddRange(MasterListData.Select(masterListData => $", MasterListData: {masterListData}"));
return "UpdateUnitIdListDto[" + string.Join(", ", items) + "]";
}
}
public class MasterListData
{
public ObjectId? MasterListId { get; set; }
public MasterListType? MasterListType { get; set; }
public override string ToString()
{
List<string> items =
[
MasterListId != null ? $"identifier: {MasterListId.ToString()}" : "identifier: Null",
MasterListType != null ? $"type: {MasterListType.ToString()}" : "type: null"
];
return "[" + string.Join(", ", items) + "]";
}
}
@@ -0,0 +1,11 @@
using adas_core.Domain.Models.MongoModels;
namespace adas_core.Domain.Models.DTO;
public class UpdateUserWithAuthDto
{
public User User { get; set; } = new();
public List<Authorization> Authorizations { get; set; } = [];
public List<Authorization> NewAuthorizations { get; set; } = [];
public List<string> AuthsToDelete { get; set; } = [];
}
+12
View File
@@ -0,0 +1,12 @@
namespace adas_core.Domain.Models;
public class Entity
{
public string? EntityIdentifier { get; set; }
public string? NamespaceId { get; set; }
public string? UniversalId { get; set; }
public string? UniversalIdType { get; set; }
}
+18
View File
@@ -0,0 +1,18 @@
//using Newtonsoft.Json;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Web;
//namespace smacs_uci_api.Models
//{
// public class Field
// {
// [JsonProperty("name")]
// public string Name { get; set; }
// [JsonProperty("last")]
// public int Last { get; set; }
// }
//}
@@ -0,0 +1,19 @@
using adas_core.Domain.Models.Masters;
namespace adas_core.Domain.Models.Filter;
public class FilterOptionListElement
{
public string? OptionType { get; set; }
public string? Text { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public string? IconDefault { get; set; }
public string? IconCategory { get; set; }
public string? IconColor { get; set; }
public string? Color { get; set; }
public string? BgColor { get; set; }
public LocaleEnum? Locale { get; set; }
public bool? IsFromAdmPanel { get; set; } = false;
public Locale? LocaleItems { get; set; }
}
@@ -0,0 +1,91 @@
using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.Filter;
public class FilteredRequest
{
#region Common region
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public string? PatientId { get; set; }
public string? PatientNumber { get; set; }
public string? Text { get; set; }
public string? DeviceId { get; set; }
public bool? InUse { get; set; }
#endregion
#region PUMP
public PumpEnum.AlarmMode? AlarmMode { get; set; }
public string? AlarmType { get; set; }
public PumpEnum.Mode? PumpMode { get; set; }
public PumpEnum.InfusingStatus? InfusingStatus { get; set; }
public PumpEnum.Status? Status { get; set; }
#endregion
#region Treatment
public List<string>? Observations { get; set; }
public bool ActiveTreatments { get; set; }
#endregion
#region Medicines
public string? MedicineName { get; set; }
public string? MedicineCode { get; set; }
public string? MedicineType { get; set; }
public string? MedicineGroup { get; set; }
#endregion
#region User
public string? Name { get; set; }
public string? Email { get; set; }
public string? UserName { get; set; }
public StatusEnum.User UserStatus { get; set; }
public string? UserType { get; set; }
#endregion
#region Patient
public DateTime? StartAdmTime { get; set; }
public DateTime? EndAdmTime { get; set; }
public DateTime? StartDischargeTime { get; set; }
public DateTime? EndDischargeTime { get; set; }
public DateTime? StartLastObsTime { get; set; }
public DateTime? EndLastObsTime { get; set; }
public DateTime? StartCreationDateTime { get; set; }
public DateTime? EndCreationDateTime { get; set; }
public DateTime? StartUpDateTime { get; set; }
public DateTime? EndUpDateTime { get; set; }
public DateTime? StartBirthDate { get; set; }
public DateTime? EndBirthDate { get; set; }
#endregion
#region Displays y PoC
public string? UnitId { get; set; }
public string? PocId { get; set; }
public string? UnitName { get; set; }
public DisplayConfigEnums.DisplayType? DisplayType { get; set; }
public StatusEnum.PointOfCare? PointOfCareStatus { get; set; }
#endregion
}
@@ -0,0 +1,41 @@
namespace adas_core.Domain.Models.Filter;
public record PaginationFilter
{
public PaginationFilter()
{
}
public PaginationFilter(int pageNumber, int pageSize, FilteredRequest? filtered)
{
PageNumber = pageNumber < 1 ? 1 : pageNumber;
PageSize = pageSize <= 0 ? 100 : pageSize;
FilteredRequest = filtered;
}
public int PageNumber { get; set; } = 1;
public int PageSize { get; set; } = 100;
public FilteredRequest? FilteredRequest { get; set; }
public bool IsEmpty()
{
return PageNumber <= 0 && PageSize <= 0;
}
}
public static class PaginationFilterExtensions
{
public static IQueryable<T> ApplyPagination<T>(this IQueryable<T> queryable, PaginationFilter? filter)
{
var modifQueryable = queryable;
if (filter is not { PageNumber: >= 0, PageSize: > 0 }) return modifQueryable;
var pageNumber = filter.PageNumber;
var pageSize = filter.PageSize;
modifQueryable = modifQueryable
.Skip((pageNumber - 1) * pageSize)
.Take(pageSize)
;
return modifQueryable;
}
}
@@ -0,0 +1,96 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models;
public class GroupedObservation
{
public ObjectId PatientId { get; set; }
public string? Name { get; set; } = string.Empty;
public string? Group { get; set; } = string.Empty;
public List<GroupedObservationObs> Observations { get; set; } = [];
public override string ToString()
{
List<string> items =
[
$"name: {Name}",
$"observations: {Observations} "
];
return "PatientObservation[" + string.Join(", ", items) + "]";
}
public class GroupedObservationObs
{
public string Name { get; set; } = string.Empty;
public GroupedObservationObsValue? First { get; set; }
public GroupedObservationObsValue? Last { get; set; }
public GroupedObservationObsValue? Min { get; set; }
public GroupedObservationObsValue? Max { get; set; }
public object? MinAlert { get; set; }
public object? MaxAlert { get; set; }
public GroupedObservationObsValue? Average { get; set; }
public GroupedObservationObsValue? Sum { get; set; }
public GroupedObservationObsValue? Count { get; set; }
public GroupedObservationObsValue? HalfHour { get; set; }
public GroupedObservationObsValue? LastFilled { get; set; }
public DateTime Time { get; set; }
public int? Shift { get; set; }
public DateTime ShiftDate { get; set; }
public bool IsFilled { get; set; }
public override string ToString()
{
List<string> items = [$"name: {Name}"];
if (First != null) items.Add($"first; {First}");
if (Last != null) items.Add($"last; {Last}");
if (Min != null) items.Add($"min; {Min}");
if (Max != null) items.Add($"max; {Max}");
if (Average != null) items.Add($"average; {Average}");
if (Sum != null) items.Add($"sum; {Sum}");
if (Count != null) items.Add($"count; {Count}");
if (HalfHour != null) items.Add($"halfhour; {HalfHour}");
if (MinAlert != null) items.Add($"minAlert; {MinAlert}");
if (MaxAlert != null) items.Add($"maxAlert; {MaxAlert}");
items.Add($"time; {Time}");
items.Add($"shiftDate; {ShiftDate}");
if (Shift != null) items.Add($"shift; {Shift}");
return "GroupedObservationObs[" + string.Join(", ", items) + "]";
}
}
public class GroupedObservationObsValue(object value, DateTime? time, StatusEnum.Type type = StatusEnum.Type.Ok)
{
public StatusEnum.Type Type { get; set; } = type;
public object Value { get; set; } = value;
public DateTime? Time { get; set; } = time;
public override string ToString()
{
return $"value: {Value}, time: {Time}, status: {Type}";
}
}
}
@@ -0,0 +1,36 @@
namespace adas_core.Domain.Models.GroupedObservations;
public class Field
{
public string? Name { get; set; }
public int Last { get; set; } = 1;
public bool OnlyExpired { get; set; }
//public override bool Equals(object? obj)
//{
// // Verifica si el objeto pasado es nulo o no es del mismo tipo
// if (obj == null || GetType() != obj.GetType()) return false;
// // Convierte el objeto pasado al tipo Field
// var other = (Field)obj;
// // Compara las propiedades una por una, maneja el caso de valores nulos usando el operador de coalescencia nula (??)
// return Name == other.Name &&
// Last == other.Last &&
// OnlyExpired == other.OnlyExpired;
//}
//public override int GetHashCode()
//{
// unchecked
// {
// var hash = 17;
// hash = hash * 23 + (Name?.GetHashCode() ?? 0);
// hash = hash * 23 + Last.GetHashCode();
// hash = hash * 23 + OnlyExpired.GetHashCode();
// return hash;
// }
//}
}
@@ -0,0 +1,65 @@
using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.GroupedObservations;
public class GroupedField
{
public GroupedField()
{
}
public GroupedField(
string? name,
List<string>? names,
string? group,
List<string>? startTimeShift,
int max,
GroupedObservationEnum.Regularity? regularity,
GroupedObservationEnum.Since since,
List<GroupedObservationEnum.Result>? result,
List<string>? labelList)
{
Name = name;
Names = names ?? [];
Group = group;
StartTimeShift = startTimeShift ?? [];
Max = max;
Regularity = regularity;
Since = since;
Result = result ?? [GroupedObservationEnum.Result.First];
LabelList = labelList;
}
public string? Name { get; init; }
public List<string> Names { get; init; } = [];
public string? Group { get; init; }
public List<string> StartTimeShift { get; init; } = [];
public int Max { get; init; }
public GroupedObservationEnum.Regularity? Regularity { get; init; }
public GroupedObservationEnum.Since Since { get; init; }
public List<GroupedObservationEnum.Result> Result { get; init; } = [];
public List<string>? LabelList { get; init; }
public List<string> GetNames()
{
return Names;
}
public override bool Equals(object? obj)
{
return obj is GroupedField field && Group == field.Group;
}
public override int GetHashCode()
{
return HashCode.Combine(Name, Group, Max, Regularity, Result);
}
}
@@ -0,0 +1,31 @@
namespace adas_core.Domain.Models;
public class HistoricalLocation : IEquatable<HistoricalLocation>
{
// Propiedades con get y set para que MongoDB pueda escribir en ellas
public DateTime? AdmTime { get; set; }
public PatientLocation? PatientLocation { get; set; }
// Constructor vacío necesario para la deserialización de MongoDB
public HistoricalLocation() { }
// Tu constructor actual
public HistoricalLocation(DateTime admTime, PatientLocation patientLocation)
{
AdmTime = admTime;
PatientLocation = patientLocation ?? throw new ArgumentNullException(nameof(patientLocation));
}
public bool Equals(HistoricalLocation? other)
{
if (other == null) return false;
return AdmTime == other.AdmTime &&
(PatientLocation?.Equals(other.PatientLocation) ?? other.PatientLocation == null);
}
public bool IsEmpty() => !AdmTime.HasValue && (PatientLocation == null || PatientLocation.IsEmpty());
public bool IsFull() => AdmTime.HasValue && PatientLocation != null && !PatientLocation.IsFullEmpty();
public override string ToString() => $"HistoricalLocation[AdmTime: {AdmTime}, PatientLocation: {PatientLocation}]";
}
@@ -0,0 +1,19 @@
namespace adas_core.Domain.Models;
public class ManualRecording
{
//[JsonProperty("patientId")]
//public object PatientId { get; set; }
//[JsonProperty("roomId")]
//public int RoomId { get; set; }
public MRecording? Recording { get; set; }
}
public class MRecording
{
public DateTime? StartRecordingTime { get; set; }
public DateTime? StopRecordingTime { get; set; }
}
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class AccessControlList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class AllergyList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class AltableOptionList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class DestinationList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class DiagnosisList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class DischargeStatusList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class DoctorList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class DoctorTypeList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class GenericList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class InsulationList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class InternalDestinationList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class LanguageBarrierList : MasterList;
@@ -0,0 +1,102 @@
using adas_core.Domain.Enums;
using MongoDB.Bson;
namespace adas_core.Domain.Models.Masters;
public class MasterList
{
public ObjectId Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string ManualObservationName { get; set; } = "UnknownMasterList";
public List<string> AutoObservationName { get; set; } = [];
public MasterListType ListType { get; set; }
public bool CanAddElement { get; set; }
public OptionListDetails? OptionListDetails { get; set; }
public LocaleEnum? DefaultLocale { get; set; }
public List<OptionList> Options { get; set; } = [];
public MasterList ReturnMasterListOptionsInLocaleIfExist(LocaleEnum? localeToReturn)
{
if (localeToReturn == null) return this;
var optionsConverted = new List<OptionList>();
foreach (var opt in Options)
{
// 1. Obtener traducción del locale
string? translatedName = null;
if (opt.LocaleItems != null)
{
var localeProp = opt.LocaleItems
.GetType()
.GetProperty(localeToReturn.Value.ToString());
var localeItem = localeProp?.GetValue(opt.LocaleItems) as LocaleItem;
translatedName = localeItem?.Name;
}
// 2. Usar traducción si existe, sino fallback
var finalName = !string.IsNullOrWhiteSpace(translatedName)
? translatedName
: opt.Name;
// 3. Crear nueva opción convertida
var newOpt = new OptionList
{
Id = opt.Id,
Name = finalName,
OptionType = opt.OptionType,
Description = opt.Description,
Color = opt.Color,
BgColor = opt.BgColor,
IconDefault = opt.IconDefault,
IconCategory = opt.IconCategory,
IconColor = opt.IconColor,
InitDate = opt.InitDate,
EndDate = opt.EndDate,
IsDefault = opt.IsDefault,
// Mantener todos los LocaleItems originales
LocaleItems = opt.LocaleItems
};
optionsConverted.Add(newOpt);
}
// 4. Clonar el master pero con las opciones nuevas
return new MasterList
{
Id = Id,
Name = Name,
Description = Description,
ManualObservationName = ManualObservationName,
AutoObservationName = new List<string>(AutoObservationName),
ListType = ListType,
CanAddElement = CanAddElement,
OptionListDetails = OptionListDetails,
DefaultLocale = DefaultLocale,
Options = optionsConverted
};
}
}
public class OptionListDetails
{
public Element? OptionType { get; set; }
public Element? Name { get; set; }
public Element? IconDefault { get; set; }
public Element? IconCategory { get; set; }
public Element? IconColor { get; set; }
public Element? Color { get; set; }
public Element? BgColor { get; set; }
public Element? Description { get; set; }
}
public class Element
{
public string Title { get; set; } = string.Empty;
public bool IsRequired { get; set; }
public bool IsList { get; set; } = false;
public string ListName { get; set; } = string.Empty;
}
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class MobilityOptionList : MasterList;
@@ -0,0 +1,73 @@
using MongoDB.Bson;
namespace adas_core.Domain.Models.Masters;
public class OptionList
{
public ObjectId? Id { get; set; }
public Locale? LocaleItems { get; set; }
public string? OptionType { get; set; }
public string Name { get; set; } = string.Empty;
public string? IconDefault { get; set; }
public string? IconCategory { get; set; }
public string? IconColor { get; set; }
public string? Color { get; set; }
public string? BgColor { get; set; }
public string? Description { get; set; }
public DateTime? InitDate { get; set; }
public DateTime? EndDate { get; set; }
public bool? IsDefault { get; set; }
public bool AreEqual(OptionList a, OptionList b)
{
return a.OptionType == b.OptionType &&
a.Name == b.Name &&
a.IconDefault == b.IconDefault &&
a.IconCategory == b.IconCategory &&
a.IconColor == b.IconColor &&
a.Color == b.Color &&
a.BgColor == b.BgColor &&
a.IsDefault == b.IsDefault &&
a.Description == b.Description &&
a.InitDate == b.InitDate &&
a.EndDate == b.EndDate;
}
public bool AreEqualExcludeDescription(OptionList a, OptionList b)
{
return a.OptionType == b.OptionType &&
a.Name == b.Name &&
a.IconDefault == b.IconDefault &&
a.IconCategory == b.IconCategory &&
a.IconColor == b.IconColor &&
a.Color == b.Color &&
a.BgColor == b.BgColor &&
a.IsDefault == b.IsDefault &&
a.InitDate == b.InitDate &&
a.EndDate == b.EndDate;
}
}
public class Locale
{
public LocaleItem? Es { get; set; }
public LocaleItem? Pt { get; set; }
public LocaleItem? Ca { get; set; }
public LocaleItem? Eng { get; set; }
public LocaleItem? Zh { get; set; }
}
public class LocaleItem
{
public string? Name { get; set; }
}
public enum LocaleEnum
{
Default,
Es,
Pt,
Ca,
Eng,
Zh
}
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class OriginList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class PassiveSittingList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class PatientStatusList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class ProcedureList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class ServiceList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class TestList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class TherapeuticCeilingList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class TreatmentList : MasterList;
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Models.Masters;
public class VisitOptionList : MasterList;
+18
View File
@@ -0,0 +1,18 @@
using MongoDB.Bson;
namespace adas_core.Domain.Models;
public class Medicine
{
public ObjectId Id { get; set; }
public string? Name { get; set; }
public List<string> Codes { get; set; } = [];
public List<string> Notes { get; set; } = [];
public List<string> Type { get; set; } = [];
public List<string> Group { get; set; } = [];
}
@@ -0,0 +1,51 @@
using adas_core.Domain.Models.Masters;
using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
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
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) + "]";
}
}
@@ -0,0 +1,23 @@
using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.MongoModels;
public class AlarmConfig
{
public string? Name { get; set; }
public bool Enabled { get; set; }
public int EndAfter { get; set; } //seconds
public AlarmItem? Recording { get; set; }
public AlarmItem? Beacon { get; set; }
public AlarmItem? OpenDoor { get; set; }
public int? Priority { get; set; }
public string? Color { get; set; }
public AudioConfig? AudioConfig { get; set; }
}
public class AudioConfig
{
public AlarmEnum.AudioAlarmType Type { get; set; } = AlarmEnum.AudioAlarmType.Off;
public string? Path { get; set; }
public int? EndAfter { get; set; }
}
@@ -0,0 +1,39 @@
using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.MongoModels;
public class AlarmItem
{
public bool Enabled { get; set; }
public int StartBefore { get; set; } // seconds
public int EndAfter { get; set; } // seconds overrides
public string? Color
{
get => BeaconColor.ToString();
set
{
if (!string.IsNullOrEmpty(value) && Enum.TryParse(value, out AlarmEnum.BeaconColor color))
BeaconColor = color;
}
}
public AlarmEnum.Severity Severity { get; set; } = AlarmEnum.Severity.None;
public AlarmEnum.BeaconColor BeaconColor { get; set; } = AlarmEnum.BeaconColor.None;
public override string ToString()
{
List<string> items =
[
$"Enabled: {Enabled}",
$"StartBefore: {StartBefore}",
$"EndAfter: {EndAfter}",
$"Severity: {Severity}",
$"BeaconColorEnum: {BeaconColor}"
];
if (!string.IsNullOrEmpty(Color)) items.Add($"Color: {Color}");
return "AlarmItem[" + string.Join(", ", items) + "]";
}
}
@@ -0,0 +1,25 @@
using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
public class Authorization
{
public ObjectId Id { get; set; }
public ObjectId UserId { get; set; }
public string? Rol { get; set; } = string.Empty;
public string? DisplayId { get; set; } = string.Empty;
public string? UnitId { get; set; } = null;
public bool PanelAuthorization { get; set; }
public bool CanUpdate { get; set; } = true;
#region NotMapped
public Unit? Unit { get; set; }
public Display? Display { get; set; }
public User? User { get; set; }
#endregion
}
@@ -0,0 +1,33 @@
using adas_core.Domain.Enums;
using adas_core.Domain.Models.Observations;
using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
public class Box
{
public Person? AttendingDoctor;
public string? PointOfCare { get; set; }
public string? Bed { get; set; }
public bool IsActive { get; set; } = true;
public bool IsVisible { get; set; } = true;
public Dictionary<string, object>? Configuration { get; set; }
public PatientLocation Location => new(PointOfCare, Bed);
public bool HasPatient { get; set; }
public ObjectId? Patientid { get; set; }
public Patient? Patient { get; set; }
public StatusEnum.Type Type { get; set; }
public List<PatientObservation>? Observations { get; set; }
public List<Medication>? Medication { get; set; }
}
@@ -0,0 +1,31 @@
using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
public class Camera
{
public ObjectId Id { get; set; }
public string? Name { get; set; } = string.Empty;
public Stream? Streams { get; set; }
public bool Ptz { get; set; }
public string? Driver { get; set; }
public string? Ip { get; set; }
public string? Username { get; set; }
public string? Password { get; set; }
public bool InUse { get; private set; }
}
public class Stream
{
public string? Rtsp { get; set; }
public string? Jpeg { get; set; }
public string? WebRtc { get; set; }
public string? Hls { get; set; }
public string? Mp4 { get; set; }
}
@@ -0,0 +1,122 @@
using System.Xml.Serialization;
using adas_core.Domain.Enums;
using MongoDB.Bson;
using Newtonsoft.Json;
namespace adas_core.Domain.Models.MongoModels;
public class ConfigObservation
{
public Dictionary<string, ConfigObservation>? Grouped;
public ObjectId Id { get; set; }
public string? Code { get; set; }
public string? CodingSystem { get; set; }
public string? OriginalName { get; set; }
public string? ParentCode { get; set; }
public string? ParentCodingSystem { get; set; }
public string? ParentName { get; set; }
public string? Name { get; set; }
public string? Units { get; set; }
public ObservationEnum.ArrowType ArrowType { get; set; } = ObservationEnum.ArrowType.Default;
public bool ShowArrow { get; set; } = true;
public bool ShowValue { get; set; } = true;
public bool ForceUnits { get; set; }
public double? MinAlert { get; set; }
public double? MaxAlert { get; set; }
public double? MaxWarn { get; set; }
public double? MinWarn { get; set; }
public string? WarnColor { get; set; }
public string? AlertColor { get; set; }
public List<object>? AlertValues { get; set; }
public List<object>? WarningValues { get; set; }
public bool ForceWarn { get; set; }
public bool ForceAlert { get; set; }
public char? Alert { get; set; }
public int? Expires { get; set; }
public bool ShowOnExpired { get; set; }
public bool? Persist { get; set; }
public string? ColorOnExpired { get; set; }
public RetentionPolicy? RetentionPolicy { get; set; }
public int? RetentionPolicyValue { get; set; }
public string? LevelCondition { get; set; }
public Dictionary<string, object>? UiConfiguration { get; set; }
public AlarmConfig? Alarm { get; set; }
public string? Description { get; set; }
public object? RequiredValue { get; set; }
public List<ConfigObservation>? Preconditions { get; set; }
public bool CheckObservations { get; set; }
public List<ConfigObservation>? CreateObservation { get; set; }
public ObservationEnum.InsertMode InsertMode { get; set; } = ObservationEnum.InsertMode.Auto;
public bool TimeFromMessageTime { get; set; } = false;
public List<ColorRange>? ColorRanges { get; set; }
public DemoConfig? DemoConfig { get; set; }
public override string ToString()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
public class ColorRange
{
public ObservationEnum.ValueType? ValueType;
//Para números
public double? Min { get; set; }
public double? Max { get; set; }
//Para Strings
public string? MatchText { get; set; }
//Para booleanos
public bool? MatchBoolean { get; set; }
// Para fechas (en formato ISO)
public string? MinDate { get; set; }
public string? MaxDate { get; set; }
//Estética
public string? Color { get; set; }
public string? Label { get; set; }
}
}
public class DemoConfig
{
public int? MaxValue { get; set; }
public int? MinValue { get; set; }
public object? ValueOption { get; set; }
public bool? SetRandomValue { get; set; }
public bool? SetInValue { get; set; }
public int? RandomCount { get; set; }
public bool? ValueIsArray { get; set; }
public bool? RequireInitDate { get; set; }
public bool? RequireEndDate { get; set; }
public int? PriorityAlarm { get; set; }
//Campos para el simulador del Admin
public int? Periodicity { get; set; }
public ObservationEnum.XmlType? XmlType { get; set; }
}
@@ -0,0 +1,24 @@
using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.MongoModels;
public class ConfigPumps
{
public string Id { get; set; } = string.Empty;
public List<ConfigPumpItem>? Items { get; set; }
}
public class ConfigPumpItem
{
public PumpEnum.AlarmType? AlarmType { get; set; }
public Dictionary<string, object>? UiConfiguration { get; set; }
public PumpEnum.PumpMessageType? Type { get; set; }
public RetentionPolicy? RetentionPolicy { get; set; }
public int? RetentionPolicyValue { get; set; }
}

Some files were not shown because too many files have changed in this diff Show More