# Interface IDiagnosisRepository

Namespace
  adas_core.Application.Repositories.Interfaces

Assembly
  adas-core.Application.dll

    public interface IDiagnosisRepository : IMongoRepository<PatientDiagnosis>

Inherited Members
  IMongoRepository<PatientDiagnosis>.Collection
  IMongoRepository<PatientDiagnosis>.GetCollectionName()
  IMongoRepository<PatientDiagnosis>.UpdateOneAsync(ObjectId, PatientDiagnosis)

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

## Methods

### DeleteAsync(ObjectId)

Asynchronously deletes the entity identified by the specified identifier.

    Task DeleteAsync(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the entity to delete.

#### Returns

Task

### DeleteByPatientId(ObjectId)

Asynchronously deletes records associated with the specified patient identifier.

    Task DeleteByPatientId(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique MongoDB.Bson.ObjectId of the patient whose related records should be removed.

#### Returns

Task

### FindByPatientIdAndCode(ObjectId, string?, string?)

Asynchronously retrieves the PatientDiagnosis associated with the specified patient, diagnosis code, and coding system. Returns null when no matching diagnosis is found.

    Task<PatientDiagnosis?> FindByPatientIdAndCode(ObjectId patientId, string? diagnosisCode, string? codingSystem)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose diagnosis is being looked up.

`diagnosisCode` string

  The diagnosis code to match. May be null.

`codingSystem` string

  The coding system of the diagnosis code (for example, ICD-10 or SNOMED). May be null.

#### Returns

Task<PatientDiagnosis>

  A task that resolves to the matching PatientDiagnosis, or null if no diagnosis matches the given criteria.

### FindByPatientIdAsync(ObjectId)

Asynchronously finds all patient diagnoses associated with the specified patient identifier, returning a cursor to iterate over the matching documents.

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

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose diagnoses should be retrieved.

#### Returns

Task<IAsyncCursor<PatientDiagnosis>>

  A task that represents the asynchronous operation, containing an IAsyncCursor of PatientDiagnosis that yields the matching documents.

### GetByPatient(ObjectId)

Asynchronously retrieves a list of patient diagnoses associated with the specified patient identifier.

    Task<List<PatientDiagnosis>> GetByPatient(ObjectId patientId)

#### Parameters

`patientId` ObjectId

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

#### Returns

Task<List<PatientDiagnosis>>

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

### InsertOneAsync(PatientDiagnosis)

Asynchronously inserts a single patient diagnosis record into the data store.

    Task InsertOneAsync(PatientDiagnosis diagnosis)

#### Parameters

`diagnosis` PatientDiagnosis

  The patient diagnosis entity to insert.

#### Returns

Task

### UpdateManyObjectId(string, ObjectId, ObjectId)

Updates many records by replacing the existing MongoDB.Bson.ObjectId identified by `oldId` with the new MongoDB.Bson.ObjectId `id`, scoped to the specified `nameId`.

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

#### Parameters

`nameId` string

  The identifier of the field or collection on which the update is performed.

`id` ObjectId

  The new MongoDB.Bson.ObjectId value to assign.

`oldId` ObjectId

  The existing MongoDB.Bson.ObjectId value to be replaced.

#### Returns

Task