First off, I'd suggest talking to someone about how you are feeling.
I've been told to take each day an hour at a time. Set goals for that hour and not worry about the other hours until you get to them.
For example, for one hour set the goal of getting through some coursework, the n the next hour doing more coursework, or eating etc.
As for the bad thoughts, I think keeping yourself occupied can help with that.
Hope this helps