The accurate prediction of post-refracture production can be of great value in the selection of target wells for refracturing. Given that production from post-refracture wells yields time-series data, deep neural networks have been utilized for making these predictions. Conventional deep neural networks, including recurrent neural network and long shortterm memory neural network, often fail to effectively capture long-range dependencies, which is particularly evident in tasks such as forecasting oil well production over periods extending up to 36 years. To overcome this limitation, this paper presents a novel deep neural network based on Transformer architecture, meticulously designed by fine-tuning the key components of the architecture, including its dimensions, the number of encoder layers, attention heads, and iteration cycles. This Transformer-based model is deployed on a dataset from oil wells in the Junggar Basin that spans the period of 1983 to 2020. The results demonstrate that the Transformer significantly outperforms traditional models such as recurrent neural networks and long short-term memory, underscoring its enhanced ability to manage long-term dependencies within time-series data. Moreover, the predictive accuracy of Transformer was further validated with data from six newly refractured wells in the Junggar Basin, which underscored its effectiveness over both 90 and 180 days post-refracture. The effective application of the proposed Transformer-based time-series model affirms the feasibility of capturing long-term dependencies using Transformer-based encoders, which also allows for more accurate predictions compared to conventional deep learning techniques.