T8/T9: TEA Seguimiento and Análisis de riesgo as two components in rebuild's list style

tea-list is replaced by tab-seguimiento-tea and tab-riesgos-tea over one
tea-rows module (params, rows, workbook, export), with Material filters,
cards and pager. The risk list defaults to every child and keeps the
association pairs per row; the focused patient is fetched with the list's
own search. Specs and page cases follow.
This commit is contained in:
2026-12-01 03:55:35 -06:00
parent 48e6c9f390
commit fcb3634fa9
17 changed files with 1219 additions and 990 deletions
+239
View File
@@ -0,0 +1,239 @@
<div class="filters card">
<app-patient-search [(value)]="search" (searched)="index.set(0)" />
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Fecha de corte</mat-label>
<input
matInput
type="date"
[ngModel]="filters().cutoff || cutoff()"
(ngModelChange)="setFilter('cutoff', $event)"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Ventana de meses</mat-label>
<mat-select [value]="filters().window" (selectionChange)="setFilter('window', $event.value)">
@for (months of [1, 3, 6, 12]; track months) {
<mat-option [value]="months">{{ months }} {{ months === 1 ? 'mes' : 'meses' }}</mat-option>
}
</mat-select>
</mat-form-field>
@for (filter of tokenFilters; track filter.key) {
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>{{ filter.label }}</mat-label>
<mat-select
[value]="filters()[filter.key] || ''"
(selectionChange)="setFilter(filter.key, $event.value)"
>
<mat-option value="">Todos</mat-option>
@for (option of filter.options; track option.code) {
<mat-option [value]="option.code">{{ option.label }}</mat-option>
}
</mat-select>
</mat-form-field>
}
@for (filter of scoreFilters; track filter.label) {
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>{{ filter.label }} mínimo</mat-label>
<input
matInput
type="number"
step="any"
[ngModel]="filters()[filter.min]"
(ngModelChange)="setFilter(filter.min, $event)"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>{{ filter.label }} máximo</mat-label>
<input
matInput
type="number"
step="any"
[ngModel]="filters()[filter.max]"
(ngModelChange)="setFilter(filter.max, $event)"
/>
</mat-form-field>
}
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Inicio</mat-label>
<input
matInput
type="date"
[ngModel]="filters().start"
(ngModelChange)="setFilter('start', $event)"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Modelo de asociación</mat-label>
<mat-select
[value]="association()"
(selectionChange)="association.set($event.value); index.set(0)"
>
@for (option of associationOptions; track option) {
<mat-option [value]="option">{{ associationLabels[option] }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Registros por página</mat-label>
<mat-select [value]="size()" (selectionChange)="size.set($event.value); index.set(0)">
@for (n of [20, 50, 100]; track n) {
<mat-option [value]="n">{{ n }}</mat-option>
}
</mat-select>
</mat-form-field>
</div>
@if (cutoff()) {
<p class="muted window">Ventana consultada: {{ start() }} al {{ cutoff() }}.</p>
}
@if (summary(); as eeg) {
<section class="card eeg-summary" aria-labelledby="tea-eeg-summary">
<h3 id="tea-eeg-summary">EEG de los pacientes del periodo</h3>
<div class="counts">
<span><strong>{{ eeg.normal }}</strong> Normales</span>
<span><strong>{{ eeg.abnormal }}</strong> Anormales</span>
<span><strong>{{ eeg.notValid }}</strong> Sin EEG válido</span>
</div>
@if (eeg.alterations.length) {
<ul class="by-alteration">
@for (alteration of eeg.alterations; track alteration.code) {
<li>{{ name(alteration.code) }}: <strong>{{ alteration.patients }}</strong></li>
}
</ul>
}
</section>
} @else if (summaryError()) {
<p role="alert">No se pudo leer el resumen de EEG.</p>
}
<div class="actions">
<button
mat-stroked-button
type="button"
(click)="export()"
[disabled]="loading() || exporting() || !!error() || !rows().length"
>
{{ exporting() ? 'Exportando…' : 'Exportar a Excel' }}
</button>
</div>
@if (actionError()) {
<p role="alert">{{ actionError() }}</p>
}
@if (error()) {
<p role="alert">No se pudieron leer los pacientes.</p>
} @else if (loading()) {
<app-loading what="pacientes" />
}
@if (!loading() && !error()) {
<div class="table-wrap card">
<table class="plain worklist">
<caption>
Resultados de asociación por paciente
</caption>
<thead>
<tr>
<th scope="col">Expediente</th>
<th scope="col">Nombre</th>
<th scope="col">Pares</th>
<th scope="col">Acciones</th>
</tr>
</thead>
<tbody>
@for (row of rows(); track row.patient.id) {
@let id = row.patient.id!;
<tr>
<td>{{ row.recordNumbers.join(', ') || '—' }}</td>
<td>
<a [routerLink]="['/indicadores', 'tea', 'pacientes', id]">
{{ row.name || '—' }}
</a>
</td>
<td>{{ row.pairs.length || '—' }}</td>
<td>
<div class="row-actions">
@if (row.pairs.length) {
<button
mat-button
type="button"
(click)="toggle(id)"
[attr.aria-expanded]="expanded()[id] ?? false"
>
{{ expanded()[id] ? 'Ocultar' : 'Ver detalles' }}
</button>
}
<a [routerLink]="['/indicadores', 'tea', 'pacientes', id, 'riesgo']">Riesgo</a>
</div>
</td>
</tr>
@if (expanded()[id] && row.pairs.length) {
<tr>
<td colspan="4">
<table class="plain pairs">
<thead>
<tr>
<th>Par</th>
<th>OR (IC)</th>
<th>q</th>
<th>Probabilidad</th>
<th>Referencia</th>
<th>Mismo sentido</th>
</tr>
</thead>
<tbody>
@for (pair of row.pairs; track pair.pair) {
<tr>
<td>{{ pair.pair || '—' }}</td>
<td>
{{ (pair.or | number: '1.0-3') ?? '—' }} ({{
(pair.low | number: '1.0-3') ?? '—'
}}–{{ (pair.high | number: '1.0-3') ?? '—' }})
</td>
<td>{{ (pair.q | number: '1.0-4') ?? '—' }}</td>
<td>{{ (pair.probability | number: '1.0-4') ?? '—' }}</td>
<td>{{ (pair.reference | number: '1.0-4') ?? '—' }}</td>
<td>
{{
pair.sameDirection == null ? '—' : pair.sameDirection ? 'Sí' : 'No'
}}
</td>
</tr>
}
</tbody>
</table>
</td>
</tr>
}
} @empty {
<tr>
<td colspan="4" class="muted">No hay registros para los filtros aplicados.</td>
</tr>
}
</tbody>
</table>
</div>
<nav class="pager" aria-label="Páginas de pacientes">
<span class="muted">
Página {{ index() + 1 }} de {{ pageCount() }} · {{ filtered().length }} registros
</span>
<button
mat-stroked-button
type="button"
(click)="index.set(index() - 1)"
[disabled]="index() === 0"
>
Anterior
</button>
<button
mat-stroked-button
type="button"
(click)="index.set(index() + 1)"
[disabled]="index() + 1 >= pageCount()"
>
Siguiente
</button>
</nav>
}