Example 6 As shown in Figure $3, \odot O$ has a diameter whose length is the largest integer root of the quadratic equation in $x$
$$
x^{2}+2(k-2) x+k
$$
$=0$ (where $k$ is an integer). $P$ is a point outside $\odot O$. A tangent $PA$ and a secant $PBC$ are drawn from point $P$ to $\odot O$, with $A$ being the point of tangency, and $B, C$ being the points where the secant $PBC$ intersects $\odot O$. If the lengths of $PA, PB, PC$ are all positive integers, and the length of $PB$ is not a composite number, find the value of $PA^{2}+PB^{2}+PC^{2}$.
Analysis: First, find the value of the diameter, then discuss the cases based on $P B$ not being a composite number.

Solution: Let the two integer roots of the equation $x^{2}+2(k-2) x+k=0$ be $x_{1}$ and $x_{2}$, with $x_{1}>x_{2}$. Then
$$
x_{1}+x_{2}=-2(k-2), x_{1} x_{2}=k \text {. }
$$

From the above two equations, we know $2 x_{1} x_{2}+x_{1}+x_{2}=4$, which means
$$
\left(2 x_{1}+1\right)\left(2 x_{2}+1\right)=9=9 \times 1 \text {. }
$$

Since $x_{1}>x_{2}$, then $2 x_{1}+1=9,2 x_{2}+1=1$, which gives $x_{1}=4, x_{2}=0$.
Thus, the diameter of $\odot O$ is 4.
Note that $0<B C \leqslant 4$, and $P A, P B, P C$ are positive integers, so $B C=P C-P B$ is a positive integer.
Therefore, $B C=1,2,3,4$.
By the Power of a Point theorem, we have
$$
P A^{2}=P B \cdot P C=P B(P B+B C) \text {. }
$$
(1) When $B C=1$, from equation (1) we get
$$
P A^{2}=P B^{2}+P B \text {. }
$$

Thus, $P B^{2}<P A^{2}<(P B+1)^{2}$, which is a contradiction.
(2) When $B C=2$, from equation (1) we get
$$
P A^{2}=P B^{2}+2 P B \text {. }
$$

Thus, $P B^{2}<P A^{2}<(P B+1)^{2}$, which is a contradiction.
(3) When $B C=3$, from equation (1) we get
$$
P A^{2}=P B^{2}+3 P B \text {, }
$$

which means $(P A-P B)(P A+P B)=3 P B$.
Since $P B$ is not a composite number, and $P A-P B<P A+P B$, the only possibilities are
$$
\begin{array}{l}
\left\{\begin{array} { l } 
{ P A - P B = 1 , } \\
{ P A + P B = 3 P B ; }
\end{array} \quad \left\{\begin{array}{l}
P A-P B=3, \\
P A+P B=P B ;
\end{array}\right.\right. \\
\left\{\begin{array}{l}
P A-P B=P B, \\
P A+P B=3 .
\end{array}\right.
\end{array}
$$

Solving these, we get $P A=2, P B=1$.
In this case, $P C=P B+B C=1+3=4$.
Therefore, $P A^{2}+P B^{2}+P C^{2}=21$.
(4) When $B C=4$, from equation (1) we get
$$
P A^{2}=P B^{2}+4 P B \text {. }
$$

Thus, $(P B+1)^{2}<P B^{2}+4 P B=P A^{2}$
$$
<(P B+2)^{2},
$$

which is a contradiction.
In summary, $P A^{2}+P B^{2}+P C^{2}=21$.