The positive sequence $\{a_n\}$ satisfies:$a_1=1+\sqrt 2$ and $(a_n-a_{n-1})(a_n+a_{n-1}-2\sqrt n)=2(n\geq 2).$
(1)Find the general formula of $\{a_n\}$;
(2)Find the set of all the positive integers $n$ so that $\lfloor a_n\rfloor=2022$.
1. **Finding the general formula of $\{a_n\}$:**

   We are given the sequence $\{a_n\}$ with the initial condition $a_1 = 1 + \sqrt{2}$ and the recurrence relation:
   \[
   (a_n - a_{n-1})(a_n + a_{n-1} - 2\sqrt{n}) = 2 \quad \text{for} \quad n \geq 2.
   \]

   We will use induction to find the general formula for $a_n$.

   **Base Case:**
   For \( n = 1 \):
   \[
   a_1 = 1 + \sqrt{2}.
   \]
   This matches the given initial condition.

   **Inductive Step:**
   Assume that for some \( k \geq 1 \), the formula holds:
   \[
   a_k = \sqrt{k} + \sqrt{k+1}.
   \]
   We need to show that:
   \[
   a_{k+1} = \sqrt{k+1} + \sqrt{k+2}.
   \]

   Using the recurrence relation:
   \[
   (a_{k+1} - a_k)(a_{k+1} + a_k - 2\sqrt{k+1}) = 2.
   \]

   Substitute \( a_k = \sqrt{k} + \sqrt{k+1} \):
   \[
   (a_{k+1} - (\sqrt{k} + \sqrt{k+1}))(a_{k+1} + (\sqrt{k} + \sqrt{k+1}) - 2\sqrt{k+1}) = 2.
   \]

   Simplify the second term:
   \[
   a_{k+1} + \sqrt{k} + \sqrt{k+1} - 2\sqrt{k+1} = a_{k+1} + \sqrt{k} - \sqrt{k+1}.
   \]

   The equation becomes:
   \[
   (a_{k+1} - \sqrt{k} - \sqrt{k+1})(a_{k+1} + \sqrt{k} - \sqrt{k+1}) = 2.
   \]

   Let \( x = a_{k+1} - \sqrt{k+1} \). Then:
   \[
   (x - \sqrt{k})(x + \sqrt{k}) = 2.
   \]

   This simplifies to:
   \[
   x^2 - k = 2 \quad \Rightarrow \quad x^2 = k + 2.
   \]

   Therefore:
   \[
   x = \sqrt{k+2}.
   \]

   Hence:
   \[
   a_{k+1} = \sqrt{k+1} + \sqrt{k+2}.
   \]

   By induction, the general formula for \( a_n \) is:
   \[
   a_n = \sqrt{n} + \sqrt{n+1}.
   \]

2. **Finding the set of all positive integers \( n \) such that \( \lfloor a_n \rfloor = 2022 \):**

   We need to find \( n \) such that:
   \[
   \lfloor \sqrt{n} + \sqrt{n+1} \rfloor = 2022.
   \]

   This implies:
   \[
   2021 < \sqrt{n} + \sqrt{n+1} \leq 2022.
   \]

   **Lower Bound:**
   \[
   2021 < \sqrt{n} + \sqrt{n+1}.
   \]

   Since \( \sqrt{n+1} \approx \sqrt{n} \) for large \( n \), we can approximate:
   \[
   2\sqrt{n} \approx 2021 \quad \Rightarrow \quad \sqrt{n} \approx \frac{2021}{2} = 1010.5.
   \]

   Therefore:
   \[
   n > 1010.5^2 = 1021025.25.
   \]

   So:
   \[
   n \geq 1021026.
   \]

   **Upper Bound:**
   \[
   \sqrt{n} + \sqrt{n+1} \leq 2022.
   \]

   Again, approximating \( \sqrt{n+1} \approx \sqrt{n} \):
   \[
   2\sqrt{n} \leq 2022 \quad \Rightarrow \quad \sqrt{n} \leq 1011.
   \]

   Therefore:
   \[
   n \leq 1011^2 = 1022121.
   \]

   Combining the bounds, we get:
   \[
   1021026 \leq n \leq 1022121.
   \]

   Thus, the set of all positive integers \( n \) such that \( \lfloor a_n \rfloor = 2022 \) is:
   \[
   \{ n \in \mathbb{Z} \mid 1021026 \leq n \leq 1022121 \}.
   \]

The final answer is \( \boxed{ \{ n \in \mathbb{Z} \mid 1021026 \leq n \leq 1022121 \} } \).