diff --git a/src/app/modules/rup/components/core/rup.component.ts b/src/app/modules/rup/components/core/rup.component.ts
index bcb68cb7a8..5da53e3c37 100644
--- a/src/app/modules/rup/components/core/rup.component.ts
+++ b/src/app/modules/rup/components/core/rup.component.ts
@@ -35,6 +35,7 @@ import { PrestacionesService } from './../../services/prestaciones.service';
import { RecetaService } from '../../../../services/receta.service';
import { ECLQueriesService } from './../../../../services/eclqueries.service';
import { ObraSocialService } from 'src/app/services/obraSocial.service';
+import { InternacionResumenHTTP } from '../../../../apps/rup/mapa-camas/services/resumen-internacion.http';
@Component({
selector: 'rup',
@@ -162,7 +163,8 @@ export class RUPComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges
public recetasService: RecetaService,
public obraSocialService: ObraSocialService,
@Optional() public ejecucionService: RupEjecucionService,
- public eclqueriesServicies: ECLQueriesService
+ public eclqueriesServicies: ECLQueriesService,
+ public internacionResumenHTTP: InternacionResumenHTTP
) {
}
diff --git a/src/app/modules/rup/components/ejecucion/prestacionEjecucion.component.ts b/src/app/modules/rup/components/ejecucion/prestacionEjecucion.component.ts
index 1639ef32b4..ac3226b819 100644
--- a/src/app/modules/rup/components/ejecucion/prestacionEjecucion.component.ts
+++ b/src/app/modules/rup/components/ejecucion/prestacionEjecucion.component.ts
@@ -103,7 +103,8 @@ export class PrestacionEjecucionComponent implements OnInit, OnDestroy {
public alerta = 'Este registro no puede modificarse, si necesita cambiar una medicación prescripta puede suspender desde la HUDS y registrar una nueva.';
- private soloValores = ['33633005']; // prescripción de medicamento
+ private soloValores = ['33633005'];
+ conceptoSeleccionadoId: string;
constructor(
public servicioPrestacion: PrestacionesService,
@@ -243,6 +244,7 @@ export class PrestacionEjecucionComponent implements OnInit, OnDestroy {
} else if (registoExiste.id && registoExiste.valor) {
// Expandir sólo si no tienen algún valor
this.itemsRegistros[registoExiste.id].collapse = false;
+
}
}
}
@@ -751,11 +753,10 @@ export class PrestacionEjecucionComponent implements OnInit, OnDestroy {
});
}
- cambiaValorCollapse(indice) {
+ cambiaValorCollapse(indice: string) {
if (this.itemsRegistros[indice]) {
this.itemsRegistros[indice].collapse = !this.itemsRegistros[indice].collapse;
}
- // this.registrosColapsados();
}
toggleCollapse() {
diff --git a/src/app/modules/rup/components/ejecucion/prestacionEjecucion.html b/src/app/modules/rup/components/ejecucion/prestacionEjecucion.html
index 109d07ae73..5101f162f9 100644
--- a/src/app/modules/rup/components/ejecucion/prestacionEjecucion.html
+++ b/src/app/modules/rup/components/ejecucion/prestacionEjecucion.html
@@ -104,6 +104,7 @@
+
@@ -111,7 +112,6 @@
Registro Privado
-
1">
+ (click)="confirmarEliminarRegistro(registro, 'card')"
+ [disabled]="!puedeEliminar(registro)">
-
@@ -159,7 +159,6 @@
registro.concepto.semanticTag}}
-
@@ -172,6 +171,7 @@
[conceptosAsociados]="conceptosAsociados" [alerta]="alerta">
+
@@ -216,8 +216,6 @@
-
-
@@ -229,6 +227,7 @@
Mover a esta posición
+
@@ -265,7 +264,7 @@
-
@@ -308,9 +307,9 @@
-
-
+ label="Informe de Laboratorio">
+
+
diff --git a/src/app/modules/rup/components/elementos/historial.component.ts b/src/app/modules/rup/components/elementos/historial.component.ts
new file mode 100644
index 0000000000..dd123ebfbd
--- /dev/null
+++ b/src/app/modules/rup/components/elementos/historial.component.ts
@@ -0,0 +1,65 @@
+import { Component, OnInit, Input } from '@angular/core';
+import { map, switchMap } from 'rxjs/operators';
+import { RUPComponent } from '../core/rup.component';
+import { RupElement } from '.';
+import { of } from 'rxjs';
+import { PlexTextToolBar } from '@andes/plex';
+
+
+@Component({
+ selector: 'rup-historial',
+ styleUrls: ['./historial.scss'],
+ templateUrl: './historial.html'
+})
+@RupElement('HistorialComponent')
+export class HistorialComponent extends RUPComponent implements OnInit {
+
+ // Se usa por un bug en el quill-editor al ser cargado dinamicamente.
+ afterInit = false;
+ fullscreen = false;
+
+ public qlToolbar: PlexTextToolBar[] = [{
+ name: 'fullscreen',
+ handler: () => {
+ this.fullscreen = true;
+ }
+ }];
+
+ public historial: any[] = [];
+ public isLoading = false;
+ public verHistorial = false;
+ public fechaDesde = null;
+
+ decodeHtml(html: string) {
+ const txt = document.createElement('textarea');
+ txt.innerHTML = html;
+ return txt.value;
+ }
+ ngOnInit() {
+
+ const conceptId = this.registro?.concepto?.conceptId;
+
+ this.isLoading = true;
+
+ if (!this.soloValores) {
+ if (this.params.pacienteInternado && this.params.requiereFechaInicio) {
+
+ this.internacionResumenHTTP.search({ paciente: this.paciente.id }).subscribe(resumen => {
+
+ if (resumen.length && resumen[resumen.length - 1].fechaIngreso) {
+ this.fechaDesde = new Date(resumen[resumen.length - 1].fechaIngreso);
+ this.prestacionesService.getRegistrosHuds(this.paciente.id, conceptId, this.fechaDesde).subscribe(prestaciones => {
+ this.isLoading = false;
+ // Ver si tomamos el ultimo valor..
+ if (prestaciones.length) {
+ this.historial = prestaciones;
+ }
+
+ });
+ }
+ });
+ }
+ }
+ }
+
+}
diff --git a/src/app/modules/rup/components/elementos/historial.html b/src/app/modules/rup/components/elementos/historial.html
new file mode 100644
index 0000000000..5d6080945c
--- /dev/null
+++ b/src/app/modules/rup/components/elementos/historial.html
@@ -0,0 +1,37 @@
+
+
+ 0"
+ class="mx-4 d-flex flex-column justify-content-between h-100">
+
+
+ {{ item.fecha | date:'dd/MM/yyyy hh:mm a' }}
+
+
+
+
+
+
+
+
+Cargando historial...
+
+ No hay evoluciones previas registradas
+
\ No newline at end of file
diff --git a/src/app/modules/rup/components/elementos/historial.scss b/src/app/modules/rup/components/elementos/historial.scss
new file mode 100644
index 0000000000..66243c067d
--- /dev/null
+++ b/src/app/modules/rup/components/elementos/historial.scss
@@ -0,0 +1,35 @@
+.historial-item {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 8px 12px;
+ margin: 4px 0;
+}
+
+.historial-fecha {
+ border: 2px solid #000;
+ border-radius: 20px;
+ padding: 6px 12px;
+ font-weight: bold;
+ min-width: 130px;
+ text-align: center;
+ background-color: #fff;
+ flex-shrink: 0;
+ line-height: 1.2;
+}
+
+.historial-texto {
+ flex-grow: 1;
+ font-family: Arial, sans-serif;
+ font-weight: normal;
+ color: #444;
+ word-wrap: break-word;
+ margin-left: 5px;
+}
+
+
+.boton-historial {
+ text-align: center;
+ margin-top: 20px;
+ margin-bottom: 15px;
+}
\ No newline at end of file
diff --git a/src/app/modules/rup/rup.module.ts b/src/app/modules/rup/rup.module.ts
index 4ca60c8654..4a2488041b 100644
--- a/src/app/modules/rup/rup.module.ts
+++ b/src/app/modules/rup/rup.module.ts
@@ -28,6 +28,7 @@ import { RUPServicioIntermedioAltaComponent } from './components/servicio-interm
import { ElementosRUPModule } from './elementos-rup.module';
import { HUDSLibModule } from './huds-lib.module';
import { RUPLibModule } from './rup-lib.module';
+import { HistorialComponent } from './components/elementos/historial.component';
export const RUP_COMPONENTS = [
@@ -40,6 +41,7 @@ export const RUP_COMPONENTS = [
RupAsignarTurnoComponent,
AutocitarTurnoAgendasComponent,
RupRelacionesComponent,
+ HistorialComponent,
RUPServicioIntermedioAltaComponent
];
diff --git a/src/app/modules/rup/services/prestaciones.service.ts b/src/app/modules/rup/services/prestaciones.service.ts
index 92c27520cb..1f87c99a0e 100644
--- a/src/app/modules/rup/services/prestaciones.service.ts
+++ b/src/app/modules/rup/services/prestaciones.service.ts
@@ -1,3 +1,4 @@
+/* eslint-disable no-console */
import { map, switchMap } from 'rxjs/operators';
import { Injectable } from '@angular/core';
@@ -37,6 +38,8 @@ export class PrestacionesService {
conceptId: '32485007',
term: 'internación'
};
+ private nuevoValorSubject = new BehaviorSubject(null);
+ public nuevoValor$ = this.nuevoValorSubject.asObservable();
private prestacionesUrl = '/modules/rup/prestaciones'; // URL to web api
private cache: any[] = [];
@@ -75,6 +78,15 @@ export class PrestacionesService {
clearRefSetData() {
this.datosRefSet.next(null);
}
+ postNuevaEvolucion(idPrestacion: string, nuevaEvolucion: any): Observable {
+ const cambios = {
+ op: 'registros',
+ action: 'add',
+ registro: nuevaEvolucion
+ };
+ return this.server.patch(this.prestacionesUrl + '/' + idPrestacion, cambios);
+ }
+
constructor(
private server: Server,
@@ -224,9 +236,14 @@ export class PrestacionesService {
clearConceptosPaciente(idPaciente) {
this._cacheRegistros[idPaciente] = null;
}
+ emitirNuevoValor(valor: any) {
+ if (valor) {
+ this.nuevoValorSubject.next(valor);
+ console.log('Nuevo valor emitido desde PrestacionesService:', valor);
+ }
+ }
getConceptosByPaciente(idPaciente: string, soloValidados?: boolean): Observable {
-
if (this._cacheRegistros[idPaciente]) {
return new Observable(observe => observe.next(this._cacheRegistros[idPaciente]));
} else {
@@ -247,16 +264,14 @@ export class PrestacionesService {
}
});
-
if (prestacion.ejecucion) {
const conceptos = prestacion.ejecucion.registros
- // .filter(registro => semanticTags.includes(registro.concepto.semanticTag))
.map(registro => {
registro.idPrestacion = prestacion.id;
registro.tipoPrestacion = prestacion.solicitud.tipoPrestacion.term;
return registro;
});
- // ConceptId del informe requerido en en todas las prestaciones ambulatorias
+
if (conceptos.length > 0) {
conceptos[0].informeRequerido = prestacion.ejecucion.registros.find(r => r.concepto.conceptId === PrestacionesService.InformeDelEncuentro);
}
@@ -301,7 +316,6 @@ export class PrestacionesService {
.filter(r => r.id)
.map(r => {
r.fechaCarga = prestacion.ejecucion.fecha; return r;
-
}),
valor: registro.valor
}],
@@ -326,14 +340,16 @@ export class PrestacionesService {
relacionadoCon: (registro.relacionadoCon ? registro.relacionadoCon : [])
.filter(r => r.id)
.map(r => {
- r.fechaCarga = prestacion.ejecucion.fecha; return r;
+ r.fechaCarga = prestacion.ejecucion.fecha;
+ return r;
}),
valor: registro.valor
};
+
registroEncontrado.prestaciones.push(registro.idPrestacion);
registroEncontrado.evoluciones.push(nuevaEvolucion);
registroEncontrado.registros.push(registro);
- // ordenamos las evoluciones para que la primero del array sea la ultima registrada
+
registroEncontrado.evoluciones = registroEncontrado.evoluciones.sort((a, b) => b.fechaCarga - a.fechaCarga);
registroEncontrado.privacy = (registro.privacy && registro.privacy.scope) ? registro.privacy.scope : 'public';
}
@@ -455,14 +471,14 @@ export class PrestacionesService {
* @returns {any[]} Prestaciones del paciente que coincidan con los conceptIds
* @memberof PrestacionesService
*/
- getRegistrosHuds(idPaciente: string, expresion, deadLine = null, valor = null, searchTerm = null, form = null) {
+ getRegistrosHuds(idPaciente: string, expresion, deadline = null, valor = null, searchTerm = null, form = null) {
const opt = {
params: {
valor,
expresion,
searchTerm,
form,
- deadLine,
+ deadline,
hudsToken: this.hudsService.getHudsToken()
},
options: {