From f0138f5c0d382244dd9e369b8179d5a90e02632f Mon Sep 17 00:00:00 2001
From: nicolasarana <90768149+nicolasarana@users.noreply.github.com>
Date: Tue, 12 May 2026 15:56:18 -0300
Subject: [PATCH] =?UTF-8?q?HUDS=20-=20"=20Se=20agrega=20filtro=20de=20orga?=
=?UTF-8?q?nizaci=C3=B3n=20a=20EXPORTAR=20HUDS"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../exportar-huds.component.html | 3 +++
.../exportar-huds/exportar-huds.component.ts | 20 ++++++++++++++++++-
.../services/export-huds.service.ts | 4 ++++
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/app/modules/visualizacion-informacion/components/exportar-huds/exportar-huds.component.html b/src/app/modules/visualizacion-informacion/components/exportar-huds/exportar-huds.component.html
index 8f368d7f9d..a8dd2f1fbd 100644
--- a/src/app/modules/visualizacion-informacion/components/exportar-huds/exportar-huds.component.html
+++ b/src/app/modules/visualizacion-informacion/components/exportar-huds/exportar-huds.component.html
@@ -53,6 +53,9 @@
+
+
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 9c41a68819..2b9d32946b 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
@@ -1,5 +1,7 @@
import { Plex } from '@andes/plex';
import { Component, OnInit } from '@angular/core';
+import { Observable, EMPTY } from 'rxjs';
+import { switchMap } from 'rxjs/operators';
import { IPaciente } from 'src/app/core/mpi/interfaces/IPaciente';
import { ExportHudsService } from '../../services/export-huds.service';
import { Auth } from '@andes/auth';
@@ -28,6 +30,8 @@ export class ExportarHudsComponent implements OnInit {
public turnosPrestaciones = false;
public excluirVacunas;
public excluirLaboratorio;
+ public organizaciones$: Observable;
+ public organizacion: any;
constructor(
@@ -46,6 +50,8 @@ export class ExportarHudsComponent implements OnInit {
{ route: '/', name: 'VISUALIZACIÓN DE INFORMACIÓN' },
{ name: 'Exportar HUDS' }
]);
+ this.organizaciones$ = this.auth.organizaciones();
+ this.organizacion = this.auth.organizacion;
this.descargasPendientes();
}
}
@@ -70,6 +76,7 @@ export class ExportarHudsComponent implements OnInit {
this.fechaDesde = null;
this.fechaHasta = null;
this.prestacion = null;
+ this.organizacion = this.auth.organizacion;
}
esPacienteRestringido(paciente: IPaciente) {
@@ -109,9 +116,20 @@ export class ExportarHudsComponent implements OnInit {
fechaDesde: this.fechaDesde,
fechaHasta: this.fechaHasta,
hudsCompleta: this.hudsCompleta,
+ organizacion: this.organizacion ? this.organizacion.id : null,
excluye
};
- this.exportHudsService.peticionHuds(params).subscribe((res) => {
+ // verifica primero que exista historial antes de crear el pedido
+ this.exportHudsService.checkHistory(params).pipe(
+ switchMap((resCheck) => {
+ if (resCheck.hasHistory) {
+ return this.exportHudsService.peticionHuds(params);
+ } else {
+ this.plex.info('warning', 'No existen registros y/o historial con los filtros seleccionados ', 'Atención');
+ return EMPTY;
+ }
+ })
+ ).subscribe((res) => {
if (res) {
this.plex.toast('success', 'Su pedido esta siendo procesado', 'Información', 2000);
this.descargasPendientes();
diff --git a/src/app/modules/visualizacion-informacion/services/export-huds.service.ts b/src/app/modules/visualizacion-informacion/services/export-huds.service.ts
index 01dc00f658..4c1ece2db7 100644
--- a/src/app/modules/visualizacion-informacion/services/export-huds.service.ts
+++ b/src/app/modules/visualizacion-informacion/services/export-huds.service.ts
@@ -21,6 +21,10 @@ export class ExportHudsService {
return this.server.post(this.exportHudsUrl, data, { responseType: 'blob' } as any);
}
+ checkHistory(data): Observable {
+ return this.server.post(this.exportHudsUrl + '/check-history', data);
+ }
+
descargaHuds(params): Observable {
return this.server.post(this.exportHudsUrl + '/' + params.id, params, { responseType: 'blob' } as any).pipe(
saveAs(params.name, 'zip')