Sorry to hear that you are in so much pain apple...

I would suggest doing some gentle leg stretches before you go to bed, and when you wake up as well...
Can you go and have a chat to a physio at your hospital about it, they may be able to suggest some more things?