Sir Gregor Smith has stepped down, citing health reasons, amid a row about failures at NHS Grampian.