I don't know where you have trouble, but it's straightforward if you just assume $R(x,t)$ and $S(x,t)$ in the form given for $\psi$ and then expand out the operations, where:
$$\begin{align}
\psi &\equiv R(x,t)e^{i S(x,t)\hbar} \\
\partial_t \psi &\rightarrow \Big(\frac{\partial_t R}{R} + \frac{i \partial_t S}{\hbar} \Big)\psi \\
\nabla \psi &\rightarrow \Big(\frac{\nabla R}{R} + \frac{i \nabla S}{\hbar} \Big)\psi \\
\nabla^2 \psi &\rightarrow \Big(\frac{\nabla^2 R}{R} + 2\frac{\nabla R}{R} \cdot \frac{i \nabla S}{\hbar}+ \left(\frac{i \nabla S}{\hbar}\right)^2 \Big)\psi \\
\end{align} $$
divide through by $\psi$ and you can separate the Schrödinger equation into real and imaginary parts to get two independent equations:
\begin{align}\partial_t S &= \frac{\hbar ^2 }{2m}\frac{\nabla^2 R}{R} - \frac{1}{2m}(\nabla S)^2 - V\\ \partial_t R &= -\frac{1}{m}\nabla R \cdot \nabla S -\frac{1}{2m}R \nabla^2 S\end{align}
The first equation is the one you seek, where I've written $Q$ explicitly.