CaCu record: stages with states and sources, segmented risk scales, antecedents and collapsible findings
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { Sheet } from '../export';
|
||||
import type { RiskScale } from './risk-scales';
|
||||
import { Stage, STATES } from './stages';
|
||||
import { ANTECEDENTS } from './record-groups';
|
||||
import { SOURCES, Stage, STATES } from './stages';
|
||||
|
||||
const NONE = 'No disponible';
|
||||
const percent = (p: number) => `${(100 * p).toFixed(2)} %`;
|
||||
@@ -15,6 +16,12 @@ interface Test {
|
||||
kind: string;
|
||||
reported?: string;
|
||||
results: string[];
|
||||
/** the extra findings (collapsed on the page) */
|
||||
findings: string[];
|
||||
}
|
||||
interface Form {
|
||||
date: string;
|
||||
values: Record<string, string | undefined>;
|
||||
}
|
||||
|
||||
/** A patient's record as the tables of her PDF, in the page's order. */
|
||||
@@ -23,6 +30,7 @@ export function recordSheets(
|
||||
stages: Stage[],
|
||||
history: Event[],
|
||||
tests: Test[],
|
||||
forms: Form[],
|
||||
scales: RiskScale[],
|
||||
): Sheet[] {
|
||||
return [
|
||||
@@ -33,18 +41,38 @@ export function recordSheets(
|
||||
},
|
||||
{
|
||||
title: 'Etapas del tamizaje',
|
||||
head: ['Etapa', 'Estado', 'Fecha'],
|
||||
rows: stages.map((s) => [s.label, STATES[s.state], s.day ?? '']),
|
||||
head: ['Etapa', 'Estado', 'Fecha', 'Procedencia'],
|
||||
rows: stages.map((s) => [
|
||||
s.label,
|
||||
STATES[s.state],
|
||||
s.day ?? (s.requested ? `Solicitada el ${s.requested}` : ''),
|
||||
(s.sources ?? []).map((c) => SOURCES[c]).join(' · '),
|
||||
]),
|
||||
},
|
||||
{
|
||||
title: 'Historial médico',
|
||||
head: ['Fecha', 'Tipo', 'Detalle'],
|
||||
rows: history.map((h) => [h.date, h.kind, h.text]),
|
||||
},
|
||||
{
|
||||
title:
|
||||
'Antecedentes y evaluación ginecológica (declarados en el formulario de la citología; no son diagnósticos confirmados)',
|
||||
head: ['Toma', ...ANTECEDENTS.map((a) => a.title)],
|
||||
rows: forms.map((f) => [
|
||||
f.date,
|
||||
...ANTECEDENTS.map((a) => f.values[a.field] ?? 'No documentado'),
|
||||
]),
|
||||
},
|
||||
{
|
||||
title: 'Pruebas y resultados',
|
||||
head: ['Toma', 'Estudio', 'Reporte', 'Resultados'],
|
||||
rows: tests.map((t) => [t.date, t.kind, t.reported ?? 'Pendiente', t.results.join(' · ')]),
|
||||
head: ['Toma', 'Estudio', 'Reporte', 'Resultados', 'Hallazgos'],
|
||||
rows: tests.map((t) => [
|
||||
t.date,
|
||||
t.kind,
|
||||
t.reported ?? 'Pendiente',
|
||||
t.results.join(' · '),
|
||||
t.findings.join(' · '),
|
||||
]),
|
||||
},
|
||||
{
|
||||
title: 'Riesgos',
|
||||
|
||||
Reference in New Issue
Block a user