I am a US citizen and a consultant physician in Edinburgh, on a Tier 1 (General) Migrant visa.
Practically speaking, GPs and NHS hospitals are pretty poor about determing if an immigrant's visa entitles them to healthcare in the NHS (when our HR department sends me job applicants to interview, they can't even tell me correctly what visa the job applicant has). The most common way they settle the issue is not to ask for your visa or proof of residency/employment. They usually settle the issue by asking for your National Insurance (NI) number.
I think GPs/hospitals rely on the NI number as proof of entitlement for a few reasons. Most immigrants that I know of obtain their NI number from their first job (my HR department knew exactly what to do and had all of the paperwork), and it's widely *perceived* that if you're an immigrant with a NI number, you must have it because you're working. It's also necessary to have the number to make NI contributions, obviously. Whether it's legal/right or not, that's what the GPs in my area do. My wife was not allowed to sign up for a GP until she had a NI number; my daughter (a minor) was allowed to sign up immediately on account of her age. We showed her visa and my (NHS consultant!) contract to GPs, to no avail; our difficulty in this regard may be due to the fact that my wife and I have different last names.
The loophole in the process is this--if you go to a JobCentre and show a visa that entitles you to work, they will help you obtain a NI number, even if you're unemployed. My NI application was painless via my HR dept., compared to my wife's application process via JobCentre (she's unemployed, on a Tier 1 Dependent visa), which was quite the hassle. Chances are good that if you show the GP/hospital your NI number, no further questions will be asked. Physicians have better things to do than define your visa status!