What kind of illness was Kaori Miyazono suffering from?
In my theory, her disease is Friedreich's Ataxia. Symptons begins between the ages of 5 to 15. Muscle weakness in the arms and legs and loss of coordination are symptons.

It causes heart disorders. In Episode 20, she may be having a severe and painful tachycardia, and a following cardiac arrest. The surgery may be to implant a pacemaker, but another arrest killed her during the surgery.