Compare commits
9
Commits
065928e8c1
...
8bc9cbdd35
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bc9cbdd35 | ||
|
|
b1264da979 | ||
|
|
17c9e1a1f2 | ||
|
|
7a08e63e44 | ||
|
|
26bb9e1844 | ||
|
|
d46c983776 | ||
|
|
44e9b86b27 | ||
|
|
89b407f5cc | ||
|
|
7842de0d21 |
@@ -20,6 +20,7 @@ $cacheRow = db()->prepare(
|
|||||||
WHERE numero_documento = ?
|
WHERE numero_documento = ?
|
||||||
AND DATE(created_at) = CURDATE()
|
AND DATE(created_at) = CURDATE()
|
||||||
AND created_at >= NOW() - INTERVAL 30 MINUTE
|
AND created_at >= NOW() - INTERVAL 30 MINUTE
|
||||||
|
AND turno_id IS NULL
|
||||||
ORDER BY created_at DESC
|
ORDER BY created_at DESC
|
||||||
LIMIT 1"
|
LIMIT 1"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* POST /api/lab/marcar_rips_usado.php
|
||||||
|
* Marca el registro RIPS de una cédula como consumido por un turno.
|
||||||
|
* Body: { cedula, turno_id }
|
||||||
|
*/
|
||||||
|
require_once __DIR__ . '/_helpers.php';
|
||||||
|
requireMethod('POST');
|
||||||
|
|
||||||
|
$body = json_decode(file_get_contents('php://input'), true) ?? [];
|
||||||
|
$cedula = trim($body['cedula'] ?? '');
|
||||||
|
$turnoId = (int)($body['turno_id'] ?? 0);
|
||||||
|
|
||||||
|
if (!$cedula || !$turnoId) jsonError('cedula y turno_id requeridos', 400);
|
||||||
|
|
||||||
|
db()->prepare(
|
||||||
|
"UPDATE rips_examenes_pendientes
|
||||||
|
SET turno_id = ?
|
||||||
|
WHERE numero_documento = ?
|
||||||
|
AND DATE(created_at) = CURDATE()
|
||||||
|
AND turno_id IS NULL
|
||||||
|
ORDER BY created_at DESC
|
||||||
|
LIMIT 1"
|
||||||
|
)->execute([$turnoId, $cedula]);
|
||||||
|
|
||||||
|
jsonOk(['marcado' => true]);
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
; kiosko_autoprint.ahk
|
||||||
|
; Detecta el diálogo de impresión y lo confirma automáticamente.
|
||||||
|
; Requiere AutoHotkey v2: https://www.autohotkey.com/
|
||||||
|
|
||||||
|
#Persistent
|
||||||
|
SetTitleMatchMode 2
|
||||||
|
|
||||||
|
Loop {
|
||||||
|
; Esperar cualquier ventana de diálogo de impresión (Chrome, Edge, Windows)
|
||||||
|
if WinExist("Imprimir") or WinExist("Print") {
|
||||||
|
WinActivate
|
||||||
|
Sleep 400
|
||||||
|
; Intentar presionar el botón Imprimir / OK / Enter
|
||||||
|
ControlClick "Button1"
|
||||||
|
Sleep 200
|
||||||
|
Send "{Enter}"
|
||||||
|
Sleep 1000
|
||||||
|
}
|
||||||
|
Sleep 500
|
||||||
|
}
|
||||||
+1
-1
@@ -2,4 +2,4 @@
|
|||||||
taskkill /F /IM msedge.exe >nul 2>&1
|
taskkill /F /IM msedge.exe >nul 2>&1
|
||||||
timeout /t 2 /nobreak >nul
|
timeout /t 2 /nobreak >nul
|
||||||
|
|
||||||
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --kiosk "https://erp.laboratorioximenacaicedo.com/erp.php?m=turnero&v=kiosko&autoprint=1" --edge-kiosk-type=fullscreen --kiosk-printing --disable-print-preview
|
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --kiosk "https://erp.laboratorioximenacaicedo.com/erp.php?m=turnero&v=kiosko&autoprint=1" --edge-kiosk-type=fullscreen --kiosk-printing
|
||||||
|
|||||||
@@ -120,11 +120,32 @@ try {
|
|||||||
$turnoId = (int) $pdo->lastInsertId();
|
$turnoId = (int) $pdo->lastInsertId();
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
|
|
||||||
|
// ── Prioridad F: saltar recepción, ir directo a toma de muestras ──
|
||||||
|
$esSoloMuestra = ($prioCodigo === 'F');
|
||||||
|
if ($esSoloMuestra) {
|
||||||
|
try {
|
||||||
|
$stmtLugar = $pdo->prepare(
|
||||||
|
"SELECT id FROM turnero_lugares WHERE tipo = 'muestras' AND activo = 1 ORDER BY sort_order ASC LIMIT 1"
|
||||||
|
);
|
||||||
|
$stmtLugar->execute();
|
||||||
|
$lugarMuestras = $stmtLugar->fetchColumn();
|
||||||
|
if ($lugarMuestras) {
|
||||||
|
$pdo->prepare(
|
||||||
|
"UPDATE turnero_turnos
|
||||||
|
SET estado = 'en_espera_lugar',
|
||||||
|
lugar_destino_id = ?,
|
||||||
|
fin_recepcion_at = NOW()
|
||||||
|
WHERE id = ?"
|
||||||
|
)->execute([(int)$lugarMuestras, $turnoId]);
|
||||||
|
notificarSSE($sesionId);
|
||||||
|
}
|
||||||
|
} catch (\Throwable $_) {}
|
||||||
|
}
|
||||||
|
|
||||||
notificarSSE($sesionId);
|
notificarSSE($sesionId);
|
||||||
|
|
||||||
// ── Crear registro de consentimiento (siempre, con o sin teléfono) ──
|
// ── Crear registro de consentimiento (siempre, con o sin teléfono) ──
|
||||||
$enlaceConsentimiento = null;
|
$enlaceConsentimiento = null;
|
||||||
$esSoloMuestra = ($prioCodigo === 'F');
|
|
||||||
if (!$esSoloMuestra) {
|
if (!$esSoloMuestra) {
|
||||||
try {
|
try {
|
||||||
$stmtForms = $pdo->prepare(
|
$stmtForms = $pdo->prepare(
|
||||||
|
|||||||
@@ -84,6 +84,15 @@ function generarUuid(): string
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Leer config de WhatsApp (igual que create_turno.php) ─────
|
||||||
|
$stmtCfg = $pdo->prepare(
|
||||||
|
"SELECT clave, valor FROM lab_config WHERE clave IN ('turnero_wa_template','turnero_wa_lang')"
|
||||||
|
);
|
||||||
|
$stmtCfg->execute();
|
||||||
|
$cfgWA = $stmtCfg->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||||
|
$waTemplateName = $cfgWA['turnero_wa_template'] ?? 'consentimiento_turno';
|
||||||
|
$waLangFallback = $cfgWA['turnero_wa_lang'] ?? 'es';
|
||||||
|
|
||||||
$pdo->beginTransaction();
|
$pdo->beginTransaction();
|
||||||
$consentimientosResultado = [];
|
$consentimientosResultado = [];
|
||||||
$erroresEnvio = [];
|
$erroresEnvio = [];
|
||||||
@@ -105,10 +114,10 @@ try {
|
|||||||
|
|
||||||
$wa = new WhatsAppService('turnero');
|
$wa = new WhatsAppService('turnero');
|
||||||
$waMeta = ['canal' => 'turnero'];
|
$waMeta = ['canal' => 'turnero'];
|
||||||
$waTemplate = 'consentimiento_turno';
|
$waTemplate = $waTemplateName;
|
||||||
$stmtLang = $pdo->prepare("SELECT language_code FROM message_templates WHERE template_name = ? LIMIT 1");
|
$stmtLang = $pdo->prepare("SELECT language_code FROM message_templates WHERE template_name = ? LIMIT 1");
|
||||||
$stmtLang->execute([$waTemplate]);
|
$stmtLang->execute([$waTemplate]);
|
||||||
$waLang = $stmtLang->fetchColumn() ?: 'es';
|
$waLang = $stmtLang->fetchColumn() ?: $waLangFallback;
|
||||||
|
|
||||||
$baseUrl = defined('BASE_URL') ? rtrim(BASE_URL, '/') : (
|
$baseUrl = defined('BASE_URL') ? rtrim(BASE_URL, '/') : (
|
||||||
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http')
|
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http')
|
||||||
|
|||||||
@@ -1515,6 +1515,9 @@ function abrirFicha(turno) {
|
|||||||
if (data && !pacienteActivo) seleccionarPaciente(data);
|
if (data && !pacienteActivo) seleccionarPaciente(data);
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
|
} else if (turno.paciente_nombre && /^\d{5,15}$/.test(turno.paciente_nombre.trim())) {
|
||||||
|
// El kiosko capturó una cédula como nombre — consultar RIPS de inmediato
|
||||||
|
consultarExamenesRips(turno.paciente_nombre.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cargar consentimientos del desk actual para este turno
|
// Cargar consentimientos del desk actual para este turno
|
||||||
@@ -1704,6 +1707,16 @@ async function cargarExamenesRips() {
|
|||||||
if (_ripsData.valor_total > 0) {
|
if (_ripsData.valor_total > 0) {
|
||||||
document.getElementById('inp-total').value = Math.round(_ripsData.valor_total);
|
document.getElementById('inp-total').value = Math.round(_ripsData.valor_total);
|
||||||
}
|
}
|
||||||
|
// Marcar registro RIPS como consumido para no reutilizarlo en otro turno
|
||||||
|
const cedula = pacienteActivo?.numero_documento || pacienteActivo?.documento
|
||||||
|
|| turnoActivo?.paciente_nombre || '';
|
||||||
|
if (cedula && turnoActivo?.id) {
|
||||||
|
fetch(`${BASE_WA}api/lab/marcar_rips_usado.php`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ cedula, turno_id: turnoActivo.id }),
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
descartarRips();
|
descartarRips();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -546,6 +546,9 @@ function _addExamWizardHtml(string $cid): string {
|
|||||||
@media (min-width: 480px) {
|
@media (min-width: 480px) {
|
||||||
.campos-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 14px; align-items: start; }
|
.campos-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 14px; align-items: start; }
|
||||||
.campos-grid .campo-full { grid-column: span 3; }
|
.campos-grid .campo-full { grid-column: span 3; }
|
||||||
|
/* ponytail: :has() override — 4-col only when campo-cuarto present */
|
||||||
|
.campos-grid:has(.campo-cuarto) { grid-template-columns: 1fr 1fr 1fr 1fr; }
|
||||||
|
.campos-grid:has(.campo-cuarto) .campo-full { grid-column: span 4; }
|
||||||
}
|
}
|
||||||
/* ── Checkboxes y radios con área táctil mayor ── */
|
/* ── Checkboxes y radios con área táctil mayor ── */
|
||||||
.campo-edit .form-check {
|
.campo-edit .form-check {
|
||||||
@@ -1201,8 +1204,9 @@ function _addExamWizardHtml(string $cid): string {
|
|||||||
};
|
};
|
||||||
// texto libre ocupa fila completa; tipos cortos caben 3 por fila
|
// texto libre ocupa fila completa; tipos cortos caben 3 por fila
|
||||||
$inputFullClass = ($compact && $tipo === 'texto') ? ' campo-full' : '';
|
$inputFullClass = ($compact && $tipo === 'texto') ? ' campo-full' : '';
|
||||||
|
$extraClase = htmlspecialchars($campo['clase'] ?? '', ENT_QUOTES);
|
||||||
?>
|
?>
|
||||||
<div class="campo-edit<?= $inputFullClass ?>" data-campo-id="<?= esc2($cid) ?>">
|
<div class="campo-edit<?= $inputFullClass ?><?= $extraClase ? ' '.$extraClase : '' ?>" data-campo-id="<?= esc2($cid) ?>">
|
||||||
<label><?= $label ?></label>
|
<label><?= $label ?></label>
|
||||||
<input type="<?= $inputType ?>" class="form-control form-control-sm"
|
<input type="<?= $inputType ?>" class="form-control form-control-sm"
|
||||||
name="<?= esc2($cid) ?>" value="<?= esc2($prefill) ?>"<?= $req ?>
|
name="<?= esc2($cid) ?>" value="<?= esc2($prefill) ?>"<?= $req ?>
|
||||||
@@ -1963,13 +1967,15 @@ function _mpRefreshCards(signedFid, nextFid) {
|
|||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
_mpRenderCards();
|
_mpRenderCards();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
var fw = document.querySelector('.firma-pro-widget:not([style*="display:none"])');
|
||||||
|
if (!fw) return;
|
||||||
|
// Siempre auto-llenar la hora (incluso en Minuto 0 sin firmas previas)
|
||||||
|
_mpAutoFillHora(fw.dataset.campo);
|
||||||
|
// Solo hacer scroll si ya hay alguna firma iniciada
|
||||||
var hayFirmaIniciada = Object.keys(window._mpSavedFirmas || {}).length > 0
|
var hayFirmaIniciada = Object.keys(window._mpSavedFirmas || {}).length > 0
|
||||||
|| !!document.querySelector('.firma-box img');
|
|| !!document.querySelector('.firma-box img');
|
||||||
if (!hayFirmaIniciada) return;
|
if (hayFirmaIniciada) {
|
||||||
var fw = document.querySelector('.firma-pro-widget:not([style*="display:none"])');
|
|
||||||
if (fw) {
|
|
||||||
fw.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
fw.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||||
_mpAutoFillHora(fw.dataset.campo);
|
|
||||||
}
|
}
|
||||||
}, 350);
|
}, 350);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user