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
treatmentServiceITreatmentServicepatientServiceIPatientService
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
patientIdstringThe 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
patientIdis 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
treatmentIdstringThe unique identifier of the treatment to delete.
Returns
- Task<IActionResult>
An IActionResult representing the result of the deletion operation.
Exceptions
- BadRequestException
Thrown when
treatmentIdis 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
requestPaginationFilterThe 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
requestis 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
patientidstringThe 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
patientidis 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
treatmentDtoTreatmentDtoThe 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 OKonce the request has been successfully saved.
Exceptions
- NotFoundException
Thrown when no patient is found for the
PatientNumberprovided intreatmentDto.
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
requestPatientTreatmentThe PatientTreatment payload containing the treatment data to update.
Returns
- Task<IActionResult>
An IActionResult containing the updated treatment in an HTTP 200 OK response.