A
Galaxy-class starship like
Enterprise-D is supposed to be able to evacuate up to fifteen thousand persons, though that's not implying some level of medical care available for them. With her several large shuttlebays, mess halls and other facilities (heck, holodecks would work) that could easily be converted to medical care areas in a pinch, I would wager she could provide a couple of thousand flying hospital beds for emergencies, especially with a bit of time to prepare.
It's interesting to note that the
TNG TM claims 40% of the crew has training to serve secondary medical functions, which is a lot and would really help in disaster relief and so forth.
The TOS
Enterprise has about 1/25 the volume of the
Enterprise-D, and I would guess she could provide a maximum of maybe a hundred and fifty emergency beds or something like that, again with time to prepare. She doesn't have nearly as much space available per crewman she normally carries, and I think a lot of the other spaces are serving vital functions and are not the kind of place you can just start laying sick people everywhere.
As for comparison to starbase, I am not sure if you mean in general or just in the matter of hospital beds.
For the latter, I think all we can say is that a starbase, regardless of era, is probably better equipped to handle emergencies requiring care for many ill or injured than anywhere except a major city on a Federation member planet.
As a general question, I think the
Galaxy class is the closest thing they can build to a flying starbase in its era, given that it is supposed to operate on its own, possibly for long periods of time, and to be able to carry out all Federation policy options while doing so. The TOS
Enterprise was, in my personal opinion at least, probably the Starfleet top of the line in her day, but I think the gap between a major facility and a mobile one was wider then and might narrow somewhat with the continuing technological progress and embiggening of certain ships
