- Add full CRUD operations for results (index, show, update, delete)
- Implement result validation with reference range checking (L/H flags)
- Add cumulative patient results retrieval across all orders
- Create ReportController for HTML lab report generation
- Add lab report view with patient info, order details, and test results
- Implement soft delete for results with transaction safety
- Update API routes with /api/results/* endpoints for CRUD
- Add /api/reports/{orderID} endpoint for report viewing
- Update OpenAPI docs with results and reports schemas/paths
- Add documentation for manual result entry and MVP plan
301 lines
8.9 KiB
YAML
301 lines
8.9 KiB
YAML
/api/results:
|
|
get:
|
|
tags: [Results]
|
|
summary: List results
|
|
description: Retrieve patient test results with optional filters by order or patient
|
|
security:
|
|
- bearerAuth: []
|
|
parameters:
|
|
- name: order_id
|
|
in: query
|
|
schema:
|
|
type: integer
|
|
description: Filter by internal order ID
|
|
- name: patient_id
|
|
in: query
|
|
schema:
|
|
type: integer
|
|
description: Filter by internal patient ID (returns cumulative results)
|
|
- name: page
|
|
in: query
|
|
schema:
|
|
type: integer
|
|
default: 1
|
|
description: Page number for pagination
|
|
- name: per_page
|
|
in: query
|
|
schema:
|
|
type: integer
|
|
default: 20
|
|
description: Number of results per page
|
|
responses:
|
|
'200':
|
|
description: List of results
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
status:
|
|
type: string
|
|
example: success
|
|
message:
|
|
type: string
|
|
data:
|
|
type: array
|
|
items:
|
|
type: object
|
|
properties:
|
|
ResultID:
|
|
type: integer
|
|
OrderID:
|
|
type: integer
|
|
TestSiteID:
|
|
type: integer
|
|
TestSiteCode:
|
|
type: string
|
|
Result:
|
|
type: string
|
|
nullable: true
|
|
ResultDateTime:
|
|
type: string
|
|
format: date-time
|
|
RefNumID:
|
|
type: integer
|
|
nullable: true
|
|
RefTxtID:
|
|
type: integer
|
|
nullable: true
|
|
CreateDate:
|
|
type: string
|
|
format: date-time
|
|
TestSiteName:
|
|
type: string
|
|
nullable: true
|
|
Unit1:
|
|
type: string
|
|
nullable: true
|
|
Unit2:
|
|
type: string
|
|
nullable: true
|
|
Low:
|
|
type: number
|
|
nullable: true
|
|
High:
|
|
type: number
|
|
nullable: true
|
|
LowSign:
|
|
type: string
|
|
nullable: true
|
|
HighSign:
|
|
type: string
|
|
nullable: true
|
|
RefDisplay:
|
|
type: string
|
|
nullable: true
|
|
|
|
/api/results/{id}:
|
|
get:
|
|
tags: [Results]
|
|
summary: Get result by ID
|
|
description: Retrieve a specific result entry with all related data
|
|
security:
|
|
- bearerAuth: []
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
description: Result ID
|
|
responses:
|
|
'200':
|
|
description: Result details
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
status:
|
|
type: string
|
|
example: success
|
|
message:
|
|
type: string
|
|
data:
|
|
type: object
|
|
properties:
|
|
ResultID:
|
|
type: integer
|
|
SiteID:
|
|
type: integer
|
|
OrderID:
|
|
type: integer
|
|
InternalSID:
|
|
type: integer
|
|
SID:
|
|
type: string
|
|
SampleID:
|
|
type: string
|
|
TestSiteID:
|
|
type: integer
|
|
TestSiteCode:
|
|
type: string
|
|
AspCnt:
|
|
type: integer
|
|
Result:
|
|
type: string
|
|
nullable: true
|
|
SampleType:
|
|
type: string
|
|
nullable: true
|
|
ResultDateTime:
|
|
type: string
|
|
format: date-time
|
|
WorkstationID:
|
|
type: integer
|
|
nullable: true
|
|
EquipmentID:
|
|
type: integer
|
|
nullable: true
|
|
RefNumID:
|
|
type: integer
|
|
nullable: true
|
|
RefTxtID:
|
|
type: integer
|
|
nullable: true
|
|
CreateDate:
|
|
type: string
|
|
format: date-time
|
|
TestSiteName:
|
|
type: string
|
|
nullable: true
|
|
Unit1:
|
|
type: string
|
|
nullable: true
|
|
Unit2:
|
|
type: string
|
|
nullable: true
|
|
Low:
|
|
type: number
|
|
nullable: true
|
|
High:
|
|
type: number
|
|
nullable: true
|
|
LowSign:
|
|
type: string
|
|
nullable: true
|
|
HighSign:
|
|
type: string
|
|
nullable: true
|
|
RefDisplay:
|
|
type: string
|
|
nullable: true
|
|
OrderNumber:
|
|
type: string
|
|
nullable: true
|
|
InternalPID:
|
|
type: integer
|
|
'404':
|
|
description: Result not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/common.yaml#/ErrorResponse'
|
|
|
|
patch:
|
|
tags: [Results]
|
|
summary: Update result
|
|
description: Update a result value with automatic validation against reference ranges. Returns calculated flag (L/H) in response but does not store it.
|
|
security:
|
|
- bearerAuth: []
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
description: Result ID
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
Result:
|
|
type: string
|
|
description: The result value
|
|
RefNumID:
|
|
type: integer
|
|
description: Reference range ID to validate against
|
|
SampleType:
|
|
type: string
|
|
nullable: true
|
|
WorkstationID:
|
|
type: integer
|
|
nullable: true
|
|
EquipmentID:
|
|
type: integer
|
|
nullable: true
|
|
responses:
|
|
'200':
|
|
description: Result updated successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
status:
|
|
type: string
|
|
example: success
|
|
message:
|
|
type: string
|
|
data:
|
|
type: object
|
|
properties:
|
|
result:
|
|
type: object
|
|
flag:
|
|
type: string
|
|
nullable: true
|
|
enum: [L, H]
|
|
description: Calculated flag - L for Low, H for High, null for normal
|
|
'400':
|
|
description: Validation failed
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/common.yaml#/ErrorResponse'
|
|
'404':
|
|
description: Result not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/common.yaml#/ErrorResponse'
|
|
|
|
delete:
|
|
tags: [Results]
|
|
summary: Delete result
|
|
description: Soft delete a result entry by setting DelDate
|
|
security:
|
|
- bearerAuth: []
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: integer
|
|
description: Result ID
|
|
responses:
|
|
'200':
|
|
description: Result deleted successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/common.yaml#/SuccessResponse'
|
|
'404':
|
|
description: Result not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/common.yaml#/ErrorResponse' |