The combination of deep learning and the medical field has recently achieved great success, particularly in recommending medicine for patients. However, patients' clinical records often contain repeated medical information that can significantly impact their health condition. Most existing methods for modeling longitudinal patient information overlook the impact of individual diagnoses and procedures on the patient's health, resulting in insufficient patient representation and limited accuracy of medicine recommendations. Therefore, we propose a medicine recommendation model called KEAN, which is based on an attention aggregation network and enhanced graph convolution. Specifically, KEAN can aggregate individual diagnoses and procedures in patient visits to capture significant features that affect patients' diseases. We further incorporate medicine knowledge from complex medicine combinations, reduce drug-drug interactions (DDIs), and recommend medicines that are beneficial to patients' health. The experimental results on the MIMIC-III dataset demonstrate that our model outperforms existing advanced methods, which highlights the effectiveness of the proposed method.