fix: use FECHA_RECEPCION for exam query in scheduler, not HORAINICIORECEPCION

HORAINICIORECEPCION is a TIME field that can be NULL or outside the
2-minute window even when FECHA_RECEPCION matches, causing patients
to sync without their exams. Using the same FECHA_RECEPCION filter
for both queries ensures consistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-28 09:32:42 -05:00
co-authored by Claude Sonnet 4.6
parent 7f2dffc63e
commit 408325192a
+1 -1
View File
@@ -59,7 +59,7 @@ LEFT JOIN EMPRESA_SUB es ON TRIM(es.NIT_EMP) = TRIM(r.NIT_EMPRESA)
AND TRIM(es.SUBGRUPO) = TRIM(r.SUBGRUPO)
LEFT JOIN TARIFA t ON TRIM(t.COD_EXAMEN) = TRIM(rel.COD_EXAMEN)
AND t.TARIFA = COALESCE(es.TARIFA, e.TARIFA)
WHERE r.HORAINICIORECEPCION >= DATEADD(MINUTE, ?, CURRENT_TIMESTAMP)
WHERE r.FECHA_RECEPCION >= DATEADD(MINUTE, ?, CURRENT_TIMESTAMP)
ORDER BY r.IDRECEPCION
"""