false]); exit; } $doc = preg_replace('/\D/', '', trim($_GET['doc'] ?? '')); if (strlen($doc) < 5 || strlen($doc) > 15) { echo json_encode(['ok' => false]); exit; } try { $stmt = Database::getInstance()->getConnection() ->prepare("SELECT fecha_nacimiento FROM lab_pacientes WHERE numero_documento = ? LIMIT 1"); $stmt->execute([$doc]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row || !$row['fecha_nacimiento']) { echo json_encode(['ok' => false]); exit; } echo json_encode(['ok' => true, 'fecha_nacimiento' => $row['fecha_nacimiento']]); } catch (\Throwable $e) { echo json_encode(['ok' => false]); }