It sounds like he's checked out, for whatever reason.
He could be stressed, he could have his own underlying medical/hormonal condition that he's as yet unaware of, or just going through a low point for other reasons, e.g. work, legal issues, not practising self-care, sleep issues etc.
If you've recently been having a lot of arguments, etc., he could feel disconnected because of that.
Or he could be having an affair, or just plain indifferent and thinking about ending the relationship.
The only way you'll know is if you sit down with no distractions and open a dialogue.
There's no guarantee that you'll get a considered or honest answer from him, but you can only try.
I will say that the fact he had no idea whatsoever that you were depressed doesn't exactly speak volumes about him as a partner.
And the immediate physical blocking of affection upon getting into bed is never a good sign, especially as it's a change in behaviour that's now lasted months.
Perhaps you're depressed, in part at least, because you have an indifferent, emotionally unavailable partner who doesn't support you through your medical difficulties.