Who pays for the medical costs?

Person getting care. The person getting medical care pays for his doctors, his tests, and his medicines. . . Because he is getting the services. However, as a community and a society, we want to have the healthiest, happiest population possible. So, there are insurance, governmental, and non-profit systems set up to help everybody afford good medical care without causing financial hardship (idealistically speaking!).
For what & who. We all basically pay but it depends whether it's through private insurance or taxes.