  We prove asymptotic formulae for sums of the form $$
\sum_{n\in\mathbb{Z}^d\cap K}\prod_{i=1}^tF_i(\psi_i(n)), $$ where $K$ is a
convex body, each $F_i$ is either the von Mangoldt function or the
representation function of a quadratic form, and $\Psi=(\psi_1,\ldots,\psi_t)$
is a system of linear forms of finite complexity. When all the functions $F_i$
are equal to the von Mangoldt function, we recover a result of Green and Tao,
while when they are all representation functions of quadratic forms, we recover
a result of Matthiesen. Our formulae imply asymptotics for some polynomial
patterns in the primes. Specifically, they describe the asymptotic behaviour of
the number of $k$-term arithmetic progressions of primes whose common
difference is a sum of two squares.
  The article combines ingredients from the work of Green and Tao on linear
equations in primes and that of Matthiesen on linear correlations amongst
integers represented by a quadratic form. To make the von Mangoldt function
compatible with the representation function of a quadratic form, we provide a
new pseudorandom majorant for both -- an average of the known majorants for
each of the functions -- and prove that it has the required pseudorandomness
properties.
