diff --git a/src/app/modules/com/com.module.ts b/src/app/modules/com/com.module.ts index def4f15cbf..e1d0d5b167 100644 --- a/src/app/modules/com/com.module.ts +++ b/src/app/modules/com/com.module.ts @@ -24,7 +24,7 @@ import { HistorialDerivacionComponent } from './components/historial-derivacion. import { NuevaDerivacionComponent } from './components/nueva-derivacion/nueva-derivacion.component'; import { ComPuntoInicioComponent } from './components/punto-inicio.component'; import { TipoTrasladoComponent } from './components/tipo-traslado/tipo-traslado'; -import { PuntoInicioService } from './services/punto-inicio.service'; +import { PuntoInicioService } from 'src/app/services/puntoInicio/punto-inicio.service'; export const COM_COMPONENTS = [ diff --git a/src/app/modules/com/components/punto-inicio.component.ts b/src/app/modules/com/components/punto-inicio.component.ts index 016bacbeae..9886bb792b 100644 --- a/src/app/modules/com/components/punto-inicio.component.ts +++ b/src/app/modules/com/components/punto-inicio.component.ts @@ -11,7 +11,7 @@ import { OrganizacionService } from '../../../services/organizacion.service'; import { SemaforoService } from '../../semaforo-priorizacion/service/semaforo.service'; import { IDerivacion } from '../interfaces/IDerivacion.interface'; import { DerivacionesService } from './../../../services/com/derivaciones.service'; -import { PuntoInicioService } from './../services/punto-inicio.service'; +import { PuntoInicioService } from './../../../services/puntoInicio/punto-inicio.service'; @Component({ selector: 'com-punto-inicio', diff --git a/src/app/modules/rup/components/ejecucion/hudsBusqueda.component.ts b/src/app/modules/rup/components/ejecucion/hudsBusqueda.component.ts index e6793d9811..2f9d5c90e2 100644 --- a/src/app/modules/rup/components/ejecucion/hudsBusqueda.component.ts +++ b/src/app/modules/rup/components/ejecucion/hudsBusqueda.component.ts @@ -21,6 +21,7 @@ import { HUDSService } from '../../services/huds.service'; import { PrestacionesService } from './../../services/prestaciones.service'; import { CDAService } from '../../services/CDA.service'; +import { PuntoInicioService } from 'src/app/services/puntoInicio/punto-inicio.service'; @Component({ selector: 'rup-hudsBusqueda', @@ -32,6 +33,7 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro laboratoriosFS: any; laboratorios: any = []; vacunas: any = []; + derivaciones: any = []; ordenDesc = true; searchTerm: string; hallazgosCronicosAux: any[]; @@ -116,6 +118,7 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro elementoderegistro: ['elemento de registro'], laboratorios: ['laboratorios'], vacunas: ['vacunas'], + recc: ['recc'] }; public prestacionesTotales; public registrosTotales = { @@ -163,7 +166,8 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro { key: 'recetas', titulo: 'recetas', icono: 'listado-receta' }, { key: 'producto', titulo: 'productos', icono: 'pildoras' }, { key: 'laboratorios', titulo: 'laboratorios', icono: 'recipiente' }, - { key: 'vacunas', titulo: 'vacunas', icono: 'vacuna' } + { key: 'vacunas', titulo: 'vacunas', icono: 'vacuna' }, + { key: 'recc', titulo: 'recc', icono: 'account-switch' } ]; public estadoReceta = { @@ -201,6 +205,7 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro private recetasService: RecetaService, private cdaService: CDAService, private profesionalService: ProfesionalService, + private puntoInicioService: PuntoInicioService ) { } @@ -214,6 +219,7 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro this.listarInternaciones(); this.listarPrestaciones(); this.listarConceptos(); + this.listarDerivaciones(); } this.token = this.huds.getHudsToken(); // Cuando se inicia una prestación debemos volver a consultar si hay CDA nuevos al ratito. @@ -402,6 +408,11 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro registro.tipo = 'solicitud'; registro.class = 'plan'; break; + case 'recc': + gtag('huds-open', tipo, registro.organizacionOrigen.nombre, index); + registro = registro; + registro.class = 'recc'; + break; case 'ficha-epidemiologica': gtag('huds-open', tipo, registro.prestacion.term, index); registro = registro.data; @@ -571,6 +582,19 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro }); } + listarDerivaciones() { + const query = { + paciente: `^${this.paciente.documento}` + }; + + this.puntoInicioService.get(query).subscribe((data) => { + + if (data.length > 0) { + this.derivaciones = data.filter(d => d.estado === 'finalizada'); + } + }); + } + private cargarSolicitudesMezcladas() { this.solicitudesMezcladas = this.solicitudes.concat(this.solicitudesTOP); @@ -727,6 +751,8 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro return this.laboratorios.length; case 'vacunas': return this.vacunas.length; + case 'recc': + return this.derivaciones.length; case 'solicitudes': return this.solicitudesMezcladas.length; case 'recetas': @@ -888,6 +914,10 @@ export class HudsBusquedaComponent implements AfterContentInit, OnInit, OnDestro this.emitTabs(registro, (registro.evoluciones ? 'concepto' : 'solicitud'), index); } + clickDerivacion(registro, index) { + this.emitTabs(registro, 'recc', index); + } + normalizarCadena(cadena) { return cadena .normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().replace(/\s+/g, ' ').trim(); diff --git a/src/app/modules/rup/components/ejecucion/hudsBusqueda.html b/src/app/modules/rup/components/ejecucion/hudsBusqueda.html index 1eadf80c4d..c3f49ab46d 100644 --- a/src/app/modules/rup/components/ejecucion/hudsBusqueda.html +++ b/src/app/modules/rup/components/ejecucion/hudsBusqueda.html @@ -877,5 +877,68 @@
{{ getTitulo(filtroActual) | uppercas + + + + +
+
+
+ + +
+
+
\ No newline at end of file diff --git a/src/app/modules/rup/components/ejecucion/hudsBusqueda.scss b/src/app/modules/rup/components/ejecucion/hudsBusqueda.scss index 7b833ee6c2..220c78af90 100644 --- a/src/app/modules/rup/components/ejecucion/hudsBusqueda.scss +++ b/src/app/modules/rup/components/ejecucion/hudsBusqueda.scss @@ -132,6 +132,10 @@ @include card-estilo($vacuna); } + .recc { + @include card-estilo($recc); + } + .dominios { @include card-estilo($dominiosNac); } @@ -286,6 +290,10 @@ color: $vacuna } + &.recc { + color: $recc + } + &.dominios { color: $dominiosNac } diff --git a/src/app/modules/rup/components/ejecucion/vistaHuds.html b/src/app/modules/rup/components/ejecucion/vistaHuds.html index 42cab59a72..ee04058b76 100644 --- a/src/app/modules/rup/components/ejecucion/vistaHuds.html +++ b/src/app/modules/rup/components/ejecucion/vistaHuds.html @@ -98,6 +98,10 @@ + + + diff --git a/src/app/modules/rup/components/huds/vistaDerivacion.html b/src/app/modules/rup/components/huds/vistaDerivacion.html new file mode 100644 index 0000000000..523cbe0833 --- /dev/null +++ b/src/app/modules/rup/components/huds/vistaDerivacion.html @@ -0,0 +1,93 @@ + + +
+ + + + {{registro.estado}} + + + {{registro.estado}} + + + {{registro.estado}} + +
+
+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + + +
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+ + + {{registro.detalle}} + + + +
\ No newline at end of file diff --git a/src/app/modules/rup/components/huds/vistaDerivacion.scss b/src/app/modules/rup/components/huds/vistaDerivacion.scss new file mode 100644 index 0000000000..9d9b7801ff --- /dev/null +++ b/src/app/modules/rup/components/huds/vistaDerivacion.scss @@ -0,0 +1,53 @@ +.titulo-badges { + display: flex; + column-gap: 5px; + align-items: center; +} + +.registros { + display: flex; + align-items: center; + grid-gap: 20px; + + .icon-info { + color: var(--nav-bar-color); + padding: 10px; + border: 1px solid var(--nav-bar-color); + border-radius: 100%; + width: 60px; + height: 60px; + align-items: center; + display: flex; + justify-content: center; + } + + .info-registro { + display: flex; + flex-direction: column; + + plex-badge { + margin-bottom: 10px; + } + + hr { + float: left; + margin: 0.75rem 0; + width: 35px; + border: solid 0.5px var(--nav-bar-color); + } + } +} + +.texto-detalle { + text-transform: capitalize; + font-size: 80%; + line-height: normal; +} + +.subtitulo { + font-size: 1.4em; + font-weight: 300; + margin-bottom: -5px; + text-transform: uppercase; + color: var(--nav-bar-color); +} \ No newline at end of file diff --git a/src/app/modules/rup/components/huds/vistaDerivacion.ts b/src/app/modules/rup/components/huds/vistaDerivacion.ts new file mode 100644 index 0000000000..12053992cf --- /dev/null +++ b/src/app/modules/rup/components/huds/vistaDerivacion.ts @@ -0,0 +1,77 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { Auth } from '@andes/auth'; +import { TurnoService } from '../../../../services/turnos/turno.service'; +import { HUDSService } from '../../services/huds.service'; +import { DocumentosService } from 'src/app/services/documentos.service'; +import { AdjuntosService } from '../../services/adjuntos.service'; +import { OrganizacionService } from 'src/app/services/organizacion.service'; +@Component({ + selector: 'vista-derivacion', + templateUrl: 'vistaDerivacion.html', + styleUrls: ['vistaDerivacion.scss'], +}) + +export class VistaDerivacionComponent implements OnInit { + + @Input() registro; + turno; + estado; + observaciones = ''; + organizacionOrigen; + public puedeDescargarInforme: boolean; + public requestInProgress: boolean; + public adjuntosUrl = []; + fileToken: string = null; + fechaAceptada: string; + + constructor( + public servicioTurnos: TurnoService, + public huds: HUDSService, + private auth: Auth, + private documentosService: DocumentosService, + private adjuntosService: AdjuntosService, + private organizacionService: OrganizacionService + ) { } + + ngOnInit() { + this.puedeDescargarInforme = this.auth.check('huds:impresion'); + this.adjuntosUrl = this.registro.adjuntos.map((doc) => { + return { + ...doc, + url: this.adjuntosService.createUrl('drive', doc, this.fileToken) + }; + }); + this.organizacionOrigen = this.organizacionService.getById(this.registro.organizacionOrigen.id).subscribe(organizacion => { + this.organizacionOrigen = organizacion; + + this.fechaAceptada = this.getFechaAceptada(this.registro); + }); + } + + abrirSolicitud() { + const tipo = 'rup'; + this.huds.toogle(this.registro, tipo); + } + + imprimirHistorial() { + this.requestInProgress = true; + const foo = () => this.requestInProgress = false; + this.documentosService.descargarHistorialDerivacion(this.registro._id, this.registro.paciente.apellido).subscribe(foo, foo); + } + + getFechaAceptada(derivacion) { + const aceptada = derivacion.historial.find(h => h.estado === 'aceptada'); + return aceptada ? aceptada.createdAt : null; + } + getHistorialDerivacion(organizacion, derivacion) { + derivacion.historial.shift(); + let historial = organizacion.esCOM ? derivacion.historial : derivacion.historial.filter((h) => h.createdBy.organizacion.id === organizacion.id); + historial = historial.filter(h => !h.eliminado); + historial.forEach(h => { + h.fechaCreacion = moment(h.createdAt).locale('es').format('DD/MM/YYYY HH:mm'); + h.reporteCOM = organizacion.esCOM; + h.esActualizacion = !h?.estado; + }); + return historial.sort((a, b) => b.createdAt - a.createdAt); + } +} diff --git a/src/app/modules/rup/components/variables.scss b/src/app/modules/rup/components/variables.scss index 6a8ae79af3..f7f3da94a2 100644 --- a/src/app/modules/rup/components/variables.scss +++ b/src/app/modules/rup/components/variables.scss @@ -20,6 +20,7 @@ $calificador: #660520; $laboratorio: #a0a0a0; $registro: #8bc43f; // elemento de registro $vacuna: #11910D; +$recc: #7a1e2b; $dominiosNac: #11312D; $informacion: #00A8E0; $recetas: #7b2ff7; @@ -43,6 +44,7 @@ $rup_colors: ( 'medicamento.clínico': $producto, adjunto: $adjunto, vacuna: $vacuna, + recc: $recc, dominiosNac: $dominiosNac, elemento: $registro, elementoderegistro: $registro, diff --git a/src/app/modules/rup/huds-lib.module.ts b/src/app/modules/rup/huds-lib.module.ts index e445751369..1d042a2519 100644 --- a/src/app/modules/rup/huds-lib.module.ts +++ b/src/app/modules/rup/huds-lib.module.ts @@ -37,6 +37,7 @@ import { MotivosHudsService } from 'src/app/services/motivosHuds.service'; import { VistaLaboratorioComponent } from './components/ejecucion/laboratorios/vista-laboratorio.component'; import { VistaRecetaComponent } from './components/huds/vistaReceta'; import { SuspenderMedicacionComponent } from './components/ejecucion/recetas/suspenderMedicacion'; +import { VistaDerivacionComponent } from './components/huds/vistaDerivacion'; @NgModule({ imports: [ @@ -76,6 +77,7 @@ import { SuspenderMedicacionComponent } from './components/ejecucion/recetas/sus DetallePacienteComponent, VistaDetalleRegistroComponent, VistaAccesosHudsComponent, + VistaDerivacionComponent, VistaSolicitudTopComponent, VistaHistorialTurnosComponent, HudsBusquedaComponent, @@ -100,6 +102,7 @@ import { SuspenderMedicacionComponent } from './components/ejecucion/recetas/sus VistaDetalleRegistroComponent, VistaAccesosHudsComponent, VistaSolicitudTopComponent, + VistaDerivacionComponent, VistaHistorialTurnosComponent, HudsBusquedaComponent, ListadoInternacionHudsComponent, diff --git a/src/app/modules/rup/services/huds.service.ts b/src/app/modules/rup/services/huds.service.ts index c3871fae97..1cfa1cbbef 100644 --- a/src/app/modules/rup/services/huds.service.ts +++ b/src/app/modules/rup/services/huds.service.ts @@ -87,6 +87,11 @@ export class HUDSService { case 'cda': case 'dominio': case 'solicitud': + case 'recc': + if (registro._id === _registro._id) { + return i; + } + break; case 'ficha-epidemiologica': if (registro.id === _registro.id || registro.data?.id === _registro.id) { return i; diff --git a/src/app/services/com/derivaciones.service.ts b/src/app/services/com/derivaciones.service.ts index 2f11fd6e7b..0c7144e8c5 100644 --- a/src/app/services/com/derivaciones.service.ts +++ b/src/app/services/com/derivaciones.service.ts @@ -2,7 +2,9 @@ import { ResourceBaseHttp, Server } from '@andes/shared'; import { Injectable } from '@angular/core'; import { environment } from 'src/environments/environment'; -@Injectable() +@Injectable({ + providedIn: 'root' +}) export class DerivacionesService extends ResourceBaseHttp { protected url = '/modules/com/derivaciones'; constructor(protected server: Server) { super(server); } diff --git a/src/app/modules/com/services/punto-inicio.service.ts b/src/app/services/puntoInicio/punto-inicio.service.ts similarity index 93% rename from src/app/modules/com/services/punto-inicio.service.ts rename to src/app/services/puntoInicio/punto-inicio.service.ts index f1911c5d8e..09d797640a 100644 --- a/src/app/modules/com/services/punto-inicio.service.ts +++ b/src/app/services/puntoInicio/punto-inicio.service.ts @@ -1,10 +1,12 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { DerivacionesService } from 'src/app/services/com/derivaciones.service'; -import { IDerivacion } from '../interfaces/IDerivacion.interface'; +import { IDerivacion } from '../../modules/com/interfaces/IDerivacion.interface'; +import { DerivacionesService } from '../com/derivaciones.service'; -@Injectable() +@Injectable({ + providedIn: 'root' +}) export class PuntoInicioService { public derivacionesOrdenadas$: Observable; diff --git a/src/styles.scss b/src/styles.scss index 916d753e02..52d59844f3 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -7,6 +7,7 @@ $trastorno: #ff4a1a; $hallazgo: #f4a03b; $procedimiento: #92278e; $solicitud: #0070cc; +$recc: #7a1e2b; // $productos: #ef0993; $producto: #00bcb4; $adjunto: #b9c512; @@ -29,6 +30,7 @@ $plex-tabs-color-extend: ( regimen: $procedimiento, entidad: $procedimiento, solicitud: $solicitud, + recc: $recc, producto: $producto, adjunto: $adjunto, elementoderegistro: $registro,