Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/app/modules/rup/components/core/rup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

}
}
}
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@
</div>
</ng-container>
</div>

</div>
<div class="actions"
*ngIf="!confirmarDesvincular[registro.id] && (!confirmarEliminar || (confirmarEliminar && indexEliminar != i) )">

<ng-container *ngIf="registro?.privacy?.scope !== 'public'">
<plex-badge type="info">Registro Privado</plex-badge>
</ng-container>

<ng-container
*ngIf="prestacion?.ejecucion?.registros !== null && prestacion?.ejecucion?.registros?.length > 1">
<plex-dropdown type="primary" class="dropdown-inline" [right]="true"
Expand Down Expand Up @@ -141,11 +141,11 @@

<plex-button *ngIf="!existe(registro.concepto);" size="sm" type="danger"
icon="delete"
(click)="confirmarEliminarRegistro(registro, 'card')" [disabled]="!puedeEliminar(registro)">
(click)="confirmarEliminarRegistro(registro, 'card')"
[disabled]="!puedeEliminar(registro)">
</plex-button>
</div>
</div>

<div class="rup-body" (click)="recuperaLosMasFrecuentes(registro.concepto)"
[hidden]="itemsRegistros[registro.id]?.collapse || confirmarEliminar || confirmarDesvincular[registro.id]">
<!-- ... Header -->
Expand All @@ -159,7 +159,6 @@
registro.concepto.semanticTag}}
</span>
</div>

<!-- ... Body -->
<div class="content"
*ngIf="paciente || (prestacion.solicitud.tipoPrestacion.noNominalizada)">
Expand All @@ -172,6 +171,7 @@
[conceptosAsociados]="conceptosAsociados" [alerta]="alerta">
</rup>
</div>

</div>

<!-- Footer del registro -->
Expand Down Expand Up @@ -216,8 +216,6 @@
</div>
</div>
</div>


</ng-container>

<!-- Drop area -->
Expand All @@ -229,6 +227,7 @@
Mover a esta posición
</div>
</div>

</plex-tab>

<plex-tab label="Resumen del Paciente" *ngIf="paciente && tieneAccesoHUDS">
Expand Down Expand Up @@ -265,7 +264,7 @@
<plex-tab [allowClose]="true" [label]="registro.data.concepto.term"
[class]="registro.data.class" [color]="registro.data.class"
*ngIf="registro.tipo === 'concepto'">
<detalle-registro *ngIf="registro.data.class === 'situación' ||
<detalle-registro *="registro.data.class === 'situación' ||
registro.data.class === 'hallazgo' || registro.data.class === 'trastorno'"
[registro]="registro.data" [paciente]="paciente">
</detalle-registro>
Expand Down Expand Up @@ -308,9 +307,9 @@
</plex-tab>

<plex-tab *ngIf="registro.tipo === 'laboratorio'" [allowClose]="true"
label="Informe de Laboratorio">
<vista-laboratorio [protocolo]="registro"></vista-laboratorio>
</plex-tab>
label="Informe de Laboratorio">
<vista-laboratorio [protocolo]="registro"></vista-laboratorio>
</plex-tab>

<plex-tab *ngIf="registro.tipo === 'receta'" color="receta" class="tab-receta"
[allowClose]="true" [label]="recetaService.getLabel(registro.data.recetas)">
Expand Down
65 changes: 65 additions & 0 deletions src/app/modules/rup/components/elementos/historial.component.ts
Original file line number Diff line number Diff line change
@@ -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;
}

});
}
});
}
}
}

}
37 changes: 37 additions & 0 deletions src/app/modules/rup/components/elementos/historial.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<form #form="ngForm">
<div class="row flex-column">
<div class="col-12">
<ng-container *ngIf="!soloValores">
<plex-text [label]="params?.titulo" [html]="true" [(ngModel)]="registro.valor" name="observaciones"
[required]="params?.required" [qlToolbar]="qlToolbar"> </plex-text>
</ng-container>

<p *ngIf="soloValores" class="readonly">
<span [innerHTML]="registro.valor"></span>
</p>
</div>
</div>
</form>
<div *ngIf="!soloValores" class="boton-historial">
<plex-button (click)="verHistorial = !verHistorial"
size="sm" type="primary" class="collapse-card"
label="{{ !verHistorial ? 'Ver historial' : 'Ocultar historial' }}">
</plex-button>
</div>
<section *ngIf="!isLoading && verHistorial && historial.length > 0"
class="mx-4 d-flex flex-column justify-content-between h-100">
<div *ngFor="let item of historial" class="historial-item">
<div class="historial-fecha">
{{ item.fecha | date:'dd/MM/yyyy hh:mm a' }}
</div>

<div class="historial-texto" [innerHTML]="decodeHtml(item.registro.valor)">
</div>
</div>


</section>
<div *ngIf="isLoading && verHistorial">Cargando historial...</div>
<div *ngIf="!isLoading && verHistorial && historial.length === 0">
<em>No hay evoluciones previas registradas</em>
</div>
35 changes: 35 additions & 0 deletions src/app/modules/rup/components/elementos/historial.scss
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 2 additions & 0 deletions src/app/modules/rup/rup.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -40,6 +41,7 @@ export const RUP_COMPONENTS = [
RupAsignarTurnoComponent,
AutocitarTurnoAgendasComponent,
RupRelacionesComponent,
HistorialComponent,
RUPServicioIntermedioAltaComponent
];

Expand Down
34 changes: 25 additions & 9 deletions src/app/modules/rup/services/prestaciones.service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */

import { map, switchMap } from 'rxjs/operators';
import { Injectable } from '@angular/core';
Expand Down Expand Up @@ -37,6 +38,8 @@ export class PrestacionesService {
conceptId: '32485007',
term: 'internación'
};
private nuevoValorSubject = new BehaviorSubject<any>(null);
public nuevoValor$ = this.nuevoValorSubject.asObservable();

private prestacionesUrl = '/modules/rup/prestaciones'; // URL to web api
private cache: any[] = [];
Expand Down Expand Up @@ -75,6 +78,15 @@ export class PrestacionesService {
clearRefSetData() {
this.datosRefSet.next(null);
}
postNuevaEvolucion(idPrestacion: string, nuevaEvolucion: any): Observable<any> {
const cambios = {
op: 'registros',
action: 'add',
registro: nuevaEvolucion
};
return this.server.patch(this.prestacionesUrl + '/' + idPrestacion, cambios);
}


constructor(
private server: Server,
Expand Down Expand Up @@ -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<any[]> {

if (this._cacheRegistros[idPaciente]) {
return new Observable(observe => observe.next(this._cacheRegistros[idPaciente]));
} else {
Expand All @@ -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);
}
Expand Down Expand Up @@ -301,7 +316,6 @@ export class PrestacionesService {
.filter(r => r.id)
.map(r => {
r.fechaCarga = prestacion.ejecucion.fecha; return r;

}),
valor: registro.valor
}],
Expand All @@ -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';
}
Expand Down Expand Up @@ -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: {
Expand Down
Loading