1+ import { Profesional } from '../../../core/tm/schemas/profesional' ;
2+ import { searchMatriculas } from '../../../core/tm/controller/profesional' ;
13import { HTMLComponent } from '../model/html-component.class' ;
24import { loadImage } from '../model/informe.class' ;
35import * as moment from 'moment' ;
@@ -35,6 +37,9 @@ export class InformeRupFooter extends HTMLComponent {
3537 <h6>
3638 {{ validacion.usuario }}
3739 </h6>
40+ <div class="matriculas-grid">
41+ {{{ validacion.matriculas }}}
42+ </div>
3843 <h6>
3944 {{ validacion.fecha }}hs
4045 </h6>
@@ -49,36 +54,60 @@ export class InformeRupFooter extends HTMLComponent {
4954
5055 constructor ( public prestacion , public paciente , public organizacion , public user ) {
5156 super ( ) ;
57+ }
5258
59+ public async process ( ) {
60+ const validacion = await this . getDatosValidacion ( ) ;
5361
5462 this . data = {
55- usuario : user . usuario ,
63+ usuario : this . user . usuario ,
5664 organizacion : {
57- nombre : organizacion ? organizacion . nombre . replace ( ' - ' , '</br>' ) : '' ,
58- direccion : organizacion ? organizacion . direccion . valor + ', ' + organizacion . direccion . ubicacion . localidad . nombre : ''
65+ nombre : this . organizacion ? this . organizacion . nombre . replace ( ' - ' , '</br>' ) : '' ,
66+ direccion : this . organizacion ? this . organizacion . direccion . valor + ', ' + this . organizacion . direccion . ubicacion . localidad . nombre : ''
5967 } ,
6068 hora : moment ( ) . format ( 'DD/MM/YYYY HH:mm' ) ,
6169 logos : {
6270 pdp : loadImage ( 'templates/rup/informes/img/logo-pdp.png' ) ,
6371 } ,
64- validacion : this . getDatosValidacion ( ) ,
72+ validacion,
6573 numeracionHTML : '<small> {{page}} </small> de <small> {{pages}} </small>' ,
66- notaPie : organizacion . configuraciones ?. notaAlPie || InformeRupFooter . notaAlPieDefault
74+ notaPie : this . organizacion . configuraciones ?. notaAlPie || InformeRupFooter . notaAlPieDefault
6775 } ;
6876 }
6977
70- getDatosValidacion ( ) {
78+ async getDatosValidacion ( ) {
7179 const lastState = this . prestacion . estados [ this . prestacion . estados . length - 1 ] ;
7280 const esValidada = lastState . tipo === 'validada' ;
81+ let matriculas ;
82+ const searchProfesional : any = await Profesional . findOne ( { documento : lastState . createdBy . documento } ) ;
83+
84+ if ( searchProfesional ) {
85+ matriculas = await this . getMatriculas ( searchProfesional ) ;
86+ }
87+
7388 if ( esValidada ) {
7489 return {
7590 usuario : lastState . createdBy . nombreCompleto ,
76- fecha : moment ( lastState . createdAt ) . format ( 'DD/MM/YYYY HH:mm' )
91+ fecha : moment ( lastState . createdAt ) . format ( 'DD/MM/YYYY HH:mm' ) ,
92+ matriculas
7793 } ;
7894 }
7995 return null ;
8096 }
8197
98+ private async getMatriculas ( profesional ) {
99+ const infoMatriculas = await searchMatriculas ( profesional . id ) ;
100+
101+ const grado = infoMatriculas . formacionGrado . map ( e => {
102+ return `${ e . nombre } MP ${ e . numero } `
103+ } ) ;
104+ const posgrado = infoMatriculas . formacionPosgrado . map ( e => {
105+ return `${ e . nombre } ME ${ e . numero } `
106+ } ) ;
107+
108+ return [ ...grado , ...posgrado ] . join ( ' - ' ) ;
109+ }
110+
82111 static readonly notaAlPieDefault = `El contenido de este informe ha sido validado digitalmente siguiendo los estándares de
83112calidad y seguridad
84113requeridos. El ministerio de salud de la provincia de Neuquén es responsable inscripto en el
0 commit comments