# Interface ITreatmentService

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface ITreatmentService : IApiRequestService

Inherited Members
  IApiRequestService.SaveRequestAsync(ApiRequest)
  IApiRequestService.SaveRequest(ApiRequest)

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Methods

### Archive(Patient)

Archives the specified patient, marking them as archived in the system.

    Task Archive(Patient patient)

#### Parameters

`patient` Patient

  The patient to archive.

#### Returns

Task

### ArchiveByPatientId(ObjectId)

Archives records associated with the specified patient identifier.

    Task ArchiveByPatientId(ObjectId id)

#### Parameters

`id` ObjectId

  The ObjectId of the patient whose records should be archived.

#### Returns

Task

### DeleteById(ObjectId)

Asynchronously deletes the entity identified by the specified identifier.

    Task DeleteById(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the entity to delete.

#### Returns

Task

### DeleteByPatientId(ObjectId)

Asynchronously deletes an entity associated with the specified patient identifier.

    Task<bool> DeleteByPatientId(ObjectId id)

#### Parameters

`id` ObjectId

  The MongoDB.Bson.ObjectId representing the unique identifier of the patient whose related entity should be removed.

#### Returns

Task<bool>

  A Task<TResult> containing `true` if the deletion was successful; otherwise, `false`.

### FindByPatientId(ObjectId)

Asynchronously retrieves all patient treatments associated with the specified patient identifier.

    Task<IEnumerable<PatientTreatment>> FindByPatientId(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose treatments are being queried.

#### Returns

Task<IEnumerable<PatientTreatment>>

  A task that represents the asynchronous operation, containing a collection of PatientTreatment instances for the specified patient.

### FindByPatientIdAsync(ObjectId)

Asynchronously retrieves a cursor over the PatientTreatment records associated with the specified patient identifier.

    Task<IAsyncCursor<PatientTreatment>> FindByPatientIdAsync(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose treatments should be returned.

#### Returns

Task<IAsyncCursor<PatientTreatment>>

  A Task<TResult> yielding an MongoDB.Driver.IAsyncCursor<TDocument> that iterates the matching PatientTreatment documents.

### GetActiveTreatmentsByPatient(ObjectId)

Retrieves the active treatment records associated with the specified patient identifier.

    Task<IEnumerable<PatientTreatment?>> GetActiveTreatmentsByPatient(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the patient whose active treatments should be retrieved.

#### Returns

Task<IEnumerable<PatientTreatment>>

  A task that represents the asynchronous operation, containing an enumerable collection of active PatientTreatment records, which may include null entries.

### GetActiveTreatmentsByPatientIdAndOrder(ObjectId, string)

Retrieves the list of active treatments associated with the specified patient, sorted according to the provided order parameter.

    Task<List<PatientTreatment>> GetActiveTreatmentsByPatientIdAndOrder(ObjectId patientId, string order)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose active treatments are being queried.

`order` string

  A string defining the ordering criteria applied to the returned treatments.

#### Returns

Task<List<PatientTreatment>>

  A task that represents the asynchronous operation, containing a list of active PatientTreatment entries for the patient.

### GetBolusTreatments(ObjectId)

Retrieves the list of bolus treatments associated with the specified patient.

    Task<List<PatientTreatment>> GetBolusTreatments(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose bolus treatments are being retrieved.

#### Returns

Task<List<PatientTreatment>>

  A task that represents the asynchronous operation, containing a list of PatientTreatment records representing the patient's bolus treatments.

### GetPaginatedTreatments(PaginationFilter)

Retrieves a paginated list of patient treatments based on the specified filter criteria.

    Task<PaginationResponse<PatientTreatment>> GetPaginatedTreatments(PaginationFilter filter)

#### Parameters

`filter` PaginationFilter

  The pagination filter used to control the page number, page size, and other query options.

#### Returns

Task<PaginationResponse<PatientTreatment>>

  A task that represents the asynchronous operation, containing the paginated patient treatment results.

### GetTreatmentsByPatientId(ObjectId)

Retrieves all treatments associated with the specified patient identifier.

    Task<IEnumerable<PatientTreatment>> GetTreatmentsByPatientId(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the patient whose treatments are to be retrieved.

#### Returns

Task<IEnumerable<PatientTreatment>>

  A task that represents the asynchronous operation, containing a collection of PatientTreatment objects for the specified patient.

### Insert(PatientTreatment)

Inserts a new PatientTreatment record into the underlying data store.

    Task Insert(PatientTreatment treatment)

#### Parameters

`treatment` PatientTreatment

  The patient treatment entity to be added.

#### Returns

Task

### UpdateManyObjectId(string, ObjectId, ObjectId)

Updates many records by replacing the specified old ObjectId with the new ObjectId in the field identified by nameId.

    Task UpdateManyObjectId(string nameId, ObjectId id, ObjectId oldId)

#### Parameters

`nameId` string

  The name of the field that contains the ObjectId to be updated.

`id` ObjectId

  The new ObjectId value that will replace the existing one.

`oldId` ObjectId

  The existing ObjectId value to be replaced.

#### Returns

Task

### UpdateTreatment(PatientTreatment)

Updates an existing patient treatment record in the system.

    Task<bool> UpdateTreatment(PatientTreatment patientTreatment)

#### Parameters

`patientTreatment` PatientTreatment

  The patient treatment entity containing the updated information to be persisted.

#### Returns

Task<bool>

  A task that represents the asynchronous operation. The task result contains `true` if the treatment was updated successfully; otherwise, `false`.