The present invention relates to the field of medicinal chemistry, specifically to a compound containing lactam and derivative thereof, and especially to a pyridine derivative as represented by general formula (I), preparation method and use thereof as an Xa factor inhibitor. The present invention further relates to the medical use of the compound and derivative thereof in preparation of anticoagulant drugs, particularly to the use in preparation of drugs for preventing or treating thrombosis or embolism.