A heat exchanger includes a vapor collection pipe, a liquid collection pipe, and an exchange pipeline. The exchange pipeline includes a condensing section, an evaporation section, and a transition section. An upper end of the condensing section is connected to the vapor collection pipe. A lower end of the condensing section is connected to a first end of the transition section. An upper end of the evaporation section is connected to a second end of the transition section. A lower end of the evaporation section is connected to the liquid collection pipe. The evaporation section and the condensing section respectively extend in directions opposite to each other.