# Class ArchivePatientCarePlanService

Namespace
  adas_core.Application.Services

Assembly
  adas-core.Application.dll

    public class ArchivePatientCarePlanService : IArchivePatientCarePlanService

Inheritance
  object
  ArchivePatientCarePlanService

Implements
  IArchivePatientCarePlanService

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

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

## Constructors

### ArchivePatientCarePlanService(IArchivePatientCarePlanRepository, ILogger<ArchivePatientCarePlanService>, IHttpContextAccessor, ILocalAuditService)

    public ArchivePatientCarePlanService(IArchivePatientCarePlanRepository archivedPatientRepository, ILogger<ArchivePatientCarePlanService> logger, IHttpContextAccessor httpContextAccessor, ILocalAuditService auditService)

#### Parameters

`archivedPatientRepository` IArchivePatientCarePlanRepository
`logger` ILogger<ArchivePatientCarePlanService>
`httpContextAccessor` IHttpContextAccessor
`auditService` ILocalAuditService

## Methods

### FindAll()

Retrieves all archived patient care plans by delegating to the archived patient repository.

    public Task<List<PatientCarePlan>> FindAll()

#### Returns

Task<List<PatientCarePlan>>

  A task that resolves to a list of PatientCarePlan objects representing all archived patient care plans.

### FindByPatientId(ObjectId)

Retrieves the list of archived patient care plans associated with the specified patient identifier by delegating to the underlying repository. Returns a nullable list, which may be null when no archived care plans exist for the patient.

    public Task<List<PatientCarePlan>?> FindByPatientId(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose archived care plans are being searched.

#### Returns

Task<List<PatientCarePlan>>

  A task that represents the asynchronous operation. The task result contains a list of PatientCarePlan for the patient, or null if no records are found.

### FindByPatientId(string)

Retrieves a list of archived patient care plans associated with the specified patient identifier. Returns null when no archived care plans are found for the given patient.

    public Task<List<PatientCarePlan>?> FindByPatientId(string patientId)

#### Parameters

`patientId` string

  The unique identifier of the patient whose archived care plans are being retrieved.

#### Returns

Task<List<PatientCarePlan>>

  A list of PatientCarePlan entries for the patient, or `null` if no records exist.

### FindByPatientNumber(string)

Retrieves a list of archived patient care plans associated with the specified patient number. Returns null if no archived care plans are found for the given patient.

    public Task<List<PatientCarePlan>?> FindByPatientNumber(string patientId)

#### Parameters

`patientId` string

  The unique identifier of the patient whose archived care plans are being searched.

#### Returns

Task<List<PatientCarePlan>>

  A list of PatientCarePlan objects for the specified patient, or null if no records are found.

### InsertManyAsync(List<PatientCarePlan>)

Asynchronously inserts a batch of archived patient care plans into the repository and creates an audit log entry for each one using the current HTTP context user.

    public Task InsertManyAsync(List<PatientCarePlan> patientCarePla)

#### Parameters

`patientCarePla` List<PatientCarePlan>

  The list of patient care plans to insert and audit.

#### Returns

Task

### InsertOneAsync(PatientCarePlan)

Inserts a patient care plan into the archived patient repository, logs the operation, and creates an audit log entry capturing the current user context.

    public Task<PatientCarePlan?> InsertOneAsync(PatientCarePlan patient)

#### Parameters

`patient` PatientCarePlan

  The patient care plan to be archived and inserted.

#### Returns

Task<PatientCarePlan>

  The inserted patient care plan, or null if no plan was provided.