That's a good question, Sandy!
For service dogs, hospitals are considered a "public accommodation." Persons with disabilities accompanied by service dogs are generally allowed to enter any area of a public accommodation where members of the public are permitted. With rare exception, the handler doesn't have to ask before entering and cannot legally be forbidden to enter.
Therapy dog teams do not have public access rights. When they visit hospitals, it is ONLY with permission from the hospital. Some hospitals permit therapy dog teams and others do not. Some only permit therapy dog teams at certain times or in certain wards or areas. It is up to the individual hospital to decide whether and where they will permit therapy dogs in their facility.
Sometimes when a person is sick, some hospitals will permit their own pet to visit them. The pet should be freshly bathed and very well-behaved, but might not have to be a certified therapy dog to visit. This is also up to the hospital. Not all hospitals will permit a pet visit.