From what I could interpret from your question, here are some pointers you may find useful:
'last time somebody lived here was two years ago.'
This sentence is grammatically correct. The sentence simply means that the last time some person ever lived in there was around two years from now (or to the time when the speaker said this sentence), which also means that for 2 years, that place was unoccupied by anybody.
'there hasn't lived anyone for the last two years/in the last two years'
This sentence is incorrect. If you want to restructure the sentence, you could rewrite it as:
Nobody has lived there for the last two years.
If you want to change it to passive voice, you could try:
That place has not been occupied by anybody for the last two years.
As for the second part of the question,
'I haven't done much work for the last 2 weeks/in the last two weeks.'
This means that 'I' (the subject) has not done much work in recent years (2 to be exact). This doesn't mean he has not worked at all.
If you want to understand it better, we know this is 2017. So the subject has not been doing much work since 2015. As you interpreted, this means that he worked properly till 2015 and has not been doing the same amount of work from 2015 to now, which is 2017. This means that he has not done much work in 2016 either.
Hope this helps.