Actually, I'd take the easy route and dispense with visas, just try to time your flights to grab as much of the 72 hour TWOV allowance as you can, during productive daylight hours. While you'll have to stay in Shanghai municipality for your overnights, nobody is going to fret if you want to take a daytrip to a nearby water town or Suzhou or Hangzhou during your stay there. Shanghai city itself is probably good for 1.5-2 days. Hong Kong can fill up the balance of your time, and there's plenty to see in the outer islands or take a daytrip over to Macau which has interesting stuff to see, even if you don't set foot inside a casino.