feat(tea): cambios de la reunión del 5 de noviembre

Resumen
- Estado del caso (completo, en proceso, fuera del protocolo) al cierre del
  periodo, en una figura y en el párrafo, separado de diagnóstico confirmado.
- Tiempos por paso: M-CHAT a ADOS-2, ADOS-2 a diagnóstico y total.
- Un solo formato: barras. M24 son barras apiladas por grupo de edad.
- «Descargar reporte» abre la impresión con el periodo y los indicadores
  seleccionados.

Histórico
- Porcentaje de casos en proceso, tiempos por paso en la misma escala y
  calidad de los EEG (indicador solo de esta pestaña, con `vistas`).
- Ejes con unidades y fechas como «mar 2025».

Seguimiento
- Columna y filtro de estado del caso, con lo que falta.
- Filtro por tipo de alteración y resumen de EEG que sigue los filtros.
- Módulo de ADOS-2 junto al puntaje.
- Tarjetas de alteraciones: al elegir una se apartan y aparece su mapa, sin
  caja, con leyenda de colores. Referencia por grupo de edad.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 13:38:53 -06:00
parent 27dc7a0166
commit ef631e2c0b
24 changed files with 515 additions and 115 deletions
@@ -16,7 +16,7 @@ import { IndicadoresService } from './indicadores.service';
import { applyGlobal, domainTypes, GlobalFilterState, IndicadoresMemory, pending, validDraft } from './indicadores-memory';
import { IndicadorPeriodFilters } from './indicador-period-filters';
import { IndicadorCatalogCard } from './indicador-catalog-card';
import { CACU_RESULTADO_KPI, KPI_BY_DOMAIN } from './indicadores-kpi';
import { CACU_RESULTADO_KPI, KPI_BY_DOMAIN, KPI_RESUMEN_TEA } from './indicadores-kpi';
import { TeaResumenPeriodo } from './tea-resumen-periodo';
import { IndicadorKpiPanel } from './indicador-kpi-panel';
import { IndicadorKpiCard } from './indicador-kpi-card';
@@ -160,7 +160,26 @@ export class IndicadoresPage {
this.visibilityObserver = observer;
for (const region of this.observedRegions.keys()) observer.observe(region);
}
// Report: every selected chart has to be drawn, narrow enough for a page, before opening the print dialog.
readonly preparandoReporte = signal(false);
async descargarReporte() {
const browser = this.document.defaultView;
if (!browser || this.preparandoReporte()) return;
this.preparandoReporte.set(true);
for (const card of this.graphicCards()) card.setVisible(true);
this.changeDetector.markForCheck();
const espera = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
const pendiente = () => this.element.nativeElement.querySelector('#panel-resumen mat-progress-bar, #panel-resumen .figure-skeleton');
await espera(100);
for (let i = 0; pendiente() && i < 150; i++) await espera(100);
// Charts resize to the page width on their next frames.
await espera(500);
const terminar = () => { this.preparandoReporte.set(false); this.changeDetector.markForCheck(); this.visibilityChanged(); };
browser.addEventListener('afterprint', terminar, { once: true });
browser.print();
}
private evaluateVisibility() {
if (this.preparandoReporte()) return;
const browser = this.document.defaultView;
if (!browser || this.visibilityDestroyed || !this.visibilityObserver) return;
if (this.activeSection() !== 'resumen') return;
@@ -180,9 +199,9 @@ export class IndicadoresPage {
changeIndicatorSelection(ids: string[]) {
this.preserveCardFocus();
// Every indicator checked is the same as no filter, so later catalog additions also show.
this.indicatorSelection.set(ids.length === this.catalog().length ? null : ids);
this.indicatorSelection.set(ids.length === this.catalogOrder().length ? null : ids);
}
showAllIndicators() { this.changeIndicatorSelection(this.catalog().map(item => item.id)); }
showAllIndicators() { this.changeIndicatorSelection(this.catalogOrder().map(item => item.id)); }
isPinned(item: Indicador) { return this.memory.isPinned(this.dominio, item.id); }
togglePinned(item: Indicador) {
this.preserveCardFocus();
@@ -254,7 +273,7 @@ export class IndicadoresPage {
// Short form for the domain-switcher buttons (our shell's own nav, see the
// template comment above it) -- `domainLabels`/`domainTitles` are prose-length.
readonly domainNavLabels: Record<Dominio, string> = { tea: 'TEA', cacu: 'CaCu', cama: 'CaMa' };
readonly kpisByDomain = KPI_BY_DOMAIN;
readonly kpisByDomain = { ...KPI_BY_DOMAIN, tea: [...KPI_BY_DOMAIN.tea, ...KPI_RESUMEN_TEA] };
figureApplied(item: Indicador) { return figureApplied(this.dominio, item.id, this.filters!.applied); }
independentPeriods(item: Indicador) { return independentFigurePeriods(this.dominio, item.id); }
kpiIndicator(id: string) {
@@ -287,13 +306,13 @@ export class IndicadoresPage {
readonly catalog = signal<Indicador[]>([]);
// Ids of the indicators to render; null shows the whole catalog.
readonly indicatorSelection = signal<string[] | null>(null);
readonly searchVisible = computed(() => this.catalog().length >= 2);
readonly searchVisible = computed(() => this.catalogOrder().length >= 2);
// Stable presentation priority; pins still take precedence in the grid.
readonly catalogOrder = computed(() => {
const catalog = this.catalog();
return this.dominio === 'cacu'
? [...catalog.filter(item => item.id === 'cacu_eu7'), ...catalog.filter(item => item.id !== 'cacu_eu7')]
: catalog;
: catalog.filter(item => !item.vistas || item.vistas.includes('resumen'));
});
readonly selectedIndicators = computed(() => this.indicatorSelection() ?? this.catalog().map(item => item.id));
readonly selectionSummary = computed(() => {