Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._getExportListContent(listIndex,entriesChunk) +
this._getExportPageFooter(currentPage,totalPages,oaData.oa.code)
});
})
})
// Close document
pdfTemplate += this._getExportPdfFooter();
this._setLoadingMessage({ message:this.localize('mhListing.spinner.step_5_done',this.language), icon:"check-circle", updateLastMessage: true, done:true});
this._setLoadingMessage({ message:this.localize('mhListing.spinner.step_6',this.language), icon:"arrow-forward"});
this.downloadFileName = this.reportCurrentDateMomentObject.format('YYYY-MM-DD-HH[h]-mm[m]-ss[s]') + "-listing-patients" + ".pdf";
// Generate, archive & download pdf report
this.api.pdfReport(mustache.render(pdfTemplate, pdfData))
.then(pdfFileContent=>{
this._setLoadingMessage({ message:this.localize('mhListing.spinner.step_6_done',this.language), icon:"check-circle", updateLastMessage: true, done:true});
this._setLoadingMessage({ message:this.localize('mhListing.spinner.step_7',this.language), icon:"arrow-forward"});
return this.api.message().newInstance(this.user)
.then(newMessageInstance => this.api.message().createMessage(
_.merge(newMessageInstance, {
transportGuid: "MH:ARCHIVES:LISTING",
recipients: [_.get(this.user, 'healthcarePartyId', _.trim(this.hcp.id))],
metas: {totalPages: totalPages, filename: this.downloadFileName},
toAddresses: [_.get(this.user, 'email', _.get(this.user, 'healthcarePartyId', _.trim(this.hcp.id)))],
subject: "MH: Archive listing patients download - " + this.downloadFileName
}))
)
.then(createdMessage => this.api.document().newInstance(this.user, createdMessage, {
documentType: 'report',
title: data.title,
byline: data.byline,
date: (new Date(data.publication_year, data.publication_month, data.publication_day)).toLocaleDateString(),
body: data.body,
url: data.url
};
if(data.small_image_url){
templateData.image = {
src: data.small_image_url.replace(/thumbStandard.*\./, "hpMedium."),
height: 253,
width: 337
};
}
element.innerHTML = mustache.render(ARTICLE_TEMPLATE, templateData);
document.body.appendChild(element);
this.markResource(data.title);
setTimeout(function(){
element.width = element.clientWidth;
element.height = element.clientHeight;
documentFragment.appendChild(element);
self.addResource(data.title, new StaticElement(element));
});
};
_pdfReport(drugsToBePrescribed,toPrint,size) {
this.dispatchEvent(new CustomEvent('pdf-report',{detail: {loading: true}}))
const pdfPrintingData = {
downloadFileName: _.kebabCase([ "prescription", _.get(this.patient, "lastName", ""), _.get(this.patient, "firstName", ""), +new Date()].join(" ")) + ".pdf",
documentMetas : {
title : "Prescription",
contactId : _.get(this.currentContact, "id", ""),
created: ""+ +new Date(),
patientId : _.trim(_.get(this.patient, "id", "")),
patientName : _.compact([ _.get(this.patient, "lastName", ""), _.get(this.patient, "firstName", "") ]).join(" ")
}
}
this.api.pdfReport(mustache.render(toPrint, null), {
paperWidth: this.patient.ssin && this.api.tokenId && size == 'A4' ? 210 : 105,
paperHeight: this.patient.ssin && this.api.tokenId && size == 'A4' ? 297 : 210,
marginLeft: 5,
marginRight: 5,
marginTop: 5,
marginBottom: 5
})
.then(({pdf:pdfFileContent, printed:wasPrinted}) => _.assign({pdfFileContent:pdfFileContent, printed:wasPrinted}, pdfPrintingData))
.then(pdfPrintingData => this.api.message().newInstanceWithPatient(this.user, this.patient)
.then(newMessageInstance=>_.assign({newMessageInstance: newMessageInstance}, pdfPrintingData))
.then(pdfPrintingData=>this.api.message().createMessage(
_.merge(
pdfPrintingData.newMessageInstance,
{
transportGuid: "PRESCRIPTION:PHARMACEUTICALS:ARCHIVE",
recipients: [_.get(this.user, 'healthcarePartyId', _.trim(this.user.id))],