Am I being selfish?

I need some advice. I haven’t been doing too well mentally lately, and I feel like it’s really starting to affect my life negatively. I was thinking about taking some time to myself & admitting myself into a psychiatric hospital. The only thing stopping me is being away from my son for that long. Is it selfish of me for wanting to do this? Am I a bad mom for it? I just really fear that if I keep going, my son won’t have a mother in 5 years time. I want to get better for the both of us.