What sort of work did you do before the Heart Attack? Thats the first question here. What will you have to do if you returned in a few months. Would you feel confident in doing the same tasks? If it was a job where heavy lifting was involved, then it would be advisable to ask your work for something lighter until your heart muscles have healed sufficiently. Your doctor will support you with a covering letter, so ask for one.
If your job entailed dealing with stressful situations, then the above applies too, where you need the doctor to help you obtain more time to recover, while working.
Everyone is different in deciding whether they can work or want to return to work. It is down to you as a person and knowing what you are comfortable in doing. You may have lost your confidence or are scared to be around lots of people; maybe the questions about your heart surgery and what happened, will be too much, so you may avoid going back. I can help you deal with this change and will work with you to deal with this, at your own pace. No pressure, just re-assurance and patience.