Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IN: permisos para plan de indicaciones #2716

Merged
merged 2 commits into from
Mar 3, 2023
Merged
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 @@ -20,6 +20,11 @@ export class PermisosMapaCamasService {
public censo = false;
public descargarListado = false;
public registros = false;
public indicacionesVer = false;
public indicacionesCrear = false;
public indicacionesEjecutar = false;
public indicacionesValidar = false;

constructor(
private auth: Auth,
) { }
Expand All @@ -43,6 +48,10 @@ export class PermisosMapaCamasService {
this.bloqueo = this.auth.check(`${this.ambito}:bloqueo`);
this.censo = this.auth.check(`${this.ambito}:censo`);
this.descargarListado = this.auth.check(`${this.ambito}:descargarListado`);
this.indicacionesVer = this.auth.check(`${this.ambito}:indicaciones`);
this.indicacionesCrear = this.auth.check(`${this.ambito}:indicaciones:create`);
this.indicacionesEjecutar = this.auth.check(`${this.ambito}:indicaciones:ejecutar`);
this.indicacionesValidar = this.auth.check(`${this.ambito}:indicaciones:validar`);
this.registros = this.auth.check('internacion:registros');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@
<plex-title size="sm" justify titulo="DATOS DE PACIENTE">
<plex-button label="EXPLORACIÓN VISUAL" size="sm" type="info" (click)="onVerResumen(cama)" class="mr-1">
</plex-button>
<ng-container *feature="'planIndicaciones'">
<plex-button *ngIf="capa !== 'estadistica'" label="INDICACIONES" size="sm" type="info"
(click)="onVerIndicaciones(cama)" class="mr-1">
</plex-button>
</ng-container>

<plex-button *ngIf="capa !== 'estadistica' && permisosMapaCamasService.indicacionesVer"
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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ export class CamaDetalleComponent implements OnInit {
public titleColor;
public tabIndex = 0;
public editar = false;
public permisoIngreso = false;
canUndo = false;
pacienteFields = ['sexo', 'fechaNacimiento', 'edad', 'cuil', 'financiador', 'numeroAfiliado', 'direccion', 'telefono'];
public nota: String;
public editNota = false;
Expand Down Expand Up @@ -106,10 +104,10 @@ export class CamaDetalleComponent implements OnInit {
switchMap(cama => cama.paciente ? this.mapaCamasService.getPaciente(cama.paciente) : of(null))
);

this.turnero$ = combineLatest(
this.turnero$ = combineLatest([
this.cama$,
this.mapaCamasService.maquinaDeEstado$
).pipe(
]).pipe(
map(([cama, estado]) => {
if (cama.idInternacion) {
const turnero = estado.turnero || {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
<section *ngIf="capa !== 'interconsultores'" class="item-indicacion">
<div class="item__container"></div>
<div class="item__botonera">
<plex-button *ngIf="detener$ | async" type="danger" icon="stop" size="sm"
(click)="onDetenerClick()" tooltip="Suspender"
tooltipPosition="bottom">
</plex-button>
<plex-button *ngIf="continuar$ | async" type="success" icon="play" size="sm"
(click)="onContinuarClick()" tooltip="Continuar"
tooltipPosition="bottom">
</plex-button>
<ng-container *ngIf="permisosMapaCamasService.indicacionesEjecutar">
<plex-button *ngIf="detener$ | async" type="danger" icon="stop" size="sm"
(click)="onDetenerClick()" tooltip="Suspender"
tooltipPosition="bottom">
</plex-button>
<plex-button *ngIf="continuar$ | async" type="success" icon="play" size="sm"
(click)="onContinuarClick()" tooltip="Continuar"
tooltipPosition="bottom">
</plex-button>
</ng-container>

<plex-dropdown *ngIf="borradores.length" right="true" size="sm"
label="Validar borradores" type="warning">
<plex-dropdown *ngIf="permisosMapaCamasService.indicacionesValidar && borradores.length"
right="true" size="sm" label="Validar borradores" type="warning">
<plex-button label="Seleccionadas" type="link"
[disabled]="!soloBorradoresSeleccionados"
(click)="onValidar(true)">
Expand Down Expand Up @@ -57,12 +59,13 @@
<h6 class="item__title">{{ seccion.concepto.term }}</h6>
</div>
<div class="item__botonera">
<plex-button *ngIf="isToday() && puedeCrear" size="sm" type="info" icon="plus"
<plex-button *ngIf="isToday && permisosMapaCamasService.indicacionesCrear"
size="sm" type="info" icon="plus"
(click)="onNuevaIndicacion(seccion)" tooltip="Agregar indicación">
</plex-button>
<plex-button type="info" size="sm"
[icon]="showSecciones[seccion.concepto.term] ? 'chevron-up' : 'chevron-down'"
(click)="tootleSeccion(seccion.concepto)">
(click)="toggleSeccion(seccion.concepto)">
</plex-button>
</div>
</td>
Expand Down Expand Up @@ -153,12 +156,12 @@ <h3>
<!-- Botones de aceptacion / rechazo -->
<ng-container *ngIf="!indicacion.estado.verificacion">
<ng-container *ngIf="capa === 'interconsultores'">
<plex-button type="success" size="sm" icon="check" tooltip="Aceptar"
[autodisable]="true"
<plex-button type="success" size="sm" icon="check"
tooltip="Aceptar" [autodisable]="true"
(click)="onVerificar(indicacion, true)">
</plex-button>
<plex-button type="danger" size="sm" icon="close" tooltip="Rechazar"
[autodisable]="true"
<plex-button type="danger" size="sm" icon="close"
tooltip="Rechazar" [autodisable]="true"
(click)="onVerificar(indicacion, false)">
</plex-button>
</ng-container>
Expand All @@ -170,7 +173,7 @@ <h3>
</ng-container>
</ng-container>

<div *ngIf="!indicacionEventoSelected && !nuevaIndicacion && !indicacion.readonly"
<div *ngIf="permisosMapaCamasService.indicacionesEjecutar && !indicacionEventoSelected && !nuevaIndicacion && !indicacion.readonly"
in-plan-indicacion-botonera [indicacion]="indicacion"
(refresh)="actualizar()"
(cancelIndicacion)="cancelIndicacion($event)">
Expand Down Expand Up @@ -210,8 +213,9 @@ <h3>

<ng-container *ngIf="indicacionView">
<in-indicacion-detalle [indicacion]="indicacionView">
<plex-button *ngIf="puedeEditar && indicacionView.estado.tipo !== 'cancelled' && indicacionView.estado.tipo !== 'active'" class="mr-1"
type="warning" size="sm" icon="pencil" tooltip="Editar" (click)="editar(indicacionView)">
<plex-button *ngIf="puedeEditar && indicacionView.estado.tipo !== 'cancelled' && indicacionView.estado.tipo !== 'active'"
class="mr-1" type="warning" size="sm" icon="pencil" tooltip="Editar"
(click)="editar(indicacionView)">
</plex-button>
<plex-button type="danger" size="sm" icon="close" tooltip="Cerrar" (click)="onClose()">
</plex-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ChangeDetectorRef, Component, OnInit, ViewEncapsulation } from '@angula
import { ActivatedRoute, Router } from '@angular/router';
import { BehaviorSubject, forkJoin, Observable } from 'rxjs';
import { map, tap, switchMap } from 'rxjs/operators';
import { PermisosMapaCamasService } from '../../services/permisos-mapa-camas.service';
import { HeaderPacienteComponent } from 'src/app/components/paciente/headerPaciente.component';
import { PacienteService } from 'src/app/core/mpi/services/paciente.service';
import { RupEjecucionService } from 'src/app/modules/rup/services/ejecucion.service';
Expand All @@ -22,7 +23,7 @@ import { OrganizacionService } from '../../../../../services/organizacion.servic
styleUrls: [
'../../../../../modules/rup/components/core/_rup.scss',
'./plan-indicaciones.scss'
],
]
})
export class PlanIndicacionesComponent implements OnInit {

Expand All @@ -32,15 +33,14 @@ export class PlanIndicacionesComponent implements OnInit {
public hoy;
public suspenderAnterior = false;
public indicacionAnterior;
public horas ;
public horas;
public indicaciones = [];
public selectedIndicacion = {};
public loading = false;
public suspenderIndicacion: Boolean;
public showSecciones = {};
public showMotivoRechazo = false; // interconsultores
public indicacionAVerificar; // interconsultores
public hayDraft = 0;
public soloBorradoresSeleccionados = false;
public borradores = [];
public eventos = {};
Expand Down Expand Up @@ -95,6 +95,8 @@ export class PlanIndicacionesComponent implements OnInit {
}

constructor(
public permisosMapaCamasService: PermisosMapaCamasService,
public ejecucionService: RupEjecucionService,
private prestacionService: PrestacionesService,
private route: ActivatedRoute,
private resumenInternacionService: InternacionResumenHTTP,
Expand All @@ -107,7 +109,6 @@ export class PlanIndicacionesComponent implements OnInit {
private maquinaEstadoService: MaquinaEstadosHTTP,
private organizacionService: OrganizacionService,
private router: Router,
public ejecucionService: RupEjecucionService,
private cd: ChangeDetectorRef,
) {
}
Expand All @@ -116,11 +117,12 @@ export class PlanIndicacionesComponent implements OnInit {
ngOnInit() {
this.organizacionService.configuracion(this.auth.organizacion.id).pipe(
tap(config => {
this.horaOrganizacion=config.planIndicaciones.horaInicio;
this.horas=this.getHorariosGrilla();
this.horaOrganizacion = config.planIndicaciones.horaInicio;
this.horas = this.getHorariosGrilla();
})
).subscribe();
this.hoy=moment();
this.permisosMapaCamasService.calcularPermisos();
this.hoy = moment();
this.capa = this.route.snapshot.paramMap.get('capa');
this.ambito = this.route.snapshot.paramMap.get('ambito');
this.idInternacion = this.route.snapshot.paramMap.get('idInternacion');
Expand Down Expand Up @@ -199,7 +201,7 @@ export class PlanIndicacionesComponent implements OnInit {
const eventosMap = {};
// filtramos eventos por fecha y hora segun tablero
const comienzoTablero = moment(this.fecha).hours(this.horaOrganizacion);
const finTablero = moment(this.fecha).add(1, 'days').hours(this.horaOrganizacion-1);
const finTablero = moment(this.fecha).add(1, 'days').hours(this.horaOrganizacion - 1);
eventos = eventos.filter(ev => moment(ev.fecha).isBetween(comienzoTablero, finTablero, 'hour', '[]'));
eventos.forEach(evento => {
eventosMap[evento.idIndicacion] = eventosMap[evento.idIndicacion] || {};
Expand Down Expand Up @@ -386,7 +388,7 @@ export class PlanIndicacionesComponent implements OnInit {
);
}

tootleSeccion(seccion) {
toggleSeccion(seccion) {
this.showSecciones[seccion.term] = !this.showSecciones[seccion.term];
}

Expand Down Expand Up @@ -458,14 +460,14 @@ export class PlanIndicacionesComponent implements OnInit {
}

getHorariosGrilla() {
const res=[];
const horaIncio= this.horaOrganizacion;
const res = [];
const horaIncio = this.horaOrganizacion;
res.push(horaIncio);
let horas = horaIncio+1;
while (horas!==horaIncio ) {
let horas = horaIncio + 1;
while (horas !== horaIncio) {
res.push(horas);
horas++;
if (horas===24) {
if (horas === 24) {
horas = 0;
}
}
Expand Down