fileContent += patient.tostring();
fileContent += "Test";
function onReady(smart) { if (smart.hasOwnProperty('patient')) { var patient = smart.patient; var pt = patient.read(); var obv = smart.patient.api.fetchAll({ type: 'Observation', query: { code: { } } }); $.when(pt, obv).fail(onError);
$.when(pt, obv).done(function(patient, obv) { let fileContent = "data:text/csv;charset=utf-8,"; fileContent += patient.tostring(); var encodedUri = encodeURI(fileContent); window.open(encodedUri); }}