World number one Novak Djokovic completed a dramatic comeback to edge Stefanos Tsitsipas in a thrilling quarter-final clash at the Italian Open.