Table of Contents

Class PatientCarePlanService

Namespace
adas_core.Application.Services
Assembly
adas-core.Application.dll

Provides operations for managing patient care plans, implementing the contract defined by IPatientCarePlanService. Serves as the concrete service layer responsible for handling care plan related business logic.

public class PatientCarePlanService : IPatientCarePlanService
Inheritance
PatientCarePlanService
Implements
Inherited Members
Extension Methods

Constructors

PatientCarePlanService(ILogger<PatientCarePlanService>, IPatientCarePlanRepository, IUserRepository, IArchivePatientCarePlanService, IHttpContextAccessor, ILocalAuditService)

public PatientCarePlanService(ILogger<PatientCarePlanService> logger, IPatientCarePlanRepository patientCarePlanRepository, IUserRepository userRepository, IArchivePatientCarePlanService archivePatientCarePlanService, IHttpContextAccessor httpContextAccessor, ILocalAuditService auditService)

Parameters

logger ILogger<PatientCarePlanService>
patientCarePlanRepository IPatientCarePlanRepository
userRepository IUserRepository
archivePatientCarePlanService IArchivePatientCarePlanService
httpContextAccessor IHttpContextAccessor
auditService ILocalAuditService

Methods

ArchiveByPatientId(ObjectId)

Archives all care plans associated with the specified patient by moving them to the archive service, removing them from the active repository, and creating audit log entries for each archived record.

public Task ArchiveByPatientId(ObjectId patientid)

Parameters

patientid ObjectId

The identifier of the patient whose care plans will be archived.

Returns

Task

ArchiveCarePlanFromJob(Patient, List<OptionList>)

Creates archive records in the patient care plan repository for the specified care plan items that have expired from a job, attributing the action to the system user.

public Task ArchiveCarePlanFromJob(Patient patientWithFinishedProcedure, List<OptionList> itemsToArchive)

Parameters

patientWithFinishedProcedure Patient

The patient associated with the finished procedure whose care plan items are being archived.

itemsToArchive List<OptionList>

The list of care plan options to archive.

Returns

Task

FindAll()

Retrieves all patient care plans from the repository, returning an empty list if an error occurs while fetching the data.

public Task<List<PatientCarePlan>> FindAll()

Returns

Task<List<PatientCarePlan>>

A task that represents the asynchronous operation, containing a list of PatientCarePlan objects, or an empty list if the retrieval fails.

FindByPatientId(ObjectId)

Retrieves a list of patient care plans associated with the specified patient identifier. Returns an empty list if an error occurs while querying the repository.

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

Parameters

patientId ObjectId

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

Returns

Task<List<PatientCarePlan>>

A task representing the asynchronous operation, containing a list of PatientCarePlan for the patient, or an empty list if an error occurs.

FindByUserId(ObjectId)

Retrieves the list of patient care plans associated with the specified user identifier. If an error occurs during retrieval, the error is logged and an empty list is returned as a fallback.

public Task<List<PatientCarePlan>> FindByUserId(ObjectId userId)

Parameters

userId ObjectId

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

Returns

Task<List<PatientCarePlan>>

A task that represents the asynchronous operation, containing a list of PatientCarePlan objects for the user, or an empty list if an error occurs.

InsertOneAsync(PatientCarePlan)

Inserts a new patient care plan into the repository, stamping it with the current UTC time, and records an audit log entry for the operation. Any errors encountered during the insertion or audit logging are caught and logged without rethrowing.

public Task InsertOneAsync(PatientCarePlan patientCarePlan)

Parameters

patientCarePlan PatientCarePlan

The patient care plan entity to be inserted into the repository.

Returns

Task

UpdateManyObjectId(string, ObjectId, ObjectId)

Updates multiple patient care plan records by replacing the specified old object identifier with a new one for the given patient.

public Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId)

Parameters

patientid string

The unique identifier of the patient whose care plan records will be updated.

patientId ObjectId

The new object identifier that will replace the old identifier in the matching care plan records.

oldId ObjectId

The existing object identifier to be replaced by the new identifier.

Returns

Task