Elemental doping can modulate the electronic and molecular structure of g-C3N4 to improve its photocatalytic properties. In this study, potassium (K), phosphorus (P), oxygen (O), and sulfur (S) were doped into the g-C3N4 photocatalyst (K, P, O, S/g-C3N4), and the four-element doped photocatalyst was successfully prepared. UV-vis diffuse reflection spectroscopy, photoluminescence, and transient photocurrent revealed that the co-doping of g-C3N4 with K, P, O and S broadens the visible response and accelerates the transfer of photogenerated charges. Under visible light irradiation, the H2O2 concentration produced with K, P, O, S/g-C3N4 was 12.85 times higher than that with g-C3N4. Moreover, tetracycline (TC) can be effectively degraded by the photocatalyst in surface water. The degradation pathway of TC and the molecular structures of 12 intermediates were analyzed by liquid chromatography-mass spectrometry. The superoxide radical (center dot O-2(-)) trapping-electron spin resonance (ESR) technique confirmed that center dot O-2(-) is the main active species in the system. Therefore, the four-element doping strategy adopted in this research proved the feasibility of increasing the amount of H2O2 produced and degrading the antibiotics in natural water under visible light.