feat(pacientes): modo insertar en sync-all — solo crea nuevos, omite existentes

sync_todos() ahora acepta modo='insertar'|'upsert'. La ruta /pacientes/sync-all
usa insertar: skippea cédulas que ya están en lab_pacientes. Los hooks
automáticos (terceros/automation) siguen en upsert.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-09 11:06:14 -05:00
co-authored by Claude Sonnet 4.6
parent e7c6bc794a
commit 1aab14f705
3 changed files with 27 additions and 14 deletions
+7 -3
View File
@@ -135,7 +135,7 @@ async function runSync() {
result.innerHTML = `
<div class="bg-green-50 border border-green-200 rounded-lg p-4 space-y-3">
<p class="font-medium text-green-800"><i class="fas fa-check-circle mr-2"></i>${json.message}</p>
<div class="grid grid-cols-3 gap-3 text-center text-sm">
<div class="grid grid-cols-4 gap-3 text-center text-sm">
<div class="bg-white rounded-lg p-3 border border-green-100">
<p class="text-2xl font-bold text-gray-800">${json.total}</p>
<p class="text-gray-500">Total</p>
@@ -145,8 +145,12 @@ async function runSync() {
<p class="text-gray-500">Nuevos</p>
</div>
<div class="bg-white rounded-lg p-3 border border-green-100">
<p class="text-2xl font-bold text-green-600">${json.updated}</p>
<p class="text-gray-500">Actualizados</p>
<p class="text-2xl font-bold text-gray-400">${json.skipped ?? 0}</p>
<p class="text-gray-500">Ya existían</p>
</div>
<div class="bg-white rounded-lg p-3 border border-green-100">
<p class="text-2xl font-bold text-red-500">${json.errores}</p>
<p class="text-gray-500">Errores</p>
</div>
</div>
${json.errores > 0 ? `<p class="text-sm text-red-600"><i class="fas fa-exclamation-triangle mr-1"></i>${json.errores} errores — revisa los detalles abajo.</p>` : ''}