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
7 changes: 5 additions & 2 deletions modules/cda/routes/cda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ router.post('/createInformeCDA', Auth.authenticate(), async (req: any, res, next
}
try {
const informe = new InformeCDA(req.body, req.user.usuario);
const fileName = await informe.informe();
return res.download(fileName);
const pdfBuffer = await informe.informe();

res.setHeader('Content-Type', 'application/pdf');
res.setHeader('Content-Disposition', 'inline; filename="informe.pdf"');
return res.send(pdfBuffer);
} catch (err) {
return next(err);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const moment = require('moment');
export async function sendMailComprobanteDerivacion(derivacion, to) {
const body = { derivacionId: derivacion._id };
const comprobante = new Derivacion({ body });
const opciones = { header: { height: '3cm' } };
const opciones = { margin: { top: '3cm' } };
const fileName: any = await comprobante.informe(opciones);
const fechaFinalizacion = moment(derivacion.historial.createdAt).format('DD/MM/YYYY');

Expand Down
20 changes: 11 additions & 9 deletions modules/descargas/ficha-epidemiologica/ficha-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ export class FichaEpidemiologicaBody extends HTMLComponent {
template = `
<main>
<p class="texto-centrado">FICHA {{tipo}}</p>
{{#each arreSecciones}}
<h6><u>{{seccionNombre}}:</u></h6>
{{#each arreFields}}
{{#if fieldValor.nombre}}
<p><b>{{fieldNombre}}:</b> {{fieldValor.nombre}}</p>
{{else}}
<p><b>{{fieldNombre}}:</b> {{fieldValor}}</p>
{{/if}}
<section class="contenedor-secundario">
{{#each arreSecciones}}
<h6><u>{{seccionNombre}}:</u></h6>
{{#each arreFields}}
{{#if fieldValor.nombre}}
<p><b>{{fieldNombre}}:</b> {{fieldValor.nombre}}</p>
{{else}}
<p><b>{{fieldNombre}}:</b> {{fieldValor}}</p>
{{/if}}
{{/each}}
{{/each}}
{{/each}}
</section>
</main>
`;

Expand Down
6 changes: 4 additions & 2 deletions modules/descargas/ficha-epidemiologica/ficha-footer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import * as moment from 'moment';
export class FichaEpidemiologicaFooter extends HTMLComponent {
template = `
<hr>
<div class="foot"> <b>Fecha y hora de impresión: </b>{{fecha}} </div>
<div class="foot"> <b>Impreso por: </b>{{usuario}} </div>
<span class="foot">
<p><b>Fecha y hora de impresión: </b>{{fecha}}</p>
<p><b>Impreso por: </b>{{usuario}}</p>
</span>
`;

constructor(public usuario) {
Expand Down
28 changes: 14 additions & 14 deletions modules/descargas/informe-censo/censo-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class CensoBody extends HTMLComponent {
<!-- Body -->
<main>
<section class="contenedor-informe">
<table class="table table-bordered">
<table class="resumen table table-bordered">
<thead>
<tr>
<th>Paciente</th>
Expand Down Expand Up @@ -81,45 +81,45 @@ export class CensoBody extends HTMLComponent {
<thead>
<tr>
<th rowspan="2">
<h6>Existencia a las 0 hs</h6>
Existencia a las 0 hs
</th>
<th rowspan="2">
<h6>Ingresos</h6>
Ingresos
</th>
<th rowspan="2">
<h6>Pases de</h6>
Pases de
</th>
<th colspan="2">
<h6>Egreso</h6>
Egreso
</th>
<th rowspan="2">
<h6>Pases A</h6>
Pases A
</th>
<th rowspan="2">
<h6>Existencia a las 24 hs</h6>
Existencia a las 24 hs
</th>
<th rowspan="2">
<h6>Ingresos y egresos del día</h6>
Ingresos y egresos del día
</th>
<th rowspan="2">
<h6>Pacientes día</h6>
Pacientes día
</th>
<!-- <th rowspan="2">
<h6>Camas disponibles a las 0hs</h6>
Camas disponibles a las 0hs
</th> -->
<th rowspan="2">
<h6>Días estada</h6>
Días estada
</th>
<th rowspan="2">
<h6>Camas disponibles a las 24hs</h6>
Camas disponibles a las 24hs
</th>
</tr>
<tr>
<th>
<h6>Altas</h6>
Altas
</th>
<th>
<h6>Defunciones</h6>
Defunciones
</th>
</tr>
</thead>
Expand Down
6 changes: 4 additions & 2 deletions modules/descargas/informe-censo/censo-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ export class CensoHeader extends HTMLComponent {
{{/if}}
</span>
<span class="contenedor-logos-secundarios">
<img class="logo-adicional" src="data:image/png;base64,{{ logos.logoAdicional }}">
<img class="logo-andes" src="data:image/png;base64,{{ logos.logoAndes }}">
<img class="logo-adicional" src="data:image/png;base64,{{ logos.adicional }}">
<img class="logo-andes" src="data:image/png;base64,{{ logos.andes }}">
</span>
</section>
<section class="contenedor-data-origen">
<hr>
<span class="contenedor-principal-data">
<div class="contenedor-secundario">
<h4>
Expand All @@ -34,6 +35,7 @@ export class CensoHeader extends HTMLComponent {
</h5>
</div>
</span>
<hr>
</section>
`;

Expand Down
54 changes: 27 additions & 27 deletions modules/descargas/informe-censo/censo-mensual-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,45 @@ export class CensoMensualBody extends HTMLComponent {
<thead>
<tr>
<th rowspan="2">
<h6>Fecha</h6>
Fecha
</th>
<th rowspan="2">
<h6>Existencia 0 hs</h6>
Existencia 0 hs
</th>
<th rowspan="2">
<h6>Ingresos</h6>
Ingresos
</th>
<th rowspan="2">
<h6>Pases de</h6>
Pases de
</th>
<th colspan="2">
<h6>Egreso</h6>
Egreso
</th>
<th rowspan="2">
<h6>Pases A</h6>
Pases A
</th>
<th rowspan="2">
<h6>Existencia 24 hs</h6>
Existencia 24 hs
</th>
<th rowspan="2">
<h6>Ingresos- Egresos día</h6>
Ingresos- Egresos día
</th>
<th rowspan="2">
<h6>Pacientes día</h6>
Pacientes día
</th>
<th rowspan="2">
<h6>Camas disponibles 24hs</h6>
Camas disponibles 24hs
</th>
<th rowspan="2">
<h6>Días de estada</h6>
Días de estada
</th>
</tr>
<tr>
<th>
<h6>Altas</h6>
Altas
</th>
<th>
<h6>Defunciones</h6>
Defunciones
</th>
</tr>
</thead>
Expand Down Expand Up @@ -90,26 +90,26 @@ export class CensoMensualBody extends HTMLComponent {
<table class="resumen table">
<thead>
<tr>
<th>
<h6>Días de funcionamiento del servicio</h6>
<th rowspan="2">
Días de funcionamiento del servicio
</th>
<th>
<h6>Promedio diario de camas disponibles</h6>
<th rowspan="2">
Promedio diario de camas disponibles
</th>
<th>
<h6>Promedio diario de paciente día</h6>
<th rowspan="2">
Promedio diario de paciente día
</th>
<th>
<h6>Tasa de mortalidad hospitalaria</h6>
<th rowspan="2">
Tasa de mortalidad hospitalaria
</th>
<th>
<h6>Promedio de permanencia</h6>
<th rowspan="2">
Promedio de permanencia
</th>
<th>
<h6>Giro Cama</h6>
<th rowspan="2">
Giro Cama
</th>
<th>
<h6>Promedio días de estada</h6>
<th rowspan="2">
Promedio días de estada
</th>
</tr>
</thead>
Expand Down
6 changes: 4 additions & 2 deletions modules/descargas/informe-censo/censo-mensual-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ export class CensoMensualHeader extends HTMLComponent {
{{/if}}
</span>
<span class="contenedor-logos-secundarios">
<img class="logo-adicional" src="data:image/png;base64,{{ logos.logoAdicional }}">
<img class="logo-andes" src="data:image/png;base64,{{ logos.logoAndes }}">
<img class="logo-adicional" src="data:image/png;base64,{{ logos.adicional }}">
<img class="logo-andes" src="data:image/png;base64,{{ logos.andes }}">
</span>
</section>
<section class="contenedor-data-origen">
<hr>
<span class="contenedor-principal-data">
<div class="contenedor-secundario">
<h3>
Expand All @@ -39,6 +40,7 @@ export class CensoMensualHeader extends HTMLComponent {
</h5>
</div>
</span>
<hr>
</section>
</header>
<!-- END Header -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { HTMLComponent } from '../../model/html-component.class';
import * as mime from 'mime-types';
import { streamToBase64, readFile } from '../../../../core/tm/controller/file-storage';
import { getArchivoAdjunto } from '../../../../modules/rup/controllers/rup';
import { streamToJpegDataUri } from '../../../../utils/pdf/puppeteer';


export class AdjuntarDocumentoComponent extends HTMLComponent {
Expand All @@ -17,7 +18,7 @@ export class AdjuntarDocumentoComponent extends HTMLComponent {
{{#each documentos}}
<div class="subregistro">
<p> {{ term }}: </p>
<img class="w-25 archivo-adjunto" src="data:image/png;base64,{{img}}">
<img class="w-50 archivo-adjunto" src="{{img}}">
</div>
{{/each}}
</div>
Expand Down Expand Up @@ -45,8 +46,21 @@ export class AdjuntarDocumentoComponent extends HTMLComponent {
return new Promise(async (resolve, reject) => {
if (documento.id) {
const stream = await getArchivoAdjunto(documento.id);
const base64 = await streamToBase64(stream);
return resolve({ img: base64, term: documento?.descripcion?.term });
const img = await streamToJpegDataUri(stream, { maxWidth: 1600, quality: 75 });
return resolve({ img, term: documento?.descripcion?.term });


// const stream = await getArchivoAdjunto(documento.id);
// const dataUri = await streamToOptimizedDataUri(stream, {
// format: 'jpeg', // o 'webp' si necesitás alpha
// quality: 75,
// maxWidth: 1600,
// });
// return resolve({ img: dataUri, term: documento?.descripcion?.term });


// const base64 = await streamToBase64(stream);
// return resolve({ img: base64, term: documento?.descripcion?.term });
}
return;
});
Expand Down
25 changes: 13 additions & 12 deletions modules/descargas/informe-rup/informe-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,47 @@ import { InformeRupFirma } from './informe-firma';
export class InformeRupBody extends HTMLComponent {
template = `
<main>
<hr>
<section class="contenedor-informe">
<article class="cabezal-conceptos horizontal">
<div class="contenedor-bloque-texto w-3/4" >
<span class="cabezal-conceptos horizontal">
<div class="contenedor-bloque-texto w-50">
<div class="tipo-prestacion">
{{ titulo }}
</div>
</div>

<div class="contenedor-bloque-texto">
<h6 class="bolder">
Fecha Consulta
<h6>
<b>Fecha Consulta</b>
</h6>
<h6>
{{ fechaEjecucion }}hs
</h6>
</div>
<div class="contenedor-bloque-texto">
{{#if esValidada}}
<h6 class="bolder">
Fecha Validación
<h6>
<b>Fecha Validación</b>
</h6>
<h6>
{{ fechaValidacion }}hs
</h6>
{{else}}
<h6 class="bolder">
Sin validar
<h6>
<b>Sin validar</b>
</h6>
{{/if}}
</div>
<div class="contenedor-bloque-texto">
<h6 class="bolder">
Inicio de Prestación
<h6>
<b>Inicio de Prestación</b>
</h6>
<h6>
{{ fechaPrestacion }}hs
</h6>
</div>
</article>
</span>
<hr>
<br>
<div class="registros">
{{#each registros}}
{{{this}}}
Expand Down
4 changes: 2 additions & 2 deletions modules/descargas/informe-rup/informe-firma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Profesional } from '../../../core/tm/schemas/profesional';

export class InformeRupFirma extends HTMLComponent {
template = `
<footer id="last">
<section id="last">
<!-- Firmas -->
<span class="contenedor-firmas">
<div class="contenedor-bloque-texto">
Expand All @@ -24,7 +24,7 @@ export class InformeRupFirma extends HTMLComponent {
{{/if}}
</div>
</span>
</footer>
</section>
`;

constructor(public profesional, public organizacion) {
Expand Down
Loading
Loading