Skip to content

Commit

Permalink
HUDS - Controla permisos para ver la HUDS de pacientes (#2978)
Browse files Browse the repository at this point in the history
* feat(HUDS): controla permisos para ver la HUDS

* ref(misc): renombra pipe, restringe edicion en mpi, corrige offset en rup

---------

Co-authored-by: Lautaro Molina <[email protected]>
  • Loading branch information
ma7payne and negro89 authored Jul 18, 2024
1 parent 832a9fb commit 3c971ae
Show file tree
Hide file tree
Showing 21 changed files with 266 additions and 170 deletions.
9 changes: 9 additions & 0 deletions projects/auth/src/lib/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -48,6 +55,7 @@ export class Auth {
private arrayFiltros: any[];
public mobileUser: any;
private feature: { [key: string]: boolean };
public pacienteRestringido;


constructor(private server: Server) {
Expand All @@ -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),
Expand Down
12 changes: 9 additions & 3 deletions projects/shared/src/lib/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -38,7 +39,8 @@ import { DocumentoPipe } from './pipes/documento.pipe';
PopoverAuditComponent,
GaleriaArchivosComponent,
UploadFileComponent,
NotasComponent
NotasComponent,
PacienteRestringidoPipe
],
exports: [
FechaPipe,
Expand All @@ -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<SharedModule> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ng-container *ngFor="let relacion of relaciones$ | async">
<ng-container *ngIf="relacionesYcondiciones(relacion, cama)">
<plex-button tooltip="{{ relacion.nombre }}" [icon]="relacion.icon" [type]="relacion.color"
size="sm" (click)="accion(relacion)">
size="sm" (click)="accion(relacion)" class="mr-1">
</plex-button>
</ng-container>
<plex-dropdown #drop class="mr-1" *ngIf="puedeDesocupar(relacion)" [right]="true" size="sm"
Expand Down Expand Up @@ -72,41 +72,43 @@
</ng-container>
<ng-container *ngIf="cama.paciente">
<plex-title size="sm" justify titulo="DATOS DE PACIENTE">
<plex-button *ngIf="puedeVerHuds" label="EXPLORACIÓN VISUAL" size="sm" type="info"
(click)="onVerResumen(cama)" class="mr-1">
</plex-button>

<plex-button *ngIf="capa !== 'estadistica' && verIndicacion()" label="INDICACIONES" size="sm"
type="info" (click)="onVerIndicaciones(cama)" class="mr-1">
</plex-button>

<ng-container *ngIf="turnero$ | async as pantalla">
<plex-button (click)="llamarTurnero(pantalla, cama)" size="sm" type="info" class="mr-2">
<plex-icon name="bell-ring-outline"></plex-icon>
<ng-container *ngIf="!(cama.paciente | pacienteRestringido)">
<plex-button *ngIf="puedeVerHuds" label="EXPLORACIÓN VISUAL" size="sm" type="info"
(click)="onVerResumen(cama)" class="mr-1">
</plex-button>
</ng-container>

<ng-container *ngIf="botonRegistroHabilitado$ | async">
<plex-button class="mr-1" size="sm" type="success" (click)="onNuevoRegistrio()"> NUEVO REGISTRO
<plex-button *ngIf="capa !== 'estadistica' && verIndicacion()" label="INDICACIONES" size="sm"
type="info" (click)="onVerIndicaciones(cama)" class="mr-1">
</plex-button>
</ng-container>
<ng-container *ngIf="!cama.sala && !registraEgreso">
<ng-container *ngIf="capa !== 'interconsultores' && capa !== 'farmaceutica'">
<plex-button *ngIf="unicoMovimiento" size="sm" icon="account-off" type="danger"
tooltip="Deshacer Internación" tooltipPosition="left"
(click)="deshacerInternacion(true)">

<ng-container *ngIf="turnero$ | async as pantalla">
<plex-button (click)="llamarTurnero(pantalla, cama)" size="sm" type="info" class="mr-2">
<plex-icon name="bell-ring-outline"></plex-icon>
</plex-button>
<plex-dropdown *ngIf="!unicoMovimiento" [right]="true" size="sm" icon="account-off"
type="danger" tooltip="Deshacer Internación" tooltipPosition="left"
[items]="items">
</plex-dropdown>
</ng-container>

<ng-container *ngIf="botonRegistroHabilitado$ | async">
<plex-button class="mr-1" size="sm" type="success" (click)="onNuevoRegistrio()"> NUEVO REGISTRO
</plex-button>
</ng-container>
<ng-container *ngIf="!cama.sala && !registraEgreso">
<ng-container *ngIf="capa !== 'interconsultores' && capa !== 'farmaceutica'">
<plex-button *ngIf="unicoMovimiento" size="sm" icon="account-off" type="danger"
tooltip="Deshacer Internación" tooltipPosition="left"
(click)="deshacerInternacion(true)">
</plex-button>
<plex-dropdown *ngIf="!unicoMovimiento" [right]="true" size="sm" icon="account-off"
type="danger" tooltip="Deshacer Internación" tooltipPosition="left"
[items]="items">
</plex-dropdown>
</ng-container>
</ng-container>
</ng-container>
</plex-title>

<fieldset>
<paciente-detalle [paciente]="paciente$ | async" orientacion="horizontal" [fields]="pacienteFields"
[accesoHuds]="true">
[accesoHuds]="!(cama.paciente | pacienteRestringido)">
<plex-badge class="pr-1" type="warning" *ngIf="hayRespirador$ | async as respirador"
tooltip="Desde {{ respirador.valor.fechaDesde | fecha }}">
Respirador
Expand Down Expand Up @@ -135,7 +137,7 @@
</ng-container>
</plex-tab>
<plex-tab *ngIf="cama.paciente" label="INTERNACION">
<app-internacion-detalle (accion)="onAccion($event)">
<app-internacion-detalle (accion)="onAccion($event)" [paciente]="cama.paciente">
</app-internacion-detalle>
</plex-tab>
<plex-tab label="HISTORIAL" *ngIf="!cama.sala">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@
egreso.
</plex-label>
</ng-container>

<ng-container *ngIf="mostrar === 'registros' && permisosMapaCamasService.registros">
<app-registros-huds-detalle (accion)="onAccion($event)"></app-registros-huds-detalle>
<app-registros-huds-detalle *ngIf="!(paciente | pacienteRestringido)"
(accion)="onAccion($event)"></app-registros-huds-detalle>
<plex-label *ngIf="paciente | pacienteRestringido" class="mt-4" type="warning" icon="informacion" justify="center"
direction="column">
No tiene permiso para ingresar a este paciente.
</plex-label>
</ng-container>


</div>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class InternacionDetalleComponent implements OnInit, AfterViewChecked {
public existeEgreso;
view$ = this.mapaCamasService.view;

@Input() cama;
@Input() paciente;
@Output() cambiarCama = new EventEmitter<any>();
@Output() accion = new EventEmitter<any>();
@ContentChild(PlexOptionsComponent, { static: true }) plexOptions: PlexOptionsComponent;
Expand Down Expand Up @@ -233,5 +233,4 @@ export class InternacionDetalleComponent implements OnInit, AfterViewChecked {
puedeEditarEgreso() {
return (this.permisosMapaCamasService.egreso && this.estadoPrestacion !== 'validada' && this.existeEgreso);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ 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';
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',
Expand Down Expand Up @@ -98,6 +100,7 @@ export class TurnosPrestacionesComponent implements OnInit, OnDestroy {
private exportHudsService: ExportHudsService,
public obraSocialService: ObraSocialService,
private pacienteService: PacienteService,
private pacienteRestringido: PacienteRestringidoPipe

) { }

Expand Down Expand Up @@ -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()
);
Expand Down Expand Up @@ -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);
}
}
42 changes: 26 additions & 16 deletions src/app/components/top/solicitudes/solicitudes.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ 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';
import { PrestacionesService } from '../../../modules/rup/services/prestaciones.service';
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',
Expand Down Expand Up @@ -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
) {
}

