There is a big difference between working (salaried, W2, etc) for a non-profit hospital system (remember, some hospitals are in a for-profit health system so it won't count) and working in a private group contracted through the hospital OR working as independent contractor for the hospital (1099-MISC). Only directly working (salaried, W2) for a non-profit hospital system will count towards the loan forgiveness.
However, keep in mind, you may be penny-wise but pound-foolish. You may have a decent salary, and your loans forgiven in 10 years (or whatever remainder of your years minus residency/fellowship) ... but if you join a group ... you could be making A LOT MORE money (especially if you are on a partner track or become a partner and share in revenue). I have friends who are salaried faculty at an academic center (MD faculty), friends who are salaried hospitalist at a private hospital, and friends who are part of a hospitalist group contract to work at a hospital. The lowest paying friend is the academic hospitalist, followed by salaried employee (hospitalist) followed by private group hospitalist. The difference between an academic hospitalist salary and the private group salary is almost $120k/year. *however, the private group covers multiple hospitals, does ALL admissions for all services (including elective surgical cases), and has a fast turn-around time (with bonuses for decrease length of stay, decrease in-hospital infection rate, etc) ... and the group does their own billing (RVUs for procedures, CPTs, E&M, etc) so it's a "eat what you kill" mentality.
And some groups and hospitals offer loan payback as part of their contract (as a recruitment tool).
So in the end, depending on your contract, you may end up making more money working for a private group than being a salaried employee of a non-profit organization (and hoping that Congress doesn't get rid of the 10 year public service loan forgiveness).
And also - only federal DIRECT loans qualify. So none of the private loans would qualify, and for those who borrow under the FFEL Programs (where your stafford and perkin loans used to come from a bank with a government guarantee) won't qualify either.