Personalized Pain Relief Exercise Generator

Personalized Pain Relief Exercise Generator

Get a simple, personalized exercise plan to help alleviate common aches and pains.

Step 1: Where are you experiencing pain?

Step 2: How would you describe the pain?

Step 3: What is the intensity of the pain?

4

Your Personalized Relief Plan

Perform these gentle exercises to help alleviate your discomfort. Stop if you feel any sharp pain.

Reps/Duration: ${ex.reps}

`; }); } elements.planResultContainer.innerHTML = planHTML; }; const downloadPDF = () => { if (typeof window.jspdf === 'undefined') { alert('Could not generate PDF. The required library is missing.'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); const colors = { primary: '#2563eb', secondary: '#3b82f6', textPrimary: '#1f2937', textSecondary: '#6b7280' }; doc.setFillColor(colors.primary); doc.rect(0, 0, 210, 28, 'F'); doc.setFont('helvetica', 'bold'); doc.setFontSize(20); doc.setTextColor('#FFFFFF'); doc.text('Your Personalized Pain Relief Plan', 105, 18, { align: 'center' }); let yPos = 40; const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1); const painAreaText = planData.painArea.replace('_', ' '); doc.setFontSize(12); doc.setFont('helvetica', 'normal'); doc.setTextColor(colors.textPrimary); doc.text(`This plan is designed for your ${capitalize(planData.painType)} ${capitalize(painAreaText)} pain.`, 14, yPos); yPos += 15; planData.exercises.forEach(ex => { if (yPos > 250) { doc.addPage(); yPos = 20; } doc.setFontSize(14); doc.setFont('helvetica', 'bold'); doc.setTextColor(colors.primary); doc.text(ex.name, 14, yPos); yPos += 7; doc.setFontSize(11); doc.setFont('helvetica', 'normal'); doc.setTextColor(colors.textPrimary); const splitDesc = doc.splitTextToSize(ex.desc, 180); doc.text(splitDesc, 14, yPos); yPos += (splitDesc.length * 5) + 3; doc.setFont('helvetica', 'bold'); doc.setTextColor(colors.textSecondary); doc.text(`Reps/Duration: ${ex.reps}`, 14, yPos); yPos += 12; }); yPos = 275; doc.setDrawColor(colors.secondary); doc.line(14, yPos, 196, yPos); doc.setFontSize(9); doc.setFont('helvetica', 'italic'); doc.setTextColor(colors.textSecondary); doc.text('Disclaimer: This is not medical advice. Consult a healthcare professional before starting any new exercise program, especially if you have sharp pain.', 105, yPos + 8, { align: 'center', maxWidth: 180 }); doc.save('My_Pain_Relief_Plan.pdf'); }; // --- Event Listeners --- elements.nextBtn.addEventListener('click', nextStep); elements.prevBtn.addEventListener('click', prevStep); elements.downloadPdfBtn.addEventListener('click', downloadPDF); elements.intensity.addEventListener('input', () => { elements.intensityValue.textContent = elements.intensity.value; }); // --- Initialization --- updateFormUI(); });
Scroll to Top