diff --git a/bus-gateway/controllers/iti65.js b/bus-gateway/controllers/iti65.js index f86286e..a96a31b 100644 --- a/bus-gateway/controllers/iti65.js +++ b/bus-gateway/controllers/iti65.js @@ -16,8 +16,8 @@ const LIST_RESOURCE_TYPE = 'List'; const NATIONAL_ID_SYSTEM = 'https://federador.msal.gob.ar/patient-id'; const DNI_SYSTEM = 'http://www.renaper.gob.ar/dni'; -const CUSTODIAN_ID_SYSTEM = 'https://federador.msal.gob.ar/uri'; -const MASTER_ID_SYSTEM = '' +const CUSTODIAN_ID_SYSTEM = 'http://federador.msal.gob.ar/uri'; +const MASTER_ID_SYSTEM = 'urn:ietf:rfc:3986' /** * Procesa una transacción y devuelve los recursos persistidos en el servidor HAPI FHIR @@ -91,7 +91,8 @@ async function createBusDocumentReference(token, localIPSDocument, localPatient) resourceType: 'DocumentReference', status: 'current', masterIdentifier: { - system: 'urn:ietf:rfc:3986', + use: 'usual', + system: MASTER_ID_SYSTEM, value: `urn:uuid:${uuidv4()}` }, type: { @@ -103,6 +104,7 @@ async function createBusDocumentReference(token, localIPSDocument, localPatient) }, ], }, + date: "2026-04-28T10:00:00-03:00", subject: { reference: busPatientReference }, @@ -113,6 +115,7 @@ async function createBusDocumentReference(token, localIPSDocument, localPatient) { attachment: { url: localIPSDocumentReference, + contentType: 'application/fhir+json' }, }, ], @@ -154,7 +157,7 @@ async function provideDocumentBundle(req, res, next) { // Paso 4: Creo el document reference en el indice de atenciones const busDocumentReference = await createBusDocumentReference(token, localIPSDocument, localPatient); - return status(200).json(busDocumentReference); + return res.status(200).json(busDocumentReference); } catch (err) { next(err); diff --git a/bus-gateway/services/documentReference.js b/bus-gateway/services/documentReference.js index 8532e04..09fd886 100644 --- a/bus-gateway/services/documentReference.js +++ b/bus-gateway/services/documentReference.js @@ -101,7 +101,7 @@ async function searchDocumentReference(token, subject, custodian, type) { } module.exports = { - fetchDocumentRefernce: fetchDocumentReference, + fetchDocumentReference, postDocumentReference, searchDocumentReferenceBySubject, searchDocumentReferenceByPatient,