Provided are a 4,6,7-trisubstituted 1,2-dihydropyrrol[3,4-c]pyridin/pyrimidin-3-one derivative and a preparation method and pharmaceutical use thereof. In particular, the present invention relates to a compound of formula (I) or a pharmaceutically acceptable salt, stereoisomer, solvate, or prodrug thereof and a preparation method and application of the same. The definition of each substituent in the formula is described in detail in the specification and claims.