A compound represented by formula (II), a stereoisomer thereof, or a pharmaceutically acceptable salt of the same, wherein, X is independently N or CH; m is 0, 1 or 2; n is 1 or 2; D is -C(=O)-, -C(=O)O-, -CH 2 -; R 1 is C 1-6 alkyl, C 1-6 heteroalkyl or C 3 - 6 cycloalkyl, each of which is optionally substituted by one, two or three R; each of R 2 and R 3 is H, halogen, OH, NH 2 , CN or R 4 -L-, or selected from the group consisting of C 1-6 alkyl, C 1-6 heteroalkyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by one, two or three R; R 4 is C 3-6 cycloalkyl, 3-6 membered heterocyclic alkyl, phenyl or 5-6 membered heteroaryl, each of which is optionally substituted by one, two or three R; L is -(CRR) 1-3 -, or -O-(CRR) 0-3 -; ring A is 5 membered heteroaryl; ring B is phenyl or 5-9 membered heteroaryl; R is H, F, Cl, Br, I, CN, OH, NH 2 , COOH, or optionally selected from the group consisting of C 1-6 alkyl and C 1-6 heteroalkyl, each of which is optionally substituted by one, two or three R'; R' is H, F, Cl, Br, I, OH, CN, NH 2 , COOH, Me, Et, CF 3 , CHF 2 , CH 2 F, NHCH 3 , N(CH 3 ) 2 ; "hetero" represents a heteroatom or a heteroatom group, which is selected from the group consisting of -C(=O)N(R)-, -N(R)-, -C(=NR)-, -S(=O) 2 N(R)-, -S(=O)N(R)-, -O-, -S-, =O, =S, -O-N=, -C(=O)O-, -C(=O)-, -C(=S)-, -S(=O)-, -S(=O) 2 -, and -N(R)C(=O)N(R)-; in any one of the above cases, the number of heteroatom or heteroatom group is independently selected from one, two and three. X is independently N or CH; m is 0, 1 or 2; n is 1 or 2; D is -C(=O)-, -C(=O)O-, -CH 2 -; R 1 is C 1-6 alkyl, C 1-6 heteroalkyl or C 3 - 6 cycloalkyl, each of which is optionally substituted by one, two or three R; each of R 2 and R 3 is H, halogen, OH, NH 2 , CN or R 4 -L-, or selected from the group consisting of C 1-6 alkyl, C 1-6 heteroalkyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by one, two or three R; R 4 is C 3-6 cycloalkyl, 3-6 membered heterocyclic alkyl, phenyl or 5-6 membered heteroaryl, each of which is optionally substituted by one, two or three R; L is -(CRR) 1-3 -, or -O-(CRR) 0-3 -; ring A is 5 membered heteroaryl; ring B is phenyl or 5-9 membered heteroaryl; R is H, F, Cl, Br, I, CN, OH, NH 2 , COOH, or optionally selected from the group consisting of C 1-6 alkyl and C 1-6 heteroalkyl, each of which is optionally substituted by one, two or three R'; R' is H, F, Cl, Br, I, OH, CN, NH 2 , COOH, Me, Et, CF 3 , CHF 2 , CH 2 F, NHCH 3 , N(CH 3 ) 2 ; "hetero" represents a heteroatom or a heteroatom group, which is selected from the group consisting of -C(=O)N(R)-, -N(R)-, -C(=NR)-, -S(=O) 2 N(R)-, -S(=O)N(R)-, -O-, -S-, =O, =S, -O-N=, -C(=O)O-, -C(=O)-, -C(=S)-, -S(=O)-, -S(=O) 2 -, and -N(R)C(=O)N(R)-; in any one of the above cases, the number of heteroatom or heteroatom group is independently selected from one, two and three. "hetero" represents a heteroatom or a heteroatom group, which is selected from the group consisting of -C(=O)N(R)-, -N(R)-, -C(=NR)-, -S(=O) 2 N(R)-, -S(=O)N(R)-, -O-, -S-, =O, =S, -O-N=, -C(=O)O-, -C(=O)-, -C(=S)-, -S(=O)-, -S(=O) 2 -, and -N(R)C(=O)N(R)-; in any one of the above cases, the number of heteroatom or heteroatom group is independently selected from one, two and three. <EOS>