feat(tea): pestaña Histórico, colores por edad en EEG y acordeón en Seguimiento

- Evolución pasa a llamarse Histórico y añade «Periodos a mostrar»: los
  últimos 5, 10, 15... meses o semestres, según el intervalo elegido.
- M21 y M22 usan un color por grupo de edad, sin verde ni rojo, también en
  sus líneas de Histórico.
- Se quita el selector «Representación gráfica».
- Todas las filas de Seguimiento de TEA se despliegan en su lugar; se quita
  la ventana propia de los pacientes impares.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-04 22:41:05 -06:00
parent 078db53ae4
commit 09b52e6b0a
19 changed files with 149 additions and 207 deletions
@@ -6,7 +6,6 @@ import { catchError, defer, map, of, Subject, switchMap } from 'rxjs';
import { CacuSeguimientoService, validSeguimientoQuery } from './cacu-seguimiento.service';
import { latestStudy, SeguimientoPaciente, SeguimientoQuery, SeguimientoResponse, SeguimientoStatus } from './cacu-seguimiento.models';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { PacienteDetalleComponent } from './paciente-detalle/paciente-detalle';
import { PacienteDetalleState } from './paciente-detalle/paciente-detalle.state';
import { Dominio } from './indicadores.models';
@@ -16,7 +15,7 @@ import { TeaPacienteResumen } from './tea-paciente-resumen';
@Component({
selector: 'app-indicadores-tracking',
imports: [FormsModule, MatButtonModule, MatIconModule, PacienteDetalleComponent, TeaPacienteResumen],
imports: [FormsModule, MatButtonModule, PacienteDetalleComponent, TeaPacienteResumen],
providers: [PacienteDetalleState],
templateUrl: './indicadores-tracking.html',
styleUrl: './indicadores-tracking.scss',
@@ -44,8 +43,6 @@ export class IndicadoresTracking implements OnChanges {
teaData?: TeaSeguimientoResponse;
// One open summary at a time, like an accordion.
teaAbierto?: string;
// Patient shown in its own window, like CaCu's patient page.
teaFicha?: TeaSeguimientoPaciente;
statuses: SeguimientoStatus[] = [];
private metadataLoaded = false;
categories: Record<string, { etiqueta: string; color?: string | null }> = {};
@@ -92,8 +89,7 @@ export class IndicadoresTracking implements OnChanges {
ngOnChanges() {
if (this.previousDomain !== this.dominio) {
if (this.pacienteDetalle.estado().tipo !== 'cerrado') this.fichaPacienteAbierta.emit(false);
if (this.teaFicha) this.fichaPacienteAbierta.emit(false);
this.pacienteDetalle.cerrar(); this.controlPaciente = undefined; this.teaFicha = undefined;
this.pacienteDetalle.cerrar(); this.controlPaciente = undefined;
this.previousDomain = this.dominio; this.requests.next(null); this.teaRequests.next(null); this.data = undefined; this.teaData = undefined;
this.status = 'idle'; this.statuses = []; this.initialized = false; this.draft = { meses: 3, page: 1, page_size: 50 }; this.applied = { ...this.draft };
}
@@ -131,25 +127,6 @@ export class IndicadoresTracking implements OnChanges {
if (evento.currentTarget instanceof HTMLTableRowElement && evento.target instanceof HTMLElement && evento.target.closest('button, a, input, select, textarea')) return;
this.teaAbierto = this.teaAbierto === id ? undefined : id;
}
// Mock: to show both ideas side by side, odd-numbered patients open their own window and
// even-numbered ones expand in place.
teaVentana(item: TeaSeguimientoPaciente) { return Number(item.id_seudonimo.replace(/\D/g, '')) % 2 === 1; }
abrirTea(item: TeaSeguimientoPaciente, evento: Event) {
evento.stopPropagation();
if (!this.teaVentana(item)) { this.alternarTea(item.id_seudonimo, evento); return; }
if (evento.currentTarget instanceof HTMLTableRowElement && evento.target instanceof HTMLElement
&& evento.target.closest('button, a, input, select, textarea')) return;
this.controlPaciente = evento.currentTarget instanceof HTMLElement ? evento.currentTarget : undefined;
this.teaAbierto = undefined; this.teaFicha = item;
this.fichaPacienteAbierta.emit(true);
afterNextRender(() => document.getElementById('tea-ficha-titulo')?.focus(), { injector: this.injector });
}
cerrarTea() {
this.teaFicha = undefined;
this.fichaPacienteAbierta.emit(false);
const control = this.controlPaciente;
afterNextRender(() => { if (control?.isConnected) control.focus({ preventScroll: true }); }, { injector: this.injector });
}
volverASeguimiento() {
this.pacienteDetalle.cerrar();
this.fichaPacienteAbierta.emit(false);