Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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<any[]>;
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;
Expand Down Expand Up @@ -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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Se le puede agregar al acento? por favor

},
{
key: 'col-4',
label: 'Profesional'
}
];

public max = 10;
Expand Down Expand Up @@ -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))];
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<plex-layout *ngIf="!showTurnos" main="{{itemSelected ? '8' : '12'}}" [min]="4" [max]="5" [steps]="2">
<plex-layout *ngIf="!showTurnos" [main]="itemSelected ? 8 : 12">
<plex-layout-main>
<plex-title main titulo="Demanda insatisfecha">
<plex-button label="volver" type="danger" size="sm" position="left" routerLink='/inicio'></plex-button>
Expand All @@ -10,7 +10,7 @@
</plex-text>
<plex-select [(ngModel)]="selectorPrestacion" name="prestacion"
(change)="actualizarFiltros($event,'prestacion')" label="Prestación" tmPrestaciones
preload="true" tipo="nominalizadas" [multiple]="true">
[preload]="true" tipo="nominalizadas" [multiple]="true">
</plex-select>
<plex-datetime type="date" [(ngModel)]="selectorFechaDesde" name="fechaDesde" label="Desde"
class="fechas" [max]="filtros.fechaHasta"
Expand Down Expand Up @@ -96,6 +96,11 @@
<td *plTableCol="'col-3'">
<span><small>{{ demanda.organizacion.nombre }}</small></span>
</td>
<td *plTableCol="'col-4'">
<span *ngIf="demanda.profesional"><small>{{ demanda.profesional.apellido + ' ' +
demanda.profesional.nombre }}</small></span>
<span *ngIf="!demanda.profesional"><small>SIN PROFESIONAL</small></span>
</td>
</tr>
</plex-table>
</ng-container>
Expand All @@ -122,15 +127,15 @@
</plex-title>
<ng-container>
<form #formLlamados="ngForm" *ngIf="verFormularioLlamado">
<plex-wrapper justify>
<plex-wrapper>
<plex-select grow="full" label="Seleccione una opción"
[(ngModel)]="selectorEstadoLlamado" name="estadoLlamado"
[data]="estadosLlamado" [required]="true"
(change)="seleccionarEstadoLlamado()">
</plex-select>
<plex-text *ngIf="selectorEstadoLlamado?.id === 'otro'" grow="full" columns="6"
label="Ingrese comentario" [(ngModel)]="nuevoLlamado.comentario" name="nota"
multiline=true required="true">
[multiline]="true" [required]="true">
</plex-text>
</plex-wrapper>
</form>
Expand Down
14 changes: 12 additions & 2 deletions src/app/interfaces/turnos/IListaEspera.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { IPaciente } from 'src/app/core/mpi/interfaces/IPaciente';

export interface IDemanda {
profesional: {
id: String;
Expand All @@ -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;
Expand All @@ -45,4 +51,8 @@ export interface IListaEspera {
export interface ILlamado {
estado?: string;
comentario?: string;
createdAt?: Date;
createdBy?: {
nombreCompleto?: string;
};
}
7 changes: 7 additions & 0 deletions src/app/interfaces/turnos/ITurno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ export interface ITurno {
};
notificar: boolean;
}

export interface IHistorialTurno extends ITurno {
organizacion: {
id?: string;
nombre: string;
};
}
Loading