A General Equilibrium Model of the Term Structure of Interest Rates under Regime-switching Risk