Purpose Surgical workflow recognition has emerged an important part of computer-assisted intervention systems for the modern operating room, and at the same time a very challenging problem. For sequence data, modelling of temporal information is essential for accurate identification. However, current phase recognition methods based on the CNN framework are not very adequate for the extraction of long-range dependencies. Methods Therefore, to better capture long-range dependencies, we propose a Temporal-based Swin Transformer Network (TSTNet) for the surgical video workflow recognition task. TSTNet contains two main parts: the Swin Transformer and the LSTM. The Swin Transformer incorporates the attention mechanism to encode remote dependencies and learn highly expressive representations. The LSTM is capable of learning longrange dependencies and is used to extract temporal information. The TSTNet organically combines the two components to extract spatiotemporal features that contain more contextual information. In particular, based on a full understanding of the natural features of the surgical video, we propose a priori revision algorithm (PRA) using a priori information about the sequence of the surgical phase. This strategy optimises the output of TSTNet and further improves the recognition performance. Results We have conducted extensive experiments using the Cholec80 dataset to validate the effectiveness of the TSTNet-PRA method. Our method achieves excellent performance on the Cholec80 dataset and can achieve an accuracy of 93.5%. This greatly exceeds the state-of-the-art methods. Conclusion By modelling remote temporal information and multi-scale visual information, we proposed the TSTNet-PRA method. It was evaluated on a large public dataset, showing high recognition capability superior to other spatiotemporal networks.