Table of Contents

Class TreatmentsController

Namespace
adas_core.Controllers
Assembly
adas-core.dll
[Route("treatments")]
[ApiController]
public class TreatmentsController : ControllerBase
Inheritance
TreatmentsController
Inherited Members
Extension Methods

Constructors

TreatmentsController(ITreatmentService, IPatientService)

public TreatmentsController(ITreatmentService treatmentService, IPatientService patientService)

Parameters

treatmentService ITreatmentService
patientService IPatientService

Methods

DeleteTreatment(string)

Deletes the treatment associated with the specified patient ID.

[HttpDelete("{patientid}/patient-id")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> DeleteTreatment(string patientId)

Parameters

patientId string

The string representation of the patient's ObjectId used to identify the treatment to delete.

Returns

Task<IActionResult>

An IActionResult indicating the result of the delete operation.

Exceptions

BadRequestException

Thrown when the provided patientId is not a valid ObjectId format.

DeleteTreatmentById(string)

Deletes a treatment by its unique identifier. Validates that the supplied identifier is a valid ObjectId format before invoking the deletion service.

[HttpDelete("{treatmentId}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> DeleteTreatmentById(string treatmentId)

Parameters

treatmentId string

The unique identifier of the treatment to delete.

Returns

Task<IActionResult>

An IActionResult representing the result of the deletion operation.

Exceptions

BadRequestException

Thrown when treatmentId is not a valid ObjectId format.

GetPaginatedTreatments(PaginationFilter)

Retrieves a paginated list of treatments based on the provided filter criteria.

[HttpPost("paginated")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> GetPaginatedTreatments(PaginationFilter request)

Parameters

request PaginationFilter

The pagination filter containing paging parameters used to query the treatments.

Returns

Task<IActionResult>

An IActionResult containing the paginated treatments returned by the service.

Exceptions

BadRequestException

Thrown when the request is null.

GetTreatmentsByPatientId(string)

Retrieves up to 50 treatments associated with the specified patient, ordered by order time. Validates that the provided patient identifier is a well-formed value; otherwise a bad request is raised.

[HttpGet("{patientid}/patient-id")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> GetTreatmentsByPatientId(string patientid)

Parameters

patientid string

The patient's identifier used to look up their treatments.

Returns

Task<IActionResult>

An IActionResult containing the first 50 treatments for the patient, sorted by order time.

Exceptions

BadRequestException

Thrown when patientid is not a valid identifier format.

ProcessRequest(TreatmentDto)

Processes an inbound treatment request for a known patient, building an ApiRequest of type "RAS_O17" and persisting it asynchronously. Falls back to the patient's registered location when the incoming DTO does not specify one, and raises a not-found error if no patient matches the supplied number.

[HttpPost]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> ProcessRequest(TreatmentDto treatmentDto)

Parameters

treatmentDto TreatmentDto

The treatment payload received in the request body, providing patient number, location, message time, wait result, and the optional treatment to forward.

Returns

Task<IActionResult>

An IActionResult that yields 200 OK once the request has been successfully saved.

Exceptions

NotFoundException

Thrown when no patient is found for the PatientNumber provided in treatmentDto.

UpdateTreatment(PatientTreatment)

Updates an existing patient treatment record based on the provided request payload. Requires the caller to have the AuthSome role and the appropriate source/display permissions.

[HttpPut]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> UpdateTreatment(PatientTreatment request)

Parameters

request PatientTreatment

The PatientTreatment payload containing the treatment data to update.

Returns

Task<IActionResult>

An IActionResult containing the updated treatment in an HTTP 200 OK response.