{"id":2087,"date":"2025-06-26T20:15:13","date_gmt":"2025-06-26T20:15:13","guid":{"rendered":"https:\/\/summithealth.ca\/?page_id=2087"},"modified":"2026-07-09T14:18:32","modified_gmt":"2026-07-09T14:18:32","slug":"formulaire-de-consentement-de-sortie-pour-perfusion","status":"publish","type":"page","link":"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/","title":{"rendered":"Formulaire de consentement de sortie pour perfusion"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"fr\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Formulaire de sortie du patient &#8211; Summit Health<\/title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.0.1\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\">\n    <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/signature_pad@4.1.5\/dist\/signature_pad.umd.min.js\"><\/script>\n    <script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.6.0\/jquery.min.js\"><\/script>\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/html2pdf.js\/0.10.1\/html2pdf.bundle.min.js\"><\/script>\n    <style>\n        html, body {\n          margin: 0;\n          padding: 0;\n          background: #fff;\n        }\n\n        * {\n          box-sizing: border-box;\n        }\n\n        body {\n            padding: 20px;\n            font-family: sans-serif;\n            font-size: 14px;\n        }\n        #signature-pad {\n            border: 1px solid #ccc;\n            width: 100%;\n            max-width: 600px;\n            height: 200px;\n        }\n        canvas {\n            touch-action: none;\n            display: block;\n        }\n    <\/style>\n<script>\n(function (root, factory) {\n  var api = factory(root);\n\n  if (typeof module === \"object\" && module.exports) {\n    module.exports = api;\n  }\n\n  root.SummitQuestionnaireV2 = api;\n\n  \/\/ Expose helper functions as globals so legacy HTML call sites that reference them\n  \/\/ by bare name (e.g. `resolvePublicApiBase(...)`) keep working after the helper is\n  \/\/ inlined into the page. Without this, the IIFE only exposes the api object via\n  \/\/ `window.SummitQuestionnaireV2`, which causes a ReferenceError in code paths that\n  \/\/ do not use the defensive `window.SummitQuestionnaireV2 && ...` pattern.\n  if (api && typeof api === \"object\") {\n    var _helperExports = [\n      \"resolveStage\",\n      \"resolveApiBase\",\n      \"resolvePublicApiBase\",\n      \"rewriteUrl\",\n      \"rewriteLegacyUrl\",\n      \"rewriteManagedTargets\",\n      \"attachManagedForms\",\n    ];\n    for (var _i = 0; _i < _helperExports.length; _i++) {\n      var _name = _helperExports[_i];\n      if (typeof api[_name] === \"function\" &#038;&#038; typeof root[_name] !== \"function\") {\n        root[_name] = api[_name];\n      }\n    }\n  }\n})(typeof globalThis !== \"undefined\" ? globalThis : this, function (root) {\n  var PROD_BASE = \"https:\/\/api.ascentemr.com\/v2\";\n  var DEV_BASE = \"https:\/\/dev.ascentemr.com\/v2\";\n  var STAGING_BASE = \"https:\/\/staging.ascentemr.com\/v2\";\n  var LOCAL_BASE = \"http:\/\/localhost:4010\/dev\/v2\";\n  var DOM_READY_EVENTS = [\"DOMContentLoaded\", \"load\"];\n\n  function asSearchParams(input) {\n    if (typeof URLSearchParams === \"undefined\") {\n      return {\n        get: function () {\n          return null;\n        },\n      };\n    }\n\n    if (!input &#038;&#038; root.location &#038;&#038; typeof root.location.search === \"string\") {\n      return new URLSearchParams(root.location.search);\n    }\n\n    if (input instanceof URLSearchParams) {\n      return input;\n    }\n\n    if (typeof input === \"string\") {\n      return new URLSearchParams(input.charAt(0) === \"?\" ? input.slice(1) : input);\n    }\n\n    if (input &#038;&#038; typeof input === \"object\" &#038;&#038; typeof input.toString === \"function\") {\n      return new URLSearchParams(String(input));\n    }\n\n    return new URLSearchParams(\"\");\n  }\n\n  function normalize(value) {\n    return String(value || \"\").trim().toLowerCase();\n  }\n\n  function currentOrigin() {\n    if (root.location &#038;&#038; typeof root.location.origin === \"string\" &#038;&#038; root.location.origin) {\n      return root.location.origin.replace(\/\\\/$\/, \"\");\n    }\n    if (typeof URL !== \"undefined\" &#038;&#038; root.location &#038;&#038; typeof root.location.href === \"string\") {\n      try {\n        return new URL(root.location.href).origin.replace(\/\\\/$\/, \"\");\n      } catch (_error) {}\n    }\n    return \"\";\n  }\n\n  function isProductionWordpressHost() {\n    var hostname = normalize(root.location &#038;&#038; root.location.hostname);\n    if (!hostname) {\n      return false;\n    }\n    if (\n      hostname.indexOf(\"dev.\") === 0 ||\n      hostname.indexOf(\"dev-\") === 0 ||\n      hostname.indexOf(\"staging.\") === 0 ||\n      hostname.indexOf(\"staging-\") === 0 ||\n      hostname.indexOf(\".staging.\") >= 0 ||\n      hostname.indexOf(\".vercel.app\") >= 0\n    ) {\n      return false;\n    }\n\n    return (\n      hostname === \"dormalab.com\" ||\n      hostname === \"www.dormalab.com\" ||\n      hostname === \"summithealth.ca\" ||\n      hostname === \"www.summithealth.ca\" ||\n      hostname === \"cliniquevoyageur.ca\" ||\n      hostname === \"www.cliniquevoyageur.ca\"\n    );\n  }\n\n  function resolveStage(searchLike) {\n    var params = asSearchParams(searchLike);\n    var requestedStage = normalize(params.get(\"stage\"));\n    var testMode = normalize(params.get(\"test\"));\n    var hostname = normalize(root.location && root.location.hostname);\n\n    if (requestedStage === \"local\" || testMode === \"true\") {\n      return \"local\";\n    }\n    if (requestedStage === \"dev\") {\n      return \"dev\";\n    }\n    if (requestedStage === \"staging\") {\n      return \"staging\";\n    }\n    if (requestedStage === \"prod\" || requestedStage === \"production\") {\n      return \"prod\";\n    }\n\n    if (!hostname || hostname === \"localhost\" || hostname === \"127.0.0.1\" || hostname === \"::1\") {\n      return \"local\";\n    }\n    if (\n      hostname === \"staging.ascentemr.com\" ||\n      hostname.indexOf(\"staging.\") === 0 ||\n      hostname.indexOf(\"staging-\") === 0 ||\n      hostname.indexOf(\".staging.\") >= 0\n    ) {\n      return \"staging\";\n    }\n    if (\n      hostname === \"dev.ascentemr.com\" ||\n      hostname === \"dev.ascent.summithealth.ca\" ||\n      hostname.indexOf(\"dev.\") === 0 ||\n      hostname.indexOf(\"dev-\") === 0 ||\n      hostname.indexOf(\".vercel.app\") >= 0\n    ) {\n      return \"dev\";\n    }\n\n    return \"prod\";\n  }\n\n  function resolveApiBase(searchLike) {\n    var stage = resolveStage(searchLike);\n\n    if (isProductionWordpressHost() && stage !== \"dev\" && stage !== \"staging\" && stage !== \"local\") {\n      return PROD_BASE;\n    }\n    if (stage === \"local\") {\n      return LOCAL_BASE;\n    }\n    if (stage === \"dev\") {\n      return DEV_BASE;\n    }\n    if (stage === \"staging\") {\n      return STAGING_BASE;\n    }\n\n    return currentOrigin() ? currentOrigin() + \"\/api\/v2\" : DEV_BASE;\n  }\n\n  function resolvePublicApiBase(searchLike) {\n    return resolveApiBase(searchLike).replace(\/\\\/$\/, \"\") + \"\/public\";\n  }\n\n  function startsWith(value, prefix) {\n    return String(value || \"\").slice(0, prefix.length) === prefix;\n  }\n\n  function isAscentApiHost(host) {\n    var normalizedHost = normalize(host);\n    return (\n      normalizedHost === \"api.ascentemr.com\" ||\n      normalizedHost === \"dev.ascentemr.com\" ||\n      normalizedHost === \"staging.ascentemr.com\" ||\n      normalizedHost === \"api.summittravelhealthdev.com\" ||\n      normalizedHost === \"dev.summittravelhealthdev.com\" ||\n      normalizedHost === \"staging.summittravelhealthdev.com\" ||\n      normalizedHost.indexOf(\"localhost:3000\") === 0 ||\n      normalizedHost.indexOf(\"127.0.0.1:3000\") === 0 ||\n      normalizedHost.indexOf(\"localhost:4010\") === 0 ||\n      normalizedHost.indexOf(\"127.0.0.1:4010\") === 0\n    );\n  }\n\n  function normalizePublicPath(pathname) {\n    var normalized = String(pathname || \"\");\n    if (!normalized) {\n      return \"\/public\";\n    }\n\n    if (startsWith(normalized, \"\/public\")) {\n      return normalized;\n    }\n    if (startsWith(normalized, \"\/v2\/public\")) {\n      return normalized.slice(3);\n    }\n    if (startsWith(normalized, \"\/dev\/v2\/public\")) {\n      return normalized.slice(7);\n    }\n    if (startsWith(normalized, \"\/dev\/v2\/\")) {\n      return \"\/public\" + normalized.slice(7);\n    }\n    if (startsWith(normalized, \"\/dev\")) {\n      return \"\/public\" + normalized.slice(4);\n    }\n    if (startsWith(normalized, \"\/v2\/\")) {\n      return \"\/public\" + normalized.slice(3);\n    }\n\n    return normalized;\n  }\n\n  function shouldRewriteUrl(parsed, rawUrl) {\n    var pathname = String(parsed && parsed.pathname || \"\");\n    if (\n      startsWith(pathname, \"\/public\") ||\n      startsWith(pathname, \"\/v2\/public\") ||\n      startsWith(pathname, \"\/dev\/v2\/public\") ||\n      startsWith(pathname, \"\/dev\") ||\n      startsWith(pathname, \"\/v2\/\")\n    ) {\n      var rawValue = String(rawUrl || \"\");\n      var isRelative =\n        startsWith(rawValue, \"\/\") ||\n        startsWith(rawValue, \".\/\") ||\n        startsWith(rawValue, \"..\/\");\n      return isRelative || isAscentApiHost(parsed.host) || normalize(parsed.host) === normalize(root.location && root.location.host);\n    }\n\n    return false;\n  }\n\n  function rewriteUrl(rawUrl, searchLike) {\n    var value = String(rawUrl || \"\");\n    if (!value || typeof URL === \"undefined\") {\n      return value;\n    }\n\n    try {\n      var parsed = new URL(value, root.location && root.location.href ? root.location.href : undefined);\n      if (!shouldRewriteUrl(parsed, value)) {\n        return value;\n      }\n\n      var apiBase = resolveApiBase(searchLike);\n      var normalizedPath = normalizePublicPath(parsed.pathname);\n\n      return apiBase.replace(\/\\\/$\/, \"\") + normalizedPath + parsed.search + parsed.hash;\n    } catch (_error) {\n      return value;\n    }\n  }\n\n  function patchFetch() {\n    if (typeof root.fetch !== \"function\" || root.fetch.__summitQuestionnaireV2Patched) {\n      return;\n    }\n\n    var originalFetch = root.fetch.bind(root);\n\n    var patchedFetch = function (input, init) {\n      if (typeof Request !== \"undefined\" && input instanceof Request) {\n        var rewrittenRequestUrl = rewriteUrl(input.url);\n        if (rewrittenRequestUrl !== input.url) {\n          input = new Request(rewrittenRequestUrl, input);\n        }\n      } else if (typeof input === \"string\" || (typeof URL !== \"undefined\" && input instanceof URL)) {\n        input = rewriteUrl(String(input));\n      }\n\n      return originalFetch(input, init);\n    };\n\n    patchedFetch.__summitQuestionnaireV2Patched = true;\n    root.fetch = patchedFetch;\n  }\n\n  function patchXmlHttpRequest() {\n    if (\n      typeof XMLHttpRequest === \"undefined\" ||\n      !XMLHttpRequest.prototype ||\n      XMLHttpRequest.prototype.open.__summitQuestionnaireV2Patched\n    ) {\n      return;\n    }\n\n    var originalOpen = XMLHttpRequest.prototype.open;\n    XMLHttpRequest.prototype.open = function (method, url) {\n      var rewrittenUrl = rewriteUrl(url);\n      return originalOpen.apply(this, [method, rewrittenUrl].concat([].slice.call(arguments, 2)));\n    };\n    XMLHttpRequest.prototype.open.__summitQuestionnaireV2Patched = true;\n  }\n\n  function rewriteManagedTargets(documentLike) {\n    var doc = documentLike || root.document;\n    if (!doc || typeof doc.querySelectorAll !== \"function\") {\n      return;\n    }\n\n    doc.querySelectorAll(\"form[action], a[href]\").forEach(function (element) {\n      var attributeName = element.tagName === \"FORM\" ? \"action\" : \"href\";\n      var currentValue = element.getAttribute(attributeName);\n      var rewrittenValue = rewriteUrl(currentValue);\n      if (rewrittenValue && rewrittenValue !== currentValue) {\n        element.setAttribute(attributeName, rewrittenValue);\n      }\n    });\n  }\n\n  function getRecaptchaSiteKey(form) {\n    if (!form || !form.querySelector) {\n      return null;\n    }\n\n    var localWidget = form.querySelector(\".g-recaptcha[data-sitekey]\");\n    if (localWidget) {\n      return localWidget.getAttribute(\"data-sitekey\");\n    }\n\n    var globalWidget =\n      root.document && root.document.querySelector(\".g-recaptcha[data-sitekey]\");\n    return globalWidget ? globalWidget.getAttribute(\"data-sitekey\") : null;\n  }\n\n  function collectFormPayload(form) {\n    var payload = {};\n    var formData = new FormData(form);\n\n    formData.forEach(function (value, key) {\n      if (payload[key] !== undefined) {\n        if (!Array.isArray(payload[key])) {\n          payload[key] = [payload[key]];\n        }\n        payload[key].push(value);\n        return;\n      }\n\n      payload[key] = value;\n    });\n\n    payload.formKey = form.getAttribute(\"data-v2-form-key\") || \"\";\n    payload.pageUrl = root.location ? root.location.href : \"\";\n    payload.recaptchaToken =\n      payload.recaptchaToken ||\n      payload[\"g-recaptcha-response\"] ||\n      \"\";\n    payload.recaptchaSiteKey = payload.recaptchaSiteKey || getRecaptchaSiteKey(form);\n\n    return payload;\n  }\n\n  function ensureStatusElement(form, kind) {\n    var attributeName = kind === \"error\" ? \"data-v2-form-error\" : \"data-v2-form-success\";\n    var existing = form.querySelector(\"[\" + attributeName + \"]\");\n    if (existing) {\n      return existing;\n    }\n\n    var element = root.document.createElement(\"div\");\n    element.setAttribute(attributeName, \"true\");\n    element.style.display = \"none\";\n    element.style.marginBottom = \"12px\";\n    element.style.padding = \"12px\";\n    element.style.borderRadius = \"4px\";\n    element.style.fontSize = \"14px\";\n    element.style.background = kind === \"error\" ? \"#fbe9e7\" : \"#e8f5e9\";\n    element.style.color = kind === \"error\" ? \"#b71c1c\" : \"#1b5e20\";\n    form.insertBefore(element, form.firstChild);\n    return element;\n  }\n\n  function setStatusMessage(form, kind, message) {\n    var element = ensureStatusElement(form, kind);\n    element.textContent = message || \"\";\n    element.style.display = message ? \"block\" : \"none\";\n  }\n\n  function disableSubmitButtons(form, disabled) {\n    var buttons = form.querySelectorAll(\"button[type=submit], input[type=submit]\");\n    buttons.forEach(function (button) {\n      button.disabled = Boolean(disabled);\n    });\n  }\n\n  async function submitManagedForm(form) {\n    var payload = collectFormPayload(form);\n    var action = rewriteUrl(form.getAttribute(\"action\"));\n    var response = await root.fetch(action, {\n      method: \"POST\",\n      headers: {\n        \"Content-Type\": \"application\/json\",\n      },\n      body: JSON.stringify(payload),\n    });\n\n    var contentType = String(response.headers && response.headers.get && response.headers.get(\"content-type\") || \"\");\n    var data =\n      contentType.indexOf(\"application\/json\") >= 0\n        ? await response.json()\n        : { success: response.ok, message: await response.text() };\n\n    if (!response.ok || data.success === false) {\n      throw new Error(data.error || data.message || \"Form submission failed.\");\n    }\n\n    return data;\n  }\n\n  function attachFormHandler(form) {\n    if (!form || form.__summitQuestionnaireV2Attached) {\n      return;\n    }\n\n    form.__summitQuestionnaireV2Attached = true;\n    form.addEventListener(\"submit\", async function (event) {\n      event.preventDefault();\n\n      if (form.__summitQuestionnaireV2Submitting) {\n        return;\n      }\n\n      if (typeof form.checkValidity === \"function\" && !form.checkValidity()) {\n        if (typeof form.reportValidity === \"function\") {\n          form.reportValidity();\n        }\n        return;\n      }\n\n      form.__summitQuestionnaireV2Submitting = true;\n      setStatusMessage(form, \"error\", \"\");\n      setStatusMessage(form, \"success\", \"\");\n      disableSubmitButtons(form, true);\n\n      try {\n        var result = await submitManagedForm(form);\n        var redirectUrl = result.redirectUrl || collectFormPayload(form).retURL;\n\n        if (redirectUrl && root.location && typeof root.location.assign === \"function\") {\n          root.location.assign(redirectUrl);\n          return;\n        }\n\n        setStatusMessage(form, \"success\", \"Votre formulaire a ete soumis avec succes.\");\n      } catch (error) {\n        setStatusMessage(form, \"error\", error && error.message ? error.message : \"Le formulaire n'a pas pu etre soumis.\");\n        if (root.console && typeof root.console.error === \"function\") {\n          root.console.error(\"SummitQuestionnaireV2 form submission failed\", error);\n        }\n      } finally {\n        disableSubmitButtons(form, false);\n        form.__summitQuestionnaireV2Submitting = false;\n      }\n    });\n  }\n\n  function attachManagedForms(documentLike) {\n    var doc = documentLike || root.document;\n    if (!doc || typeof doc.querySelectorAll !== \"function\") {\n      return;\n    }\n\n    var managedForms = doc.querySelectorAll(\"form[data-v2-form-key]\");\n    managedForms.forEach(attachFormHandler);\n  }\n\n  function bootstrap() {\n    patchFetch();\n    patchXmlHttpRequest();\n\n    if (!root.document || typeof root.document.addEventListener !== \"function\") {\n      return;\n    }\n\n    rewriteManagedTargets(root.document);\n    attachManagedForms(root.document);\n    DOM_READY_EVENTS.forEach(function (eventName) {\n      root.document.addEventListener(eventName, function () {\n        rewriteManagedTargets(root.document);\n        attachManagedForms(root.document);\n      });\n    });\n\n    root.document.addEventListener(\"submit\", function (event) {\n      var form = event && event.target;\n      if (form && typeof form.getAttribute === \"function\") {\n        var currentAction = form.getAttribute(\"action\");\n        var rewrittenAction = rewriteUrl(currentAction);\n        if (rewrittenAction && rewrittenAction !== currentAction) {\n          form.setAttribute(\"action\", rewrittenAction);\n        }\n      }\n    }, true);\n  }\n\n  bootstrap();\n\n  return {\n    resolveStage: resolveStage,\n    resolveApiBase: resolveApiBase,\n    resolvePublicApiBase: resolvePublicApiBase,\n    rewriteUrl: rewriteUrl,\n    rewriteLegacyUrl: rewriteUrl,\n    rewriteManagedTargets: rewriteManagedTargets,\n    attachManagedForms: attachManagedForms,\n    bootstrap: bootstrap,\n  };\n});\n<\/script>\n<\/head>\n<body>\n\n<div id=\"pdf-wrapper\" style=\"background-color: #fff; color: #000; padding: 20px; margin: 0 auto; max-width: 800px; min-height: 100vh; box-sizing: border-box;\">\n    <h2 class=\"mb-4\">Formulaire de sortie du patient &#8211; Summit Health<\/h2>\n\n    <div class=\"mb-3\">\n        <label for=\"patientName\" class=\"form-label\"><strong>Nom complet du patient<\/strong><\/label>\n        <input type=\"text\" class=\"form-control\" id=\"patientName\" placeholder=\"Entrez le nom complet\">\n    <\/div>\n\n    <div class=\"mb-3\">\n        <label for=\"dischargeDate\" class=\"form-label\"><strong>Date<\/strong><\/label>\n        <input type=\"date\" class=\"form-control\" id=\"dischargeDate\">\n    <\/div>\n\n    <div id=\"dischargeSection\" style=\"display: block;\">\n      <p><strong>Reconnaissance de la sortie<\/strong><\/p>\n      <ul>\n        <li>Je reconnais avoir choisi de quitter la clinique avant la fin de la p\u00e9riode de surveillance post-infusion recommand\u00e9e. Je comprends les risques potentiels et d\u00e9charge Summit Health de toute responsabilit\u00e9 en cas de r\u00e9action retard\u00e9e ou de complication apr\u00e8s mon d\u00e9part.<\/li>\n      <\/ul>\n    <\/div>\n\n    <div class=\"form-check mb-3\">\n      <input class=\"form-check-input\" type=\"checkbox\" value=\"\" id=\"consentCheckbox\">\n      <label class=\"form-check-label\" for=\"consentCheckbox\">\n        Je confirme avoir lu et compris les informations ci-dessus et j\u2019accepte les termes et conditions.\n      <\/label>\n    <\/div>\n\n    <div class=\"mb-3\">\n        <label class=\"form-label\"><strong>Signature<\/strong><\/label><br>\n        <canvas id=\"signature-pad\"><\/canvas><br>\n        <button class=\"btn btn-secondary mt-2\" id=\"clearSignature\">Effacer la signature<\/button>\n    <\/div>\n\n    <div id=\"signatureMetadata\" class=\"mb-3\" style=\"font-size: 12px; color: #555;\"><\/div>\n\n    <button class=\"btn btn-primary\" id=\"submitForm\">Soumettre le formulaire<\/button>\n\n    <div class=\"alert alert-success mt-3\" style=\"display: none;\" id=\"successMessage\">\n        Le formulaire de consentement a \u00e9t\u00e9 soumis avec succ\u00e8s.\n    <\/div>\n    <div class=\"alert alert-danger mt-3\" style=\"display: none;\" id=\"errorMessage\">\n        Une erreur s&rsquo;est produite lors de la soumission du formulaire. Veuillez en informer votre infirmier(\u00e8re).\n    <\/div>\n<\/div>\n\n<script>\n    \/\/ Retrieve secure discharge token from URL\n    const urlParams = new URLSearchParams(window.location.search);\n    const accessToken = urlParams.get(\"accessToken\");\n\n    \/\/ Validate secure token\n    if (!accessToken) {\n      document.getElementById(\"pdf-wrapper\").innerHTML = `\n        <div class=\"alert alert-danger\">\n          Ce formulaire contient une erreur technique. Veuillez parler \u00e0 votre infirmier(\u00e8re) pour compl\u00e9ter le processus de sortie.\n        <\/div>\n      `;\n      throw new Error(\"Missing accessToken in URL\");\n    }\n\n    const canvas = document.getElementById(\"signature-pad\");\n    const signaturePad = new SignaturePad(canvas);\n\n    \/\/ Set today's date as default for dischargeDate\n    document.getElementById(\"dischargeDate\").valueAsDate = new Date();\n\n    function resizeCanvas() {\n        const ratio = Math.max(window.devicePixelRatio || 1, 1);\n        canvas.width = canvas.offsetWidth * ratio;\n        canvas.height = canvas.offsetHeight * ratio;\n        canvas.getContext(\"2d\").scale(ratio, ratio);\n        const data = signaturePad.toDataURL();\n        signaturePad.clear();\n        try { signaturePad.fromDataURL(data); } catch (_) {}\n    }\n\n    window.addEventListener(\"resize\", resizeCanvas);\n    resizeCanvas();\n\n    let userIP = \"Fetching...\";\n    fetch(\"https:\/\/api.ipify.org?format=json\")\n      .then(response => response.json())\n      .then(data => { userIP = data.ip; })\n      .catch(() => { userIP = \"Unavailable\"; });\n\n    document.getElementById(\"clearSignature\").addEventListener(\"click\", () => {\n        signaturePad.clear();\n    });\n\n    document.getElementById(\"submitForm\").addEventListener(\"click\", () => {\n        const name = document.getElementById(\"patientName\").value.trim();\n        const date = document.getElementById(\"dischargeDate\").value;\n\n        if (!name || !date || signaturePad.isEmpty()) {\n            alert(\"Veuillez remplir tous les champs et signer avant de soumettre.\");\n            return;\n        }\n\n        const consentCheckbox = document.getElementById(\"consentCheckbox\");\n        if (!consentCheckbox.checked) {\n          alert(\"Veuillez confirmer que vous avez lu et acceptez les termes avant de soumettre.\");\n          return;\n        }\n\n        const estDate = new Date().toLocaleString(\"en-CA\", { timeZone: \"America\/Toronto\" });\n        const browserInfo = navigator.userAgent;\n\n        const metaDiv = document.getElementById(\"signatureMetadata\");\n        metaDiv.innerText = `Sign\u00e9 le ${estDate} (HNE)\\nNavigateur : ${browserInfo}\\nIP : ${userIP}`;\n\n        const signature = signaturePad.toDataURL();\n\n        \/\/ Convert canvas to image\n        const signatureImg = new Image();\n        signatureImg.src = signature;\n        signatureImg.style.width = '100%';\n        signatureImg.style.maxWidth = '600px';\n\n        \/\/ Replace canvas with static image before PDF\n        const canvasEl = document.getElementById(\"signature-pad\");\n        canvasEl.parentNode.replaceChild(signatureImg, canvasEl);\n\n        document.getElementById(\"submitForm\").style.display = \"none\";\n        document.getElementById(\"clearSignature\").style.display = \"none\";\n        document.getElementById(\"successMessage\").style.display = \"none\";\n        document.getElementById(\"errorMessage\").style.display = \"none\";\n\n        const wrapper = document.getElementById(\"pdf-wrapper\");\n        wrapper.style.display = \"block\";\n        wrapper.style.visibility = \"visible\";\n        wrapper.style.position = \"relative\";\n\n        function generatePdfAndUpload() {\n          requestAnimationFrame(() => {\n            html2pdf()\n              .set({\n                margin: 10,\n                filename: `Discharge - ${name}.pdf`,\n                image: { type: 'jpeg', quality: 0.98 },\n                html2canvas: {\n                  scale: 1.5,\n                  useCORS: true,\n                  logging: true,\n                  scrollY: 0\n                },\n                jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }\n              })\n              .from(wrapper)\n              .toPdf()\n              .get('pdf')\n              .then((pdf) => {\n                const total = pdf.internal.getNumberOfPages();\n                if (total > 1) {\n                  for (let i = 1; i <= total; i++) {\n                    pdf.setPage(i);\n                    pdf.setFontSize(10);\n                    const pageSize = pdf.internal.pageSize;\n                    const x = pageSize.getWidth() - 5;\n                    const y = pageSize.getHeight() - 5;\n                    pdf.text(`Page ${i} de ${total}`, x, y, { align: 'right' });\n                  }\n                }\n                return pdf.output('blob');\n              })\n              .then((pdfBlob) => {\n                \/\/ Upload first, then download\n                const reader = new FileReader();\n                reader.onloadend = function () {\n                  const base64PDF = reader.result.split(',')[1];\n                  const payload = {\n                    formType: \"discharge\",\n                    base64PDF,\n                    fileName: `Discharge - ${name}.pdf`,\n                    accessToken\n                  };\n\n                  fetch(resolvePublicApiBase(window.location.search).replace(\/\\\/$\/, \"\") + \"\/pdf\/uploadPatientAgreementForm\", {\n                    method: \"POST\",\n                    headers: { \"Content-Type\": \"application\/json\" },\n                    body: JSON.stringify(payload),\n                  })\n                    .then(response => {\n                      if (!response.ok) throw new Error(\"Upload failed\");\n                      return response.json();\n                    })\n                    .then(data => {\n                      console.log(\"Uploaded to backend:\", data);\n                      document.getElementById(\"successMessage\").style.display = \"block\";\n\n                      \/\/ Save locally AFTER successful upload\n                      if (typeof saveAs !== \"undefined\") {\n                        saveAs(pdfBlob, `Discharge - ${name}.pdf`);\n                      } else {\n                        const url = URL.createObjectURL(pdfBlob);\n                        const a = document.createElement(\"a\");\n                        a.href = url;\n                        a.download = `Discharge - ${name}.pdf`;\n                        document.body.appendChild(a);\n                        a.click();\n                        document.body.removeChild(a);\n                        URL.revokeObjectURL(url);\n                      }\n                    })\n                    .catch(err => {\n                      console.error(err);\n                      document.getElementById(\"errorMessage\").style.display = \"block\";\n                    });\n                };\n                reader.readAsDataURL(pdfBlob);\n              })\n              .catch(error => {\n                console.error(\"PDF generation failed:\", error);\n                document.getElementById(\"errorMessage\").style.display = \"block\";\n              });\n          });\n        }\n\n        if (signatureImg.complete) {\n          generatePdfAndUpload();\n        } else {\n          signatureImg.onload = generatePdfAndUpload;\n        }\n    });\n\/\/ FileSaver.js for saveAs\n<\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/FileSaver.js\/2.0.5\/FileSaver.min.js\"><\/script>\n\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Formulaire de sortie du patient &#8211; Summit Health Formulaire de sortie du patient &#8211; Summit Health Nom complet du patient Date Reconnaissance de la sortie &#8230; <a title=\"Formulaire de consentement de sortie pour perfusion\" class=\"read-more\" href=\"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/\" aria-label=\"En savoir plus sur Formulaire de consentement de sortie pour perfusion\">Lire plus<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2087","page","type-page","status-publish"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Formulaire de consentement de sortie pour perfusion - Summit Health<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Formulaire de consentement de sortie pour perfusion - Summit Health\" \/>\n<meta property=\"og:description\" content=\"Formulaire de sortie du patient &#8211; Summit Health Formulaire de sortie du patient &#8211; Summit Health Nom complet du patient Date Reconnaissance de la sortie ... Lire plus\" \/>\n<meta property=\"og:url\" content=\"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/\" \/>\n<meta property=\"og:site_name\" content=\"Summit Health\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-09T14:18:32+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/formulaire-de-consentement-de-sortie-pour-perfusion\\\/\",\"url\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/formulaire-de-consentement-de-sortie-pour-perfusion\\\/\",\"name\":\"Formulaire de consentement de sortie pour perfusion - Summit Health\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/#website\"},\"datePublished\":\"2025-06-26T20:15:13+00:00\",\"dateModified\":\"2026-07-09T14:18:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/formulaire-de-consentement-de-sortie-pour-perfusion\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/summithealth.ca\\\/fr\\\/formulaire-de-consentement-de-sortie-pour-perfusion\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/formulaire-de-consentement-de-sortie-pour-perfusion\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Formulaire de consentement de sortie pour perfusion\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/#website\",\"url\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/\",\"name\":\"Summit Health\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/#organization\",\"name\":\"Summit Health\",\"url\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/summithealth.ca\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/logo_trimmed.png\",\"contentUrl\":\"https:\\\/\\\/summithealth.ca\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/logo_trimmed.png\",\"width\":312,\"height\":312,\"caption\":\"Summit Health\"},\"image\":{\"@id\":\"https:\\\/\\\/summithealth.ca\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Formulaire de consentement de sortie pour perfusion - Summit Health","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/","og_locale":"fr_FR","og_type":"article","og_title":"Formulaire de consentement de sortie pour perfusion - Summit Health","og_description":"Formulaire de sortie du patient &#8211; Summit Health Formulaire de sortie du patient &#8211; Summit Health Nom complet du patient Date Reconnaissance de la sortie ... Lire plus","og_url":"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/","og_site_name":"Summit Health","article_modified_time":"2026-07-09T14:18:32+00:00","twitter_card":"summary_large_image","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/","url":"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/","name":"Formulaire de consentement de sortie pour perfusion - Summit Health","isPartOf":{"@id":"https:\/\/summithealth.ca\/fr\/#website"},"datePublished":"2025-06-26T20:15:13+00:00","dateModified":"2026-07-09T14:18:32+00:00","breadcrumb":{"@id":"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/summithealth.ca\/fr\/formulaire-de-consentement-de-sortie-pour-perfusion\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/summithealth.ca\/fr\/"},{"@type":"ListItem","position":2,"name":"Formulaire de consentement de sortie pour perfusion"}]},{"@type":"WebSite","@id":"https:\/\/summithealth.ca\/fr\/#website","url":"https:\/\/summithealth.ca\/fr\/","name":"Summit Health","description":"","publisher":{"@id":"https:\/\/summithealth.ca\/fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/summithealth.ca\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/summithealth.ca\/fr\/#organization","name":"Summit Health","url":"https:\/\/summithealth.ca\/fr\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/summithealth.ca\/fr\/#\/schema\/logo\/image\/","url":"https:\/\/summithealth.ca\/wp-content\/uploads\/2024\/07\/logo_trimmed.png","contentUrl":"https:\/\/summithealth.ca\/wp-content\/uploads\/2024\/07\/logo_trimmed.png","width":312,"height":312,"caption":"Summit Health"},"image":{"@id":"https:\/\/summithealth.ca\/fr\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/summithealth.ca\/fr\/wp-json\/wp\/v2\/pages\/2087","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/summithealth.ca\/fr\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/summithealth.ca\/fr\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/summithealth.ca\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/summithealth.ca\/fr\/wp-json\/wp\/v2\/comments?post=2087"}],"version-history":[{"count":5,"href":"https:\/\/summithealth.ca\/fr\/wp-json\/wp\/v2\/pages\/2087\/revisions"}],"predecessor-version":[{"id":3096,"href":"https:\/\/summithealth.ca\/fr\/wp-json\/wp\/v2\/pages\/2087\/revisions\/3096"}],"wp:attachment":[{"href":"https:\/\/summithealth.ca\/fr\/wp-json\/wp\/v2\/media?parent=2087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}