Integrable and superintegrable quantum systems in a magnetic field