The invention discloses a condensed heterocyclic compound as well as a preparation method, a pharmaceutical composition and an application thereof. The condensed heterocyclic compound is shown by a formula I, a formula II or a formula III in the specification. The preparation method of the condensed heterocyclic compound and/or pharmaceutically acceptable salt thereof comprises the three synthetic routes. The invention also provides a pharmaceutical composition of the condensed heterocyclic compound. The pharmaceutical composition contains at least one or more of the condensed heterocyclic compound shown by the formula I, the formula II or the formula III, a pharmaceutically acceptable salt, hydrate, a solvate, a polymorphic substance and a prodrug of the condensed heterocyclic compound as well as a pharmaceutically acceptable carrier. The invention also relates to applications of the condensed heterocyclic compound and/or the pharmaceutical composition in the preparation of a kinase inhibitor, and the preparation of medicaments for preventing and treating kinase related diseases. The condensed heterocyclic compound disclosed by the invention has a selective inhibitory action on PI3Kdelta, and can be used for preparing medicaments for preventing and treating cell proliferation type diseases including cancers, infections, inflammations or autoimmunity pathological changes and the like.