Welcome to the community!
What is the make and model of the phone you are using? How long has this been happening? Is it happening to everyone that is not in your contacts list or just some people?
Sounds like your phone is somehow set to only allow incoming calls from your contact list. You might want to check through the phone app settings, hospitals usually have private numbers maybe you phone is set to block calls from private numbers.
It is a Samsung galaxy A71. Only 2 weeks old! I was initially getting spam calls but anyone else not in my contacts doesn't get through. Both private calls and several hospital numbers. Been through all the settings and don't see anything that applies to this problem. Not impressed so far....
Go to the phone app settings -> Block numbers make sure Block unknown callers have not been enabled also you can see all the numbers you have blocked there.
Try doing a force restart press and hold the volume down + the power key at the same time for 10 seconds and the phone should restart.
If the problem is still there try clearing the phone app cache and the data (clearing the data might clear your recent call history) restart the phone and see if the problem goes away.