Recepción: vincular paciente atómicamente al crear token de firma

create_consent_token.php ahora acepta paciente_id y lo vincula al turno
si aún no lo tiene, eliminando la carrera con vincular_paciente.php
(fire-and-forget). Ya no hace falta refrescar para firmar el consentimiento.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-23 09:54:41 -05:00
co-authored by Claude Opus 4.8
parent 506f3469b4
commit dfe3a01fee
2 changed files with 11 additions and 3 deletions
+2 -2
View File
@@ -568,7 +568,7 @@ async function abrirFormularioLugar(formularioId, nombre) {
const res = await fetch(API + 'create_consent_token.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ turno_id: turnoActivo.id, formulario_id: formularioId }),
body: JSON.stringify({ turno_id: turnoActivo.id, formulario_id: formularioId, paciente_id: pacienteActivo?.id || null }),
});
const json = await res.json();
if (json.ok && (json.data?.url || json.url)) {
@@ -1208,7 +1208,7 @@ async function firmarConsentimiento(formularioId, nombre) {
const res = await fetch(API + 'create_consent_token.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ turno_id: turnoActivo.id, formulario_id: formularioId }),
body: JSON.stringify({ turno_id: turnoActivo.id, formulario_id: formularioId, paciente_id: pacienteActivo?.id || null }),
});
const json = await res.json();
if (json.ok && (json.url || json.data?.url)) {