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
+26
View File
@@ -0,0 +1,26 @@
namespace adas_core.Domain.Enums;
public static class ActionsEnum
{
public enum Actions
{
View,
Write
}
public enum CrudAction
{
Create,
Read,
Update,
Delete,
Archive
}
public enum ResourceAction
{
Add,
Update,
Delete
}
}
+165
View File
@@ -0,0 +1,165 @@
using System.ComponentModel;
namespace adas_core.Domain.Enums;
public static class AlarmEnum
{
public enum AudioAlarmType
{
Continuous,
Off,
OnStart
}
public enum AudioVideoState
{
Paused,
Off,
Enabled,
Disabled
}
public enum BeaconColor
{
Blue,
Yellow,
Red,
None
}
public enum EventPhase
{
Tpoint,
Start,
Continue,
End,
Update,
Escalate,
Deescalate,
Reset,
Inactivation
}
public enum Name
{
[Description("CÓDIGO AZUL")] Blue,
[Description("Hemofiltro")] Hemo,
[Description("PEEP baja")] Peep,
[Description("Límite superior de presión del respirador vía aerea")]
Pico,
[Description("Presión intracraneal")] Picm,
[Description("Fuga Respirador")] VniLeak,
[Description("Superación de Límites FR")]
EventFr,
[Description("Superación de Límites FC")]
EventFc,
[Description("Superación de Límites PAm")]
EventPam,
[Description("Superación de Límites ARTm")]
EventArtm,
[Description("Superación de Límites SpO2")]
EventSpo2,
[Description("Superación de Límites PEEP")]
EventPeep,
[Description("Límite FC Alto")] EventFcHi,
[Description("Límite FR Alto")] EventFrHi,
[Description("Límite SPO2 Alto")] EventSpo2Hi,
[Description("Límite PaM Alto")] EventPamHi,
[Description("Límite PICm Alto")] EventPicmHi,
[Description("Límite PEEPt Alto")] EventPeeptHi,
[Description("Límite MVexp Alto")] EventMvexpHi,
[Description("Límite ARTm Alto")] EventArtmHi,
[Description("Límite PEEP Bajo")] EventPeepLo,
[Description("Límite FC Bajo")] EventFcLo,
[Description("Límite FR Bajo")] EventFrLo,
[Description("Límite SPO2 Bajo")] EventSpo2Lo,
[Description("Límite PaM Bajo")] EventPamLo,
[Description("Límite PICm Bajo")] EventPicmLo,
[Description("Límite PEEPt Bajo")] EventPeeptLo,
[Description("Límite VMExp Bajo")] EventVmexpLo,
[Description("Límite ARTm Bajo")] EventArtmLo,
[Description("Parada flujo de sangre Hemofiltro")]
EventAlarmFlow,
[Description("Evento extremo")] ExtremeEvent,
[Description("Bradicardia extrema")] ExtremeBradi,
[Description("Taquicardia extrema")] ExtremeTaqui,
[Description("Desaturación extrema")] ExtremeDesat,
[Description("Alerta de volumen minuto respirador")]
VolMin,
[Description("TAm alta extrema")] EvtExtrPamHi,
[Description("TAm baja extrema")] EvtExtrPamLo,
[Description("Límite VMExp Bajo")] EvtExtrVmexpLo,
[Description("Apnea")] Apnea,
[Description("Respiratorio")] Respiration,
//separar en varias
[Description("Alerta bomba")] Pump,
//Tipo para hacer pruebas
[Description("Alerta Test")] Test,
[Description("NEWS RED")] NewsAlert,
[Description("NEWS YELLOW")] NewsWarning,
[Description("NEWS OFF")] NewsOff
}
public enum ObservationAlarmCode
{
AdvisoryAlert,
SoftInop
}
public enum ObservationAlarmPriority
{
Ph,
Pm,
Pl
}
public enum ObservationAlarmState
{
Inactive,
Active,
Latched
}
public enum ObservationAlarmType
{
Sp,
St,
Sa
}
public enum Severity
{
None,
Blue,
Red,
Yellow
}
public enum Type
{
Manual,
Auto
}
}
@@ -0,0 +1,14 @@
namespace adas_core.Domain.Enums;
public enum AuthorizeUserByServiceType
{
Display,
Discharge,
Admission,
PointOfCare,
ConfigDisplay,
MasterList,
Notice,
Patient,
Unit
}
+28
View File
@@ -0,0 +1,28 @@
namespace adas_core.Domain.Enums;
public static class CacheEnum
{
public enum Mode
{
None = 0, // No cachear
Cache = 1, // CacheService (memoria)
Redis = 2 // RedisService
}
public enum EntityType
{
Unknown,
Patients,
Displays,
PumpObservations,
Appointments,
PontOfCare,
GroupedObservations,
PatientObservations,
ConfigObservations
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace adas_core.Domain.Enums;
public enum ClickType
{
Unknown,
SingleClick,
DoubleClick,
Hold,
Release
}
@@ -0,0 +1,9 @@
namespace adas_core.Domain.Enums;
public enum DeviceActionType
{
Unknown,
SendAlarm,
SendObs,
All
}
+7
View File
@@ -0,0 +1,7 @@
namespace adas_core.Domain.Enums;
public enum DeviceType
{
Unknown,
Button
}
@@ -0,0 +1,301 @@
namespace adas_core.Domain.Enums;
public static class DisplayConfigEnums
{
public enum AxisPosition
{
Top,
Bottom,
Left,
Right
}
public enum AxisType
{
Time,
Value
}
public enum BannerType
{
Inputs,
InputsFull,
Outputs,
OutputsText,
Slots,
Notices,
Status
}
public enum CellType
{
BoxNumber,
BoxNumberStatus,
BeaconColor,
Simple,
Alert,
Alarm,
ObsGraphList,
GraphCompose,
GraphTitle,
Lab,
Plus,
ObsText,
Triple,
TripleData,
UciDays,
Predict,
TableBox,
TableDate,
TableCell,
TripleDataFormatted,
Sensors,
SensorAwair,
SensorObs,
Default,
FullIcon,
List,
Text,
TableText,
TableRepeated,
TableInsulation,
TableDropdown,
TableBoxRepeated,
TableAge,
Icon,
TableIcon,
TableGender,
Admission,
Demographic,
DemographicNoDiagnosis,
Intervention,
InterventionSection,
Isolation,
DetailCard,
DetailHeader,
DetailHeaderText,
PreviewCard,
PatientStatus,
Physicians,
Test,
TherapeuticCeiling,
Mobility,
Therapies,
DoctorCell,
CellDivider,
RowDivider,
VisitIcon,
AltableDestinationIcon,
LenguageBarrier,
DemographicCell,
DaysCalendarCell,
ObsCell,
ObsCellIcon,
AdmDateCellIcon,
NurseDateCellIcon,
MedicalDateCellIcon,
AllergyCell,
AltableInfo,
AltableInfoText,
TherapiesSection,
TestSection,
PhysiciansSection,
PatientStatusSection,
WrapperSection,
WrapperSectionCell,
DropDown,
TherapeuticCeilingDropDown,
IncomingDate,
AccessIconComponent,
FullAccessIconComponent,
IncomingSection,
WrapperObsCell,
SubHeader,
PatientInfo,
ObsGa,
TextObs,
ObsIcon,
DynamicText,
ObsMultiIcon,
ObsIconText,
WeightObs,
PlainIconText,
ObsBoolean,
CellWrapper,
Filler,
ObsMultiText,
LifeTime,
ObsIsolation,
BirthObs,
WrapperCell,
Language,
ObsTextIfMatch,
SensorWrapper
}
public enum ConfigTypes
{
SectionCfg,
ObservationCfg,
PumpCfg
}
public enum DirectionEnum
{
Row,
Column,
RowReverse,
ColumnReverse
}
public enum DisplayType
{
DisplayNurse,
SmartDisplay,
StandarDisplay,
PumpDisplay,
Unknown
}
public enum ELegendIconType
{
Circle,
Square,
Triangle,
Diamond,
Cross,
Star,
HorizontalLine,
VerticalLine,
DashedLine,
DottedLine
}
public enum HospitalCustomizeEnum
{
Test,
Vdh,
Trueta,
Ryc,
Chuo,
Gregorio,
H12O
}
public enum LabelFormat
{
Hour,
Second,
Minute,
HourExact,
Default,
FullDateExact,
FixPercentage,
Custom
}
public enum LineType
{
Solid,
Dashed,
Dotted
}
public enum MarkerIcon
{
Kangaroo,
Bath,
Hand,
None
}
public enum RotatingLayoutMode
{
Default,
Equitable,
FixedImageTime
}
public enum RotatingLayoutType
{
HomeSection,
Ad
}
public enum RowType
{
Simple,
General,
GraphLast,
Prediction,
Prevision,
Treatment,
Camera,
SubHeader,
Custom,
BoxNavigationSubheader,
Admission,
Demographic,
Intervention,
Isolation,
TherapiesSection,
TestSection,
InterventionSection,
IncomingSection,
DetailHeaderSection,
PatientStatus,
Physicians,
Test,
Therapies,
AltableInfo,
WrapperSection,
WrapperSectionCell,
RowDivider
}
public enum SeriesType
{
Line,
Area,
Marker,
MarkArea,
Candlestick,
BarPercentage,
LineMapColor,
LineMark,
Scatter,
Bar
}
public enum SourceType
{
Obs,
Diagnosis,
Alarm,
Pump,
Treatment,
Sensor
}
public enum StepType
{
Standar,
Advertising,
Alarms
}
public enum WebDisplayCellSubtype
{
Default,
Mobility,
Isolation,
Tests,
Therapy,
Intervention,
Visits,
Therapeutic,
Days,
WeeksDays
}
}
+19
View File
@@ -0,0 +1,19 @@
namespace adas_core.Domain.Enums;
public static class FileEnum
{
public enum AssetTheme
{
Light,
Dark
}
public enum FileType
{
Csv,
Excel,
Json,
Xml,
Txt
}
}
@@ -0,0 +1,56 @@
namespace adas_core.Domain.Enums;
public class GroupedObservationEnum
{
public enum Regularity
{
Times,
Second,
Minute,
Hour,
Day,
Shift
}
public enum Result
{
First,
Last,
Sum,
Min,
Max,
Average,
Count,
/*
* Rellena las horas que no tienen valor con la última media hora del anterior en caso de haberla.
* Al pedir las observaciones a la bd, devuelve todas las observaciones de la hora
*/
HalfHour,
/*
* Devuelve valor para todas las horas puestas en el max, Rellenando con el valor anterior de no haber ninguno en esas horas.
*/
LastFilled,
/*
* Igual que el last filled, pero no rellena con el valor anterior en caso de no haberlo. ¿Last puede ser así siempre?, creo que si
* (caso diuresis gráfica)
* No devuelve valores??
*/
LastAll
}
public enum Since
{
/*
* Does not take into account the current date for the number of groupings (default value).
*/
Now,
/*
* It takes into account the current date for the number of groupings.
*/
Last
}
}
+242
View File
@@ -0,0 +1,242 @@
namespace adas_core.Domain.Enums;
public static class HttpEnum
{
/// <summary>
/// Enumeration for HTTP error code messages.
/// </summary>
public enum ErrorMessage
{
#region 200 OK
/// <summary>
/// The update could not be completed because the resource has not been modified.
/// </summary>
OkResouceNotModified = 2001,
#endregion
#region 400 Bad Request
/// <summary>
/// Required parameters are missing from the request.
/// </summary>
BadRequestMissingParameters = 4001,
/// <summary>
/// The format of the provided data is invalid.
/// </summary>
BadRequestInvalidFormat = 4002,
/// <summary>
/// The submitted data contains duplicate values that are not allowed.
/// </summary>
BadRequestDuplicateData = 4003,
/// <summary>
/// Username already exists.
/// </summary>
BadRequestInvalidUsername = 4004,
/// <summary>
/// Email already exists.
/// </summary>
BadRequestInvalidEmail = 4005,
/// <summary>
/// Incorrect type.
/// </summary>
BadRequestIncorrectType = 4006,
/// <summary>
/// Incorrect length.
/// </summary>
BadRequestIncorrectLength = 4007,
/// <summary>
/// Invalid username or email.
/// </summary>
BadRequestIncorrectEmailOrUsername = 4008,
#endregion
#region 401 Unauthorized
/// <summary>
/// The access token has expired.
/// </summary>
UnauthorizedTokenExpired = 4011,
/// <summary>
/// The user does not have permission to perform this action.
/// </summary>
UnauthorizedNoPermission = 4012,
/// <summary>
/// The authentication token is invalid or has been revoked.
/// </summary>
UnauthorizedInvalidToken = 4013,
/// <summary>
/// User not registered.
/// </summary>
UnauthorizedUserNotRegistered = 4014,
/// <summary>
/// Invalid user credentials.
/// </summary>
UnauthorizedInvalidCredentials = 4015,
#endregion
#region 403 Forbidden
/// <summary>
/// User does not have access to this resource.
/// </summary>
ForbiddenNoAccess = 4031,
/// <summary>
/// User does not have permission to perform this operation.
/// </summary>
ForbiddenNoPermission = 4032,
/// <summary>
/// Access is restricted due to security configurations.
/// </summary>
ForbiddenRestrictedAccess = 4033,
/// <summary>
/// User is blocked or disabled.
/// </summary>
ForbiddenUserBlocked = 4034,
#endregion
#region 404 Not Found
/// <summary>
/// The requested resource does not exist.
/// </summary>
NotFoundResourceMissing = 4041,
/// <summary>
/// No items matching the search criteria were found.
/// </summary>
NotFoundNoMatches = 4042,
#endregion
#region 409 Conflict
/// <summary>
/// The update could not be completed.
/// </summary>
ConflictUpdateFailed = 4091,
/// <summary>
/// The deletion could not be completed.
/// </summary>
ConflictDeleteFailed = 4092,
/// <summary>
/// The deletion could not be completed because the resource is in use.
/// </summary>
ConflictResourceInUse = 4093,
/// <summary>
/// The resource already exists and cannot be duplicated.
/// </summary>
ConflictResourceAlreadyExists = 4094,
/// <summary>
/// The current state of the resource prevents this operation.
/// </summary>
ConflictInvalidResourceState = 4095,
/// <summary>
/// The creation could not be completed.
/// </summary>
ConflictCreationFailed = 4096,
/// <summary>
/// Operation could not be completed.
/// </summary>
ConflictOperationIncompleted = 4097,
#endregion
#region 422 Unprocessable Entity
/// <summary>
/// One or more fields do not meet the required validations.
/// </summary>
UnprocessableEntityInvalidFields = 4221,
/// <summary>
/// The resource cannot be processed.
/// </summary>
UnprocessableEntityCannotProcess = 4222,
/// <summary>
/// The provided value is outside the allowed range.
/// </summary>
UnprocessableEntityOutOfRange = 4223,
/// <summary>
/// The password is not strong enough.
/// </summary>
UnprocessableEntityInvalidPassword = 4224,
/// <summary>
/// The current password is incorrect, or the new password does not meet the required format. Please check and try
/// again.
/// </summary>
BadRequestIncorrectPassword = 4225,
#endregion
#region 500 Internal Server Error
/// <summary>
/// An unexpected error occurred while processing the request.
/// </summary>
InternalServerErrorUnexpected = 5001,
/// <summary>
/// The service could not complete the operation due to an internal failure.
/// </summary>
InternalServerErrorInternalFailure = 5002,
/// <summary>
/// Error communicating with an external service.
/// </summary>
InternalServerErrorExternalServiceError = 5003,
#endregion
#region 503 Service Unavailable
/// <summary>
/// The service is under maintenance. Please try again later.
/// </summary>
ServiceUnavailableUnderMaintenance = 5031,
/// <summary>
/// The system is experiencing high load. Please try again later.
/// </summary>
ServiceUnavailableHighLoad = 5032,
/// <summary>
/// The data service is temporarily unavailable.
/// </summary>
ServiceUnavailableDataServiceUnavailable = 5033,
/// <summary>
/// Action is temporarily unavailable.
/// </summary>
ServiceUnavailableCensusInAutomaticMode = 5034
#endregion
}
}
@@ -0,0 +1,13 @@
namespace adas_core.Domain.Enums;
public enum LightBeaconColor
{
Off = 000,
Red = 001,
Yellow = 011,
Green = 010,
Cyan = 110,
Blue = 100,
Magenta = 101,
White = 111
}
+27
View File
@@ -0,0 +1,27 @@
namespace adas_core.Domain.Enums;
public enum MasterListType
{
AltableOptionList,
AllergyList,
DestinationList,
DiagnosisList,
DischargeStatusList,
DoctorList,
DoctorTypeList,
InternalDestinationList,
InsulationList,
LanguageBarrierList,
PassiveSittingList,
MobilityOptionList,
OriginList,
PatientStatusList,
ProcedureList,
ServiceList,
TherapeuticCeilingList,
TreatmentList,
VisitOptionList,
AccessControlList,
TestList,
GenericList
}
+30
View File
@@ -0,0 +1,30 @@
namespace adas_core.Domain.Enums;
public static class MedicineEnum
{
public enum Group
{
Metabolic,
DoubleSignature,
Vasoactive
}
public enum Types
{
MuscleRelaxant,
Vasopressin,
AdrenalineNoradrenaline,
DopamineDobutamine,
Pge1,
FibrinolyticAnticoagulants,
DexmedetomidineMidazolam,
Anticomiciales,
AntiarrhythmicsCardiovascular,
BloodDerivative,
ParacetamolOpiates,
ParenteralNutrition,
ParenteralNutritionLipids,
Insulin,
CrystalloidExpansion
}
}
+51
View File
@@ -0,0 +1,51 @@
namespace adas_core.Domain.Enums;
public static class ObservationEnum
{
/**
* Default => Devuelve flecha blanca siempre
* DefaultStatus => Devuelve flecha basándonos en el estado de la obs manteniendo la tendencia respecto al último valor
* RegularLastValue => Si baja flecha color rojo Si sube flecha color verde
* RegularInvertLastValue => Si baja flecha color verde Si sube flecha color rojo
* MinMaxValue => Solo se muestra flecha por encima / debajo max / min y siempre en rojo
*/
public enum ArrowType
{
None,
Default,
DefaultStatus,
RegularLastValue,
RegularInvertLastValue,
MinMaxValue
}
public enum Category
{
Treatment,
Observation,
Intervention
}
public enum InsertMode
{
Auto,
Manual,
Mix
}
public enum ValueType
{
Number,
String,
Boolean,
Date
}
public enum XmlType
{
Observation,
Treatment,
Intervention,
Canbra
}
}
+83
View File
@@ -0,0 +1,83 @@
namespace adas_core.Domain.Enums;
public enum OperationType
{
Status,
Section,
SectionSensors,
Box,
Observation,
GroupedObservation,
ConfigObservation,
Pump,
PumpAlarm,
Treatment,
UpdateTreatment,
UpdatedPointOfCare,
NewPointOfCare,
PatientLocation,
DeletePatient,
PatientAttendingDoctor,
PatientData,
UpdatePatient,
NewPatient,
RecordingAlert,
Diagnosis,
NewAppointment,
UpdatedAppointment,
CanceledAppointment,
Sensor,
Error,
SurgeryRoomAlert,
ChatMessage,
Relay,
RecordingStatus,
UpdateApplication,
Beacon,
Alarm,
NewAdmission,
DeleteAdmission,
UpdateAdmission,
NewDischarge,
DeleteDischarge,
UpdateDischarge,
Display,
DisplayList,
NewNotice,
DeleteNotice,
UpdateNotice,
NewMasterList,
DeleteMasterList,
UpdateMasterList,
UpdateUnit,
UpdateDisplayConfig,
UpdateCardDisplayConfig,
UpdateSmartDisplayConfig,
UpdateNurseDisplayConfig,
UpdateDisplayPoC,
NewPoC,
UpdatePoc,
DeletePoc,
UpdateMasterListItem,
DeleteMasterListItem,
AddMasterListItem,
UpdateDetailDisplayConfig,
UpdateChartConfig,
UpdatePassword,
UpdateAuthorities,
DisableUser,
LockUser
}
@@ -0,0 +1,56 @@
namespace adas_core.Domain.Enums;
public enum OrderControlType
{
Af, //Order/service refill request approval
Ca, //Cancel order/service request
Ch, //Child order/service
Cn, //Combined result
Cr, //Canceled as requested
Dc, //Discontinue order/service request
De, //Data errors
Df, //Order/service refill request denied
Dr, //Discontinued as requested
Fu, //Order/service refilled, unsolicited
Hd, //Hold order request
Hr, //On hold as requested
Li, //Link order/service to patient care problem or goal
Mc, //Miscellaneous Charge - not associated with an order
Na, //Number assigned
Nw, //New order/service
Oc, //Order/service canceled
Od, //Order/service discontinued
Oe, //Order/service released
Of, //Order/service refilled as requested
Oh, //Order/service held
Ok, //Order/service accepted & OK
Op, //Notification of order for outside dispense
Or, //Released as requested
Pa, //Parent order/service
Pr, //Previous Results with new order/service
Py, //Notification of replacement order for outside dispense
Re, //Observations/Performed Service to follow
Rf, //Refill order/service request
Rl, //Release previous hold
Ro, //Replacement order
Rp, //Order/service replace request
Rq, //Replaced as requested
Rr, //Request received
Ru, //Replaced unsolicited
Sc, //Status changed
Sn, //Send order/service number
Sr, //Response to send order/service status request
Ss, //Send order/service status request
Ua, //Unable to accept order/service
Uc, //Unable to cancel
Ud, //Unable to discontinue
Uf, //Unable to refill
Uh, //Unable to put on hold
Um, //Unable to replace
Un, //Unlink order/service from patient care problem or goal
Ur, //Unable to release
Ux, //Unable to change
Xo, //Change order/service request
Xr, //Changed as requested
Xx //Order/service changed, unsol.
}
+12
View File
@@ -0,0 +1,12 @@
namespace adas_core.Domain.Enums;
public static class PatientEnum
{
public enum Gender
{
Male,
Female,
Undifferentiated,
Unknown
}
}
+55
View File
@@ -0,0 +1,55 @@
namespace adas_core.Domain.Enums;
public class PermissionEnum
{
public enum PermissionTypesEnum
{
Unit,
Display,
DisplayConfig,
MasterList,
Treatment,
Patient,
Medicine,
Pump,
User,
ConfigObservation,
Observation,
Audit,
Admission,
Discharge,
PatientIncome,
Obs,
DemographicData,
BoxBlocking,
Default // ??????????????????????????
}
public enum RolesType
{
AuthSome = 1,
AuthGuest = 2,
AuthNurse = 3,
AuthNursesupervisor = 4,
AuthDoctor = 5,
AuthDoctorchief = 6,
AuthDeveloper = 5000,
AuthAdmin = 10000
}
public enum SourcePermissionsEnum
{
Display,
Unit,
Panel
}
public enum UserActionEnum
{
Create,
Read,
Update,
Delete
}
}
+169
View File
@@ -0,0 +1,169 @@
namespace adas_core.Domain.Enums;
public static class PumpEnum
{
public enum PumpMessageType
{
Unknown = 0,
Observation = 1, // PCD-01 / PCD-10
Alarm = 2 // PCD-04
}
public enum AlarmMode
{
Hight,
Medium,
Low,
None
}
public enum AlarmType
{
// ALARMAS DE ESTADO/CONDICIÓN GENERAL
AlarmCondition,
// ALARMAS ESPECÍFICAS DE INFUSIÓN Y BOMBA
Occlusion,
DoorOpen,
InfusionNearCompletion,
VtbiComplete,
NoPowerSource,
SyringeSizeMismatch,
// ALARMAS DE SISTEMA Y TÉCNICAS
BatteryEmpty,
PowerFailure,
CommunicationFailure,
PumpMalfunction,
ProgramError,
SensorError,
PressureSensorError,
TemperatureTooHigh,
SelfTestFailed,
//NEXUS ALARMS
SystemError,
CheckSyringePlunger,
CheckSyringeClamp,
SyringeInstallError,
DownstreamOcclusion,
DriveHeadPositionErr,
HandOverFailed,
KvoEnd,
SyringeEmpty,
VtbiDone,
PressureFall,
PressureRise,
StandbyEnd,
AcPowerFail,
Attention,
DrugMismatch,
StepCompleted,
NearEndOfInfusion,
SyringeNearEmpty,
AirInLine,
BatteryLow,
NoBattery,
TitrationNotConfirmed,
DropSensorDisconnect,
NoFlow,
TooFewDrops,
TooManyDrops,
UpstreamOcclusion,
KvoAtSeEnd,
InfusionSetNotCorrectlyFitted
}
public enum Event
{
Start,
Stop,
Complete,
ProgramRelay,
CommStatusChange,
LimitOverrideSoftUpper,
LimitOverrideSoftLower,
LimitExceededSoftUpper,
LimitExceededSoftLower,
VolumeCountersCleared
}
public enum EventPhase
{
Start,
Continue,
End
}
public enum InfusingStatus
{
Infusing,
NotInfusing,
Unknown
}
public enum MedicationMode
{
DrugDosing,
RampTaper,
MultiStep,
MultiDosing,
LoadingDose,
Continuous,
Piggyback,
Concurrent,
ClinicianDose,
Kvo,
Flushing,
PatientDose,
Priming,
Other
}
public enum Mode
{
Hold,
Infusing,
Primary,
Secondary,
KeepVeinOpen,
EndOfInfusion,
Titration,
Bolus,
Priming,
Setup,
Induction,
BackOff,
MultiDose,
LoadingDose,
Unknown,
DrugDosing,
RampTaper,
MultiDosing,
Continuous,
Piggyback,
Concurrent,
ClinicianDose,
Other,
Flushing,
PatientDose,
MultiStep
}
public enum Status
{
Alarm,
Warning,
Caution,
Hold,
Infusing,
Unknown,
NotInfusing,
Delivering,
NotDelivering,
Transitioning,
Kvo,
Priming
}
}
+29
View File
@@ -0,0 +1,29 @@
namespace adas_core.Domain.Enums;
public static class RelayEnum
{
public enum Mode
{
OpenedOnClosedOff,
OpenedOffClosedOn
}
public enum OutletType
{
Rele,
Pdu
}
public enum Status
{
On,
Off,
Unknown,
NotInitialized
}
public enum Type
{
Door
}
}
@@ -0,0 +1,9 @@
namespace adas_core.Domain.Enums;
public enum RespirationType
{
NonInvasive,
Invasive,
HighFrequencyVentilation,
None
}
@@ -0,0 +1,9 @@
namespace adas_core.Domain.Enums;
public enum RetentionPolicy
{
NoDelete,
DeleteOlderDays,
DeleteOlderNumber,
DeleteOlderSeconds
}
+53
View File
@@ -0,0 +1,53 @@
namespace adas_core.Domain.Enums;
public static class StatusEnum
{
public enum Discharge
{
Altable,
NoAltable
}
public enum PointOfCare
{
//Bloqueado
Locked,
//Reservado cuando hay una admisión prevista
Reserved,
//Disponible
Available,
//En uso
InUse
}
public enum Type
{
Ok = 0,
Warning = 1,
Alert = 2
}
public enum User
{
Enabled,
EnabledUnlocked,
EnabledLocked,
Disabled
}
public enum Video
{
Initialized,
Recording,
Paused,
Stopped,
Finished,
Published,
Deleted,
Purged,
Error
}
}
@@ -0,0 +1,28 @@
namespace adas_core.Domain.Enums;
public static class SubscriptionEnum
{
public enum Type
{
SectionSubscribe,
PatientData,
Idle,
BoxSubscribe,
ChatMessage,
RecordingSuscribe,
GroupedObservations,
Sensors,
Display,
Demo,
Admin
}
public enum WsType
{
Section,
Box,
Unit,
Display,
Admin
}
}
+17
View File
@@ -0,0 +1,17 @@
namespace adas_core.Domain.Enums;
public static class UserEnum
{
public enum LoginMethod
{
Local,
Ldap,
Cas
}
public enum Type
{
Local,
Ldap
}
}
@@ -0,0 +1,13 @@
namespace adas_core.Domain.Enums;
public enum VirtualPointOfCare
{
Pushed,
Unknown,
Deleted,
Moved,
NoBed,
Cancelled,
Recovered,
UnitData
}
@@ -0,0 +1,3 @@
namespace adas_core.Domain.Exceptions;
public class AdasException(string message) : Exception($"ADAS Exception: {message}");
@@ -0,0 +1,14 @@
using System.Net;
namespace adas_core.Domain.Exceptions;
public class BusinessException : AggregateException
{
public BusinessException(HttpStatusCode status, string message) : base($"{status}: {message}")
{
}
public BusinessException(string message, Exception exception) : base(message, exception)
{
}
}
@@ -0,0 +1,16 @@
using System.Net;
namespace adas_core.Domain.Exceptions;
public class LoginServicesException : BusinessException
{
public LoginServicesException(string message) :
base(HttpStatusCode.BadRequest, $"Login service error: {message}")
{
}
public LoginServicesException(string message, Exception exception) : base($"Login service error: {message}",
exception)
{
}
}
@@ -0,0 +1,6 @@
using System.Net;
namespace adas_core.Domain.Exceptions;
public class LoginServicesNotFoundException()
: BusinessException(HttpStatusCode.Forbidden, "No login services available");
@@ -0,0 +1,16 @@
using System.Net;
namespace adas_core.Domain.Exceptions;
public class UserNotFoundException : BusinessException
{
public UserNotFoundException(string username) :
base(HttpStatusCode.NotFound, $"USER with username {username} not found")
{
}
public UserNotFoundException(string username, Exception exception) : base(
$"USER with username {username} not found", exception)
{
}
}
+33
View File
@@ -0,0 +1,33 @@
using System.Linq.Expressions;
using adas_core.Domain.Models.Filter;
using Microsoft.EntityFrameworkCore;
namespace adas_core.Domain;
public interface IDefaultRepository<T, in TS> where T : class
{
DbSet<T> GetSet();
IQueryable<T> Query();
IQueryable<T> Query(PaginationFilter? filter);
IQueryable<T> Query(int? currentPage, int? pageSize = null);
T? GetById(TS id, params Expression<Func<T, object>>[] includeExpressions);
T? GetById(TS id, QueryCustomizer<T> queryCustomizer);
/*[Obsolete("Use GetById(<S> id) instead")]
T? GetById(int id);
[Obsolete("Use GetById(<S> id) instead")]
T? GetById(long id);
//T? GetById(string id);*/
T? GetByIds(params object[] keyValues);
T Create(T obj);
List<T> Create(List<T> objs);
T Delete(T obj);
List<T> Delete(ICollection<T> objs);
void DeleteAll();
T Update(T obj);
int Count();
int Count(string status);
List<T> FindAll();
}
@@ -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; }
}

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