From a03751cdc435ec531eb6e7d30fa4e4a9f34f23be Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 4 Mar 2026 14:39:08 +0000 Subject: [PATCH 1/2] chore(release): 5.170.2 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * **CIT:** bloques con turno con llave en calendario de top ([#3304](https://github.com/andes/app/issues/3304)) ([c2b3fb9](https://github.com/andes/app/commit/c2b3fb9279b3276ba36bccf8dfe92830e23c220a)) * **MPI:** cuil no requerido ([#3308](https://github.com/andes/app/issues/3308)) ([585e26e](https://github.com/andes/app/commit/585e26e17d866909ca54a183d31c7b860afcf648)) * **TOP-211:** Listado: Error de visualización datos del paciente ([#3296](https://github.com/andes/app/issues/3296)) ([19e5ce7](https://github.com/andes/app/commit/19e5ce7cc493c18ccf3d58cea3eb345f64a68716)) --- .../mapa-camas/services/mapa-camas.http.ts | 6 +-- .../ingreso/ingresar-paciente.component.ts | 53 +++++++++++++------ 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/app/apps/rup/mapa-camas/services/mapa-camas.http.ts b/src/app/apps/rup/mapa-camas/services/mapa-camas.http.ts index e1590ddb4c..ab25723fb5 100644 --- a/src/app/apps/rup/mapa-camas/services/mapa-camas.http.ts +++ b/src/app/apps/rup/mapa-camas/services/mapa-camas.http.ts @@ -85,14 +85,14 @@ export class MapaCamasHTTP { } // [TODO] ver interfaz e ID - updateEstados(ambito: string, capa: string, fecha: Date, data): Observable { - const params = { + updateEstados(ambito: string, capa: string, fecha: Date, data, options: any = {}): Observable { + const body = { ...data, ambito: ambito, capa: capa, fecha }; - return this.server.patch(`${this.url}/camaEstados/${data._id}`, params); + return this.server.patch(`${this.url}/camaEstados/${data._id}`, body, { params: options }); } deshacerInternacion(ambito: string, capa: string, idInternacion: string, completo: boolean): Observable<{ status: boolean }> { diff --git a/src/app/apps/rup/mapa-camas/sidebar/ingreso/ingresar-paciente.component.ts b/src/app/apps/rup/mapa-camas/sidebar/ingreso/ingresar-paciente.component.ts index 3a849b1815..1de8c74d5d 100644 --- a/src/app/apps/rup/mapa-camas/sidebar/ingreso/ingresar-paciente.component.ts +++ b/src/app/apps/rup/mapa-camas/sidebar/ingreso/ingresar-paciente.component.ts @@ -1,7 +1,7 @@ import { Auth } from '@andes/auth'; import { Plex } from '@andes/plex'; import { Component, EventEmitter, OnDestroy, OnInit, Output, QueryList, ViewChildren } from '@angular/core'; -import { combineLatest, Observable, of, Subscription } from 'rxjs'; +import { combineLatest, forkJoin, Observable, of, Subscription } from 'rxjs'; import { auditTime, filter, map, switchMap, take } from 'rxjs/operators'; import { IPaciente } from 'src/app/core/mpi/interfaces/IPaciente'; import { ElementosRUPService } from 'src/app/modules/rup/services/elementosRUP.service'; @@ -25,6 +25,7 @@ import { cache } from '@andes/shared'; import { IMaquinaEstados } from '../../interfaces/IMaquinaEstados'; import { ListadoInternacionCapasService } from '../../views/listado-internacion-capas/listado-internacion-capas.service'; import { IObraSocial } from 'src/app/interfaces/IObraSocial'; +import { MapaCamasHTTP } from '../../services/mapa-camas.http'; @Component({ selector: 'app-ingresar-paciente', @@ -94,6 +95,7 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { private subscription2: Subscription; public selectedOS = false; public financiador; + public edicionFinanciador = false; public selectorFinanciadores: IObraSocial[] = []; public obrasSociales: IObraSocial[] = []; public OSPrivada = false; @@ -107,6 +109,7 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { private organizacionService: OrganizacionService, private servicioPrestacion: PrestacionesService, public mapaCamasService: MapaCamasService, + private camasHTTP: MapaCamasHTTP, private listadoInternacionService: ListadoInternacionService, private historialInternacionService: ListadoInternacionCapasService, private auth: Auth, @@ -472,25 +475,39 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { // Sincroniza las fechas editadas entre la cama y elresumen/prestacion private sincronizarCamaInternacion(idInternacion, fechaIngresoOriginal, fechaIngreso): Observable { - return this.mapaCamasService.snapshot(this.fechaIngresoOriginal, idInternacion).pipe( - switchMap(snapshot => { - const primeraCama = snapshot[0]; - return this.mapaCamasService.changeTime(primeraCama, fechaIngresoOriginal, fechaIngreso, idInternacion); - }), + const obs$ = (fechaIngresoOriginal.getTime() !== fechaIngreso.getTime()) ? + this.mapaCamasService.snapshot(this.fechaIngresoOriginal, idInternacion).pipe( + switchMap(snapshot => { + const primeraCama = snapshot[0]; + return this.mapaCamasService.changeTime(primeraCama, fechaIngresoOriginal, fechaIngreso, idInternacion); + }) + ) : of(this.cama); + + return obs$.pipe( switchMap(cama => { - if (!cama.id) { + if (!cama?.id) { // algun error en changeTime throw new Error(); } - if (this.capa === 'estadistica') { - return of(null); - } this.cama = cama; - // Prestacion creada por capa estadistica-v2. Puede estar siendo actualizada por medica/enfermeria - return this.internacionResumenService.update(cama.idInternacion, { - idPrestacion: this.prestacion?.id, - fechaIngreso: this.informeIngreso.fechaIngreso - }); + + const nextOps$: Observable[] = []; + if (this.capa === 'estadistica' && this.edicionFinanciador) { + nextOps$.push(this.camasHTTP.updateEstados(this.mapaCamasService.ambito, this.capa, this.informeIngreso.fechaIngreso, this.cama, { edicionFinanciador: true })); + } + + if (this.capa !== 'estadistica') { + // Prestacion creada por capa estadistica-v2. Puede estar siendo actualizada por medica/enfermeria + nextOps$.push(this.internacionResumenService.update(cama.idInternacion, { + idPrestacion: this.prestacion?.id, + fechaIngreso: this.informeIngreso.fechaIngreso + })); + } + + if (nextOps$.length > 0) { + return forkJoin(nextOps$).pipe(map(() => cama)); + } + return of(cama); }) ) as Observable; } @@ -510,7 +527,10 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { if (this.prestacion && this.poseeMovimientos) { // Se actualiza fecha y hora en camas this.cama.idInternacion = idInternacion; - if (this.informeIngreso.fechaIngreso.getTime() !== this.fechaIngresoOriginal.getTime()) { + const fechaChange = this.informeIngreso.fechaIngreso.getTime() !== this.fechaIngresoOriginal.getTime(); + const financiadorChange = this.capa === 'estadistica' && this.edicionFinanciador; + + if (fechaChange || financiadorChange) { // Recuperamos snapshot inicial, por si hay un cambio de cama this.sincronizarCamaInternacion(idInternacion, this.fechaIngresoOriginal, this.informeIngreso.fechaIngreso).subscribe(() => { this.plex.info('success', 'Los datos se actualizaron correctamente'); @@ -895,5 +915,6 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { financiador: financiadorSeleccionado.financiador }; } + this.edicionFinanciador = true; } } From df5b4b85f4b8c5e0342e54b72fd93798d10d9298 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 4 Mar 2026 14:39:08 +0000 Subject: [PATCH 2/2] chore(release): 5.170.2 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * **CIT:** bloques con turno con llave en calendario de top ([#3304](https://github.com/andes/app/issues/3304)) ([c2b3fb9](https://github.com/andes/app/commit/c2b3fb9279b3276ba36bccf8dfe92830e23c220a)) * **MPI:** cuil no requerido ([#3308](https://github.com/andes/app/issues/3308)) ([585e26e](https://github.com/andes/app/commit/585e26e17d866909ca54a183d31c7b860afcf648)) * **TOP-211:** Listado: Error de visualización datos del paciente ([#3296](https://github.com/andes/app/issues/3296)) ([19e5ce7](https://github.com/andes/app/commit/19e5ce7cc493c18ccf3d58cea3eb345f64a68716)) --- .../mapa-camas/services/mapa-camas.http.ts | 6 +-- .../ingreso/ingresar-paciente.component.ts | 53 +++++++++++++------ 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/app/apps/rup/mapa-camas/services/mapa-camas.http.ts b/src/app/apps/rup/mapa-camas/services/mapa-camas.http.ts index e1590ddb4c..ab25723fb5 100644 --- a/src/app/apps/rup/mapa-camas/services/mapa-camas.http.ts +++ b/src/app/apps/rup/mapa-camas/services/mapa-camas.http.ts @@ -85,14 +85,14 @@ export class MapaCamasHTTP { } // [TODO] ver interfaz e ID - updateEstados(ambito: string, capa: string, fecha: Date, data): Observable { - const params = { + updateEstados(ambito: string, capa: string, fecha: Date, data, options: any = {}): Observable { + const body = { ...data, ambito: ambito, capa: capa, fecha }; - return this.server.patch(`${this.url}/camaEstados/${data._id}`, params); + return this.server.patch(`${this.url}/camaEstados/${data._id}`, body, { params: options }); } deshacerInternacion(ambito: string, capa: string, idInternacion: string, completo: boolean): Observable<{ status: boolean }> { diff --git a/src/app/apps/rup/mapa-camas/sidebar/ingreso/ingresar-paciente.component.ts b/src/app/apps/rup/mapa-camas/sidebar/ingreso/ingresar-paciente.component.ts index 3a849b1815..1de8c74d5d 100644 --- a/src/app/apps/rup/mapa-camas/sidebar/ingreso/ingresar-paciente.component.ts +++ b/src/app/apps/rup/mapa-camas/sidebar/ingreso/ingresar-paciente.component.ts @@ -1,7 +1,7 @@ import { Auth } from '@andes/auth'; import { Plex } from '@andes/plex'; import { Component, EventEmitter, OnDestroy, OnInit, Output, QueryList, ViewChildren } from '@angular/core'; -import { combineLatest, Observable, of, Subscription } from 'rxjs'; +import { combineLatest, forkJoin, Observable, of, Subscription } from 'rxjs'; import { auditTime, filter, map, switchMap, take } from 'rxjs/operators'; import { IPaciente } from 'src/app/core/mpi/interfaces/IPaciente'; import { ElementosRUPService } from 'src/app/modules/rup/services/elementosRUP.service'; @@ -25,6 +25,7 @@ import { cache } from '@andes/shared'; import { IMaquinaEstados } from '../../interfaces/IMaquinaEstados'; import { ListadoInternacionCapasService } from '../../views/listado-internacion-capas/listado-internacion-capas.service'; import { IObraSocial } from 'src/app/interfaces/IObraSocial'; +import { MapaCamasHTTP } from '../../services/mapa-camas.http'; @Component({ selector: 'app-ingresar-paciente', @@ -94,6 +95,7 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { private subscription2: Subscription; public selectedOS = false; public financiador; + public edicionFinanciador = false; public selectorFinanciadores: IObraSocial[] = []; public obrasSociales: IObraSocial[] = []; public OSPrivada = false; @@ -107,6 +109,7 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { private organizacionService: OrganizacionService, private servicioPrestacion: PrestacionesService, public mapaCamasService: MapaCamasService, + private camasHTTP: MapaCamasHTTP, private listadoInternacionService: ListadoInternacionService, private historialInternacionService: ListadoInternacionCapasService, private auth: Auth, @@ -472,25 +475,39 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { // Sincroniza las fechas editadas entre la cama y elresumen/prestacion private sincronizarCamaInternacion(idInternacion, fechaIngresoOriginal, fechaIngreso): Observable { - return this.mapaCamasService.snapshot(this.fechaIngresoOriginal, idInternacion).pipe( - switchMap(snapshot => { - const primeraCama = snapshot[0]; - return this.mapaCamasService.changeTime(primeraCama, fechaIngresoOriginal, fechaIngreso, idInternacion); - }), + const obs$ = (fechaIngresoOriginal.getTime() !== fechaIngreso.getTime()) ? + this.mapaCamasService.snapshot(this.fechaIngresoOriginal, idInternacion).pipe( + switchMap(snapshot => { + const primeraCama = snapshot[0]; + return this.mapaCamasService.changeTime(primeraCama, fechaIngresoOriginal, fechaIngreso, idInternacion); + }) + ) : of(this.cama); + + return obs$.pipe( switchMap(cama => { - if (!cama.id) { + if (!cama?.id) { // algun error en changeTime throw new Error(); } - if (this.capa === 'estadistica') { - return of(null); - } this.cama = cama; - // Prestacion creada por capa estadistica-v2. Puede estar siendo actualizada por medica/enfermeria - return this.internacionResumenService.update(cama.idInternacion, { - idPrestacion: this.prestacion?.id, - fechaIngreso: this.informeIngreso.fechaIngreso - }); + + const nextOps$: Observable[] = []; + if (this.capa === 'estadistica' && this.edicionFinanciador) { + nextOps$.push(this.camasHTTP.updateEstados(this.mapaCamasService.ambito, this.capa, this.informeIngreso.fechaIngreso, this.cama, { edicionFinanciador: true })); + } + + if (this.capa !== 'estadistica') { + // Prestacion creada por capa estadistica-v2. Puede estar siendo actualizada por medica/enfermeria + nextOps$.push(this.internacionResumenService.update(cama.idInternacion, { + idPrestacion: this.prestacion?.id, + fechaIngreso: this.informeIngreso.fechaIngreso + })); + } + + if (nextOps$.length > 0) { + return forkJoin(nextOps$).pipe(map(() => cama)); + } + return of(cama); }) ) as Observable; } @@ -510,7 +527,10 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { if (this.prestacion && this.poseeMovimientos) { // Se actualiza fecha y hora en camas this.cama.idInternacion = idInternacion; - if (this.informeIngreso.fechaIngreso.getTime() !== this.fechaIngresoOriginal.getTime()) { + const fechaChange = this.informeIngreso.fechaIngreso.getTime() !== this.fechaIngresoOriginal.getTime(); + const financiadorChange = this.capa === 'estadistica' && this.edicionFinanciador; + + if (fechaChange || financiadorChange) { // Recuperamos snapshot inicial, por si hay un cambio de cama this.sincronizarCamaInternacion(idInternacion, this.fechaIngresoOriginal, this.informeIngreso.fechaIngreso).subscribe(() => { this.plex.info('success', 'Los datos se actualizaron correctamente'); @@ -895,5 +915,6 @@ export class IngresarPacienteComponent implements OnInit, OnDestroy { financiador: financiadorSeleccionado.financiador }; } + this.edicionFinanciador = true; } }