You are doing something unusual here. Taking a diagonal form and insisting on the variables being nonnegative is possible but is not really natural. One counts a representation with some $x$ as distinct from the same representation with $-x.$ However, this is what you did. I can fill in the beginning of the story, enough for those expert in quadratic fields to finish it. First, for all ***odd*** numbers $n,$ the number of ***primitive*** representations with $\pm$ being considered distinct is $h(-32n),$ being the class number of positive binary quadratic forms of the same discriminant has $f(x,y) = x^2 + 8ny^2.$ Now, there is typically no reason for the number of representations, or number of primitive representations, by a diagonal ternary form $a x^2 + b y^2 + c z^2$ to be divisible by 8. However, once we restrict $n \equiv 7 \pmod 8,$ we immediately find that $x,y,z$ are odd. Odd means nonzero. Furthermore, $1,2,4$ are distinct. So there is no permutation of a given $x,y,z$ that gives the same value. As a result, each triple has exactly eight full versions with the possible $\pm$ on each of three positions. So far, with your positive variables, the number of primitive representations is $$h(-32n)/8.$$ Alright, you wanted primes. So primitive representations agree with representations. The other effect is that the number of genera of (positive binary forms of) discriminant $-32p$ is four. Finally we get to distinguish $7 \pmod {16}$ and $15 \pmod {16}.$ When $p \equiv 15 \pmod {16},$ the number of classes in the principal genus is divisible by 4, because the number of fourth powers in the class group is even. For a given $p \equiv 15 \pmod {16},$ the fourth powers include $\langle 1,0, 8p \rangle$ and $\langle 8,8, p+2 \rangle$ and add up to an even number of classes, should there be any others. For a given $p \equiv 7 \pmod {16},$ the fourth powers include $\langle 1,0, 8p \rangle$ (but not the other one, it is a square but not a fourth power) and add up to an odd number of classes, should there be any others. Put those together, the principal genus has either a multiple of four classes or twice an odd number, multiply by four genera and you get either a multiple of sixteen or $8 \pmod {16},$ finally divide by 8 and you get either an even number or an odd number. Probably enough. Relating primitive representations by ternaries (of numbers relatively prime to the discriminant) to a class number goes back to Gauss and the Disquisitiones. I do not particularly know what to do with primes $1,3,5 \pmod 8$ in this problem.