A heat exchanger, operating in a cooling mode or a heating mode, a heat exchange medium flowing through via a first flow path within the heat exchanger in the cooling mode, and flowing through via a second flow path (C, C1, C2) within the heat exchanger in the heating mode, wherein a diversion component is disposed within the heat exchanger, the diversion component is configured such that the length of the first flow path is different from the length of the second flow path, a partial segment of the first flow path and a partial segment of the second flow path overlap with each other, and flow directions of the heat exchange medium therein are identical; wherein an inlet end and an outlet end of the first flow path are respectively in communication with a first piping and a second piping that are connected to the heat exchanger, and an inlet end and an outlet end of the second flow path are in communication with the second piping and the first piping respectively; wherein the diversion component comprises: one or more first heat exchange tube bundles (11a, b, c, d) and one or more second heat exchange tube bundles (12a, b), wherein the first heat exchange tube bundle is disposed upstream of the second heat exchange tube bundle along the flow direction of the heat exchange medium within the first flow path and is in communication with the first piping, the second heat exchange tube bundle is in communication with the first piping and the second piping, a first check valve is disposed between the second heat exchange tube bundle and the first piping to prevent the heat exchange medium from flowing backward from the first piping to the second heat exchange tube bundle, and a second check valve is disposed between the second heat exchange tube bundle and the second piping to prevent the heat exchange medium from flowing backward from the second piping to the second heat exchange tube bundle; characterized by one or more intermediate manifolds (1, 2) disposed between and in communication with the first heat exchange tube bundle and the second heat exchange tube bundle; and a dispenser, wherein one port of the dispenser is in communication with the second piping, a third check valve is disposed between the dispenser and the second piping to prevent the heat exchange medium from flowing backward from the dispenser to the second piping, and another port is in communication with the intermediate manifold. one or more first heat exchange tube bundles (11a, b, c, d) and one or more second heat exchange tube bundles (12a, b), wherein the first heat exchange tube bundle is disposed upstream of the second heat exchange tube bundle along the flow direction of the heat exchange medium within the first flow path and is in communication with the first piping, the second heat exchange tube bundle is in communication with the first piping and the second piping, a first check valve is disposed between the second heat exchange tube bundle and the first piping to prevent the heat exchange medium from flowing backward from the first piping to the second heat exchange tube bundle, and a second check valve is disposed between the second heat exchange tube bundle and the second piping to prevent the heat exchange medium from flowing backward from the second piping to the second heat exchange tube bundle; characterized by one or more intermediate manifolds (1, 2) disposed between and in communication with the first heat exchange tube bundle and the second heat exchange tube bundle; and a dispenser, wherein one port of the dispenser is in communication with the second piping, a third check valve is disposed between the dispenser and the second piping to prevent the heat exchange medium from flowing backward from the dispenser to the second piping, and another port is in communication with the intermediate manifold.