Expand Down Expand Up @@ -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() {
Expand Down
11 changes: 7 additions & 4 deletions src/app/components/turnos/autocitar/autocitar.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
</plex-item>
</ng-container>
</plex-list>
<small *ngIf="(!agendasAutocitar || agendasAutocitar?.length === 0) && prestacionAutocitar">No hay agendas con
turnos
disponibles para la autocitación</small>
<div class="mt-5">
<plex-label *ngIf="(!agendasAutocitar || agendasAutocitar?.length === 0) && prestacionAutocitar"
icon="calendar-cruz" color="#ff8d22" size="md" direction="column" [tituloBold]="false"
titulo='No hay agendas con turnos disponibles para la autocitación' subtitulo=''>
</plex-label>
</div>
<div *ngIf="agendaSeleccionada">
<plex-title titulo="Grilla Horaria" size="sm"></plex-title>
<div *ngFor="let bloque of agendaSeleccionada.bloques; let indiceBloque = index">
Expand All @@ -42,7 +45,7 @@
</div>
<plex-modal size="sm" #modal [allowEscClose]="false" [allowBackdropClose]="false" (closed)="cerrarModal()">
<plex-modal-title class="mb-2" type="info">
<div class="rounded" align="center">?</div>
<div class="rounded" align="center">?</div>
</plex-modal-title>
<plex-modal-subtitle class="text-center">¿Desea confirmar el turno para paciente autocitado?
</plex-modal-subtitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</demandaInsatisfecha>
</ng-container>
</plex-tab>
<plex-tab icon="history" label="Historial">
<plex-tab icon="history" label="Historial" *ngIf="!(paciente | pacienteRestringido)">
<fieldset *plTab>
<ul class="list-group">
<li *ngFor="let turno of ultimosTurnos$ | async; let i=index" class="list-group-item"
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/mpi/components/busqueda-mpi.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!-- detalles del paciente a visualizar -->
<ng-container *ngIf="showDetallePaciente">
<plex-title titulo="Detalle paciente" size="sm">
<plex-button type="warning" size="sm" label="Editar Datos" (click)="toEdit(paciente)"></plex-button>
<plex-button [disabled]="paciente | pacienteRestringido" type="warning" size="sm" label="Editar Datos" (click)="toEdit(paciente)"></plex-button>
<plex-button type="danger" icon="close" class="ml-2" size="sm" (click)="closeDetallePaciente()">
</plex-button>
</plex-title>
Expand Down
12 changes: 6 additions & 6 deletions src/app/modules/mpi/components/paciente-listado.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<ng-container *ngFor="let paciente of listado;let i=index">
<plex-item [class.pacienteFallecido]="paciente.fechaFallecimiento" [selected]="selectedId === paciente.id"
(click)="seleccionar(paciente)" [colors]="colorItem(i)">
(click)="seleccionar(paciente)" [colors]="colorItem(i)">
<img [ngClass]="{'img-fallecido' : paciente.fechaFallecimiento}" [mpiFotoPaciente]="paciente" />

<plex-label *ngIf="!showDatosTutor(paciente)" titulo="{{ paciente | nombre }}"
subtitulo="{{ paciente | documento }}">
subtitulo="{{ paciente | documento }}">
</plex-label>

<plex-label *ngIf="showDatosTutor(paciente)" titulo="{{ paciente | nombre }}" subtitulo=" {{paciente.relaciones[0].relacion?.nombre.toUpperCase() || 'RELACIÓN S/D'}}:
Expand All @@ -24,7 +24,7 @@
</plex-badge>

<plex-badge type="" class=""
[ngClass]="{'text-success' : paciente.estado === 'validado' , 'text-warning' : paciente.estado === 'temporal'} ">
[ngClass]="{'text-success' : paciente.estado === 'validado' , 'text-warning' : paciente.estado === 'temporal'} ">
{{ paciente.estado || 'S/D' }}
</plex-badge>

Expand All @@ -33,12 +33,12 @@
</plex-badge>

<plex-button *ngIf="showBtnRelaciones(paciente)" type="info" size="sm" icon="usuarios"
title="{{openBtnRelaciones(paciente)?'No ver relaciones':'Ver relaciones'}}"
(click)="verRelaciones(paciente)">
title="{{openBtnRelaciones(paciente)?'No ver relaciones':'Ver relaciones'}}"
(click)="verRelaciones(paciente)">
</plex-button>

<plex-button *ngIf="editing" type="warning" size="sm" icon="pencil" title="Editar paciente"
(click)="editar(paciente)">
[disabled]="paciente | pacienteRestringido" (click)="editar(paciente)">
</plex-button>
</plex-item>

Expand Down
Loading

0 comments on commit 3c971ae

Please sign in to comment.