rama creada apartir de master en j
This commit is contained in:
@@ -4,6 +4,14 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously persists the specified <see cref="ApiRequest"/>.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
Task SaveRequestAsync(ApiRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Asynchronously saves the specified API request.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to persist.</param>
|
||||
Task SaveRequest(ApiRequest apiRequest);
|
||||
}
|
||||
@@ -7,39 +7,135 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IAdminPanelService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a unit identified by its unique identifier from the data store.
|
||||
/// Returns a result indicating whether the deletion was successful (e.g., true if the unit was found and removed, false otherwise).
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the unit was successfully deleted; otherwise, <c>false</c> if the unit was not found.</returns>
|
||||
Task<bool> DeleteUnitById(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Inserts a new <see cref="Unit"/> into the data store and returns the inserted entity.
|
||||
/// </summary>
|
||||
/// <param name="unit">The <see cref="Unit"/> to insert.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the inserted <see cref="Unit"/>, or <see langword="null"/> if the insert could not be completed.</returns>
|
||||
Task<Unit?> InsertUnit(Unit unit);
|
||||
|
||||
#region Patient
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new patient based on the provided admin panel request.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The admin panel request containing the data needed to create the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the created <see cref="Patient"/>, or <c>null</c> if no patient was created.</returns>
|
||||
Task<Patient?> CreatePatient(AdmPanelRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the patient associated with the specified location.
|
||||
/// </summary>
|
||||
/// <param name="location">The location used to look up the associated patient.</param>
|
||||
/// <returns>A task that resolves to the <see cref="Patient"/> found at the given location, or <c>null</c> if no patient is associated with that location.</returns>
|
||||
Task<Patient?> FindPatientByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> by their unique patient number.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique identifier of the patient to look up.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Patient"/>, or <c>null</c> if no patient is found with the specified number.</returns>
|
||||
Task<Patient?> FindPatientByPatientNumber(string patientNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient from the data store using the specified unique identifier.
|
||||
/// Returns null when no patient matches the provided identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the patient if found; otherwise, null.</returns>
|
||||
Task<Patient?> FindPatientById(ObjectId id);
|
||||
|
||||
//List<person> FindAllPatient();
|
||||
/// <summary>
|
||||
/// Asynchronously finds and returns a <see cref="Patient"/> based on the criteria provided in the admission panel request.
|
||||
/// Returns <c>null</c> when no matching patient is found.
|
||||
/// </summary>
|
||||
/// <param name="request">The admission panel request containing the search criteria used to locate the patient.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Patient"/> if found, or <c>null</c> otherwise.</returns>
|
||||
Task<Patient?> FindPatient(AdmPanelRequest request);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the dependency information DTO for the specified <paramref name="unit"/>.
|
||||
/// Returns <c>null</c> when no dependency information is available for the unit.
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit for which to retrieve dependency information.</param>
|
||||
/// <returns>A <see cref="Task{UnitInfoDto}"/> that yields the unit dependency DTO, or <c>null</c> if none is found.</returns>
|
||||
Task<UnitInfoDto?> GetUnitDependencyDto(Unit unit);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the patient location based on the provided admission panel request.
|
||||
/// </summary>
|
||||
/// <param name="request">The admission panel request containing the patient location details to update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdatePatientLocation(AdmPanelRequest request);
|
||||
/// <summary>
|
||||
/// Updates the patient data based on the provided admission panel request, using the existing patient record as a reference.
|
||||
/// </summary>
|
||||
/// <param name="request">The admission panel request containing the updated patient data.</param>
|
||||
/// <param name="oldPatient">The existing patient record to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the patient data was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdatePatientData(AdmPanelRequest request, Patient oldPatient);
|
||||
/// <summary>
|
||||
/// Archives the specified patient, marking them as inactive while preserving their record.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the patient was successfully archived; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> ArchivePatient(Patient patient);
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConfigObservations
|
||||
/// <summary>
|
||||
/// Asynchronously creates a configuration based on the specified observation.
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The observation data used to create the configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous create operation, containing a value indicating whether the configuration was created successfully.</returns>
|
||||
Task<bool> CreateConfig(ConfigObservation configObservation);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the configuration based on the provided <see cref="ConfigObservation"/>, applying any required changes derived from the observation data.
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The observation data used to determine and apply configuration updates.</param>
|
||||
/// <returns>A <see cref="Task{Boolean}"/> that represents the asynchronous update operation, containing a value indicating whether the configuration was successfully updated.</returns>
|
||||
Task<bool> UpdateConfig(ConfigObservation configObservation);
|
||||
/// <summary>
|
||||
/// Deletes the configuration observation item identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation item to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the item was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteConfigObservationItem(ObjectId id);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Medicienes
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Medicine"/> entity by its unique identifier from the data store.
|
||||
/// Returns <c>null</c> when no medicine matches the provided identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique <see cref="ObjectId"/> 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 not found.</returns>
|
||||
Task<Medicine?> GetMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Asynchronously creates and persists a new medicine record.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity to be created and posted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the newly created <see cref="Medicine"/>, or <c>null</c> if the operation fails.</returns>
|
||||
Task<Medicine?> PostMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Updates an existing medicine record in the system.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity containing the updated information to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Medicine"/> if found, or <c>null</c> if the medicine does not exist.</returns>
|
||||
Task<Medicine?> UpdateMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Deletes a medicine identified by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the medicine was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteMedicineById(string medicineId);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -9,26 +9,121 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IAdmissionService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an admission by its unique identifier, returning <c>null</c> when no matching admission is found.
|
||||
/// </summary>
|
||||
/// <param name="admissionId">The unique identifier of the admission to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Admission"/> if found, or <c>null</c> if no admission matches the specified identifier.</returns>
|
||||
Task<Admission?> GetAdmissionByIdAsync(ObjectId admissionId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes an admission record identified by the specified admission ID.
|
||||
/// </summary>
|
||||
/// <param name="admissionId">The unique identifier of the admission to delete.</param>
|
||||
Task DeleteAdmissionByIdAsync(ObjectId admissionId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the specified admission record.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity to remove.</param>
|
||||
Task DeleteAdmissionAsync(Admission admission);
|
||||
/// <summary>
|
||||
/// Deletes all admissions associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose admissions will be deleted.</param>
|
||||
Task DeleteAdmissionsByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing admission record with the provided information.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity containing the updated data to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
Task UpdateAdmissionAsync(Admission admission);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of admissions.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of <see cref="Admission"/> objects.</returns>
|
||||
Task<IEnumerable<Admission>> GetAdmissionsAsync();
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new admission record and returns the created entry, or <see langword="null"/> if the insertion was not performed.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission entity to be inserted into the data store.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the inserted <see cref="Admission"/>, or <see langword="null"/> when no record is produced.</returns>
|
||||
Task<Admission?> InsertAdmission(Admission admission);
|
||||
/// <summary>
|
||||
/// Admits a patient based on the provided admission details, optionally registering the patient as new.
|
||||
/// </summary>
|
||||
/// <param name="admission">The admission information used to process the patient admission.</param>
|
||||
/// <param name="isNew">Indicates whether the patient is being admitted for the first time. Defaults to <c>false</c>.</param>
|
||||
Task AdmitPatient(Admission admission, bool isNew = false);
|
||||
/// <summary>
|
||||
/// Processes the return of a patient to the admissions workflow, typically used when a patient needs to be re-queued or reinstated for admission processing.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to be returned to admissions.</param>
|
||||
Task ReturnPatientToAdmissions(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously returns a patient to the admissions workflow using the specified admission record.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient being returned to admissions.</param>
|
||||
/// <param name="adm">The admission record associated with the patient being returned.</param>
|
||||
Task ReturnPatientToAdmissions(ObjectId patientId, Admission adm);
|
||||
/// <summary>
|
||||
/// Retrieves a list of admissions associated with the specified patient location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter the admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of admissions for the given location.</returns>
|
||||
Task<List<Admission>> GetAdmissionByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of admissions associated with the specified point of care identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the point of care used to filter the admissions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Admission"/> objects matching the specified point of care id, or an empty list if no admissions are found.</returns>
|
||||
Task<List<Admission>> GetAdmissionByPointOfCareId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the list of admissions associated with the specified point of care, localized for the given locale.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of care whose admissions are being queried.</param>
|
||||
/// <param name="locale">The locale used to localize the returned admission data.</param>
|
||||
/// <returns>A task that resolves to the list of admissions matching the point of care and locale; an empty list when no matches are found.</returns>
|
||||
Task<List<Admission>> GetAdmissionByPointOfCareIdAndLocale(ObjectId pocId, LocaleEnum locale);
|
||||
/// <summary>
|
||||
/// Retrieves a list of admissions associated with the specified unit identifier, excluding any Point of Care (PoC) related admissions.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose admissions should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of admissions for the specified unit, excluding PoC admissions.</returns>
|
||||
Task<List<Admission>> GetAdmissionByUnitIdWithOutPoC(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of admissions associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The MongoDB ObjectId of the unit whose admissions should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total count of admissions for the given unit.</returns>
|
||||
Task<long> CountAdmissionsByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Searches for a patient by their patient number within the specified unit, returning the matching patient search result or null if no match is found.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The patient number used to identify the patient.</param>
|
||||
/// <param name="unitId">The identifier of the unit in which the patient is being searched.</param>
|
||||
/// <returns>A task that returns the matching <see cref="PatientSearch"/> if found; otherwise, null.</returns>
|
||||
Task<PatientSearch?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves the admission record associated with the specified patient number, returning <c>null</c> when no matching admission is found.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient 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 exists for the given patient number.</returns>
|
||||
Task<Admission?> GetAdmissionByPatientNumber(string patientNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a patient master list item based on the provided option change and related unit and type information.
|
||||
/// </summary>
|
||||
/// <param name="opt">The update option master list data transfer object containing the change details.</param>
|
||||
/// <param name="unitList">The collection of units associated with the master list item change.</param>
|
||||
/// <param name="typeName">The name of the type used to identify the master list item category.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes a patient master list item identified by the specified options, units, and type name.
|
||||
/// </summary>
|
||||
/// <param name="opt">The option list used to identify the master list item to delete.</param>
|
||||
/// <param name="unitList">The collection of units associated with the master list item.</param>
|
||||
/// <param name="typeName">The name of the type associated with the master list item.</param>
|
||||
Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName);
|
||||
}
|
||||
@@ -8,23 +8,73 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IAlarmService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the most recent patient observations for the specified patient, optionally filtered by a set of fields.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose last observations should be retrieved.</param>
|
||||
/// <param name="filterObservations">An optional list of fields to restrict the returned observations; when null, no field filter is applied.</param>
|
||||
/// <returns>A task that resolves to the list of the patient's most recent <see cref="PatientObservationAlarm"/> records.</returns>
|
||||
public Task<List<PatientObservationAlarm>> FindLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null);
|
||||
List<Field>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent non-expired patient observation alarms for a specific patient, based on the provided alarm fields and configuration.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose alarms are being queried.</param>
|
||||
/// <param name="dataAlarmfields">The list of fields used to identify and filter the patient observation alarm data.</param>
|
||||
/// <param name="configAlarm">The list of configuration observations that define the alarm criteria, including expiration rules.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of the latest non-expired <see cref="PatientObservationAlarm"/> entries for the patient.</returns>
|
||||
Task<List<PatientObservationAlarm>> FindLastValuesNotExpired(ObjectId patientId, List<Field> dataAlarmfields,
|
||||
List<ConfigObservation> configAlarm);
|
||||
List<ConfigObservation> configAlarm);
|
||||
|
||||
/// <summary>
|
||||
/// Maps a patient observation alarm, optionally restricting the lookup to name-based matching only. Returns a null result when no matching alarm is found.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation alarm to be mapped.</param>
|
||||
/// <param name="onlyByName">When true, limits the mapping to lookups performed by name only.</param>
|
||||
/// <returns>A task that resolves to the mapped patient observation alarm, or null if no corresponding alarm is found.</returns>
|
||||
public Task<PatientObservationAlarm?> MapObservation(PatientObservationAlarm obs, bool onlyByName = false);
|
||||
/// <summary>
|
||||
/// Maps the given patient observation alarm to a corresponding record by name, returning a null result when no matching observation is found.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation alarm to be mapped by name.</param>
|
||||
/// <returns>A task containing the mapped <see cref="PatientObservationAlarm"/>, or <c>null</c> if no matching observation exists.</returns>
|
||||
public Task<PatientObservationAlarm?> MapObservationsByName(PatientObservationAlarm obs);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously calculates an alarm test result based on the provided patient observation value.
|
||||
/// </summary>
|
||||
/// <param name="source">The base patient observation value used as input for the alarm evaluation.</param>
|
||||
/// <param name="name">The name that identifies the alarm test to be calculated.</param>
|
||||
Task CalculateAlarmTest(BasePatientObservationValue source, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an alarm notification associated with the specified patient observation, using the provided name, optional code, severity, and type.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation that triggers the alarm.</param>
|
||||
/// <param name="name">The display name of the alarm.</param>
|
||||
/// <param name="code">The optional alarm code identifier, or null when not applicable.</param>
|
||||
/// <param name="severity">The severity level assigned to the alarm.</param>
|
||||
/// <param name="type">The type category of the alarm.</param>
|
||||
/// <returns>A task that represents the asynchronous alarm sending operation.</returns>
|
||||
Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code, AlarmEnum.Severity severity,
|
||||
AlarmEnum.Type type);
|
||||
AlarmEnum.Type type);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously checks the observation alarm for the specified patient observation.
|
||||
/// </summary>
|
||||
/// <param name="obs4">The patient observation to evaluate for alarm conditions.</param>
|
||||
Task CheckObservationAlarm(PatientObservation obs4);
|
||||
|
||||
/// <summary>
|
||||
/// Processes a collection of patient observation alarms, associating them with the corresponding observations and patient, and recording the processing time.
|
||||
/// </summary>
|
||||
/// <param name="alarmObservations">The list of patient observation alarms to be processed.</param>
|
||||
/// <param name="observations">The list of patient observations related to the alarms.</param>
|
||||
/// <param name="patient">The patient to whom the observations and alarms belong.</param>
|
||||
/// <param name="messageTime">The timestamp associated with the message being processed.</param>
|
||||
/// <param name="observationData">Optional additional observation data used during processing.</param>
|
||||
Task ProcessAlarmObservations(List<PatientObservationAlarm> alarmObservations,
|
||||
List<PatientObservation> observations, Patient patient,
|
||||
DateTime messageTime, ObservationData? observationData = null);
|
||||
List<PatientObservation> observations, Patient patient,
|
||||
DateTime messageTime, ObservationData? observationData = null);
|
||||
}
|
||||
@@ -5,5 +5,11 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IAlertValuesService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously finds a <see cref="ConfigObservation"/> identified by the specified key.
|
||||
/// Returns <c>null</c> when no matching configuration observation exists.
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier of the configuration observation to look up.</param>
|
||||
/// <returns>A task that yields the matching <see cref="ConfigObservation"/>, or <c>null</c> if no record is found.</returns>
|
||||
Task<ConfigObservation?> FindByKey(ObjectId key);
|
||||
}
|
||||
@@ -7,14 +7,64 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IAppointmentService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of patient appointments associated with the specified location.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to filter and locate the relevant appointments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> items matching the given location.</returns>
|
||||
Task<List<PatientAppointment>> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Retrieves all appointments associated with the specified patient asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The 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"/> entries for the patient.</returns>
|
||||
Task<List<PatientAppointment>> GetByPatient(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of patient appointments scheduled for today for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose appointments are being queried.</param>
|
||||
/// <param name="ct">A cancellation token to observe while waiting for the task to complete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> entries for the given patient for the current day.</returns>
|
||||
Task<List<PatientAppointment>> GetTodayByPatient(ObjectId patientId, CancellationToken ct = default);
|
||||
/// <summary>
|
||||
/// Retrieves the list of patient appointments scheduled for today at the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of care whose appointments will be returned.</param>
|
||||
/// <param name="ct">The cancellation token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of today's patient appointments for the specified point of care.</returns>
|
||||
Task<List<PatientAppointment>> GetTodayByPoc(ObjectId pocId, CancellationToken ct = default);
|
||||
/// <summary>
|
||||
/// Asynchronously finds all <see cref="PatientAppointment"/> records 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 an <see cref="IAsyncCursor{TDocument}"/> for iterating over the matching <see cref="PatientAppointment"/> documents.</returns>
|
||||
Task<IAsyncCursor<PatientAppointment>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the specified patient, marking the record as archived in the system.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose record should be archived.</param>
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously archives records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the patient whose related records should be archived.</param>
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Deletes a record associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the patient whose related record should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Processes an incoming API request in the context of the specified patient, handling the required business logic and returning when the processing completes.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be processed.</param>
|
||||
/// <param name="patient">The patient associated with the API request.</param>
|
||||
Task ProcessApiRequest(ApiRequest apiRequest, Patient patient);
|
||||
/// <summary>
|
||||
/// Updates multiple records by replacing the old <see cref="ObjectId"/> with the new one for the field identified by <paramref name="nameId"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The name of the field whose <see cref="ObjectId"/> value should be updated.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to set on matching records.</param>
|
||||
/// <param name="oldId">The existing <see cref="ObjectId"/> value to be replaced.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
}
|
||||
@@ -5,15 +5,43 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IArchivePatientCarePlanService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a list of patient care plans associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose care plans are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="PatientCarePlan"/> objects if found, or <c>null</c> if no care plans exist for the patient.</returns>
|
||||
Task<List<PatientCarePlan>?> FindByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the list of care plans associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose care plans should be retrieved.</param>
|
||||
/// <returns>A task that returns a list of <see cref="PatientCarePlan"/> records for the patient, or <c>null</c> if no care plans are found.</returns>
|
||||
Task<List<PatientCarePlan>?> FindByPatientId(string id);
|
||||
/// <summary>
|
||||
/// Retrieves a list of patient care plans associated with the specified patient number.
|
||||
/// </summary>
|
||||
/// <param name="id">The patient number used to locate the associated care plans.</param>
|
||||
/// <returns>A task that returns a list of <see cref="PatientCarePlan"/> for the given patient number, or <c>null</c> if no care plans are found.</returns>
|
||||
Task<List<PatientCarePlan>?> FindByPatientNumber(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patient care plans.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> objects.</returns>
|
||||
Task<List<PatientCarePlan>> FindAll();
|
||||
|
||||
// Task<PatientCarePlan?> UpdateTreatment(PatientCarePlan patientCarePla, List<OptionList> options);
|
||||
// Task<PatientCarePlan?> UpdateProcedure(PatientCarePlan patientCarePla, List<OptionList> options);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single patient care plan and returns the inserted entity, or null if the insert did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePla">The patient care plan to insert.</param>
|
||||
/// <returns>A <see cref="Task{PatientCarePlan}"/> that represents the asynchronous insert operation, containing the inserted <see cref="PatientCarePlan"/> or null if no entity was returned.</returns>
|
||||
Task<PatientCarePlan?> InsertOneAsync(PatientCarePlan patientCarePla);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a collection of patient care plans into the data store in a single bulk operation.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePla">The list of <see cref="PatientCarePlan"/> entities to be inserted.</param>
|
||||
Task InsertManyAsync(List<PatientCarePlan> patientCarePla);
|
||||
|
||||
// Task Update(PatientCarePlan oldPatientCarePla, PatientCarePlan newPatientCarePla);
|
||||
|
||||
@@ -5,5 +5,10 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IArchivedPatientObservationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of archived patient observations associated with the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose archived observations are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservation"/> objects representing the archived observations for the patient.</returns>
|
||||
public Task<List<PatientObservation>> FindArchivedPatientObservationsFromPatient(ObjectId patientId);
|
||||
}
|
||||
@@ -4,5 +4,9 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IArchivedPatientService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all patients.</returns>
|
||||
public Task<List<Patient>> FindAllPatients();
|
||||
}
|
||||
@@ -5,5 +5,10 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IArchivedPatientTreatmentService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves all patient treatment records associated with the specified patient asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments are being retrieved.</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>> FindAllPatientTreatmentsByPatient(ObjectId patientId);
|
||||
}
|
||||
@@ -6,10 +6,38 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IAuthService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the current login response, returning <c>null</c> when no login state is available.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the current <see cref="LoginResponse"/>, or <c>null</c> if no login response exists.</returns>
|
||||
Task<LoginResponse?> GetLoginResponse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a token.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the retrieved token string.</returns>
|
||||
Task<string> GetToken();
|
||||
/// <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 queried.</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);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the record identified by the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayId">The display identifier of the record to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating whether the record was successfully deleted.</returns>
|
||||
Task<bool> DeleteByDisplayId(ObjectId displayId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose associated entity should be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating whether the deletion was successful.</returns>
|
||||
Task<bool> DeleteByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of authorizations associated with the specified user identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the user whose authorizations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of authorizations for the user.</returns>
|
||||
Task<List<Authorization>> GetUserAuthorities(ObjectId id);
|
||||
}
|
||||
@@ -6,34 +6,111 @@ namespace adas_core.Application.Services.Interfaces
|
||||
public interface ICacheService
|
||||
{
|
||||
//Métodos básicos
|
||||
/// <summary>
|
||||
/// Stores the specified value associated with the given key.
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier used to associate the value.</param>
|
||||
/// <param name="value">The value to store for the specified key.</param>
|
||||
void SetValue(string key, string value);
|
||||
/// <summary>
|
||||
/// Retrieves the string value associated with the specified key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key used to look up the value.</param>
|
||||
/// <returns>The value associated with the key, or <c>null</c> if the key is not found.</returns>
|
||||
string? GetValue(string key);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an object associated with the specified <paramref name="key"/>, returning null if no entry is found.
|
||||
/// When <paramref name="updateExpiration"/> is true, the expiration of the retrieved entry is extended upon access.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier of the object to retrieve.</param>
|
||||
/// <param name="updateExpiration">Indicates whether the expiration of the entry should be extended when it is successfully retrieved. Defaults to true.</param>
|
||||
/// <returns>A task that represents the asynchronous retrieval operation. The task result contains the object of type <typeparamref name="T"/> associated with the key, or null if no matching entry exists.</returns>
|
||||
Task<T?> GetObjectAsync<T>(string key, bool updateExpiration = true);
|
||||
/// <summary>
|
||||
/// Asynchronously stores an object of type <typeparamref name="T"/> using the specified key, optionally updating its expiration time.
|
||||
/// When <paramref name="updateExpiration"/> is true, the entry's expiration is refreshed; otherwise the existing expiration is preserved.
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier under which the object will be stored.</param>
|
||||
/// <param name="obj">The object to be stored.</param>
|
||||
/// <param name="updateExpiration">Specifies whether the expiration time of the entry should be refreshed. Defaults to true.</param>
|
||||
Task SetObjectAsync<T>(string key, T obj, bool updateExpiration = true);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an object of type <typeparamref name="T"/> associated with the specified <paramref name="key"/>.
|
||||
/// Supports an optional <paramref name="ttlOverride"/> to apply a custom time-to-live and an <paramref name="updateExpiration"/> flag
|
||||
/// to control whether the entry's expiration is refreshed on access.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier of the object to retrieve.</param>
|
||||
/// <param name="ttlOverride">An optional time-to-live value that overrides the default expiration period; if <see langword="null"/>, the default TTL is used.</param>
|
||||
/// <param name="updateExpiration">A value indicating whether the object's expiration should be extended when it is successfully retrieved.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous operation, containing the retrieved object of type <typeparamref name="T"/>, or <see langword="null"/> if the object is not found.</returns>
|
||||
Task<T?> GetObjectAsync<T>(string key, TimeSpan? ttlOverride, bool updateExpiration);
|
||||
/// <summary>
|
||||
/// Asynchronously stores the specified object associated with the given key, using an optional time-to-live override and expiration update behavior.
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier under which the object will be stored.</param>
|
||||
/// <param name="obj">The object to store.</param>
|
||||
/// <param name="ttlOverride">An optional <see cref="TimeSpan"/> that overrides the default time-to-live for the stored object.</param>
|
||||
/// <param name="updateExpiration">A value indicating whether the expiration of the stored object should be updated based on the provided TTL.</param>
|
||||
/// <returns>A <see cref="Task"/> that represents the asynchronous storage operation.</returns>
|
||||
Task SetObjectAsync<T>(string key, T obj, TimeSpan? ttlOverride, bool updateExpiration);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes an object identified by the specified key.
|
||||
/// </summary>
|
||||
/// <param name="key">The unique identifier of the object to delete.</param>
|
||||
Task DeleteObjectAsync(string key);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes entries matching the specified pattern and returns the number of deleted items.
|
||||
/// </summary>
|
||||
/// <param name="pattern">The pattern used to match the entries to be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains the total number of entries that were deleted.</returns>
|
||||
Task<long> DeleteByPatternAsync(string pattern);
|
||||
/// <summary>
|
||||
/// Clears the application cache, removing all cached entries.
|
||||
/// </summary>
|
||||
void CleanCache();
|
||||
|
||||
|
||||
// Métodos para transparencia y gestión de locks
|
||||
|
||||
// GetOrSet (string key)
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a cached value for the specified key, or loads and stores it using the provided loader function when the key is not present.
|
||||
/// </summary>
|
||||
/// <param name="key">The cache key used to identify the stored value.</param>
|
||||
/// <param name="loader">The asynchronous function invoked to produce the value when no cached entry exists for the specified key.</param>
|
||||
/// <param name="ttlOverride">An optional time-to-live duration that overrides the default expiration for the cached entry; when <c>null</c>, the default TTL is used.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is the cached or freshly loaded string value, or <c>null</c> when no value is available.</returns>
|
||||
Task<string?> GetOrSetValueAsync(string key, Func<Task<string>> loader, TimeSpan? ttlOverride = null);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an object associated with the specified key from the cache, or invokes the factory to create and cache a new one when the key is not found.
|
||||
/// </summary>
|
||||
/// <param name="key">The cache key used to identify the stored object.</param>
|
||||
/// <param name="factory">The asynchronous function executed to produce the object when no cached value exists for the given key.</param>
|
||||
/// <param name="ttl">The optional expiration period for the cached entry; if null, the default cache lifetime is applied.</param>
|
||||
/// <param name="cancellationToken">The token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that resolves to the cached or newly created object of type <typeparamref name="T"/>.</returns>
|
||||
Task<T> GetOrSetObjectAsync<T>(
|
||||
string key,
|
||||
Func<Task<T>> factory,
|
||||
TimeSpan? ttl = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
string key,
|
||||
Func<Task<T>> factory,
|
||||
TimeSpan? ttl = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
// GetOrSet especializado para GroupedObservations
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a cached object identified by the patient and grouped field, or creates and stores it via the supplied factory when no cached value exists.
|
||||
/// </summary>
|
||||
/// <param name="groupedField">The grouped field used to categorize and identify the cached object.</param>
|
||||
/// <param name="patientId">The identifier of the patient the object is associated with.</param>
|
||||
/// <param name="factory">The asynchronous factory delegate invoked to produce the object when it is not found in the cache.</param>
|
||||
/// <param name="ttl">The optional time-to-live duration applied to the cached entry.</param>
|
||||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
||||
/// <returns>A task containing the cached or newly created object of type <typeparamref name="T"/>.</returns>
|
||||
Task<T> GetOrSetObjectAsync<T>(
|
||||
GroupedField groupedField,
|
||||
ObjectId patientId,
|
||||
Func<Task<T>> factory,
|
||||
TimeSpan? ttl = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
GroupedField groupedField,
|
||||
ObjectId patientId,
|
||||
Func<Task<T>> factory,
|
||||
TimeSpan? ttl = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,21 +7,78 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ICalculatedObservations
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously maps a patient observation to a corresponding target type, optionally restricting the mapping to name-based matching only.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source patient observation to be mapped.</param>
|
||||
/// <param name="onlyByName">When set to <c>true</c>, the mapping is performed considering only the observation name; otherwise, additional mapping criteria are applied. Defaults to <c>false</c>.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that represents the asynchronous mapping operation. The result is the mapped observation of type <typeparamref name="T"/>, or <c>null</c> when no matching mapping is found.</returns>
|
||||
Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation;
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <paramref name="treatment"/> to a <see cref="PatientTreatment"/> result.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment instance to map.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation. The task result contains the mapped <see cref="PatientTreatment"/>.</returns>
|
||||
Task<PatientTreatment> Map(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Asynchronously maps a <see cref="PatientDiagnosis"/> to a <see cref="PatientDiagnosis"/> representation.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The patient diagnosis to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the mapped <see cref="PatientDiagnosis"/>.</returns>
|
||||
Task<PatientDiagnosis> Map(PatientDiagnosis diagnosis);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <see cref="PumpObservation"/> to a <see cref="PumpObservation"/> result.
|
||||
/// </summary>
|
||||
/// <param name="pumpObservation">The <see cref="PumpObservation"/> to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> representing the asynchronous operation, containing the mapped <see cref="PumpObservation"/>.</returns>
|
||||
Task<PumpObservation> Map(PumpObservation pumpObservation);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously calculates a medicine observation for a patient based on their active medicines.
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of medicines currently active for the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observation is being calculated.</param>
|
||||
Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the active bolus for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active bolus is to be calculated.</param>
|
||||
Task CalculateActiveBolus(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the active treatments associated with a specific patient by their unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of nullable <see cref="PatientTreatment"/> entries that represent the active treatments for the specified patient.</returns>
|
||||
Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Resolves time inconsistencies between the new observation and the last stored observation, returning a corrected version when applicable.
|
||||
/// </summary>
|
||||
/// <param name="newObservation">The new patient observation to validate and reconcile against the previous observation's time information.</param>
|
||||
/// <returns>A task that yields the fixed <see cref="PatientObservation"/>, or <c>null</c> when no time inconsistency is detected or no correction is required.</returns>
|
||||
Task<PatientObservation?> FixTimeInconsistencyWithLast(PatientObservation newObservation);
|
||||
/// <summary>
|
||||
/// Performs pre-insertion mapping on a list of patient observations, transforming or preparing the data before it is persisted.
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be pre-mapped prior to insertion.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the mapped list of patient observations.</returns>
|
||||
Task<List<PatientObservation>> PreMapList(List<PatientObservation> listToInsert);
|
||||
/// <summary>
|
||||
/// Maps the source alarm onto the specified patient observation and returns the resulting observation.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation to which the source alarm will be mapped.</param>
|
||||
/// <param name="alarmToInsert">The patient observation alarm to insert and map as the source alarm.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the patient observation with the source alarm mapped.</returns>
|
||||
Task<PatientObservation> MapSourceAlarm(PatientObservation obs, PatientObservationAlarm alarmToInsert);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an alarm associated with the specified patient observation, optionally classified by an alarm code.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation that triggered the alarm.</param>
|
||||
/// <param name="name">The name associated with the alarm.</param>
|
||||
/// <param name="code">An optional alarm code categorizing the type of alarm to send.</param>
|
||||
Task SendAlarm(PatientObservation obs, string name, AlarmEnum.Name? code);
|
||||
}
|
||||
@@ -6,15 +6,77 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ICalculatedObservationsService
|
||||
{
|
||||
/// <summary>
|
||||
/// Maps a <see cref="PatientObservation"/> to a corresponding <see cref="PatientObservation"/>, typically resolved through a lookup or translation process.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source <see cref="PatientObservation"/> to be mapped.</param>
|
||||
/// <param name="onlyByName">When <c>true</c>, restricts the mapping to be performed by name only; otherwise, additional criteria are used.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> that resolves to the mapped <see cref="PatientObservation"/>, or <c>null</c> if no match is found.</returns>
|
||||
Task<PatientObservation?> Map(PatientObservation obs, bool onlyByName = false);
|
||||
/// <summary>
|
||||
/// Asynchronously maps a <see cref="PatientObservationAlarm"/> instance, optionally performing the mapping
|
||||
/// by name only when <paramref name="onlyByName"/> is <c>true</c>. Returns <c>null</c> when no matching
|
||||
/// alarm can be resolved based on the selected lookup strategy.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source patient observation alarm to map.</param>
|
||||
/// <param name="onlyByName">When <c>true</c>, restricts the mapping to match by name only; otherwise the
|
||||
/// full mapping logic is applied. Defaults to <c>false</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the mapped
|
||||
/// <see cref="PatientObservationAlarm"/>, or <c>null</c> if no mapping is found.</returns>
|
||||
Task<PatientObservationAlarm?> Map(PatientObservationAlarm obs, bool onlyByName = false);
|
||||
/// <summary>
|
||||
/// Maps a <see cref="PatientTreatment"/> instance to a projected <see cref="PatientTreatment"/> representation asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The source <see cref="PatientTreatment"/> to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{PatientTreatment}"/> that represents the asynchronous mapping operation. The result is the mapped <see cref="PatientTreatment"/>, or <see langword="null"/> if no mapping could be produced.</returns>
|
||||
Task<PatientTreatment?> Map(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Maps the provided <see cref="PumpObservation"/> to a <see cref="PumpObservation"/> result, returning <see langword="null"/> when no mapping is produced.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source <see cref="PumpObservation"/> to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the mapped <see cref="PumpObservation"/>, or <see langword="null"/> if the mapping yields no result.</returns>
|
||||
Task<PumpObservation?> Map(PumpObservation obs);
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <see cref="PatientRecordingAlert"/> to a resulting <see cref="PatientRecordingAlert"/>, returning <see langword="null"/> when no mapping is produced.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source <see cref="PatientRecordingAlert"/> instance to map.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that contains the mapped <see cref="PatientRecordingAlert"/>, or <see langword="null"/> if the source cannot be mapped.</returns>
|
||||
Task<PatientRecordingAlert?> Map(PatientRecordingAlert obs);
|
||||
/// <summary>
|
||||
/// Maps a <see cref="PatientDiagnosis"/> instance to its corresponding representation, returning <see langword="null"/> when no mapping is available.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source <see cref="PatientDiagnosis"/> to map.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> containing the mapped <see cref="PatientDiagnosis"/>, or <see langword="null"/> if the source cannot be mapped.</returns>
|
||||
Task<PatientDiagnosis?> Map(PatientDiagnosis obs);
|
||||
/// <summary>
|
||||
/// Maps a list of patient observations for insertion, returning the transformed list asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="listToInsert">The list of patient observations to be mapped for insertion.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the mapped list of patient observations.</returns>
|
||||
Task<List<PatientObservation>> MapList(List<PatientObservation> listToInsert);
|
||||
/// <summary>
|
||||
/// Asynchronously calculates the bolus dose of opiates for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient for whom the bolus opiates calculation is performed.</param>
|
||||
Task CalculateBolusOpiates(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously calculates medicine observations for a patient based on their active medicines.
|
||||
/// </summary>
|
||||
/// <param name="activeMedicines">The list of medicines currently active for the patient.</param>
|
||||
/// <param name="patientId">The unique identifier of the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous calculation operation.</returns>
|
||||
Task CalculateMedicineObservation(List<Medicine> activeMedicines, ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves the active patient treatments associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of active PatientTreatment entries for the patient.</returns>
|
||||
Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id);
|
||||
/// <summary>
|
||||
/// Maps a source alarm from a <see cref="PatientObservationAlarm"/> onto a <see cref="PatientObservation"/>, producing an observation enriched with the corresponding alarm information.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation that serves as the base for the mapping.</param>
|
||||
/// <param name="observationAlarm">The source alarm whose data is mapped onto the observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="PatientObservation"/> populated with the mapped alarm data.</returns>
|
||||
Task<PatientObservation> MapSourceAlarm(PatientObservation observation, PatientObservationAlarm observationAlarm);
|
||||
}
|
||||
@@ -7,11 +7,48 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ICameraService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the camera associated with the specified relay identifier.
|
||||
/// </summary>
|
||||
/// <param name="relayId">The unique identifier of the relay used to look up the camera.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Camera"/> if a matching record is found; otherwise, <c>null</c>.</returns>
|
||||
Task<Camera?> GetById(ObjectId relayId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of cameras associated with the specified configuration relay identifiers.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of configuration relay object identifiers used to look up the associated cameras.</param>
|
||||
/// <returns>A list of cameras that correspond to the provided configuration relay identifiers.</returns>
|
||||
List<Camera> GetCameraInList(List<ObjectId> configurationRelayList);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of cameras based on the provided pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing the page size, page number, and optional search criteria used to query cameras.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PaginationResponse{Camera}"/> with the requested page of cameras and pagination metadata.</returns>
|
||||
Task<PaginationResponse<Camera>> GetPaginatedCameras(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Inserts a new camera into the system asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="camera">The camera entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the inserted camera with its generated identifier, or <c>null</c> if the camera could not be inserted.</returns>
|
||||
Task<Camera?> InsertCamera(Camera camera);
|
||||
/// <summary>
|
||||
/// Updates an existing camera identified by the specified object identifier with the provided camera data.
|
||||
/// Returns <see langword="null"/> when no camera with the given identifier exists.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the camera to update.</param>
|
||||
/// <param name="camera">The camera data containing the updated values to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated camera, or <see langword="null"/> if the camera was not found.</returns>
|
||||
Task<Camera?> UpdateCameraById(ObjectId objectId, Camera camera);
|
||||
/// <summary>
|
||||
/// Deletes a camera identified by the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the camera to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The result is <c>true</c> if the camera was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteCamera(ObjectId objectId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of cameras whose names match the specified search text.
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The text used to search camera names.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Camera"/> objects matching the search criteria; an empty list is returned if no matches are found.</returns>
|
||||
Task<List<Camera>> GetSearchByNameCameras(string textToSearch);
|
||||
}
|
||||
@@ -6,8 +6,30 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IClientMessageService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously sends a message to the specified receiver, optionally categorized by an operation type.
|
||||
/// </summary>
|
||||
/// <param name="receiverId">The identifier of the intended message receiver.</param>
|
||||
/// <param name="type">The optional operation type used to classify the message.</param>
|
||||
/// <param name="msg">The optional message payload to be sent.</param>
|
||||
/// <returns>A task that represents the asynchronous send operation.</returns>
|
||||
Task SendAsync(string receiverId, OperationType? type, object? msg);
|
||||
/// <summary>
|
||||
/// Asynchronously broadcasts a message of the specified operation type to all connected recipients.
|
||||
/// </summary>
|
||||
/// <param name="type">The operation type that classifies the broadcast message.</param>
|
||||
/// <param name="msg">The message payload to send, or <c>null</c> when no payload is required.</param>
|
||||
/// <returns>A task that represents the asynchronous broadcast operation.</returns>
|
||||
Task SendToAllAsync(OperationType type, object? msg);
|
||||
/// <summary>
|
||||
/// Processes an incoming message within the context of the specified connection.
|
||||
/// </summary>
|
||||
/// <param name="msg">The message to be processed.</param>
|
||||
/// <param name="contextConnectionId">The identifier of the connection context associated with the message.</param>
|
||||
Task ProcessMessage(Message msg, string contextConnectionId);
|
||||
/// <summary>
|
||||
/// Sends an update message to the specified list of patient location boxes.
|
||||
/// </summary>
|
||||
/// <param name="boxes">The list of patient locations that will receive the update message.</param>
|
||||
void SendUpdateMessageToBoxes(List<PatientLocation> boxes);
|
||||
}
|
||||
@@ -12,33 +12,149 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IConfigObservationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="ConfigObservation"/> identified by the specified coding system and code.
|
||||
/// Returns <c>null</c> when no matching configuration observation is found.
|
||||
/// </summary>
|
||||
/// <param name="codingSystem">The coding system used to identify the configuration observation (e.g., ICD, SNOMED).</param>
|
||||
/// <param name="code">The code within the given coding system that uniquely identifies the configuration observation.</param>
|
||||
/// <returns>A <see cref="ConfigObservation"/> if a match is found; otherwise, <c>null</c>.</returns>
|
||||
Task<ConfigObservation?> GetByCodeSysAndCode(string codingSystem, string code);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="ConfigObservation"/> identified by the given name.
|
||||
/// Returns <see langword="null"/> when no matching configuration observation is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the configuration observation to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="ConfigObservation"/>, or <see langword="null"/> if no observation is found.</returns>
|
||||
Task<ConfigObservation?> Get(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the <see cref="ConfigObservation"/> associated with the specified patient observation, optionally restricting the lookup to a match performed by name only.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation whose corresponding configuration observation is being requested.</param>
|
||||
/// <param name="onlyByName">When <c>true</c>, limits the lookup to a name-based match; otherwise, other matching criteria may be applied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigObservation"/>, or <c>null</c> if no matching observation is found.</returns>
|
||||
Task<ConfigObservation?> Get<T>(T obs, bool onlyByName = false) where T : BasePatientObservation;
|
||||
|
||||
/// <summary>
|
||||
/// Performs retention actions for the specified patient observation and returns the resulting retention outcome.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation of type <typeparamref name="T"/> on which retention actions will be executed.</param>
|
||||
/// <returns>A task that represents the asynchronous retention operation. The task result contains the <see cref="ObservatitonRetentionResult"/> produced by the retention actions, or <c>null</c> when no retention result is produced.</returns>
|
||||
Task<ObservatitonRetentionResult?> RetentionActions<T>(T obs) where T : BasePatientObservation;
|
||||
/// <summary>
|
||||
/// Maps a patient observation to a corresponding target observation of the same type, optionally restricting the lookup to name-based matching only.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source patient observation to be mapped.</param>
|
||||
/// <param name="onlyByName">When set to <c>true</c>, the mapping is performed using the observation's name only; otherwise, additional matching criteria are considered. Defaults to <c>false</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the mapped patient observation of type <typeparamref name="T"/>, or <c>null</c> if no matching observation is found.</returns>
|
||||
Task<T?> Map<T>(T obs, bool onlyByName = false) where T : BasePatientObservation;
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <see cref="PatientTreatment"/> to a populated <see cref="PatientTreatment"/> instance, returning <see langword="null"/> when the treatment cannot be resolved.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The <see cref="PatientTreatment"/> to be mapped.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the mapped <see cref="PatientTreatment"/>, or <see langword="null"/> if no mapping result is available.</returns>
|
||||
Task<PatientTreatment?> Map(PatientTreatment treatment);
|
||||
|
||||
/// <summary>
|
||||
/// Determines the status of a grouped observation field based on the provided result, value, and optional threshold range.
|
||||
/// </summary>
|
||||
/// <param name="groupedField">The grouped field associated with the observation.</param>
|
||||
/// <param name="result">The result of the grouped observation used to evaluate the status.</param>
|
||||
/// <param name="name">The name of the field or value being evaluated.</param>
|
||||
/// <param name="value">The value associated with the grouped observation.</param>
|
||||
/// <param name="min">The optional minimum threshold for the value.</param>
|
||||
/// <param name="max">The optional maximum threshold for the value.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the evaluated <see cref="StatusEnum.Type"/> for the grouped observation.</returns>
|
||||
Task<StatusEnum.Type> GroupedObservationStatus(GroupedField groupedField, GroupedObservationEnum.Result result,
|
||||
string name, object value, double? min, double? max);
|
||||
string name, object value, double? min, double? max);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all configuration observations asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="ct">The cancellation token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="ConfigObservation"/> objects representing all available configurations.</returns>
|
||||
Task<ICollection<ConfigObservation>> GetAllConfigs(CancellationToken ct = default);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of <see cref="ConfigObservation"/> items based on the supplied filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and query criteria used to retrieve the configuration observations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{ConfigObservation}"/> with the requested items and pagination metadata.</returns>
|
||||
Task<PaginationResponse<ConfigObservation>> GetPaginatedItems(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves all configuration observations in a compact format.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation that returns a <see cref="ConfigObservationDto"/> containing the compact representation of all configuration observations.</returns>
|
||||
Task<ConfigObservationDto> GetAllCompact();
|
||||
/// <summary>
|
||||
/// Retrieves a configuration observation by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration observation to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ConfigObservation"/> if a matching record is found, or <c>null</c> if no configuration exists for the specified id.</returns>
|
||||
Task<ConfigObservation?> GetConfigById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of configuration names associated with the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier used to look up the associated configuration names.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains 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 a list of configuration names.</returns>
|
||||
Task<List<string>> GetConfigNames();
|
||||
/// <summary>
|
||||
/// Updates an existing configuration observation and returns the updated result.
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The configuration observation containing the data to update.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="ConfigObservation"/>, or <c>null</c> when no matching configuration is found.</returns>
|
||||
Task<ConfigObservation?> UpdateConfig(ConfigObservation configObservation);
|
||||
/// <summary>
|
||||
/// Asynchronously creates a new configuration based on the provided observation data.
|
||||
/// </summary>
|
||||
/// <param name="configObservation">The observation data used to create the configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the created <see cref="ConfigObservation"/>, or <c>null</c> if the configuration could not be created.</returns>
|
||||
Task<ConfigObservation?> CreateConfig(ConfigObservation configObservation);
|
||||
/// <summary>
|
||||
/// Asynchronously removes the configuration item with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="itemName">The name of the configuration item to remove.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="ConfigObservation"/> describing the removed item, or <c>null</c> if no matching item was found.</returns>
|
||||
Task<ConfigObservation?> RemoveConfigItem(string itemName);
|
||||
/// <summary>
|
||||
/// Asynchronously removes the configuration item identified by the specified identifier and returns the resulting observation.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the configuration item to remove.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ConfigObservation"/> describing the removed configuration item, or <c>null</c> if no matching item was found.</returns>
|
||||
Task<ConfigObservation?> RemoveConfigItem(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the configuration observation items associated with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the configuration observation items.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result contains a collection of <see cref="ConfigObservation"/> items matching the provided name, or <c>null</c> if no matching items are found.</returns>
|
||||
Task<IEnumerable<ConfigObservation>?> GetConfigObservationItem(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a single configuration observation item based on the provided code, coding system, name, and original name.
|
||||
/// </summary>
|
||||
/// <param name="code">The code used to identify the configuration observation item.</param>
|
||||
/// <param name="codingSystem">The coding system associated with the code.</param>
|
||||
/// <param name="name">The name of the configuration observation item.</param>
|
||||
/// <param name="originalName">The original name of the configuration observation item.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigObservation"/>, or <c>null</c> if no item is found.</returns>
|
||||
Task<ConfigObservation?> GetSingleConfigObservationItem(string? code, string? codingSystem, string? name,
|
||||
string? originalName);
|
||||
string? originalName);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a single configuration observation item from the underlying store.
|
||||
/// </summary>
|
||||
/// <param name="configObservationItem">The configuration observation item to be deleted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the deletion was successful.</returns>
|
||||
Task<bool> DeleteSingleConfigObservationItem(ConfigObservation configObservationItem);
|
||||
/// <summary>
|
||||
/// Retrieves configuration observation items that match the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to filter the configuration observation items.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the collection of <see cref="ConfigObservation"/> items matching the specified name.</returns>
|
||||
Task<IEnumerable<ConfigObservation>> GetConfigObservationItemsByName(string name);
|
||||
}
|
||||
@@ -6,13 +6,53 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IConfigPumpsService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously maps the source PumpObservation to a new PumpObservation instance, transforming its data into the target representation.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source PumpObservation to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting PumpObservation.</returns>
|
||||
Task<PumpObservation> Map(PumpObservation obs);
|
||||
/// <summary>
|
||||
/// Retrieves all available pump configurations from the configuration store.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of <see cref="ConfigPumps"/> with all pump configurations, or <c>null</c> if no configurations are available.</returns>
|
||||
Task<List<ConfigPumps>?> GetAllPumpConfigs();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the configuration pump items associated with the specified identifier.
|
||||
/// Returns null if no configuration items are found for the given id.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier used to look up the configuration items.</param>
|
||||
/// <returns>A task containing a list of ConfigPumpItem objects if found, or null if no items exist for the specified id.</returns>
|
||||
Task<List<ConfigPumpItem>?> GetConfigItems(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the pump configuration that matches the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the pump configuration to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ConfigPumps"/> configuration if found; otherwise, <c>null</c> when no configuration exists for the given identifier.</returns>
|
||||
Task<ConfigPumps?> GetPumpConfigById(string id);
|
||||
/// <summary>
|
||||
/// Updates the pump configuration asynchronously and returns the updated configuration.
|
||||
/// </summary>
|
||||
/// <param name="pumpConfig">The pump configuration to update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="ConfigPumps"/>, or <c>null</c> if the configuration was not found.</returns>
|
||||
Task<ConfigPumps?> UpdatePumpConfig(ConfigPumps pumpConfig);
|
||||
/// <summary>
|
||||
/// Inserts a new pump configuration into the data store.
|
||||
/// </summary>
|
||||
/// <param name="pumpConfig">The pump configuration to insert.</param>
|
||||
/// <returns>The inserted <see cref="ConfigPumps"/> entity, or <c>null</c> if the insertion was not performed.</returns>
|
||||
Task<ConfigPumps?> InsertPumpConfig(ConfigPumps pumpConfig);
|
||||
/// <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 a boolean indicating whether the deletion was successful.</returns>
|
||||
Task<bool> DeletePumpConfig(ConfigPumps config);
|
||||
/// <summary>
|
||||
/// Asynchronously evaluates and applies retention actions for a pump observation, returning the resulting retention outcome.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to process for retention actions.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the retention result, or null if no retention action applies.</returns>
|
||||
Task<ObservatitonRetentionResult?> RetentionActions(PumpObservation obs);
|
||||
|
||||
}
|
||||
@@ -5,6 +5,17 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IConfigUnitsService
|
||||
{
|
||||
/// <summary>
|
||||
/// Maps a patient observation of type <typeparamref name="T"/> to a corresponding output representation.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The specific patient observation type, constrained to <see cref="BasePatientObservation"/>.</typeparam>
|
||||
/// <param name="obs">The patient observation instance to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, yielding the mapped patient observation.</returns>
|
||||
Task<T> Map<T>(T obs) where T : BasePatientObservation;
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <see cref="PumpObservation"/> to a resulting <see cref="PumpObservation"/>.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting <see cref="PumpObservation"/>.</returns>
|
||||
Task<PumpObservation> Map(PumpObservation obs);
|
||||
}
|
||||
@@ -6,8 +6,29 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IDeviceService
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Device"/> from the provided <see cref="DeviceDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="device">The data transfer object containing the information used to create the device.</param>
|
||||
/// <returns>A task that represents the asynchronous create operation. The task result contains the created <see cref="Device"/>, or <see langword="null"/> if the device could not be created.</returns>
|
||||
Task<Device?> Create(DeviceDto device);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the object identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the object to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The result is <c>true</c> if the object was deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> Delete(ObjectId objectId);
|
||||
/// <summary>
|
||||
/// Updates an existing device using the provided data transfer object.
|
||||
/// </summary>
|
||||
/// <param name="device">The data transfer object containing the updated device information.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated device, or <c>null</c> if the device was not found.</returns>
|
||||
Task<Device?> Update(DeviceDto device);
|
||||
/// <summary>
|
||||
/// Processes an incoming event for the specified device and returns the associated <see cref="Device"/>.
|
||||
/// Returns <c>null</c> when the device referenced by the event cannot be found.
|
||||
/// </summary>
|
||||
/// <param name="device">The device data transfer object carrying the event information to be processed.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the resolved <see cref="Device"/> or <c>null</c> if no matching device was found.</returns>
|
||||
Task<Device?> ReceiveEvent(DeviceDto device);
|
||||
}
|
||||
@@ -6,12 +6,51 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IDiagnosisService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves all diagnoses associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose diagnoses are being retrieved.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of <see cref="PatientDiagnosis"/> records for the specified patient; an empty list is returned if no diagnoses are found.</returns>
|
||||
Task<List<PatientDiagnosis>> GetByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the specified patient, marking the patient record as archived rather than permanently deleting it.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives the records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose records will be archived.</param>
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Processes a diagnosis observation for the specified patient based on the supplied API request data.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the diagnosis observation payload and contextual information to process.</param>
|
||||
/// <param name="patient">The patient to whom the diagnosis observation pertains.</param>
|
||||
Task ProcessDiagnosisObservation(ApiRequest apiRequest, Patient patient);
|
||||
/// <summary>
|
||||
/// Persists the specified API request along with its associated patient data.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
/// <param name="patient">The patient associated with the API request.</param>
|
||||
Task SaveRequest(ApiRequest apiRequest, Patient patient);
|
||||
/// <summary>
|
||||
/// Processes the provided list of patient diagnoses for the specified patient at the given message time.
|
||||
/// </summary>
|
||||
/// <param name="diagnosis">The list of patient diagnoses to be processed.</param>
|
||||
/// <param name="patient">The patient associated with the diagnoses.</param>
|
||||
/// <param name="messageTime">The timestamp of the message triggering the diagnosis processing.</param>
|
||||
Task ProcessDiagnosis(List<PatientDiagnosis> diagnosis, Patient patient, DateTime messageTime);
|
||||
/// <summary>
|
||||
/// Updates multiple records by replacing the <paramref name="oldId"/> with the new <paramref name="id"/> in the field identified by <paramref name="nameId"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The identifier of the field or property whose ObjectId values will be updated.</param>
|
||||
/// <param name="id">The new ObjectId value to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced in the matching records.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
}
|
||||
@@ -9,19 +9,94 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IDischargeService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a discharge record by its unique identifier, returning null if no matching discharge is found.
|
||||
/// </summary>
|
||||
/// <param name="dischargeId">The unique identifier of the discharge to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Discharge"/> if found, or null when no record matches the provided identifier.</returns>
|
||||
Task<Discharge?> GetDischargeByIdAsync(ObjectId dischargeId);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of discharge records associated with the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose discharges should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total number of discharges for the specified unit.</returns>
|
||||
Task<long> CountDischargesByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a discharge record identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="dischargeId">The unique identifier of the discharge to delete.</param>
|
||||
Task DeleteDischargeByIdAsync(ObjectId dischargeId);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the specified discharge record.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity to be removed.</param>
|
||||
Task DeleteDischargeAsync(Discharge discharge);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing discharge record in the data store.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The <see cref="Discharge"/> entity containing the updated information to persist.</param>
|
||||
Task UpdateDischargeAsync(Discharge discharge);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of discharge records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of <see cref="Discharge"/> objects.</returns>
|
||||
Task<IEnumerable<Discharge>> GetDischargesAsync();
|
||||
/// <summary>
|
||||
/// Inserts a new discharge record into the data store. Returns the inserted <see cref="Discharge"/> entity, or <see langword="null"/> if the record could not be created.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The <see cref="Discharge"/> entity containing the data to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the inserted <see cref="Discharge"/>, or <see langword="null"/> when the insertion does not produce a result.</returns>
|
||||
Task<Discharge?> InsertDischarge(Discharge discharge);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge record associated with the specified patient location, returning null if no matching discharge is found.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to look up the discharge record.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Discharge"/> if found, or null if no discharge is associated with the specified location.</returns>
|
||||
Task<Discharge?> GetDischargeByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge record associated with the specified patient identifier.
|
||||
/// </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"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Discharge?> GetDischargeByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves a discharge record associated with the specified point of care location identifier.
|
||||
/// </summary>
|
||||
/// <param name="location">The ObjectId of the point of care location used to look up the discharge.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Discharge"/> if found, or <c>null</c> if no discharge exists for the specified point of care location.</returns>
|
||||
Task<Discharge?> GetDischargeByPointOfCareId(ObjectId location);
|
||||
/// <summary>
|
||||
/// Retrieves the discharge associated with the specified point of care location, returning localized data for the requested locale.
|
||||
/// Returns null when no matching discharge is found.
|
||||
/// </summary>
|
||||
/// <param name="location">The identifier of the point of care location whose discharge should be retrieved.</param>
|
||||
/// <param name="dataLocale">The locale used to determine the language of the returned discharge data.</param>
|
||||
/// <returns>A task containing the matching <see cref="Discharge"/>, or null if no discharge exists for the given location.</returns>
|
||||
Task<Discharge?> GetDischargeByPointOfCareIdWithLocale(ObjectId location, LocaleEnum dataLocale);
|
||||
/// <summary>
|
||||
/// Sends a broadcast notification for the specified discharge based on the given operation type.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity to be included in the broadcast.</param>
|
||||
/// <param name="operation">The type of operation (e.g., create, update, delete) that determines the broadcast context.</param>
|
||||
void SendDischargeBroadcast(Discharge discharge, OperationType operation);
|
||||
/// <summary>
|
||||
/// Updates a patient master list item change using the provided update options, applying the change across the specified unit list and master list type.
|
||||
/// </summary>
|
||||
/// <param name="opt">The update options describing the change to apply to the patient master list item.</param>
|
||||
/// <param name="unitList">The collection of units to which the master list item change should be applied.</param>
|
||||
/// <param name="typeName">The name of the master list type that identifies which list the item belongs to.</param>
|
||||
Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes the specified patient master list item associated with the given option list and units.
|
||||
/// </summary>
|
||||
/// <param name="opt">The option list containing the patient master list item to delete.</param>
|
||||
/// <param name="unitList">The collection of units associated with the item to be deleted.</param>
|
||||
/// <param name="typeName">The name of the type used to identify the patient master list item.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName);
|
||||
/// <summary>
|
||||
/// Deletes discharge records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose discharge records should be removed.</param>
|
||||
Task DeleteDischargesByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -10,37 +10,194 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IDisplayConfigService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves all display configurations asynchronously.
|
||||
/// </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 list of display configurations in a compact (minimal) representation.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter that controls page size, page number, and sorting criteria.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{T}"/> with the compact display configuration entries.</returns>
|
||||
Task<PaginationResponse<DisplayConfigMinimalResponse>> GetAllCompactPaginated(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Retrieves a list of display configurations filtered by the specified display type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the configurations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="DisplayConfig"/> objects matching the specified type.</returns>
|
||||
Task<List<DisplayConfig>> GetByType(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="DisplayConfig"/> by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="DisplayConfig"/> matching the specified identifier.</returns>
|
||||
Task<DisplayConfig> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="DisplayConfig"/> identified by the specified configuration identifier, unit identifier, and display type.
|
||||
/// </summary>
|
||||
/// <param name="configId">The optional identifier of the display configuration to look up; may be <c>null</c> when searching without a specific configuration.</param>
|
||||
/// <param name="unitId">The identifier of the unit the display configuration belongs to.</param>
|
||||
/// <param name="displayType">The display type used to filter or scope the lookup.</param>
|
||||
/// <returns>A <see cref="Task{DisplayConfig}"/> that resolves to the matching <see cref="DisplayConfig"/>, or <c>null</c> if no configuration is found.</returns>
|
||||
Task<DisplayConfig?> GetById(ObjectId? configId, ObjectId unitId, DisplayConfigEnums.DisplayType displayType);
|
||||
/// <summary>
|
||||
/// Inserts a single display configuration asynchronously and returns the resulting configuration, or null when no record is produced.
|
||||
/// </summary>
|
||||
/// <param name="config">The display configuration to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="DisplayConfig"/> or null.</returns>
|
||||
Task<DisplayConfig?> InsertOne(DisplayConfig config);
|
||||
/// <summary>
|
||||
/// Inserts a new display configuration in a minimal fashion and returns the created <see cref="DisplayConfig"/>, or <c>null</c> when no configuration could be produced.
|
||||
/// </summary>
|
||||
/// <param name="config">The data transfer object containing the values used to create the new display configuration.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the created <see cref="DisplayConfig"/> when successful, or <c>null</c> when no result is available.</returns>
|
||||
Task<DisplayConfig?> InsertOneMinimal(CreateDisplayConfigDto config);
|
||||
/// <summary>
|
||||
/// Performs a test insertion operation that returns a <see cref="DisplayConfig"/> instance, used to validate insertion behavior.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{DisplayConfig}"/> representing the asynchronous test insertion result.</returns>
|
||||
Task<DisplayConfig> InsertOneTest();
|
||||
/// <summary>
|
||||
/// Updates the display configuration identified by the specified identifier with the provided new configuration data.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The unique identifier of the display configuration to update.</param>
|
||||
/// <param name="newDisplayConfig">The new display configuration data to apply to the existing configuration.</param>
|
||||
/// <returns>The updated <see cref="DisplayConfig"/>, or <c>null</c> if no display configuration with the specified identifier is found.</returns>
|
||||
Task<DisplayConfig?> UpdateConfig(ObjectId displayConfigId, object newDisplayConfig);
|
||||
/// <summary>
|
||||
/// Updates the list of fields associated with the specified configuration display.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the configuration display whose field list will be updated.</param>
|
||||
/// <param name="fields">The list of fields to be applied to the configuration display.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a value indicating whether the update was successful.</returns>
|
||||
Task<bool> UpdateFieldList(ObjectId objectIdConfigDisplay, List<Field> fields);
|
||||
/// <summary>
|
||||
/// Updates the color configuration for the specified config display.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the config display whose color configuration will be updated.</param>
|
||||
/// <param name="colorConfigDto">The color configuration data to apply to the config display.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateConfigColor(ObjectId objectIdConfigDisplay, ColorConfig colorConfigDto);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the header configuration associated with the specified config display identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the config display whose header configuration will be updated.</param>
|
||||
/// <param name="headerConfig">The new header configuration to apply.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateHeaderConfig(ObjectId objectIdConfigDisplay, HeaderConfig headerConfig);
|
||||
/// <summary>
|
||||
/// Updates the home banner configuration for the specified config display with the provided list of banner items.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the config display whose home banner will be updated.</param>
|
||||
/// <param name="bannerItems">The list of banner items to set as the home banner configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the home banner was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateSetHomeBanner(ObjectId objectIdConfigDisplay, List<BannerItem> bannerItems);
|
||||
/// <summary>
|
||||
/// Updates the base display configuration with the specified settings.
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The display configuration to apply as the new base configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The task result contains a boolean value indicating whether the update was successful.</returns>
|
||||
Task<bool> UpdateBaseConfig(DisplayConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the hospital name associated with the specified display configuration.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The identifier of the display configuration whose hospital name will be updated.</param>
|
||||
/// <param name="name">The new hospital name to apply to the display configuration.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the update was applied successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateDisplayConfigHospitalName(ObjectId objectIdConfigDisplay, string name);
|
||||
/// <summary>
|
||||
/// Deletes a display configuration identified by the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the display configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result contains a boolean value indicating whether the display configuration was successfully deleted.</returns>
|
||||
Task<bool> DeleteDisplayConfig(ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the default display configuration for the specified display type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to look up the default configuration.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the default <see cref="DisplayConfig"/> for the given display type, or <c>null</c> if no default configuration is available.</returns>
|
||||
Task<DisplayConfig?> GetDefaultConfig(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Retrieves the list of display configuration locations associated with the specified configuration display identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The ObjectId of the configuration display whose locations are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of DisplayConfigLocationDto objects for the specified configuration display.</returns>
|
||||
Task<List<DisplayConfigLocationDto>> GetDisplayConfigLocations(ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all display configurations in a compact (minimal) representation.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="DisplayConfigMinimalResponse"/> objects representing the compact display configurations.</returns>
|
||||
Task<List<DisplayConfigMinimalResponse>> GetAllCompact();
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a new display configuration record using a predefined template, optionally scoped to a specific hospital context.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The identifier of the object the display configuration is associated with.</param>
|
||||
/// <param name="configType">The type of display configuration template to use for the insertion.</param>
|
||||
/// <param name="configHospital">The optional hospital identifier used to scope the configuration; may be null when the configuration is not hospital-specific.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the inserted <see cref="DisplayConfig"/>, or null if the configuration could not be created.</returns>
|
||||
Task<DisplayConfig?> InsertOneWithTemplate(string objectId,
|
||||
DisplayConfigEnums.DisplayType configType, string? configHospital);
|
||||
DisplayConfigEnums.DisplayType configType, string? configHospital);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the card configuration based on the provided settings.
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The card configuration to be updated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the update was successful.</returns>
|
||||
Task<bool> UpdateCardConfig(CardConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Inserts a new card configuration using the supplied data and returns the resulting <see cref="CardConfig"/>, or null if no card config is created.
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The DTO containing the data used to create the display config card.</param>
|
||||
/// <returns>A task that resolves to the inserted <see cref="CardConfig"/>, or null if the insert did not produce a card config.</returns>
|
||||
Task<CardConfig?> InsertCardConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all 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>> GetCardConfigAll();
|
||||
/// <summary>
|
||||
/// Retrieves the card configuration associated with the specified identifier.
|
||||
/// Returns <c>null</c> when no matching card configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the card configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="CardConfig"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<CardConfig?> GetCardConfigById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the card details configuration based on the provided base configuration.
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The base card details configuration to apply during the update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value indicating whether the update was successful.</returns>
|
||||
Task<bool> UpdateDetailConfig(CardDetailsConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Inserts a new card detail configuration based on the provided display config data.
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The DTO containing the data required to create the card detail configuration.</param>
|
||||
/// <returns>A task that resolves to the created <see cref="CardDetailsConfig"/>, or <c>null</c> if the configuration could not be inserted.</returns>
|
||||
Task<CardDetailsConfig?> InsertCardDetailConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto);
|
||||
/// <summary>
|
||||
/// Inserts a new chart configuration based on the provided display config card data.
|
||||
/// </summary>
|
||||
/// <param name="updateDisplayConfigNameDto">The data transfer object containing the details of the chart configuration to create.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the newly inserted <see cref="ChartConfig"/>, or <c>null</c> if the insertion was not successful.</returns>
|
||||
Task<ChartConfig?> InsertChartConfig(CreateDisplayConfigCardDto updateDisplayConfigNameDto);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the chart configuration based on the provided base configuration and returns a value indicating whether the update was successful.
|
||||
/// </summary>
|
||||
/// <param name="baseConfig">The base chart configuration to apply during the update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is <c>true</c> if the chart configuration was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateChartConfig(ChartConfig baseConfig);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a chart configuration identified by the specified configuration display identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigDisplay">The <see cref="ObjectId"/> of the chart configuration display to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation, containing a value indicating whether the deletion was successful.</returns>
|
||||
Task<bool> DeleteChartConfig(ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the chart configuration associated with the specified chart identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectIdConfigChart">The unique identifier of the chart whose configuration should be fetched.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ChartConfig"/> associated with the provided identifier, or <c>null</c> if no configuration is found.</returns>
|
||||
Task<ChartConfig?> GetChartConfig(ObjectId objectIdConfigChart);
|
||||
}
|
||||
@@ -12,52 +12,208 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
public interface IDisplayService
|
||||
{
|
||||
//Task<List<DisplayWithPermissionsDto>> GetAll(string? userName, List<Authorization> displayIdByAuthorities);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all displays in a compact format containing only minimal identifying information.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="DisplayMinimalDto"/> objects representing all available displays in a compact projection.</returns>
|
||||
Task<List<DisplayMinimalDto>> GetAllCompact();
|
||||
/// <summary>
|
||||
/// Retrieves all displays along with their associated permissions for the specified user.
|
||||
/// When <paramref name="userName"/> is null, the behavior is determined by the underlying implementation (e.g., returning all displays or an empty result).
|
||||
/// </summary>
|
||||
/// <param name="userName">The username used to look up the associated displays and permissions. May be null.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="DisplayWithPermissionsDto"/> entries for the user.</returns>
|
||||
Task<List<DisplayWithPermissionsDto>> GetAllByUser(string? userName);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of <see cref="Display"/> entries filtered by the specified display type.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the returned collection.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Display"/> items matching the specified type.</returns>
|
||||
Task<List<Display>> GetByType(DisplayConfigEnums.DisplayType type);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of displays associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care used to filter the displays to be returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Display"/> items linked to the given point of care.</returns>
|
||||
Task<List<Display>> GetByPointOfCare(PointOfCare pointOfCare);
|
||||
/// <summary>
|
||||
/// Retrieves a list of displays associated with the specified configuration identifier.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the configuration used to filter the displays.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of displays matching the specified configuration identifier.</returns>
|
||||
Task<List<Display>> GetByConfigId(ObjectId configId);
|
||||
/// <summary>
|
||||
/// Retrieves a list of <see cref="Display"/> entities associated with the specified card configuration identifier.
|
||||
/// </summary>
|
||||
/// <param name="configId">The unique identifier of the card configuration whose associated displays are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Display"/> objects linked to the given card configuration.</returns>
|
||||
Task<List<Display>> GetByCardConfigId(ObjectId configId);
|
||||
|
||||
// Task<List<Display>> GetByUser();
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Display"/> entity by its name asynchronously.
|
||||
/// Returns <c>null</c> when no matching display is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the display to look up.</param>
|
||||
/// <returns>A <see cref="Task{Display}"/> that resolves to the matching <see cref="Display"/>, or <c>null</c> if none is found.</returns>
|
||||
Task<Display?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Display"/> entity by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Display"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Display?> GetById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a display representation of an entity along with its associated permissions, localized for the specified locale.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to retrieve.</param>
|
||||
/// <param name="localeEnum">The locale used to localize the returned display data.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the localized display data with permissions.</returns>
|
||||
Task<DisplayWithPermissionsDto> GetByIdWithPermissions(ObjectId id, LocaleEnum localeEnum);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of displays associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose displays should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the count of displays linked to the specified unit.</returns>
|
||||
Task<long> CountDisplaysByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the display identified by <paramref name="id"/>, optionally populating related data such as point-of-care, patient, display list, and display configuration based on the corresponding fill flags.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the display to retrieve.</param>
|
||||
/// <param name="userName">The name of the user requesting the display, used for authorization checks.</param>
|
||||
/// <param name="authorizations">Optional collection of authorizations used to control access to the display and its related data.</param>
|
||||
/// <param name="locale">Optional locale used to localize the returned display information.</param>
|
||||
/// <param name="fillPointOfCare">When <c>true</c>, includes the associated point-of-care data in the result.</param>
|
||||
/// <param name="fillPatientData">When <c>true</c>, includes the associated patient data in the result.</param>
|
||||
/// <param name="fillDisplayList">When <c>true</c>, includes the display list in the result.</param>
|
||||
/// <param name="fillDisplayConfig">When <c>true</c>, includes the display configuration in the result.</param>
|
||||
/// <param name="ct">Token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the <see cref="Display"/> if found, or <c>null</c> if no display matches the specified <paramref name="id"/>.</returns>
|
||||
Task<Display?> GetInfo(
|
||||
ObjectId id,
|
||||
string? userName,
|
||||
List<Authorization>? authorizations,
|
||||
LocaleEnum? locale,
|
||||
bool fillPointOfCare = true,
|
||||
bool fillPatientData = false,
|
||||
bool fillDisplayList = true,
|
||||
bool fillDisplayConfig = true,
|
||||
CancellationToken ct = default
|
||||
);
|
||||
ObjectId id,
|
||||
string? userName,
|
||||
List<Authorization>? authorizations,
|
||||
LocaleEnum? locale,
|
||||
bool fillPointOfCare = true,
|
||||
bool fillPatientData = false,
|
||||
bool fillDisplayList = true,
|
||||
bool fillDisplayConfig = true,
|
||||
CancellationToken ct = default
|
||||
);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a list of minimal display sections filtered by display type, current display context, user name, and the provided authorizations.
|
||||
/// </summary>
|
||||
/// <param name="type">The display type used to filter the available sections.</param>
|
||||
/// <param name="currentDisplay">The identifier of the current display, or <c>null</c> when no display is selected.</param>
|
||||
/// <param name="userName">The user name used to resolve user-specific sections, or <c>null</c> if not applicable.</param>
|
||||
/// <param name="authorizations">The list of authorizations used to authorize and filter the returned sections, or <c>null</c> if no authorization filtering is required.</param>
|
||||
/// <returns>A task that yields the list of <see cref="MinimalDisplaySection"/> instances matching the supplied criteria.</returns>
|
||||
Task<List<MinimalDisplaySection>> GetDisplaySectionByUser(
|
||||
DisplayConfigEnums.DisplayType type,
|
||||
ObjectId? currentDisplay,
|
||||
string? userName,
|
||||
List<Authorization>? authorizations);
|
||||
DisplayConfigEnums.DisplayType type,
|
||||
ObjectId? currentDisplay,
|
||||
string? userName,
|
||||
List<Authorization>? authorizations);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all display sections as a minimal display list.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="MinimalDisplayListDto"/> with the display section data.</returns>
|
||||
Task<MinimalDisplayListDto> GetAllDisplaySection();
|
||||
/// <summary>
|
||||
/// Retrieves a list of <see cref="Display"/> records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> that identifies the unit whose displays are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="List{Display}"/> of displays linked to the given unit.</returns>
|
||||
Task<List<Display>> GetByUnitId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves all available Points of Contact (POCs) along with their associated unit information, optionally filtered by the provided display identifiers and allowing exclusion of virtual entries.
|
||||
/// </summary>
|
||||
/// <param name="displayIds">The list of display identifiers used to filter the available POCs.</param>
|
||||
/// <param name="excludeVirtual">When set to <c>true</c>, excludes virtual POCs from the results; otherwise, virtual POCs are included.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PocAndUnitDto"/> with the matching POCs and their unit details.</returns>
|
||||
Task<PocAndUnitDto> GetAllAvailablePoc(List<string> displayIds, bool excludeVirtual = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all Points of Care (POCs) associated with the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The display identifier used to look up the associated Points of Care.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of Points of Care matching the specified display identifier.</returns>
|
||||
Task<List<PointOfCare>> GetAllPocsByDisplayId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Inserts a new display record into the data store and returns the persisted entity.
|
||||
/// </summary>
|
||||
/// <param name="display">The display entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the inserted <see cref="Display"/>.</returns>
|
||||
Task<Display> InsertOne(Display display);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single test <see cref="Display"/> record and returns the persisted result.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task{Display}"/> that represents the asynchronous insert operation, containing the inserted <see cref="Display"/>.</returns>
|
||||
Task<Display> InsertOneTest();
|
||||
/// <summary>
|
||||
/// Updates the configuration of an existing display using the provided new configuration.
|
||||
/// </summary>
|
||||
/// <param name="oldDisplay">The current display whose configuration will be updated.</param>
|
||||
/// <param name="newDisplayConfig">The new display configuration to apply, or null to leave the configuration unchanged.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Display"/>, or null if the update was not performed.</returns>
|
||||
Task<Display?> UpdateConfig(Display oldDisplay, DisplayConfig? newDisplayConfig);
|
||||
/// <summary>
|
||||
/// Updates the configuration identifier associated with the specified display.
|
||||
/// </summary>
|
||||
/// <param name="oldDisplay">The existing display whose configuration identifier will be updated.</param>
|
||||
/// <param name="configId">The new configuration identifier to associate with the display.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Display"/>, or <c>null</c> if no result is available.</returns>
|
||||
Task<Display?> UpdateConfigId(Display oldDisplay, ObjectId configId);
|
||||
/// <summary>
|
||||
/// Updates the point of care list associated with the specified object identifier, replacing or merging it with the provided list of point of care object identifiers.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The identifier of the object whose point of care list is being updated.</param>
|
||||
/// <param name="listPocObId">The collection of point of care object identifiers to apply to the target object.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the resulting <see cref="Display"/> when the update succeeds, or <c>null</c> when no matching object is found.</returns>
|
||||
Task<Display?> UpdatePointOfCareList(ObjectId objectId, List<ObjectId> listPocObId);
|
||||
/// <summary>
|
||||
/// Updates the configuration preset associated with the specified display using the provided configuration display.
|
||||
/// </summary>
|
||||
/// <param name="objectIdDisplay">The unique identifier of the display whose configuration preset will be updated.</param>
|
||||
/// <param name="objectIdConfigDisplay">The unique identifier of the configuration display to apply as the preset.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Display"/>, or <c>null</c> if no matching display is found.</returns>
|
||||
Task<Display?> UpdateConfigPreset(ObjectId objectIdDisplay, ObjectId objectIdConfigDisplay);
|
||||
/// <summary>
|
||||
/// Updates the name of the entity identified by the given identifier and returns the resulting <see cref="Display"/>.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the entity whose name should be updated.</param>
|
||||
/// <param name="name">The new name to apply to the entity.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the updated <see cref="Display"/> or <c>null</c> if no entity was found.</returns>
|
||||
Task<Display?> UpdateName(ObjectId id, string name);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of displays based on the provided filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and any additional filtering criteria for the display results.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{Display}"/> with the requested page of displays and pagination metadata.</returns>
|
||||
Task<PaginationResponse<Display>> GetPaginatedDisplays(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the display identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a value indicating whether the display was successfully deleted.</returns>
|
||||
Task<bool> DeleteDisplay(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the list of display configuration locations associated with the specified display configuration.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The unique identifier of the display configuration whose locations are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="DisplayConfigLocationDto"/> objects for the specified display configuration.</returns>
|
||||
Task<List<DisplayConfigLocationDto>> GetDisplayConfigLocations(ObjectId displayConfigId);
|
||||
/// <summary>
|
||||
/// Asynchronously determines whether the specified display configuration is currently in use.
|
||||
/// </summary>
|
||||
/// <param name="displayConfigId">The identifier of the display configuration to check.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the display configuration is in use; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> IsDisplayConfigInUse(ObjectId displayConfigId);
|
||||
/// <summary>
|
||||
/// Deletes display records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose displays should be removed.</param>
|
||||
Task DeleteDisplaysByUnitId(ObjectId unitId);
|
||||
}
|
||||
@@ -8,9 +8,30 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IFileService
|
||||
{
|
||||
/// <summary>
|
||||
/// Copies the provided update files to the appropriate location for processing or deployment.
|
||||
/// </summary>
|
||||
/// <param name="files">The collection of update files to be copied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the copy operation succeeded.</returns>
|
||||
Task<bool> CopyUpdateFiles(ICollection<IFormFile> files);
|
||||
/// <summary>
|
||||
/// Uploads the provided asset files categorized by the specified theme, returning a value indicating whether the operation completed successfully.
|
||||
/// </summary>
|
||||
/// <param name="files">The collection of uploaded form files to process and store as assets.</param>
|
||||
/// <param name="themeParse">The asset theme used to classify and organize the uploaded files.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the asset files were uploaded successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UploadAssetFiles(ICollection<IFormFile> files, FileEnum.AssetTheme themeParse);
|
||||
/// <summary>
|
||||
/// Retrieves all asset files for the specified asset theme as a list of asset data transfer objects.
|
||||
/// </summary>
|
||||
/// <param name="themeParse">The asset theme used to retrieve the corresponding assets.</param>
|
||||
/// <returns>A <see cref="List{AssetDto}"/> containing the asset data transfer objects for the specified theme.</returns>
|
||||
List<AssetDto> GetAllAssetFile(FileEnum.AssetTheme themeParse);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a list of file names from the specified directory path.
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">The path of the directory from which to retrieve the files.</param>
|
||||
/// <returns>A list of strings representing the names of the files in the specified directory.</returns>
|
||||
List<string> GetFilesInDirectory(string directoryPath);
|
||||
}
|
||||
@@ -7,16 +7,48 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IGroupedObservationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates a grouped observation for the specified identifier and grouped field, applying the provided time zone for time-based calculations.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the source entity used to produce the grouped observation.</param>
|
||||
/// <param name="groupedField">The field definition that determines how the observation is grouped.</param>
|
||||
/// <param name="timeZoneId">The identifier of the time zone to apply when interpreting time values. Defaults to "Romance Standard Time".</param>
|
||||
/// <param name="cacheIsChecked">Indicates whether the cache should be consulted before generating the result. Defaults to <c>false</c>.</param>
|
||||
/// <param name="ct">The cancellation token used to cancel the operation.</param>
|
||||
/// <returns>A task that represents the asynchronous generation, producing the resulting <see cref="GroupedObservation"/>.</returns>
|
||||
Task<GroupedObservation> GenerateGroupedObservation(ObjectId id, GroupedField groupedField,
|
||||
string timeZoneId = "Romance Standard Time", bool cacheIsChecked = false, CancellationToken ct = default);
|
||||
string timeZoneId = "Romance Standard Time", bool cacheIsChecked = false, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Generates a <see cref="GroupedObservation"/> for the specified patient based on the provided patient observation,
|
||||
/// grouped field configuration, and any previously recorded grouped observations, applying the supplied time zone for
|
||||
/// date and time handling.
|
||||
/// </summary>
|
||||
/// <param name="obsPatientId">The identifier of the patient whose observation is being grouped.</param>
|
||||
/// <param name="groupedField">The grouped field definition that drives how the observation is categorized and aggregated.</param>
|
||||
/// <param name="wsgLastGroupedObservationObs">The list of the most recent grouped observation entries used as context when building the new grouped observation.</param>
|
||||
/// <param name="obs">The patient observation to be processed and grouped.</param>
|
||||
/// <param name="timeZoneId">The time zone identifier used when computing date and time values for the grouped observation. Defaults to "Romance Standard Time".</param>
|
||||
/// <returns>A <see cref="Task{GroupedObservation}"/> that resolves to the generated grouped observation for the patient.</returns>
|
||||
Task<GroupedObservation> GenerateGroupedObservation(ObjectId obsPatientId, GroupedField groupedField,
|
||||
List<GroupedObservation.GroupedObservationObs> wsgLastGroupedObservationObs, PatientObservation obs,
|
||||
string timeZoneId = "Romance Standard Time");
|
||||
List<GroupedObservation.GroupedObservationObs> wsgLastGroupedObservationObs, PatientObservation obs,
|
||||
string timeZoneId = "Romance Standard Time");
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent observations for a specified patient, optionally filtered by observation types.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 2.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names to include; if null, all observation types are considered.</param>
|
||||
/// <returns>A task that resolves to a list of the most recent <see cref="PatientObservation"/> entries for the patient.</returns>
|
||||
Task<List<PatientObservation>> FindLastObservations(ObjectId patientId, int num = 2,
|
||||
List<string>? filterObservations = null);
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously creates a new empty observation for the next available slot in the grouped web service subscription.
|
||||
/// </summary>
|
||||
/// <param name="ws">The grouped web service subscriber for which the next empty observation is created.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the newly created <see cref="GroupedObservation"/>.</returns>
|
||||
Task<GroupedObservation> CreateNextEmptyObs(WsSubscriberGrouped ws);
|
||||
/*
|
||||
*
|
||||
|
||||
@@ -6,20 +6,72 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IHistoricalConfigChangesService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all historical configuration changes recorded in the system.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of all <see cref="HistoricalConfigChanges"/> entries.</returns>
|
||||
Task<ICollection<HistoricalConfigChanges>> GetAll();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a historical configuration change entry by its unique identifier.
|
||||
/// Returns null when no matching historical configuration change is found for the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the historical configuration change to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="HistoricalConfigChanges"/> or null if not found.</returns>
|
||||
Task<HistoricalConfigChanges?> Get(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of historical configuration changes filtered by the specified configuration type.
|
||||
/// </summary>
|
||||
/// <param name="type">The configuration type used to filter the historical changes.</param>
|
||||
/// <param name="num">The maximum number of historical change records to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of <see cref="HistoricalConfigChanges"/> for the specified type.</returns>
|
||||
Task<ICollection<HistoricalConfigChanges>> GetByType(DisplayConfigEnums.ConfigTypes type, int num);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a collection of historical configuration changes associated with the specified user.
|
||||
/// Results can be filtered by configuration type and limited in count; when the configuration type is not provided, all types are considered.
|
||||
/// </summary>
|
||||
/// <param name="user">The identifier of the user whose historical configuration changes should be retrieved.</param>
|
||||
/// <param name="configTypes">The optional configuration type used to filter the results; if null, changes for all configuration types are returned.</param>
|
||||
/// <param name="num">The maximum number of historical configuration change records to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of historical configuration changes matching the specified criteria.</returns>
|
||||
Task<ICollection<HistoricalConfigChanges>> GetByUser(string user, DisplayConfigEnums.ConfigTypes? configTypes,
|
||||
int num);
|
||||
int num);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent historical configuration changes for the specified configuration type.
|
||||
/// Returns null if no historical changes are found for the given type.
|
||||
/// </summary>
|
||||
/// <param name="configTypes">The configuration type used to look up the most recent historical changes.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the last <see cref="HistoricalConfigChanges"/> for the specified type, or null if no changes are available.</returns>
|
||||
Task<HistoricalConfigChanges?> FindLastConfigChanges(DisplayConfigEnums.ConfigTypes configTypes);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a single historical configuration change record into the data store.
|
||||
/// Returns the inserted record, or null if the insert could not be performed.
|
||||
/// </summary>
|
||||
/// <param name="historicalConfigChanges">The historical configuration change entity to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the inserted <see cref="HistoricalConfigChanges"/> entity, or null if the insertion did not produce a result.</returns>
|
||||
Task<HistoricalConfigChanges?> InsertOne(HistoricalConfigChanges historicalConfigChanges);
|
||||
/// <summary>
|
||||
/// Updates an existing historical configuration change record with the provided data and returns the updated entity.
|
||||
/// </summary>
|
||||
/// <param name="historicalConfigChanges">The historical configuration change entity containing the updated values to be persisted.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="HistoricalConfigChanges"/>, or <c>null</c> if the record was not found.</returns>
|
||||
Task<HistoricalConfigChanges?> UpdateHistoricalConfigChange(HistoricalConfigChanges historicalConfigChanges);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a historical configuration change identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the historical configuration change to delete.</param>
|
||||
Task DeleteHistoricalConfigChange(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a configuration change event, recording the user who made the change, the type of configuration affected, and the old and new configuration values.
|
||||
/// </summary>
|
||||
/// <param name="user">The identifier of the user who made the configuration change.</param>
|
||||
/// <param name="configType">The type of configuration that was changed.</param>
|
||||
/// <param name="newConfig">The new configuration value after the change.</param>
|
||||
/// <param name="oldConfig">The previous configuration value before the change.</param>
|
||||
Task LogConfigChanged(string user, DisplayConfigEnums.ConfigTypes configType, string newConfig, string oldConfig);
|
||||
}
|
||||
@@ -9,20 +9,85 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ILightBeaconService
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends the specified color command to the light beacon associated with the given point of control identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of control that targets the light beacon.</param>
|
||||
/// <param name="color">The color to apply to the light beacon.</param>
|
||||
Task SendColor(ObjectId pocId, LightBeaconColor color);
|
||||
/// <summary>
|
||||
/// Sends a color command to the light beacon of the specified point of care device,
|
||||
/// updating its visual indicator to reflect the requested state.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of care device whose light beacon will be updated.</param>
|
||||
/// <param name="color">The color to apply to the light beacon.</param>
|
||||
/// <returns>A task that represents the asynchronous color send operation.</returns>
|
||||
Task SendColor(PointOfCare pocId, LightBeaconColor color);
|
||||
/// <summary>
|
||||
/// Sends a light beacon broadcast for the specified point of care, setting the beacon to display the specified color.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care device or location whose beacon will be updated.</param>
|
||||
/// <param name="color">The color to display on the light beacon.</param>
|
||||
Task SendBeaconBroadcast(PointOfCare poc, LightBeaconColor color);
|
||||
/// <summary>
|
||||
/// Sends a broadcast signal to the beacon associated with the specified point of care identifier using the given beacon color.
|
||||
/// </summary>
|
||||
/// <param name="poc">The identifier of the point of care (or beacon) that will receive the broadcast.</param>
|
||||
/// <param name="color">The color of the light beacon used for the broadcast.</param>
|
||||
Task SendBeaconBroadcast(ObjectId poc, LightBeaconColor color);
|
||||
/// <summary>
|
||||
/// Asynchronously powers off the LED associated with the specified point of connection identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of connection whose LED will be turned off.</param>
|
||||
Task PowerOffLed(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Asynchronously powers off the LED indicator associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care whose LED indicator should be turned off.</param>
|
||||
Task PowerOffLed(PointOfCare poc);
|
||||
|
||||
/// <summary>
|
||||
/// Generates a color-coded alert based on the provided patient observation.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation used to determine the alert level and color.</param>
|
||||
void GenerateColorAlert(PatientObservation obs);
|
||||
|
||||
//TODO refactor, one patient can have multiple beacons
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the <see cref="LightBeaconColor"/> associated with the specified point of care identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of care whose light beacon color is being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="LightBeaconColor"/> for the specified point of care.</returns>
|
||||
public Task<LightBeaconColor> GetColor(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the light beacon color associated with the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care for which to look up the light beacon color.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="LightBeaconColor"/> for the specified point of care.</returns>
|
||||
public Task<LightBeaconColor> GetColor(PointOfCare poc);
|
||||
/// <summary>
|
||||
/// Updates a single light beacon record in the data store.
|
||||
/// Returns <see langword="null"/> when the beacon to update cannot be found.
|
||||
/// </summary>
|
||||
/// <param name="beacon">The light beacon containing the updated values to persist.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="LightBeacon"/>, or <see langword="null"/> if no matching beacon was found.</returns>
|
||||
Task<LightBeacon?> UpdateOne(LightBeacon beacon);
|
||||
/// <summary>
|
||||
/// Inserts a single light beacon into the data store.
|
||||
/// </summary>
|
||||
/// <param name="beacon">The light beacon entity to insert.</param>
|
||||
/// <returns>A task that resolves to the inserted <see cref="LightBeacon"/>, or <c>null</c> when no result is produced.</returns>
|
||||
Task<LightBeacon?> InsertOne(LightBeacon beacon);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a paginated collection of light beacons based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing the criteria used to page the beacon results.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a pagination response with the requested light beacons.</returns>
|
||||
Task<PaginationResponse<LightBeacon>> GetPaginatedBeacons(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Asynchronously searches for light beacons by name using the specified search text.
|
||||
/// </summary>
|
||||
/// <param name="textToSearch">The text used to search for matching light beacons by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="LightBeacon"/> objects matching the search criteria.</returns>
|
||||
Task<List<LightBeacon>> GetSearchByName(string textToSearch);
|
||||
}
|
||||
@@ -4,6 +4,19 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ILocalAuditService
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an asynchronous audit log entry capturing the original and modified data along with the user responsible for the change.
|
||||
/// </summary>
|
||||
/// <param name="user">The claims principal representing the user who performed the action being audited. May be null if the action is performed by an unauthenticated or system context.</param>
|
||||
/// <param name="dataOriginal">The original state of the data before the change. May be null when the action creates a new record.</param>
|
||||
/// <param name="dataModified">The modified state of the data after the change. May be null when the action deletes an existing record.</param>
|
||||
/// <param name="reason">An optional explanation or justification for the change. Defaults to null when no reason is provided.</param>
|
||||
/// <returns>A task that represents the asynchronous creation of the audit log entry.</returns>
|
||||
Task CreateAuditLogAsync(ClaimsPrincipal? user, object? dataOriginal, object? dataModified, string? reason = null);
|
||||
/// <summary>
|
||||
/// Asynchronously creates a deep copy of the specified data, producing a new independent instance of the same type.
|
||||
/// </summary>
|
||||
/// <param name="data">The data instance to be deep copied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the deep-copied instance of type <typeparamref name="T"/>, or <c>null</c> if the copy could not be produced.</returns>
|
||||
Task<T?> DeepCopyAsync<T>(T data);
|
||||
}
|
||||
@@ -9,38 +9,199 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IMasterListService<T> where T : MasterList
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the complete master list of items of type <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an <see cref="IEnumerable{T}"/> with all items from the master list.</returns>
|
||||
Task<IEnumerable<T>> GetAllMasterList();
|
||||
/// <summary>
|
||||
/// Retrieves all master list entries, excluding items categorized as options.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="MasterListDto"/> items representing the master list without options.</returns>
|
||||
Task<IEnumerable<MasterListDto>> GetAllMasterListWithoutOptions();
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of master list items with their associated options based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing paging criteria such as page number and page size.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of <see cref="MasterListWithPaginatedOptionsDto"/> items for the requested page.</returns>
|
||||
Task<IEnumerable<MasterListWithPaginatedOptionsDto>> GetAllMasterListWithPaginatedOptions(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Retrieves a master list entry identified by the specified <paramref name="id"/>, optionally resolving localized content based on the provided <paramref name="locale"/>. Returns <c>null</c> when no matching entry is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list entry to retrieve.</param>
|
||||
/// <param name="locale">The optional locale used to resolve localized fields; when <c>null</c>, a default or non-localized representation is returned.</param>
|
||||
/// <returns>A task that resolves to the matching master list entry of type <typeparamref name="T"/>, or <c>null</c> if the entry does not exist.</returns>
|
||||
Task<T?> GetMasterListById(ObjectId id, LocaleEnum? locale);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a master list along with its paginated options identified by the specified id.
|
||||
/// Returns null when no master list is found for the given identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list to retrieve.</param>
|
||||
/// <param name="request">The pagination filter used to control the paginated options returned with the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="MasterListWithPaginatedOptionsDto"/> if a matching master list is found, otherwise null.</returns>
|
||||
Task<MasterListWithPaginatedOptionsDto?> GetMasterListByIdWithPaginatedOptions(ObjectId id,
|
||||
PaginationFilter request);
|
||||
PaginationFilter request);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the list of master list option names associated with the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list whose option names are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of option names for the specified master list.</returns>
|
||||
Task<List<string>> GetMasterListOptionsNamesById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves a master list of <see cref="OptionList"/> entries filtered by the specified identifier and an optional text search criterion.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier used to scope the master list lookup.</param>
|
||||
/// <param name="textSearch">An optional text string used to further filter the results; may be <c>null</c> to return all matching entries.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="OptionList"/> items matching the provided identifier and text search.</returns>
|
||||
Task<List<OptionList>> GetMasterListByIdAndTextSearch(ObjectId id, string? textSearch);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a master list of options associated with the specified identifier, applying the provided search and filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier used to locate the master list to retrieve.</param>
|
||||
/// <param name="filterOption">The filter and search options used to refine the returned list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="OptionList"/> entries that match the specified id and filter options.</returns>
|
||||
Task<List<OptionList>> GetMasterListByIdAndSearchOptions(ObjectId id, FilterOptionListElement filterOption);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a master list that matches the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The result is the matching master list of type <typeparamref name="T"/>, or <c>null</c> if no master list with the specified name is found.</returns>
|
||||
Task<T?> GetMasterListByName(string name);
|
||||
/// <summary>
|
||||
/// Inserts the specified item into the master list and returns the resulting entry, or <c>null</c> if the operation did not produce a result.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to insert into the master list.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the inserted item, or <c>null</c> when no result is available.</returns>
|
||||
Task<T?> InsertMasterList(T item);
|
||||
/// <summary>
|
||||
/// Updates the master list with the specified item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to be updated in the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation, containing the updated item or <c>null</c> if the update could not be performed.</returns>
|
||||
Task<T?> UpdateMasterList(T item);
|
||||
/// <summary>
|
||||
/// Deletes a master list identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list to delete.</param>
|
||||
Task DeleteMasterListById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Adds the specified option element to the master option list identified by the given identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master option list to which the option will be added.</param>
|
||||
/// <param name="opt">The filter option list element to append to the master list.</param>
|
||||
/// <returns>A task that returns the updated <see cref="OptionList"/>, or <c>null</c> if the master list could not be found.</returns>
|
||||
Task<OptionList?> AddOptionToMasterList(ObjectId id, FilterOptionListElement opt);
|
||||
/// <summary>
|
||||
/// Updates an option in a master list, localized for the specified locale, and returns the updated option list.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the option to update.</param>
|
||||
/// <param name="opt">The option data to apply to the existing entry.</param>
|
||||
/// <param name="typeName">The name of the master list type that owns the option.</param>
|
||||
/// <param name="locale">The locale used to resolve or apply localized values.</param>
|
||||
/// <returns>A task that returns the updated <see cref="OptionList"/>, or <c>null</c> if the option could not be found.</returns>
|
||||
Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName, LocaleEnum locale);
|
||||
/// <summary>
|
||||
/// Updates the full master list option identified by the specified identifier and type name.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the option to update.</param>
|
||||
/// <param name="opt">The option list containing the updated values.</param>
|
||||
/// <param name="typeName">The name of the type associated with the master list option.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="OptionList"/>, or <c>null</c> if the option was not found.</returns>
|
||||
Task<OptionList?> UpdateFullMasterListOption(ObjectId id, OptionList opt, string typeName);
|
||||
/// <summary>
|
||||
/// Updates a master list option for the specified type with the provided option data.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the option to update.</param>
|
||||
/// <param name="opt">The option data to apply to the master list.</param>
|
||||
/// <param name="typeName">The name of the master list type containing the option.</param>
|
||||
/// <returns>The updated <see cref="OptionList"/>, or null if the option is not found.</returns>
|
||||
Task<OptionList?> UpdateMasterListOption(ObjectId id, OptionList opt, string typeName);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an option list item identified by the specified master ID, option ID, and locale.
|
||||
/// </summary>
|
||||
/// <param name="masterId">The identifier of the master entity that owns the option list.</param>
|
||||
/// <param name="optionId">The identifier of the specific option item to find.</param>
|
||||
/// <param name="locale">The locale used to retrieve the localized option item.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing 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>
|
||||
/// Updates the option details of a master list entry identified by the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master list entry to update.</param>
|
||||
/// <param name="opt">The master list details to apply to the entry.</param>
|
||||
/// <returns>A task that returns 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 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 successfully updated; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateMasterListName(ObjectId id, string name);
|
||||
/// <summary>
|
||||
/// Updates the description (name) of a master list entry identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the master list entry to update.</param>
|
||||
/// <param name="name">The new description to apply to the master list entry.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the update was successful; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateMasterListDescription(ObjectId id, string name);
|
||||
/// <summary>
|
||||
/// Asynchronously removes the specified option from the master list identified by the given id.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master list from which the option will be removed.</param>
|
||||
/// <param name="oldOpt">The option entry to be removed from the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the option was successfully removed; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> RemoveMasterListOption(ObjectId id, OptionList oldOpt);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the total count of all items in the master list.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the total number of items in the master list.</returns>
|
||||
Task<int> GetAllMasterListCount();
|
||||
/// <summary>
|
||||
/// Retrieves a paginated master list of items based on the specified filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines paging parameters such as page number and page size.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response with the requested master list items.</returns>
|
||||
Task<PaginationResponse<T>> GetPaginatedMasterList(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a master list option identified by the supplied identifiers.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the master list that contains the option to delete.</param>
|
||||
/// <param name="optId">The identifier of the specific option to remove from the master list.</param>
|
||||
/// <param name="typeName">The name of the master list type to which the option belongs.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the option was successfully deleted; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteMasterListOption(ObjectId id, ObjectId optId, string typeName);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a paginated master list along with its associated paginated options.
|
||||
/// </summary>
|
||||
/// <param name="listFilter">The pagination filter applied to the master list results.</param>
|
||||
/// <param name="optionsFilter">The pagination filter applied to the associated options.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response with master list and options data.</returns>
|
||||
Task<PaginationResponse<MasterListWithPaginatedOptionsDto>> GetPaginatedMasterListWithPaginatedOptions(
|
||||
PaginationFilter listFilter, PaginationFilter optionsFilter);
|
||||
PaginationFilter listFilter, PaginationFilter optionsFilter);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of options associated with the specified list.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination parameters used to control the page size and page index of the returned results.</param>
|
||||
/// <param name="listId">The identifier of the list whose options should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{OptionList}"/> with the requested options.</returns>
|
||||
Task<PaginationResponse<OptionList>> GetPaginatedOptions(PaginationFilter filter, ObjectId listId);
|
||||
/// <summary>
|
||||
/// Retrieves the associated list identifier for the given object based on the specified master list types.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the object whose associated list is being requested.</param>
|
||||
/// <param name="masterListType1">The first master list type used to determine the association.</param>
|
||||
/// <param name="masterListType2">The second master list type used to determine the association.</param>
|
||||
/// <returns>A task that returns the associated <see cref="ObjectId"/> if found, or <c>null</c> if no association exists.</returns>
|
||||
Task<ObjectId?> GetAssociatedList(ObjectId id, MasterListType masterListType1, MasterListType masterListType2);
|
||||
/// <summary>
|
||||
/// Retrieves the available options associated with the specified list identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the list whose options are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of option strings for the specified list.</returns>
|
||||
Task<List<string>> GetOptionsOfList(ObjectId id);
|
||||
}
|
||||
@@ -7,17 +7,81 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IMasterListServiceFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the service object of the specified type.
|
||||
/// </summary>
|
||||
/// <param name="serviceType">An object that specifies the type of service object to get.</param>
|
||||
/// <returns>
|
||||
/// A service object of type <paramref name="serviceType"/>, or <c>null</c> if there is no service
|
||||
/// object of that type registered.
|
||||
/// </returns>
|
||||
object GetService(Type serviceType);
|
||||
/// <summary>
|
||||
/// Retrieves a service instance from the master list based on the specified service name.
|
||||
/// </summary>
|
||||
/// <param name="serviceName">The <see cref="MasterListType"/> identifier used to look up the desired service.</param>
|
||||
/// <returns>An <see cref="object"/> representing the resolved service, or <see langword="null"/> if no matching service is found.</returns>
|
||||
object GetService(MasterListType serviceName);
|
||||
/// <summary>
|
||||
/// Retrieves a typed representation of the specified <paramref name="masterList"/> based on the given <paramref name="masterListType"/>.
|
||||
/// </summary>
|
||||
/// <param name="masterListType">The type that determines how the master list should be converted or filtered.</param>
|
||||
/// <param name="masterList">The master list to be returned in a typed form.</param>
|
||||
/// <returns>A typed object representing the master list, or <c>null</c> if no matching type is found.</returns>
|
||||
object? GetTypedMasterList(MasterListType masterListType, MasterList masterList);
|
||||
/// <summary>
|
||||
/// Gets the specific <see cref="Type"/> associated with the given master list type, mapping the master list category to its corresponding implementation type.
|
||||
/// </summary>
|
||||
/// <param name="masterListType">The master list type whose associated <see cref="Type"/> should be returned.</param>
|
||||
/// <returns>The <see cref="Type"/> that corresponds to the specified <paramref name="masterListType"/>.</returns>
|
||||
Type GetMasterListSpecificType(MasterListType masterListType);
|
||||
/// <summary>
|
||||
/// Inserts a new <see cref="MasterList"/> record based on the specified <paramref name="masterListType"/>.
|
||||
/// </summary>
|
||||
/// <param name="masterListType">The type of master list to insert.</param>
|
||||
/// <param name="masterList">The master list entity to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation. The result contains the inserted master list data, or <c>null</c> if the insert was not successful.</returns>
|
||||
Task<object?> InsertMasterList(MasterListType masterListType, MasterList masterList);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing master list entry based on the specified master list type and master list data.
|
||||
/// </summary>
|
||||
/// <param name="masterListType">The type of master list to update, used to determine the target list or category.</param>
|
||||
/// <param name="masterList">The master list entity containing the updated data to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The result is an object containing the updated master list information, or <c>null</c> if no matching record was found.</returns>
|
||||
Task<object?> UpdateMasterList(MasterListType masterListType, MasterList masterList);
|
||||
/// <summary>
|
||||
/// Retrieves a master list entry by its identifier and type, optionally filtered by the specified data locale.
|
||||
/// </summary>
|
||||
/// <param name="masterListType">The type of the master list to query.</param>
|
||||
/// <param name="masterListId">The unique identifier of the master list entry to retrieve.</param>
|
||||
/// <param name="dataLocale">The optional locale used to resolve localized data; when null, no locale filtering is applied.</param>
|
||||
/// <returns>A task that yields the matching master list entry as an object, or null if no entry is found.</returns>
|
||||
Task<object?> GetMasterListById(MasterListType masterListType, ObjectId masterListId, LocaleEnum? dataLocale);
|
||||
/// <summary>
|
||||
/// Retrieves a list of nurse observation entries as string values.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="List{T}"/> of <see cref="string"/> containing the nurse observation data.</returns>
|
||||
List<string> StringNurseObs();
|
||||
/// <summary>
|
||||
/// Retrieves a translated <see cref="Patient"/> based on the provided <paramref name="unit"/> and <paramref name="locale"/>.
|
||||
/// Returns <c>null</c> when the <paramref name="patient"/>, <paramref name="unit"/>, or <paramref name="locale"/> is not provided or no translation is found.
|
||||
/// </summary>
|
||||
/// <param name="unit">The organizational unit context used to look up the translation. May be <c>null</c>.</param>
|
||||
/// <param name="locale">The target locale for the translation. May be <c>null</c>.</param>
|
||||
/// <param name="patient">The patient to be translated. May be <c>null</c>.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the translated <see cref="Patient"/>, or <c>null</c> if no translation is available.</returns>
|
||||
Task<Patient?> GetPatientTraslated(Unit? unit, LocaleEnum? locale, Patient? patient);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a master list option by its identifier, optionally localized to the specified data locale.
|
||||
/// Returns <see langword="null"/> if no matching option is found.
|
||||
/// </summary>
|
||||
/// <param name="masterListType">The type of master list to search within.</param>
|
||||
/// <param name="masterListId">The identifier of the master list containing the option.</param>
|
||||
/// <param name="masterListOptionId">The identifier of the master list option to retrieve.</param>
|
||||
/// <param name="dataLocale">The optional locale used to localize the returned option data.</param>
|
||||
/// <returns>A task that yields the matching master list option as an <see cref="object"/>, or <see langword="null"/> if not found.</returns>
|
||||
Task<object?> GetMasterListOptionById(MasterListType masterListType, ObjectId masterListId,
|
||||
ObjectId masterListOptionId,
|
||||
LocaleEnum? dataLocale);
|
||||
ObjectId masterListOptionId,
|
||||
LocaleEnum? dataLocale);
|
||||
}
|
||||
@@ -7,19 +7,89 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IMedicineService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Medicine"/> entity by its unique code identifier.
|
||||
/// Returns <c>null</c> when no matching medicine is found.
|
||||
/// </summary>
|
||||
/// <param name="code">The unique code used to look up the medicine.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="Medicine"/> or <c>null</c> if not found.</returns>
|
||||
Task<Medicine?> GetByCode(string code);
|
||||
/// <summary>
|
||||
/// Retrieves a list of medicines that match the provided codes or notes.
|
||||
/// </summary>
|
||||
/// <param name="codeNote">A list of strings representing the codes or notes used to look up medicines.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Medicine"/> objects matching the provided codes or notes.</returns>
|
||||
Task<List<Medicine>> GetByCodeOrNote(List<string> codeNote);
|
||||
/// <summary>
|
||||
/// Retrieves a medicine by its name, returning null if no matching medicine is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the medicine to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the matching <see cref="Medicine"/> or null if not found.</returns>
|
||||
Task<Medicine?> GetByName(string name);
|
||||
/// <summary>
|
||||
/// Retrieves the medicines associated with the specified patient treatments.
|
||||
/// </summary>
|
||||
/// <param name="treatments">The collection of patient treatments, which may include null entries, whose medicines are to be obtained.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of medicines linked to the provided treatments.</returns>
|
||||
Task<IEnumerable<Medicine>> GetMedicinesOfTreatments(IEnumerable<PatientTreatment?> treatments);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of active medicines associated with the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active medicines are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of active <see cref="Medicine"/> records for the patient.</returns>
|
||||
Task<IEnumerable<Medicine>> GetActiveMedicinesByPatient(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of medicines based on the provided filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing page size, page number, and optional search criteria.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{T}"/> with the requested <see cref="Medicine"/> items and pagination metadata.</returns>
|
||||
Task<PaginationResponse<Medicine>> GetPaginatedMedicines(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all medicines from the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of all <see cref="Medicine"/> entities.</returns>
|
||||
Task<List<Medicine>> GetAll();
|
||||
/// <summary>
|
||||
/// Retrieves a medicine by its unique identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="Medicine"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Medicine?> GetMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Asynchronously posts a new medicine and returns the created medicine, or null if the operation fails.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity to be posted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the posted <see cref="Medicine"/>, or null if the medicine could not be posted.</returns>
|
||||
Task<Medicine?> PostMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Updates an existing medicine in the data store and returns the updated entity, or <c>null</c> if no matching medicine was found.
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity containing the updated values to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation. The result is the updated <see cref="Medicine"/> when the update succeeds, or <c>null</c> when the medicine does not exist.</returns>
|
||||
Task<Medicine?> UpdateMedicine(Medicine medicine);
|
||||
/// <summary>
|
||||
/// Deletes a medicine record identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to delete.</param>
|
||||
Task DeleteMedicineById(ObjectId medicineId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available types as a list of string identifiers.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of type identifiers.</returns>
|
||||
Task<List<string>> GetAllTypes();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available groups, returning their identifiers or names as a list of strings.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of strings representing all groups.</returns>
|
||||
Task<List<string>> GetAllGroups();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all available names.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all names.</returns>
|
||||
Task<List<string>> GetAllNames();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the complete list of available codes from the data source.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of code strings.</returns>
|
||||
Task<List<string>> GetAllCodes();
|
||||
}
|
||||
@@ -6,14 +6,61 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface INoticeService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the specified notice.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
||||
Task DeleteNoticeAsync(Notice notice);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a notice identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="noticeId">The unique identifier of the notice to delete.</param>
|
||||
Task DeleteNoticeByIdAsync(ObjectId noticeId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Notice"/> entity by its unique identifier from the data store.
|
||||
/// Returns <see langword="null"/> when no notice matches the provided identifier.
|
||||
/// </summary>
|
||||
/// <param name="noticeId">The <see cref="ObjectId"/> that uniquely identifies the notice to retrieve.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> containing the matching <see cref="Notice"/>, or <see langword="null"/> if no notice is found.</returns>
|
||||
Task<Notice?> GetNoticeByIdAsync(ObjectId noticeId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of notices filtered by the specified notice type.
|
||||
/// The task result may be null when no notices match the given type.
|
||||
/// </summary>
|
||||
/// <param name="noticeType">The type of notice to filter by.</param>
|
||||
/// <returns>A task containing an enumerable of matching <see cref="Notice"/> objects, or null if none are found.</returns>
|
||||
Task<IEnumerable<Notice>?> GetNoticeByTypeAsync(string noticeType);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a collection of notices.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable collection of <see cref="Notice"/> objects.</returns>
|
||||
Task<IEnumerable<Notice>> GetNoticesAsync();
|
||||
/// <summary>
|
||||
/// Inserts a new notice into the data store.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice entity to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the inserted <see cref="Notice"/>, or <c>null</c> if the notice could not be inserted.</returns>
|
||||
Task<Notice?> InsertNotice(Notice notice);
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing notice in the system.
|
||||
/// </summary>
|
||||
/// <param name="notice">The notice entity containing the updated information to be persisted.</param>
|
||||
Task UpdateNoticeAsync(Notice notice);
|
||||
/// <summary>
|
||||
/// Persists the provided API request to the data store.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to be saved.</param>
|
||||
Task SaveRequest(ApiRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Asynchronously persists the specified API request.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request to save.</param>
|
||||
Task SaveRequestAsync(ApiRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of notices associated with the specified display identifier.
|
||||
/// </summary>
|
||||
/// <param name="displayId">The identifier of the display whose notices should be retrieved.</param>
|
||||
/// <returns>A task that returns the notices for the display, or <c>null</c> when no notices are found for the given display.</returns>
|
||||
Task<IEnumerable<Notice>?> GetNoticesByDisplayId(ObjectId displayId);
|
||||
}
|
||||
@@ -6,7 +6,25 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IObservationDemoService
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates a list of patient observations by evaluating the specified data fields for the given patient.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient for whom the observations are being generated.</param>
|
||||
/// <param name="dataFields">The collection of fields used to drive the observation generation.</param>
|
||||
/// <returns>A task representing the asynchronous operation that returns the list of generated patient observations.</returns>
|
||||
Task<List<PatientObservation>> GenerateObservationByField(Patient patient, List<Field> dataFields);
|
||||
/// <summary>
|
||||
/// Generates a grouped observation for the specified patient based on the provided grouped field configuration.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient for whom the grouped observation is generated.</param>
|
||||
/// <param name="groupedField">The grouped field definition that determines the grouping criteria for the observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the generated <see cref="GroupedObservation"/>.</returns>
|
||||
Task<GroupedObservation> GenerateGroupedObservation(Patient patient, GroupedField groupedField);
|
||||
/// <summary>
|
||||
/// Generates a list of patient observation alarms for the specified patient based on the provided data alarm fields.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient for whom the observation alarms are generated.</param>
|
||||
/// <param name="dataAlarmfields">The list of fields used to determine and generate the data alarms.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientObservationAlarm"/> objects generated for the patient.</returns>
|
||||
Task<List<PatientObservationAlarm>> GenerateAlarmByField(Patient patient, List<Field> dataAlarmfields);
|
||||
}
|
||||
@@ -14,72 +14,274 @@ public interface IObservationService : IApiRequestService
|
||||
/*
|
||||
List<PatientObservation> FindLastObservations(ObjectId patientId, string codingSystem, string code, int num = 2);
|
||||
*/
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all 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 returns an <see cref="IAsyncCursor{TDocument}"/> of <see cref="PatientObservation"/> instances for the given patient.</returns>
|
||||
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAsync(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves patient observations matching the specified patient identifier, coding system, and name.
|
||||
/// </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 (e.g., LOINC, SNOMED).</param>
|
||||
/// <param name="name">The name of the observation to filter by.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an <see cref="IAsyncCursor{TDocument}"/> of <see cref="PatientObservation"/> matching the criteria.</returns>
|
||||
Task<IAsyncCursor<PatientObservation>> FindByPatientIdAndCodingSystemAsync(ObjectId patientId, string codingSystem,
|
||||
string name);
|
||||
string name);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent patient observations for the specified patient, optionally filtered by a set of observation codes.
|
||||
/// </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. Defaults to 2.</param>
|
||||
/// <param name="filterObservations">An optional list of observation codes used to restrict the result set; if null, observations are not filtered by code.</param>
|
||||
/// <returns>A task that resolves to a list of the most recent <see cref="PatientObservation"/> entries matching the criteria.</returns>
|
||||
Task<List<PatientObservation>> FindLastObservations(ObjectId patientId, int num = 2,
|
||||
List<string>? filterObservations = null);
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the status of the provided patient observations that have reached their expiration.
|
||||
/// </summary>
|
||||
/// <param name="expiredObservations">The list of patient observations to update as expired.</param>
|
||||
Task UpdateExpiredObservations(List<PatientObservation> expiredObservations);
|
||||
/// <summary>
|
||||
/// Asynchronously expires observations that are no longer valid and recalculates the dependent data.
|
||||
/// </summary>
|
||||
Task ExpireObservationsAndRecalculateAsync();
|
||||
/// <summary>
|
||||
/// Asynchronously expires active alerts and powers off the device.
|
||||
/// </summary>
|
||||
Task ExpireAlertsAndPowerOffAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent unique patient observations for the specified patient, filtered by observation name, with an optional cache expiration window in seconds.
|
||||
/// </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="expires">Optional expiration time in seconds applied to the cached results. If <c>null</c>, no expiration is applied.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of the latest unique <see cref="PatientObservation"/> values matching the specified patient and name.</returns>
|
||||
Task<List<PatientObservation>> FindLatestUniqueValuesByName(ObjectId patientId, string name, int? expires);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent observations recorded for a patient, optionally filtered to a specific set of fields.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose observations are being retrieved.</param>
|
||||
/// <param name="filterObservations">An optional list of fields used to restrict which observations are returned. When null, observations for all fields are considered.</param>
|
||||
/// <param name="mapped">Indicates whether the returned observations should be mapped (default true) or returned in their raw form.</param>
|
||||
/// <param name="ct">The cancellation token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that resolves to a list of the patient's most recent <see cref="PatientObservation"/> entries.</returns>
|
||||
Task<List<PatientObservation>> FindLastObservationsByField(ObjectId patientId,
|
||||
List<Field>? filterObservations = null, bool mapped = true, CancellationToken ct = default);
|
||||
List<Field>? filterObservations = null, bool mapped = true, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the most recent intravenous line observations associated with a specific location for the given patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose intravenous line observations are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of nullable <see cref="PatientObservation"/> entries representing the latest intravenous line observations by location, where individual entries may be <c>null</c> when no data is available.</returns>
|
||||
Task<List<PatientObservation?>> FindLastIntravenousLinesObservationByLocation(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a patient observation, with options to control whether the observation is persisted and whether it is mapped.
|
||||
/// </summary>
|
||||
/// <param name="patientObservation">The patient observation to insert.</param>
|
||||
/// <param name="persistObs">Indicates whether the observation should be persisted; defaults to <c>true</c>.</param>
|
||||
/// <param name="mapObs">Indicates whether the observation should be mapped; defaults to <c>true</c>.</param>
|
||||
Task InsertObservation(PatientObservation patientObservation, bool persistObs = true, bool mapObs = true);
|
||||
/// <summary>
|
||||
/// Inserts the specified patient observation only if it has changed, optionally persisting the observation and applying a mapping during the insert.
|
||||
/// </summary>
|
||||
/// <param name="name">The name associated with the patient observation being evaluated for changes.</param>
|
||||
/// <param name="observation">The patient observation to compare against the existing value and potentially insert.</param>
|
||||
/// <param name="persistObs">Indicates whether the observation should be persisted when it is inserted. Defaults to <c>true</c>.</param>
|
||||
/// <param name="mapObs">Indicates whether the observation should be mapped as part of the insert operation. Defaults to <c>true</c>.</param>
|
||||
/// <returns>A task that returns <c>true</c> if the observation was inserted because a change was detected; otherwise, <c>false</c> if no insert was performed.</returns>
|
||||
Task<bool> InsertIfChanged(string name, PatientObservation observation, bool persistObs = true, bool mapObs = true);
|
||||
/// <summary>
|
||||
/// Inserts a new nurse observation for a patient into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="obs">The patient observation data recorded by the nurse to be persisted.</param>
|
||||
Task InsertNurseObservation(PatientObservation obs);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the patient whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the specified patient observation, preserving it for historical or compliance purposes while removing it from the active set.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation to archive.</param>
|
||||
/// <returns>A task that represents the asynchronous archive operation.</returns>
|
||||
Task Archive(PatientObservation observation);
|
||||
/// <summary>
|
||||
/// Asynchronously maps a <see cref="PatientObservation"/> to a corresponding observation, optionally restricting the lookup to name-based matching. Returns <see langword="null"/> when no matching observation is found.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source <see cref="PatientObservation"/> to be mapped.</param>
|
||||
/// <param name="onlyByName">When <see langword="true"/>, restricts the lookup to name-based matching; otherwise, the default mapping behavior is applied.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing the mapped <see cref="PatientObservation"/>, or <see langword="null"/> if no match is found.</returns>
|
||||
Task<PatientObservation?> MapObservation(PatientObservation obs, bool onlyByName = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent observation time for each patient, 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 latest observation.</returns>
|
||||
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime();
|
||||
/// <summary>
|
||||
/// Asynchronously maps or looks up a <see cref="PatientObservation"/> based on the name of the provided observation, returning the matching observation or <c>null</c> when no match is found.
|
||||
/// </summary>
|
||||
/// <param name="obs">The <see cref="PatientObservation"/> whose name is used to perform the mapping or lookup.</param>
|
||||
/// <returns>A <see cref="Task{PatientObservation}"/> that resolves to the matching <see cref="PatientObservation"/>, or <c>null</c> if no corresponding observation is found.</returns>
|
||||
Task<PatientObservation?> MapObservationsByName(PatientObservation obs);
|
||||
/// <summary>
|
||||
/// Archives the specified patient, moving their record out of the active set so that it is retained for historical or compliance purposes while no longer appearing in routine operational queries.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose record is to be archived.</param>
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose records should be archived.</param>
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing patient observation in the data store.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation containing the updated information.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
Task UpdateObservation(PatientObservation observation);
|
||||
/// <summary>
|
||||
/// Updates the specified identifier field (<paramref name="nameId"/>) across multiple objects, replacing the existing value <paramref name="oldId"/> with the new value <paramref name="id"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The name of the identifier field to be updated.</param>
|
||||
/// <param name="id">The new <see cref="ObjectId"/> value to assign to the field.</param>
|
||||
/// <param name="oldId">The current <see cref="ObjectId"/> value to be replaced.</param>
|
||||
/// <returns>A task that represents the asynchronous bulk update operation.</returns>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously broadcasts a patient observation to subscribed listeners or endpoints.
|
||||
/// </summary>
|
||||
/// <param name="obs">The base patient observation to be broadcast.</param>
|
||||
Task SendObsBroadcast(BasePatientObservation obs);
|
||||
/// <summary>
|
||||
/// Sends a broadcast containing the specified patient observations to the given patient location.
|
||||
/// </summary>
|
||||
/// <param name="obs">The list of patient observations to include in the broadcast.</param>
|
||||
/// <param name="location">The target patient location that will receive the broadcast.</param>
|
||||
Task SendObsBroadcast(List<PatientObservation> obs, PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously sends a broadcast of patient observations to the specified Point of Care (POC) system.
|
||||
/// </summary>
|
||||
/// <param name="obs">The list of patient observations to be transmitted in the broadcast.</param>
|
||||
/// <param name="pocId">The identifier of the Point of Care system that will receive the observations.</param>
|
||||
Task SendObsBroadcast(List<PatientObservation> obs, ObjectId pocId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent <see cref="PatientObservation"/> for a patient recorded before the specified date, optionally filtered by observation name.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observation is being queried.</param>
|
||||
/// <param name="date">The cutoff date; only observations recorded strictly before this date are considered.</param>
|
||||
/// <param name="obsName">The optional name of the observation to filter by, or <c>null</c> to match any observation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the latest matching <see cref="PatientObservation"/>, or <c>null</c> if none was found before the given date.</returns>
|
||||
Task<PatientObservation?> FindLastBeforeDate(ObjectId patientId, DateTime date, string? obsName);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the patient observations for the specified patient that share the given date, optionally filtered by observation name.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose observations will be searched.</param>
|
||||
/// <param name="date">The date used to match observations.</param>
|
||||
/// <param name="obsName">The optional observation name used to filter the results. When null, observations are not filtered by name.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of matching <see cref="PatientObservation"/> records, or null when no observations match the criteria.</returns>
|
||||
Task<List<PatientObservation>?> FindAnyWithSameDate(ObjectId patientId, DateTime date, string? obsName);
|
||||
|
||||
//TODO To implement
|
||||
/// <summary>
|
||||
/// Retrieves all patient observations recorded before the specified date, optionally filtered to a specific set of observation types.
|
||||
/// </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 before this date will be returned.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to restrict the results to specific observation types. When null, all observation types are included.</param>
|
||||
/// <returns>A task that resolves to a list of PatientObservation instances matching the criteria.</returns>
|
||||
Task<List<PatientObservation>> FindAllBeforeDate(ObjectId patientId, DateTime date,
|
||||
List<string>? filterObservations = null);
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
//TODO To implement
|
||||
/// <summary>
|
||||
/// Retrieves all <see cref="PatientObservation"/> entries for the specified patient recorded after the given date, optionally restricted to a subset of observation names.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="date">The cutoff date; only observations with a timestamp after this value are returned.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names to restrict the result to. When <c>null</c> or empty, all observations after the date are returned.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that yields the list of matching <see cref="PatientObservation"/> entries.</returns>
|
||||
Task<List<PatientObservation>> FindAllAfterDate(ObjectId patientId, DateTime date,
|
||||
List<string>? filterObservations = null);
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of patient observations for the specified patient within an optional date range, optionally filtered by observation names and including archived records when requested.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="startDate">The inclusive lower bound of the observation date range, or null to apply no lower bound.</param>
|
||||
/// <param name="endDate">The inclusive upper bound of the observation date range, or null to apply no upper bound.</param>
|
||||
/// <param name="filterObservations">An optional list of observation names used to restrict the returned observations.</param>
|
||||
/// <param name="fromArchived">When true, observations are retrieved from archived records; otherwise, only active records are considered.</param>
|
||||
/// <param name="filter">An optional pagination filter applied to the result set.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="PatientObservation"/> entries matching the provided criteria.</returns>
|
||||
Task<List<PatientObservation>> FindAllBetweenDates(ObjectId patientId, DateTime? startDate, DateTime? endDate,
|
||||
List<string>? filterObservations = null, bool fromArchived = false, PaginationFilter? filter = null);
|
||||
List<string>? filterObservations = null, bool fromArchived = false, PaginationFilter? filter = null);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent non-expired observations for the specified patient, optionally filtered by observation name and constrained by pagination parameters.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose observations are being queried.</param>
|
||||
/// <param name="name">The name of the observation type used to filter the results.</param>
|
||||
/// <param name="endAfter">Optional parameter that defines the pagination boundary; when provided, observations are returned starting after this position.</param>
|
||||
/// <param name="num">Optional parameter that limits the maximum number of observations returned.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a collection of matching non-expired <see cref="PatientObservation"/> records; an empty collection is returned if none are found.</returns>
|
||||
Task<IEnumerable<PatientObservation>> FindLastNotExpiredObservatonsByPatient(ObjectId patientId, string name,
|
||||
int? endAfter = null, int? num = null);
|
||||
int? endAfter = null, int? num = null);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks observations and expires those that meet the expiration criteria.
|
||||
/// </summary>
|
||||
Task CheckAndExpireObservations();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves patient observations that have not been marked as expired but should be, based on their validity period or business rules.
|
||||
/// </summary>
|
||||
/// <returns>An asynchronous stream of <see cref="PatientObservation"/> instances that are not expired but meet the criteria to be expired.</returns>
|
||||
IAsyncEnumerable<PatientObservation> FindNotExpiredObservationsShouldBeExpired();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Processes a collection of patient observations, associating them with the specified patient and recording the message time.
|
||||
/// </summary>
|
||||
/// <param name="observations">The list of patient observations to process.</param>
|
||||
/// <param name="patient">The patient associated with the observations.</param>
|
||||
/// <param name="messageTime">The timestamp of the message containing the observations.</param>
|
||||
/// <param name="observationData">Optional additional data related to the observations.</param>
|
||||
void ProcessObservations(List<PatientObservation> observations, Patient patient, DateTime messageTime,
|
||||
ObservationData? observationData = null);
|
||||
ObservationData? observationData = null);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously processes and expires observations that have exceeded their validity period.
|
||||
/// </summary>
|
||||
Task ExpireObservations();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a simple patient observation record.
|
||||
/// </summary>
|
||||
/// <param name="observation">The patient observation to insert.</param>
|
||||
/// <returns>A task that represents the asynchronous insert operation.</returns>
|
||||
Task InsertSimpleObservation(PatientObservation observation);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a paginated collection of patient observations based on the specified filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that controls the page size, page number, and any additional query criteria applied to the patient observations.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a <see cref="PaginationResponse{T}"/> of <see cref="PatientObservation"/> with the requested page of results.</returns>
|
||||
Task<PaginationResponse<PatientObservation>> GetPaginatedObservations(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Asynchronously saves a nurse observation request.
|
||||
/// </summary>
|
||||
/// <param name="request">The API request containing the nurse observation data to save.</param>
|
||||
Task SaveRequestNurseObsAsync(ApiRequest request);
|
||||
}
|
||||
@@ -6,12 +6,45 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IPatientCarePlanService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a 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 retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientCarePlan"/> records for the given patient.</returns>
|
||||
Task<List<PatientCarePlan>> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves a 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 retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of patient care plans associated with the user.</returns>
|
||||
Task<List<PatientCarePlan>> FindByUserId(ObjectId userId);
|
||||
/// <summary>
|
||||
/// Retrieves all patient care plans from the system.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a list of all <see cref="PatientCarePlan"/> records.</returns>
|
||||
Task<List<PatientCarePlan>> FindAll();
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a single patient care plan into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="patientCarePlan">The patient care plan to insert.</param>
|
||||
Task InsertOneAsync(PatientCarePlan patientCarePlan);
|
||||
/// <summary>
|
||||
/// Archives the care plan associated with a finished procedure for the specified patient, processing the provided list of items to be archived.
|
||||
/// </summary>
|
||||
/// <param name="patientWithFinishedProcedure">The patient whose procedure has been completed and whose care plan should be archived.</param>
|
||||
/// <param name="itemsToArchive">The collection of option list items to be archived as part of the care plan archival process.</param>
|
||||
Task ArchiveCarePlanFromJob(Patient patientWithFinishedProcedure, List<OptionList> itemsToArchive);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously archives records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientid">The unique identifier of the patient whose records are to be archived.</param>
|
||||
Task ArchiveByPatientId(ObjectId patientid);
|
||||
/// <summary>
|
||||
/// Updates the ObjectId references from the specified old identifier to a new one across multiple records associated with the given patient.
|
||||
/// </summary>
|
||||
/// <param name="patientid">The string identifier of the patient whose related records will be updated.</param>
|
||||
/// <param name="patientId">The ObjectId of the patient used to locate the records to update.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced in the matched records.</param>
|
||||
Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId);
|
||||
}
|
||||
@@ -11,74 +11,358 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IPatientService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient by their unique patient identifier, optionally including location information.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to find.</param>
|
||||
/// <param name="withLocation">When set to <c>true</c>, includes location details in the returned patient; otherwise, only basic patient data is returned.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the found <see cref="Patient"/>, or <c>null</c> if no patient matches the specified identifier.</returns>
|
||||
Task<Patient?> FindByPatientId(string patientId, bool withLocation = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient by their unique identifier, applying the specified locale for localized data.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to locate.</param>
|
||||
/// <param name="localeEnum">The locale to use when retrieving or formatting localized patient information.</param>
|
||||
/// <returns>A task that resolves to the matching patient, or <c>null</c> if no patient is found for the given identifier.</returns>
|
||||
Task<Patient?> FindByPatientIdWithLocale(string patientId, LocaleEnum localeEnum);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves an archived <see cref="Patient"/> matching the specified patient number, returning <c>null</c> when no matching archived record is found.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the archived patient record.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that yields the matching archived <see cref="Patient"/>, or <c>null</c> if no archived patient is found.</returns>
|
||||
Task<Patient?> FindByPatientNumberArchived(string patientNumber);
|
||||
/// <summary>
|
||||
/// Retrieves a patient by their unique patient number, optionally including location information in the result.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
|
||||
/// <param name="withLocation">When <c>true</c>, location information is included in the returned patient; otherwise, it is omitted.</param>
|
||||
/// <returns>A task that yields the matching <see cref="Patient"/> if one is found, or <c>null</c> when no patient matches the given number.</returns>
|
||||
Task<Patient?> FindByPatientNumber(string patientNumber, bool withLocation = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient associated with the specified location.
|
||||
/// Returns <see langword="null"/> if no matching patient is found or if the location is <see langword="null"/>.
|
||||
/// </summary>
|
||||
/// <param name="location">The patient location used to search for a matching patient. May be <see langword="null"/>.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Patient"/>, or <see langword="null"/> if no patient is found.</returns>
|
||||
Task<Patient?> FindByLocation(PatientLocation? location);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient associated with the specified Point of Care identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The ObjectId representing the Point of Care identifier used to look up the patient.</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?> FindByPointOfCareId(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a patient identified by the specified unit and point-of-care identifiers.
|
||||
/// </summary>
|
||||
/// <param name="unit">The unique identifier of the unit to search within.</param>
|
||||
/// <param name="pointOfCare">The unique identifier of the point-of-care associated with the patient.</param>
|
||||
/// <returns>A task that yields the matching <see cref="Patient"/>, or <c>null</c> if no patient is found for the given unit and point-of-care.</returns>
|
||||
Task<Patient?> FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare);
|
||||
/// <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 locate matching patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> objects that match the specified point of care.</returns>
|
||||
Task<List<Patient>> FindByPointOfCare(string pointOfCare);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of patients associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The ObjectId of the unit whose patients should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total count of patients for the given unit.</returns>
|
||||
Task<long> CountPatientsByUnitId(ObjectId unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously locates a patient using the provided identifiers, supporting lookup by patient
|
||||
/// ID, patient number, or location when <paramref name="findByLocation"/> is enabled.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient to find.</param>
|
||||
/// <param name="patientNumber">The patient number used as an alternative lookup key.</param>
|
||||
/// <param name="location">The patient location used when searching by location.</param>
|
||||
/// <param name="findByLocation">When <c>true</c>, the search is performed using the supplied
|
||||
/// <paramref name="location"/> instead of the patient identifiers.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that yields the matching <see cref="Patient"/>, or
|
||||
/// <c>null</c> if no patient is found.</returns>
|
||||
Task<Patient?> FindPatient(string? patientId, string? patientNumber, PatientLocation? location,
|
||||
bool findByLocation = false);
|
||||
bool findByLocation = false);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a new patient record into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity to be inserted.</param>
|
||||
Task Insert(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously inserts the specified <see cref="Patient"/> into the data store.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient entity to be persisted.</param>
|
||||
Task InsertAsync(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives the specified patient record.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
Task ArchivePatient(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives the patient data identified by the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientid">The unique identifier of the patient whose data should be archived.</param>
|
||||
Task ArchivePatientData(ObjectId patientid);
|
||||
/// <summary>
|
||||
/// Merges the specified patient record with the existing patient identified by the old patient number.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient data to merge into the existing record.</param>
|
||||
/// <param name="oldPatienNumber">The identifier of the existing patient record to be merged.</param>
|
||||
Task MergePatient(Patient patient, string oldPatienNumber);
|
||||
/// <summary>
|
||||
/// Updates the location of a patient identified by the specified object identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose location will be updated.</param>
|
||||
/// <param name="location">The new patient location, or <c>null</c> if no location is provided.</param>
|
||||
Task UpdateLocation(ObjectId id, PatientLocation? location);
|
||||
/// <summary>
|
||||
/// Updates the attending doctor for the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the entity whose attending doctor will be updated.</param>
|
||||
/// <param name="doctor">The new attending doctor to assign to the entity.</param>
|
||||
/// <returns>A task that represents the asynchronous update operation.</returns>
|
||||
Task UpdateAttendingDoctor(ObjectId id, Person doctor);
|
||||
/// <summary>
|
||||
/// Updates the data of an existing patient identified by the given identifier, optionally replacing the patient number when the <paramref name="updatePatientNumber"/> flag is true.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose data will be updated.</param>
|
||||
/// <param name="patientNumber">The patient number to be applied to the patient.</param>
|
||||
/// <param name="data">The person data to assign to the patient.</param>
|
||||
/// <param name="updatePatientNumber">Indicates whether the patient number should also be updated; defaults to true.</param>
|
||||
Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true);
|
||||
/// <summary>
|
||||
/// Updates the patient data for the specified patient identified by <paramref name="id"/> and <paramref name="patientNumber"/>, applying the changes from the provided <paramref name="patient"/> object. When <paramref name="updatePatientNumber"/> is <c>true</c>, the patient number is also updated as part of the operation; otherwise, only the remaining patient fields are updated.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient record to update.</param>
|
||||
/// <param name="patientNumber">The current patient number used to locate the patient record.</param>
|
||||
/// <param name="patient">The patient object containing the updated data to be applied.</param>
|
||||
/// <param name="updatePatientNumber">A flag indicating whether the patient number should also be updated; defaults to <c>true</c>.</param>
|
||||
/// <returns>A <see cref="Task"/> that represents the asynchronous update operation.</returns>
|
||||
Task UpdatePatientData(ObjectId id, string patientNumber, Patient patient, bool updatePatientNumber = true);
|
||||
/// <summary>
|
||||
/// Updates the specified patient record.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose information will be updated.</param>
|
||||
Task Update(Patient patient);
|
||||
/// <summary>
|
||||
/// Moves the specified patient from the old point of care to the new point of care.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be moved.</param>
|
||||
/// <param name="newPocId">The identifier of the destination point of care.</param>
|
||||
/// <param name="oldPocId">The identifier of the source point of care.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the move was successful; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> Move(Patient patient, ObjectId newPocId, ObjectId oldPocId);
|
||||
/// <summary>
|
||||
/// Retrieves a patient by their unique identifier, optionally including location information.
|
||||
/// Returns <c>null</c> when no patient matches the provided identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> used to look up the patient.</param>
|
||||
/// <param name="withLocation">When <c>true</c>, includes the patient's location data in the result; otherwise, location data is omitted.</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, bool withLocation = false);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Box"/> associated with the specified <see cref="PointOfCare"/>, returning <see langword="null"/> when no box is found for the given point of care.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care used to look up the associated box.</param>
|
||||
/// <param name="observations">When <see langword="true"/>, observations are included with the returned box; otherwise, observations are omitted.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to restrict which observations are loaded when <paramref name="observations"/> is <see langword="true"/>.</param>
|
||||
/// <returns>A <see cref="Task{Box}"/> that resolves to the matching <see cref="Box"/>, or <see langword="null"/> if no box exists for the specified point of care.</returns>
|
||||
Task<Box?> GetBox(PointOfCare poc, bool observations = false, List<string>? filterObservations = null);
|
||||
/// <summary>
|
||||
/// Creates a <see cref="Patient"/> instance from the provided <see cref="ApiRequest"/>, optionally ignoring location information during the creation process.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the data used to construct the patient.</param>
|
||||
/// <param name="ignoreLocation">When <c>true</c>, location information is ignored during patient creation. Defaults to <c>false</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the created <see cref="Patient"/>, or <c>null</c> if the patient could not be created.</returns>
|
||||
Task<Patient?> CreatePatientFromRequest(ApiRequest apiRequest, bool ignoreLocation = false);
|
||||
/// <summary>
|
||||
/// Asynchronously finds a patient based on the information provided in the specified API request.
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the data used to look up the patient.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if found, or null if no patient matches the request.</returns>
|
||||
Task<Patient?> FindPatientByApiRequest(ApiRequest apiRequest);
|
||||
/// <summary>
|
||||
/// Archives patients who have no observations recorded since the specified date.
|
||||
/// </summary>
|
||||
/// <param name="date">The cutoff date; patients without observations after this date are archived.</param>
|
||||
Task ArchivePatientWithoutObservationsSinceDate(DateTime date);
|
||||
|
||||
/// <summary>
|
||||
/// Archives patient records for patients who have been discharged longer than the specified time threshold.
|
||||
/// </summary>
|
||||
/// <param name="hoursBeforeArchive">The number of hours a patient must have been discharged before being archived.</param>
|
||||
Task ArchiveDischargedPatients(int hoursBeforeArchive);
|
||||
/// <summary>
|
||||
/// Retrieves all patients, optionally including their location data when requested.
|
||||
/// </summary>
|
||||
/// <param name="withLocation">Indicates whether location information should be included in the returned patient records.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> objects.</returns>
|
||||
Task<List<Patient>> FindAll(bool withLocation = false);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of patients based on the provided pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the paging criteria used to retrieve patients.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PaginationResponse{Patient}"/> with the requested page of patients.</returns>
|
||||
Task<PaginationResponse<Patient>> GetPaginatedPatients(PaginationFilter filter);
|
||||
|
||||
/// <summary>
|
||||
/// Discharges patients who have been inactive since the specified date and archives them after the defined retention period.
|
||||
/// </summary>
|
||||
/// <param name="sinceDate">The date used to identify patients that have been inactive since this point in time.</param>
|
||||
/// <param name="hoursBeforeArchive">The number of hours of inactivity that must elapse before a discharged patient is archived.</param>
|
||||
Task DischargeInactivePatients(DateTime sinceDate, int hoursBeforeArchive);
|
||||
/// <summary>
|
||||
/// Updates an existing patient record with the provided patient data. Returns the updated patient, or <c>null</c> if no matching patient was found.
|
||||
/// </summary>
|
||||
/// <param name="updatedPatient">The patient object containing the updated information to be persisted.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that resolves to the updated <see cref="Patient"/>, or <c>null</c> if the patient could not be found.</returns>
|
||||
Task<Patient?> UpdateOne(Patient updatedPatient);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous broadcast notification to inform relevant subscribers or systems about a newly registered patient.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose information will be included in the broadcast notification.</param>
|
||||
Task SendNewPatientBroadcast(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously sends a broadcast notification about an update to the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose update information will be broadcast.</param>
|
||||
Task SendPatientUpdateBroadcast(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the list of inactive Patients of Care (PoC), allowing consumers to identify
|
||||
/// patients that are no longer active in the system for reporting, cleanup, or follow-up workflows.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of inactive <see cref="Patient"/> records.</returns>
|
||||
Task<List<Patient>> FindInActivePoC();
|
||||
/// <summary>
|
||||
/// Retrieves a list of patients associated with inactive PoC records.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="Patient"/> objects associated with inactive PoC records.</returns>
|
||||
Task<List<Patient>> FindInInactivePoC();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="Patient"/> associated with the specified <paramref name="item"/> point of care, returning <c>null</c> when no matching patient is found.
|
||||
/// When <paramref name="observations"/> is <c>true</c>, the result includes the patient's observations, optionally restricted by the identifiers supplied in <paramref name="filterObservations"/>.
|
||||
/// </summary>
|
||||
/// <param name="item">The point of care used to look up the associated patient.</param>
|
||||
/// <param name="observations">Indicates whether the patient's observations should be included in the returned patient.</param>
|
||||
/// <param name="filterObservations">An optional list of observation identifiers used to filter which observations are returned when <paramref name="observations"/> is <c>true</c>.</param>
|
||||
/// <returns>A <see cref="Task{Patient}"/> that resolves to the matching <see cref="Patient"/>, or <c>null</c> if no patient is found for the given point of care.</returns>
|
||||
Task<Patient?> GetByPointOfCare(PointOfCare item, bool observations = false,
|
||||
List<string>? filterObservations = null);
|
||||
List<string>? filterObservations = null);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Patient"/> matching the specified point of care, optionally narrowed by unit and locale.
|
||||
/// </summary>
|
||||
/// <param name="item">The point of care used to locate the patient.</param>
|
||||
/// <param name="unit">An optional unit that further filters the lookup.</param>
|
||||
/// <param name="localeEnum">An optional locale used to scope the search.</param>
|
||||
/// <returns>A task that yields the matching <see cref="Patient"/>, or <c>null</c> when no patient is found.</returns>
|
||||
Task<Patient?> GetByPointOfCareAndLocale(PointOfCare item, Unit? unit, LocaleEnum? localeEnum);
|
||||
/// <summary>
|
||||
/// Updates the altable (allergy table) information for the specified patient and returns the updated patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose altable is being updated.</param>
|
||||
/// <param name="altable">The option list containing the altable data to apply to the patient.</param>
|
||||
/// <param name="user">The user performing the update, or <c>null</c> when no user context is available.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Patient"/>, or <c>null</c> if the patient was not found.</returns>
|
||||
Task<Patient?> UpdatePatientAltable(ObjectId patientId, OptionList altable, User? user);
|
||||
/// <summary>
|
||||
/// Exits a patient identified by the given identifier, optionally archiving the patient record.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient to exit.</param>
|
||||
/// <param name="archivePatient">When true, the patient record is archived as part of the exit process; when false, archiving is skipped.</param>
|
||||
Task ExitPatientById(ObjectId id, bool archivePatient = true);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified master list for a patient with the provided options and returns the updated patient record.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose master list is being updated.</param>
|
||||
/// <param name="typeName">The type of master list to update.</param>
|
||||
/// <param name="updatedOptions">The new list of options to apply to the master list.</param>
|
||||
/// <param name="user">The user performing the update, or null if not specified.</param>
|
||||
/// <param name="carePlanLog">Optional care plan log entries associated with the update.</param>
|
||||
/// <returns>A task that returns the updated <see cref="Patient"/>, or null if the patient was not found.</returns>
|
||||
Task<Patient?> UpdatePatientMasterList(ObjectId patientId, MasterListType typeName,
|
||||
List<OptionList> updatedOptions,
|
||||
User? user, List<OptionList>? carePlanLog);
|
||||
List<OptionList> updatedOptions,
|
||||
User? user, List<OptionList>? carePlanLog);
|
||||
|
||||
/// <summary>
|
||||
/// Generates a nurse care plan of the specified type, using the provided options, and inserts it for the patient.
|
||||
/// </summary>
|
||||
/// <param name="carePlanType">The master list type that determines which nurse care plan template to generate.</param>
|
||||
/// <param name="options">Optional list of options applied during care plan generation. May be null.</param>
|
||||
/// <param name="patient">The patient for whom the nurse care plan is generated and inserted.</param>
|
||||
/// <param name="user">The user associated with the care plan generation. May be null.</param>
|
||||
/// <returns>A task that completes when the nurse care plan has been generated and inserted.</returns>
|
||||
Task GenerateNurseCarePlanAndInsert(MasterListType carePlanType, List<OptionList>? options,
|
||||
Patient patient, User? user);
|
||||
Patient patient, User? user);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the incoming data for the specified patient by applying the provided patient information.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose incoming data is being updated.</param>
|
||||
/// <param name="person">The patient object containing the incoming data to be applied to the patient record.</param>
|
||||
Task UpdatePatientIncomingData(ObjectId patientId, Patient person);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the demographic data of an existing patient identified by the specified patient 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 new demographic information to apply.</param>
|
||||
/// <param name="user">The user performing the update operation, or <see langword="null"/> if no user context is available.</param>
|
||||
Task UpdatePatientDemographicData(ObjectId patientId, Patient person, User? user);
|
||||
/// <summary>
|
||||
/// Searches for a patient by their patient number within a distinct unit.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The patient number used to identify the patient.</param>
|
||||
/// <param name="unitId">The identifier of the distinct unit where the patient is registered.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Patient"/> if found; otherwise, <see langword="null"/>.</returns>
|
||||
Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients whose procedures have been finished, filtering based on the specified archive threshold for procedure end times.
|
||||
/// </summary>
|
||||
/// <param name="archiveProcedureEndDateAfterMinutes">The number of minutes after the procedure end date used as the archive threshold to qualify patients with finished procedures.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> objects that match the finished procedures criteria.</returns>
|
||||
Task<List<Patient>> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all patients who have completed a test, using the specified archive window in minutes to determine which tests are considered finished.
|
||||
/// </summary>
|
||||
/// <param name="archiveTestEndDateAfterMinutes">The time window in minutes applied to the test end date to identify tests that should be treated as finished/archived.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Patient"/> instances with finished tests.</returns>
|
||||
Task<List<Patient>> FindAllPatientWithFinishedTest(int archiveTestEndDateAfterMinutes);
|
||||
/// <summary>
|
||||
/// Retrieves a list of patients whose treatments have finished, based on the specified archive time threshold in minutes after the treatment end date.
|
||||
/// </summary>
|
||||
/// <param name="archiveTreatmentEndDateAfterMinutes">The number of minutes after the treatment end date used to determine which finished treatments should be included.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of patients with finished treatment matching the specified criteria.</returns>
|
||||
Task<List<Patient>> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the incoming income data of a patient using the specified changes and the user performing the operation.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose income data is being updated.</param>
|
||||
/// <param name="person">The patient entity associated with the update.</param>
|
||||
/// <param name="personDataChange">The income data changes to apply to the patient.</param>
|
||||
/// <param name="user">The user performing the update operation.</param>
|
||||
Task UpdatePatientIncomingData(ObjectId patientId, Patient person, PatientIncomeData personDataChange,
|
||||
User user);
|
||||
User user);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a patient master list item change based on the provided update options, unit list, and type name.
|
||||
/// </summary>
|
||||
/// <param name="opt">The update options for the master list item.</param>
|
||||
/// <param name="unitList">The collection of units associated with the update.</param>
|
||||
/// <param name="typeName">The name of the type used to categorize the master list item.</param>
|
||||
Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList,
|
||||
string typeName);
|
||||
string typeName);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a patient master list item based on the specified option, unit list, and type name.
|
||||
/// </summary>
|
||||
/// <param name="opt">The option list containing the details of the patient master list item to delete.</param>
|
||||
/// <param name="unitList">The collection of units associated with the patient master list item.</param>
|
||||
/// <param name="typeName">The name of the type identifying the patient master list item to be deleted.</param>
|
||||
Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName);
|
||||
}
|
||||
@@ -6,17 +6,62 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IPermissionService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the set of display permission types applicable to the specified user for the given display.
|
||||
/// </summary>
|
||||
/// <param name="display">The display for which permissions are being evaluated.</param>
|
||||
/// <param name="user">The user whose permissions for the display are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="DisplayPermissionTypes"/> granted to the user for the display.</returns>
|
||||
public Task<DisplayPermissionTypes> GetPermissionsForDisplay(Display display, User user);
|
||||
/// <summary>
|
||||
/// Retrieves the display-friendly permission types applicable to the specified user for the given unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose permissions are being queried.</param>
|
||||
/// <param name="user">The user whose permissions for the unit should be evaluated.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="DisplayPermissionTypes"/> for the specified unit and user.</returns>
|
||||
public Task<DisplayPermissionTypes> GetPermissionsForUnit(string unitId, User user);
|
||||
/// <summary>
|
||||
/// Retrieves the panel permission types associated with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="user">The user whose panel permissions are being queried.</param>
|
||||
/// <returns>The <see cref="PanelPermissionTypes"/> granted to the specified user.</returns>
|
||||
public PanelPermissionTypes GetPermissionsForPanel(User user);
|
||||
/// <summary>
|
||||
/// Retrieves the panel permission types associated with the specified user.
|
||||
/// </summary>
|
||||
/// <param name="user">The identifier or name of the user whose panel permissions are being requested.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="PanelPermissionTypes"/> granted to the user.</returns>
|
||||
public Task<PanelPermissionTypes> GetPermissionsForPanel(string user);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously checks whether the specified user, with the given role and source permission, has access to the specified display.
|
||||
/// </summary>
|
||||
/// <param name="username">The name of the user whose access is being verified.</param>
|
||||
/// <param name="role">The role assigned to the user, used to determine access rights.</param>
|
||||
/// <param name="source">The source permission type considered when evaluating access.</param>
|
||||
/// <param name="displayId">The identifier of the display for which access is being checked.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the user has access to the display; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> HasAccessToDisplay(string username, PermissionEnum.RolesType role,
|
||||
PermissionEnum.SourcePermissionsEnum source, string displayId);
|
||||
PermissionEnum.SourcePermissionsEnum source, string displayId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously determines whether the specified user, with the given role and permission source, has access to the identified unit.
|
||||
/// </summary>
|
||||
/// <param name="username">The identifier of the user whose access is being evaluated.</param>
|
||||
/// <param name="role">The role assigned to the user, used in the access evaluation.</param>
|
||||
/// <param name="source">The permission source used to resolve the user's access rights.</param>
|
||||
/// <param name="unitId">The identifier of the unit to check access against.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the user has access to the specified unit; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> HasAccessToUnit(string username, PermissionEnum.RolesType role,
|
||||
PermissionEnum.SourcePermissionsEnum source, string unitId);
|
||||
PermissionEnum.SourcePermissionsEnum source, string unitId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously determines whether the specified user has access to a panel based on their role and the requested source permission.
|
||||
/// </summary>
|
||||
/// <param name="username">The identifier of the user whose panel access is being evaluated.</param>
|
||||
/// <param name="role">The role assigned to the user, used to resolve applicable permissions.</param>
|
||||
/// <param name="source">The source permission being checked against the user's access rights.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the user has access to the panel; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> HasAccessToPanel(string username, PermissionEnum.RolesType role,
|
||||
PermissionEnum.SourcePermissionsEnum source);
|
||||
PermissionEnum.SourcePermissionsEnum source);
|
||||
}
|
||||
@@ -4,5 +4,10 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IPoCMappingService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified <paramref name="original"/> patient location to a new <see cref="PatientLocation"/>, returning <c>null</c> when no corresponding mapping result is found.
|
||||
/// </summary>
|
||||
/// <param name="original">The source patient location to map from.</param>
|
||||
/// <returns>A task that yields the mapped <see cref="PatientLocation"/>, or <c>null</c> if no mapping result is available.</returns>
|
||||
Task<PatientLocation?> Map(PatientLocation original);
|
||||
}
|
||||
@@ -9,50 +9,200 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IPointOfCareService
|
||||
{
|
||||
/// <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>
|
||||
Task Delete(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing point of care record with the provided information.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The point of care entity containing the updated data.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the updated point of care, or null if no matching record was found.</returns>
|
||||
Task<PointOfCare?> Update(PointOfCare pointOfCare);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates an existing unit identified by the specified identifier with the provided unit data.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the unit to update.</param>
|
||||
/// <param name="unit">The unit data to apply to the existing record.</param>
|
||||
Task UpdateUnit(ObjectId id, Unit unit);
|
||||
/// <summary>
|
||||
/// Retrieves all PointOfCare records asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all PointOfCare entries.</returns>
|
||||
Task<List<PointOfCare>> GetAll();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all PointOfCare configurations.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="PointOfCare"/> configurations.</returns>
|
||||
Task<List<PointOfCare>> GetAllConfigs();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all point-of-care location information.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of all <see cref="PointOfCare"/> locations.</returns>
|
||||
Task<List<PointOfCare>> GetAllLocationInfo();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the point of care configuration identified by the specified identifier with the provided configuration data.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the point of care configuration to update.</param>
|
||||
/// <param name="configuration">The new configuration data to apply.</param>
|
||||
Task UpdateConfiguration(ObjectId id, PointOfCareConfiguration configuration);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="PointOfCare"/> entity by its unique identifier, returning null if no matching record is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the <see cref="PointOfCare"/> to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous lookup operation. The task result contains the matching <see cref="PointOfCare"/> if found, or null when no entity with the specified identifier exists.</returns>
|
||||
Task<PointOfCare?> FindById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="PointOfCare"/> entity by its identifier, including all of its associated configuration data.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> of the <see cref="PointOfCare"/> to locate.</param>
|
||||
/// <returns>A task that yields the matching <see cref="PointOfCare"/> with its full configuration, or <c>null</c> if no entity is found for the supplied identifier.</returns>
|
||||
Task<PointOfCare?> FindByIdAllConfig(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all PointOfCare records associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unit">The unique identifier of the unit whose PointOfCare records should be retrieved.</param>
|
||||
/// <returns>A task that returns a collection of PointOfCare records for the specified unit, or <c>null</c> if no records are found.</returns>
|
||||
Task<IEnumerable<PointOfCare>?> FindAllByUnitId(ObjectId unit);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of Points of Care associated with the specified room.
|
||||
/// </summary>
|
||||
/// <param name="room">The room identifier used to look up the associated Points of Care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains an enumerable of Points of Care found for the given room, or <c>null</c> if no matching results are found.</returns>
|
||||
Task<IEnumerable<PointOfCare>?> FindByRoom(string room);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of points of care associated with the specified bed.
|
||||
/// </summary>
|
||||
/// <param name="bed">The bed identifier used to look up the associated points of care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of <see cref="PointOfCare"/> instances matching the bed, or <c>null</c> if no match is found.</returns>
|
||||
Task<IEnumerable<PointOfCare>?> FindByBed(string bed);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all points of care associated with the specified unit identifiers.
|
||||
/// </summary>
|
||||
/// <param name="unitIds">The list of unit identifiers used to look up the associated points of care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of points of care matching the provided unit identifiers.</returns>
|
||||
Task<List<PointOfCare>> FindAllByUnitIds(List<ObjectId> unitIds);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the information of a point of care by its identifier, optionally localized and enriched with patient data.
|
||||
/// Returns <c>null</c> when no point of care matches the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the point of care to retrieve.</param>
|
||||
/// <param name="locale">Optional locale used to localize the retrieved point of care information; when <c>null</c>, the default locale is used.</param>
|
||||
/// <param name="fillPatientData">When <c>true</c>, associated patient data is included in the result; when <c>false</c>, only the point of care information is returned.</param>
|
||||
/// <param name="ct">Token to cancel the asynchronous operation.</param>
|
||||
/// <returns>A task that yields the <see cref="PointOfCare"/> corresponding to the given identifier, or <c>null</c> if it is not found.</returns>
|
||||
Task<PointOfCare?> GetInfo(ObjectId id, LocaleEnum? locale = null, bool fillPatientData = true, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a new <see cref="PointOfCare"/> record into the system.
|
||||
/// </summary>
|
||||
/// <param name="pointOfCare">The <see cref="PointOfCare"/> entity to be inserted.</param>
|
||||
/// <returns>A <see cref="Task{PointOfCare}"/> containing the inserted <see cref="PointOfCare"/>, or <c>null</c> if the insertion was not performed.</returns>
|
||||
Task<PointOfCare?> InsertPointOfCare(PointOfCare pointOfCare);
|
||||
/// <summary>
|
||||
/// Retrieves the Point of Care associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose Point of Care is being looked up.</param>
|
||||
/// <returns>A task that yields the <see cref="PointOfCare"/> associated with the patient, or <c>null</c> if no Point of Care is found for the given patient identifier.</returns>
|
||||
Task<PointOfCare?> FindPoCByPatientId(ObjectId patientId);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously sets the Point of Care status for the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity whose Point of Care status will be updated.</param>
|
||||
/// <param name="status">The Point of Care status to assign to the entity.</param>
|
||||
/// <returns>A task that represents the asynchronous status update operation.</returns>
|
||||
Task SetPointOfCareStatus(ObjectId id, StatusEnum.PointOfCare status);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the points of care associated with the specified unit and point-of-care status, optionally excluding virtual ones.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose points of care are queried.</param>
|
||||
/// <param name="poc">The point-of-care status used to filter the results.</param>
|
||||
/// <param name="excludeVirtual">When <c>true</c>, virtual points of care are excluded from the results; otherwise, they are included.</param>
|
||||
/// <returns>A task that returns the matching collection of <see cref="PointOfCare"/> entries.</returns>
|
||||
Task<IEnumerable<PointOfCare>> FindByUnitAndStatus(ObjectId unitId, StatusEnum.PointOfCare poc,
|
||||
bool excludeVirtual = false);
|
||||
bool excludeVirtual = false);
|
||||
|
||||
/// <summary>
|
||||
/// Checks the next admission for the specified patient location.
|
||||
/// </summary>
|
||||
/// <param name="patientLocation">The optional identifier of the patient location to check.</param>
|
||||
void CheckNextAdmission(ObjectId? patientLocation);
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="PointOfCare"/> associated with the specified bed and unit identifier, returning <c>null</c> when no matching record is found.
|
||||
/// </summary>
|
||||
/// <param name="bed">The bed identifier used to locate the point of care.</param>
|
||||
/// <param name="unitId">The MongoDB <see cref="ObjectId"/> of the unit the point of care belongs to.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the matching <see cref="PointOfCare"/> or <c>null</c> if no record matches the supplied bed and unit.</returns>
|
||||
Task<PointOfCare?> FindByBedAndUnitId(string? bed, ObjectId? unitId);
|
||||
/// <summary>
|
||||
/// Updates the relay configuration associated with the specified point-of-care device.
|
||||
/// </summary>
|
||||
/// <param name="poc">The point-of-care device whose relay configuration should be updated.</param>
|
||||
Task UpdateRelayConfig(PointOfCare poc);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the Point of Care (PoC) associated with the specified patient number.
|
||||
/// Returns <c>null</c> if no matching Point of Care is found for the given patient number.
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the associated Point of Care.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="PointOfCare"/> if found, or <c>null</c> if no match exists.</returns>
|
||||
Task<PointOfCare?> FindPoCByPatientNumber(string patientNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of Points of Contact (PoCs) associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose PoCs should be counted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the total number of PoCs linked to the given unit.</returns>
|
||||
Task<long> CountPoCsByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the total number of virtual Proofs of Concept (PoCs) associated with the specified unit.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose virtual PoCs should be counted.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> that represents the asynchronous operation, containing the count of virtual PoCs for the given unit.</returns>
|
||||
Task<long> CountVirtualPoCsByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of Points of Care based on the provided filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination parameters used to control page size and page number.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response of Points of Care.</returns>
|
||||
Task<PaginationResponse<PointOfCare>> GetPaginatedPoCs(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Deletes all PoCs associated with the specified unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose PoCs should be removed.</param>
|
||||
Task DeletePoCsByUnitId(ObjectId unitId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of all camera identifiers that are currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a HashSet of ObjectId values representing the cameras currently in use.</returns>
|
||||
Task<HashSet<ObjectId>> FindAllIdCamerasInUse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of all ID relays that are currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="HashSet{ObjectId}"/> of the ID relays currently in use.</returns>
|
||||
Task<HashSet<ObjectId>> FindAllIdRelaysInUse();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the set of all ID beacons currently in use.
|
||||
/// </summary>
|
||||
/// <returns>A task containing a <see cref="HashSet{ObjectId}"/> of the ID beacons that are active or in use.</returns>
|
||||
Task<HashSet<ObjectId>> FindAllIdBeaconsInUse();
|
||||
/// <summary>
|
||||
/// Retrieves all Point of Care entries associated with the specified unit, including their related devices.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The unique identifier of the unit whose Point of Care entries should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a collection of Point of Care entries with their devices, or <c>null</c> if no entries are found for the given unit.</returns>
|
||||
Task<IEnumerable<PointOfCare>?> FindAllByUnitIdWithDevices(ObjectId unitId);
|
||||
}
|
||||
@@ -2,8 +2,31 @@
|
||||
|
||||
public interface IPublisherService
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new queue with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="queueName">The name of the queue to create.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <see langword="true"/> if the queue was created successfully; otherwise, <see langword="false"/>.</returns>
|
||||
Task<bool> CreateQueue(string queueName);
|
||||
/// <summary>
|
||||
/// Asynchronously sends an error message to the specified message queue.
|
||||
/// </summary>
|
||||
/// <param name="obj">The error payload or message object to be sent to the queue.</param>
|
||||
/// <param name="queueName">The name of the target message queue.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value that indicates whether the message was successfully sent.</returns>
|
||||
Task<bool> SendMessageError(object obj, string queueName);
|
||||
/// <summary>
|
||||
/// Asynchronously sends the specified object as a message to the named queue.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object payload to serialize and publish to the queue.</param>
|
||||
/// <param name="queueName">The name of the target queue that will receive the message.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the message was sent successfully, otherwise <c>false</c>.</returns>
|
||||
Task<bool> SendMessage(object obj, string queueName);
|
||||
/// <summary>
|
||||
/// Asynchronously sends a message to the specified message queue and returns a value indicating whether the operation succeeded.
|
||||
/// </summary>
|
||||
/// <param name="message">The message content to be sent to the queue.</param>
|
||||
/// <param name="queueName">The name of the target queue where the message will be delivered.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the message was sent successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> SendMessage(string message, string queueName);
|
||||
}
|
||||
@@ -10,31 +10,104 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
public interface IPumpService: IApiRequestService
|
||||
{
|
||||
// Insert manual
|
||||
/// <summary>
|
||||
/// Asynchronously inserts a pump observation record into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="obs">The pump observation to persist.</param>
|
||||
Task InsertPumpObservation(PumpObservation obs);
|
||||
|
||||
// Mapping
|
||||
/// <summary>
|
||||
/// Asynchronously maps the specified pump observation to a resulting <see cref="PumpObservation"/>, returning <c>null</c> when no mapping result is produced.
|
||||
/// </summary>
|
||||
/// <param name="obs">The source pump observation to be mapped.</param>
|
||||
/// <returns>A task that represents the asynchronous mapping operation, containing the resulting <see cref="PumpObservation"/> or <c>null</c> if no result is available.</returns>
|
||||
Task<PumpObservation?> MapPumpObservation(PumpObservation obs);
|
||||
|
||||
// Consultas por paciente
|
||||
/// <summary>
|
||||
/// Retrieves the most recent pump observations for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose pump observations are being queried.</param>
|
||||
/// <param name="num">The maximum number of recent observations to return. Defaults to 1.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of the most recent pump observations for the patient, up to the specified count.</returns>
|
||||
Task<List<PumpObservation>> FindLastPumpObservations(ObjectId patientId, int num = 1);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the most recent observation timestamp for every patient, returning a dictionary keyed by patient identifier.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a dictionary mapping each patient's <see cref="ObjectId"/> to their last observation <see cref="DateTime"/>.</returns>
|
||||
Task<Dictionary<ObjectId, DateTime>> FindAllLastPatientObservationTime();
|
||||
|
||||
// Gestión de configuración
|
||||
/// <summary>
|
||||
/// Retrieves the list of configuration pump items associated with the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier used to look up the configuration pump items.</param>
|
||||
/// <returns>A task that resolves to a list of <see cref="ConfigPumpItem"/> objects matching the given identifier, or <c>null</c> when no items are found.</returns>
|
||||
Task<List<ConfigPumpItem>?> GetItemsById(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the full list of pump configurations from the underlying data source.
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to a <see cref="List{ConfigPumps}"/> containing all pump configurations, or <c>null</c> if no configurations are available.</returns>
|
||||
Task<List<ConfigPumps>?> GetAllPumpConfig();
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the pump configuration associated with the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the pump configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="ConfigPumps"/> instance matching the specified identifier, or <see langword="null"/> if no configuration is found.</returns>
|
||||
Task<ConfigPumps?> GetPumpConfigsById(string id);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the pump configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The pump configuration to update.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the updated <see cref="ConfigPumps"/> or null if not found.</returns>
|
||||
Task<ConfigPumps?> UpdatePumpConfig(ConfigPumps config);
|
||||
/// <summary>
|
||||
/// Inserts a new pump configuration into the system asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="config">The pump configuration to be inserted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the inserted <see cref="ConfigPumps"/> or <c>null</c> if the insertion fails.</returns>
|
||||
Task<ConfigPumps?> InsertPumpConfig(ConfigPumps config);
|
||||
/// <summary>
|
||||
/// Deletes the specified pump configuration.
|
||||
/// </summary>
|
||||
/// <param name="config">The pump configuration to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous delete operation. The task result is <c>true</c> if the configuration was deleted successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeletePumpConfig(ConfigPumps config);
|
||||
|
||||
// Paginación
|
||||
/// <summary>
|
||||
/// Retrieves a paginated collection of pump observations based on the provided filter criteria.
|
||||
/// Returns null when no pump observations match the supplied pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines page size, page number, and any additional filtering criteria applied to the pump observations.</param>
|
||||
/// <returns>A task that resolves to a <see cref="PaginationResponse{PumpObservation}"/> containing the matching pump observations, or null when no results are found.</returns>
|
||||
Task<PaginationResponse<PumpObservation>?> GetPaginatedPump(PaginationFilter filter);
|
||||
|
||||
// Archivado / limpieza
|
||||
/// <summary>
|
||||
/// Asynchronously deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the patient whose related records should be deleted.</param>
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Archives the specified patient, marking the patient record as archived in the system.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to be archived.</param>
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the data associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose data should be archived.</param>
|
||||
/// <returns>A task that represents the asynchronous archive operation.</returns>
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
|
||||
// Mantenimiento ids
|
||||
/// <summary>
|
||||
/// Asynchronously updates multiple records, replacing the specified old ObjectId with a new one in the field identified by <paramref name="nameId"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The name of the field whose ObjectId value should be updated.</param>
|
||||
/// <param name="id">The new ObjectId value to assign.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
}
|
||||
@@ -6,10 +6,35 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IRecordingAlertService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the most recent patient recording alerts for the specified patient.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose recording alerts are being queried.</param>
|
||||
/// <param name="num">The maximum number of most recent recording alerts to return. Defaults to 2.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of the patient's most recent recording alerts.</returns>
|
||||
Task<List<PatientRecordingAlert>> FindLastRecordingAlert(ObjectId patientId, int num = 2);
|
||||
/// <summary>
|
||||
/// Deletes records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose related records should be removed.</param>
|
||||
Task DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously archives the specified patient, moving their record out of the active set.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Archives the records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> identifying the patient whose related records should be archived.</param>
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates multiple records by replacing the <paramref name="oldId"/> with the new <paramref name="id"/>
|
||||
/// in entries identified by <paramref name="nameId"/>.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The identifier used to select the target records to update.</param>
|
||||
/// <param name="id">The new ObjectId value to assign to the matching records.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced in the matching records.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
}
|
||||
@@ -9,15 +9,54 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IRecordingService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously sends a cancel recording request to the recording API for the specified patient and point of care.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose recording should be cancelled.</param>
|
||||
/// <param name="poc">The point of care associated with the recording to be cancelled.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean value indicating the outcome of the cancel recording request.</returns>
|
||||
Task<bool> SendCancelRecordingToRecordingApi(Patient patient, PointOfCare poc);
|
||||
|
||||
/// <summary>
|
||||
/// Queues alarm recording data for the specified patient at the given point of care,
|
||||
/// using the provided alarm details to be processed asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient associated with the recording data.</param>
|
||||
/// <param name="poc">The point of care where the recording originated.</param>
|
||||
/// <param name="date">The start date of the recording, if applicable.</param>
|
||||
/// <param name="endDate">The end date of the recording, if applicable.</param>
|
||||
/// <param name="eventDate">The date of the event, if applicable.</param>
|
||||
/// <param name="alarmName">The name of the alarm, if applicable.</param>
|
||||
/// <param name="severity">The severity level of the alarm.</param>
|
||||
/// <param name="alarmDescription">The description of the alarm, if applicable.</param>
|
||||
/// <param name="start">Indicates whether to start the recording (default is true).</param>
|
||||
/// <param name="type">The type of alarm (default is Manual).</param>
|
||||
Task SendRecordingDataToQueue(Patient patient, PointOfCare poc, DateTime? date, DateTime? endDate,
|
||||
DateTime? eventDate, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription,
|
||||
bool start = true, AlarmEnum.Type type = AlarmEnum.Type.Manual);
|
||||
DateTime? eventDate, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription,
|
||||
bool start = true, AlarmEnum.Type type = AlarmEnum.Type.Manual);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously sends manual recording data for the specified patient at the given point of care, using the provided manual recording and a flag indicating whether to start the recording.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient whose recording data is being sent.</param>
|
||||
/// <param name="poc">The point of care associated with the recording.</param>
|
||||
/// <param name="manualRecording">The manual recording payload to transmit.</param>
|
||||
/// <param name="start">A flag indicating whether the recording is being started or stopped.</param>
|
||||
Task SendRecordingData(Patient patient, PointOfCare poc, ManualRecording manualRecording, bool start);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously sends automatic recording data for a patient at the specified point of care.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient associated with the automatic recording data.</param>
|
||||
/// <param name="poc">The point of care where the recording was taken.</param>
|
||||
/// <param name="automaticRecording">The automatic recording data to be sent.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a boolean indicating whether the data was sent successfully.</returns>
|
||||
Task<bool> SendAutoRecordingData(Patient patient, PointOfCare poc, RecordingData automaticRecording);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the list of recordings associated with the specified room.
|
||||
/// </summary>
|
||||
/// <param name="roomName">The identifier of the room whose recordings are being requested.</param>
|
||||
/// <returns>A task that returns a list of <see cref="RecordingData"/> for the room, or <c>null</c> if no recordings are available.</returns>
|
||||
Task<List<RecordingData>?> GetRecordings(int roomName);
|
||||
}
|
||||
@@ -8,17 +8,74 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IRelayService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously checks the current status of the specified relay.
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay whose status is being checked.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the current <see cref="RelayEnum.Status"/> of the relay.</returns>
|
||||
Task<RelayEnum.Status> CheckRelayStatus(Relay relay);
|
||||
/// <summary>
|
||||
/// Asynchronously checks the current status of the relay identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="relayId">The unique identifier of the relay whose status is being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the <see cref="RelayEnum.Status"/> of the requested relay.</returns>
|
||||
Task<RelayEnum.Status> CheckRelayStatus(ObjectId relayId);
|
||||
|
||||
/// <summary>
|
||||
/// Powers on the specified relay.
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay to power on.</param>
|
||||
Task PowerOn(Relay relay);
|
||||
/// <summary>
|
||||
/// Powers off the specified relay by sending a command to deactivate it.
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay to power off.</param>
|
||||
Task PowerOff(Relay relay);
|
||||
/// <summary>
|
||||
/// Sets a manual relay with the specified status for the given point of contact and relay type.
|
||||
/// </summary>
|
||||
/// <param name="status">The status to apply to the manual relay.</param>
|
||||
/// <param name="pocId">The identifier of the point of contact associated with the relay.</param>
|
||||
/// <param name="type">The type of relay to set manually.</param>
|
||||
Task SetManualRelay(RelayEnum.Status status, ObjectId pocId, RelayEnum.Type type);
|
||||
/// <summary>
|
||||
/// Retrieves a relay by its unique identifier, returning <c>null</c> if no matching relay is found.
|
||||
/// </summary>
|
||||
/// <param name="relay">The unique identifier of the relay to look up.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that resolves to the <see cref="Relay"/> if found, or <c>null</c> if no relay matches the provided identifier.</returns>
|
||||
Task<Relay?> GetById(ObjectId relay);
|
||||
/// <summary>
|
||||
/// Retrieves the list of <see cref="Relay"/> objects corresponding to the specified collection of relay identifiers.
|
||||
/// </summary>
|
||||
/// <param name="relayList">The list of <see cref="ObjectId"/> values identifying the relays to retrieve. May be <c>null</c>.</param>
|
||||
/// <returns>A <see cref="List{Relay}"/> containing the relays found for the provided identifiers.</returns>
|
||||
List<Relay> GetRelayInList(List<ObjectId>? relayList);
|
||||
/// <summary>
|
||||
/// Retrieves the relays of a specified type from the provided configuration relay list.
|
||||
/// </summary>
|
||||
/// <param name="configurationRelayList">The list of relay ObjectIds to filter, or null if no configuration relays are available.</param>
|
||||
/// <param name="type">The relay type to match against the configuration relays.</param>
|
||||
/// <returns>A list of <see cref="Relay"/> objects that match the specified <paramref name="type"/>.</returns>
|
||||
List<Relay> GetRelayByTypeInList(List<ObjectId>? configurationRelayList, RelayEnum.Type type);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of relays based on the specified pagination filter.
|
||||
/// </summary>
|
||||
/// <param name="request">The pagination filter containing the criteria used to retrieve the relays.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response with the requested relays.</returns>
|
||||
Task<PaginationResponse<Relay>> GetPaginatedRelays(PaginationFilter request);
|
||||
/// <summary>
|
||||
/// Inserts a new relay record based on the provided request data.
|
||||
/// </summary>
|
||||
/// <param name="request">The relay entity to be inserted.</param>
|
||||
/// <returns>A task that resolves to the inserted <see cref="Relay"/>, or <c>null</c> if the insert did not return a value.</returns>
|
||||
Task<Relay?> InsertRelay(Relay request);
|
||||
/// <summary>
|
||||
/// Updates an existing relay identified by the specified <paramref name="objectId"/> with the provided <paramref name="relay"/> data.
|
||||
/// Returns <c>null</c> when no relay is found with the given identifier.
|
||||
/// </summary>
|
||||
/// <param name="objectId">The unique identifier of the relay to update.</param>
|
||||
/// <param name="relay">The relay data containing the updated values.</param>
|
||||
/// <returns>A task that resolves to the updated <see cref="Relay"/>, or <c>null</c> if the relay was not found.</returns>
|
||||
Task<Relay?> UpdateRelayById(ObjectId objectId, Relay relay);
|
||||
}
|
||||
@@ -4,7 +4,19 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ISendAlertService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a list of available queues.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Queue"/> instances.</returns>
|
||||
Task<List<Queue>> GetQueues();
|
||||
/// <summary>
|
||||
/// Retrieves a list of performance records.
|
||||
/// </summary>
|
||||
/// <returns>A list of <see cref="Performance"/> objects.</returns>
|
||||
List<Performance> GetPerformance();
|
||||
/// <summary>
|
||||
/// Retrieves a list of API clients.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="ApiClients"/>.</returns>
|
||||
Task<List<ApiClients>> GetApiClients();
|
||||
}
|
||||
@@ -4,5 +4,10 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IServiceConfigService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="ServiceConfig"/> by its identifier, returning <c>null</c> if no matching configuration is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the service configuration to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="ServiceConfig"/> if found, or <c>null</c> if no configuration exists for the given identifier.</returns>
|
||||
Task<ServiceConfig?> Get(string id);
|
||||
}
|
||||
@@ -7,15 +7,55 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ISubscriberGroupedService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a list of subscribers organized into groups.
|
||||
/// </summary>
|
||||
/// <returns>A list of <see cref="WsSubscriberGrouped"/> instances representing the grouped subscribers.</returns>
|
||||
List<WsSubscriberGrouped> GetGrouped();
|
||||
/// <summary>
|
||||
/// Removes grouped observations associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose grouped observations should be removed.</param>
|
||||
void RemoveGroupedObsByPatientId(string patientId);
|
||||
/// <summary>
|
||||
/// Removes a WebSocket subscriber associated with the specified patient based on the provided location.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose WebSocket subscriber should be removed.</param>
|
||||
/// <param name="newLocation">The new patient location used to identify the subscriber to remove, or null to remove without location filtering.</param>
|
||||
void RemoveWsSubscriberByLocation(string patientId, PatientLocation? newLocation);
|
||||
/// <summary>
|
||||
/// Removes the specified workstation identifier associated with a patient's WS subscriber entry.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The identifier of the patient whose WS subscriber entry will be updated.</param>
|
||||
/// <param name="wsIdToRemove">The workstation identifier to remove from the patient's WS subscriber entry.</param>
|
||||
void RemoveWsSubscriberPatientIdAndWsId(string patientId, string wsIdToRemove);
|
||||
/// <summary>
|
||||
/// Validates the provided <see cref="WsSubscriberGrouped"/> instance to identify empty subscriber groups.
|
||||
/// </summary>
|
||||
/// <param name="wsl">The subscriber group instance to be checked for empty groups.</param>
|
||||
/// <returns>A <see cref="List{String}"/> containing validation messages for any empty subscriber groups found; returns an empty list if all groups are valid.</returns>
|
||||
List<string> CheckEmptySubscriberGroup(WsSubscriberGrouped wsl);
|
||||
/// <summary>
|
||||
/// Adds a new subscriber together with its associated group information to the system.
|
||||
/// </summary>
|
||||
/// <param name="wsSubscriberGrouped">The web service representation of the subscriber and its group assignments to be added.</param>
|
||||
void AddSubscriberGrouped(WsSubscriberGrouped wsSubscriberGrouped);
|
||||
|
||||
/// <summary>
|
||||
/// Checks subscription-related conditions for a grouped field and its associated grouped observation.
|
||||
/// </summary>
|
||||
/// <param name="groupedField">The grouped field to evaluate.</param>
|
||||
/// <param name="patientId">The identifier of the patient associated with the observation.</param>
|
||||
/// <param name="timeZoneId">The time zone identifier used for the observation context.</param>
|
||||
/// <param name="connectionId">The connection identifier for the current request or session.</param>
|
||||
/// <param name="go">The grouped observation to be checked against the subscription.</param>
|
||||
void CheckOnSubscriptionGroup(GroupedField groupedField, ObjectId patientId, string timeZoneId, string connectionId,
|
||||
GroupedObservation go);
|
||||
GroupedObservation go);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the most recent grouped observation in the group identified by the specified hash code with the new grouped observation.
|
||||
/// </summary>
|
||||
/// <param name="wsgHashCode">The hash code identifying the group whose last grouped observation should be updated.</param>
|
||||
/// <param name="newGroupedObservation">The new grouped observation to set as the last grouped observation in the group.</param>
|
||||
void UpdateLastGroupedObsInGroup(string wsgHashCode, GroupedObservation newGroupedObservation);
|
||||
}
|
||||
@@ -5,9 +5,32 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ISubscribersService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the list of subscribers.
|
||||
/// </summary>
|
||||
/// <returns>A list of <see cref="WsSubscriber"/> instances representing the subscribers.</returns>
|
||||
List<WsSubscriber> GetSubscribers();
|
||||
/// <summary>
|
||||
/// Retrieves a <see cref="WsSubscriber"/> associated with the specified context connection identifier.
|
||||
/// </summary>
|
||||
/// <param name="contextConnectionId">The unique identifier of the context connection used to look up the subscriber.</param>
|
||||
/// <returns>The <see cref="WsSubscriber"/> matching the given connection identifier, or <c>null</c> if no subscriber is found.</returns>
|
||||
WsSubscriber? GetById(string contextConnectionId);
|
||||
/// <summary>
|
||||
/// Retrieves the list of subscribers associated with the specified point of contact (POC) identifier.
|
||||
/// </summary>
|
||||
/// <param name="pocId">The identifier of the point of contact whose subscribers should be returned.</param>
|
||||
/// <returns>A list of <see cref="WsSubscriber"/> instances matching the provided POC identifier.</returns>
|
||||
List<WsSubscriber> GetByPocId(ObjectId pocId);
|
||||
/// <summary>
|
||||
/// Removes a connection identified by the specified context connection identifier.
|
||||
/// </summary>
|
||||
/// <param name="contextConnectionId">The unique identifier of the connection to remove.</param>
|
||||
/// <returns>An integer indicating the result of the removal operation.</returns>
|
||||
int RemoveConnectionById(string contextConnectionId);
|
||||
/// <summary>
|
||||
/// Registers the specified WebSocket subscriber to receive notifications or messages.
|
||||
/// </summary>
|
||||
/// <param name="subscriber">The <see cref="WsSubscriber"/> instance to be added to the collection of subscribers.</param>
|
||||
void AddSubscriber(WsSubscriber subscriber);
|
||||
}
|
||||
@@ -9,18 +9,86 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface ITreatmentService : IApiRequestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Inserts a new <see cref="PatientTreatment"/> record into the underlying data store.
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment entity to be added.</param>
|
||||
Task Insert(PatientTreatment treatment);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes an entity associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="ObjectId"/> representing the unique identifier of the patient whose related entity should be removed.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> containing <c>true</c> if the deletion was successful; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> DeleteByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes the entity identified by the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the entity to delete.</param>
|
||||
Task DeleteById(ObjectId id);
|
||||
/// <summary>
|
||||
/// Archives records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The ObjectId of the patient whose records should be archived.</param>
|
||||
Task ArchiveByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Archives the specified patient, marking them as archived in the system.
|
||||
/// </summary>
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
Task Archive(Patient patient);
|
||||
/// <summary>
|
||||
/// Updates an existing patient treatment record in the system.
|
||||
/// </summary>
|
||||
/// <param name="patientTreatment">The patient treatment entity containing the updated information to be persisted.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains <c>true</c> if the treatment was updated successfully; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateTreatment(PatientTreatment patientTreatment);
|
||||
/// <summary>
|
||||
/// Updates many records by replacing the specified old ObjectId with the new ObjectId in the field identified by nameId.
|
||||
/// </summary>
|
||||
/// <param name="nameId">The name of the field that contains the ObjectId to be updated.</param>
|
||||
/// <param name="id">The new ObjectId value that will replace the existing one.</param>
|
||||
/// <param name="oldId">The existing ObjectId value to be replaced.</param>
|
||||
Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId);
|
||||
/// <summary>
|
||||
/// Retrieves all treatments associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose treatments are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a collection of PatientTreatment objects for the specified patient.</returns>
|
||||
Task<IEnumerable<PatientTreatment>> GetTreatmentsByPatientId(ObjectId id);
|
||||
/// <summary>
|
||||
/// Retrieves the active treatment records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the patient whose active treatments should be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of active <see cref="PatientTreatment"/> records, which may include null entries.</returns>
|
||||
Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a cursor over the <see cref="PatientTreatment"/> records associated with the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose treatments should be returned.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> yielding an <see cref="IAsyncCursor{TDocument}"/> that iterates the matching <see cref="PatientTreatment"/> documents.</returns>
|
||||
Task<IAsyncCursor<PatientTreatment>> FindByPatientIdAsync(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all 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 a collection of <see cref="PatientTreatment"/> instances for the specified patient.</returns>
|
||||
Task<IEnumerable<PatientTreatment>> FindByPatientId(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// 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 retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientTreatment"/> records representing the patient's bolus treatments.</returns>
|
||||
Task<List<PatientTreatment>> GetBolusTreatments(ObjectId patientId);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of patient treatments based on the specified filter criteria.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter used to control the page number, page size, and other query options.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated patient treatment results.</returns>
|
||||
Task<PaginationResponse<PatientTreatment>> GetPaginatedTreatments(PaginationFilter filter);
|
||||
/// <summary>
|
||||
/// Retrieves the list of active treatments associated with the specified patient, sorted according to the provided order parameter.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active treatments are being queried.</param>
|
||||
/// <param name="order">A string defining the ordering criteria applied to the returned treatments.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of active <see cref="PatientTreatment"/> entries for the patient.</returns>
|
||||
Task<List<PatientTreatment>> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order);
|
||||
}
|
||||
@@ -10,35 +10,150 @@ namespace adas_core.Application.Services.Interfaces;
|
||||
|
||||
public interface IUnitService
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves all units, with an option to include their associated POCs.
|
||||
/// </summary>
|
||||
/// <param name="withPocs">Indicates whether the returned units should include their associated POCs.</param>
|
||||
/// <returns>A task representing the asynchronous operation, containing the list of units.</returns>
|
||||
Task<List<Unit>> GetAll(bool withPocs = false);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a compact list of all units, returning minimal summary information for each unit.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of <see cref="UnitInfoDto"/> objects with the compact information of all units.</returns>
|
||||
Task<List<UnitInfoDto>> GetAllCompact();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a compact representation of a unit info by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the unit to retrieve.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the compact unit information.</returns>
|
||||
Task<UnitInfoDto> GetOneCompact(ObjectId id);
|
||||
|
||||
// Task<Unit?> GetByCodeSysAndCode(string unit);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Unit"/> by its name.
|
||||
/// </summary>
|
||||
/// <param name="unit">The name of the unit to look up.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Unit"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Unit?> GetByName(string unit);
|
||||
|
||||
// Task<Unit?> GetByPointOfCare(PointOfCare pointOfCare);
|
||||
/// <summary>
|
||||
/// Retrieves information for a unit identified by the specified <paramref name="id"/>, returning <see langword="null"/> when no matching unit is found.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the unit to look up.</param>
|
||||
/// <param name="dataLocale">Optional locale used to localize the returned unit data.</param>
|
||||
/// <param name="fillLists">When <see langword="true"/>, populates the related lists on the returned unit.</param>
|
||||
/// <param name="withPoCs">When <see langword="true"/>, includes the unit's points of contact in the result.</param>
|
||||
/// <returns>A task that yields the located <see cref="Unit"/>, or <see langword="null"/> if no unit matches the given id.</returns>
|
||||
Task<Unit?> GetInfo(ObjectId id, LocaleEnum? dataLocale, bool fillLists = true, bool withPoCs = false);
|
||||
/// <summary>
|
||||
/// Retrieves information about a unit identified by the specified <paramref name="id"/>, optionally including related points of contact and devices.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier of the unit to retrieve information for.</param>
|
||||
/// <param name="withPoCs">Indicates whether related points of contact should be included in the result. Defaults to <c>true</c>.</param>
|
||||
/// <param name="withDevices">Indicates whether related devices should be included in the result. Defaults to <c>true</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <c>Unit</c> if found, or <c>null</c> if no unit matches the specified identifier.</returns>
|
||||
Task<Unit?> GetInfo(ObjectId id, bool withPoCs = true, bool withDevices = true);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the unit associated with the specified patient identifier, returning <c>null</c> when no matching unit exists.
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose unit is being looked up.</param>
|
||||
/// <returns>A task that represents the asynchronous lookup, containing the matching <see cref="Unit"/> if found, or <c>null</c> if no unit is associated with the patient.</returns>
|
||||
Task<Unit?> FindByPatientId(ObjectId patientId);
|
||||
|
||||
// Task<List<Unit>?> FindByLocation(PatientLocation location);
|
||||
/// <summary>
|
||||
/// Asynchronously finds and returns a <see cref="Unit"/> matching the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the <see cref="Unit"/> to retrieve. May be <c>null</c>.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the <see cref="Unit"/> if found; otherwise, <c>null</c>.</returns>
|
||||
Task<Unit?> FindById(ObjectId? id);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Unit"/> entity matching the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name used to look up the unit. Can be null.</param>
|
||||
/// <returns>A task that resolves to the matching <see cref="Unit"/> if found; otherwise, null.</returns>
|
||||
Task<Unit?> FindByName(string? name);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves a <see cref="Unit"/> by matching either its unit name or point-of-contact (POC) name.
|
||||
/// Returns <c>null</c> if no matching unit is found.
|
||||
/// </summary>
|
||||
/// <param name="name">The unit name to search for. May be <c>null</c>.</param>
|
||||
/// <param name="pocName">The point-of-contact (POC) name to search for. May be <c>null</c>.</param>
|
||||
/// <returns>A <see cref="Task{Unit}"/> containing the matched <see cref="Unit"/>, or <c>null</c> if no unit is found.</returns>
|
||||
Task<Unit?> FindByUnitNameOrPocName(string? name, string? pocName);
|
||||
|
||||
//Task<Unit?> FindByPointOfCare(PointOfCare pointOfCare);
|
||||
/// <summary>
|
||||
/// Inserts a single <see cref="Unit"/> into the underlying data store and returns the resulting entity wrapped in a task.
|
||||
/// </summary>
|
||||
/// <param name="unit">The <see cref="Unit"/> instance to be inserted.</param>
|
||||
/// <returns>A task that resolves to the inserted <see cref="Unit"/>, or <c>null</c> if the insertion did not produce a result.</returns>
|
||||
Task<Unit?> InsertOne(Unit unit);
|
||||
/// <summary>
|
||||
/// Updates the specified unit in the system.
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit containing the updated information to persist.</param>
|
||||
/// <returns>A task that returns the updated <see cref="Unit"/>, or <c>null</c> if the unit was not found.</returns>
|
||||
Task<Unit?> UpdateUnit(Unit unit);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of units associated with the specified master list identifier and master list type.
|
||||
/// Returns null when no matching units are found.
|
||||
/// </summary>
|
||||
/// <param name="masterListId">The unique identifier of the master list whose units should be retrieved.</param>
|
||||
/// <param name="masterListType">The type of the master list used to scope the unit lookup.</param>
|
||||
/// <returns>A task that returns an <see cref="IEnumerable{T}"/> of <see cref="Unit"/> when matches exist, or null when no matching units are found.</returns>
|
||||
Task<IEnumerable<Unit>?> FindUnitsByMasterListId(ObjectId masterListId, MasterListType masterListType);
|
||||
/// <summary>
|
||||
/// Asynchronously counts the number of units associated with the specified master list, filtered by the given master list type.
|
||||
/// </summary>
|
||||
/// <param name="masterListId">The unique identifier of the master list whose units should be counted.</param>
|
||||
/// <param name="masterListType">The type of the master list used to scope the count to the appropriate unit category.</param>
|
||||
/// <returns>A <see cref="Task{Int64}"/> that represents the asynchronous operation, containing the total number of units matching the specified master list.</returns>
|
||||
Task<long> CountUnitsByMasterListId(ObjectId masterListId, MasterListType masterListType);
|
||||
/// <summary>
|
||||
/// Asynchronously retrieves the collection of units associated with the specified master list identifier.
|
||||
/// </summary>
|
||||
/// <param name="masterListId">The identifier of the master list whose units are to be retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the collection of units that belong to the specified master list.</returns>
|
||||
Task<IEnumerable<Unit>> FindUnitsByMasterListId(ObjectId masterListId);
|
||||
/// <summary>
|
||||
/// Updates the unit master list based on the provided unit ID list DTO.
|
||||
/// </summary>
|
||||
/// <param name="updateUnitListDto">The DTO containing the list of unit IDs to be used for updating the master list.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains the updated <see cref="Unit"/>, or <c>null</c> if the update was not applicable.</returns>
|
||||
Task<Unit?> UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto);
|
||||
/// <summary>
|
||||
/// Asynchronously updates the configuration for the specified unit using the provided configuration data.
|
||||
/// </summary>
|
||||
/// <param name="unitIdParsed">The parsed 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 resolves to <c>true</c> if the configuration was successfully updated; otherwise, <c>false</c>.</returns>
|
||||
Task<bool> UpdateConfiguration(ObjectId unitIdParsed, UnitConfiguration unitConfiguration);
|
||||
/// <summary>
|
||||
/// Asynchronously deletes a unit identified by the provided <paramref name="unit"/> entity's identifier.
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit entity whose identifier is used to locate and delete the record.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation, containing a value indicating whether the unit was successfully deleted.</returns>
|
||||
Task<bool> DeleteUnitById(Unit unit);
|
||||
/// <summary>
|
||||
/// Updates the information of an existing unit identified by <paramref name="unitId"/>, including its name, title, and optionally its configuration object ID.
|
||||
/// Returns the updated unit, or <c>null</c> when no matching unit is found.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The 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>
|
||||
/// <param name="configObsId">An optional configuration object ID to associate with the unit.</param>
|
||||
/// <returns>A task that yields the updated <see cref="Unit"/>, or <c>null</c> if the unit does not exist.</returns>
|
||||
Task<Unit?> UpdateUnitInfo(ObjectId unitId, string name, string title, string? configObsId = null);
|
||||
/// <summary>
|
||||
/// Retrieves a paginated list of units based on the provided filter, optionally including their associated points of contact.
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter that defines the page size, page number, and any additional query criteria.</param>
|
||||
/// <param name="withPoCs">A flag indicating whether the response should include the points of contact associated with each unit.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the paginated response of units.</returns>
|
||||
Task<PaginationResponse<Unit>> GetPaginatedUnits(PaginationFilter filter, bool withPoCs);
|
||||
}
|
||||
Reference in New Issue
Block a user