Construction of a complete orthogonal system for the quantum-mechanical three-body problem