=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===
This commit is contained in:
@@ -36,6 +36,7 @@ public class MedicineService(
|
||||
/// Retrieves all medicines from the repository asynchronously.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of all <see cref="Medicine"/> entities.</returns>
|
||||
/// <!-- aidoc:v1 sig=6bce187 body=38d3044 -->
|
||||
public async Task<List<Medicine>> GetAll()
|
||||
{
|
||||
return await medicineRepository.GetAll();
|
||||
@@ -46,6 +47,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="code">The unique code identifier of the medicine to retrieve.</param>
|
||||
/// <returns>A <see cref="Medicine"/> instance if a medicine with the specified code exists; otherwise, null.</returns>
|
||||
/// <!-- aidoc:v1 sig=9f0c493 body=0fd6bb1 -->
|
||||
public async Task<Medicine?> GetByCode(string code)
|
||||
{
|
||||
return await medicineRepository.GetMedicine(code);
|
||||
@@ -56,6 +58,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="codeNote">A list of strings representing the codes or notes used to search for matching medicines.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the list of <see cref="Medicine"/> objects that match the specified codes or notes.</returns>
|
||||
/// <!-- aidoc:v1 sig=3cc75c7 body=40ffa28 -->
|
||||
public async Task<List<Medicine>> GetByCodeOrNote(List<string> codeNote)
|
||||
{
|
||||
return await medicineRepository.GetMedicineByCodeOrNote(codeNote);
|
||||
@@ -67,6 +70,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the medicine to look up.</param>
|
||||
/// <returns>A <see cref="Medicine"/> if a match is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=c2409b6 body=1be51c8 -->
|
||||
public async Task<Medicine?> GetByName(string name)
|
||||
{
|
||||
return await medicineRepository.GetMedicineByName(name);
|
||||
@@ -77,6 +81,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="treatments">The patient treatments to resolve medicines for. Null entries are skipped.</param>
|
||||
/// <returns>An enumerable of medicines resolved from the supplied treatments, aggregating types, codes, groups, and notes when a treatment specifies a <c>RequestedGiveTreatment</c> name.</returns>
|
||||
/// <!-- aidoc:v1 sig=c254229 body=d49d316 -->
|
||||
public async Task<IEnumerable<Medicine>> GetMedicinesOfTreatments(IEnumerable<PatientTreatment?> treatments)
|
||||
{
|
||||
var totalMedicines = new List<Medicine>();
|
||||
@@ -165,6 +170,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="patientId">The unique identifier of the patient whose active medicines are being queried.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing an enumerable collection of <see cref="Medicine"/> instances linked to the patient's active treatments.</returns>
|
||||
/// <!-- aidoc:v1 sig=1d2d0a9 body=c9a2dcc -->
|
||||
public async Task<IEnumerable<Medicine>> GetActiveMedicinesByPatient(ObjectId patientId)
|
||||
{
|
||||
var activeTreatments = await treatmentService.GetActiveTreatmentsByPatient(patientId);
|
||||
@@ -177,6 +183,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="filter">The pagination filter containing the page number and page size used to determine which subset of medicines to return.</param>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="PaginationResponse{Medicine}"/> with the medicines for the requested page, the current page number, the page size, and the total count of medicines matching the query.</returns>
|
||||
/// <!-- aidoc:v1 sig=806bf86 body=f9249ed -->
|
||||
public async Task<PaginationResponse<Medicine>> GetPaginatedMedicines(PaginationFilter filter)
|
||||
{
|
||||
var result = medicineRepository.GetPaginatedMedicines(filter);
|
||||
@@ -201,6 +208,7 @@ public class MedicineService(
|
||||
/// <param name="medicineId">The unique identifier of the medicine to retrieve.</param>
|
||||
/// <returns>The <see cref="Medicine"/> entity if found; otherwise, the method throws an exception.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no medicine is found for the specified <paramref name="medicineId"/>.</exception>
|
||||
/// <!-- aidoc:v1 sig=be77265 body=440a8fa -->
|
||||
public async Task<Medicine?> GetMedicineById(ObjectId medicineId)
|
||||
{
|
||||
return await medicineRepository.GetMedicineById(medicineId) ??
|
||||
@@ -213,6 +221,7 @@ public class MedicineService(
|
||||
/// <param name="medicine">The medicine entity to create.</param>
|
||||
/// <returns>The newly created <see cref="Medicine"/> entity.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the repository returns a null result, indicating the creation failed.</exception>
|
||||
/// <!-- aidoc:v1 sig=25564e2 body=3bf2108 -->
|
||||
public async Task<Medicine?> PostMedicine(Medicine medicine)
|
||||
{
|
||||
var result = await medicineRepository.PostMedicine(medicine) ??
|
||||
@@ -226,6 +235,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="medicine">The medicine entity containing the updated information.</param>
|
||||
/// <returns>The updated <see cref="Medicine"/>, or <c>null</c> if the update did not produce a result.</returns>
|
||||
/// <!-- aidoc:v1 sig=baa8582 body=2626b7e -->
|
||||
public async Task<Medicine?> UpdateMedicine(Medicine medicine)
|
||||
{
|
||||
var oldMedicine = GetMedicineById(medicine.Id);
|
||||
@@ -239,6 +249,7 @@ public class MedicineService(
|
||||
/// Captures the existing medicine state prior to deletion to preserve audit trail details.
|
||||
/// </summary>
|
||||
/// <param name="medicineId">The unique identifier of the medicine to delete.</param>
|
||||
/// <!-- aidoc:v1 sig=ea3ac00 body=1689aa2 -->
|
||||
public async Task DeleteMedicineById(ObjectId medicineId)
|
||||
{
|
||||
var oldMedicine = GetMedicineById(medicineId);
|
||||
@@ -250,6 +261,7 @@ public class MedicineService(
|
||||
/// Asynchronously retrieves all distinct medicine types from the repository. Returns an empty list if an exception occurs during the retrieval process.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of distinct medicine type strings, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=39dbb1c body=e709a32 -->
|
||||
public async Task<List<string>> GetAllTypes()
|
||||
{
|
||||
try
|
||||
@@ -269,6 +281,7 @@ public class MedicineService(
|
||||
/// Returns an empty list if an error occurs while fetching or converting the data.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation, containing a list of distinct group strings, or an empty list if an exception is encountered.</returns>
|
||||
/// <!-- aidoc:v1 sig=fa46f44 body=e246c96 -->
|
||||
public async Task<List<string>> GetAllGroups()
|
||||
{
|
||||
try
|
||||
@@ -287,6 +300,7 @@ public class MedicineService(
|
||||
/// Retrieves all distinct medicine names from the repository asynchronously, returning an empty list if any error occurs during the data retrieval or mapping process.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation. The task result contains a list of medicine names, or an empty list if the operation fails.</returns>
|
||||
/// <!-- aidoc:v1 sig=beaf9c9 body=8f4cffa -->
|
||||
public async Task<List<string>> GetAllNames()
|
||||
{
|
||||
try
|
||||
@@ -306,6 +320,7 @@ public class MedicineService(
|
||||
/// Returns an empty list if an exception occurs during retrieval.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous operation, containing a list of code strings, or an empty list if an error occurs.</returns>
|
||||
/// <!-- aidoc:v1 sig=5dbd383 body=c312526 -->
|
||||
public async Task<List<string>> GetAllCodes()
|
||||
{
|
||||
try
|
||||
@@ -327,6 +342,7 @@ public class MedicineService(
|
||||
/// </summary>
|
||||
/// <param name="treatment">The patient treatment whose notes are used to derive the parental nutrition medicine.</param>
|
||||
/// <returns>A task containing the calculated <see cref="Medicine"/>, or <c>null</c> when no "NPT" note is found or when an error is logged during processing.</returns>
|
||||
/// <!-- aidoc:v1 sig=448874c body=b5dfee6 -->
|
||||
private Task<Medicine?> CalculateParentalNutritionMedicine(PatientTreatment treatment)
|
||||
{
|
||||
Medicine? medicine = null;
|
||||
|
||||
Reference in New Issue
Block a user