SHAPE: A Sample-adaptive Hierarchical Prediction Network for Medication Recommendation