@@ -5,14 +5,16 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
55import { ActivatedRoute , Router } from '@angular/router' ;
66import * as moment from 'moment' ;
77import { Observable } from 'rxjs' ;
8- import { map } from 'rxjs/operators' ;
8+ import { map , switchMap } from 'rxjs/operators' ;
99import { ElementosRUPService } from 'src/app/modules/rup/services/elementosRUP.service' ;
1010import { OrganizacionService } from 'src/app/services/organizacion.service' ;
1111import { WebSocketService } from 'src/app/services/websocket.service' ;
1212import { IMaquinaEstados } from '../../interfaces/IMaquinaEstados' ;
1313import { ISnapshot } from '../../interfaces/ISnapshot' ;
1414import { MapaCamasService } from '../../services/mapa-camas.service' ;
1515import { PermisosMapaCamasService } from '../../services/permisos-mapa-camas.service' ;
16+ import { MotivosHudsService } from 'src/app/services/motivosHuds.service' ;
17+ import { HUDSService } from 'src/app/modules/rup/services/huds.service' ;
1618
1719@Component ( {
1820 selector : 'app-mapa-camas-resumen' ,
@@ -55,6 +57,14 @@ export class MapaCamasResumenComponent implements OnInit {
5557 public isValidDate = true ;
5658 public dataOrganizacion ;
5759
60+ public showModalMotivo = false ;
61+ public motivoVerContinuarPrestacion = 'continuidad' ;
62+ public routeToParams = [ ] ;
63+ public accesoHudsPrestacion = null ;
64+ public prestacionNominalizada ;
65+ public accesoHudsPaciente = null ;
66+ public accesoHudsTurno = null ;
67+
5868 public columns = {
5969 fechaMovimiento : false ,
6070 fechaIngreso : false ,
@@ -87,7 +97,9 @@ export class MapaCamasResumenComponent implements OnInit {
8797 public permisosMapaCamasService : PermisosMapaCamasService ,
8898 public elementoRUPService : ElementosRUPService ,
8999 public ws : WebSocketService ,
90- public organizacionService : OrganizacionService
100+ public organizacionService : OrganizacionService ,
101+ public motivosHudsService : MotivosHudsService ,
102+ private hudsService : HUDSService ,
91103
92104 ) { }
93105
@@ -163,4 +175,37 @@ export class MapaCamasResumenComponent implements OnInit {
163175 ] ) ;
164176 }
165177
178+
179+
180+ setRouteToParams ( params ) {
181+ this . routeToParams = params ;
182+ }
183+
184+ verHuds ( paciente ) {
185+ const token = this . motivosHudsService . getMotivo ( 'seleccion-manual' ) . pipe (
186+ switchMap ( motivoH => {
187+ const paramsToken = {
188+ usuario : this . auth . usuario ,
189+ organizacion : this . auth . organizacion ,
190+ paciente : paciente ,
191+ motivo : motivoH [ 0 ] . key ,
192+ profesional : this . auth . profesional ,
193+ idTurno : null ,
194+ idPrestacion : null
195+ } ;
196+ return this . hudsService . generateHudsToken ( paramsToken ) ;
197+ } ) ) ;
198+
199+ token . subscribe ( ( husdTokenRes ) => {
200+ if ( husdTokenRes . token ) {
201+ window . sessionStorage . setItem ( 'huds-token' , husdTokenRes . token ) ;
202+ this . router . navigate ( [ 'huds' , 'paciente' , paciente . id ] ) ;
203+ }
204+ } ) ;
205+
206+ // this.router.navigate(['/huds/paciente/' + paciente.id]);
207+ }
208+
209+
210+
166211}
0 commit comments