This paper investigates the reconfigurable intelligent surface (RIS)-aided uplink multicell massive multiple-input multiple-output (mMIMO) communication system with transceiver hardware impairments (THWIs), and the practical and feasible two-timescale scheme is used to design the phase shifts of RIS. We consider the Rician channel model and use maximal-ratio combining (MRC) technology to process the received signal at BS. The expression of the uplink achievable rate is derived and analyzed. Besides, genetic algorithm (GA) is used to optimize the phase shifts of RIS to maximize the data rate. Finally, the accuracy of the derived results is verified. The simulation results show that appropriately increasing the number of RIS’s reflecting elements can compensate for the performance loss caused by inter-cell interference and THWIs, and reduce the demand for the number of BS antennas, which can significantly reduce the hardware costs at the BS.