Tea pest and disease named entity recognition (NER) faces challenges resulting from dense domain terminology, multi-granularity entity structures, and long-distance semantic dependencies. This paper proposes E-BERT-wwm-BiGRU-RAT-CRF, integrating whole-word masking E-BERT with three innovations—a trainable relative position bias matrix, a cross-layer hierarchical mask matrix, and a heterogeneous multi-head attention mechanism—followed by bidirectional gated recurrent units (BiGRU), residual attention (RAT), and conditional random fields (CRF). On a self-constructed tea pest and disease corpus of over 300,000 characters across seven entity categories, the model achieves 93.67% precision, 93.07% recall, and 93.37% F1-score, outperforming the baseline by 2.73 percentage points in F1-score. Ablation experiments confirm the contribution of each module.