7. Given the sequence $\left\{a_{n}\right\}$, where $a_{1}=2, a_{n+1}=\frac{2 a_{n}+6}{a_{n}+1}$, then $a_{n}=$
7. $\frac{2+3 \times(-4)^{n}}{(-4)^{n}-1}$

Let $f(x)=\frac{2 x+6}{x+1}$, solving the equation $f(x)=x$ yields the fixed points of $f(x)$ as -2 and 3.
Let $b_{n}=a_{n}-3, c_{n}=a_{n}+2$, then
$b_{n+1}=\frac{2 a_{n}+6}{a_{n}+1}-3=\frac{-a_{n}+3}{a_{n}+1}=-\frac{b_{n}}{a_{n}+1}$.
$c_{n-1}=\frac{2 a_{n}+6}{a_{n}+1}+2=\frac{4 a_{n}+8}{a_{n}+1}=\frac{4 c_{n}}{a_{n}+1}$.
Thus, $\frac{b_{n+1}}{c_{n+1}}=-\frac{1}{4} \frac{b_{n}}{c_{n}},\left\{\frac{b_{n}}{c_{n}}\right\}$ is a geometric sequence with a common ratio of $-\frac{1}{4}$, and the first term is $\frac{b_{1}}{c_{1}}=\frac{a_{1}-3}{a_{1}+2}=-\frac{1}{4}$.
Therefore, $\frac{b_{n}}{c_{n}}=\frac{1}{(-4)^{n}}$, and from $\frac{a_{n}-3}{a_{n}+2}=\frac{1}{(-4)^{n}}$, we get $a_{n}=\frac{2+3 \times(-4)^{n}}{(-4)^{n}-1}$.