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
11 changes: 10 additions & 1 deletion src/app/components/top/pipes/botones.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export class BotonesSolicitudPipe implements PipeTransform {
verHuds: false,
devolverDeshacer: false,
cancelar: false,
comunicacionPaciente: false
comunicacionPaciente: false,
resolver: false,
deshacerResolver: false
};
if (prestacion?.paciente) {
if (prestacion.estadoActual.tipo === 'asignada') {
Expand All @@ -37,12 +39,18 @@ export class BotonesSolicitudPipe implements PipeTransform {
if (prestacion.estadoActual.tipo === 'rechazada') {
botones.referir = true;
}
if (prestacion.estadoActual.tipo === 'resuelta') {
if (this.esEfectorDestino(prestacion)) {
botones.deshacerResolver = true;
}
}
if (!prestacion.solicitud.turno) {
if (prestacion.estadoActual.tipo === 'pendiente') {
if (this.esEfectorDestino(prestacion)) {
botones.darTurno = true;
botones.anular = true;
botones.volverAuditoria = true;
botones.resolver = true;
}
if (prestacion.solicitud.historial.length) {
botones.comunicacionPaciente = true;
Expand All @@ -55,6 +63,7 @@ export class BotonesSolicitudPipe implements PipeTransform {
if ((this.esEfectorDestino(prestacion) && prestacion.estadoActual.tipo === 'auditoria')) {
botones.anular = true;
botones.auditar = true;
botones.resolver = true;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/top/pipes/estado-prestacion.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export class EstadoPrestacionPipe implements PipeTransform {
'turnoDado': 'success',
'validada': 'success',
'anulada': 'danger',
'vencida': 'danger'
'vencida': 'danger',
'resuelta': 'success'
};

return badge[prestacion.estadoActual.tipo];
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/top/pipes/estado-solicitud.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export class EstadoSolicitudPipe implements PipeTransform {
if (prestacion.estadoActual.tipo === 'rechazada') {
return 'rechazada';
}
if (prestacion.estadoActual.tipo === 'resuelta') {
return 'resuelta';
}

}
}
66 changes: 63 additions & 3 deletions src/app/components/top/solicitudes/solicitudes.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class SolicitudesComponent implements OnInit {
@HostBinding('class.plex-layout') layout = true;
@ViewChild('modalDevolver', { static: true }) modalDevolver: PlexModalComponent;
@ViewChild('modalIniciar', { static: true }) modalIniciar: PlexModalComponent;
@ViewChild('modalResolver', { static: true }) modalResolver: PlexModalComponent;
@ViewChild('helpIniciar', { static: false }) helpIniciar: PlexHelpComponent;
@ViewChild('helpAnular', { static: false }) helpAnular: PlexHelpComponent;
@ViewChild('helpCitar', { static: false }) helpCitar: PlexHelpComponent;
Expand Down Expand Up @@ -76,14 +77,22 @@ export class SolicitudesComponent implements OnInit {
{ id: 'turnoDado', nombre: 'TURNO DADO' },
{ id: 'registroHUDS', nombre: 'REGISTRO EN HUDS' },
{ id: 'anulada', nombre: 'ANULADA' },
{ id: 'vencida', nombre: 'VENCIDA' }
{ id: 'vencida', nombre: 'VENCIDA' },
{ id: 'resuelta', nombre: 'RESUELTA' }
];

public prioridad;
public prioridades = [
{ id: 'prioritario', nombre: 'PRIORITARIO' },
];
prestacionSeleccionada: any;
public prestacionSeleccionada: any;
public motivosResolucion = [
{ id: 'turno_en_efector', nombre: 'Con turno programado en el efector' },
{ id: 'turno_otro_efector', nombre: 'Con turno programado en otro efector' },
{ id: 'no_requiere', nombre: 'Ya no requiere turno' },
{ id: 'fallecido', nombre: 'Paciente fallecido' }
];
public motivoResolucionSeleccionado: any;
public showModalMotivo = false;
public motivoVerContinuarPrestacion = 'Continuidad del cuidado del paciente';
public routeToParams = [];
Expand Down Expand Up @@ -367,6 +376,50 @@ export class SolicitudesComponent implements OnInit {
this.observacionesAnular = '';
}
}

onResolver() {
if (this.prestacionSeleccionada.estados?.length && this.motivoResolucionSeleccionado) {
const patch = {
op: 'estadoPush',
estado: {
tipo: 'resuelta',
observaciones: this.motivoResolucionSeleccionado.nombre
}
};
this.servicioPrestacion.patch(this.prestacionSeleccionada.id, patch).subscribe(
() => {
this.cargarSolicitudes();
this.plex.toast('success', 'Solicitud resuelta exitosamente');
}
);
this.hideModal('resolver');
this.closeSidebar();
}
}

onDeshacerResolver() {
this.closeSidebar();
let estadoPrevio = 'pendiente';
if (this.prestacionSeleccionada.estados?.length > 1) {
const prev = this.prestacionSeleccionada.estados[this.prestacionSeleccionada.estados.length - 2];
estadoPrevio = prev.tipo;
}

const patch = {
op: 'estadoPush',
estado: {
tipo: estadoPrevio,
observaciones: 'Reversión de estado resuelto'
}
};
this.servicioPrestacion.patch(this.prestacionSeleccionada.id, patch).subscribe(
() => {
this.cargarSolicitudes();
this.plex.toast('success', 'Se deshizo la resolución de la solicitud');
}
);
}

citar() {
if (this.prestacionSeleccionada.estados?.length) {
const patch = {
Expand Down Expand Up @@ -437,7 +490,8 @@ export class SolicitudesComponent implements OnInit {
'validada',
'ejecucion',
'asignada',
'referir'
'referir',
'resuelta'
]
};
if (this.tipoSolicitud === 'entrada') {
Expand Down Expand Up @@ -949,6 +1003,8 @@ export class SolicitudesComponent implements OnInit {
break;
case 'devolver': this.modalDevolver.showed = true;
break;
case 'resolver': this.modalResolver.showed = true;
break;
}
}

Expand All @@ -961,6 +1017,10 @@ export class SolicitudesComponent implements OnInit {
this.modalDevolver.showed = false;
this.motivoRespuesta = '';
break;
case 'resolver':
this.modalResolver.showed = false;
this.motivoResolucionSeleccionado = null;
break;
}
}

Expand Down
Loading