The present invention provides Pyrazolopyrimidinonefor or pyrrolo-triazine ketones derivant, preparation method and its application in medicine. Specifically, the present invention relates to Pyrazolopyrimidinonefor shown in a kind of logical formula (I) or pyrrolo-triazine ketones derivants and its officinal salt, preparation method and they as gonadotropin-releasing hormone (GnRH) receptor antagonist especially as the purposes of the therapeutic agents such as endometriosis, definition is the same as that in the specification for each substituent group in formula of (I).本發明提供了吡唑并嘧啶酮類或吡咯并三嗪酮類衍生物,其製備方法及其在醫藥上的應用。具體而言,本發明涉及一種通式(I)所示的吡唑并嘧啶酮類或吡咯并三嗪酮類衍生物及其可藥用鹽,其製備方法以及它們作爲促性腺素釋放激素(GnRH)受體拮抗劑特別是作爲子宮內膜異位症等治療劑的用途,其中通式(I)中的各取代基的定義與說明書中的定義相同。