Files
WebApp/src/app/indicadores/tab-riesgos.html
T
2026-11-30 23:31:58 -06:00

240 lines
7.6 KiB
HTML

<form class="filters card" (submit)="$event.preventDefault()">
<app-patient-search [(value)]="search" />
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Fecha de corte</mat-label>
<input
matInput
type="date"
[ngModel]="cutoff() || applied()"
(ngModelChange)="cutoff.set($event)"
name="cutoff"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Edad mínima</mat-label>
<input
matInput
type="number"
min="0"
max="120"
[ngModel]="ageFrom()"
(ngModelChange)="setAge(ageFrom, $event)"
name="ageFrom"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Edad máxima</mat-label>
<input
matInput
type="number"
min="0"
max="120"
[ngModel]="ageTo()"
(ngModelChange)="setAge(ageTo, $event)"
name="ageTo"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Ventana de meses</mat-label>
<mat-select [value]="window()" (selectionChange)="window.set($event.value)">
@for (m of [1, 3, 6, 12]; track m) {
<mat-option [value]="m">{{ m }} {{ m === 1 ? 'mes' : 'meses' }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Estatus de seguimiento</mat-label>
<mat-select [value]="status()" (selectionChange)="status.set($event.value)">
<mat-option value="">Todos</mat-option>
@for (s of statuses; track s) {
<mat-option [value]="s">{{ name(s) }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Horizonte de la probabilidad</mat-label>
<mat-select [value]="horizon()" (selectionChange)="horizon.set($event.value)">
@for (h of [1, 2, 3, 4, 5]; track h) {
<mat-option [value]="h">{{ h }} {{ h === 1 ? 'año' : 'años' }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Ordenar por</mat-label>
<mat-select [value]="sort()" (selectionChange)="sort.set($event.value)">
<mat-option value="-recent">Estudio más reciente</mat-option>
<mat-option value="-risk-cin2">Mayor riesgo de LIEAG+</mat-option>
<mat-option value="-risk-cancer">Mayor riesgo de cáncer</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)">
@for (n of [20, 50, 100]; track n) {
<mat-option [value]="n">{{ n }}</mat-option>
}
</mat-select>
</mat-form-field>
<button
mat-stroked-button
type="button"
[disabled]="saving() || !applied()"
(click)="save('xlsx')"
>
Exportar Excel
</button>
<button
mat-stroked-button
type="button"
[disabled]="saving() || !applied()"
(click)="save('pdf')"
>
Exportar PDF
</button>
</form>
@if (saveError()) {
<p class="muted" role="alert">{{ saveError() }}</p>
}
@if (error()) {
<p class="muted" role="alert">
No se pudo leer la lista de seguimiento.
<button mat-button type="button" (click)="retry()">Reintentar seguimiento</button>
</p>
} @else if (!page() || loading()) {
<app-loading what="seguimiento" />
} @else if (applied()) {
<p class="muted window">Ventana consultada: {{ start() }} al {{ applied() }}.</p>
}
<div class="table-wrap card">
<table class="plain worklist">
<caption>
Resultados disponibles por paciente
</caption>
<thead>
<tr>
<th>Paciente</th>
<th>Edad</th>
<th>Estatus de seguimiento</th>
<th>Etapas</th>
<th>Última citología</th>
<th>Último resultado de VPH</th>
<th>Última biopsia</th>
<th>Probabilidad a LIEAG+ a {{ horizon() }} {{ horizon() === 1 ? 'año' : 'años' }} (%)</th>
<th>Probabilidad a cáncer a {{ horizon() }} {{ horizon() === 1 ? 'año' : 'años' }} (%)</th>
<th>Estudio más reciente</th>
<th>Días de toma a diagnóstico</th>
</tr>
</thead>
<tbody>
@for (row of rows(); track row.patient.id) {
<tr>
<td>
<a
[routerLink]="['/indicadores', domain(), 'pacientes', row.patient.id]"
[queryParams]="{ corte: applied(), citologia: row.cytology?.date }"
>{{ row.name ?? row.patient.id!.slice(0, 10) }}</a
>
@if (row.curp) {
<div class="muted curp">{{ row.curp }}</div>
}
</td>
<td>
{{ row.age ?? 'No disponible' }}
<small>Grupo: {{ row.ageGroup }}</small>
</td>
<td>{{ name(row.status) }}</td>
<td>
<app-stages [stages]="row.stages" />
<button
mat-button
type="button"
[attr.aria-expanded]="opened() === row.patient.id"
(click)="toggle(row)"
>
Detalle
</button>
</td>
<td>
@if (row.cytology; as c) {
{{ result(c) }}
<small>Fecha: {{ c.date }}</small>
<small>Calidad: {{ c.adequacy ? name(c.adequacy) : '—' }}</small>
} @else {
No disponible
}
</td>
<td>
@if (row.hpv; as h) {
{{ h.positive ? 'Positivo' : 'Negativo' }}
<small>Fecha: {{ h.date }}</small>
<small
>Genotipo 16/18:
{{
h.types1618 === undefined
? 'No disponible'
: h.types1618
? 'Presente'
: 'No detectado'
}}</small
>
} @else {
No disponible
}
</td>
<td>
@if (row.biopsy; as b) {
{{ name(b.histology ?? '') || 'Sin grado' }}
<small>Fecha: {{ b.date }}</small>
} @else {
No disponible
}
</td>
<td class="num">
{{
row.risk.cin2 === undefined
? 'No disponible'
: (row.risk.cin2 * 100 | number: '1.1-1') + ' %'
}}
</td>
<td class="num">
{{
row.risk.cancer === undefined
? 'No disponible'
: (row.risk.cancer * 100 | number: '1.1-1') + ' %'
}}
</td>
<td>{{ latest(row) ?? 'No disponible' }}</td>
<td class="num">{{ row.daysToDiagnosis ?? 'No disponible' }}</td>
</tr>
@if (opened() === row.patient.id) {
<tr class="stage-detail">
<td colspan="11"><app-stages [stages]="row.stages" [detail]="true" /></td>
</tr>
}
} @empty {
@if (page() && !loading()) {
<tr>
<td colspan="11" class="muted">No hay registros para los filtros aplicados.</td>
</tr>
}
}
</tbody>
</table>
</div>
<div class="pager">
<span class="muted">
@if (page()?.total; as total) {
Página {{ pageNumber() }} de {{ pageCount() }}, {{ total }} registros
}
</span>
<button mat-stroked-button (click)="go('previous')" [disabled]="!has('previous') || loading()">
Anterior
</button>
<button mat-stroked-button (click)="go('next')" [disabled]="!has('next') || loading()">
Siguiente
</button>
</div>