=== 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
@@ -11,6 +11,7 @@ namespace adas_core.Infrastructure.Repositories;
/// Provides a MongoDB-backed repository for persisting and retrieving archived patient treatment records.
/// Inherits from <see cref="MongoRepository{PatientTreatment}"/> and implements the <see cref="ITreatmentArchiveRepository"/> contract.
/// </summary>
/// <!-- aidoc:v1 sig=00919c4 -->
public class TreatmentArchiveRepository : MongoRepository<PatientTreatment>, ITreatmentArchiveRepository
{
private readonly ApiSettings _apiSettings;
@@ -34,6 +35,7 @@ public class TreatmentArchiveRepository : MongoRepository<PatientTreatment>, ITr
/// Asynchronously inserts a single <see cref="PatientTreatment"/> document into the collection.
/// </summary>
/// <param name="patientTreatment">The patient treatment entity to persist.</param>
/// <!-- aidoc:v1 sig=817004e body=78ae787 -->
public override async Task InsertOneAsync(PatientTreatment patientTreatment)
{
await Collection.InsertOneAsync(patientTreatment);
@@ -43,6 +45,7 @@ public class TreatmentArchiveRepository : MongoRepository<PatientTreatment>, ITr
/// Deletes all patient treatments whose order time is before the specified date.
/// </summary>
/// <param name="date">The cutoff date; treatments with an order time earlier than this are removed.</param>
/// <!-- aidoc:v1 sig=63daa66 body=62a2131 -->
public async Task DeleteBeforeDate(DateTime date)
{
var filter = Builders<PatientTreatment>.Filter.Lt(po => po.OrderTime, date);
@@ -54,6 +57,7 @@ public class TreatmentArchiveRepository : MongoRepository<PatientTreatment>, ITr
/// </summary>
/// <param name="treatments">The collection of patient treatment records to insert into the database.</param>
/// <returns>The total count of patient treatment records inserted by the bulk write operation.</returns>
/// <!-- aidoc:v1 sig=5327a55 body=14e0e13 -->
public async Task<long> InsertBatch(IEnumerable<PatientTreatment> treatments)
{
var writes = new List<WriteModel<PatientTreatment>>();
@@ -69,6 +73,7 @@ public class TreatmentArchiveRepository : MongoRepository<PatientTreatment>, ITr
/// </summary>
/// <param name="patientId">The unique identifier of the patient whose treatment records are to be retrieved.</param>
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="PatientTreatment"/> records matching the specified patient.</returns>
/// <!-- aidoc:v1 sig=26634ec body=cdc309e -->
public async Task<List<PatientTreatment>> FindAllFromPatient(ObjectId patientId)
{
var filter = Builders<PatientTreatment>.Filter.Eq(t => t.PatientId, patientId);
@@ -81,6 +86,7 @@ public class TreatmentArchiveRepository : MongoRepository<PatientTreatment>, ITr
/// Retrieves the collection name for archive patients treatments, falling back to the default "archive_patients_treatments" value when the API settings do not specify one.
/// </summary>
/// <returns>The configured collection name from the API settings, or the default "archive_patients_treatments" if the setting is null.</returns>
/// <!-- aidoc:v1 sig=94e22ff body=a88c4fb -->
public override string GetCollectionName()
{
return _apiSettings.ArchivePatientsTreatments ?? "archive_patients_treatments";