4. Given the three interior angles of $\triangle A B C$ are $\angle A, \angle B$, and $\angle C$. If
$$
\frac{\sin A+\sqrt{3} \cos A}{\cos A-\sqrt{3} \sin A}=\tan \frac{7 \pi}{12},
$$

then the maximum value of $\sin 2 B+2 \cos C$ is ( ).
(A) $\frac{1}{2}$
(B) 1
(C) $\frac{3}{2}$
(D) 2
4. C.
$$
\begin{array}{l}
\text { Given } \frac{\sin A+\sqrt{3} \cos A}{\cos A-\sqrt{3} \sin A}=\frac{\tan A+\tan \frac{\pi}{3}}{1-\tan A \cdot \tan \frac{\pi}{3}} \\
=\tan \left(A+\frac{\pi}{3}\right) \\
\Rightarrow \angle A+\frac{\pi}{3}=\frac{7 \pi}{12} \Rightarrow \angle A=\frac{\pi}{4} .
\end{array}
$$

Since $2 \angle B+2 \angle C=\frac{3 \pi}{2}$, we have,
$$
\begin{array}{l}
\sin 2 B+2 \cos C=\sin \left(\frac{3 \pi}{2}-2 C\right)+2 \cos \\
=-\cos 2 C+2 \cos C \\
=1-2 \cos ^{2} C+2 \cos C \\
=-2\left(\cos C-\frac{1}{2}\right)^{2}+\frac{3}{2} \leqslant \frac{3}{2} .
\end{array}
$$

When $\angle C=\frac{\pi}{3}$, the equality holds.
Thus, the maximum value of $\sin 2 B+2 \cos C$ is $\frac{3}{2}$.