By polynomial long division, we get
\[\frac{2x^3+x^2-4x+7}{x^2+x-2}=2x-1+\frac{x+5}{x^2+x-2}. \]
We factor the denominator: \(x^2+x-2=(x-1)(x+2)\). For a partial fraction decomposition, let
\[ \frac{x+5}{x^2+x-2}=\frac{x+5}{(x-1)(x+2)}=\frac{A}{x-1}+\frac{B}{x+2}.\]
Multiplying by \((x-1)(x+2)\), we get
\[x+5=A(x+2)+B(x-1) \;\;\;\;\;\;\;\; (1) \]
Plugging \(x=1\) in (1), we get
\[1+5=A(1+2)+B(1-1) \implies 6=3A \implies A=\frac{6}{3}=2.\]
Plugging \(x=-2\) in (1), we get
\[-2+5=A(-2+2)+B(-2-1) \implies 3=-3B \implies B=-1.\]
So a partial fraction decomposition is
\[ \frac{2x^3+x^2-4x+7}{x^2+x-2}=2x-1+\frac{2}{x-1}-\frac{1}{x+2}.\]
\[\begin{align*}
\int \frac{2x^3+x^2-4x+7}{x^2+x-2} \,dx &= \int \left[ 2x-1+\frac{2}{x-1}-\frac{1}{x+2}\right] \;dx \\
&= 2\int x \;dx-\int \;dx+2\int\frac{dx}{x-1}-\int\frac{dx}{x+2} \\
&= x^2-x+2\ln|x-1|-\ln|x+2|+C.
\end{align*}\]