Cardiac surgery is an operation to repair or replace parts of the heart. It is only done when there are problems with the heart that medicines or other treatments can't fix. A surgeon will open your chest and may put in new parts to help your heart work better, or they may fix a part of the heart that is not working correctly. The surgery may take several hours, and a patient usually has to stay in a hospital for a few days after the surgery.