Interface IPatientService
- Namespace
- adas_core.Application.Services.Interfaces
- Assembly
- adas-core.Application.dll
public interface IPatientService : IApiRequestService
- Inherited Members
- Extension Methods
Methods
ArchiveDischargedPatients(int)
Archives patient records for patients who have been discharged longer than the specified time threshold.
Task ArchiveDischargedPatients(int hoursBeforeArchive)
Parameters
hoursBeforeArchiveintThe number of hours a patient must have been discharged before being archived.
Returns
ArchivePatient(Patient)
Archives the specified patient record.
Task ArchivePatient(Patient patient)
Parameters
patientPatientThe patient to archive.
Returns
ArchivePatientData(ObjectId)
Archives the patient data identified by the specified patient identifier.
Task ArchivePatientData(ObjectId patientid)
Parameters
patientidObjectIdThe unique identifier of the patient whose data should be archived.
Returns
ArchivePatientWithoutObservationsSinceDate(DateTime)
Archives patients who have no observations recorded since the specified date.
Task ArchivePatientWithoutObservationsSinceDate(DateTime date)
Parameters
dateDateTimeThe cutoff date; patients without observations after this date are archived.
Returns
CountPatientsByUnitId(ObjectId)
Asynchronously counts the number of patients associated with the specified unit identifier.
Task<long> CountPatientsByUnitId(ObjectId unitId)
Parameters
unitIdObjectIdThe ObjectId of the unit whose patients should be counted.
Returns
- Task<long>
A task that represents the asynchronous operation, containing the total count of patients for the given unit.
CreatePatientFromRequest(ApiRequest, bool)
Creates a Patient instance from the provided ApiRequest, optionally ignoring location information during the creation process.
Task<Patient?> CreatePatientFromRequest(ApiRequest apiRequest, bool ignoreLocation = false)
Parameters
apiRequestApiRequestThe API request containing the data used to construct the patient.
ignoreLocationboolWhen
true, location information is ignored during patient creation. Defaults tofalse.
Returns
- Task<Patient>
A task that represents the asynchronous operation. The task result contains the created Patient, or
nullif the patient could not be created.
DeletePatientMasterListItem(OptionList, IEnumerable<Unit>, string)
Deletes a patient master list item based on the specified option, unit list, and type name.
Task DeletePatientMasterListItem(OptionList opt, IEnumerable<Unit> unitList, string typeName)
Parameters
optOptionListThe option list containing the details of the patient master list item to delete.
unitListIEnumerable<Unit>The collection of units associated with the patient master list item.
typeNamestringThe name of the type identifying the patient master list item to be deleted.
Returns
DischargeInactivePatients(DateTime, int)
Discharges patients who have been inactive since the specified date and archives them after the defined retention period.
Task DischargeInactivePatients(DateTime sinceDate, int hoursBeforeArchive)
Parameters
sinceDateDateTimeThe date used to identify patients that have been inactive since this point in time.
hoursBeforeArchiveintThe number of hours of inactivity that must elapse before a discharged patient is archived.
Returns
ExitPatientById(ObjectId, bool)
Exits a patient identified by the given identifier, optionally archiving the patient record.
Task ExitPatientById(ObjectId id, bool archivePatient = true)
Parameters
idObjectIdThe unique identifier of the patient to exit.
archivePatientboolWhen true, the patient record is archived as part of the exit process; when false, archiving is skipped.
Returns
FindAll(bool)
Retrieves all patients, optionally including their location data when requested.
Task<List<Patient>> FindAll(bool withLocation = false)
Parameters
withLocationboolIndicates whether location information should be included in the returned patient records.
Returns
- Task<List<Patient>>
A task that represents the asynchronous operation, containing a list of Patient objects.
FindAllPatientWithFinishedProcedures(int)
Asynchronously retrieves all patients whose procedures have been finished, filtering based on the specified archive threshold for procedure end times.
Task<List<Patient>> FindAllPatientWithFinishedProcedures(int archiveProcedureEndDateAfterMinutes)
Parameters
archiveProcedureEndDateAfterMinutesintThe number of minutes after the procedure end date used as the archive threshold to qualify patients with finished procedures.
Returns
- Task<List<Patient>>
A task that represents the asynchronous operation, containing a list of Patient objects that match the finished procedures criteria.
FindAllPatientWithFinishedTest(int)
Asynchronously retrieves all patients who have completed a test, using the specified archive window in minutes to determine which tests are considered finished.
Task<List<Patient>> FindAllPatientWithFinishedTest(int archiveTestEndDateAfterMinutes)
Parameters
archiveTestEndDateAfterMinutesintThe time window in minutes applied to the test end date to identify tests that should be treated as finished/archived.
Returns
- Task<List<Patient>>
A task that represents the asynchronous operation, containing a list of Patient instances with finished tests.
FindAllPatientWithFinishedTreatment(int)
Retrieves a list of patients whose treatments have finished, based on the specified archive time threshold in minutes after the treatment end date.
Task<List<Patient>> FindAllPatientWithFinishedTreatment(int archiveTreatmentEndDateAfterMinutes)
Parameters
archiveTreatmentEndDateAfterMinutesintThe number of minutes after the treatment end date used to determine which finished treatments should be included.
Returns
- Task<List<Patient>>
A task representing the asynchronous operation, containing a list of patients with finished treatment matching the specified criteria.
FindById(ObjectId, bool)
Retrieves a patient by their unique identifier, optionally including location information.
Returns null when no patient matches the provided identifier.
Task<Patient?> FindById(ObjectId id, bool withLocation = false)
Parameters
idObjectIdThe MongoDB.Bson.ObjectId used to look up the patient.
withLocationboolWhen
true, includes the patient's location data in the result; otherwise, location data is omitted.
Returns
- Task<Patient>
A Task<TResult> that resolves to the matching Patient, or
nullif no patient is found.
FindByLocation(PatientLocation?)
Asynchronously retrieves a patient associated with the specified location. Returns null if no matching patient is found or if the location is null.
Task<Patient?> FindByLocation(PatientLocation? location)
Parameters
locationPatientLocationThe patient location used to search for a matching patient. May be null.
Returns
- Task<Patient>
A Task<TResult> that yields the matching Patient, or null if no patient is found.
FindByPatientId(string, bool)
Asynchronously retrieves a patient by their unique patient identifier, optionally including location information.
Task<Patient?> FindByPatientId(string patientId, bool withLocation = false)
Parameters
patientIdstringThe unique identifier of the patient to find.
withLocationboolWhen set to
true, includes location details in the returned patient; otherwise, only basic patient data is returned.
Returns
- Task<Patient>
A task that represents the asynchronous operation. The task result contains the found Patient, or
nullif no patient matches the specified identifier.
FindByPatientIdWithLocale(string, LocaleEnum)
Asynchronously retrieves a patient by their unique identifier, applying the specified locale for localized data.
Task<Patient?> FindByPatientIdWithLocale(string patientId, LocaleEnum localeEnum)
Parameters
patientIdstringThe unique identifier of the patient to locate.
localeEnumLocaleEnumThe locale to use when retrieving or formatting localized patient information.
Returns
- Task<Patient>
A task that resolves to the matching patient, or
nullif no patient is found for the given identifier.
FindByPatientNumber(string, bool)
Retrieves a patient by their unique patient number, optionally including location information in the result.
Task<Patient?> FindByPatientNumber(string patientNumber, bool withLocation = false)
Parameters
patientNumberstringThe unique patient number used to look up the patient.
withLocationboolWhen
true, location information is included in the returned patient; otherwise, it is omitted.
Returns
- Task<Patient>
A task that yields the matching Patient if one is found, or
nullwhen no patient matches the given number.
FindByPatientNumberArchived(string)
Asynchronously retrieves an archived Patient matching the specified patient number, returning null when no matching archived record is found.
Task<Patient?> FindByPatientNumberArchived(string patientNumber)
Parameters
patientNumberstringThe unique patient number used to look up the archived patient record.
Returns
- Task<Patient>
A Task<TResult> that yields the matching archived Patient, or
nullif no archived patient is found.
FindByPointOfCare(string)
Asynchronously retrieves a list of patients associated with the specified point of care.
Task<List<Patient>> FindByPointOfCare(string pointOfCare)
Parameters
pointOfCarestringThe point of care identifier used to locate matching patients.
Returns
- Task<List<Patient>>
A task that represents the asynchronous operation, containing a list of Patient objects that match the specified point of care.
FindByPointOfCareId(ObjectId)
Asynchronously retrieves a patient associated with the specified Point of Care identifier.
Task<Patient?> FindByPointOfCareId(ObjectId pocId)
Parameters
pocIdObjectIdThe ObjectId representing the Point of Care identifier used to look up the patient.
Returns
- Task<Patient>
A task that represents the asynchronous operation. The task result contains the matching Patient if found; otherwise,
null.
FindByUnitAndPocId(ObjectId, ObjectId)
Asynchronously retrieves a patient identified by the specified unit and point-of-care identifiers.
Task<Patient?> FindByUnitAndPocId(ObjectId unit, ObjectId pointOfCare)
Parameters
unitObjectIdThe unique identifier of the unit to search within.
pointOfCareObjectIdThe unique identifier of the point-of-care associated with the patient.
Returns
- Task<Patient>
A task that yields the matching Patient, or
nullif no patient is found for the given unit and point-of-care.
FindInActivePoC()
Asynchronously retrieves the list of inactive Patients of Care (PoC), allowing consumers to identify patients that are no longer active in the system for reporting, cleanup, or follow-up workflows.
Task<List<Patient>> FindInActivePoC()
Returns
- Task<List<Patient>>
A task representing the asynchronous operation, containing a list of inactive Patient records.
FindInInactivePoC()
Retrieves a list of patients associated with inactive PoC records.
Task<List<Patient>> FindInInactivePoC()
Returns
- Task<List<Patient>>
A task that represents the asynchronous operation. The task result contains a list of Patient objects associated with inactive PoC records.
FindPatient(string?, string?, PatientLocation?, bool)
Asynchronously locates a patient using the provided identifiers, supporting lookup by patient
ID, patient number, or location when findByLocation is enabled.
Task<Patient?> FindPatient(string? patientId, string? patientNumber, PatientLocation? location, bool findByLocation = false)
Parameters
patientIdstringThe unique identifier of the patient to find.
patientNumberstringThe patient number used as an alternative lookup key.
locationPatientLocationThe patient location used when searching by location.
findByLocationboolWhen
true, the search is performed using the suppliedlocationinstead of the patient identifiers.
Returns
- Task<Patient>
A Task<TResult> that yields the matching Patient, or
nullif no patient is found.
FindPatientByApiRequest(ApiRequest)
Asynchronously finds a patient based on the information provided in the specified API request.
Task<Patient?> FindPatientByApiRequest(ApiRequest apiRequest)
Parameters
apiRequestApiRequestThe API request containing the data used to look up the patient.
Returns
- Task<Patient>
A task that represents the asynchronous operation. The task result contains the matching Patient if found, or null if no patient matches the request.
GenerateNurseCarePlanAndInsert(MasterListType, List<OptionList>?, Patient, User?)
Generates a nurse care plan of the specified type, using the provided options, and inserts it for the patient.
Task GenerateNurseCarePlanAndInsert(MasterListType carePlanType, List<OptionList>? options, Patient patient, User? user)
Parameters
carePlanTypeMasterListTypeThe master list type that determines which nurse care plan template to generate.
optionsList<OptionList>Optional list of options applied during care plan generation. May be null.
patientPatientThe patient for whom the nurse care plan is generated and inserted.
userUserThe user associated with the care plan generation. May be null.
Returns
- Task
A task that completes when the nurse care plan has been generated and inserted.
GetBox(PointOfCare, bool, List<string>?)
Retrieves a Box associated with the specified PointOfCare, returning null when no box is found for the given point of care.
Task<Box?> GetBox(PointOfCare poc, bool observations = false, List<string>? filterObservations = null)
Parameters
pocPointOfCareThe point of care used to look up the associated box.
observationsboolWhen true, observations are included with the returned box; otherwise, observations are omitted.
filterObservationsList<string>An optional list of observation identifiers used to restrict which observations are loaded when
observationsis true.
Returns
- Task<Box>
A Task<TResult> that resolves to the matching Box, or null if no box exists for the specified point of care.
GetByPointOfCare(PointOfCare, bool, List<string>?)
Retrieves a Patient associated with the specified item point of care, returning null when no matching patient is found.
When observations is true, the result includes the patient's observations, optionally restricted by the identifiers supplied in filterObservations.
Task<Patient?> GetByPointOfCare(PointOfCare item, bool observations = false, List<string>? filterObservations = null)
Parameters
itemPointOfCareThe point of care used to look up the associated patient.
observationsboolIndicates whether the patient's observations should be included in the returned patient.
filterObservationsList<string>An optional list of observation identifiers used to filter which observations are returned when
observationsistrue.
Returns
- Task<Patient>
A Task<TResult> that resolves to the matching Patient, or
nullif no patient is found for the given point of care.
GetByPointOfCareAndLocale(PointOfCare, Unit?, LocaleEnum?)
Asynchronously retrieves a Patient matching the specified point of care, optionally narrowed by unit and locale.
Task<Patient?> GetByPointOfCareAndLocale(PointOfCare item, Unit? unit, LocaleEnum? localeEnum)
Parameters
itemPointOfCareThe point of care used to locate the patient.
unitUnitAn optional unit that further filters the lookup.
localeEnumLocaleEnum?An optional locale used to scope the search.
Returns
GetPaginatedPatients(PaginationFilter)
Retrieves a paginated list of patients based on the provided pagination filter.
Task<PaginationResponse<Patient>> GetPaginatedPatients(PaginationFilter filter)
Parameters
filterPaginationFilterThe pagination filter that defines the paging criteria used to retrieve patients.
Returns
- Task<PaginationResponse<Patient>>
A task that represents the asynchronous operation. The task result contains a PaginationResponse<T> with the requested page of patients.
Insert(Patient)
Asynchronously inserts a new patient record into the data store.
Task Insert(Patient patient)
Parameters
patientPatientThe patient entity to be inserted.
Returns
InsertAsync(Patient)
Asynchronously inserts the specified Patient into the data store.
Task InsertAsync(Patient patient)
Parameters
patientPatientThe patient entity to be persisted.
Returns
MergePatient(Patient, string)
Merges the specified patient record with the existing patient identified by the old patient number.
Task MergePatient(Patient patient, string oldPatienNumber)
Parameters
patientPatientThe patient data to merge into the existing record.
oldPatienNumberstringThe identifier of the existing patient record to be merged.
Returns
Move(Patient, ObjectId, ObjectId)
Moves the specified patient from the old point of care to the new point of care.
Task<bool> Move(Patient patient, ObjectId newPocId, ObjectId oldPocId)
Parameters
patientPatientThe patient to be moved.
newPocIdObjectIdThe identifier of the destination point of care.
oldPocIdObjectIdThe identifier of the source point of care.
Returns
SearchByPatientNumberAndDistinctUnit(string, ObjectId)
Searches for a patient by their patient number within a distinct unit.
Task<Patient?> SearchByPatientNumberAndDistinctUnit(string patientNumber, ObjectId unitId)
Parameters
patientNumberstringThe patient number used to identify the patient.
unitIdObjectIdThe identifier of the distinct unit where the patient is registered.
Returns
- Task<Patient>
A task that represents the asynchronous operation. The task result contains the matching Patient if found; otherwise, null.
SendNewPatientBroadcast(Patient)
Sends an asynchronous broadcast notification to inform relevant subscribers or systems about a newly registered patient.
Task SendNewPatientBroadcast(Patient patient)
Parameters
patientPatientThe patient whose information will be included in the broadcast notification.
Returns
SendPatientUpdateBroadcast(Patient)
Asynchronously sends a broadcast notification about an update to the specified patient.
Task SendPatientUpdateBroadcast(Patient patient)
Parameters
patientPatientThe patient whose update information will be broadcast.
Returns
Update(Patient)
Updates the specified patient record.
Task Update(Patient patient)
Parameters
patientPatientThe patient whose information will be updated.
Returns
UpdateAttendingDoctor(ObjectId, Person)
Updates the attending doctor for the entity identified by the specified identifier.
Task UpdateAttendingDoctor(ObjectId id, Person doctor)
Parameters
idObjectIdThe identifier of the entity whose attending doctor will be updated.
doctorPersonThe new attending doctor to assign to the entity.
Returns
- Task
A task that represents the asynchronous update operation.
UpdateLocation(ObjectId, PatientLocation?)
Updates the location of a patient identified by the specified object identifier.
Task UpdateLocation(ObjectId id, PatientLocation? location)
Parameters
idObjectIdThe unique identifier of the patient whose location will be updated.
locationPatientLocationThe new patient location, or
nullif no location is provided.
Returns
UpdateOne(Patient)
Updates an existing patient record with the provided patient data. Returns the updated patient, or null if no matching patient was found.
Task<Patient?> UpdateOne(Patient updatedPatient)
Parameters
updatedPatientPatientThe patient object containing the updated information to be persisted.
Returns
- Task<Patient>
A Task<TResult> that resolves to the updated Patient, or
nullif the patient could not be found.
UpdatePatientAltable(ObjectId, OptionList, User?)
Updates the altable (allergy table) information for the specified patient and returns the updated patient.
Task<Patient?> UpdatePatientAltable(ObjectId patientId, OptionList altable, User? user)
Parameters
patientIdObjectIdThe unique identifier of the patient whose altable is being updated.
altableOptionListThe option list containing the altable data to apply to the patient.
userUserThe user performing the update, or
nullwhen no user context is available.
Returns
UpdatePatientData(ObjectId, string, Patient, bool)
Updates the patient data for the specified patient identified by id and patientNumber, applying the changes from the provided patient object. When updatePatientNumber is true, the patient number is also updated as part of the operation; otherwise, only the remaining patient fields are updated.
Task UpdatePatientData(ObjectId id, string patientNumber, Patient patient, bool updatePatientNumber = true)
Parameters
idObjectIdThe unique identifier of the patient record to update.
patientNumberstringThe current patient number used to locate the patient record.
patientPatientThe patient object containing the updated data to be applied.
updatePatientNumberboolA flag indicating whether the patient number should also be updated; defaults to
true.
Returns
UpdatePatientData(ObjectId, string, Person, bool)
Updates the data of an existing patient identified by the given identifier, optionally replacing the patient number when the updatePatientNumber flag is true.
Task UpdatePatientData(ObjectId id, string patientNumber, Person data, bool updatePatientNumber = true)
Parameters
idObjectIdThe unique identifier of the patient whose data will be updated.
patientNumberstringThe patient number to be applied to the patient.
dataPersonThe person data to assign to the patient.
updatePatientNumberboolIndicates whether the patient number should also be updated; defaults to true.
Returns
UpdatePatientDemographicData(ObjectId, Patient, User?)
Asynchronously updates the demographic data of an existing patient identified by the specified patient identifier.
Task UpdatePatientDemographicData(ObjectId patientId, Patient person, User? user)
Parameters
patientIdObjectIdThe unique identifier of the patient whose demographic data is to be updated.
personPatientThe patient object containing the new demographic information to apply.
userUserThe user performing the update operation, or null if no user context is available.
Returns
UpdatePatientIncomingData(ObjectId, Patient)
Asynchronously updates the incoming data for the specified patient by applying the provided patient information.
Task UpdatePatientIncomingData(ObjectId patientId, Patient person)
Parameters
patientIdObjectIdThe unique identifier of the patient whose incoming data is being updated.
personPatientThe patient object containing the incoming data to be applied to the patient record.
Returns
UpdatePatientIncomingData(ObjectId, Patient, PatientIncomeData, User)
Updates the incoming income data of a patient using the specified changes and the user performing the operation.
Task UpdatePatientIncomingData(ObjectId patientId, Patient person, PatientIncomeData personDataChange, User user)
Parameters
patientIdObjectIdThe unique identifier of the patient whose income data is being updated.
personPatientThe patient entity associated with the update.
personDataChangePatientIncomeDataThe income data changes to apply to the patient.
userUserThe user performing the update operation.
Returns
UpdatePatientMasterList(ObjectId, MasterListType, List<OptionList>, User?, List<OptionList>?)
Updates the specified master list for a patient with the provided options and returns the updated patient record.
Task<Patient?> UpdatePatientMasterList(ObjectId patientId, MasterListType typeName, List<OptionList> updatedOptions, User? user, List<OptionList>? carePlanLog)
Parameters
patientIdObjectIdThe identifier of the patient whose master list is being updated.
typeNameMasterListTypeThe type of master list to update.
updatedOptionsList<OptionList>The new list of options to apply to the master list.
userUserThe user performing the update, or null if not specified.
carePlanLogList<OptionList>Optional care plan log entries associated with the update.
Returns
UpdatePatientMasterListItemChange(UpdateOptionMasterListDto, IEnumerable<Unit>, string)
Updates a patient master list item change based on the provided update options, unit list, and type name.
Task UpdatePatientMasterListItemChange(UpdateOptionMasterListDto opt, IEnumerable<Unit> unitList, string typeName)
Parameters
optUpdateOptionMasterListDtoThe update options for the master list item.
unitListIEnumerable<Unit>The collection of units associated with the update.
typeNamestringThe name of the type used to categorize the master list item.