diff --git a/modules/descargas/informe-rup/informe-footer.ts b/modules/descargas/informe-rup/informe-footer.ts index 78a33d8db1..dff09e83d1 100644 --- a/modules/descargas/informe-rup/informe-footer.ts +++ b/modules/descargas/informe-rup/informe-footer.ts @@ -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'; @@ -29,17 +31,21 @@ export class InformeRupFooter extends HTMLComponent { {{ hora }}hs -
+
{{#if validacion}}
Validado por:
{{ validacion.usuario }}
+
+ {{{ validacion.matriculas }}} +
{{ validacion.fecha }}hs
{{/if}}
+
{{{ numeracionHTML }}} @@ -49,36 +55,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(' - ', '
') : '', - direccion: organizacion ? organizacion.direccion.valor + ', ' + organizacion.direccion.ubicacion.localidad.nombre : '' + nombre: this.organizacion ? this.organizacion.nombre.replace(' - ', '
') : '', + 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: ' {{page}} de {{pages}} ', - 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 diff --git a/templates/rup/informes/sass/main.scss b/templates/rup/informes/sass/main.scss index 9c1ad2c349..5c552f1b13 100644 --- a/templates/rup/informes/sass/main.scss +++ b/templates/rup/informes/sass/main.scss @@ -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; } @@ -258,7 +260,7 @@ main { margin-left: 0em; } - + .nivel-2:not(:first-child) { margin-left: 1em; width: 100%; @@ -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; } @@ -369,12 +371,9 @@ 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; } @@ -382,6 +381,7 @@ footer { text-align: left; } + .numeracion { // display: inline-block; float: right;