Skip to content

Commit

Permalink
RUP - Componente para visualización de alergias (#2685)
Browse files Browse the repository at this point in the history
* feat(rup): componente para visualizar alergias del paciente

* correcciones
  • Loading branch information
negro89 authored Aug 19, 2022
1 parent 30807d4 commit c3348b7
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Component, OnInit, Input } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { PrestacionesService } from '../../../../../modules/rup/services/prestaciones.service';
import { IPaciente } from '../../../../../core/mpi/interfaces/IPaciente';

@Component ({
selector: 'alergias-paciente',
templateUrl: './alergias-paciente.html',
styles: [`
.bordered {
width: 175px;
height: 36px;
border: #ff8d22 solid 1px;
}
`]
})
export class AlergiasPacienteComponent implements OnInit {
@Input() paciente: IPaciente;
@Input() cardSize: 'half' | 'full' = 'half';

public registrosAlergia$: Observable<any[]>;
private expression = '<<39579001 OR <<419199007';

constructor(
private prestacionesService: PrestacionesService
) {}

ngOnInit() {
this.registrosAlergia$ = this.prestacionesService.getRegistrosHuds(this.paciente.id, this.expression, null, null, null, 'inferred').pipe(
map(alergias => alergias.map(a => {
return {
nombre: a.registro.nombre,
evolucion: a.registro.valor.evolucion?.replace(/<[/]*p>/gi, ' '),
fechaInicio: a.registro.valor.fechaInicio
};
})
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<ng-container *ngIf="(registrosAlergia$ | async) as alergias">
<div *ngIf="alergias.length" class="mr-1 bordered" justify="between">
<plex-label class="ml-2" titulo="Paciente alérgico" [tituloBold]="false" subtitulo="" type="warning" size="md">
</plex-label>
<plex-help size="md" btnType="warning" [cardSize]="cardSize" icon="alert-circle-outline">
<plex-table size="sm">
<tr *ngFor="let registro of alergias">
<td>
<plex-label grow="4" titulo="{{ registro.nombre }}" subtitulo="{{ registro.fechaInicio | fecha }}"></plex-label>
</td>
<td *ngIf="registro.evolucion?.length">
<plex-label>
<b class="mr-1">Evolución:</b>
<div [innerHtml]="registro.evolucion"></div>
</plex-label>
</td>
<td *ngIf="!registro.evolucion?.length">
<plex-label>Sin observaciones</plex-label>
</td>
</tr>
</plex-table>
</plex-help>
</div>
</ng-container>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<plex-layout [main]="indicacionView || indicacionEventoSelected || nuevaIndicacion || suspenderIndicacion ? 8 : 12">
<plex-layout [main]="sidebarOpen ? 8 : 12">
<plex-layout-main>
<plex-title titulo="Plan de indicaciones" main>
<alergias-paciente *ngIf="paciente" [paciente]="paciente" [cardSize]="sidebarOpen ? 'full' : 'half'"></alergias-paciente>
<plex-datetime [(ngModel)]="fecha" skipBy="day" type="date" (change)="onDateChange()" [max]="hoy">
</plex-datetime>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { ActivatedRoute, Router } from '@angular/router';
import { BehaviorSubject, forkJoin, Observable } from 'rxjs';
import { map, tap } from 'rxjs/operators';
import { HeaderPacienteComponent } from 'src/app/components/paciente/headerPaciente.component';
import { IPaciente } from 'src/app/core/mpi/interfaces/IPaciente';
import { PacienteService } from 'src/app/core/mpi/services/paciente.service';
import { RupEjecucionService } from 'src/app/modules/rup/services/ejecucion.service';
import { ElementosRUPService } from 'src/app/modules/rup/services/elementosRUP.service';
import { HUDSService } from 'src/app/modules/rup/services/huds.service';
import { PrestacionesService } from '../../../../../modules/rup/services/prestaciones.service';
import { MaquinaEstadosHTTP } from '../../services/maquina-estados.http';
Expand All @@ -28,7 +28,7 @@ export class PlanIndicacionesComponent implements OnInit {
private capa: string;
private ambito: string;
private idInternacion: string;
private paciente: any;
public paciente: any;
public indicacion;
public fecha = new Date();
public hoy = new Date();
Expand All @@ -37,18 +37,10 @@ export class PlanIndicacionesComponent implements OnInit {
public horas = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5];
public indicaciones = [];
public selectedIndicacion = {};
private selectedBuffer = new BehaviorSubject({});

private seccion = true;

public suspenderIndicacion: Boolean;
public showSecciones = {

};

public showSecciones = {};
public isToday = true;

private internacion;
private selectedBuffer = new BehaviorSubject({});
private botones$ = this.selectedBuffer.pipe(
map(selected => {
const indicaciones = Object.keys(selected)
Expand All @@ -58,6 +50,10 @@ export class PlanIndicacionesComponent implements OnInit {
})
);

get sidebarOpen() {
return this.indicacionView || this.indicacionEventoSelected || this.nuevaIndicacion || this.suspenderIndicacion;
}

public detener$ = this.botones$.pipe(
map(indicaciones => {
const b = indicaciones.length > 0 && indicaciones.every(ind => ind.estado.tipo === 'active' || ind.estado.tipo === 'on-hold' || ind.estado.tipo === 'pending');
Expand Down Expand Up @@ -104,9 +100,8 @@ export class PlanIndicacionesComponent implements OnInit {
private hudsService: HUDSService,
private auth: Auth,
private maquinaEstadoService: MaquinaEstadosHTTP,
private elementoRUPService: ElementosRUPService,
public ejecucionService: RupEjecucionService,
private router: Router
private router: Router,
public ejecucionService: RupEjecucionService
) { }


Expand All @@ -115,13 +110,11 @@ export class PlanIndicacionesComponent implements OnInit {
this.ambito = this.route.snapshot.paramMap.get('ambito');
this.idInternacion = this.route.snapshot.paramMap.get('idInternacion');
this.getInternacion().subscribe((resumen) => {
this.internacion = resumen;
this.pacienteService.getById(resumen.paciente.id).subscribe(paciente => {
this.paciente = paciente;
this.plex.setNavbarItem(HeaderPacienteComponent, { paciente });
});
this.actualizar();

});

this.maquinaEstadoService.getAll(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { PlanIndicacionesBotoneraComponent } from './indicaciones-botonera/indic
import { PlanIndicacionesNuevaIndicacionComponent } from './nueva-indicacion/nueva-indicacion.component';
import { PlanIndicacionesComponent } from './plan-indicaciones.component';
import { SuspensionIndicacionComponent } from './motivo-suspension/motivo-suspension.component';
import { AlergiasPacienteComponent } from './alergias-paciente.component';

@NgModule({
imports: [
Expand All @@ -35,12 +36,15 @@ import { SuspensionIndicacionComponent } from './motivo-suspension/motivo-suspen
PlanIndicacionesBotoneraComponent,
PlanIndicacionesNuevaIndicacionComponent,
SuspensionIndicacionComponent,
DetalleIndicacionPipe
DetalleIndicacionPipe,
AlergiasPacienteComponent
],
exports: [
IndicacionColorPipe,
IndicacionLabelPipe,
PlanIndicacionesResumenComponent
PlanIndicacionesResumenComponent,
AlergiasPacienteComponent,
SuspensionIndicacionComponent
],
providers: [
{ provide: RupEjecucionService, useClass: PlanIndicacionesServices }
Expand Down
10 changes: 6 additions & 4 deletions src/app/modules/rup/services/prestaciones.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,14 @@ export class PrestacionesService {
* @returns {any[]} Prestaciones del paciente que coincidan con los conceptIds
* @memberof PrestacionesService
*/
getRegistrosHuds(idPaciente: string, expresion, deadLine = null, valor = null) {
getRegistrosHuds(idPaciente: string, expresion, deadLine = null, valor = null, searchTerm = null, form = null) {
const opt = {
params: {
'valor': valor,
'expresion': expresion,
'deadLine': deadLine,
valor,
expresion,
searchTerm,
form,
deadLine,
hudsToken: this.hudsService.getHudsToken()
},
options: {
Expand Down

0 comments on commit c3348b7

Please sign in to comment.