The present invention provides a tetrahydroprotoberberine compound represented by the formula (I), enantiomers, diastereomers, racemates and mixtures thereof, and pharmaceutically acceptable salts, crystalline hydrates and solvates thereof. The invention also provides a method for preparing the compound and the use thereof in the preparation of a medicament for preventing and/or treating central nervous system diseases.