In this work, the gravitational field is investigated in detailed and the quantum mechanics equation under the gravitational field has been derived. Then, the Schrodinger and Dirac equations are accordantly solved under the gravitational field condition by separating variables. As a result, the Rydberg formula is deduced in such conditions, which proves that the change of the external gravitational field intensity will cause the overall spectral movement. Obviously, the partial redshift of quasar spectrum should assign to this effect. Furthermore, by applying this gravitational field together with the energy and mass concepts into the symmetry, gravity theory and gauge theory, it is deduced that the interaction of “gravity” between matter and anti-matter is repulsive force, which is the originator of the accelerated expansion phenomenon for dark energy in the universe. It is found that the calculated cosmological constant is a small variable related to the radial and angular direction of the universe, and the “spontaneous breaking of vacuum symmetry” is caused by this gravitational field. Further, the gravitational field lead to the non-conservation of weak action parity. The equal number of baryon and antibaryon as well as the energy conservation in the universe are confirmed. In this work, the gravitational field is introduced into quantum theory, which will promote the integrality of the quantum mechanics, and explain the dark energy phenomenon constitutionally. This study will push the astrophysical theory and the gauge theory of particle physics for the further study of energy level, basic particle structure, and quantum gravity theory.