diff --git a/sandbox/src/mocks/retrieveServiceRequests/responses/ServiceRequestsWithAppointmentAndTask.json b/sandbox/src/mocks/retrieveServiceRequests/responses/ServiceRequestsWithAppointmentAndTask.json index db77dec8..641c56ce 100644 --- a/sandbox/src/mocks/retrieveServiceRequests/responses/ServiceRequestsWithAppointmentAndTask.json +++ b/sandbox/src/mocks/retrieveServiceRequests/responses/ServiceRequestsWithAppointmentAndTask.json @@ -304,6 +304,112 @@ } } }, + { + "fullUrl": "_baseUrl_/ServiceRequest/r.783014dd-c5d5-4f18-b326-739f56fa8c23", + "search": { + "mode": "match" + }, + "resource": { + "resourceType": "ServiceRequest", + "id": "r.783014dd-c5d5-4f18-b326-739f56fa8c23", + "meta": { + "versionId": "1", + "profile": ["https://fhir.nhs.uk/StructureDefinition/NHSDigital-ServiceRequest-PatientCare"] + }, + "extension": [ + { + "url": "https://fhir.nhs.uk/StructureDefinition/Extension-eRS-ServiceRequest-State", + "extension": [ + { + "url": "state", + "valueCoding": { + "system": "https://fhir.nhs.uk/CodeSystem/eRS-ReferralState", + "code": "CANCELLED" + } + }, + { + "url": "reason", + "valueCoding": { + "system": "https://fhir.nhs.uk/CodeSystem/eRS-RequestCancellationReason", + "code": "INTEND_PRIVATE" + } + }, + { + "code": "statusChanged", + "valueInstant": "2012-01-31T00:00:00.000Z" + } + ] + }, + { + "url": "https://fhir.nhs.uk/StructureDefinition/Extension-ServiceRequest-Priority", + "valueCoding": { + "system": "https://fhir.nhs.uk/CodeSystem/eRS-Priority", + "code": "TWO_WEEK_WAIT", + "display": "2 Week Wait" + } + } + ], + "contained": [ + { + "resourceType": "PractitionerRole", + "id": "PractitionerRole-R69-000000000101", + "meta": { + "profile": ["https://fhir.nhs.uk/StructureDefinition/NHSDigital-PractitionerRole-Minimal"] + }, + "practitioner": { + "identifier": { + "system": "https://fhir.nhs.uk/Id/sds-user-id", + "value": "000000000101" + } + }, + "organization": { + "identifier": { + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "R69" + } + } + } + ], + "identifier": [ + { + "system": "https://fhir.nhs.uk/Id/UBRN", + "value": "111111111111" + } + ], + "status": "active", + "intent": "order", + "category": [ + { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "3457005" + } + ] + } + ], + "priority": "asap", + "subject": { + "identifier": { + "system": "https://fhir.nhs.uk/Id/nhs-number", + "value": "9912003888" + } + }, + "authoredOn": "2022-01-11T16:40:00+00:00", + "requester": { + "reference": "#PractitionerRole-R69-000000000101" + }, + "performerType": { + "coding": [ + { + "system": "https://fhir.nhs.uk/CodeSystem/eRS-Specialty", + "code": "DERMATOLOGY", + "display": "Dermatology" + } + ] + } + } + }, { "fullUrl": "_baseUrl_/Appointment/2c539951-0819-4ffb-ab77-b7cbdc5d9c9a", "search": { diff --git a/specification/components/schemas/ServiceRequest.yaml b/specification/components/schemas/ServiceRequest.yaml index a97c9a47..b0f5b5e0 100644 --- a/specification/components/schemas/ServiceRequest.yaml +++ b/specification/components/schemas/ServiceRequest.yaml @@ -47,14 +47,14 @@ properties: $ref: identifiers/UBRN.yaml extension: type: array - minItems: 3 + minItems: 2 maxItems: 3 nullable: false description: | | Field | Cardinality | Notes | | ------------------------------------------ | ----------- | --------------------------------------------------------------------- | - | `Extension-Portal-Link` | `1..1` | Deep Link into the specific landing page in MYR | + | `Extension-Portal-Link` | `0..1` | Deep Link into the specific landing page in MYR | | `Extension-ServiceRequest-Priority` | `1..1` | Code for the priority of the referral set by the Referring Clinician | | `Extension-ServiceRequest-State` | `1..1` | Code for the ServiceRequest state | items: diff --git a/specification/components/schemas/codings/ServiceRequest-Cancellation-Reason.yaml b/specification/components/schemas/codings/ServiceRequest-Cancellation-Reason.yaml new file mode 100644 index 00000000..17f0ab51 --- /dev/null +++ b/specification/components/schemas/codings/ServiceRequest-Cancellation-Reason.yaml @@ -0,0 +1,44 @@ +type: object +description: e-RS representation of the reason for the state of the ServiceRequest. +required: + - url + - valueCoding +properties: + url: + type: string + enum: + - 'reason' + example: 'reason' + valueCoding: + type: object + required: + - system + - code + properties: + system: + type: string + enum: + - 'https://fhir.nhs.uk/CodeSystem/eRS-RequestCancellationReason' + example: 'https://fhir.nhs.uk/CodeSystem/eRS-RequestCancellationReason' + code: + type: string + enum: + - INTEND_PRIVATE + - PATIENT_REQUEST_CANCELLATION_OTHER + - REFERRER_CANCELLATION + - PATIENT_DIED + - RAISED_IN_ERROR + - TREATMENT_NO_LONGER_REQUIRED + - BOOKED_OUTSIDE_CAB + - PROVIDER_CANCELLATION + - PATIENT_APPOINTMENT_CANCELLATION_OTHER + - TRIAGE_ENDED + - OUTPATIENT_SERVICE_NA + - OUTPATIENT_CLINICIAN_NA + - COMMUNITY_SERVICE_NA + - STRAIGHT_TO_TEST + - BOOKED_CLINICAL_NEED + - COMPLEX_PATHWAY + - NO_LONGER_REQUIRED + - OTHER_OTHER + example: 'INTEND_PRIVATE' diff --git a/specification/components/schemas/codings/ServiceRequest-State.yaml b/specification/components/schemas/codings/ServiceRequest-State.yaml index 967389e3..cb5733dd 100644 --- a/specification/components/schemas/codings/ServiceRequest-State.yaml +++ b/specification/components/schemas/codings/ServiceRequest-State.yaml @@ -34,4 +34,5 @@ properties: - CARL - ARBL - CARBL_OR_ARL + - CANCELLED example: 'NOT_BOOKED' diff --git a/specification/components/schemas/codings/ServiceRequest-StatusChanged.yaml b/specification/components/schemas/codings/ServiceRequest-StatusChanged.yaml new file mode 100644 index 00000000..471eec1c --- /dev/null +++ b/specification/components/schemas/codings/ServiceRequest-StatusChanged.yaml @@ -0,0 +1,13 @@ +title: representation of the date the service request state was set +type: object +required: + - code + - valueInstant +properties: + code: + type: string + enum: + - statusChanged + valueInstant: + type: string + format: date-time diff --git a/specification/components/schemas/extensions/Extension-ServiceRequest-State.yaml b/specification/components/schemas/extensions/Extension-ServiceRequest-State.yaml index 637a38a3..bfa988f0 100644 --- a/specification/components/schemas/extensions/Extension-ServiceRequest-State.yaml +++ b/specification/components/schemas/extensions/Extension-ServiceRequest-State.yaml @@ -13,7 +13,9 @@ properties: extension: type: array minItems: 1 - maxItems: 1 + maxItems: 3 items: anyOf: - - $ref: '../codings/ServiceRequest-State.yaml' \ No newline at end of file + - $ref: '../codings/ServiceRequest-State.yaml' + - $ref: '../codings/ServiceRequest-Cancellation-Reason.yaml' + - $ref: '../codings/ServiceRequest-StatusChanged.yaml' diff --git a/specification/components/schemas/responses/retrieveServiceRequests/200Response.yaml b/specification/components/schemas/responses/retrieveServiceRequests/200Response.yaml index 1898f24d..014c1c7b 100644 --- a/specification/components/schemas/responses/retrieveServiceRequests/200Response.yaml +++ b/specification/components/schemas/responses/retrieveServiceRequests/200Response.yaml @@ -15,7 +15,7 @@ content: multiple: summary: ServiceRequest search response containing multiple ServiceRequest resources with an associated Task or Appointment value: - $ref: '../../../examples/retrieveServiceRequests/responses/ServiceRequestsWithAppointmentAndTask.json' + $ref: '../../../examples/retrieveServiceRequests/responses/ServiceRequestsWithAppointmentAndTask.json' empty: summary: Empty ServiceRequest search response value: