clqms-be/public/paths/orders.yaml
mahdahar 42006e1af9 feat: implement comprehensive order management with specimens and tests
Major updates to order system:
- Add specimen and test data to order responses (index, show, create, update, status update)
- Implement getOrderSpecimens() and getOrderTests() private methods in OrderTestController
- Support 'include=details' query parameter for expanded order data
- Update OrderTestModel with enhanced query capabilities and transaction handling

API documentation:
- Update OpenAPI specs for orders, patient-visits, and tests
- Add new schemas for order specimens and tests
- Regenerate bundled API documentation

Database:
- Add Requestable field to TestDefSite migration
- Create OrderSeeder and ClearOrderDataSeeder for test data
- Update DBSeeder to include order seeding

Patient visits:
- Add filtering by PatientID, PatientName, and date ranges
- Include LastLocation in visit queries

Testing:
- Add OrderCreateTest with comprehensive test coverage

Documentation:
- Update AGENTS.md with improved controller structure examples
2026-03-03 13:51:27 +07:00

266 lines
6.9 KiB
YAML

/api/ordertest:
get:
tags: [Orders]
summary: List orders
security:
- bearerAuth: []
parameters:
- name: page
in: query
schema:
type: integer
- name: perPage
in: query
schema:
type: integer
- name: InternalPID
in: query
schema:
type: integer
description: Filter by internal patient ID
- name: OrderStatus
in: query
schema:
type: string
enum: [ORD, SCH, ANA, VER, REV, REP]
description: |
ORD: Ordered
SCH: Scheduled
ANA: Analysis
VER: Verified
REV: Reviewed
REP: Reported
- name: include
in: query
schema:
type: string
enum: [details]
description: Include specimens and tests in response
responses:
'200':
description: List of orders
content:
application/json:
schema:
type: object
properties:
status:
type: string
message:
type: string
data:
type: array
items:
$ref: '../components/schemas/orders.yaml#/OrderTest'
post:
tags: [Orders]
summary: Create order with specimens and tests
description: Creates an order with associated specimens and patres records. Tests are grouped by container type to minimize specimen creation.
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- InternalPID
- Tests
properties:
OrderID:
type: string
description: Optional custom order ID (auto-generated if not provided)
InternalPID:
type: integer
description: Patient internal ID
PatVisitID:
type: integer
description: Visit ID
SiteID:
type: integer
default: 1
PlacerID:
type: string
Priority:
type: string
enum: [R, S, U]
default: R
description: |
R: Routine
S: Stat
U: Urgent
ReqApp:
type: string
description: Requesting application
Comment:
type: string
Tests:
type: array
items:
type: object
required:
- TestSiteID
properties:
TestSiteID:
type: integer
description: Test definition site ID
TestID:
type: integer
description: Alias for TestSiteID
responses:
'201':
description: Order created successfully with specimens and tests
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
message:
type: string
data:
$ref: '../components/schemas/orders.yaml#/OrderTest'
'400':
description: Validation error
'500':
description: Server error
patch:
tags: [Orders]
summary: Update order
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- OrderID
properties:
OrderID:
type: string
Priority:
type: string
enum: [R, S, U]
OrderStatus:
type: string
enum: [ORD, SCH, ANA, VER, REV, REP]
OrderingProvider:
type: string
DepartmentID:
type: integer
WorkstationID:
type: integer
responses:
'200':
description: Order updated
content:
application/json:
schema:
type: object
properties:
status:
type: string
message:
type: string
data:
$ref: '../components/schemas/orders.yaml#/OrderTest'
delete:
tags: [Orders]
summary: Delete order
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- OrderID
properties:
OrderID:
type: string
responses:
'200':
description: Order deleted
/api/ordertest/status:
post:
tags: [Orders]
summary: Update order status
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- OrderID
- OrderStatus
properties:
OrderID:
type: string
OrderStatus:
type: string
enum: [ORD, SCH, ANA, VER, REV, REP]
description: |
ORD: Ordered
SCH: Scheduled
ANA: Analysis
VER: Verified
REV: Reviewed
REP: Reported
responses:
'200':
description: Order status updated
content:
application/json:
schema:
type: object
properties:
status:
type: string
message:
type: string
data:
$ref: '../components/schemas/orders.yaml#/OrderTest'
/api/ordertest/{id}:
get:
tags: [Orders]
summary: Get order by ID
description: Returns order details with associated specimens and tests
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Order ID (e.g., 0025030300001)
responses:
'200':
description: Order details with specimens and tests
content:
application/json:
schema:
type: object
properties:
status:
type: string
message:
type: string
data:
$ref: '../components/schemas/orders.yaml#/OrderTest'