Pro routes
Mounted at /pro. JWT audience snr_pro. Same encrypted Authorization header as /app and /admin.
POST /pro/sops
Section titled “POST /pro/sops”Lists second_opinions assigned to the authenticated doctor (JWT id = doctor_id on the row). Only active = 1 rows. Paginated.
Request body
Section titled “Request body”| Field | Type | Required | Notes |
|---|---|---|---|
coordinator | boolean | no | If true, only rows with is_coordinator = 1. If false or omitted, only rows with is_coordinator = 0. |
page | number | no | default 1 |
page_size | number | no | default 15, max 100 |
Example
Section titled “Example”{ "coordinator": true, "page": 1, "page_size": 15}Response — data items
Section titled “Response — data items”| Field | Type | Notes |
|---|---|---|
sop_id | string | Primary key |
case_id | string | Review case |
doctor_id | string | Same as JWT id for this list |
requested_documents | string[] | Parsed from JSON |
created_date | string | ISO timestamp |
is_coordinator | boolean |
pagination: total, page, page_size.
POST /pro/review-case-details
Section titled “POST /pro/review-case-details”Single review case for the authenticated pro doctor (JWT id). Allowed only if review_cases.case_coordinator_id equals that id or there is an active second_opinions row for the same case_id and doctor_id. Otherwise 404 (Case not found — no distinction from missing case).
Request body
Section titled “Request body”| Field | Type | Required |
|---|---|---|
case_id | string | yes |
Response — data
Section titled “Response — data”Same shape as POST /app/review-case-details: case_id, rt_id, dc_id, patient_age, patient_gender, status, medical_history, medical_documents, created_date, updated_date, reject_reason, case_coordinator_id.
POST /pro/assign-doctor
Section titled “POST /pro/assign-doctor”Assigns another doctor to the review case by inserting a second_opinions row with is_coordinator = 0. Only the case coordinator may call this: review_cases.case_coordinator_id must equal the JWT id. If the case has no coordinator or the caller is not that coordinator → 403.
Request body
Section titled “Request body”| Field | Type | Required | Notes |
|---|---|---|---|
case_id | string | yes | |
doctor_id | string | yes | Assignee provider id (stored on new second_opinions row) |
requested_documents | string[] | no | Same as POST /admin/assign-coordinator; omit or [] for none |
Response — success (200)
Section titled “Response — success (200)”{ "status": 1000, "message": "Doctor assigned to case", "data": { "case_id": "uuid", "doctor_id": "EMP2", "sop_id": "uuid" }}404 if case_id does not exist. 403 if caller is not the case coordinator.
POST /pro/request-documents
Section titled “POST /pro/request-documents”Updates second_opinions.requested_documents (JSON array of strings) for an existing active row. doctor_id in the body must equal the JWT id (the doctor may only update their own assignment). sop_id identifies the row.
Request body
Section titled “Request body”| Field | Type | Required | Notes |
|---|---|---|---|
sop_id | string | yes | second_opinions.sop_id |
doctor_id | string | yes | Must match JWT id |
request_documents | string[] | yes | Each item non-empty after trim; [] clears to an empty list |
Response — success (200)
Section titled “Response — success (200)”{ "status": 1000, "message": "Requested documents updated", "data": { "sop_id": "uuid", "doctor_id": "EMP1" }}404 if no matching active row (sop_id + doctor_id). 403 if doctor_id ≠ JWT id.