rama creada apartir de master en j
This commit is contained in:
@@ -8,35 +8,127 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IAdmissionRepository : IMongoRepository<Admission>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified admission record asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity containing the updated information.</param>
|
||||
Task Update(Admission admission);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the location of an entity identified by the specified identifier to a new location.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity whose location is to be updated.</param>
|
||||
/// <param name="newLocation">The identifier of the new location to assign to the entity.</param>
|
||||
Task UpdateLocation(ObjectId id, ObjectId newLocation);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing patient record identified by the specified identifier with the provided patient information.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to update.</param>
|
||||
/// <param name="patient">The patient object containing the updated information to apply.</param>
|
||||
Task UpdatePatient(ObjectId id, Person patient);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all admission records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{Admission}"/> with all available admissions.</returns>
|
||||
Task<IEnumerable<Admission>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an <see cref="Admission"/> entity by its unique identifier, returning <c>null</c> when no matching record is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the <see cref="Admission"/> to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Admission"/>, or <c>null</c> if no admission exists with the specified identifier.</returns>
|
||||
Task<Admission?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves an admission record that matches the specified NHC (Número de Historia Clínica) identifier, or <c>null</c> when no matching admission exists.
|
||||
/// </summary>
|
||||
/// <param name="nhc">The NHC (clinical history number) used to look up the admission.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Admission"/>, or <c>null</c> if no admission is found for the given NHC.</returns>
|
||||
Task<Admission?> FindByNhc(string nhc);
|
||||
|
||||
//Task<IEnumerable<Admission>?> FindByUnit(string unit);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of admissions associated with the specified patient location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter and find the relevant admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of admissions matching the given location.</returns>
|
||||
Task<List<Admission>> FindByLocation(PatientLocation location);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of admissions filtered by the specified origin.
|
||||
/// </summary>
|
||||
/// <param name="origin">The origin value used to filter the admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of matching admissions, or <c>null</c> if no admissions are found for the given origin.</returns>
|
||||
Task<IEnumerable<Admission>?> FindByOrigin(string origin);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="Admission"/> record into the data store and returns the resulting entity.
|
||||
/// </summary>
|
||||
/// <param name="origin">The <see cref="Admission"/> entity to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="Admission"/>, or <c>null</c> if no result is returned.</returns>
|
||||
Task<Admission?> InsertOneAsyncAndReturn(Admission origin);
|
||||
/// <summary>
|
||||
/// Searches for an admission matching the specified patient number and unit, returning a distinct result.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The patient's identifier used to locate the admission.</param>
|
||||
/// <param name="unitId">The unique identifier of the unit to filter the search.</param>
|
||||
/// <returns>A <see cref="Admission"/> if a matching record is found; otherwise, <c>null</c>.</returns>
|
||||
Task<Admission?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of admissions associated with the specified unit, excluding Point of Care (PoC) entries.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose admissions are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Admission"/> records linked to the given unit, with PoC entries excluded.</returns>
|
||||
Task<List<Admission>> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves a list of admissions associated with the specified point of care identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The unique identifier of the point of care used to filter the admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of admissions matching the specified point of care identifier.</returns>
|
||||
Task<List<Admission>> FindByPointOfCareId(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of admissions associated with the specified unit identifiers.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers used to look up the corresponding admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of admissions matching the provided unit identifiers.</returns>
|
||||
Task<List<Admission>> FindByUnitIds(List<ObjectId> unitIds);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit used to filter the records.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the count of matching records.</returns>
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the master list option for the specified units based on the provided options and type, returning the affected admissions.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers whose master list option should be updated.</param>
|
||||
/// <param name="opt">The data transfer object containing the new master list option values to apply.</param>
|
||||
/// <param name="typeName">The name of the option type to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of admissions affected by the update.</returns>
|
||||
Task<IEnumerable<Admission>> UpdateMasterListOption(List<ObjectId> unitIds, UpdateOptionMasterListDto opt,
|
||||
string typeName);
|
||||
string typeName);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified option from the master list for the given units and type, returning the affected admissions.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers whose master list option should be deleted.</param>
|
||||
/// <param name="opt">The option to be removed from the master list.</param>
|
||||
/// <param name="typeName">The name of the type associated with the master list option.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of <see cref="Admission"/> records affected by the deletion.</returns>
|
||||
Task<IEnumerable<Admission>> DeleteMasterListOption(List<ObjectId> unitIds, OptionList opt, string typeName);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes admissions associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose admissions will be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating the result of the deletion.</returns>
|
||||
Task<bool> DeleteAdmissionsByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -7,9 +7,22 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IAlarmRepository : IMongoRepository<PatientObservationAlarm>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the most recent aggregated patient observations as alarm records, optionally filtered to a specific set of fields.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose last observations should be aggregated.</param>
|
||||
/// <param name="filterObservations">An optional list of fields used to restrict which observation types are included in the aggregation; when null, all available observations are considered.</param>
|
||||
/// <returns>A task that resolves to the list of aggregated <see cref="PatientObservationAlarm"/> entries representing the patient's latest observations.</returns>
|
||||
Task<List<PatientObservationAlarm>> AggregatedPatientLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null);
|
||||
List<Field>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves aggregated, non-expired patient observation alarms for a specific patient, optionally filtered by a set of fields and evaluated against the supplied configuration alarms.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observation alarms are being retrieved.</param>
|
||||
/// <param name="filterObservations">An optional list of fields used to restrict which observations are considered. If null, no field-based filtering is applied.</param>
|
||||
/// <param name="configAlarm">The list of configuration observation definitions used to build and aggregate the resulting alarms.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of aggregated <see cref="PatientObservationAlarm"/> entries for the patient.</returns>
|
||||
Task<List<PatientObservationAlarm>> AggregatedPatientNotExpiredObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations, List<ConfigObservation> configAlarm);
|
||||
List<Field>? filterObservations, List<ConfigObservation> configAlarm);
|
||||
}
|
||||
@@ -4,7 +4,20 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IAppointmentArchiveRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single patient appointment into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientAppointment">The patient appointment entity to be persisted.</param>
|
||||
Task InsertOneAsync(PatientAppointment patientAppointment);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records that have a date earlier than the specified cutoff date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; records dated before this value will be removed.</param>
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Inserts a batch of patient appointments asynchronously, typically as part of a bulk import or synchronization process.
|
||||
/// </summary>
|
||||
/// <param name="appointment">The collection of patient appointments to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing a long value that represents the result of the batch insertion.</returns>
|
||||
Task<long> InsertBatch(IEnumerable<PatientAppointment> appointment);
|
||||
}
|
||||
@@ -7,16 +7,71 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IAppointmentRepository : IMongoRepository<PatientAppointment>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of patient appointments associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointments are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> objects for the specified patient.</returns>
|
||||
Task<List<PatientAppointment>> GetByPatient(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single patient appointment record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="appointment">The patient appointment entity to be inserted.</param>
|
||||
new Task InsertOneAsync(PatientAppointment appointment);
|
||||
/// <summary>
|
||||
/// Updates an existing patient appointment asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="appointment">The patient appointment containing the updated information.</param>
|
||||
Task Update(PatientAppointment appointment);
|
||||
/// <summary>
|
||||
/// Updates the <see cref="ObjectId"/> field identified by <paramref name="nameId"/> across many records, replacing the existing value <paramref name="oldId"/> with the new value <paramref name="id"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The name of the field that contains the <see cref="ObjectId"/> to update.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to assign to matching records.</param>
|
||||
/// <param name="oldId">The current <see cref="ObjectId"/> value to be replaced.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the entity to delete.</param>
|
||||
new Task DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a cursor of <see cref="PatientAppointment"/> records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique <see cref="ObjectId"/> of the patient whose appointments are being queried.</param>
|
||||
/// <returns>A <see cref="Task{IAsyncCursor{PatientAppointment}}"/> that yields the matching patient appointments; the cursor may be empty if no appointments are found for the given patient.</returns>
|
||||
Task<IAsyncCursor<PatientAppointment>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique ObjectId of the patient whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="PatientAppointment"/> matching the specified patient identifier and visit number.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointment should be located.</param>
|
||||
/// <param name="visitNumber">The visit number used to identify the specific appointment for the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="PatientAppointment"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<PatientAppointment?> FindByPatientAndVisitNumber(ObjectId patientId, string visitNumber);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient appointment matching the specified patient identifier and appointment reason.
|
||||
/// Returns <c>null</c> when no matching appointment is found.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointment should be located.</param>
|
||||
/// <param name="appointmentReason">The appointment reason used to filter the lookup, or <c>null</c> to match any reason.</param>
|
||||
/// <returns>A <see cref="Task{PatientAppointment}"/> that resolves to the matching <see cref="PatientAppointment"/>, or <c>null</c> if none exists.</returns>
|
||||
Task<PatientAppointment?> FindByPatientAndReason(ObjectId patientId, string? appointmentReason);
|
||||
/// <summary>
|
||||
/// Retrieves a list of patient appointments associated with the specified location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter and retrieve matching appointments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> entries for the given location.</returns>
|
||||
Task<List<PatientAppointment>> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of patient appointments associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care used to filter the patient appointments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of patient appointments for the given point of care.</returns>
|
||||
Task<List<PatientAppointment>> FindByPoC(PointOfCare poc);
|
||||
}
|
||||
@@ -5,13 +5,43 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IArchivePatientCarePlanRepository : IMongoRepository<PatientCarePlan>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the list of care plans associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose care plans should be retrieved.</param>
|
||||
/// <returns>A task that returns a list of <see cref="PatientCarePlan"/> objects for the given patient, or <c>null</c> when no care plans are found.</returns>
|
||||
Task<List<PatientCarePlan>?> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of patient care plans associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose care plans are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientCarePlan"/> for the given patient, or <c>null</c> if no care plans are found.</returns>
|
||||
Task<List<PatientCarePlan>?> FindByPatientId(string patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of care plans associated with the specified patient number, returning <c>null</c> when no matching care plans are found.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The patient number used to look up the associated care plans.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> entries for the patient, or <c>null</c> if none exist.</returns>
|
||||
Task<List<PatientCarePlan>?> FindByPatientNumber(string patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient care plans from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="PatientCarePlan"/> entries.</returns>
|
||||
Task<List<PatientCarePlan>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patient care plans matching the provided legacy patient identifiers.
|
||||
/// </summary>
|
||||
/// <param name="oldPatientId">The legacy <see cref="ObjectId"/> identifier used to locate the patient.</param>
|
||||
/// <param name="oldPatientPatientId">An optional legacy patient ID string used as an additional lookup criterion.</param>
|
||||
/// <param name="oldPatientPatientNumber">An optional legacy patient number string used as an additional lookup criterion.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing a nullable list of <see cref="PatientCarePlan"/> records, or <c>null</c> if no matching care plans are found.</returns>
|
||||
Task<List<PatientCarePlan>?> FindByIds(ObjectId oldPatientId, string? oldPatientPatientId,
|
||||
string? oldPatientPatientNumber);
|
||||
string? oldPatientPatientNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a collection of patient care plans into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePla">The list of <see cref="PatientCarePlan"/> records to be inserted.</param>
|
||||
Task InsertManyAsync(List<PatientCarePlan> patientCarePla);
|
||||
}
|
||||
@@ -5,12 +5,51 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IAuthorityRepository : IMongoRepository<Authorization>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves an <see cref="Authorization"/> entity by its unique identifier asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="authId">The unique identifier of the authorization to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Authorization"/> that matches the specified identifier.</returns>
|
||||
public Task<Authorization> GetById(ObjectId authId);
|
||||
/// <summary>
|
||||
/// Creates a new authority assignment for the specified user with the given role name.
|
||||
/// </summary>
|
||||
/// <param name="roleName">The name of the role to assign as the new authority.</param>
|
||||
/// <param name="userId">The identifier of the user to whom the authority will be assigned.</param>
|
||||
void CreateNewAuthority(string roleName, ObjectId userId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of authorizations (authorities/permissions) associated with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The unique identifier of the user whose authorities are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the list of <see cref="Authorization"/> entries assigned to the user.</returns>
|
||||
public Task<List<Authorization>> GetUserAuthorities(ObjectId userId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available authorizations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="Authorization"/> objects.</returns>
|
||||
public Task<List<Authorization>> GetAllAuthorities();
|
||||
/// <summary>
|
||||
/// Asynchronously deletes all authorities associated with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The unique identifier of the user whose authorities will be removed.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if authorities were deleted; otherwise, <c>false</c>.</returns>
|
||||
public Task<bool> DeleteAllAuthoritiesByUser(ObjectId userId);
|
||||
/// <summary>
|
||||
/// Deletes all authorities associated with the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose authorities should be removed.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the authorities were successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteAllAuthoritiesByUnit(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Deletes all authorities associated with the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayId">The identifier of the display whose related authorities should be removed.</param>
|
||||
/// <returns>A task that resolves to a boolean indicating the outcome of the deletion operation.</returns>
|
||||
Task<bool> DeleteAllAuthoritiesByDisplay(ObjectId displayId);
|
||||
/// <summary>
|
||||
/// Retrieves a list of authorizations associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose authorizations are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Authorization"/> objects matching the provided unit identifier.</returns>
|
||||
Task<List<Authorization>> GetByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -7,11 +7,47 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface ICameraRepository : IMongoRepository<Camera>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Camera"/> by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="cameraId">The unique identifier of the camera to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Camera"/>, or <c>null</c> if no camera is found with the specified identifier.</returns>
|
||||
Task<Camera?> GetById(ObjectId cameraId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a camera by its name, returning <c>null</c> if no matching camera is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the camera to look up.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the matching <see cref="Camera"/>, or <c>null</c> if no camera with the specified name exists.</returns>
|
||||
Task<Camera?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves the list of <see cref="Camera"/> objects associated with the specified configuration relays.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of <see cref="ObjectId"/> values identifying the configuration relays whose cameras should be returned.</param>
|
||||
/// <returns>A <see cref="List{Camera}"/> containing the cameras linked to the provided configuration relays; returns an empty list when no matching cameras are found.</returns>
|
||||
List<Camera> GetCameraInList(List<ObjectId> configurationRelayList);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent queryable collection of cameras based on the supplied pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing the page number and page size used to page the camera results.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Camera, Camera}"/> representing the paged query of cameras.</returns>
|
||||
IFindFluent<Camera, Camera> GetPaginatedCameras(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Inserts a new camera record into the data store and returns the persisted entity, or <c>null</c> if the camera could not be inserted.
|
||||
/// </summary>
|
||||
/// <param name="camera">The <see cref="Camera"/> instance containing the data to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the inserted <see cref="Camera"/>, or <c>null</c> when the insertion is not performed.</returns>
|
||||
Task<Camera?> InsertOneCamera(Camera camera);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing camera identified by the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the camera to update.</param>
|
||||
/// <param name="camera">The camera object containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The task result contains the updated <see cref="Camera"/>, or <c>null</c> if no camera with the specified identifier was found.</returns>
|
||||
Task<Camera?> UpdateCameraAsync(ObjectId objectId, Camera camera);
|
||||
/// <summary>
|
||||
/// Asynchronously searches for cameras whose name matches the specified text.
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The text used to filter cameras by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Camera"/> objects matching the search criteria.</returns>
|
||||
Task<List<Camera>> GetSearchByNameCameras(string textToSearch);
|
||||
}
|
||||
@@ -6,25 +6,96 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IConfigObservationRepository : IMongoRepository<ConfigObservation>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a configuration observation by its unique identifier, returning <c>null</c> when no matching observation exists.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation to locate.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ConfigObservation"/> if found, or <c>null</c> if no observation matches the specified identifier.</returns>
|
||||
Task<ConfigObservation?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing configuration observation in the underlying store.
|
||||
/// Returns the updated observation, or <c>null</c> when no matching observation is found.
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The configuration observation containing the updated values to persist.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="ConfigObservation"/>, or <c>null</c> if the observation does not exist.</returns>
|
||||
Task<ConfigObservation?> Update(ConfigObservation configObservation);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the configuration observation identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains the deleted configuration observation, or <c>null</c> if no observation with the specified identifier was found.</returns>
|
||||
Task<ConfigObservation?> Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available identifiers, returning them as a list of <see cref="ObjectId"/> values.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing a list of all <see cref="ObjectId"/> instances found.</returns>
|
||||
Task<List<ObjectId>> FindAllIds();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all configuration observations available in the system.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="ConfigObservation"/> instances.</returns>
|
||||
Task<ICollection<ConfigObservation>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of configuration names associated with the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier used to look up the configuration names.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of configuration names.</returns>
|
||||
Task<List<string>> GetConfigNames(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of available configuration names.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of configuration names.</returns>
|
||||
Task<List<string>> GetConfigNames();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the total count of items.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total count as a <see cref="long"/>.</returns>
|
||||
Task<long> Count();
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of configuration observations based on the specified filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and any additional criteria used to retrieve the observations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="ConfigObservation"/> items that match the pagination criteria.</returns>
|
||||
Task<ICollection<ConfigObservation>> GetPaginatedItems(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves a configuration observation that matches the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the configuration observation to find.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching ConfigObservation if found; otherwise, null.</returns>
|
||||
Task<ConfigObservation?> FindByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="ConfigObservation"/> matching the specified coding system and code.
|
||||
/// </summary>
|
||||
/// <param name="codingSystem">The coding system identifier used to look up the configuration observation.</param>
|
||||
/// <param name="code">The code value within the specified coding system used to look up the configuration observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigObservation"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<ConfigObservation?> GetByCodeSysAndCode(string? codingSystem, string? code);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts the specified configuration observation item and returns the persisted entity.
|
||||
/// </summary>
|
||||
/// <param name="configObservationItem">The configuration observation to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="ConfigObservation"/>.</returns>
|
||||
Task<ConfigObservation> InsertOneAsyncAndReturn(ConfigObservation configObservationItem);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all <see cref="ConfigObservation"/> records matching the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the configuration observations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="ConfigObservation"/> objects matching the given name, or an empty list if none are found.</returns>
|
||||
Task<List<ConfigObservation>> FindAllByName(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a single <see cref="ConfigObservation"/> item matching the provided criteria, or <see langword="null"/> if no matching item is found.
|
||||
/// </summary>
|
||||
/// <param name="code">The code used to look up the configuration observation item, or <see langword="null"/> if not specified.</param>
|
||||
/// <param name="codingSystem">The coding system associated with the code, or <see langword="null"/> if not specified.</param>
|
||||
/// <param name="name">The name used to look up the configuration observation item, or <see langword="null"/> if not specified.</param>
|
||||
/// <param name="originalName">The original name used to look up the configuration observation item, or <see langword="null"/> if not specified.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigObservation"/> item, or <see langword="null"/> if no item matches the specified criteria.</returns>
|
||||
Task<ConfigObservation?> GetSingleConfigObservationItem(string? code, string? codingSystem, string? name,
|
||||
string? originalName);
|
||||
string? originalName);
|
||||
}
|
||||
@@ -4,9 +4,29 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IConfigPumpsRepository : IMongoRepository<ConfigPumps>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a ConfigPumps configuration by its unique identifier.
|
||||
/// Returns null when no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration to look up.</param>
|
||||
/// <returns>A task that yields the matching ConfigPumps instance, or null if no configuration is found for the specified id.</returns>
|
||||
Task<ConfigPumps?> FindById(string id);
|
||||
/// <summary>
|
||||
/// Retrieves all pump configurations asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ConfigPumps"/> if found, or <c>null</c> if no configurations are available.</returns>
|
||||
Task<List<ConfigPumps>?> GetAllConfigs();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the pumps configuration using the supplied <paramref name="config"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="config">The pumps configuration to be persisted.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="ConfigPumps"/> instance, or <see langword="null"/> if the configuration could not be found.</returns>
|
||||
Task<ConfigPumps?> UpdateConfig(ConfigPumps config);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the specified pump configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The pump configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the configuration was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteConfig(ConfigPumps config);
|
||||
}
|
||||
@@ -4,5 +4,11 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IConfigUnitsRepository : IMongoRepository<ConfigUnits>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="ConfigUnits"/> entity by its unique identifier.
|
||||
/// Returns <c>null</c> when no matching configuration unit is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration unit to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="ConfigUnits"/> or <c>null</c> if no entity is found.</returns>
|
||||
Task<ConfigUnits?> FindById(string id);
|
||||
}
|
||||
@@ -6,9 +6,35 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IDeviceRepository : IMongoRepository<Device>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a device matching the specified MAC address, returning null if no matching device is found.
|
||||
/// </summary>
|
||||
/// <param name="deviceDtoMacAddr">The MAC address used to look up the device.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="Device"/> or null when no device is found.</returns>
|
||||
Task<Device?> FindByMacAddr(string deviceDtoMacAddr);
|
||||
/// <summary>
|
||||
/// Finds and returns the device matching the specified serial number, or <c>null</c> if no matching device is found.
|
||||
/// </summary>
|
||||
/// <param name="deviceDtoSerialNumber">The serial number used to look up the device.</param>
|
||||
/// <returns>A <see cref="Device"/> instance if a match is found; otherwise, <c>null</c>.</returns>
|
||||
Task<Device?> FindBySerialNumber(string deviceDtoSerialNumber);
|
||||
/// <summary>
|
||||
/// Asynchronously finds a device by its unique identifier (UUID) and returns the matching device, or null if no device is found.
|
||||
/// </summary>
|
||||
/// <param name="deviceDtoUuid">The UUID string used to look up the device.</param>
|
||||
/// <returns>A <see cref="Task{Device}"/> that resolves to the matching <see cref="Device"/>, or null when no device matches the provided UUID.</returns>
|
||||
Task<Device?> FindByUuid(string deviceDtoUuid);
|
||||
/// <summary>
|
||||
/// Retrieves a device by its unique key identifier.
|
||||
/// </summary>
|
||||
/// <param name="deviceDtoKey">The key identifier of the device to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Device"/> if a matching device is found, or <c>null</c> if no device corresponds to the specified key.</returns>
|
||||
Task<Device?> FindByKey(string deviceDtoKey);
|
||||
/// <summary>
|
||||
/// Updates the statistics of an existing device identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the device whose statistics will be updated.</param>
|
||||
/// <param name="deviceExist">The device data transfer object representing the existing device to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
Task UpdateDeviceStats(ObjectId id,DeviceDto deviceExist);
|
||||
}
|
||||
@@ -4,7 +4,21 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IDiagnosisArchiveRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new patient diagnosis record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patientDiagnosis">The patient diagnosis entity to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
Task InsertOneAsync(PatientDiagnosis patientDiagnosis);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes items that occurred before the specified cutoff date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; items dated prior to this value will be deleted.</param>
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Inserts a batch of patient diagnosis records into the data store.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The collection of <see cref="PatientDiagnosis"/> entities to insert.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> representing the asynchronous operation, containing the result of the batch insertion.</returns>
|
||||
Task<long> InsertBatch(IEnumerable<PatientDiagnosis> diagnosis);
|
||||
}
|
||||
@@ -6,12 +6,48 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IDiagnosisRepository : IMongoRepository<PatientDiagnosis>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patient diagnoses associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnoses are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientDiagnosis"/> objects for the specified patient.</returns>
|
||||
Task<List<PatientDiagnosis>> GetByPatient(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single patient diagnosis record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis entity to insert.</param>
|
||||
new Task InsertOneAsync(PatientDiagnosis diagnosis);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
new Task DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Updates many records by replacing the existing <see cref="ObjectId"/> identified by <paramref name="oldId"/> with the new <see cref="ObjectId"/> <paramref name="id"/>, scoped to the specified <paramref name="nameId"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The identifier of the field or collection on which the update is performed.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to assign.</param>
|
||||
/// <param name="oldId">The existing <see cref="ObjectId"/> value to be replaced.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Asynchronously finds all patient diagnoses associated with the specified patient identifier, returning a cursor to iterate over the matching documents.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnoses should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an IAsyncCursor of PatientDiagnosis that yields the matching documents.</returns>
|
||||
Task<IAsyncCursor<PatientDiagnosis>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique <see cref="ObjectId"/> of the patient whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="PatientDiagnosis"/> associated with the specified patient, diagnosis code, and coding system.
|
||||
/// Returns null when no matching diagnosis is found.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnosis is being looked up.</param>
|
||||
/// <param name="diagnosisCode">The diagnosis code to match. May be null.</param>
|
||||
/// <param name="codingSystem">The coding system of the diagnosis code (for example, ICD-10 or SNOMED). May be null.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="PatientDiagnosis"/>, or null if no diagnosis matches the given criteria.</returns>
|
||||
Task<PatientDiagnosis?> FindByPatientIdAndCode(ObjectId patientId, string? diagnosisCode, string? codingSystem);
|
||||
}
|
||||
@@ -8,37 +8,129 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IDischargeRepository : IMongoRepository<Discharge>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing discharge record.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity containing the updated information to be persisted.</param>
|
||||
Task Update(Discharge discharge);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the unit associated with the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the object whose unit will be updated.</param>
|
||||
/// <param name="unit">The new unit value to assign to the object.</param>
|
||||
Task UpdateUnit(ObjectId id, string unit);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing patient record identified by the specified identifier with the provided patient data.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to update.</param>
|
||||
/// <param name="patient">The patient object containing the updated information to be applied to the existing record.</param>
|
||||
Task UpdatePatient(ObjectId id, Patient patient);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all discharge records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of all <see cref="Discharge"/> entities.</returns>
|
||||
Task<IEnumerable<Discharge>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Discharge"/> record by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the discharge record to find.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Discharge"/> if a matching record is found; otherwise, <c>null</c>.</returns>
|
||||
Task<Discharge?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of <see cref="Discharge"/> records associated with the specified unit, or <see langword="null"/> if no matching records are found.
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit identifier used to filter the discharge records.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is an <see cref="IEnumerable{T}"/> of <see cref="Discharge"/> containing the matching records, or <see langword="null"/> when no records are found.</returns>
|
||||
Task<IEnumerable<Discharge>?> FindByUnit(string unit);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The ObjectId of the unit whose associated records will be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the count of records for the specified unit.</returns>
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of discharge records associated with the specified destination.
|
||||
/// </summary>
|
||||
/// <param name="destination">The destination identifier used to look up matching discharge records.</param>
|
||||
/// <returns>A task that yields an <see cref="IEnumerable{Discharge}"/> of matching discharge records, or <c>null</c> if no records are found for the given destination.</returns>
|
||||
Task<IEnumerable<Discharge>?> FindByDestination(string destination);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of discharges associated with the specified service.
|
||||
/// Returns null when no matching discharges are found for the given service.
|
||||
/// </summary>
|
||||
/// <param name="service">The service identifier used to look up matching discharge records.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is an <see cref="IEnumerable{T}"/> of <see cref="Discharge"/> entries for the specified service, or <c>null</c> if none are found.</returns>
|
||||
Task<IEnumerable<Discharge>?> FindByService(string service);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of <see cref="Discharge"/> records associated with the specified unit identifiers.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The collection of unit identifiers used to look up the matching discharges. May be <c>null</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="Discharge"/> objects, or <c>null</c> when no matching discharges are available.</returns>
|
||||
Task<IEnumerable<Discharge>?> GetDischargesByUnitIds(IEnumerable<ObjectId>? unitIds);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the discharge record associated with the specified patient location, returning null if no discharge is found for that location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to look up the associated discharge record.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Discharge"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Discharge?> GetDischargeByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge record associated with the specified patient identifier, or <see langword="null"/> if no discharge exists for that patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose discharge record is being requested.</param>
|
||||
/// <returns>A <see cref="Task{Discharge}"/> that resolves to the matching <see cref="Discharge"/>, or <see langword="null"/> when no record is found.</returns>
|
||||
Task<Discharge?> GetByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of <see cref="Discharge"/> records associated with the specified point-of-care identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The point-of-care identifier used to look up the associated discharges.</param>
|
||||
/// <returns>A task that returns an <see cref="IEnumerable{T}"/> of <see cref="Discharge"/> records, or <see langword="null"/> if no discharges are found for the given point-of-care identifier.</returns>
|
||||
Task<IEnumerable<Discharge>?> FindByPoCId(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge associated with the specified point of care identifier.
|
||||
/// </summary>
|
||||
/// <param name="poc">The identifier of the point of care used to look up the discharge.</param>
|
||||
/// <returns>A task that returns the matching <see cref="Discharge"/> if one is found; otherwise, <c>null</c>.</returns>
|
||||
Task<Discharge?> GetDischargeByPointOfCareId(ObjectId poc);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the master list option for the specified units based on the provided update details and type name.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers to be updated.</param>
|
||||
/// <param name="opt">The update option master list data transfer object containing the new option details.</param>
|
||||
/// <param name="typeName">The name of the type to which the master list option applies.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of updated Discharge records.</returns>
|
||||
Task<IEnumerable<Discharge>> UpdateMasterListOption(List<ObjectId> unitIds, UpdateOptionMasterListDto opt,
|
||||
string typeName);
|
||||
string typeName);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified master list option from the given units and returns the resulting discharges.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The identifiers of the units from which the option will be removed.</param>
|
||||
/// <param name="opt">The master list option to delete.</param>
|
||||
/// <param name="typeName">The type name associated with the option.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of <see cref="Discharge"/> objects resulting from the deletion.</returns>
|
||||
Task<IEnumerable<Discharge>> DeleteMasterListOption(List<ObjectId> unitIds, OptionList opt, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes the entity associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose associated record should be removed.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is <c>true</c> if a record was deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -6,9 +6,33 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IDisplayCardConfigRepository : IMongoRepository<CardConfig>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available card configurations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="CardConfig"/> items.</returns>
|
||||
Task<List<CardConfig>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a card configuration by its unique identifier, returning <c>null</c> when no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the card configuration to look up.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="CardConfig"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<CardConfig?> GetById(ObjectId configId);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="CardConfig"/> into the data store and returns the persisted record, which may include database-generated values.
|
||||
/// </summary>
|
||||
/// <param name="config">The <see cref="CardConfig"/> instance to insert.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the inserted <see cref="CardConfig"/>, or <c>null</c> if the record could not be persisted.</returns>
|
||||
Task<CardConfig?> InsertOneAsyncAndReturn(CardConfig config);
|
||||
/// <summary>
|
||||
/// Updates a single <see cref="CardConfig"/> record based on the provided configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The <see cref="CardConfig"/> to update. May be <c>null</c> to indicate no update payload was provided.</param>
|
||||
/// <returns>A task that resolves to an <see cref="UpdateResponse{T}"/> containing the updated <see cref="CardConfig"/>, or <c>null</c> if no matching record was found.</returns>
|
||||
Task<UpdateResponse<CardConfig?>> UpdateOne(CardConfig? config);
|
||||
/// <summary>
|
||||
/// Deletes a single card configuration identified by the specified identifier, returning the removed configuration when found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the card configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains the deleted <see cref="CardConfig"/>, or <c>null</c> if no configuration with the specified identifier exists.</returns>
|
||||
Task<CardConfig?> DeleteOne(ObjectId configId);
|
||||
}
|
||||
@@ -6,9 +6,33 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IDisplayChartConfigRepository : IMongoRepository<ChartConfig>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all chart configurations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ChartConfig"/> objects.</returns>
|
||||
Task<List<ChartConfig>> GetAll();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="ChartConfig"/> by its unique identifier, returning null if no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The identifier of the chart configuration to look up.</param>
|
||||
/// <returns>A task that yields the matching <see cref="ChartConfig"/>, or null when no configuration exists for the specified id.</returns>
|
||||
Task<ChartConfig?> GetById(ObjectId configId);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new chart configuration into the data store and returns the persisted entity, which may be null if no record is produced.
|
||||
/// </summary>
|
||||
/// <param name="config">The chart configuration to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="ChartConfig"/> or null when the operation yields no result.</returns>
|
||||
Task<ChartConfig?> InsertOneAsyncAndReturn(ChartConfig config);
|
||||
/// <summary>
|
||||
/// Updates a single chart configuration and returns the operation result wrapped in an update response.
|
||||
/// </summary>
|
||||
/// <param name="config">The chart configuration to update. May be null.</param>
|
||||
/// <returns>A task containing the update response with the updated chart configuration, which may be null.</returns>
|
||||
Task<UpdateResponse<ChartConfig?>> UpdateOne(ChartConfig? config);
|
||||
/// <summary>
|
||||
/// Deletes a single chart configuration identified by its unique identifier. Returns the deleted configuration, or <see langword="null"/> if no matching configuration was found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the chart configuration to delete.</param>
|
||||
/// <returns>A task that resolves to the deleted <see cref="ChartConfig"/>, or <see langword="null"/> if no configuration with the specified id exists.</returns>
|
||||
Task<ChartConfig?> DeleteOne(ObjectId configId);
|
||||
}
|
||||
@@ -11,32 +11,171 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IDisplayConfigRepository : IMongoRepository<DisplayConfig>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all display configurations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="DisplayConfig"/> entries.</returns>
|
||||
Task<List<DisplayConfig>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a paginated set of <see cref="DisplayConfig"/> entities projected as <see cref="DisplayConfigSummary"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter applied to the query.</param>
|
||||
/// <returns>An <see cref="IFindFluent{TDocument, TProjection}"/> that produces the paginated <see cref="DisplayConfigSummary"/> results.</returns>
|
||||
IFindFluent<DisplayConfig, DisplayConfigSummary> GetAllPaginated(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of display configurations that match the specified display type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the returned display configurations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="DisplayConfig"/> entries matching the specified type.</returns>
|
||||
Task<List<DisplayConfig>> GetByType(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="DisplayConfig"/> entity by its unique identifier asynchronously.
|
||||
/// Returns <c>null</c> when no matching display configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="DisplayConfig"/> if found, or <c>null</c> if no matching record exists.</returns>
|
||||
Task<DisplayConfig?> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the default <see cref="DisplayConfig"/> for the specified display type.
|
||||
/// Returns <c>null</c> when no default configuration is found for the requested type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to look up the default configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the default <see cref="DisplayConfig"/> for the given type, or <c>null</c> if no default exists.</returns>
|
||||
Task<DisplayConfig?> GetDefault(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="DisplayConfig"/> and returns the persisted entity, typically populated with any server-generated values.
|
||||
/// </summary>
|
||||
/// <param name="config">The <see cref="DisplayConfig"/> to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the inserted <see cref="DisplayConfig"/>, or <see langword="null"/> when no result is returned.</returns>
|
||||
Task<DisplayConfig?> InsertOneAsyncAndReturn(DisplayConfig config);
|
||||
/// <summary>
|
||||
/// Updates the smart display configuration identified by the specified ID with the provided new configuration.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The unique identifier of the smart display configuration to update.</param>
|
||||
/// <param name="newDisplayConfig">The new smart display configuration to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the updated smart display configuration, or null if no configuration with the given ID was found.</returns>
|
||||
Task<SmartDisplay?> UpdateSmartDisplay(ObjectId displayConfigId, SmartDisplay? newDisplayConfig);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing display nurse configuration identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The identifier of the display nurse configuration to update.</param>
|
||||
/// <param name="newDisplayConfig">The new display nurse configuration data, or null if not provided.</param>
|
||||
/// <param name="nurseObs">The list of nurse observations to associate with the configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="DisplayNurse"/> or null if not found.</returns>
|
||||
Task<DisplayNurse?> UpdateDisplayNurse(ObjectId displayConfigId, DisplayNurseDto? newDisplayConfig,
|
||||
List<string> nurseObs);
|
||||
List<string> nurseObs);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the default <see cref="DisplayConfig"/> associated with the specified unit and display type.
|
||||
/// Returns <c>null</c> when no matching default configuration exists.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose default display configuration is being requested.</param>
|
||||
/// <param name="displayType">The display type used to filter the configuration lookup.</param>
|
||||
/// <returns>A task containing the matching <see cref="DisplayConfig"/>, or <c>null</c> if no default configuration is found for the given unit and display type.</returns>
|
||||
Task<DisplayConfig?> GetDefaultByUnitIdAndType(ObjectId unitId, DisplayConfigEnums.DisplayType displayType);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the color configuration for the specified config display entry.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the config display whose color configuration will be updated.</param>
|
||||
/// <param name="colorConfig">The new color configuration to apply to the config display.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the color configuration was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfig);
|
||||
/// <summary>
|
||||
/// Updates the home banner configuration identified by the specified config display ObjectId with the provided list of banner items.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The ObjectId of the config display whose home banner set will be updated.</param>
|
||||
/// <param name="bannerItems">The collection of banner items to apply to the home banner set.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the home banner set was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateSetHomeBanner(ObjectId objectIdConfigDisplay, List<BannerItem> bannerItems);
|
||||
/// <summary>
|
||||
/// Updates the base display configuration identified by the specified object identifier with the provided configuration data.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The object identifier of the configuration display entry to update.</param>
|
||||
/// <param name="baseConfig">The new base display configuration values to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is <c>true</c> if the update succeeded; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateBaseConfig(ObjectId objectIdConfigDisplay, DisplayConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Updates an existing header configuration associated with the specified configuration display identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the configuration display whose header configuration is being updated.</param>
|
||||
/// <param name="headerConfig">The new header configuration values to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the header configuration was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig);
|
||||
/// <summary>
|
||||
/// Updates the hospital name associated with the specified display configuration.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the display configuration to update.</param>
|
||||
/// <param name="name">The new hospital name to apply to the display configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the update succeeded; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name);
|
||||
/// <summary>
|
||||
/// Updates the field list associated with the specified configuration display.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the configuration display whose field list is being updated.</param>
|
||||
/// <param name="fields">The list of fields to apply to the configuration display.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the field list was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateFieldList(ObjectId objectIdConfigDisplay, List<Field> fields);
|
||||
/// <summary>
|
||||
/// Deletes a display configuration identified by the specified object ID.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The object ID of the display configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains the deleted display configuration, or null if no configuration was found with the specified ID.</returns>
|
||||
Task<DisplayConfig?> DeleteDisplayConfig(ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Retrieves all display configurations in a compact, minimal representation.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of <see cref="DisplayConfigMinimalResponse"/> objects representing the display configurations.</returns>
|
||||
Task<List<DisplayConfigMinimalResponse>> GetAllCompact();
|
||||
/// <summary>
|
||||
/// Retrieves all object identifiers associated with the specified card configuration identifier.
|
||||
/// </summary>
|
||||
/// <param name="cardConfigId">The identifier of the card configuration whose related objects should be returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ObjectId"/> values linked to the given card configuration.</returns>
|
||||
Task<List<ObjectId>> GetAllByCardConfigId(ObjectId cardConfigId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of ObjectIds associated with the specified card configuration that are marked as rotating.
|
||||
/// </summary>
|
||||
/// <param name="cardConfigId">The ObjectId of the card configuration used to filter the results.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of ObjectIds that match the given card configuration and rotating criteria.</returns>
|
||||
Task<List<ObjectId>> GetAllByCardConfigIdAndRotating(ObjectId cardConfigId);
|
||||
/// <summary>
|
||||
/// Updates the card configuration identifier for the specified display configuration and result.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The identifier of the display configuration whose card configuration will be updated.</param>
|
||||
/// <param name="resultId">The identifier of the result associated with the card configuration update.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the update succeeded; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateCardConfigId(ObjectId? displayConfigId, ObjectId? resultId);
|
||||
/// <summary>
|
||||
/// Adds a chart identifier to the specified display configuration asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The identifier of the display configuration to which the chart ID will be added, or <c>null</c> when no specific configuration is targeted.</param>
|
||||
/// <param name="newChartIdToAdd">The chart identifier to add.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the chart identifier was successfully added; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> AddChartId(ObjectId? displayConfigId, ObjectId newChartIdToAdd);
|
||||
/// <summary>
|
||||
/// Updates the configuration of a chart that was previously deleted, using the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="deletedId">The identifier of the deleted chart configuration to update.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the result of the update.</returns>
|
||||
Task<UpdateResult> UpdateDeletedChartConfig(ObjectId deletedId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the chart configuration associated with the specified chart object identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigChart">The unique object identifier of the chart configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="ChartConfig"/> associated with the specified identifier.</returns>
|
||||
Task<ChartConfig> GetChartConfig(ObjectId objectIdConfigChart);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the detail configuration identifier, associating it with the specified result identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The nullable identifier of the display configuration to update.</param>
|
||||
/// <param name="resultId">The nullable identifier of the result to associate with the configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean indicating whether the update was successful.</returns>
|
||||
Task<bool> UpdateDetailConfigId(ObjectId? displayConfigId, ObjectId? resultId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of identifiers associated with the specified card detail base configuration.
|
||||
/// </summary>
|
||||
/// <param name="baseConfigId">The identifier of the card detail base configuration to filter by.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ObjectId"/> values matching the provided base configuration identifier.</returns>
|
||||
Task<List<ObjectId>> GetAllByCardDetailConfigId(ObjectId baseConfigId);
|
||||
}
|
||||
@@ -6,9 +6,34 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IDisplayDetailConfigRepository : IMongoRepository<CardDetailsConfig>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all card details configurations from the data source.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="CardDetailsConfig"/> entries.</returns>
|
||||
Task<List<CardDetailsConfig>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="CardDetailsConfig"/> by its unique identifier.
|
||||
/// Returns <see langword="null"/> when no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="configId">The identifier of the card details configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="CardDetailsConfig"/> or <see langword="null"/> if not found.</returns>
|
||||
Task<CardDetailsConfig?> GetById(ObjectId configId);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new card details configuration and returns the inserted entity.
|
||||
/// </summary>
|
||||
/// <param name="config">The card details configuration to insert.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the inserted <see cref="CardDetailsConfig"/>, or <c>null</c> if no entity was returned.</returns>
|
||||
Task<CardDetailsConfig?> InsertOneAsyncAndReturn(CardDetailsConfig config);
|
||||
/// <summary>
|
||||
/// Updates a single card details configuration record asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="config">The card details configuration to update. May be <see langword="null"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the update response with the updated <see cref="CardDetailsConfig"/> or <see langword="null"/> when no configuration is found.</returns>
|
||||
Task<UpdateResponse<CardDetailsConfig?>> UpdateOne(CardDetailsConfig? config);
|
||||
/// <summary>
|
||||
/// Deletes a single <see cref="CardDetailsConfig"/> identified by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the <see cref="CardDetailsConfig"/> to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the deleted <see cref="CardDetailsConfig"/>, or <c>null</c> if no matching configuration was found.</returns>
|
||||
Task<CardDetailsConfig?> DeleteOne(ObjectId configId);
|
||||
}
|
||||
@@ -5,31 +5,134 @@ using MongoDB.Driver;
|
||||
|
||||
namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Repository abstraction for <see cref="Display"/> entities persisted in MongoDB.
|
||||
/// </summary>
|
||||
public interface IDisplayRepository : IMongoRepository<Display>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves every display stored in the collection.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains all displays, or an empty list if none exist.</returns>
|
||||
Task<List<Display>> GetAll();
|
||||
|
||||
|
||||
// ¿FilterByAuthorities / FindByUser
|
||||
// Delete
|
||||
// FindByUnit
|
||||
// UpdateConfig -> algo en específico? ¿Toda la colección?
|
||||
/// <summary>
|
||||
/// Retrieves all displays that include the specified point-of-care in their point-of-care list.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The <see cref="PointOfCare"/> to filter by.</param>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.</returns>
|
||||
Task<List<Display>> GetByPointOfCare(PointOfCare pointOfCare);
|
||||
|
||||
// Task<List<Display>> GetByUser();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the display whose <c>Name</c> exactly matches the supplied value.
|
||||
/// </summary>
|
||||
/// <param name="name">The display name to look up.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the <see cref="Display"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Display?> GetByName(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a display by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the display to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the <see cref="Display"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Display?> GetById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a display by its identifier, eagerly loading its associated <see cref="DisplayConfig"/> document.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the display to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the <see cref="Display"/> with its config populated if found; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Display?> GetByIdWithConfigDisplay(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all displays that belong to the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the unit.</param>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.</returns>
|
||||
Task<List<Display>> GetByUnitId(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all displays whose <c>DisplayConfigId</c> matches the supplied value.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the display configuration to filter by.</param>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.</returns>
|
||||
Task<List<Display>> GetByConfigId(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the point-of-care list of the specified display with the supplied set of point-of-care identifiers.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The <see cref="ObjectId"/> of the display to update.</param>
|
||||
/// <param name="listPocObId">The new list of <see cref="ObjectId"/> values representing the point-of-cares to associate with the display.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/> if the update succeeded; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Display?> UpdatePointOfCareList(ObjectId objectId, List<ObjectId> listPocObId);
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the <see cref="DisplayConfig"/> of the display identified by <paramref name="oldDisplayId"/> with the supplied configuration instance.
|
||||
/// </summary>
|
||||
/// <param name="oldDisplayId">The <see cref="ObjectId"/> of the display whose configuration should be replaced.</param>
|
||||
/// <param name="newDisplayConfigCast">The new <see cref="DisplayConfig"/> instance to assign to the display.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/> if the update succeeded; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Display?> UpdateConfig(ObjectId oldDisplayId, DisplayConfig newDisplayConfigCast);
|
||||
|
||||
/// <summary>
|
||||
/// Associates the display with an existing display-config preset by setting its <c>DisplayConfigId</c> to the supplied identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdDisplay">The <see cref="ObjectId"/> of the display to update.</param>
|
||||
/// <param name="objectIdConfigDisplay">The <see cref="ObjectId"/> of the display-config preset to associate.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/> if the update succeeded; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Display?> UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the <c>Name</c> of the supplied display instance and persists it.
|
||||
/// </summary>
|
||||
/// <param name="display">The <see cref="Display"/> instance to update. Its <see cref="ObjectId"/> is used to identify the document.</param>
|
||||
/// <param name="name">The new display name.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/>.</returns>
|
||||
Task<Display> UpdateName(Display display, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Builds a paginated, sorted, and filtered query over displays according to the supplied <see cref="PaginationFilter"/>.
|
||||
/// </summary>
|
||||
/// <param name="filter">The <see cref="PaginationFilter"/> containing pagination and filter criteria.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Display, Display}"/> instance that can be used to further refine and execute the query.</returns>
|
||||
IFindFluent<Display, Display> GetPaginatedDisplays(PaginationFilter filter);
|
||||
|
||||
/// <summary>
|
||||
/// Counts the number of displays that currently reference the supplied display configuration.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The <see cref="ObjectId"/> of the display configuration to check for usage.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> representing the asynchronous operation. The task result contains the number of displays referencing the configuration.</returns>
|
||||
Task<long> IsDisplayConfigInUse(ObjectId displayConfigId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the <c>DisplayConfigId</c> of the specified display.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The <see cref="ObjectId"/> of the display to update.</param>
|
||||
/// <param name="displayConfigId">The new <see cref="ObjectId"/> of the display configuration to associate with the display.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> representing the asynchronous operation. The task result contains the updated <see cref="Display"/> if the update succeeded; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Display?> UpdateConfigId(ObjectId objectId, ObjectId displayConfigId);
|
||||
|
||||
/// <summary>
|
||||
/// Counts the number of displays that belong to the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The <see cref="ObjectId"/> of the unit.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> representing the asynchronous operation. The task result contains the number of displays for the unit.</returns>
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes every display that belongs to the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The <see cref="ObjectId"/> of the unit whose displays should be removed.</param>
|
||||
/// <returns>A <see cref="Task{Boolean}"/> representing the asynchronous operation. The task result is <see langword="true"/> when at least one display was deleted; otherwise, <see langword="false"/>.</returns>
|
||||
Task<bool> DeleteManyByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all displays that reference the supplied card-configuration identifier.
|
||||
/// </summary>
|
||||
/// <param name="configId">The <see cref="ObjectId"/> of the card configuration to filter by.</param>
|
||||
/// <returns>A <see cref="Task{List{Display}}"/> representing the asynchronous operation. The task result contains the matching displays, or an empty list if none exist.</returns>
|
||||
Task<List<Display>> GetByCardConfigId(ObjectId configId);
|
||||
}
|
||||
+45
-2
@@ -6,20 +6,63 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IHistoricalConfigChangesRepository : IMongoRepository<HistoricalConfigChanges>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a historical configuration changes record by its unique identifier.
|
||||
/// Returns null if no matching record is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the historical configuration changes record to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="HistoricalConfigChanges"/> record, or null if no record with the specified identifier exists.</returns>
|
||||
Task<HistoricalConfigChanges?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing historical config change record asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="historicalConfigChange">The historical config change entity containing the values to persist.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The result is the updated historical config change, or <c>null</c> if the record was not found.</returns>
|
||||
Task<HistoricalConfigChanges?> Update(HistoricalConfigChanges historicalConfigChange);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the historical configuration change record identified by the specified identifier, returning the removed entry when found.
|
||||
/// If no record matches the given identifier, the task resolves to <c>null</c>.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the historical configuration change to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation, containing the deleted <see cref="HistoricalConfigChanges"/> record, or <c>null</c> if no matching record exists.</returns>
|
||||
Task<HistoricalConfigChanges?> Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of all object identifiers.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of ObjectId values.</returns>
|
||||
Task<List<ObjectId>> FindAllIds();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all historical configuration changes.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="HistoricalConfigChanges"/> records.</returns>
|
||||
Task<ICollection<HistoricalConfigChanges>> FindAll();
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="HistoricalConfigChanges"/> record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patientObservation">The historical config change entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="HistoricalConfigChanges"/> entity, or <c>null</c> if the insertion did not produce a result.</returns>
|
||||
new Task<HistoricalConfigChanges?> InsertOneAsync(HistoricalConfigChanges patientObservation);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent historical configuration changes filtered by the specified configuration type, limited to a given number of entries.
|
||||
/// </summary>
|
||||
/// <param name="cfgType">The configuration type used to filter the historical changes.</param>
|
||||
/// <param name="num">The maximum number of recent changes to return. Defaults to 10.</param>
|
||||
/// <returns>A task that returns a collection of historical configuration changes matching the specified type, ordered from most recent.</returns>
|
||||
Task<ICollection<HistoricalConfigChanges>> FindLastHistoricalConfigChangesByType(
|
||||
DisplayConfigEnums.ConfigTypes cfgType, int num = 10);
|
||||
DisplayConfigEnums.ConfigTypes cfgType, int num = 10);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent historical configuration changes for the specified user, optionally filtered by configuration type.
|
||||
/// </summary>
|
||||
/// <param name="user">The identifier of the user whose historical configuration changes are being retrieved.</param>
|
||||
/// <param name="cfgType">Optional. The configuration type to filter the results by. If null, changes across all configuration types are returned.</param>
|
||||
/// <param name="num">The maximum number of historical changes to return. Defaults to 10.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of historical configuration changes for the user.</returns>
|
||||
Task<ICollection<HistoricalConfigChanges>> FindLastHistoricalConfigChangesByUser(string user,
|
||||
DisplayConfigEnums.ConfigTypes? cfgType = null, int num = 10);
|
||||
DisplayConfigEnums.ConfigTypes? cfgType = null, int num = 10);
|
||||
}
|
||||
@@ -7,10 +7,40 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface ILightBeaconRepository : IMongoRepository<LightBeacon>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the list of <see cref="LightBeacon"/> objects associated with the specified configuration relay identifiers.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The collection of configuration relay <see cref="ObjectId"/> values used to look up the corresponding light beacons.</param>
|
||||
/// <returns>A <see cref="List{LightBeacon}"/> containing the light beacons matching the provided configuration relay identifiers; returns an empty list if no matches are found.</returns>
|
||||
List<LightBeacon> GetLightBeaconInList(List<ObjectId> configurationRelayList);
|
||||
/// <summary>
|
||||
/// Retrieves a light beacon by its associated relay identifier.
|
||||
/// </summary>
|
||||
/// <param name="relayId">The unique identifier of the relay used to look up the corresponding light beacon.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="LightBeacon"/>, or <c>null</c> if no beacon is found for the specified relay.</returns>
|
||||
Task<LightBeacon?> GetById(ObjectId relayId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="LightBeacon"/> by its name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the light beacon to look up.</param>
|
||||
/// <returns>A task that returns the matching <see cref="LightBeacon"/>, or <c>null</c> if no beacon with the specified name is found.</returns>
|
||||
Task<LightBeacon?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new LightBeacon and returns the persisted entity, or null if the insertion did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="beacon">The LightBeacon entity to insert.</param>
|
||||
/// <returns>A task containing the inserted LightBeacon, or null when no entity was returned by the underlying operation.</returns>
|
||||
Task<LightBeacon?> InsertOneAsyncAndReturn(LightBeacon beacon);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, queryable collection of light beacons (relays) based on the supplied pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that controls paging parameters applied to the relay list.</param>
|
||||
/// <returns>An <see cref="IFindFluent{LightBeacon, LightBeacon}"/> exposing the paginated relay result set for further querying or enumeration.</returns>
|
||||
IFindFluent<LightBeacon, LightBeacon> GetPaginatedRelays(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of <see cref="LightBeacon"/> objects whose name matches the specified search text.
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The text used to search for matching <see cref="LightBeacon"/> entries by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="LightBeacon"/> objects that match the search criteria.</returns>
|
||||
Task<List<LightBeacon>> GetSearchByName(string textToSearch);
|
||||
}
|
||||
@@ -8,27 +8,158 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IMasterListRepository<T> : IMongoRepository<T> where T : MasterList
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the entity to delete.</param>
|
||||
Task Delete(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the specified collection of items.
|
||||
/// </summary>
|
||||
/// <param name="list">The collection of items to update.</param>
|
||||
Task Update(T list);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an entity identified by the specified <paramref name="id"/>, optionally resolving localized content using the given <paramref name="locale"/>. Returns <c>null</c> when no matching entity is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to look up.</param>
|
||||
/// <param name="locale">The optional locale used to resolve localized fields of the retrieved entity.</param>
|
||||
/// <returns>A task that yields the matching entity, or <c>null</c> if the entity is not found.</returns>
|
||||
Task<T?> FindById(ObjectId id, LocaleEnum? locale);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an entity of type <typeparamref name="T"/> by its unique identifier.
|
||||
/// Returns <c>null</c> when no matching entity is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to locate.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the entity of type <typeparamref name="T"/> if found, or <c>null</c> otherwise.</returns>
|
||||
Task<T?> FindById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an <see cref="OptionList"/> item identified by the specified master and option identifiers for the given locale.
|
||||
/// Returns <c>null</c> when no matching option item is found for the provided identifiers and locale.
|
||||
/// </summary>
|
||||
/// <param name="masterId">The master identifier used to scope the lookup of the option item.</param>
|
||||
/// <param name="optionId">The identifier of the specific option item to retrieve within the master scope.</param>
|
||||
/// <param name="locale">The locale used to select the localized version of the option item.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="OptionList"/>, or <c>null</c> if no item is found.</returns>
|
||||
Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId, LocaleEnum locale);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an <see cref="OptionList"/> identified by the given master and option identifiers.
|
||||
/// </summary>
|
||||
/// <param name="masterId">The identifier of the master record that owns the option list.</param>
|
||||
/// <param name="optionId">The identifier of the specific option item to locate within the master.</param>
|
||||
/// <returns>A <see cref="Task{OptionList}"/> that yields the matching <see cref="OptionList"/>, or <c>null</c> when no item is found.</returns>
|
||||
Task<OptionList?> FindOptionItemById(ObjectId masterId, ObjectId optionId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all items of type T.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of all items of type T.</returns>
|
||||
Task<IEnumerable<T>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves all master list entries without applying optional filters or including related option data.
|
||||
/// Used to fetch the complete set of master list records for scenarios such as full enumeration or bulk operations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IEnumerable{MasterListDto}"/> with all available master list entries.</returns>
|
||||
Task<IEnumerable<MasterListDto>> GetAllWithoutOptions();
|
||||
/// <summary>
|
||||
/// Asynchronously finds and returns an entity of type <typeparamref name="T"/> matching the specified <paramref name="name"/>.
|
||||
/// Returns <c>null</c> when no matching entity is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the entity.</param>
|
||||
/// <returns>A task that represents the asynchronous lookup, containing the matched entity of type <typeparamref name="T"/> or <c>null</c> if no match exists.</returns>
|
||||
Task<T?> FindByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves a master list of option list entries filtered by the specified identifier and an optional text search that performs a contains match.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier used to scope the option list entries to be returned.</param>
|
||||
/// <param name="textSearch">An optional text used to filter entries whose content contains the specified value; may be null to skip text-based filtering.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="OptionList"/> entries that match the identifier and the optional text search criteria.</returns>
|
||||
Task<List<OptionList>> GetMasterListByIdAndTextSearchContaining(ObjectId id, string? textSearch);
|
||||
/// <summary>
|
||||
/// Asynchronously adds a <see cref="FilterOptionListElement"/> to the master option list identified by the given <see cref="ObjectId"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master option list to which the element will be added.</param>
|
||||
/// <param name="opt">The filter option list element to add to the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the resulting <see cref="OptionList"/>, or <c>null</c> if no list is returned.</returns>
|
||||
Task<OptionList?> AddOptionToMasterList(ObjectId id, FilterOptionListElement opt);
|
||||
/// <summary>
|
||||
/// Updates an existing master list option identified by the specified identifier using the provided option data and locale, returning the updated option list.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list option to update.</param>
|
||||
/// <param name="newOpt">The new option list data to apply to the master list option.</param>
|
||||
/// <param name="locale">The locale used for the update operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="OptionList"/> if found, or <c>null</c> if no matching master list option exists.</returns>
|
||||
Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList newOpt, LocaleEnum locale);
|
||||
/// <summary>
|
||||
/// Updates an existing master list option identified by the given id with the provided data, returning the updated option or null if no matching option is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list option to update.</param>
|
||||
/// <param name="newOpt">The new option data to replace the existing master list option.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the updated <see cref="OptionList"/>, or null if no option with the specified id exists.</returns>
|
||||
Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList newOpt);
|
||||
/// <summary>
|
||||
/// Updates an existing master list option identified by the specified id with the provided new option data.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list option to update.</param>
|
||||
/// <param name="newOpt">The new option data to apply to the existing master list option.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="OptionList"/>, or <c>null</c> if no matching option was found.</returns>
|
||||
Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList newOpt);
|
||||
/// <summary>
|
||||
/// Deletes a master list option identified by the specified option ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master list containing the option to delete.</param>
|
||||
/// <param name="deleteOptId">The identifier of the option to be deleted from the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean indicating whether the option was successfully deleted.</returns>
|
||||
Task<bool> DeleteMasterListOption(ObjectId id, ObjectId deleteOptId);
|
||||
/// <summary>
|
||||
/// Updates the option details of an existing entry in the master list identified by the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list entry to update.</param>
|
||||
/// <param name="opt">The update payload containing the new option details to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated master list details, or null if no matching entry is found.</returns>
|
||||
Task<UpdateMasterListDetailsDto?> UpdateOptionDetailsToMasterList(ObjectId id, UpdateMasterListDetailsDto opt);
|
||||
/// <summary>
|
||||
/// Updates the name of an existing master list identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list to update.</param>
|
||||
/// <param name="name">The new name to assign to the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the master list was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateMasterListName(ObjectId id, string name);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the description of a master list identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list to update.</param>
|
||||
/// <param name="description">The new description to set for the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <see langword="true"/> if the update was successful; otherwise, <see langword="false"/>.</returns>
|
||||
Task<bool> UpdateMasterListDescription(ObjectId id, string description);
|
||||
/// <summary>
|
||||
/// Asynchronously removes the specified option from the master list associated with the given identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master list from which the option will be removed.</param>
|
||||
/// <param name="oldOpt">The option to be removed from the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous removal operation. The task result contains true if the option was successfully removed; otherwise, false.</returns>
|
||||
Task<bool> RemoveMasterListOption(ObjectId id, OptionList oldOpt);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated master list using the specified pagination filter, returning a fluent queryable result.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the paging criteria applied to the master list query.</param>
|
||||
/// <returns>An <see cref="IFindFluent{TDocument, TProjection}"/> that represents the paginated queryable master list.</returns>
|
||||
IFindFluent<T, T> GetPaginatedMasterList(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of options associated with the specified list identifier, applying the provided pagination filter to control the result set.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter defining page size, page number, and related pagination constraints.</param>
|
||||
/// <param name="listId">The unique identifier of the list whose options should be retrieved.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="OptionList"/> items for the requested page.</returns>
|
||||
Task<List<OptionList>> GetPaginatedOptions(PaginationFilter filter, ObjectId listId);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of items and returns the total.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the total count of items.</returns>
|
||||
Task<int> Count();
|
||||
/// <summary>
|
||||
/// Retrieves a master list of <see cref="OptionList"/> entries identified by the given id, optionally applying the provided search and filtering options.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master list to retrieve.</param>
|
||||
/// <param name="filterOption">Optional filter criteria used to narrow the returned options. May be <c>null</c> to return the full list without additional filtering.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="OptionList"/> items that match the specified id and filter, or an empty list if no matching entries are found.</returns>
|
||||
Task<List<OptionList>> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement? filterOption);
|
||||
}
|
||||
@@ -7,16 +7,65 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IMedicineRepository : IMongoRepository<Medicine>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a medicine by its code asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="code">The code used to look up the medicine.</param>
|
||||
/// <returns>A task that returns the matching <see cref="Medicine"/> if found, or <c>null</c> if no medicine matches the specified code.</returns>
|
||||
Task<Medicine?> GetMedicine(string code);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a list of medicines that match the specified codes or notes.
|
||||
/// </summary>
|
||||
/// <param name="codeNotes">The list of codes or notes used to look up the medicines.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of matching medicines.</returns>
|
||||
Task<List<Medicine>> GetMedicineByCodeOrNote(List<string> codeNotes);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Medicine"/> entity by its name asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the medicine to look up.</param>
|
||||
/// <returns>A <see cref="Task{Medicine}"/> that resolves to the matching <see cref="Medicine"/>, or <c>null</c> if no medicine with the specified name is found.</returns>
|
||||
Task<Medicine?> GetMedicineByName(string name);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all medicines from the data source.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Medicine"/> objects; an empty list is returned when no medicines are found.</returns>
|
||||
Task<List<Medicine>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a medicine entity by its unique identifier from the data store.
|
||||
/// Returns <see langword="null"/> if no medicine matches the provided identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique <see cref="ObjectId"/> of the medicine to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the matching <see cref="Medicine"/> if found, or <see langword="null"/> when no record exists for the given identifier.</returns>
|
||||
Task<Medicine?> GetMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Asynchronously creates and posts a new medicine entry, returning the persisted <see cref="Medicine"/> on success or <c>null</c> when no result is produced.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity to be created and submitted.</param>
|
||||
/// <returns>A task that resolves to the newly created <see cref="Medicine"/>, or <c>null</c> if the operation does not yield a result.</returns>
|
||||
Task<Medicine?> PostMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Updates an existing medicine record with the provided information.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity containing the updated data, typically identified by its primary key.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Medicine"/>, or <c>null</c> if no matching medicine was found.</returns>
|
||||
Task<Medicine?> UpdateMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a medicine record from the data store using the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to delete.</param>
|
||||
Task DeleteMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Builds a MongoDB aggregation pipeline that retrieves the distinct values for the specified field.
|
||||
/// </summary>
|
||||
/// <param name="field">The name of the field whose distinct values should be queried.</param>
|
||||
/// <returns>An <see cref="IAggregateFluent{BsonDocument}"/> representing the distinct field data query.</returns>
|
||||
IAggregateFluent<BsonDocument> GetDistinctFieldDataQuery(string field);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of medicines based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the page number and page size used to control the result set.</param>
|
||||
/// <returns>A fluent query interface for the paginated medicines.</returns>
|
||||
IFindFluent<Medicine, Medicine> GetPaginatedMedicines(PaginationFilter filter);
|
||||
}
|
||||
@@ -7,8 +7,27 @@ public interface IMongoRepository<T>
|
||||
{
|
||||
IMongoCollection<T> Collection { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the collection.
|
||||
/// </summary>
|
||||
/// <returns>The name of the collection.</returns>
|
||||
string GetCollectionName();
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single object of type <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
Task InsertOneAsync(T obj);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier and returns the deleted entity.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the deleted entity of type <typeparamref name="T"/>, or <c>null</c> if no matching entity was found.</returns>
|
||||
Task<T?> DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing document identified by the specified identifier with the provided object data.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the document to update.</param>
|
||||
/// <param name="obj">The object containing the updated values to persist.</param>
|
||||
Task UpdateOneAsync(ObjectId id, T obj);
|
||||
}
|
||||
@@ -5,11 +5,43 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface INoticeRepository : IMongoRepository<Notice>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes the entity identified by the specified <see cref="ObjectId"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the entity to delete.</param>
|
||||
Task Delete(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing notice with the provided information.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice entity containing the updated data to be persisted.</param>
|
||||
Task Update(Notice notice);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all notices.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of all <see cref="Notice"/> objects.</returns>
|
||||
Task<IEnumerable<Notice>> FindAll();
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Notice"/> by its unique identifier. Returns <c>null</c> when no matching notice is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the notice to look up.</param>
|
||||
/// <returns>A task that yields the matching <see cref="Notice"/>, or <c>null</c> if no notice exists for the specified <paramref name="id"/>.</returns>
|
||||
Task<Notice?> FindById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of notices that match the specified date.
|
||||
/// </summary>
|
||||
/// <param name="date">The date used to filter the notices to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="Notice"/> objects for the specified date, or <c>null</c> if no matching notices are found.</returns>
|
||||
Task<IEnumerable<Notice>?> FindByDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="Notice"/> entries that match the specified type.
|
||||
/// </summary>
|
||||
/// <param name="type">The notice type used to filter the lookup.</param>
|
||||
/// <returns>A task containing the matching <see cref="Notice"/> items, or <c>null</c> when no results are available.</returns>
|
||||
Task<IEnumerable<Notice>?> FindByType(string type);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="Notice"/> entities associated with the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayId">The display identifier used to locate the matching notices.</param>
|
||||
/// <returns>A task that yields the collection of matching <see cref="Notice"/> items, or <c>null</c> if no notices are found.</returns>
|
||||
Task<IEnumerable<Notice>?> FindByDisplayId(ObjectId displayId);
|
||||
}
|
||||
@@ -5,12 +5,38 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IObservationArchiveRepository : IMongoRepository<PatientObservation>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single <see cref="PatientObservation"/> into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patientObservation">The patient observation to insert.</param>
|
||||
new Task InsertOneAsync(PatientObservation patientObservation);
|
||||
/// <summary>
|
||||
/// Deletes the records that have a date earlier than the specified cutoff date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; records dated before this value will be removed.</param>
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a batch of patient observation records into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="observations">The collection of <see cref="PatientObservation"/> entities to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous insert operation, returning a <see cref="long"/> value (such as the number of affected rows or a generated identifier) produced by the batch insertion.</returns>
|
||||
Task<long> InsertBatch(IEnumerable<PatientObservation> observations);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent aggregated patient observations for the specified patient, limited by a count and an upper date bound, and optionally filtered by observation names.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return.</param>
|
||||
/// <param name="lastDate">The cutoff date; only observations on or before this date are considered.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names to restrict the results to; pass an empty or null list to include all observations.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="PatientObservation"/> entries representing the aggregated last observations matching the criteria.</returns>
|
||||
Task<List<PatientObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num, DateTime lastDate,
|
||||
List<string> filterObservations);
|
||||
List<string> filterObservations);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all patient observations associated with the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservation"/> records for the patient.</returns>
|
||||
Task<List<PatientObservation>> FindAllFromPatient(ObjectId patientId);
|
||||
}
|
||||
@@ -9,66 +9,257 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IObservationRepository : IMongoRepository<PatientObservation>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously aggregates a patient's observations grouped by the specified field.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose observations will be aggregated.</param>
|
||||
/// <param name="groupedField">The field used to group the patient's observations during aggregation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of BSON documents with the aggregated results.</returns>
|
||||
Task<List<BsonDocument>> AggregatedPatientGroupedObservations(ObjectId patientId, GroupedField groupedField);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent aggregated observations for a specified patient,
|
||||
/// returning up to the requested number of entries. Optionally filters the results to include
|
||||
/// only observations whose identifiers match the provided list.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="num">The maximum number of most recent observations to return.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to restrict the returned results; if null, no filter is applied.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of the patient's most recent <see cref="PatientObservation"/> records.</returns>
|
||||
Task<List<PatientObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num,
|
||||
List<string>? filterObservations = null);
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent aggregated patient observations for the specified patient up to the given last date, optionally filtered by a set of observation names.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <param name="num">The maximum number of observations to return.</param>
|
||||
/// <param name="lastDate">The cutoff date; only observations on or before this date are considered.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names to restrict the results to. If null, no observation-name filter is applied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of aggregated <see cref="PatientObservation"/> entries that match the criteria.</returns>
|
||||
Task<List<PatientObservation>> AggregatedPatientLastObservationsByLastDate(ObjectId patientId, int num,
|
||||
DateTime lastDate, List<string>? filterObservations = null);
|
||||
DateTime lastDate, List<string>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent patient observations, aggregated by field, for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <param name="filterObservations">An optional list of fields to filter the observations by; if null, observations for all fields are returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of the latest patient observations grouped by field.</returns>
|
||||
Task<List<PatientObservation>> AggregatedPatientLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null);
|
||||
List<Field>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent patient observations that match the specified coding system and code, returning up to the requested number of results.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="codingSystem">The coding system used to classify the observations (for example, LOINC, SNOMED).</param>
|
||||
/// <param name="code">The specific code within the coding system identifying the type of observation to retrieve.</param>
|
||||
/// <param name="num">The maximum number of most recent observations to return. Defaults to 2.</param>
|
||||
/// <returns>A task that yields a collection of the matching <see cref="PatientObservation"/> records, ordered from most recent to oldest, containing at most <paramref name="num"/> entries.</returns>
|
||||
Task<IEnumerable<PatientObservation>> FindLastObservations(ObjectId patientId, string codingSystem, string code,
|
||||
int num = 2);
|
||||
int num = 2);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent patient observations filtered by the specified coding system.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="codingSystem">The coding system used to filter the observations.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 10.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the patient's most recent observations matching the coding system.</returns>
|
||||
Task<List<PatientObservation>> FindLastObservationsByCodingSystem(ObjectId patientId, string codingSystem,
|
||||
int num = 10);
|
||||
int num = 10);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent <see cref="PatientObservation"/> for the specified patient recorded before the given date, optionally filtered by observation name.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observation is being queried.</param>
|
||||
/// <param name="name">The optional name of the observation to filter by. If <c>null</c>, observations of any name are considered.</param>
|
||||
/// <param name="date">The cutoff date; only observations recorded strictly before this date are eligible.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="PatientObservation"/> if found, or <c>null</c> if no observation exists before the specified date.</returns>
|
||||
Task<PatientObservation?> FindLastObservationBeforeDate(ObjectId patientId, string? name, DateTime date);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the state of patient observations that have expired, applying the appropriate expiration handling to each item in the provided list.
|
||||
/// </summary>
|
||||
/// <param name="expiredObservations">The list of patient observations that have expired and require their state to be updated.</param>
|
||||
Task UpdateExpiredObservations(List<PatientObservation> expiredObservations);
|
||||
|
||||
/// <summary>
|
||||
/// Finds any existing patient observations for the specified patient that share the same date, optionally filtered by observation name.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose observations are being searched.</param>
|
||||
/// <param name="name">The optional name of the observation to match; if null, observations of any name are considered.</param>
|
||||
/// <param name="date">The date used to match observations recorded on the same day.</param>
|
||||
/// <returns>A task that returns a list of matching <see cref="PatientObservation"/> instances, or <c>null</c> if no matching observations are found.</returns>
|
||||
Task<List<PatientObservation>?> FindAnyWithSameDate(ObjectId patientId, string? name, DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient observations recorded for the specified patient before the given date.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="date">The cutoff date; only observations recorded prior to this date are returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patient observations found before the specified date.</returns>
|
||||
Task<List<PatientObservation>> FindAnyBeforeDate(ObjectId patientId, DateTime date);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent unique patient observations matching the specified name for the given patient, returning a list of <see cref="PatientObservation"/> entries.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="name">The name used to match the relevant patient observations.</param>
|
||||
/// <param name="expires">An optional expiration value in seconds used to control the time window for the lookup; if <c>null</c>, no expiration is applied.</param>
|
||||
/// <returns>A task that resolves to a list of the latest unique <see cref="PatientObservation"/> records matching the specified name for the patient. The list is empty if no matching observations are found.</returns>
|
||||
Task<List<PatientObservation>> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single <see cref="PatientObservation"/> record into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientObservation">The patient observation entity to persist.</param>
|
||||
new Task InsertOneAsync(PatientObservation patientObservation);
|
||||
/// <summary>
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the patient whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of patient observations associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IAsyncCursor{TDocument}"/> of <see cref="PatientObservation"/> instances to iterate through the matching records.</returns>
|
||||
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAsync(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="PatientObservation"/> records associated with the specified patient
|
||||
/// that belong to a given coding system, optionally filtered by name.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="codingSystem">The coding system used to classify the observations (e.g., LOINC, SNOMED).</param>
|
||||
/// <param name="name">The name of the observation to filter within the coding system.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields an <see cref="IAsyncCursor{TDocument}"/> streaming the matching <see cref="PatientObservation"/> documents.</returns>
|
||||
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem,
|
||||
string name);
|
||||
string name);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
new Task DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes patient observations older than the specified retention period and returns the records that were removed.
|
||||
/// </summary>
|
||||
/// <param name="name">The identifier used to locate the relevant patient observations to be evaluated for deletion.</param>
|
||||
/// <param name="retentionPolicyValue">The retention period in days; observations older than this value will be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the deleted <see cref="PatientObservation"/> records.</returns>
|
||||
Task<List<PatientObservation>> DeleteOlderDaysAsync(string name, int retentionPolicyValue);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes patient observations based on the specified name and retention policy value.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to identify or filter the patient observations to be deleted.</param>
|
||||
/// <param name="retentionPolicyValue">The retention policy threshold value that determines which older observations should be removed.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the list of patient observations that were deleted.</returns>
|
||||
Task<List<PatientObservation>> DeleteOlderNumberAsync(string name, int retentionPolicyValue);
|
||||
/// <summary>
|
||||
/// Asynchronously checks whether a record exists for the specified patient identified by the given system identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientid">The unique identifier of the patient whose record is being checked.</param>
|
||||
/// <param name="systemId">The system identifier used to look up the patient's record.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if a matching record exists; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> ExistBySystemId(ObjectId patientid, string systemId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes patient observations older than the specified number of seconds and returns the affected records.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to identify the patient observations to filter for deletion.</param>
|
||||
/// <param name="value">The age threshold in seconds; observations older than this value will be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of deleted patient observations.</returns>
|
||||
Task<List<PatientObservation>> DeleteOlderSecondsAsync(string name, int value);
|
||||
/// <summary>
|
||||
/// Retrieves the aggregated active intravenous lines observations for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active intravenous lines observations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservation"/> entries representing the patient's active intravenous lines observations, where each entry may be null.</returns>
|
||||
Task<List<PatientObservation?>> AggregatedPatientActiveIntravenousLinesObservations(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent observation timestamp for every patient, returning a mapping of patient identifiers to their last observation times.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a dictionary where each key is a patient <see cref="ObjectId"/> and the associated value is the date and time of that patient's last observation.</returns>
|
||||
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient observation by its unique identifier, returning <c>null</c> when no matching record is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient observation to locate.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> that resolves to the matching <see cref="PatientObservation"/>, or <c>null</c> if no observation exists for the given identifier.</returns>
|
||||
Task<PatientObservation?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patient observations associated with the specified patient identifier. Returns null when no observations are found for the patient.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <returns>A task containing a list of <see cref="PatientObservation"/> objects for the specified patient, or null if no observations are found.</returns>
|
||||
Task<List<PatientObservation>?> FindByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Updates an existing patient observation with the provided data.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation containing the updated information to be persisted.</param>
|
||||
Task Update(PatientObservation observation);
|
||||
/// <summary>
|
||||
/// Updates many records by replacing the specified old ObjectId with the new ObjectId identified by the given name.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The name identifier used to locate the target collection or field to update.</param>
|
||||
/// <param name="id">The new ObjectId to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId that identifies the records to be updated.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves patient observations that have not expired, optionally filtered by the specified observation identifiers.
|
||||
/// </summary>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to narrow the result set. May be null or contain null entries.</param>
|
||||
/// <returns>A task that resolves to a collection of non-expired <see cref="PatientObservation"/> instances matching the filter criteria.</returns>
|
||||
Task<IEnumerable<PatientObservation>> FindNotExpired(List<string?>? filterObservations);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves patient observations matching the specified name, optionally filtered by the provided date.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the patient observations.</param>
|
||||
/// <param name="date">The optional date used to filter the observations; when null, results are not restricted by date.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="PatientObservation"/> entries that match the criteria.</returns>
|
||||
Task<IEnumerable<PatientObservation>> FindByName(string name, DateTime? date);
|
||||
|
||||
/// <summary>
|
||||
/// Updates multiple <see cref="PatientObservation"/> documents that match the provided update definition.
|
||||
/// </summary>
|
||||
/// <param name="patientObservations">The collection of patient observations to update.</param>
|
||||
/// <param name="update">The update definition describing the modifications to apply to each patient observation.</param>
|
||||
Task UpdateMany(IEnumerable<PatientObservation> patientObservations, UpdateDefinition<PatientObservation> update);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all patient observation records.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of <see cref="PatientObservation"/> entries.</returns>
|
||||
Task<IEnumerable<PatientObservation>> FindAll();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously processes and expires the specified configuration observations that have met their expiration criteria.
|
||||
/// </summary>
|
||||
/// <param name="configObservationsToExpire">The list of configuration observations to expire.</param>
|
||||
Task ExpireExpiredObservations(List<ConfigObservation> configObservationsToExpire);
|
||||
//Task<PaginationResponse<PatientObservation>> GetPaginatedObservations(PaginationFilter filter);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent-queryable collection of patient observations based on the provided pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and sorting criteria applied to the observations.</param>
|
||||
/// <returns>An <see cref="IFindFluent{TSource, TDocument}"/> for <see cref="PatientObservation"/> that allows further refinement and execution of the paginated query.</returns>
|
||||
IFindFluent<PatientObservation, PatientObservation> GetPaginatedObservations(PaginationFilter filter);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent non-expired patient observations matching the specified name, supporting optional pagination.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="name">The name of the observation to filter by.</param>
|
||||
/// <param name="endAfter">Optional pagination cursor indicating the number of results to skip.</param>
|
||||
/// <param name="num">Optional maximum number of observations to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of matching <see cref="PatientObservation"/> objects.</returns>
|
||||
Task<IEnumerable<PatientObservation>> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name,
|
||||
int? endAfter = null, int? num = null);
|
||||
int? endAfter = null, int? num = null);
|
||||
}
|
||||
@@ -5,8 +5,23 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPatientArchiveRepository : IMongoRepository<Patient>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Patient"/> matching the specified patient number, returning <see langword="null"/> if no matching patient is found.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
|
||||
/// <returns>A <see cref="Patient"/> instance if a match is found; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Patient?> FindByPatientNumber(string patientNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all patients from the data source.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Patient"/> entities.</returns>
|
||||
Task<List<Patient>> FindAll();
|
||||
/// <summary>
|
||||
/// Searches for a patient by patient number within a specific distinct unit.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The patient number used to locate the patient.</param>
|
||||
/// <param name="unitId">The identifier of the distinct unit in which to perform the search.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
}
|
||||
@@ -5,8 +5,28 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPatientCarePlanRepository : IMongoRepository<PatientCarePlan>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the list of care plans associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose care plans are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> records for the patient, or an empty list if no care plans are found.</returns>
|
||||
Task<List<PatientCarePlan>> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of patient care plans associated with the specified user identifier.
|
||||
/// </summary>
|
||||
/// <param name="userId">The unique identifier of the user whose patient care plans are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects linked to the specified user.</returns>
|
||||
Task<List<PatientCarePlan>> FindByUserId(ObjectId userId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient care plans from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of all <see cref="PatientCarePlan"/> records.</returns>
|
||||
Task<List<PatientCarePlan>> FindAll();
|
||||
/// <summary>
|
||||
/// Updates all records that reference the specified old ObjectId so they are associated with the new patient ObjectId.
|
||||
/// </summary>
|
||||
/// <param name="patientid">The string identifier of the patient whose related records will be updated.</param>
|
||||
/// <param name="patientId">The new ObjectId that will replace the previous identifier in the matching records.</param>
|
||||
/// <param name="oldId">The previous ObjectId whose references should be replaced across the matching records.</param>
|
||||
Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId);
|
||||
}
|
||||
@@ -10,36 +10,202 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPatientRepository : IMongoRepository<Patient>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deletes the item identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the item to delete.</param>
|
||||
Task Delete(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> associated with the specified location, or <see langword="null"/> if no patient is found at that location.
|
||||
/// </summary>
|
||||
/// <param name="location">The location used to look up the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Patient"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Patient?> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Retrieves a patient by their unique identifier, returning <c>null</c> when no matching patient exists.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique <see cref="ObjectId"/> of the patient to look up.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the matching <see cref="Patient"/>, or <c>null</c> if no patient is found.</returns>
|
||||
Task<Patient?> FindById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the location of a patient identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose location is to be updated.</param>
|
||||
/// <param name="location">The new patient location data to apply to the existing record.</param>
|
||||
Task UpdateLocation(ObjectId id, PatientLocation location);
|
||||
/// <summary>
|
||||
/// Updates the location of the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the entity whose location will be updated.</param>
|
||||
/// <param name="location">The identifier of the new location to associate with the entity.</param>
|
||||
Task UpdateLocation(ObjectId id, ObjectId location);
|
||||
/// <summary>
|
||||
/// Updates the attending doctor for the record identified by the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the record whose attending doctor will be updated.</param>
|
||||
/// <param name="attendingDoctor">The person to be set as the new attending doctor.</param>
|
||||
Task UpdateAttendingDoctor(ObjectId id, Person attendingDoctor);
|
||||
/// <summary>
|
||||
/// Updates the patient data identified by the specified id, optionally updating the patient number when <paramref name="updatePatientNumber"/> is true.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to update.</param>
|
||||
/// <param name="patientNumber">The patient number associated with the patient.</param>
|
||||
/// <param name="data">The new person data to apply to the patient record.</param>
|
||||
/// <param name="updatePatientNumber">Indicates whether the patient number should be updated; defaults to true.</param>
|
||||
Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true);
|
||||
/// <summary>
|
||||
/// Updates the information of an existing patient in the system.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity containing the updated information to be persisted.</param>
|
||||
Task Update(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> by their unique patient number.
|
||||
/// Returns <c>null</c> when no patient matches the provided identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the matching <see cref="Patient"/>, or <c>null</c> if no patient is found.</returns>
|
||||
Task<Patient?> FindByPatientNumber(string patientNumber);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> that matches the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="Patient"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Patient?> FindByPatientId(string patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all <see cref="Patient"/> records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Patient"/> entities.</returns>
|
||||
Task<List<Patient>> FindAll();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patients associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care identifier used to filter patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patients matching the specified point of care.</returns>
|
||||
Task<List<Patient>> FindByPointOfCare(string pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of patients associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The unique identifier of the point of care used to filter patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of patients matching the specified point of care.</returns>
|
||||
Task<List<Patient>> FindByPointOfCare(ObjectId pointOfCare);
|
||||
/// <summary>
|
||||
/// Retrieves a patient by their point-of-care identifier, returning <c>null</c> when no matching patient is found.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The unique identifier of the point-of-care location used to look up the patient.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Patient"/>, or <c>null</c> if no patient is associated with the specified point-of-care id.</returns>
|
||||
Task<Patient?> FindByPointOfCareId(ObjectId pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patients who have been discharged.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of discharged <see cref="Patient"/> records.</returns>
|
||||
Task<List<Patient>> FindDischargedPatients();
|
||||
/// <summary>
|
||||
/// Updates an existing patient record and returns the updated patient, or <see langword="null"/> if the patient was not found.
|
||||
/// </summary>
|
||||
/// <param name="updatedPatient">The patient containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Patient"/>, or <see langword="null"/> if no matching patient exists.</returns>
|
||||
Task<Patient?> UpdateOne(Patient updatedPatient);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patients who have an inactive Point of Care (PoC) assignment.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Patient"/> objects with inactive PoC status.</returns>
|
||||
Task<List<Patient>> FindInActivePoC();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of patients who are currently marked as inactive points of contact (PoC).
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of inactive PoC patients.</returns>
|
||||
Task<List<Patient>> FindInInactivePoC();
|
||||
/// <summary>
|
||||
/// Retrieves a list of patients whose records have not been updated since the specified date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; patients last updated before this date will be included in the result.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Patient"/> objects that have not been updated since the specified date.</returns>
|
||||
Task<List<Patient>> FindPatientsNotUpdatedSince(DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient from the data store by their unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if one is found; otherwise, <c>null</c>.</returns>
|
||||
Task<Patient?> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Updates the incoming data for the specified patient and returns the updated patient record.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose incoming data should be updated.</param>
|
||||
/// <param name="person">The patient object containing the incoming data to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Patient"/>, or <c>null</c> if the patient was not found.</returns>
|
||||
Task<Patient?> UpdatePatientIncomingData(ObjectId patientId, Patient person);
|
||||
/// <summary>
|
||||
/// Updates the demographic data of an existing patient identified by the given identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose demographic data is to be updated.</param>
|
||||
/// <param name="person">The patient object containing the updated demographic information.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Patient"/>, or <c>null</c> if the patient was not found.</returns>
|
||||
Task<Patient?> UpdatePatientDemographicData(ObjectId patientId, Patient person);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the patient matching the specified unit and point of care identifier.
|
||||
/// </summary>
|
||||
/// <param name="unit">The identifier of the unit used to locate the patient.</param>
|
||||
/// <param name="pointOfCare">The point of care identifier used together with the unit to locate the patient.</param>
|
||||
/// <returns>A task that resolves to the <see cref="Patient"/> associated with the given unit and point of care.</returns>
|
||||
Task<Patient> FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the total count of records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose associated records should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total count of matching records.</returns>
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously searches for a patient by their patient number within a specific unit, ensuring the patient is associated with a distinct unit.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to identify the patient.</param>
|
||||
/// <param name="unitId">The identifier of the unit to constrain the search to a distinct unit context.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent query of patients based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines page size, page number, and additional criteria applied to the patient query.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Patient, Patient}"/> representing the paginated patient query that can be further composed before execution.</returns>
|
||||
IFindFluent<Patient, Patient> GetPaginatedPatients(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients who have completed procedures, filtering by the number of minutes that have elapsed since the procedure end date for archival purposes.
|
||||
/// </summary>
|
||||
/// <param name="archiveProcedureEndDateAfterMinutes">The number of minutes after the procedure end date used to determine which finished procedures are eligible for archive retrieval.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of patients with finished procedures matching the archive criteria.</returns>
|
||||
Task<List<Patient>> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients whose tests have finished based on the specified archive end date threshold.
|
||||
/// </summary>
|
||||
/// <param name="archiveTestEndDateAfterMinutes">The number of minutes after which a test is considered finished and eligible for retrieval.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patients with finished tests.</returns>
|
||||
Task<List<Patient>> FindAllPatientWithFinishedTests(int archiveTestEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Retrieves all patients whose treatment has been finished and is eligible for archival based on the specified end date threshold.
|
||||
/// </summary>
|
||||
/// <param name="archiveTreatmentEndDateAfterMinutes">The number of minutes after the treatment end date used as the archival threshold.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of patients with finished treatments that meet the archival criteria.</returns>
|
||||
Task<List<Patient>> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Updates a master list option for the specified units and returns the patients affected by the change.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers whose patients should be considered for the update.</param>
|
||||
/// <param name="opt">The DTO containing the master list option update details.</param>
|
||||
/// <param name="typeName">The name of the option type being updated.</param>
|
||||
/// <returns>A task that resolves to the list of patients impacted by the master list option update.</returns>
|
||||
Task<List<Patient>> UpdateMasterListOption(List<ObjectId> unitIds, UpdateOptionMasterListDto opt, string typeName);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of <see cref="Patient"/> objects associated with the specified unit identifiers and patient type.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers used to filter the patients to be returned.</param>
|
||||
/// <param name="typeName">The name of the patient type used to further refine the query results.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing a list of <see cref="Patient"/> objects matching the provided unit identifiers and type.</returns>
|
||||
Task<List<Patient>> GetPatientsByUnitIds(List<ObjectId> unitIds, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes the specified master list option and returns the patients affected by its removal.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The identifiers of the units whose master list option should be deleted.</param>
|
||||
/// <param name="opt">The master list option to remove.</param>
|
||||
/// <param name="typeName">The name of the master list type to which the option belongs.</param>
|
||||
/// <returns>A task that yields the collection of patients impacted by deleting the master list option.</returns>
|
||||
Task<IEnumerable<Patient>> DeleteMasterListOption(List<ObjectId> unitIds, OptionList opt, string typeName);
|
||||
}
|
||||
@@ -4,6 +4,16 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPoCMappingRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="PoCMapping"/> associated with the specified key.
|
||||
/// Returns <c>null</c> when no mapping exists for the given key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key used to look up the <see cref="PoCMapping"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="PoCMapping"/> if found, or <c>null</c> if no mapping exists for the specified key.</returns>
|
||||
Task<PoCMapping?> FindByKey(string key);
|
||||
/// <summary>
|
||||
/// Retrieves the name of the collection associated with the current context or entity.
|
||||
/// </summary>
|
||||
/// <returns>The collection name as a string.</returns>
|
||||
string GetCollectionName();
|
||||
}
|
||||
@@ -6,13 +6,36 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPoCSettingsRepository : IMongoRepository<PoCSettings>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified <see cref="ObjectId"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the entity to delete.</param>
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the Point of Care (PoC) settings associated with the specified patient location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to look up the corresponding PoC settings.</param>
|
||||
/// <returns>A task that returns the matching <see cref="PoCSettings"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<PoCSettings?> FindByLocation(PatientLocation location);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the PoC (Proof of Concept) settings associated with the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the PoC settings to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result contains the matching <see cref="PoCSettings"/> if found, or <c>null</c> when no settings exist for the given identifier.</returns>
|
||||
Task<PoCSettings?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the PoC (Proof of Concept) settings with the provided values.
|
||||
/// </summary>
|
||||
/// <param name="pocSettings">The PoC settings to be applied.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
Task Update(PoCSettings pocSettings);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all <see cref="PoCSettings"/> records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="PoCSettings"/> entries.</returns>
|
||||
Task<List<PoCSettings>> FindAll();
|
||||
}
|
||||
@@ -10,49 +10,183 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPointOfCareRepository : IMongoRepository<PointOfCare>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified <paramref name="id"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the entity to delete.</param>
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the specified <see cref="PointOfCare"/> entity.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The <see cref="PointOfCare"/> instance containing the updated data to be persisted.</param>
|
||||
Task Update(PointOfCare pointOfCare);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the unit identifier associated with the specified object.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the object whose unit will be updated.</param>
|
||||
/// <param name="unit">The unit value to apply to the object.</param>
|
||||
Task UpdateUnitId(ObjectId id, Unit unit);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the point of care configuration identified by the specified identifier with the provided settings.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the point of care configuration to update.</param>
|
||||
/// <param name="configuration">The new configuration values to apply to the existing point of care record.</param>
|
||||
Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="PointOfCare"/> by its identifier, returning <c>null</c> when no matching record is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the point of care to locate.</param>
|
||||
/// <returns>A task that yields the matching <see cref="PointOfCare"/>, or <c>null</c> if no record exists for the given identifier.</returns>
|
||||
Task<PointOfCare?> FindById(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all <see cref="PointOfCare"/> records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unit">The <see cref="ObjectId"/> of the unit whose points of care should be returned.</param>
|
||||
/// <returns>A task that yields an <see cref="IEnumerable{T}"/> of <see cref="PointOfCare"/> for the matching unit, or <c>null</c> when no results are found.</returns>
|
||||
Task<IEnumerable<PointOfCare>?> FindAllByUnitId(ObjectId unit);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the points of care associated with the specified room.
|
||||
/// </summary>
|
||||
/// <param name="room">The room identifier used to look up the corresponding points of care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is a collection of <see cref="PointOfCare"/> matching the specified room, or <see langword="null"/> if no matching points of care are found.</returns>
|
||||
Task<IEnumerable<PointOfCare>?> FindByRoom(string room);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of <see cref="PointOfCare"/> entities that match the specified filter, optionally applying a projection to shape the returned fields.
|
||||
/// </summary>
|
||||
/// <param name="filter">The filter definition used to match <see cref="PointOfCare"/> entities in the data store.</param>
|
||||
/// <param name="projection">An optional projection definition that limits or shapes the fields returned in each result. If <c>null</c>, the full <see cref="PointOfCare"/> entity is returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PointOfCare"/> entities that satisfy the filter. Returns an empty list when no matching entities are found.</returns>
|
||||
Task<List<PointOfCare>> FindByFilter(FilterDefinition<PointOfCare> filter,
|
||||
ProjectionDefinition<PointOfCare>? projection = null);
|
||||
ProjectionDefinition<PointOfCare>? projection = null);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the points of care associated with the specified bed, returning <c>null</c> when no matching points of care are found.
|
||||
/// </summary>
|
||||
/// <param name="bed">The bed identifier used to look up the associated points of care.</param>
|
||||
/// <returns>A task that yields an <see cref="IEnumerable{T}"/> of <see cref="PointOfCare"/> when matches exist, or <c>null</c> if none are found.</returns>
|
||||
Task<IEnumerable<PointOfCare>?> FindByBed(string bed);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available points of care.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is a list of <see cref="PointOfCare"/> instances, or <c>null</c> if no points of care are available.</returns>
|
||||
Task<List<PointOfCare>?> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves all Point of Care configurations available in the system.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of <see cref="PointOfCare"/> configurations, or <c>null</c> if no configurations are found.</returns>
|
||||
Task<List<PointOfCare>?> GetAllConfigs();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all Point of Care location information.
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to a list of <see cref="PointOfCare"/> locations, or <c>null</c> if no location data is available.</returns>
|
||||
Task<List<PointOfCare>?> GetAllLocationInfo();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the Point of Care configuration associated with the specified identifier.
|
||||
/// Returns null when no configuration exists for the given identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The unique identifier of the Point of Care whose configuration is being requested.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="PointOfCare"/> configuration, or null if no configuration is found.</returns>
|
||||
Task<PointOfCare?> GetPoCConfiguration(ObjectId pocId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="PointOfCare"/> associated with the specified bed within the given unit, returning <see langword="null"/> if no matching record is found.
|
||||
/// </summary>
|
||||
/// <param name="bed">The bed identifier used to locate the point of care; may be <see langword="null"/>.</param>
|
||||
/// <param name="unitId">The identifier of the unit in which the bed is located.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="PointOfCare"/>, or <see langword="null"/> if none is found.</returns>
|
||||
Task<PointOfCare?> FindByBedAndUnitId(string? bed, ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the point of care associated with the specified patient location.
|
||||
/// </summary>
|
||||
/// <param name="patientLocation">The patient location used to look up the corresponding point of care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="PointOfCare"/>, or <c>null</c> if no point of care is found for the given patient location.</returns>
|
||||
Task<PointOfCare?> FindByPatientLocation(PatientLocation patientLocation);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a collection of <see cref="PointOfCare"/> entities that belong to the specified unit and match the given status.
|
||||
/// When <paramref name="excludeVirtual"/> is <c>true</c>, virtual points of care are omitted from the results.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose points of care are being queried.</param>
|
||||
/// <param name="status">The point-of-care status used to filter the results.</param>
|
||||
/// <param name="excludeVirtual">When set to <c>true</c>, virtual points of care are excluded from the returned collection.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{PointOfCare}"/> of points of care matching the specified unit and status.</returns>
|
||||
Task<IEnumerable<PointOfCare>> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare status,
|
||||
bool excludeVirtual = false);
|
||||
bool excludeVirtual = false);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the relay configuration associated with the specified point of contact identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The unique identifier of the point of contact whose relay configuration is being updated.</param>
|
||||
/// <param name="relayConfig">The collection of relay entries to apply to the configuration.</param>
|
||||
Task UpdateRelayConfig(ObjectId pocId, List<Relay> relayConfig);
|
||||
/// <summary>
|
||||
/// Updates the relay configuration for the specified point of configuration (POC) using the provided list of relay configuration identifiers.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The unique identifier of the point of configuration whose relay configuration will be updated.</param>
|
||||
/// <param name="relayConfig">The list of relay configuration identifiers to apply to the specified POC.</param>
|
||||
Task UpdateRelayConfig(ObjectId pocId, List<ObjectId> relayConfig);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent queryable collection of Points of Care (PoCs) based on the provided filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines paging parameters such as page number and page size.</param>
|
||||
/// <returns>An <see cref="IFindFluent{PointOfCare, PointOfCare}"/> representing the paginated query against the PoCs collection.</returns>
|
||||
IFindFluent<PointOfCare, PointOfCare> GetPaginatedPoCs(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of entities associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit used to filter the entities to be counted.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing the total count of matching entities.</returns>
|
||||
Task<long> CountByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of virtuals associated with the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose virtuals will be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the count of virtuals for the given unit.</returns>
|
||||
Task<long> CountVirtualsByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Deletes multiple records associated with the specified unit identifier asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose related records should be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value indicating whether the deletion was successful.</returns>
|
||||
Task<bool> DeleteManyByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="PointOfCare"/> entity by its identifier, including all associated configuration data.
|
||||
/// Returns <see langword="null"/> when no matching entity is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the point of care to retrieve.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="PointOfCare"/> with all configuration, or <see langword="null"/> if not found.</returns>
|
||||
Task<PointOfCare?> FindByIdAllConfig(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of camera identifiers that are currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a hash set of <see cref="ObjectId"/> values for all cameras in use.</returns>
|
||||
Task<HashSet<ObjectId>> FindAllIdCamerasInUse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all ID relays that are currently in use, returning them as a hash set for efficient lookup.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a hash set of the <see cref="ObjectId"/> values of all ID relays currently in use.</returns>
|
||||
Task<HashSet<ObjectId>> FindAllIdRelaysInUse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of all ID beacons that are currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="HashSet{ObjectId}"/> with the identifiers of all ID beacons currently in use.</returns>
|
||||
Task<HashSet<ObjectId>> FindAllIdBeaconsInUse();
|
||||
/// <summary>
|
||||
/// Retrieves all points of care associated with the specified unit identifier, including their related devices.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose points of care and associated devices are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of points of care with their associated devices, or <c>null</c> if no points of care are found for the specified unit.</returns>
|
||||
Task<IEnumerable<PointOfCare>?> FindAllByUnitIdWithDevices(ObjectId unitId);
|
||||
}
|
||||
@@ -5,18 +5,47 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPumpAlarmEventRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a pump alarm event into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="alarmEvent">The pump alarm event to be persisted.</param>
|
||||
Task InsertAsync(PumpAlarmEvent alarmEvent);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves pump alarm events associated with the specified device, optionally filtered by a date range and capped by a maximum result count.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose alarm events should be returned.</param>
|
||||
/// <param name="from">Optional start of the date range used to filter the events.</param>
|
||||
/// <param name="to">Optional end of the date range used to filter the events.</param>
|
||||
/// <param name="limit">Optional maximum number of alarm events to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of pump alarm events matching the criteria.</returns>
|
||||
Task<IEnumerable<PumpAlarmEvent>> FindByDeviceIdAsync(
|
||||
string deviceId,
|
||||
DateTime? from = null,
|
||||
DateTime? to = null,
|
||||
int? limit = null);
|
||||
string deviceId,
|
||||
DateTime? from = null,
|
||||
DateTime? to = null,
|
||||
int? limit = null);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent pump alarm event associated with the specified device identifier.
|
||||
/// Returns null if no alarm event is found for the given device.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose last pump alarm event is to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the most recent <see cref="PumpAlarmEvent"/> for the device, or null if none exists.</returns>
|
||||
Task<PumpAlarmEvent?> FindLastByDeviceIdAsync(string deviceId);
|
||||
|
||||
// cleanup
|
||||
/// <summary>
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose records should be deleted.</param>
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the ObjectId value of multiple records where the specified field currently matches the old identifier, replacing it with the new identifier.
|
||||
/// </summary>
|
||||
/// <param name="fieldName">The name of the field whose value should be updated.</param>
|
||||
/// <param name="newId">The new ObjectId value to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId value used to identify the records to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the number of records that were updated.</returns>
|
||||
Task<long> UpdateManyObjectIdByFiledNameAsync(string fieldName, ObjectId newId, ObjectId oldId);
|
||||
}
|
||||
@@ -6,22 +6,56 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPumpAlarmStateRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the active alarm state for a specified device, optionally filtered by alarm type and alarm code.
|
||||
/// Returns <c>null</c> when no matching active alarm state is found.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The identifier of the device whose active alarm state is being queried.</param>
|
||||
/// <param name="alarmType">The optional alarm type to filter the search by; if <c>null</c>, no alarm type filter is applied.</param>
|
||||
/// <param name="alarmCodeMdc">The optional MDC alarm code to further filter the search; if <c>null</c>, no alarm code filter is applied.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the active <see cref="PumpAlarmState"/>, or <c>null</c> if no matching active alarm state exists.</returns>
|
||||
Task<PumpAlarmState?> FindActiveAsync(
|
||||
string deviceId,
|
||||
PumpEnum.AlarmType? alarmType,
|
||||
string? alarmCodeMdc = null);
|
||||
string deviceId,
|
||||
PumpEnum.AlarmType? alarmType,
|
||||
string? alarmCodeMdc = null);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all active pump alarm states associated with the specified device.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose active pump alarm states are being queried.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of active <see cref="PumpAlarmState"/> entries for the given device.</returns>
|
||||
Task<IEnumerable<PumpAlarmState>> FindAllActiveByDeviceAsync(string deviceId);
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a new active pump alarm state or updates the existing one, maintaining the current state for the alarm.
|
||||
/// </summary>
|
||||
/// <param name="state">The pump alarm state to upsert as the active record.</param>
|
||||
Task UpsertActiveAsync(PumpAlarmState state);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously removes alarm records associated with the specified device, optionally filtered by alarm type and alarm code.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The identifier of the device whose alarms should be removed.</param>
|
||||
/// <param name="alarmType">The optional alarm type to filter the removal; when null, all alarm types are considered.</param>
|
||||
/// <param name="alarmCodeMdc">The optional alarm code (MDC) to further filter the removal; when null, no code filter is applied.</param>
|
||||
Task RemoveAsync(
|
||||
string deviceId,
|
||||
PumpEnum.AlarmType? alarmType,
|
||||
string? alarmCodeMdc = null);
|
||||
string deviceId,
|
||||
PumpEnum.AlarmType? alarmType,
|
||||
string? alarmCodeMdc = null);
|
||||
|
||||
//cleanup
|
||||
/// <summary>
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the <see cref="ObjectId"/> value in multiple documents identified by the specified field name, replacing <paramref name="oldId"/> with <paramref name="newId"/>, and returns the number of documents affected.
|
||||
/// </summary>
|
||||
/// <param name="fieldName">The name of the field whose value will be updated.</param>
|
||||
/// <param name="newId">The new <see cref="ObjectId"/> value to assign.</param>
|
||||
/// <param name="oldId">The existing <see cref="ObjectId"/> value to be replaced.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous operation. The task result contains the number of documents updated.</returns>
|
||||
Task<long> UpdateManyObjectIdByFieldNameAsync(string fieldName, ObjectId newId, ObjectId oldId);
|
||||
}
|
||||
@@ -5,24 +5,82 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPumpObservationRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a pump observation into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation entity to persist.</param>
|
||||
Task InsertAsync(PumpObservation obs);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a collection of pump observations into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="observations">The collection of <see cref="PumpObservation"/> records to be persisted.</param>
|
||||
Task InsertManyAsync(IEnumerable<PumpObservation> observations);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves pump observations associated with the specified device identifier, optionally filtered by a time range and limited in count.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose pump observations are being queried.</param>
|
||||
/// <param name="from">Optional inclusive lower bound for the observation timestamp; when null, no lower bound is applied.</param>
|
||||
/// <param name="to">Optional inclusive upper bound for the observation timestamp; when null, no upper bound is applied.</param>
|
||||
/// <param name="limit">Optional maximum number of observations to return; when null, all matching observations are returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, yielding an enumerable collection of <see cref="PumpObservation"/> instances matching the criteria.</returns>
|
||||
Task<IEnumerable<PumpObservation>> FindByDeviceIdAsync(
|
||||
string deviceId,
|
||||
DateTime? from = null,
|
||||
DateTime? to = null,
|
||||
int? limit = null);
|
||||
string deviceId,
|
||||
DateTime? from = null,
|
||||
DateTime? to = null,
|
||||
int? limit = null);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent <see cref="PumpObservation"/> associated with the specified device identifier.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose last observation is being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the last <see cref="PumpObservation"/> for the device, or <c>null</c> if no observation exists for the given device.</returns>
|
||||
Task<PumpObservation?> FindLastByDeviceIdAsync(string deviceId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent observation time for all patients, returning a mapping of patient identifiers to their last observation timestamps.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a dictionary where each key is a patient <see cref="ObjectId"/> and the associated value is the <see cref="DateTime"/> of that patient's last observation.</returns>
|
||||
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTimeAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the pump observations associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose pump observations are being queried. May be <see langword="null"/>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the collection of <see cref="PumpObservation"/> items found for the patient, or an empty collection if no observations are found.</returns>
|
||||
Task<IEnumerable<PumpObservation>> FindByPatientId(ObjectId? patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent aggregated pump observations for a specified patient, ordered from newest to oldest.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="num">The maximum number of observations to return. Defaults to 100.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of the patient's most recent <see cref="PumpObservation"/> entries.</returns>
|
||||
Task<List<PumpObservation>> AggregatedPatientLastObservations(ObjectId patientId, int num = 100);
|
||||
/// <summary>
|
||||
/// Deletes all records associated with the specified patient identifier. If the patient identifier is null, no deletion is performed.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The optional patient identifier whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId? patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records older than the specified number of days, optionally filtered by name, and returns the number of items removed.
|
||||
/// </summary>
|
||||
/// <param name="days">The age threshold in days; only records older than this value will be deleted.</param>
|
||||
/// <param name="name">An optional name used to filter which records are targeted for deletion. If null, deletion applies to all records regardless of name.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing the total count of deleted records.</returns>
|
||||
Task<long> DeleteOlderThanDaysAsync(int days, string? name = null);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes items, retaining only the most recent <paramref name="maxCount"/> entries, and returns the number of items that were removed.
|
||||
/// </summary>
|
||||
/// <param name="maxCount">The maximum number of most recent items to keep after the deletion.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the count of items that were deleted.</returns>
|
||||
Task<long> DeleteKeepLastNAsync(int maxCount);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the ObjectId value of the specified field for multiple records, replacing the existing value (optionally matched by <paramref name="oldId"/>) with <paramref name="newId"/>.
|
||||
/// </summary>
|
||||
/// <param name="fieldName">The name of the field whose ObjectId value will be updated.</param>
|
||||
/// <param name="newId">The new ObjectId value to assign to the field.</param>
|
||||
/// <param name="oldId">The optional current ObjectId value used as a filter; when <see langword="null"/>, the update is applied without filtering by the previous value.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous operation, containing the number of records updated.</returns>
|
||||
Task<long> UpdateManyObjectIdByFieldAsync(string fieldName, ObjectId newId, ObjectId? oldId);
|
||||
}
|
||||
@@ -4,9 +4,23 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IPumpStateRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the pump state associated with the specified device identifier.
|
||||
/// Returns null when no matching pump state is found for the given device identifier.
|
||||
/// </summary>
|
||||
/// <param name="deviceId">The unique identifier of the device whose pump state is being looked up.</param>
|
||||
/// <returns>A task that resolves to the PumpState if a match is found, or null if no pump state exists for the specified device.</returns>
|
||||
Task<PumpState?> FindByDeviceIdAsync(string deviceId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously creates or updates a pump state record in the data store.
|
||||
/// </summary>
|
||||
/// <param name="state">The pump state to be inserted if it does not exist, or updated if it already exists.</param>
|
||||
Task UpsertAsync(PumpState state);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available pump states.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of all <see cref="PumpState"/> objects.</returns>
|
||||
Task<IEnumerable<PumpState>> GetAllAsync();
|
||||
}
|
||||
@@ -4,7 +4,20 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IRecordingAlertArchiveRepository : IMongoRepository<PatientRecordingAlert>
|
||||
{
|
||||
/// <summary>
|
||||
/// Inserts a new patient recording alert into the underlying data store asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="recordingAlert">The patient recording alert to be inserted.</param>
|
||||
new Task InsertOneAsync(PatientRecordingAlert recordingAlert);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records that have a date earlier than the specified threshold.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; records with a date value before this will be removed.</param>
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Inserts a batch of <see cref="PatientRecordingAlert"/> entities into the data store in a single operation.
|
||||
/// </summary>
|
||||
/// <param name="recordingAlerts">The collection of patient recording alerts to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous batch insert operation, containing the number of affected or inserted records.</returns>
|
||||
Task<long> InsertBatch(IEnumerable<PatientRecordingAlert> recordingAlerts);
|
||||
}
|
||||
@@ -6,13 +6,56 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IRecordingAlertRepository : IMongoRepository<PatientRecordingAlert>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves an aggregated list of the most recent patient recording alerts for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose recent alerts are being retrieved.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientRecordingAlert"/> entries for the patient's last observations.</returns>
|
||||
Task<List<PatientRecordingAlert>> AggregatedPatientLastObservations(ObjectId patientId, int num);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent observations of a specified type for a given patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are queried.</param>
|
||||
/// <param name="name">The name of the observation to filter by.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 2.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientRecordingAlert"/> entries representing the matching observations.</returns>
|
||||
Task<List<PatientRecordingAlert>> FindLastObservations(ObjectId patientId, string name, int num = 2);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single <see cref="PatientRecordingAlert"/> into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientRecordingAlert">The patient recording alert to be inserted.</param>
|
||||
new Task InsertOneAsync(PatientRecordingAlert patientRecordingAlert);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records older than the specified number of days, identified by the given name.
|
||||
/// </summary>
|
||||
/// <param name="name">The identifier or key used to locate the records to be evaluated for deletion.</param>
|
||||
/// <param name="value">The age threshold, in days, used to determine which records are considered older and eligible for deletion.</param>
|
||||
Task DeleteOlderDaysAsync(string name, int value);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a number record matching the specified name and value.
|
||||
/// </summary>
|
||||
/// <param name="name">The name associated with the number to delete.</param>
|
||||
/// <param name="value">The numeric value of the record to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
Task DeleteOlderNumberAsync(string name, int value);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique <see cref="ObjectId"/> of the patient whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Updates many records by replacing the specified <paramref name="oldId"/> with the new <paramref name="id"/> within the collection identified by <paramref name="nameId"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The name or identifier of the collection in which the update is performed.</param>
|
||||
/// <param name="id">The new ObjectId to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId used to locate the records to be updated.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient recording alerts associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose recording alerts are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an asynchronous cursor over the matching <see cref="PatientRecordingAlert"/> documents.</returns>
|
||||
Task<IAsyncCursor<PatientRecordingAlert>> FindByPatientIdAsync(ObjectId patientId);
|
||||
}
|
||||
@@ -8,11 +8,48 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IRelayRepository : IMongoRepository<Relay>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a relay entity by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="relayId">The unique identifier of the relay to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Relay"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Relay?> GetById(ObjectId relayId);
|
||||
/// <summary>
|
||||
/// Retrieves the relays of the specified type from the provided configuration relay list.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of relay object identifiers to search through.</param>
|
||||
/// <param name="type">The relay type used to filter the configuration relay list.</param>
|
||||
/// <returns>A list of relays matching the specified type; an empty list if no relays of that type are found.</returns>
|
||||
List<Relay> GetRelayByTypeInList(List<ObjectId> configurationRelayList, RelayEnum.Type type);
|
||||
/// <summary>
|
||||
/// Retrieves the <see cref="Relay"/> objects that correspond to the supplied configuration relay identifiers.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of <see cref="ObjectId"/> values identifying the configuration relays to look up.</param>
|
||||
/// <returns>A <see cref="List{Relay}"/> containing the relays that match the provided configuration relay identifiers.</returns>
|
||||
List<Relay> GetRelayInList(List<ObjectId> configurationRelayList);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, filterable query of relays based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter used to control paging and additional query criteria for the relay lookup.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Relay, Relay}"/> representing the paginated query that can be further refined and executed.</returns>
|
||||
IFindFluent<Relay, Relay> GetPaginatedRelays(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single <see cref="Relay"/> record and returns the inserted entity, or <see langword="null"/> if the insertion did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="request">The <see cref="Relay"/> entity to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation. The result is the inserted <see cref="Relay"/>, or <see langword="null"/> when no relay is returned.</returns>
|
||||
Task<Relay?> InsertOneRelayAsync(Relay request);
|
||||
/// <summary>
|
||||
/// Updates an existing relay identified by the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the relay to update.</param>
|
||||
/// <param name="relay">The relay object containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated relay, or <see langword="null"/> if no relay with the specified identifier was found.</returns>
|
||||
Task<Relay?> UpdateRelayAsync(ObjectId objectId, Relay relay);
|
||||
/// <summary>
|
||||
/// Retrieves a relay by its name asynchronously, returning null if no matching relay is found.
|
||||
/// </summary>
|
||||
/// <param name="requestRelayName">The name of the relay to look up. May be null.</param>
|
||||
/// <returns>A task that represents the asynchronous lookup. The task result contains the matching relay, or null if no relay with the specified name exists.</returns>
|
||||
Task<Relay?> GetByName(string? requestRelayName);
|
||||
}
|
||||
@@ -5,17 +5,57 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface ISectionRepository : IMongoRepository<Section>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a list of sections associated with the specified patient location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter the sections.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the list of sections matching the specified patient location.</returns>
|
||||
Task<List<Section>> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Section"/> by its identifier, returning <c>null</c> when no matching section is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the section to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Section"/>, or <c>null</c> if no section with the specified identifier exists.</returns>
|
||||
Task<Section?> FindById(object id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="Section"/> that matches the specified identifier.
|
||||
/// Returns <c>null</c> when no matching section is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the section to look up.</param>
|
||||
/// <returns>A <see cref="Task{Section}"/> that resolves to the matching <see cref="Section"/>, or <c>null</c> if no section is found.</returns>
|
||||
Task<Section?> FindById(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Section"/> that matches the specified section identifier.
|
||||
/// </summary>
|
||||
/// <param name="section">The section name or identifier used to look up the matching <see cref="Section"/>.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Section"/>, or <c>null</c> if no section is found.</returns>
|
||||
Task<Section?> FindBySection(string section);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="Section"/> associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care identifier used to look up the section.</param>
|
||||
/// <returns>A task that returns the matching <see cref="Section"/>, or <c>null</c> if no section is found for the given point of care.</returns>
|
||||
Task<Section?> FindByPointOfCare(string pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all sections.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="Section"/> items.</returns>
|
||||
Task<List<Section>> GetAll();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified section in the system and returns the updated entity.
|
||||
/// </summary>
|
||||
/// <param name="section">The section entity containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the updated section, or null if the section was not found.</returns>
|
||||
Task<Section?> UpdateSection(Section section);
|
||||
//Task<Section?> UpdateSectionItems(Section section);
|
||||
//Task<Section?> UpdateSectionConfig(Section section);
|
||||
//Section UpdateSectionItems(string sectionId, string group, string boxName, BoxResponse boxUpdated);
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a single <see cref="Section"/> into the underlying data store and returns the inserted entity, or <see langword="null"/> if the operation did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="section">The <see cref="Section"/> instance to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the inserted <see cref="Section"/>, or <see langword="null"/> if no section was inserted.</returns>
|
||||
Task<Section?> InsertOneSection(Section section);
|
||||
}
|
||||
@@ -5,6 +5,17 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IServiceConfigRepository : IMongoRepository<ServiceConfig>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="ServiceConfig"/> by its unique <see cref="ObjectId"/>.
|
||||
/// Returns <c>null</c> when no matching service configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="oid">The unique identifier of the service configuration to look up.</param>
|
||||
/// <returns>A <see cref="ServiceConfig"/> matching the provided identifier, or <c>null</c> if no configuration exists for that id.</returns>
|
||||
Task<ServiceConfig?> FindById(ObjectId oid);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="ServiceConfig"/> by its identifier, returning <see langword="null"/> when no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the service configuration to look up.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="ServiceConfig"/>, or <see langword="null"/> if no configuration exists for the given id.</returns>
|
||||
Task<ServiceConfig?> FindById(string id);
|
||||
}
|
||||
@@ -5,9 +5,27 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface ITreatmentArchiveRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new patient treatment record into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientTreatment">The patient treatment entity to insert.</param>
|
||||
Task InsertOneAsync(PatientTreatment patientTreatment);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes items whose associated date is earlier than the specified cutoff date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; items dated before this value are removed.</param>
|
||||
Task DeleteBeforeDate(DateTime date);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a batch of <see cref="PatientTreatment"/> records.
|
||||
/// </summary>
|
||||
/// <param name="treatments">The collection of patient treatment entities to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="long"/> value associated with the batch insertion.</returns>
|
||||
Task<long> InsertBatch(IEnumerable<PatientTreatment> treatments);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient treatment records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientTreatment"/> records for the given patient.</returns>
|
||||
Task<List<PatientTreatment>> FindAllFromPatient(ObjectId patientId);
|
||||
}
|
||||
@@ -7,17 +7,80 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface ITreatmentRepository : IMongoRepository<PatientTreatment>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the collection of <see cref="PatientTreatment"/> records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{PatientTreatment}"/> of treatments for the patient; the collection is empty if no treatments are found.</returns>
|
||||
Task<IEnumerable<PatientTreatment>> GetByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient treatment record from the data store that matches the specified identifier.
|
||||
/// Returns a cursor over the matching <see cref="PatientTreatment"/> document, or an empty cursor if no record is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique <see cref="ObjectId"/> of the patient treatment record to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{IAsyncCursor{PatientTreatment}}"/> that yields a cursor containing the matching patient treatment, if any.</returns>
|
||||
Task<IAsyncCursor<PatientTreatment>> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new <see cref="PatientTreatment"/> record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment entity to be persisted.</param>
|
||||
/// <returns>A <see cref="Task"/> that represents the asynchronous insert operation.</returns>
|
||||
new Task InsertOneAsync(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
new Task DeleteAsync(ObjectId id);
|
||||
/// <summary>
|
||||
/// Updates an existing <see cref="PatientTreatment"/> record in the data store asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The <see cref="PatientTreatment"/> entity containing the updated information.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous update operation. The task result contains <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> Update(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of <see cref="PatientTreatment"/> records associated with the specified patient identifier, returning the results as a cursor for streaming access.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being queried.</param>
|
||||
/// <returns>A task that yields an <see cref="IAsyncCursor{TDocument}"/> of <see cref="PatientTreatment"/> records matching the given patient identifier.</returns>
|
||||
Task<IAsyncCursor<PatientTreatment>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of patient treatments associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of <see cref="PatientTreatment"/> records for the given patient.</returns>
|
||||
Task<IEnumerable<PatientTreatment>> FindByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a record associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose record should be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the record was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of bolus treatments associated with the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose bolus treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientTreatment"/> entries representing the patient's bolus treatments.</returns>
|
||||
Task<List<PatientTreatment>> FindBolusTreatments(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Updates many records that reference a specific ObjectId, replacing the existing ObjectId with a new one.
|
||||
/// Typically used to remap references from <paramref name="oldId"/> to <paramref name="id"/> for the field identified by <paramref name="nameId"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The name of the field/property that contains the ObjectId reference to be updated.</param>
|
||||
/// <param name="id">The new ObjectId value that will replace the existing reference.</param>
|
||||
/// <param name="oldId">The current ObjectId value to match and be replaced.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent queryable collection of patient treatments based on the provided pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing page size, page number, and other pagination criteria.</param>
|
||||
/// <returns>An <see cref="IFindFluent{TSource, TDocument}"/> for <see cref="PatientTreatment"/> that supports further fluent query composition and pagination.</returns>
|
||||
IFindFluent<PatientTreatment, PatientTreatment> GetPaginatedTreatments(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of active patient treatments for the specified patient, ordered according to the provided ordering criterion.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active treatments are to be retrieved.</param>
|
||||
/// <param name="order">The ordering criterion applied to the returned list of treatments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of active <see cref="PatientTreatment"/> objects for the specified patient.</returns>
|
||||
Task<List<PatientTreatment>> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order);
|
||||
}
|
||||
@@ -10,19 +10,83 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
public interface IUnitRepository : IMongoRepository<Unit>
|
||||
{
|
||||
//Task<Unit?> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Unit"/> entity by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the <see cref="Unit"/> to locate.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Unit"/>, or <c>null</c> if no entity is found.</returns>
|
||||
Task<Unit?> FindById(object id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously finds a unit by its section name.
|
||||
/// </summary>
|
||||
/// <param name="section">The name of the section to search for.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the unit if found; otherwise, null.</returns>
|
||||
Task<Unit?> FindByName(string section);
|
||||
|
||||
//Task<Unit?> FindByPointOfCare(PointOfCare pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available units and returns them as a list.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Unit"/> entities.</returns>
|
||||
Task<List<Unit>> GetAll();
|
||||
/// <summary>
|
||||
/// Updates an existing unit in the underlying store and returns the updated entity.
|
||||
/// </summary>
|
||||
/// <param name="section">The unit containing the updated data to persist.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Unit"/>, or <c>null</c> when the unit cannot be found.</returns>
|
||||
Task<Unit?> UpdateUnit(Unit section);
|
||||
/// <summary>
|
||||
/// Inserts a single <see cref="Unit"/> record and returns the inserted entity, or <see langword="null"/> if the insertion did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="unit">The <see cref="Unit"/> entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation. The task result contains the inserted <see cref="Unit"/>, or <see langword="null"/> when no unit is returned.</returns>
|
||||
Task<Unit?> InsertOneUnit(Unit unit);
|
||||
/// <summary>
|
||||
/// Retrieves the collection of units associated with the specified master list identifier and master list type.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list whose units should be retrieved.</param>
|
||||
/// <param name="masterListType">The type of the master list used to filter or scope the unit lookup.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of units linked to the specified master list.</returns>
|
||||
Task<IEnumerable<Unit>> FindByMasterListId(ObjectId id, MasterListType masterListType);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of <see cref="Unit"/> entities associated with the specified master list identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the master list whose units are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{Unit}"/> with the units linked to the given master list.</returns>
|
||||
Task<IEnumerable<Unit>> FindByMasterListId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Updates the unit master list based on the provided unit identifiers. Returns the updated <see cref="Unit"/> when the operation succeeds, or <c>null</c> when no matching unit is found.
|
||||
/// </summary>
|
||||
/// <param name="updateUnitListDto">The data transfer object containing the list of unit identifiers to update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Unit"/>, or <c>null</c> if no unit was updated.</returns>
|
||||
Task<Unit?> UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto);
|
||||
/// <summary>
|
||||
/// Updates the name and title of an existing unit identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit to update.</param>
|
||||
/// <param name="name">The new name to assign to the unit.</param>
|
||||
/// <param name="title">The new title to assign to the unit.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The task result contains the updated <see cref="Unit"/>, or <c>null</c> if the unit was not found.</returns>
|
||||
Task<Unit?> UpdateUnitInfo(ObjectId unitId, string name, string title);
|
||||
/// <summary>
|
||||
/// Updates the configuration of a unit identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitIdParsed">The parsed object identifier of the unit whose configuration will be updated.</param>
|
||||
/// <param name="unitConfiguration">The new configuration values to apply to the unit.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the configuration was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateConfiguration(ObjectId unitIdParsed, UnitConfiguration unitConfiguration);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of <see cref="Unit"/> records based on the provided pagination criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and any additional filtering criteria.</param>
|
||||
/// <returns>An <see cref="IFindFluent{Unit, Unit}"/> representing the fluent query for the paginated units.</returns>
|
||||
IFindFluent<Unit, Unit> GetPaginatedUnits(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of units associated with the master list identified by the specified identifier and type.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list whose units should be counted.</param>
|
||||
/// <param name="masterListType">The type of the master list used to resolve the appropriate unit collection.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total number of units matching the specified master list.</returns>
|
||||
Task<long> CountUnitsByMasterListId(ObjectId id, MasterListType masterListType);
|
||||
}
|
||||
@@ -7,12 +7,54 @@ namespace adas_core.Application.Repositories.Interfaces;
|
||||
|
||||
public interface IUserRepository : IMongoRepository<User>
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a user by validating the provided username and password credentials.
|
||||
/// Returns the matching user when authentication succeeds, or null if no user matches the supplied credentials.
|
||||
/// </summary>
|
||||
/// <param name="username">The username used to look up the user account.</param>
|
||||
/// <param name="password">The password used to authenticate the user.</param>
|
||||
/// <returns>A task that resolves to the authenticated <see cref="User"/>, or null if no user matches the provided credentials.</returns>
|
||||
Task<User?> GetUser(string username, string password);
|
||||
/// <summary>
|
||||
/// Retrieves a user by their unique identifier asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the user to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="User"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
Task<User?> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a user matching the specified username. Returns <c>null</c> if no user is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The username to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="User"/> or <c>null</c> if not found.</returns>
|
||||
Task<User?> GetByUserName(string name);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a user by their name, returning null if no matching user is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the user to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the user with the specified name, or null if no matching user exists.</returns>
|
||||
Task<User?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the user associated with the specified authorities name.
|
||||
/// </summary>
|
||||
/// <param name="name">The authorities name used to look up the user.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="User"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<User?> GetByUserAndAuthoritesName(string name);
|
||||
/// <summary>
|
||||
/// Updates an existing user in the system, optionally updating the user's password when the <paramref name="updatePass"/> flag is set.
|
||||
/// </summary>
|
||||
/// <param name="user">The user entity containing the updated information to be persisted.</param>
|
||||
/// <param name="updatePass">A flag indicating whether the user's password should also be updated as part of this operation.</param>
|
||||
/// <returns>A task that returns the updated <see cref="User"/> entity, or <c>null</c> if the user was not found.</returns>
|
||||
Task<User?> UpdateUser(User user, bool updatePass);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated, fluent queryable collection of <see cref="User"/> entities based on the supplied pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines paging parameters such as page number and page size.</param>
|
||||
/// <returns>An <see cref="IFindFluent{User, User}"/> representing the queryable, paginated user results.</returns>
|
||||
IFindFluent<User, User> GetPaginatedUsers(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves the existing system user, creating a new one if it does not already exist.
|
||||
/// </summary>
|
||||
/// <returns>The existing or newly created system <see cref="User"/>.</returns>
|
||||
Task<User> GetOrCreateSystemUser();
|
||||
}
|
||||
Reference in New Issue
Block a user