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
65 changes: 47 additions & 18 deletions modules/descargas/informe-rup/informe-footer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Profesional } from '../../../core/tm/schemas/profesional';
import { searchMatriculas } from '../../../core/tm/controller/profesional';
import { HTMLComponent } from '../model/html-component.class';
import { loadImage } from '../model/informe.class';
import * as moment from 'moment';
Expand All @@ -12,6 +14,20 @@ export class InformeRupFooter extends HTMLComponent {
<article class="contenedor-data-pdp">
<h6>Nota: {{{ notaPie }}} </h6>
</article>
<article class="contenedor-data-validacion">
{{#if validacion}}
<h6 class="bolder">Validado por:</h6>
<h6>
{{ validacion.usuario }}
</h6>
<div class="matriculas-grid">
{{{ validacion.matriculas }}}
</div>
<h6>
{{ validacion.fecha }}hs
</h6>
{{/if}}
</article>
<article class="contenedor-data-organizacion">
<h6>
{{{ organizacion.nombre }}}
Expand All @@ -29,17 +45,6 @@ export class InformeRupFooter extends HTMLComponent {
{{ hora }}hs
</h6>
</article>
<article class="contenedor-data-validacion">
{{#if validacion}}
<h6 class="bolder">Validado por:</h6>
<h6>
{{ validacion.usuario }}
</h6>
<h6>
{{ validacion.fecha }}hs
</h6>
{{/if}}
</article>
<hr>
<span class="numeracion">
{{{ numeracionHTML }}}
Expand All @@ -49,36 +54,60 @@ export class InformeRupFooter extends HTMLComponent {

constructor(public prestacion, public paciente, public organizacion, public user) {
super();
}

public async process() {
const validacion = await this.getDatosValidacion();

this.data = {
usuario: user.usuario,
usuario: this.user.usuario,
organizacion: {
nombre: organizacion ? organizacion.nombre.replace(' - ', '</br>') : '',
direccion: organizacion ? organizacion.direccion.valor + ', ' + organizacion.direccion.ubicacion.localidad.nombre : ''
nombre: this.organizacion ? this.organizacion.nombre.replace(' - ', '</br>') : '',
direccion: this.organizacion ? this.organizacion.direccion.valor + ', ' + this.organizacion.direccion.ubicacion.localidad.nombre : ''
},
hora: moment().format('DD/MM/YYYY HH:mm'),
logos: {
pdp: loadImage('templates/rup/informes/img/logo-pdp.png'),
},
validacion: this.getDatosValidacion(),
validacion,
numeracionHTML: '<small> {{page}} </small> de <small> {{pages}} </small>',
notaPie: organizacion.configuraciones?.notaAlPie || InformeRupFooter.notaAlPieDefault
notaPie: this.organizacion.configuraciones?.notaAlPie || InformeRupFooter.notaAlPieDefault
};
}

getDatosValidacion() {
async getDatosValidacion() {
const lastState = this.prestacion.estados[this.prestacion.estados.length - 1];
const esValidada = lastState.tipo === 'validada';
let matriculas;
const searchProfesional: any = await Profesional.findOne({ documento: lastState.createdBy.documento });

if (searchProfesional) {
matriculas = await this.getMatriculas(searchProfesional);
}

if (esValidada) {
return {
usuario: lastState.createdBy.nombreCompleto,
fecha: moment(lastState.createdAt).format('DD/MM/YYYY HH:mm')
fecha: moment(lastState.createdAt).format('DD/MM/YYYY HH:mm'),
matriculas
};
}
return null;
}

private async getMatriculas(profesional) {
const infoMatriculas = await searchMatriculas(profesional.id);

const grado = infoMatriculas.formacionGrado.map(e => {
return `${e.nombre} MP ${e.numero}`;
});
const posgrado = infoMatriculas.formacionPosgrado.map(e => {
return `${e.nombre} ME ${e.numero}`;
});

return [...grado, ...posgrado].join(' - ');
}

static readonly notaAlPieDefault = `El contenido de este informe ha sido validado digitalmente siguiendo los estándares de
calidad y seguridad
requeridos. El ministerio de salud de la provincia de Neuquén es responsable inscripto en el
Expand Down
38 changes: 29 additions & 9 deletions templates/rup/informes/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ main {
font-weight: 400;
}

.nivel-1 p:first-child, .nivel-2 p:first-child, .nivel-3 p:first-child {
.nivel-1 p:first-child,
.nivel-2 p:first-child,
.nivel-3 p:first-child {
text-transform: capitalize;
}

Expand All @@ -258,7 +260,7 @@ main {
margin-left: 0em;
}


.nivel-2:not(:first-child) {
margin-left: 1em;
width: 100%;
Expand All @@ -275,15 +277,15 @@ main {
}

}

.nivel-3 {
margin-left: 2em;
}

.adjunto {
padding: .2cm 0;
// border-bottom: 1px solid rgba(0, 0, 0, 0.25);

small {
font-size: 0.25cm;
}
Expand Down Expand Up @@ -358,7 +360,6 @@ footer {
width: 37%;
display: inline-block;
margin-left: 0.5cm;
text-align: justify;
}

.contenedor-data-pdpCenso {
Expand All @@ -369,19 +370,38 @@ footer {
}

.contenedor-data-impresion,
.contenedor-data-validacion,
.contenedor-data-organizacion {
// display: inline-block;
float: right;
max-width: 2.25cm;
margin-left: 0; // text-align: right;
margin-left: 0.25cm;
}

.contenedor-data-organizacion {
text-align: left;
}

.contenedor-data-validacion {
width: 25%;
display: inline-block;
margin-left: 0.25cm;
text-align: justify;
}

.matriculas-grid {
column-count: 2;
column-gap: 4px;
font-size: 9px;
line-height: 1.1;
margin-top: 4px;
}

.matriculas-grid h6,
.matriculas-grid p,
.matriculas-grid span {
margin: 0;
padding: 0;
}

.numeracion {
// display: inline-block;
float: right;
Expand Down