Skip to content

Commit

Permalink
feat(HUDS): agrega historial de turnos de paciente
Browse files Browse the repository at this point in the history
  • Loading branch information
ma7payne committed Feb 6, 2023
1 parent 346ada9 commit 597af51
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/modules/rup/components/ejecucion/vistaHuds.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

</plex-tab>
</ng-container>

<plex-tab label="Historial de turnos" [allowClose]="false">
<historial-turnos [paciente]="paciente"></historial-turnos>
</plex-tab>
</plex-tabs>
</plex-tab>
<ng-container *ngFor="let registro of registros">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Component, Input, OnInit } from '@angular/core';
import { TurnoService } from 'src/app/services/turnos/turno.service';
import { IPaciente } from '../../../../core/mpi/interfaces/IPaciente';

@Component({
selector: 'historial-turnos',
templateUrl: 'vistaHistorialTurnos.html',
})

export class VistaHistorialTurnosComponent implements OnInit {
@Input() paciente: IPaciente;

historial;

constructor(
public serviceTurno: TurnoService,
) { }

ngOnInit() {
this.getHistorial();
}

private getHistorial() {
this.serviceTurno.getHistorial({ pacienteId: this.paciente.id }).subscribe(
turnos => this.historial = this.sortByHoraInicio(turnos)
);
}

private sortByHoraInicio(turnos: any[]) {
return turnos.sort((a, b) => {
const inia = a.horaInicio ? new Date(a.horaInicio) : null;
const inib = b.horaInicio ? new Date(b.horaInicio) : null;
return ((inia && inib) ? (inib.getTime() - inia.getTime()) : 0);
});
}
}
31 changes: 31 additions & 0 deletions src/app/modules/rup/components/huds/vistaHistorialTurnos.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<fieldset *plTab>
<ul class="list-group">
<li *ngFor="let turno of historial" class="list-group-item" [appHover]="'active'">
<div class="list-group-item-text">
<div>
<plex-badge *ngIf="turno.asistencia === 'noAsistio' && turno.estado !== 'suspendido'"
type="danger">NO ASISTIÓ</plex-badge>
<plex-badge *ngIf="turno.estado === 'fuera-agenda'" type="warning">
FUERA DE AGENDA</plex-badge>
<plex-badge *ngIf="turno.asistencia !== 'noAsistio' && (turno.estado === 'asignado' || turno.estado === 'turnoDoble')"
type="success">
ASIGNADO</plex-badge>
<plex-badge *ngIf="turno.estado === 'liberado' || turno.estado === 'suspendido' " type="danger">
{{turno.estado | uppercase}}</plex-badge>

| {{turno.horaInicio | date:'dd/MM/yyyy HH:mm'}}
</div>
<div *ngIf="turno.estado === 'liberado'">Por {{turno.updatedBy.nombreCompleto}} el
{{turno.updatedAt
| fecha}} a las {{turno.updatedAt | date: 'HH:mm'}}</div>
<div *ngIf="turno.tipoPrestacion?.term">{{turno.tipoPrestacion.term}}</div>
<div *ngFor="let profesional of turno.profesionales">
{{profesional | nombre}}
</div>
<div>
<em class="small">{{turno.organizacion.nombre}}</em>
</div>
</div>
</li>
</ul>
</fieldset>
3 changes: 3 additions & 0 deletions src/app/modules/rup/huds-lib.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { VistaRegistroComponent } from './components/huds/vistaRegistro';
import { VistaSolicitudTopComponent } from './components/huds/vistaSolicitudTop';
import { ElementosRUPModule } from './elementos-rup.module';
import { RUPLibModule } from './rup-lib.module';
import { VistaHistorialTurnosComponent } from './components/huds/vistaHistorialTurnos.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -60,6 +61,7 @@ import { RUPLibModule } from './rup-lib.module';
VistaDetalleRegistroComponent,
VistaAccesosHudsComponent,
VistaSolicitudTopComponent,
VistaHistorialTurnosComponent,
HudsBusquedaComponent,
ListadoInternacionHudsComponent
],
Expand All @@ -76,6 +78,7 @@ import { RUPLibModule } from './rup-lib.module';
VistaDetalleRegistroComponent,
VistaAccesosHudsComponent,
VistaSolicitudTopComponent,
VistaHistorialTurnosComponent,
HudsBusquedaComponent,
ListadoInternacionHudsComponent
],
Expand Down

0 comments on commit 597af51

Please sign in to comment.