Mean-field theory of intermediate valence/heavy fermion systems