Let $m$ be a squarefree odd integer that can be written as a sum of two squares, and let $K = {\mathbb Q}(\sqrt{m}\,)$ be a real quadratic number field with fundamental unit $\varepsilon$. Let $m = a_1^2 + 4b_1^2 = \ldots = a_t^2 + 4b_t^2$ denote the essentially different ways of writing $m$ as a sum of two squares.

If $N \varepsilon = -1$, then the ideals $(2b_i + \sqrt{m},a_i)$ represent the different ideal classes of order dividing $2$ (I am using equivalence in the usual (wide) sense), and each such ideal class is represented exactly once in this way. Moreover, each ideal is equivalent to exactly one ramified ideal (i.e. a product of distinct ramified prime ideals).

If $N \varepsilon = +1$, then the ideals $(2b_i + \sqrt{m},a_i)$ represent exactly those ideal classes of order $2$ that are not represented by a ramified ideal, and each ideal has two such representations.

Does this result occur explicitly somewhere?