clqms-be/public/paths/patients.yaml
mahdahar e99a60fe93 feat: support partial patient patch updates
Implement true PATCH behavior so omitted fields stay unchanged, while null can explicitly clear nullable nested data. Align patient update tests and OpenAPI schemas/responses with the new 200/400/404 contract.
2026-04-06 14:21:46 +07:00

176 lines
4.2 KiB
YAML

/api/patient:
get:
tags: [Patient]
summary: List patients
security:
- bearerAuth: []
parameters:
- name: page
in: query
schema:
type: integer
default: 1
- name: perPage
in: query
schema:
type: integer
default: 20
- name: InternalPID
in: query
schema:
type: integer
description: Filter by internal patient ID
- name: PatientID
in: query
schema:
type: string
description: Filter by patient ID
- name: Name
in: query
schema:
type: string
description: Search by patient name
- name: Birthdate
in: query
schema:
type: string
format: date
description: Filter by birthdate (YYYY-MM-DD)
responses:
'200':
description: List of patients
content:
application/json:
schema:
$ref: '../components/schemas/patient.yaml#/PatientListResponse'
post:
tags: [Patient]
summary: Create new patient
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '../components/schemas/patient.yaml#/Patient'
responses:
'201':
description: Patient created successfully
content:
application/json:
schema:
$ref: '../components/schemas/common.yaml#/SuccessResponse'
'422':
description: Validation error
content:
application/json:
schema:
$ref: '../components/schemas/common.yaml#/ErrorResponse'
delete:
tags: [Patient]
summary: Delete patient (soft delete)
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- InternalPID
properties:
InternalPID:
type: integer
description: Internal patient record ID
responses:
'200':
description: Patient deleted successfully
/api/patient/check:
get:
tags: [Patient]
summary: Check if patient exists
security:
- bearerAuth: []
parameters:
- name: PatientID
in: query
schema:
type: string
description: Patient ID to check
- name: EmailAddress1
in: query
schema:
type: string
format: email
description: Email address to check
responses:
'200':
description: Patient check result
content:
application/json:
schema:
type: object
properties:
exists:
type: boolean
data:
$ref: '../components/schemas/patient.yaml#/Patient'
/api/patient/{id}:
get:
tags: [Patient]
summary: Get patient by ID
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: integer
description: Internal patient record ID
responses:
'200':
description: Patient details
content:
application/json:
schema:
type: object
properties:
status:
type: string
data:
$ref: '../components/schemas/patient.yaml#/Patient'
patch:
tags: [Patient]
summary: Partially update patient
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: integer
description: Internal patient record ID
requestBody:
required: true
content:
application/json:
schema:
$ref: '../components/schemas/patient.yaml#/PatientPatch'
responses:
'200':
description: Patient updated successfully
'400':
description: Validation error
'404':
description: Patient not found