ISSSTELEON 2fe5301

This commit is contained in:
Roberto Treviño
2026-12-01 09:59:57 -06:00
parent 157006954c
commit c1c81449a9
23 changed files with 1668 additions and 209 deletions
+55
View File
@@ -0,0 +1,55 @@
import type { Sheet } from '../export';
import type { RiskScale } from './risk-scales';
import { Stage, STATES } from './stages';
const NONE = 'No disponible';
const percent = (p: number) => `${(100 * p).toFixed(2)} %`;
interface Event {
date: string;
kind: string;
text: string;
}
interface Test {
date: string;
kind: string;
reported?: string;
results: string[];
}
export function recordSheets(
facts: [string, string | undefined][],
stages: Stage[],
history: Event[],
tests: Test[],
scales: RiskScale[],
): Sheet[] {
return [
{
title: 'Datos de la paciente',
head: ['Dato', 'Valor'],
rows: facts.map(([k, v]) => [k, v || NONE]),
},
{
title: 'Etapas del tamizaje',
head: ['Etapa', 'Estado', 'Fecha'],
rows: stages.map((s) => [s.label, STATES[s.state], s.day ?? '']),
},
{
title: 'Historial médico',
head: ['Fecha', 'Tipo', 'Detalle'],
rows: history.map((h) => [h.date, h.kind, h.text]),
},
{
title: 'Pruebas y resultados',
head: ['Toma', 'Estudio', 'Reporte', 'Resultados'],
rows: tests.map((t) => [t.date, t.kind, t.reported ?? 'Pendiente', t.results.join(' · ')]),
},
{
title: 'Riesgos',
head: ['Riesgo', 'Probabilidad', 'IC 95 %'],
rows: scales.map(({ label, risk }) => [
label,
risk ? percent(risk.p) : NONE,
risk?.low === undefined ? NONE : `${percent(risk.low)} a ${percent(risk.high!)}`,
]),
},
];
}