Patient numbers — definition CRUD and referenceId
The GraphQL API now supports managing Practice Number definitions (catalogue entries such as NH_ID) and exposes a stable correlation id on patient number assignments.
New mutations
All require the settingsGeneral permission on the integration token.
createPatientNumber(input: CreatePatientNumberInput!)— create a Practice Number definition.updatePatientNumberDefinition(id: ID!, input: UpdatePatientNumberDefinitionInput!)— updatenameand/orprimary.deletePatientNumberDefinition(id: ID!)— soft-delete a definition (system definitions cannot be deleted).
CreatePatientNumberInput.idType follows the Heydoc UI rules:
- GB practices:
USER(default) orNHS_UKwhen no active NHS definition exists. - FR practices:
USER(default) orINS_FRwhen no active INS definition exists.
Primary identifier
Only one Practice Number definition may be primary: true at a time. Setting primary: true on create or update demotes the previous primary definition.
New field on patient numbers
PatientNumber.referenceId(ID!) — the id of the Practice Number definition. Same value ascreatePatientNumber.data.idand thenumberIdpassed toaddPatientNumber. Returned even when the definition has been soft-deleted (namemay be null in that case).
Recommended flow
mutation {
createPatientNumber(input: { name: "NH_ID" }) {
data { id }
error
}
}
mutation {
addPatientNumber(
patientId: "..."
patientNumber: { numberId: "<definition id>", value: "..." }
) {
data { numbers { referenceId name value } }
error
}
}
query {
patient(id: "...") {
numbers { id referenceId name value }
}
}
This is an additive change. Existing queries and mutations are unaffected.