Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,263 @@
|
||||
using adas_core.Domain.Enums;
|
||||
using adas_core.Domain.Models;
|
||||
using adas_core.Domain.Models.GroupedObservations;
|
||||
using adas_core.Domain.Models.Masters;
|
||||
using adas_core.Domain.Models.MongoModels;
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace adas_core.Test.Utilities;
|
||||
|
||||
public class TestUtilities
|
||||
{
|
||||
public static PointOfCare CreateValidPointOfCare()
|
||||
{
|
||||
return new PointOfCare
|
||||
{
|
||||
Id = ObjectId.GenerateNewId(),
|
||||
Room = "Test Room",
|
||||
Bed = "Test Bed",
|
||||
UnitId = ObjectId.GenerateNewId(),
|
||||
Configuration = new PointOfCareConfiguration(),
|
||||
Status = StatusEnum.PointOfCare.Available,
|
||||
AdmissionId = ObjectId.GenerateNewId(),
|
||||
Unit = CreateValidUnit(),
|
||||
UnitName = "Test Unit"
|
||||
};
|
||||
}
|
||||
|
||||
public static Discharge CreateValidDischarge()
|
||||
{
|
||||
return new Discharge
|
||||
{
|
||||
Id = ObjectId.GenerateNewId(),
|
||||
PointOfCareId = ObjectId.GenerateNewId(),
|
||||
UnitId = ObjectId.GenerateNewId(),
|
||||
DischargeDate = DateTime.UtcNow,
|
||||
PatientId = ObjectId.GenerateNewId(),
|
||||
Destination = "Test Destination",
|
||||
DestinationOption = CreateValidOptionList(),
|
||||
ServiceOption = CreateValidOptionList(),
|
||||
Service = "Test Service",
|
||||
MedicalDischarge = DateTime.UtcNow,
|
||||
AdminDischarge = DateTime.UtcNow,
|
||||
NurseDischarge = DateTime.UtcNow
|
||||
};
|
||||
}
|
||||
|
||||
public static Patient CreateValidPatient()
|
||||
{
|
||||
return new Patient
|
||||
{
|
||||
Id = ObjectId.GenerateNewId(),
|
||||
PatientNumber = "TestPatientNumber",
|
||||
PatientId = "TestPatientId",
|
||||
AdmTime = DateTime.UtcNow,
|
||||
DischargeStatus = new OptionList
|
||||
{
|
||||
OptionType = "TestDischargeStatus",
|
||||
Name = "TestDischargeStatusName",
|
||||
IconDefault = "TestIcon",
|
||||
Color = "TestColor",
|
||||
Description = "TestDescription",
|
||||
InitDate = DateTime.UtcNow,
|
||||
EndDate = DateTime.UtcNow.AddDays(7) // Example end date
|
||||
},
|
||||
Altable = new OptionList
|
||||
{
|
||||
OptionType = "TestAltable",
|
||||
Name = "TestAltableName",
|
||||
IconDefault = "TestAltableIcon",
|
||||
Color = "TestAltableColor",
|
||||
Description = "TestAltableDescription",
|
||||
InitDate = DateTime.UtcNow,
|
||||
EndDate = DateTime.UtcNow.AddDays(7) // Example end date
|
||||
},
|
||||
Origin = new OptionList
|
||||
{
|
||||
OptionType = "TestOrigin",
|
||||
Name = "TestOriginName",
|
||||
IconDefault = "TestOriginIcon",
|
||||
Color = "TestOriginColor",
|
||||
Description = "TestOriginDescription",
|
||||
InitDate = DateTime.UtcNow,
|
||||
EndDate = DateTime.UtcNow.AddDays(7) // Example end date
|
||||
}
|
||||
// Initialize other properties as needed
|
||||
};
|
||||
}
|
||||
|
||||
public static OptionList CreateValidOptionList()
|
||||
{
|
||||
return new OptionList
|
||||
{
|
||||
OptionType = "Test Option",
|
||||
Name = "Test Name",
|
||||
IconDefault = "Test Icon",
|
||||
Color = "Test Color",
|
||||
Description = "Test Description",
|
||||
InitDate = DateTime.UtcNow,
|
||||
EndDate = DateTime.UtcNow.AddDays(1)
|
||||
};
|
||||
}
|
||||
|
||||
private static PatientLocation CreateValidPatientLocation()
|
||||
{
|
||||
return new PatientLocation
|
||||
{
|
||||
UnitName = "Test Unit",
|
||||
Bed = "Test Bed",
|
||||
Room = "Test Room"
|
||||
};
|
||||
}
|
||||
|
||||
public static Unit CreateValidUnit()
|
||||
{
|
||||
return new Unit
|
||||
{
|
||||
Id = ObjectId.GenerateNewId(),
|
||||
Title = "Test Unit",
|
||||
Name = "Test Unit",
|
||||
LastUpdate = null,
|
||||
PointOfCareIds = [],
|
||||
Status = StatusEnum.Type.Ok,
|
||||
Configuration = new UnitConfiguration
|
||||
{
|
||||
AutoAdt = true,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Admission CreateValidAdmission()
|
||||
{
|
||||
return new Admission
|
||||
{
|
||||
//Id = ObjectId.GenerateNewId(),
|
||||
AdmissionDate = DateTime.UtcNow,
|
||||
Nhc = ObjectId.GenerateNewId().ToString(),
|
||||
UnitId = ObjectId.GenerateNewId(),
|
||||
PointOfCareId = ObjectId.GenerateNewId(),
|
||||
Person = new Person
|
||||
{
|
||||
FirstName = "Test First Name",
|
||||
LastName = "Test Last Name"
|
||||
// Initialize other properties as needed
|
||||
},
|
||||
Origin = CreateValidOptionList(),
|
||||
OriginAux = "Test Origin Aux",
|
||||
Diagnosis = CreateValidOptionList(),
|
||||
DiagnosisAux = "Test Diagnosis Aux",
|
||||
Allergies =
|
||||
[
|
||||
CreateValidOptionList(),
|
||||
CreateValidOptionList()
|
||||
// Add more allergies as needed
|
||||
],
|
||||
Insulation = CreateValidOptionList(),
|
||||
LanguageBarrier = [CreateValidOptionList()],
|
||||
PatientLocation = CreateValidPatientLocation()
|
||||
// Initialize other properties as needed
|
||||
};
|
||||
}
|
||||
|
||||
public static CardConfig CreateValidCardConfig(ObjectId? id = null)
|
||||
{
|
||||
return new CardConfig
|
||||
{
|
||||
Id = id ?? ObjectId.GenerateNewId(),
|
||||
Rows = new List<RowCardConfig>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Cells = new List<Cell>
|
||||
{
|
||||
new() { Type = DisplayConfigEnums.CellType.DemographicCell }
|
||||
},
|
||||
GrowPriority = 1,
|
||||
Type = DisplayConfigEnums.CellType.CellWrapper
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static CardDetailsConfig CreateValidCardDetailsNurseConfig(ObjectId? id = null)
|
||||
{
|
||||
return new CardDetailsConfig
|
||||
{
|
||||
Id = id ?? ObjectId.GenerateNewId(),
|
||||
NurseRows = new List<RowDetailsConfig>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Type = DisplayConfigEnums.RowType.Demographic,
|
||||
Title = "Title details",
|
||||
Cells = new List<CellDetails>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Type = DisplayConfigEnums.CellType.CellWrapper,
|
||||
Cells = new List<CellDetails>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Type = DisplayConfigEnums.CellType.AllergyCell
|
||||
},
|
||||
new()
|
||||
{
|
||||
Type = DisplayConfigEnums.CellType.DemographicCell
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static CardDetailsConfig CreateValidCardDetailsSmartConfig(ObjectId? id = null)
|
||||
{
|
||||
return new CardDetailsConfig
|
||||
{
|
||||
Id = id ?? ObjectId.GenerateNewId(),
|
||||
SmartSections = new List<SectionBoxLayout>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Type = DisplayConfigEnums.RowType.General,
|
||||
Name = "Title details",
|
||||
Rows = new List<RowBoxLayout>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Type = DisplayConfigEnums.CellType.CellWrapper,
|
||||
Observations = new List<ObservationRowBoxLayout>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Type = DisplayConfigEnums.CellType.BeaconColor
|
||||
},
|
||||
new()
|
||||
{
|
||||
Type = DisplayConfigEnums.CellType.Isolation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static DisplayConfig CreateValidDisplayConfig(DisplayConfigEnums.DisplayType type, ObjectId? id,
|
||||
ObjectId? idCard, ObjectId? idDetail)
|
||||
{
|
||||
return new DisplayConfig
|
||||
{
|
||||
Id = id ?? ObjectId.GenerateNewId(),
|
||||
CardConfigId = idCard ?? ObjectId.GenerateNewId(),
|
||||
DetailConfigId = idDetail ?? ObjectId.GenerateNewId(),
|
||||
Type = type,
|
||||
FieldList = new List<Field> { new() { Name = "FR", Last = 2 } },
|
||||
Hospital = "Test Hospital"
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user