fix: JSON preview recepciones via store (evita innerHTML injection)
feat: paso 1 registra terceros EPS de pre-servicios junto a particulares - _rdaJsonStore guarda JSON por key, toggleRdaJson usa textContent - escHtml() para caracteres especiales en diagnostico - _SQL_PACIENTES_EPS obtiene pacientes de PRESSERV_DIAN - rows_pac_todos fusiona particulares + EPS deduplicando por CODIGO Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
ef02303dde
commit
e6860a6957
@@ -179,6 +179,11 @@
|
||||
|
||||
<script>
|
||||
let _previewData = null;
|
||||
let _rdaJsonStore = {};
|
||||
|
||||
function escHtml(s) {
|
||||
return s.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
||||
}
|
||||
|
||||
async function previewAutomation() {
|
||||
const fecha = document.getElementById('fecha-input').value;
|
||||
@@ -235,22 +240,27 @@ async function previewAutomation() {
|
||||
table.innerHTML = '<div class="p-4 text-gray-400 text-center">No hay pacientes para esta fecha</div>';
|
||||
showToast('No hay datos para esa fecha', 'warning');
|
||||
} else {
|
||||
_rdaJsonStore = {};
|
||||
table.innerHTML = data.pacientes_preview.map((p, i) => {
|
||||
const rdaRows = p.rda.map((r, j) => `
|
||||
const rdaRows = p.rda.map((r, j) => {
|
||||
const key = `rda-json-${i}-${j}`;
|
||||
_rdaJsonStore[key] = r.json;
|
||||
return `
|
||||
<div class="divide-y divide-blue-100">
|
||||
<div class="flex items-center gap-3 px-6 py-1.5 bg-blue-50 border-t border-blue-100 text-xs cursor-pointer hover:bg-blue-100 select-none"
|
||||
onclick="toggleRdaJson('rda-json-${i}-${j}', this)">
|
||||
onclick="toggleRdaJson('${key}', this)">
|
||||
<i class="fas fa-chevron-right text-blue-300 text-xs transition-transform duration-150" id="rdachev-${i}-${j}"></i>
|
||||
<span class="text-blue-400 w-4"><i class="fas fa-flask"></i></span>
|
||||
<span class="font-mono text-blue-700 w-28">${r.factura}</span>
|
||||
<span class="text-blue-600 w-24">${r.fecha}</span>
|
||||
<span class="font-mono bg-blue-100 text-blue-800 px-1.5 py-0.5 rounded w-14 text-center">${r.contrato || '—'}</span>
|
||||
<span class="text-blue-600 w-20">${r.examenes} examen(es)</span>
|
||||
<span class="text-blue-600 flex-1">${r.diag}</span>
|
||||
<span class="text-blue-600 flex-1">${escHtml(r.diag||'')}</span>
|
||||
<span class="text-blue-700 font-medium">$${Number(r.valor).toLocaleString('es-CO')}</span>
|
||||
</div>
|
||||
<div id="rda-json-${i}-${j}" class="hidden bg-gray-900 text-green-300 text-xs font-mono p-4 overflow-x-auto whitespace-pre">${JSON.stringify(r.json, null, 2)}</div>
|
||||
</div>`).join('');
|
||||
<div id="${key}" class="hidden bg-gray-900 text-green-300 text-xs font-mono p-4 overflow-x-auto whitespace-pre"></div>
|
||||
</div>`;
|
||||
}).join('');
|
||||
return `
|
||||
<div class="divide-y divide-gray-100">
|
||||
<div class="flex items-center gap-3 px-4 py-2.5 hover:bg-gray-50 cursor-pointer select-none"
|
||||
@@ -373,6 +383,9 @@ function toggleRdaJson(id, row) {
|
||||
const div = document.getElementById(id);
|
||||
const chev = row.querySelector('[id^="rdachev-"]');
|
||||
const hidden = div.classList.contains('hidden');
|
||||
if (hidden && _rdaJsonStore[id]) {
|
||||
div.textContent = JSON.stringify(_rdaJsonStore[id], null, 2);
|
||||
}
|
||||
div.classList.toggle('hidden', !hidden);
|
||||
if (chev) chev.style.transform = hidden ? 'rotate(90deg)' : '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user