Pay your doctor, because god made him. God certainly didn't give him antibiotics or vaccines, at least not for another 2000 years or so, but oh well. Anyway, kings and great men are supposed to praise their essentially worthless healers and thank god for whatever 'medicines' they were using back then, like water made sweet with wood (v. 5). Apparently, god also gave physicians the skills to take away pain without anesthesia, and the apothecary the tools to make medications.
Of course, if you get sick, you can always just pray and god will help. Even better would be to avoid getting ill in the first place, which is perfectly possible so long as you don't sin, purge evil thoughts from your heart, do your sacrifices, and pay your doctor.
Suddenly in verse 15, the chapter does a complete turn around. It goes from praising doctors as tools of god to saying only sinners need to visit them.
Then just as abruptly, we get mourning instructions. First, you have to cry like a North Korean whose dictator has just died, and for exactly the same reason: lest thou be evil spoken of (v. 17). After a day or two you can bury the body. After that, though, you have to suck it up and get back to living, because excessive mourning is bad for your health.
Then Solomon has some advice for working class people, namely: suck it up. You'll never have social, political or judicial power, but the city can't run without you, so you should work hard so you can get into heaven.
Now onto the useless gits who sit around all day making prophecies. Well, those people will get to hobknob with princes and travel abroad to tell the rest of us how to live. When they die, we'll remember their names.
Next we're reminded not to question god, because everything happens for a reason and holy people can understand them, but wicked people never will. Also, god has given us everything we need, a list that consists entirely of: water, fire, iron, and salt, flour of wheat, honey, milk, and the blood of grape and oil, and clothing (v. 26). Note that this list does not include proper ventilation, street lighting or shower gel, all of which I personally need and make me so glad I live in the 21st century and not 200 BCE.
And now on to the smiting, because there are evil people out there who can't appreciate all the wonderful things god has provided to believers. Those people will be killed with the same boring, repetitive list of evils they're always being threatened with. And the believers will watch it all and rejoice because people are awful.