5. Given a geometric sequence $\left\{a_{n}\right\}$ with all terms being positive, it satisfies $\left|a_{2}-a_{3}\right|=14, a_{1} a_{2} a_{3}=343$.
Then the general term formula of the sequence $\left\{a_{n}\right\}$ is $a_{n}=$ $\qquad$
$5.7 \times 3^{n-2}$.
From $a_{2}^{3}=a_{1} a_{2} a_{3}=343=7^{3} \Rightarrow a_{2}=7$.
From $\left|a_{2}-a_{3}\right|=14 \Rightarrow a_{3}=21$ or -7 (discard).
Thus, the common ratio $q=3, a_{n}=7 \times 3^{n-2}$.