feat: auto-populate patient data in DATOS TOMA DE MUESTRAS form and add conditional dolor field
- Add fecha_nacimiento to __paciente in modoTurnero so linked fields render it - Format fecha_nacimiento as dd/mm/YYYY in static completed view - Evaluate separator conditions in static view to skip hidden sections - DB: add linked fields (numero_documento, tipo_documento, fecha_nacimiento, eps, telefono) to form id=16 - DB: add conditional "Tipo de dolor" field that appears only when Dolores is checked Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
9a3cd24454
commit
b29061c010
@@ -131,6 +131,7 @@ if ($modoTurnero) {
|
||||
'nombre_completo' => $tcRow['paciente_nombre'] ?? '',
|
||||
'numero_documento' => $tcRow['numero_documento'] ?? '',
|
||||
'tipo_documento' => $tcRow['tipo_documento'] ?? '',
|
||||
'fecha_nacimiento' => $tcRow['fecha_nacimiento'] ?? '',
|
||||
'telefono' => $tcRow['paciente_telefono'] ?? '',
|
||||
'eps' => $tcRow['eps'] ?? '',
|
||||
'medico_nombre' => trim(($tcRow['medico_nombres'] ?? '') . ' ' . ($tcRow['medico_apellidos'] ?? '')),
|
||||
@@ -634,11 +635,24 @@ function esc2(mixed $v): string {
|
||||
$_firmaGlobalPacienteUsada = false; // la firma global solo va al primer campo firma
|
||||
|
||||
if ($compact): ?><div class="campos-grid"><?php endif;
|
||||
$_saltarSeccion = false;
|
||||
foreach ($esquema as $campo):
|
||||
$tipo = $campo['tipo'] ?? '';
|
||||
if ($tipo === 'separador'): ?>
|
||||
if ($tipo === 'separador'):
|
||||
$cond = $campo['condicion'] ?? null;
|
||||
if ($cond) {
|
||||
$vCtrl = $todos[$cond['campo_id']] ?? null;
|
||||
$vCond = $cond['valores'] ?? ($cond['valor'] ? [$cond['valor']] : []);
|
||||
$_saltarSeccion = is_array($vCtrl)
|
||||
? empty(array_intersect($vCond, $vCtrl))
|
||||
: !in_array($vCtrl, $vCond, true);
|
||||
} else {
|
||||
$_saltarSeccion = false;
|
||||
}
|
||||
if ($_saltarSeccion) continue; ?>
|
||||
<div class="esquema-sep<?= $compact ? ' campo-full' : '' ?>"><?= esc2($campo['label'] ?? '') ?></div>
|
||||
<?php continue; endif;
|
||||
if ($_saltarSeccion) continue;
|
||||
|
||||
// ── Firmas inline: cada campo muestra su propia firma ──
|
||||
if ($tipo === 'firma' || $tipo === 'firma_profesional'):
|
||||
@@ -807,6 +821,9 @@ function esc2(mixed $v): string {
|
||||
if ($tipo === 'linked'):
|
||||
$lk = $campo['linked_key'] ?? '';
|
||||
$lval = $paciente[$lk] ?? $todos[$cid] ?? '';
|
||||
if ($lk === 'fecha_nacimiento' && $lval && preg_match('/^\d{4}-\d{2}-\d{2}/', $lval)) {
|
||||
$lval = date('d/m/Y', strtotime($lval));
|
||||
}
|
||||
if ($lval !== ''):
|
||||
?>
|
||||
<div class="campo-linked">
|
||||
|
||||
Reference in New Issue
Block a user