7 (dominant 7th) chords are constructed with the 1st, 3rd, 5th, and b7th notes of the major scale.
Maj7 chords are constructed with the 1st, 3rd, 5th, and 7th notes of the major scale.
It does sometimes trip learners up when they find out a 7 chord includes not a 7, but a b7, but that's how it goes!
D7
This common D7 chord shape is constructed of 1 (R for root), 3, 5, and b7.