=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===

This commit is contained in:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -47,6 +47,7 @@ public class AppointmentService(
/// </summary>
/// <param name="apiRequest">The API request containing the patient number, location, type, observations, diagnosis, and related data to be processed.</param>
/// <exception cref="ApiRequestException">Thrown when the <paramref name="apiRequest"/> has a null or empty patient number.</exception>
/// <!-- aidoc:v1 sig=229d8cd body=bb59333 -->
public async Task SaveRequest(ApiRequest apiRequest)
{
if (string.IsNullOrEmpty(apiRequest.PatientNumber))
@@ -91,6 +92,7 @@ public class AppointmentService(
/// </summary>
/// <param name="apiRequest">The API request containing the HL7 message type, timestamp, and appointment payload to process.</param>
/// <param name="patient">The patient associated with the request; if null, the method returns without processing.</param>
/// <!-- aidoc:v1 sig=21c9ac7 body=f7a7db6 -->
public async Task ProcessApiRequest(ApiRequest apiRequest, Patient? patient)
{
if (patient == null)
@@ -232,6 +234,7 @@ public class AppointmentService(
/// </summary>
/// <param name="apiRequest">The API request to be saved.</param>
/// <returns>A task that represents the asynchronous save operation.</returns>
/// <!-- aidoc:v1 sig=a3706aa body=c8d77ba -->
public Task SaveRequestAsync(ApiRequest apiRequest)
{
return Task.FromResult(Task.Run(async () => { await SaveRequest(apiRequest); }));
@@ -241,6 +244,7 @@ public class AppointmentService(
/// Archives the specified patient by delegating the operation to <see cref="ArchiveByPatientId"/> using the patient's identifier.
/// </summary>
/// <param name="patient">The patient to be archived.</param>
/// <!-- aidoc:v1 sig=0afe718 body=be01ba0 -->
public async Task Archive(Patient patient)
{
await ArchiveByPatientId(patient.Id);
@@ -250,6 +254,7 @@ public class AppointmentService(
/// Archives all appointments associated with the specified patient by copying them to the appointment archive repository and then deleting them from the source collection.
/// </summary>
/// <param name="id">The unique identifier of the patient whose appointments should be archived.</param>
/// <!-- aidoc:v1 sig=3385472 body=fb8a531 -->
public async Task ArchiveByPatientId(ObjectId id)
{
logger.LogDebug("Archive Appointments by patientId {id}", id);
@@ -268,6 +273,7 @@ public class AppointmentService(
/// </summary>
/// <param name="patientId">The unique identifier of the patient whose appointments are being requested.</param>
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientAppointment"/> records for the given patient.</returns>
/// <!-- aidoc:v1 sig=c45e6c0 body=eb5edef -->
public async Task<List<PatientAppointment>> GetByPatient(ObjectId patientId)
{
return await appointmentRepository.GetByPatient(patientId);
@@ -280,6 +286,7 @@ public class AppointmentService(
/// <param name="patientId">The unique identifier of the patient whose appointments are being queried.</param>
/// <param name="ct">Cancellation token used to cancel the asynchronous operation.</param>
/// <returns>A task that resolves to a list of <see cref="PatientAppointment"/> instances scheduled for today; an empty list is returned when no appointments match.</returns>
/// <!-- aidoc:v1 sig=ad66c0d body=a065213 -->
public async Task<List<PatientAppointment>> GetTodayByPatient(
ObjectId patientId,
CancellationToken ct = default)
@@ -320,6 +327,7 @@ public class AppointmentService(
/// <param name="pocId">The identifier of the point of care whose appointments should be retrieved.</param>
/// <param name="ct">A cancellation token to cancel the asynchronous operation.</param>
/// <returns>A task that represents the asynchronous operation, containing the list of patient appointments scheduled for today at the specified point of care.</returns>
/// <!-- aidoc:v1 sig=0c69a88 body=57eddae -->
public async Task<List<PatientAppointment>> GetTodayByPoc(
ObjectId pocId,
CancellationToken ct = default)
@@ -361,6 +369,7 @@ public class AppointmentService(
/// </summary>
/// <param name="patientId">The unique identifier of the patient whose appointments are to be retrieved.</param>
/// <returns>A task that represents the asynchronous operation, containing an async cursor over the matching <see cref="PatientAppointment"/> documents.</returns>
/// <!-- aidoc:v1 sig=737aa7b body=e468a16 -->
public Task<IAsyncCursor<PatientAppointment>> FindByPatientIdAsync(ObjectId patientId)
{
return appointmentRepository.FindByPatientIdAsync(patientId);
@@ -371,6 +380,7 @@ public class AppointmentService(
/// </summary>
/// <param name="location">The location used to filter the patient appointments.</param>
/// <returns>A task that represents the asynchronous operation, containing a list of patient appointments for the specified location.</returns>
/// <!-- aidoc:v1 sig=0baed42 body=32f1684 -->
public async Task<List<PatientAppointment>> FindByLocation(PatientLocation location)
{
return await appointmentRepository.FindByLocation(location);
@@ -381,6 +391,7 @@ public class AppointmentService(
/// Deletes all appointments associated with the specified patient identifier, invalidates the appointments cache, and records the action in the audit log.
/// </summary>
/// <param name="id">The unique identifier of the patient whose appointments will be deleted.</param>
/// <!-- aidoc:v1 sig=09e4e41 body=de0ba10 -->
public async Task DeleteByPatientId(ObjectId id)
{
var patientApp = await FindByPatientIdAsync(id);
@@ -399,6 +410,7 @@ public class AppointmentService(
/// <param name="nameId">The identifier used to scope which appointment records are affected by the update.</param>
/// <param name="id">The new ObjectId that will replace the existing one in the matching records.</param>
/// <param name="oldId">The current ObjectId to be replaced in the matching records.</param>
/// <!-- aidoc:v1 sig=72ce1ca body=413cf37 -->
public async Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)
{
await appointmentRepository.UpdateManyObjectId(nameId, id, oldId);
@@ -409,6 +421,7 @@ public class AppointmentService(
/// </summary>
/// <param name="appointment">The patient appointment whose resource groups and locations will be broadcast to subscribers.</param>
/// <param name="operationType">The optional operation type describing the change performed on the appointment; passed along to the subscriber message.</param>
/// <!-- aidoc:v1 sig=db962d9 body=b404485 -->
private async Task SendBroadcast(PatientAppointment appointment, OperationType? operationType)
{
//RECORRE LOS DIFERENTES LOCATIONS DE LA CITA