A heterocyclic compound and application thereof in medicine. Specifically disclosed is a heterocyclic compound as shown in Formula I, or an isotopically-labeled compound thereof, or an optical isomer, a geometric isomer, a tautomer or an isomer mixture thereof, or a pharmaceutically acceptable salt thereof or a precursor medicine thereof. The disclosure also relates to the medical application of these compounds.