From ca28e687b0a2ba186353f646bcd1145b75472f2b Mon Sep 17 00:00:00 2001 From: MarianoCampetella Date: Wed, 10 Jun 2026 15:47:27 -0300 Subject: [PATCH] Agregar profesional en modulo demanda insatisfecha --- .../demanda-insatisfecha.component.ts | 29 +++++++++++-------- .../demanda-insatisfecha.html | 13 ++++++--- src/app/interfaces/turnos/IListaEspera.ts | 14 +++++++-- src/app/interfaces/turnos/ITurno.ts | 7 +++++ 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/src/app/components/demandaInsatisfecha/demanda-insatisfecha.component.ts b/src/app/components/demandaInsatisfecha/demanda-insatisfecha.component.ts index b011184180..e4107d2650 100644 --- a/src/app/components/demandaInsatisfecha/demanda-insatisfecha.component.ts +++ b/src/app/components/demandaInsatisfecha/demanda-insatisfecha.component.ts @@ -5,7 +5,8 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { NgForm } from '@angular/forms'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { ILlamado } from 'src/app/interfaces/turnos/IListaEspera'; +import { IHistorialTurno } from 'src/app/interfaces/turnos/ITurno'; +import { IDemanda, ILlamado, IListaEspera } from 'src/app/interfaces/turnos/IListaEspera'; import { ListaEsperaService } from 'src/app/services/turnos/listaEspera.service'; import { TurnoService } from 'src/app/services/turnos/turno.service'; @@ -16,12 +17,12 @@ import { TurnoService } from 'src/app/services/turnos/turno.service'; export class DemandaInsatisfechaComponent implements OnInit { public listaOrganizaciones = []; - public listaEspera = []; + public listaEspera: IListaEspera[] = []; public listado$: Observable; - public listaLlamados = []; - public listaHistorial = []; - public listaDemandas = []; - public itemSelected = null; + public listaLlamados: ILlamado[] = []; + public listaHistorial: IHistorialTurno[] = []; + public listaDemandas: IDemanda[] = []; + public itemSelected: IListaEspera | null = null; public filtros: any = {}; public selectorPrestacion; public selectorOrganizacion; @@ -103,16 +104,20 @@ export class DemandaInsatisfechaComponent implements OnInit { public columnsDemandas = [ { key: 'col-1', - label: 'Fecha', + label: 'Fecha' }, { key: 'col-2', - label: 'Motivo', + label: 'Motivo' }, { key: 'col-3', - label: 'Organizacion', + label: 'Organizacion' }, + { + key: 'col-4', + label: 'Profesional' + } ]; public max = 10; @@ -145,7 +150,7 @@ export class DemandaInsatisfechaComponent implements OnInit { private getListaEsperas(filtros) { if (filtros.fechaDesde && filtros.organizacion) { - this.listaEsperaService.get({ ...filtros, estado: 'pendiente' }).subscribe((listaEspera: any[]) => { + this.listaEsperaService.get({ ...filtros, estado: 'pendiente' }).subscribe((listaEspera: IListaEspera[]) => { this.listaEspera = listaEspera; this.listaEspera.forEach(item => { item.motivos = [...new Set(item.demandas.map(({ motivo }) => motivo))]; @@ -173,7 +178,7 @@ export class DemandaInsatisfechaComponent implements OnInit { this.tabIndex = value; } - public seleccionarDemanda(item) { + public seleccionarDemanda(item: IListaEspera) { this.itemSelected = item; this.listaDemandas = item.demandas.slice(0, this.max); this.listaHistorial = []; @@ -245,7 +250,7 @@ export class DemandaInsatisfechaComponent implements OnInit { this.formLlamados.control.markAllAsTouched(); if (this.formLlamados.form.valid) { - this.listaLlamados.push({ ...this.nuevoLlamado, createdBy: this.auth.usuario, createdAt: moment() }); + this.listaLlamados.push({ ...this.nuevoLlamado, createdBy: this.auth.usuario, createdAt: moment().toDate() }); this.listaEsperaService.patch(id, 'llamados', this.listaLlamados).subscribe({ next: (item) => { diff --git a/src/app/components/demandaInsatisfecha/demanda-insatisfecha.html b/src/app/components/demandaInsatisfecha/demanda-insatisfecha.html index f56f76df70..b8115f2741 100644 --- a/src/app/components/demandaInsatisfecha/demanda-insatisfecha.html +++ b/src/app/components/demandaInsatisfecha/demanda-insatisfecha.html @@ -1,4 +1,4 @@ - + @@ -10,7 +10,7 @@ + [preload]="true" tipo="nominalizadas" [multiple]="true"> {{ demanda.organizacion.nombre }} + + {{ demanda.profesional.apellido + ' ' + + demanda.profesional.nombre }} + SIN PROFESIONAL + @@ -122,7 +127,7 @@
- + + [multiline]="true" [required]="true"> diff --git a/src/app/interfaces/turnos/IListaEspera.ts b/src/app/interfaces/turnos/IListaEspera.ts index a49717e242..39e452472e 100644 --- a/src/app/interfaces/turnos/IListaEspera.ts +++ b/src/app/interfaces/turnos/IListaEspera.ts @@ -1,3 +1,5 @@ +import { IPaciente } from 'src/app/core/mpi/interfaces/IPaciente'; + export interface IDemanda { profesional: { id: String; @@ -13,14 +15,18 @@ export interface IDemanda { origen: String; }; +export type IPacienteListaEspera = IPaciente & { _id?: string }; + export interface IListaEspera { + _id?: string; id?: String; - paciente: { id: string }; + paciente: IPacienteListaEspera; tipoPrestacion: any; fecha: Date; vencimiento?: Date; estado: String; - demandas: [IDemanda]; + motivos?: String[]; + demandas: IDemanda[]; resolucion: { fecha: Date; motivo: String; @@ -45,4 +51,8 @@ export interface IListaEspera { export interface ILlamado { estado?: string; comentario?: string; + createdAt?: Date; + createdBy?: { + nombreCompleto?: string; + }; } diff --git a/src/app/interfaces/turnos/ITurno.ts b/src/app/interfaces/turnos/ITurno.ts index 180f06498f..16aa5f021e 100644 --- a/src/app/interfaces/turnos/ITurno.ts +++ b/src/app/interfaces/turnos/ITurno.ts @@ -57,3 +57,10 @@ export interface ITurno { }; notificar: boolean; } + +export interface IHistorialTurno extends ITurno { + organizacion: { + id?: string; + nombre: string; + }; +}