that places are in Yunnan province and I have no idea how many days your planning. But if I were you, I will plan it for 10 days and then heading to Chongqing, for Yangze river cruising to Shanghai. This trip will take 7 - 8 days approx. 5 days spending in Shanghai and then heading to Qingdao by train (I have no idea with this city might be 2 - 3 days)
Qingdao to Beijing by train as well, take a time in Beijing 7 days is enough.
40 - 45 days are flexible as your itinerary plan.