diff --git a/projects/auth/src/lib/auth.service.ts b/projects/auth/src/lib/auth.service.ts index 28dcbe297c..f281859648 100644 --- a/projects/auth/src/lib/auth.service.ts +++ b/projects/auth/src/lib/auth.service.ts @@ -16,6 +16,13 @@ interface IUsuario { documento: string; nombreCompleto: string; username: number; + pacienteRestringido?: { + idPaciente: string; + archivos: string[]; + observaciones: string; + createdBy: any; + createdAt: Date; + }[]; } export enum Estado { inProgress, active, logout } @@ -48,6 +55,7 @@ export class Auth { private arrayFiltros: any[]; public mobileUser: any; private feature: { [key: string]: boolean }; + public pacienteRestringido; constructor(private server: Server) { @@ -63,6 +71,7 @@ export class Auth { this.permisos = payload.permisos; this.feature = payload.feature; this.estado = Estado.active; + this.pacienteRestringido = payload.pacienteRestringido; this.initShiro(); }), publishReplay(1), diff --git a/projects/shared/src/lib/shared.module.ts b/projects/shared/src/lib/shared.module.ts index 709caeea6e..fbf9b0611d 100644 --- a/projects/shared/src/lib/shared.module.ts +++ b/projects/shared/src/lib/shared.module.ts @@ -17,6 +17,7 @@ import { PopoverAuditComponent } from './components/popover-audit/popover-audit. import { GaleriaArchivosComponent } from './components/galeria-archivos/galeria-archivos.component'; import { FormsModule } from '@angular/forms'; import { DocumentoPipe } from './pipes/documento.pipe'; +import { PacienteRestringidoPipe } from 'src/app/pipes/pacienteRestringido.pipe'; @NgModule({ imports: [ @@ -38,7 +39,8 @@ import { DocumentoPipe } from './pipes/documento.pipe'; PopoverAuditComponent, GaleriaArchivosComponent, UploadFileComponent, - NotasComponent + NotasComponent, + PacienteRestringidoPipe ], exports: [ FechaPipe, @@ -54,8 +56,12 @@ import { DocumentoPipe } from './pipes/documento.pipe'; PopoverAuditComponent, GaleriaArchivosComponent, UploadFileComponent, - NotasComponent - ] + NotasComponent, + PacienteRestringidoPipe + ], + providers: [ + PacienteRestringidoPipe + ], }) export class SharedModule { static forRoot(host: string): ModuleWithProviders { diff --git a/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/cama-detalle.component.html b/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/cama-detalle.component.html index d4cd19ddf7..269b65aa8d 100644 --- a/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/cama-detalle.component.html +++ b/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/cama-detalle.component.html @@ -6,7 +6,7 @@ + size="sm" (click)="accion(relacion)" class="mr-1"> - - - - - - - - - + + - - - NUEVO REGISTRO + - - - - + + + + - - + + + + NUEVO REGISTRO + + + + + + + + +
+ [accesoHuds]="!(cama.paciente | pacienteRestringido)"> Respirador @@ -135,7 +137,7 @@ - + diff --git a/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/internacion-detalle/internacion-detalle.component.html b/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/internacion-detalle/internacion-detalle.component.html index 40c714bec8..9759a2bd45 100644 --- a/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/internacion-detalle/internacion-detalle.component.html +++ b/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/internacion-detalle/internacion-detalle.component.html @@ -65,8 +65,14 @@ egreso. - - + + + No tiene permiso para ingresar a este paciente. + + + \ No newline at end of file diff --git a/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/internacion-detalle/internacion-detalle.component.ts b/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/internacion-detalle/internacion-detalle.component.ts index 93263342fc..07a92cd739 100644 --- a/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/internacion-detalle/internacion-detalle.component.ts +++ b/src/app/apps/rup/mapa-camas/sidebar/cama-detalle/internacion-detalle/internacion-detalle.component.ts @@ -24,7 +24,7 @@ export class InternacionDetalleComponent implements OnInit, AfterViewChecked { public existeEgreso; view$ = this.mapaCamasService.view; - @Input() cama; + @Input() paciente; @Output() cambiarCama = new EventEmitter(); @Output() accion = new EventEmitter(); @ContentChild(PlexOptionsComponent, { static: true }) plexOptions: PlexOptionsComponent; @@ -233,5 +233,4 @@ export class InternacionDetalleComponent implements OnInit, AfterViewChecked { puedeEditarEgreso() { return (this.permisosMapaCamasService.egreso && this.estadoPrestacion !== 'validada' && this.existeEgreso); } - } diff --git a/src/app/components/buscadorTurnosPrestaciones/turnos-prestaciones.component.ts b/src/app/components/buscadorTurnosPrestaciones/turnos-prestaciones.component.ts index 365755fc04..9279dbb138 100644 --- a/src/app/components/buscadorTurnosPrestaciones/turnos-prestaciones.component.ts +++ b/src/app/components/buscadorTurnosPrestaciones/turnos-prestaciones.component.ts @@ -5,7 +5,6 @@ import { Router } from '@angular/router'; import { BehaviorSubject, Observable, Subject, combineLatest, of } from 'rxjs'; import { map, takeUntil, tap } from 'rxjs/operators'; import { PacienteService } from 'src/app/core/mpi/services/paciente.service'; -import { IFinanciador } from 'src/app/interfaces/IFinanciador'; import { HUDSService } from '../../modules/rup/services/huds.service'; import { ExportHudsService } from '../../modules/visualizacion-informacion/services/export-huds.service'; import { ObraSocialService } from '../../services/obraSocial.service'; @@ -13,6 +12,9 @@ import { ProfesionalService } from '../../services/profesional.service'; import { FacturacionAutomaticaService } from './../../services/facturacionAutomatica.service'; import { TurnosPrestacionesService } from './services/turnos-prestaciones.service'; import { cache } from '@andes/shared'; +import { IFinanciador } from 'src/app/interfaces/IFinanciador'; +import { IPaciente } from 'src/app/core/mpi/interfaces/IPaciente'; +import { PacienteRestringidoPipe } from 'src/app/pipes/pacienteRestringido.pipe'; @Component({ selector: 'turnos-prestaciones', @@ -98,6 +100,7 @@ export class TurnosPrestacionesComponent implements OnInit, OnDestroy { private exportHudsService: ExportHudsService, public obraSocialService: ObraSocialService, private pacienteService: PacienteService, + private pacienteRestringido: PacienteRestringidoPipe ) { } @@ -158,10 +161,8 @@ export class TurnosPrestacionesComponent implements OnInit, OnDestroy { this.busqueda$ = this.turnosPrestacionesService.prestacionesOrdenada$.pipe( - map(prestaciones => { - this.loader = false; - return prestaciones; - }), // Ocultar el loader cuando los datos estén disponibles + tap(() => this.loader = false), // Ocultar el loader cuando los datos estén disponibles + map((items) => items.filter(({ paciente }) => !this.esPacienteRestringido(paciente), {})), takeUntil(this.onDestroy$), cache() ); @@ -467,4 +468,8 @@ export class TurnosPrestacionesComponent implements OnInit, OnDestroy { generarComprobante() { return this.prestacionIniciada && this.puedeEmitirComprobante && this.financiador && ((!this.prestacion.estadoFacturacion) || this.prestacion.estadoFacturacion?.estado !== 'Comprobante con prestacion'); } + + esPacienteRestringido(paciente: IPaciente) { + return this.pacienteRestringido.transform(paciente); + } } diff --git a/src/app/components/top/solicitudes/solicitudes.component.ts b/src/app/components/top/solicitudes/solicitudes.component.ts index c29c7cc355..56a0722761 100644 --- a/src/app/components/top/solicitudes/solicitudes.component.ts +++ b/src/app/components/top/solicitudes/solicitudes.component.ts @@ -4,7 +4,7 @@ import { PlexModalComponent } from '@andes/plex/src/lib/modal/modal.component'; import { Unsubscribe } from '@andes/shared'; import { Component, ElementRef, HostBinding, Input, OnInit, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; -import { catchError, concatWith } from 'rxjs'; +import { catchError, concatWith, map } from 'rxjs'; import { PacienteService } from 'src/app/core/mpi/services/paciente.service'; import { RouterService } from 'src/app/services/router.service'; import { HUDSService } from '../../../modules/rup/services/huds.service'; @@ -12,6 +12,9 @@ import { PrestacionesService } from '../../../modules/rup/services/prestaciones. import { TurnoService } from '../../../services/turnos/turno.service'; import { PlexHelpComponent } from '@andes/plex/src/lib/help/help.component'; import { Location } from '@angular/common'; +import { IPaciente } from 'src/app/core/mpi/interfaces/IPaciente'; +import { IPrestacion } from 'src/app/interfaces/turnos/IPrestacion'; +import { PacienteRestringidoPipe } from 'src/app/pipes/pacienteRestringido.pipe'; @Component({ selector: 'solicitudes', @@ -160,7 +163,8 @@ export class SolicitudesComponent implements OnInit { private hudsService: HUDSService, private pacienteService: PacienteService, private routerService: RouterService, - private location: Location + private location: Location, + private pacienteRestringido: PacienteRestringidoPipe ) { } @@ -531,22 +535,28 @@ export class SolicitudesComponent implements OnInit { } } + esPacienteRestringido(paciente) { + return this.pacienteRestringido.transform(paciente); + } + @Unsubscribe() buscarSolicitudes() { - return this.servicioPrestacion.getSolicitudes(this.getParams()).subscribe(resultado => { - if (this.tipoSolicitud === 'entrada') { - this.prestacionesEntrada = this.prestacionesEntrada.concat(resultado); - this.skip = this.prestacionesEntrada.length; - } else if (this.tipoSolicitud === 'salida') { - this.prestacionesSalida = this.prestacionesSalida.concat(resultado); - this.skip = this.prestacionesSalida.length; - } - // si vienen menos solicitudes que la cantidad límite significa que ya se cargaron todas - if (!resultado.length || resultado.length < this.limit) { - this.scrollEnd = true; - } - this.loader = false; - }); + return this.servicioPrestacion.getSolicitudes(this.getParams()) + .pipe(map((resultado) => resultado.filter((solicitud) => !this.esPacienteRestringido(solicitud.paciente)))) + .subscribe(resultado => { + if (this.tipoSolicitud === 'entrada') { + this.prestacionesEntrada = this.prestacionesEntrada.concat(resultado); + this.skip = this.prestacionesEntrada.length; + } else if (this.tipoSolicitud === 'salida') { + this.prestacionesSalida = this.prestacionesSalida.concat(resultado); + this.skip = this.prestacionesSalida.length; + } + // si vienen menos solicitudes que la cantidad límite significa que ya se cargaron todas + if (!resultado.length || resultado.length < this.limit) { + this.scrollEnd = true; + } + this.loader = false; + }); } verFechaDateTimeEntrada() { diff --git a/src/app/components/turnos/autocitar/autocitar.html b/src/app/components/turnos/autocitar/autocitar.html index 0c5d1de8a7..18996c877a 100644 --- a/src/app/components/turnos/autocitar/autocitar.html +++ b/src/app/components/turnos/autocitar/autocitar.html @@ -13,9 +13,12 @@ - No hay agendas con - turnos - disponibles para la autocitación +
+ + +
@@ -42,7 +45,7 @@
-
?
+
?
¿Desea confirmar el turno para paciente autocitado? diff --git a/src/app/components/turnos/dashboard/estadisticas-pacientes.html b/src/app/components/turnos/dashboard/estadisticas-pacientes.html index d2a938766f..4207c76d00 100644 --- a/src/app/components/turnos/dashboard/estadisticas-pacientes.html +++ b/src/app/components/turnos/dashboard/estadisticas-pacientes.html @@ -17,7 +17,7 @@ - +
  • - + diff --git a/src/app/modules/mpi/components/paciente-listado.html b/src/app/modules/mpi/components/paciente-listado.html index 3c795ba200..f275cc7d5a 100644 --- a/src/app/modules/mpi/components/paciente-listado.html +++ b/src/app/modules/mpi/components/paciente-listado.html @@ -2,11 +2,11 @@ + (click)="seleccionar(paciente)" [colors]="colorItem(i)"> + subtitulo="{{ paciente | documento }}"> + [ngClass]="{'text-success' : paciente.estado === 'validado' , 'text-warning' : paciente.estado === 'temporal'} "> {{ paciente.estado || 'S/D' }} @@ -33,12 +33,12 @@ + title="{{openBtnRelaciones(paciente)?'No ver relaciones':'Ver relaciones'}}" + (click)="verRelaciones(paciente)"> + [disabled]="paciente | pacienteRestringido" (click)="editar(paciente)"> diff --git a/src/app/modules/rup/components/ejecucion/dacion-turno/asignar-turno.ts b/src/app/modules/rup/components/ejecucion/dacion-turno/asignar-turno.ts index be5da84988..dc517e3e13 100644 --- a/src/app/modules/rup/components/ejecucion/dacion-turno/asignar-turno.ts +++ b/src/app/modules/rup/components/ejecucion/dacion-turno/asignar-turno.ts @@ -15,6 +15,7 @@ import { PacienteService } from 'src/app/core/mpi/services/paciente.service'; import { AgendaService } from 'src/app/services/turnos/agenda.service'; import { ConceptosTurneablesService } from 'src/app/services/conceptos-turneables.service'; import { PlexModalComponent } from '@andes/plex/src/lib/modal/modal.component'; +import { PacienteRestringidoPipe } from 'src/app/pipes/pacienteRestringido.pipe'; @Component({ selector: 'rup-asignar-turno', @@ -48,7 +49,8 @@ export class RupAsignarTurnoComponent implements OnInit { private obraSocialService: ObraSocialService, private pacienteService: PacienteService, private serviceAgenda: AgendaService, - private conceptosTurneablesService: ConceptosTurneablesService + private conceptosTurneablesService: ConceptosTurneablesService, + private pacienteRestringido: PacienteRestringidoPipe ) { } ngOnInit() { @@ -77,26 +79,34 @@ export class RupAsignarTurnoComponent implements OnInit { this.pacienteActivo = null; } + esPacienteRestringido(paciente: IPaciente) { + return this.pacienteRestringido.transform(paciente); + } + onPacienteSelected(paciente: IPaciente) { // Si se seleccionó por error un paciente fallecido this.pacienteService.checkFallecido(paciente); - this.pacienteActivo = paciente; this.pacientes = null; if (paciente) { - this.obraSocialPaciente = null; - if (paciente.id && paciente.documento) { - this.obraSocialService.getObrasSociales(paciente.documento).subscribe( - (resultado: IObraSocial[]) => { - if (resultado.length > 0) { - this.obraSocialPaciente = resultado[0]; - } - this.setPacienteTurno(paciente); - }, - () => { - this.setPacienteTurno(paciente); - }); + if (!this.esPacienteRestringido(paciente)) { + this.pacienteActivo = paciente; + this.obraSocialPaciente = null; + if (paciente.id && paciente.documento) { + this.obraSocialService.getObrasSociales(paciente.documento).subscribe( + (resultado: IObraSocial[]) => { + if (resultado.length > 0) { + this.obraSocialPaciente = resultado[0]; + } + this.setPacienteTurno(paciente); + }, + () => { + this.setPacienteTurno(paciente); + }); + } else { + this.setPacienteTurno(paciente); + } } else { - this.setPacienteTurno(paciente); + this.plex.info('warning', 'No tiene permisos para acceder a este paciente.'); } } else { diff --git a/src/app/modules/rup/components/ejecucion/hudsBusquedaPaciente.component.ts b/src/app/modules/rup/components/ejecucion/hudsBusquedaPaciente.component.ts index 7e9893348a..459f942fc7 100644 --- a/src/app/modules/rup/components/ejecucion/hudsBusquedaPaciente.component.ts +++ b/src/app/modules/rup/components/ejecucion/hudsBusquedaPaciente.component.ts @@ -5,6 +5,7 @@ import { Auth } from '@andes/auth'; import { IPaciente } from '../../../../core/mpi/interfaces/IPaciente'; import { HUDSService } from '../../services/huds.service'; import { Location } from '@angular/common'; +import { PacienteRestringidoPipe } from 'src/app/pipes/pacienteRestringido.pipe'; @Component({ selector: 'rup-hudsBusquedaPaciente', @@ -18,7 +19,6 @@ export class HudsBusquedaPacienteComponent implements OnInit { resultadoBusqueda = null; loading = false; routeParams: any; - // public motivoAccesoHuds; showModalMotivo = false; pacienteSelected = null; @@ -27,7 +27,8 @@ export class HudsBusquedaPacienteComponent implements OnInit { public plex: Plex, public auth: Auth, private router: Router, - private hudsService: HUDSService + private hudsService: HUDSService, + private pacienteRestringido: PacienteRestringidoPipe ) { } ngOnInit() { @@ -67,10 +68,18 @@ export class HudsBusquedaPacienteComponent implements OnInit { this.resultadoBusqueda = []; } + esPacienteRestringido(paciente: IPaciente) { + return this.pacienteRestringido.transform(paciente); + } + onSelect(paciente: IPaciente): void { if (paciente) { - this.pacienteSelected = paciente; - this.showModalMotivo = true; + if (this.esPacienteRestringido(paciente)) { + this.plex.info('warning', 'No tiene permiso para ingresar a este paciente.', 'Atención'); + } else { + this.pacienteSelected = paciente; + this.showModalMotivo = true; + } } } diff --git a/src/app/modules/rup/components/ejecucion/prestacionCrear.component.ts b/src/app/modules/rup/components/ejecucion/prestacionCrear.component.ts index cd71f441ca..9ca05c25f7 100644 --- a/src/app/modules/rup/components/ejecucion/prestacionCrear.component.ts +++ b/src/app/modules/rup/components/ejecucion/prestacionCrear.component.ts @@ -13,6 +13,7 @@ import { ObraSocialCacheService } from '../../../../services/obraSocialCache.ser import { HUDSService } from '../../services/huds.service'; import { AgendaService } from './../../../../services/turnos/agenda.service'; import { PrestacionesService } from './../../services/prestaciones.service'; +import { PacienteRestringidoPipe } from 'src/app/pipes/pacienteRestringido.pipe'; @Component({ selector: 'prestacion-crear', @@ -58,7 +59,8 @@ export class PrestacionCrearComponent implements OnInit, OnChanges { public servicioPrestacion: PrestacionesService, private osService: ObraSocialCacheService, private pacienteService: PacienteService, - private hudsService: HUDSService + private hudsService: HUDSService, + private pacienteRestringido: PacienteRestringidoPipe ) { } ngOnInit() { @@ -332,6 +334,10 @@ export class PrestacionCrearComponent implements OnInit, OnChanges { this.paciente = null; } + esPacienteRestringido(paciente: IPaciente) { + return this.pacienteRestringido.transform(paciente); + } + // ---------------------------------- // Componente paciente-listado @@ -339,11 +345,15 @@ export class PrestacionCrearComponent implements OnInit, OnChanges { onSelect(paciente: IPaciente): void { // Es un paciente existente en ANDES?? if (paciente && paciente.id) { - // Si se seleccionó por error un paciente fallecido - this.pacienteService.checkFallecido(paciente); - this.paciente = paciente; - this.resultadoBusqueda = [this.paciente]; - this.darTurnoAutocitado(); + if (!this.esPacienteRestringido(paciente)) { + // Si se seleccionó por error un paciente fallecido + this.pacienteService.checkFallecido(paciente); + this.paciente = paciente; + this.resultadoBusqueda = [this.paciente]; + this.darTurnoAutocitado(); + } else { + this.plex.info('warning', 'No tiene permisos para acceder a este paciente.'); + } } else { this.plex.info('warning', 'Paciente no encontrado', '¡Error!'); } diff --git a/src/app/modules/rup/components/ejecucion/prestacionCrear.html b/src/app/modules/rup/components/ejecucion/prestacionCrear.html index 3e8e5ca90f..56e9836ade 100644 --- a/src/app/modules/rup/components/ejecucion/prestacionCrear.html +++ b/src/app/modules/rup/components/ejecucion/prestacionCrear.html @@ -22,7 +22,7 @@ - @@ -33,8 +33,8 @@ - - + + this.routeTo(this.routeToParams[0], (this.routeToParams[1]) ? this.routeToParams[1] : null); if ((this.tieneAccesoHUDS || this.motivoVerContinuarPrestacion === motivo) && motivo) { diff --git a/src/app/modules/rup/components/ejecucion/puntoInicio.html b/src/app/modules/rup/components/ejecucion/puntoInicio.html index 2e4bde5176..b4bd53c082 100644 --- a/src/app/modules/rup/components/ejecucion/puntoInicio.html +++ b/src/app/modules/rup/components/ejecucion/puntoInicio.html @@ -168,7 +168,7 @@
    + titulo='Seleccioná una agenda' subtitulo='Podrás ver el detalle de los turnos'>
    @@ -249,18 +249,18 @@
    + }}" class="mb-1"> {{turno.prestaciones[0].estados[turno.prestaciones[0].estados.length - 1].tipo}}
    - Suspendido + Suspendido - + {{turno.asistencia === 'asistio' ? 'asistió': (turno.asistencia === 'noAsistio' ? 'No asistió' : turno.asistencia)}} @@ -323,7 +323,8 @@
- +
+ *ngIf="sobreturno?.estado === 'suspendido'" + class="mb-1"> Suspendido
+ type="{{ sobreturno.prestaciones[0].estados[sobreturno.prestaciones[0].estados.length - 1].tipo === 'validada' ? 'success' : 'warning' }}" + class="mb-1"> {{sobreturno.prestaciones[0].estados[sobreturno.prestaciones[0].estados.length-1].tipo}}
- + {{sobreturno.asistencia === 'asistio' ? 'asistió': sobreturno.asistencia}} {{ sobreturno.horaAsistencia | hora }} hs @@ -483,7 +486,9 @@
- + +
- - - - - - - - + + + + + + + + + + @@ -657,30 +664,32 @@ - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/src/app/modules/rup/components/ejecucion/puntoInicio.scss b/src/app/modules/rup/components/ejecucion/puntoInicio.scss index 8cd96c8345..c6394a8863 100644 --- a/src/app/modules/rup/components/ejecucion/puntoInicio.scss +++ b/src/app/modules/rup/components/ejecucion/puntoInicio.scss @@ -58,7 +58,6 @@ display: flex; flex-direction: column; gap: 5px; - margin-bottom: 5px; } .button-list { diff --git a/src/app/modules/rup/components/internacion/puntoInicio-internacion.html b/src/app/modules/rup/components/internacion/puntoInicio-internacion.html index a9c0d35ea1..0201c15504 100644 --- a/src/app/modules/rup/components/internacion/puntoInicio-internacion.html +++ b/src/app/modules/rup/components/internacion/puntoInicio-internacion.html @@ -20,18 +20,15 @@

-
+
Registros
- - + VER HUDS
diff --git a/src/app/modules/visualizacion-informacion/components/exportar-huds/exportar-huds.component.ts b/src/app/modules/visualizacion-informacion/components/exportar-huds/exportar-huds.component.ts index 08b3d89192..bd086a1145 100644 --- a/src/app/modules/visualizacion-informacion/components/exportar-huds/exportar-huds.component.ts +++ b/src/app/modules/visualizacion-informacion/components/exportar-huds/exportar-huds.component.ts @@ -5,6 +5,7 @@ import { ExportHudsService } from '../../services/export-huds.service'; import { Auth } from '@andes/auth'; import { Router } from '@angular/router'; import { ModalMotivoAccesoHudsService } from 'src/app/modules/rup/components/huds/modal-motivo-acceso-huds.service'; +import { PacienteRestringidoPipe } from 'src/app/pipes/pacienteRestringido.pipe'; @Component({ @@ -34,7 +35,8 @@ export class ExportarHudsComponent implements OnInit { private exportHudsService: ExportHudsService, private auth: Auth, private router: Router, - private motivoAccesoService: ModalMotivoAccesoHudsService) { } + private motivoAccesoService: ModalMotivoAccesoHudsService, + private pacienteRestringido: PacienteRestringidoPipe) { } ngOnInit(): void { if (!this.auth.check('huds:exportarHuds')) { @@ -70,19 +72,27 @@ export class ExportarHudsComponent implements OnInit { this.prestacion = null; } + esPacienteRestringido(paciente: IPaciente) { + return this.pacienteRestringido.transform(paciente); + } + onSelect(paciente: IPaciente): void { if (paciente) { - this.pacienteSelected = paciente; - this.motivoAccesoService.getAccessoHUDS(this.pacienteSelected).subscribe((motivo) => { - if (motivo) { - this.modalAccepted = true; - this.showLabel = false; - } - }, - // Si viene error, segundo callback - () => { - this.pacienteSelected = ''; - }); + if (this.esPacienteRestringido(paciente)) { + this.plex.info('warning', 'No tiene permiso para ingresar a este paciente.', 'Atención'); + } else { + this.pacienteSelected = paciente; + this.motivoAccesoService.getAccessoHUDS(this.pacienteSelected).subscribe((motivo) => { + if (motivo) { + this.modalAccepted = true; + this.showLabel = false; + } + }, + // Si viene error, segundo callback + () => { + this.pacienteSelected = ''; + }); + } } } diff --git a/src/app/pipes/pacienteRestringido.pipe.ts b/src/app/pipes/pacienteRestringido.pipe.ts new file mode 100644 index 0000000000..bb4c9e8dfd --- /dev/null +++ b/src/app/pipes/pacienteRestringido.pipe.ts @@ -0,0 +1,12 @@ +import { Auth } from '@andes/auth'; +import { Pipe, PipeTransform } from '@angular/core'; +import { IPaciente } from '../core/mpi/interfaces/IPaciente'; + +@Pipe({ name: 'pacienteRestringido' }) +export class PacienteRestringidoPipe implements PipeTransform { + constructor(private auth: Auth) { } + + transform(paciente: IPaciente): boolean { + return !!this.auth.pacienteRestringido?.find(p => p.idPaciente === paciente.id); + } +}