Dynamic mean-variance and optimal reinsurance problems under the no-bankruptcy constraint for an insurer