A compound represented by formula, a stereoisomer thereof or a pharmaceutically acceptable salt thereof, wherein, is a single bond or a double bond; R 1 is selected from H and C 1-3 alkyl, wherein the C 1-3 alkyl is optionally substituted by R, and the number of R is 1, 2 or 3; R 5 is selected from H and C 1-3 alkyl, wherein the C 1-3 alkyl is optionally substituted by R, and the number of R is 1, 2 or 3; R 6 is selected from R 61, r is 1 or 2; m is 1 or 2; D is selected from -N(R 2)-, -N + (O -)(R 2)- and -C(R 3)(R 4)-; R 2 is selected from H and C 1-3 alkyl, wherein the C 1-3 alkyl is optionally substituted by R, and the number of R is 1, 2 or 3; R 3 and R 4 are independently selected from H, F, Cl, Br, I, OH, NH 2 and C 1-3 alkyl, wherein the NH 2 and the C 1-3 alkyl are optionally substituted by R, and the number of R is 1, 2 or 3; alternatively, R 3 and R 4 together with the carbon atom to which they are attached form a 5-7 membered cycloalkyl or 5-7 membered heterocycloalkyl, wherein the 5-7 membered cycloalkyl and 5-7 membered heterocycloalkyl are optionally substituted by R, and the number of R is 1, 2 or 3; R 61 is selected from H, F, Cl, Br, I, OH, NH 2, C 1-3 alkoxy and -O-C 3-6 cycloalkyl, wherein the C 1-3 alkoxy and the -O-C 3-6 cycloalkyl are optionally substituted by R, and the number of R is 1, 2 or 3; R 7 is selected from H, F, Cl, Br, I, OH, NH 2, C 1-3 alkyl, C 1-3 alkoxy and 5-6 membered heterocycloalkyl, wherein the C 1-3 alkyl, C 1-3 alkoxy and 5-6 membered heterocycloalkyl are optionally substituted by R, and the number of R is 1, 2 or 3; alternatively, R 6 and R 7 together with the ring atoms to which they are attached form ring A, and the ring A is selected from 5-7 membered heterocycloalkyl which is optionally substituted by R, and the number of R is 1, 2 or 3; R is independently selected from F, Cl, Br, I, OH, NH 2, C 1-3 alkyl, C 1-3 alkoxy and C 1-3 alkylamino; the 5-7 membered heterocycloalkyl contains 1, 2, 3 or 4 heteroatoms or heteroatom groups independently selected from -NH-, -S- and N. is a single bond or a double bond; R 1 is selected from H and C 1-3 alkyl, wherein the C 1-3 alkyl is optionally substituted by R, and the number of R is 1, 2 or 3; R 5 is selected from H and C 1-3 alkyl, wherein the C 1-3 alkyl is optionally substituted by R, and the number of R is 1, 2 or 3; R 6 is selected from R 61, r is 1 or 2; m is 1 or 2; D is selected from -N(R 2)-, -N + (O -)(R 2)- and -C(R 3)(R 4)-; R 2 is selected from H and C 1-3 alkyl, wherein the C 1-3 alkyl is optionally substituted by R, and the number of R is 1, 2 or 3; R 3 and R 4 are independently selected from H, F, Cl, Br, I, OH, NH 2 and C 1-3 alkyl, wherein the NH 2 and the C 1-3 alkyl are optionally substituted by R, and the number of R is 1, 2 or 3; alternatively, R 3 and R 4 together with the carbon atom to which they are attached form a 5-7 membered cycloalkyl or 5-7 membered heterocycloalkyl, wherein the 5-7 membered cycloalkyl and 5-7 membered heterocycloalkyl are optionally substituted by R, and the number of R is 1, 2 or 3; R 61 is selected from H, F, Cl, Br, I, OH, NH 2, C 1-3 alkoxy and -O-C 3-6 cycloalkyl, wherein the C 1-3 alkoxy and the -O-C 3-6 cycloalkyl are optionally substituted by R, and the number of R is 1, 2 or 3; R 7 is selected from H, F, Cl, Br, I, OH, NH 2, C 1-3 alkyl, C 1-3 alkoxy and 5-6 membered heterocycloalkyl, wherein the C 1-3 alkyl, C 1-3 alkoxy and 5-6 membered heterocycloalkyl are optionally substituted by R, and the number of R is 1, 2 or 3; alternatively, R 6 and R 7 together with the ring atoms to which they are attached form ring A, and the ring A is selected from 5-7 membered heterocycloalkyl which is optionally substituted by R, and the number of R is 1, 2 or 3; R is independently selected from F, Cl, Br, I, OH, NH 2, C 1-3 alkyl, C 1-3 alkoxy and C 1-3 alkylamino; the 5-7 membered heterocycloalkyl contains 1, 2, 3 or 4 heteroatoms or heteroatom groups independently selected from -NH-, -S- and N.