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 @@ -65,7 +65,10 @@ export class SeleccionarFinanciadorComponent implements OnChanges {
private resetComponentState() {
this.showSelector = false;
this.showListado = false;
this.datosFinanciadores = [];
this.financiadorSeleccionado = undefined;
this.otroFinanciadorSeleccionado = undefined;
this.busquedaFinanciador = undefined;
}

private cargarDatosModoEditable() {
Expand All @@ -91,9 +94,8 @@ export class SeleccionarFinanciadorComponent implements OnChanges {
if (!paciente) {
return;
} else {
this.financiadoresPaciente = paciente.financiador;
this.financiadoresPaciente = paciente.financiador || [];
}

this.showSelector = true;

if (this.financiadoresPaciente?.length) {
Expand All @@ -108,7 +110,7 @@ export class SeleccionarFinanciadorComponent implements OnChanges {
}

if (!financiadorParaSeleccion) {
financiadorParaSeleccion = this.paciente.obraSocial ? this.paciente.obraSocial : this.financiadoresPaciente[0];
financiadorParaSeleccion = paciente.obraSocial ? paciente.obraSocial : this.financiadoresPaciente[0];
}

const { financiador, nombre, numeroAfiliado } = financiadorParaSeleccion;
Expand All @@ -126,15 +128,14 @@ export class SeleccionarFinanciadorComponent implements OnChanges {
];

} else {
this.financiadorSeleccionado = this.paciente.obraSocial
? this.paciente.obraSocial.nombre
this.financiadorSeleccionado = paciente.obraSocial
? paciente.obraSocial.nombre
: undefined;

this.numeroAfiliado = this.paciente.obraSocial
? this.paciente.obraSocial.numeroAfiliado
this.numeroAfiliado = paciente.obraSocial
? paciente.obraSocial.numeroAfiliado
: '';
}

this.guardarFinanciador();
}

Expand Down Expand Up @@ -170,6 +171,7 @@ export class SeleccionarFinanciadorComponent implements OnChanges {
if (nombreSeleccionado === 'otras') {
this.showListado = true;
this.busquedaFinanciador = undefined;
this.otroFinanciadorSeleccionado = null;
} else {
const nombre = event.value;

Expand All @@ -182,6 +184,11 @@ export class SeleccionarFinanciadorComponent implements OnChanges {
}

public guardarFinanciador() {
if (!this.busquedaFinanciador) {
this.setFinanciador.emit(undefined);
return;
}

if (this.busquedaFinanciador) {
this.busquedaFinanciador.numeroAfiliado = this.numeroAfiliado;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Auth } from '@andes/auth';
import { Plex } from '@andes/plex';
Expand Down Expand Up @@ -26,8 +26,6 @@ import { Unsubscribe } from '@andes/shared';
export class RevisionAgendaComponent implements OnInit, OnDestroy {
private lastRequest: Subscription;
private _agenda: any;
private estadoPendienteAuditoria;
private estadoCodificado;
public agenda: any;
public cantidadTurnosAsignados: number;
public indiceReparo: any;
Expand All @@ -52,6 +50,9 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
public loading = false;
public pacienteDetalle;
public prestacionAuditable;
public financiador;
public showSidebar = false;
public numeroAfiliado;

constructor(
private pacienteCache: PacienteCacheService,
Expand Down Expand Up @@ -133,12 +134,16 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
this.turnoSeleccionado.paciente = pacienteTurno;
this.turnoSeleccionado.estado = estado;
}
if (this.financiador) {
this.turnoSeleccionado.paciente.obraSocial = this.financiador;
}
}

seleccionarTurno(turno, bloque) {
if (this.lastRequest) {
this.lastRequest.unsubscribe();
}
this.showSidebar = (this.turnoSeleccionado !== turno) ? true : false;
this.pacienteDetalle = null;
this.existeCodificacionProfesional = false;
this.diagnosticos = [];
Expand Down Expand Up @@ -173,7 +178,9 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
if (this.turnoSeleccionado && this.turnoSeleccionado.asistencia) {
this.turnoSeleccionado.asistencia = asistencia.id;
}
this.onSave();
if (this.turnoTipoPrestacion) {
this.turnoSeleccionado.tipoPrestacion = this.turnoTipoPrestacion;
}
}

asistenciaSeleccionada(asistencia) {
Expand All @@ -199,7 +206,6 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
};
nuevoDiagnostico.codificacionAuditoria = diagnostico;
this.diagnosticos.push(nuevoDiagnostico);
this.onSave();
}

borrarDiagnostico(index) {
Expand All @@ -211,7 +217,6 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
if (index === 0) {
this.plex.toast('warning', 'Información', 'El diagnostico principal fue eliminado');
}
this.onSave();
}

aprobar(index) {
Expand All @@ -222,7 +227,6 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
this.diagnosticos[j].codificacionAuditoria = this.diagnosticos[j].codificacionProfesional.cie10;
}
}
this.onSave();
}
/**
* Verifica si cada turno tiene la asistencia verificada y modifica el estado de la agenda.
Expand Down Expand Up @@ -285,12 +289,14 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
};
label = 'Pendiente Asistencia';
} else {
// Solo modificamos el turno, no la agenda por completo. Ej: la obra social.
this.plex.toast('success', 'El turno de la agenda fue actualizado');
patchear = false;
}
}
}
if (patchear) {
this.serviceAgenda.patch(this._agenda.id, patch).subscribe(resultado => {
this.serviceAgenda.patch(this._agenda.id, patch).subscribe(() => {
this.plex.toast('success', 'El estado de la agenda fue actualizado', label);
});
}
Expand Down Expand Up @@ -322,14 +328,18 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
return turno?.asistencia && turno?.asistencia === 'asistio' && !turno?.diagnostico?.codificaciones[0]?.codificacionAuditoria?.codigo && !turno?.diagnostico?.codificaciones[0]?.codificacionProfesional?.snomed?.term && turno.tipoPrestacion?.auditable === true;
}

cancelar() {
guardar() {
this.onSave();
this.showSidebar = false;
this.turnoSeleccionado = null;
}

onSave() {
// Se guarda el turno seleccionado
if (this.paciente) {
this.asignarPaciente(this.paciente);
} else {
this.turnoSeleccionado.paciente.obraSocial = this.financiador;
}
if (this.turnoTipoPrestacion) {
this.turnoSeleccionado.tipoPrestacion = this.turnoTipoPrestacion;
Expand All @@ -355,9 +365,8 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
turno: this.turnoSeleccionado
};
}

if (this.turnoSeleccionado.tipoPrestacion) {
this.serviceTurno.put(datosTurno).subscribe(resultado => {
this.serviceTurno.put(datosTurno).subscribe(() => {
this.cerrarAsistencia();
});
} else {
Expand Down Expand Up @@ -404,18 +413,11 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
this.diagnosticos[this.indiceReparo].codificacionAuditoria = reparo;
this.showReparo = false;
}
this.onSave();
}

borrarReparo(index) {
this.diagnosticos[index].codificacionAuditoria = null;
this.showReparo = false;
this.onSave();
}

volverRevision() {
this.refresh();
this.cerrarAsistencia();
}

// -------------- SOBRE BUSCADOR PACIENTES ----------------
Expand Down Expand Up @@ -446,6 +448,16 @@ export class RevisionAgendaComponent implements OnInit, OnDestroy {
this.paciente = null;
}

public setFinanciador(financiador) {
this.financiador = financiador;
}

cerrar() {
this.showSidebar = false;
this.showRegistrosTurno = false;
this.turnoSeleccionado = null;
}

// ----------------------------------

// Componente paciente-listado
Expand Down
Loading
Loading