Are you me? (Chrohn's in my case).
Sounds normal to me, I'm productive compared to a lot of programmers I know who don't have health issues and have a decade on me.
You need to be kinder to yourself, stressing about not been able to work for extended periods just makes it harder to concentrate - It just becomes a self-reinforcing downwards spiral.
In my case my hobbies are what keep me sane (you don't mention those), Chess for mental focus that isn't work (and social life) and Cycling for getting away from screens.
Otherwise the usual advice applies, try to eat better (hard with digestive issues I know) and get more sleep.