Crear paciente (o actualizarlo)
const url = 'https://ponspre.medicinainteligente.ai/fhir/Patient?identifier=example';const options = { method: 'PUT', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/fhir+json'}, body: '{ "resourceType": "Patient", "meta": { "profile": [ "http://fhir.hcen.gub.uy/StructureDefinition/hcen-patient" ] }, "identifier": [ { "use": "usual", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "MR", "display": "Medical record number" } ] }, "system": "urn:oid:2.16.858.2.99999999.72768.1", "value": "HC-000123" }, { "use": "official", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "NI", "display": "National unique individual identifier" } ] }, "system": "urn:oid:2.16.858.2.10000675.68909", "value": "70000011" } ], "name": [ { "use": "official", "family": "Rodríguez", "given": [ "Lucía" ] } ], "gender": "female", "birthDate": "1985-03-14" }'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url 'https://ponspre.medicinainteligente.ai/fhir/Patient?identifier=example' \ --header 'Content-Type: application/fhir+json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "resourceType": "Patient", "meta": { "profile": [ "http://fhir.hcen.gub.uy/StructureDefinition/hcen-patient" ] }, "identifier": [ { "use": "usual", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "MR", "display": "Medical record number" } ] }, "system": "urn:oid:2.16.858.2.99999999.72768.1", "value": "HC-000123" }, { "use": "official", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "NI", "display": "National unique individual identifier" } ] }, "system": "urn:oid:2.16.858.2.10000675.68909", "value": "70000011" } ], "name": [ { "use": "official", "family": "Rodríguez", "given": [ "Lucía" ] } ], "gender": "female", "birthDate": "1985-03-14" }'Alta o actualización del paciente por el MRN de la institución. El Patient trae el MRN y el documento de identidad. PONS lo busca por ese MRN y por sus documentos, cédula o pasaporte: 201 si lo crea; 200 si ya existía. Cada institución tiene su propio registro del paciente. El MRN tiene que ser del dominio de la institución (403). Si un documento ya es de otro paciente de la institución, 409; si coincide más de uno, 412.
Authorizations
Sección titulada «Authorizations»Parameters
Sección titulada «Parameters»Query Parameters
Sección titulada «Query Parameters»<system del MRN>|<MRN>: el MRN de la institución (urn:oid:2.16.858.2.<IdInstitución>.72768.<n>). Tiene que ser el mismo que trae el Patient.
Request Bodyrequired
Sección titulada «Request Bodyrequired»object
Examples
Pedido real
{ "resourceType": "Patient", "meta": { "profile": [ "http://fhir.hcen.gub.uy/StructureDefinition/hcen-patient" ] }, "identifier": [ { "use": "usual", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "MR", "display": "Medical record number" } ] }, "system": "urn:oid:2.16.858.2.99999999.72768.1", "value": "HC-000123" }, { "use": "official", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "NI", "display": "National unique individual identifier" } ] }, "system": "urn:oid:2.16.858.2.10000675.68909", "value": "70000011" } ], "name": [ { "use": "official", "family": "Rodríguez", "given": [ "Lucía" ] } ], "gender": "female", "birthDate": "1985-03-14"}Paciente con pasaporte, sin cédula
{ "resourceType": "Patient", "meta": { "profile": [ "http://fhir.hcen.gub.uy/StructureDefinition/hcen-patient" ] }, "identifier": [ { "use": "usual", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "MR", "display": "Medical record number" } ] }, "system": "urn:oid:2.16.858.2.99999999.72768.1", "value": "HC-000123" }, { "use": "official", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "PPN", "display": "Passport number" } ] }, "system": "urn:oid:2.16.858.1.76.68912", "value": "FX000123" } ], "name": [ { "use": "official", "family": "Silva", "given": [ "João" ] } ], "gender": "male", "birthDate": "1990-01-02"}Responses
Sección titulada «Responses»Éxito
Example generated
exampleÉxito
Examples
Respuesta real
{ "resourceType": "Patient", "id": "1021", "meta": { "versionId": "1", "lastUpdated": "2026-10-20T10:00:00.000-03:00", "profile": [ "http://fhir.hcen.gub.uy/StructureDefinition/hcen-patient" ], "tag": [ { "system": "urn:pons:hcen", "code": "paciente-institucion" } ] }, "identifier": [ { "use": "usual", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "MR", "display": "Medical record number" } ] }, "system": "urn:oid:2.16.858.2.99999999.72768.1", "value": "HC-000123" }, { "use": "official", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "NI", "display": "National unique individual identifier" } ] }, "system": "urn:oid:2.16.858.2.10000675.68909", "value": "70000011" } ], "name": [ { "use": "official", "family": "Rodríguez", "given": [ "Lucía" ] } ], "gender": "female", "birthDate": "1985-03-14"}Paciente con pasaporte, sin cédula
{ "resourceType": "Patient", "id": "1376", "meta": { "versionId": "1", "lastUpdated": "2026-10-20T10:00:00.000-03:00", "profile": [ "http://fhir.hcen.gub.uy/StructureDefinition/hcen-patient" ], "tag": [ { "system": "urn:pons:hcen", "code": "paciente-institucion" } ] }, "identifier": [ { "use": "usual", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "MR", "display": "Medical record number" } ] }, "system": "urn:oid:2.16.858.2.99999999.72768.1", "value": "HC-000123" }, { "use": "official", "type": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v2-0203", "code": "PPN", "display": "Passport number" } ] }, "system": "urn:oid:2.16.858.1.76.68912", "value": "FX000123" } ], "name": [ { "use": "official", "family": "Silva", "given": [ "João" ] } ], "gender": "male", "birthDate": "1990-01-02"}Falta la API key, no es válida o fue revocada.
Examples
Respuesta real
{ "detail": "Falta la API key, no es válida o fue revocada (header X-API-Key o Authorization: Bearer)"}La key no tiene el alcance que pide esta operación. O: El MRN no es del dominio de la institución, o su alta no tiene dominio de MRN. Se usan los MRN de la institución.
Examples
Respuesta real
{ "detail": "La API key no tiene el alcance 'entrada'"}Examples
Respuesta real
{ "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "forbidden", "diagnostics": "el MRN es del dominio urn:oid:2.16.858.2.99999998.72768.1 y la institución registra con urn:oid:2.16.858.2.99999999.72768.1: sólo se aceptan los MRN de la institución", "expression": [ "Patient.identifier" ] } ]}Otro envío con el mismo MRN está en curso. Se reintenta después de los segundos de Retry-After. O: Un documento del paciente (cédula o pasaporte) ya es de otro paciente de la institución, registrado con otro MRN. No se guardó nada; reintentar da lo mismo.
Examples
Respuesta real
{ "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "transient", "diagnostics": "otro alta con el mismo MRN o documento se está guardando ahora; reintentá" } ]}Respuesta real
{ "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "conflict", "diagnostics": "el documento urn:oid:2.16.858.1.858.68909|70000011 es de un paciente que la institución ya registró con el MRN urn:oid:2.16.858.2.99999999.72768.1|HC-000123 (Patient/1021). No se guardó nada: quedarían dos pacientes con el mismo documento. Revisá el documento; si es correcto, los dos pacientes son la misma persona y hay que fusionarlos. Reintentar da lo mismo", "expression": [ "Patient.identifier" ] } ]}El Patient no es válido para la HCEN. El OperationOutcome dice el elemento.
Examples
Respuesta real
{ "resourceType": "OperationOutcome", "issue": [ { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line", "valueInteger": 1 }, { "url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-col", "valueInteger": 632 }, { "url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-message-id", "valueString": "Validation_VAL_Profile_Minimum_SLICE" } ], "severity": "error", "code": "processing", "details": { "coding": [ { "system": "http://hl7.org/fhir/java-core-messageId", "code": "Validation_VAL_Profile_Minimum_SLICE" } ] }, "diagnostics": "Slice 'Patient.identifier:mrn': a matching slice is required, but not found (from http://fhir.hcen.gub.uy/StructureDefinition/hcen-patient|0.1.0). Note that other slices are allowed in addition to this required slice", "location": [ "Patient", "Line[1] Col[632]" ], "expression": [ "Patient" ] } ]}