The treatment of cardiac arrhythmias may require long-term medications or electroshock to the heart. Rarely, surgical procedures are necessary in order to implant pacemakers or defibrillators.