7. Given a positive integer $n(n \geqslant 3)$. For any permutation $P=\left(x_{1}, x_{2}, \cdots, x_{n}\right)$ of $1,2, \cdots, n$, if $i<j<k$, then $x_{j}$ is said to be between $x_{i}$ and $x_{k}$ (for example, in the permutation $(1,3,2,4)$, 3 is between 1 and 4, and 4 is not between 1 and 2). Let the set $S=\left\{P_{1}, P_{2}, \cdots, P_{m}\right\}$ be such that each element $P_{i}$ is a permutation of $1,2, \cdots, n$. It is known that for any three distinct numbers in $\{1,2, \cdots, n\}$, there is one number that is not between the other two numbers in each $P_{i}(1 \leqslant i \leqslant m)$. Find the maximum value of $m$.
7. First, prove by mathematical induction that: $m \leqslant 2^{n-1}$.

When $n=3$, by the condition, there must be a number (let's say 1) among 1, 2, 3 that does not lie between the other two numbers in any $P_{i}$.

Therefore, the permutations $(2,1,3)$ and $(3,1,2)$ cannot appear.

Thus, there are at most $3!-2=4$ possible permutations, and the conclusion holds.

Assume that $m \leqslant 2^{n-1}$ holds for $n=k-1$, and consider the case when $n=k$.

For each of the $m$ permutations of $1,2, \cdots, k$, remove $k$ from the permutation, resulting in a permutation of $1,2, \cdots, k-1$. Such permutations must satisfy the original condition for $n=k-1$, and by the induction hypothesis, there are at most $2^{k-2}$ such permutations.

It remains to prove that at most two permutations of $1,2, \cdots, k$ can correspond to the same permutation of $1,2, \cdots, k-1$. Thus, the total number of permutations is at most $2^{k-2} \times 2=2^{k-1}$.

Assume otherwise, then there exist three permutations of $1,2, \cdots, k$ that correspond to the same permutation of $1,2, \cdots, k-1$.

By symmetry, assume this permutation of $1,2, \cdots, k-1$ is $1,2, \cdots, k-1$, and in the three permutations $P_{1}, P_{2}, P_{3}$ of $1,2, \cdots, k$, $k$ is in the $a, b, c(1 \leqslant a < b < c \leqslant n)$ positions.
Consider the numbers $a, b, k$.
In the permutation
$$
P_{1}=\{1,2, \cdots, a-1, k, a, a+1, \cdots, k-1\}
$$

the order of these three numbers is $k, a, b$, with $a$ lying between the other two;
In the permutation
$$
P_{2}=\{1,2, \cdots, b-1, k, b, b+1, \cdots, k-1\}
$$

the order of these three numbers is $a, k, b$, with $k$ lying between the other two;
In the permutation
$$
P_{3}=\{1,2, \cdots, c-1, k, c, c+1, \cdots, k-1\}
$$

the order of these three numbers is $a, b, k$, with $b$ lying between the other two.

Thus, each of these three numbers has once lain between the other two, which contradicts the problem's condition.

Therefore, the assumption is false, and when $n=k$, $m \leqslant 2^{n-1}$ also holds.
Thus, we have proved that $m \leqslant 2^{n-1}$.
Next, provide an example where $m=2^{n-1}$.
Construct permutations of $1,2, \cdots, n$ as follows:
First, place 1, and when $1,2, \cdots, r(1 \leqslant r \leqslant n-1)$ are all placed, place $r+1$ at the leftmost or rightmost position of the first $r$ numbers. This way, each positive integer from 2 to $n$ has two possible positions. By the multiplication principle, there are $2^{n-1}$ such permutations.

For any three numbers $a<b<c$ in $1,2, \cdots, n$, by the construction, in each permutation, $c$ is either to the left or to the right of $a$ and $b$, and never lies between $a$ and $b$.
Thus, these $2^{n-1}$ permutations satisfy the problem's condition.
In conclusion, the maximum value of $m$ is $2^{n-1}$.