The obvious solution to all of this is to legalize all drugs and crack down hard on doctors overprescribing. The issue should be fixed preventively, because let's be honest with the situation, most addicts don't get clean. The relapse rate for heroin is like 80%.
As much as reddit doesn't like to admit it, the best way to not become an addict is to avoid hard drugs. They're nothing but bad news.
Sad to say, but theres nothing much you can do to get an addict clean. The goal should be to minimize the cost. Drugs should be legalized and we shouldn't be spending money putting junkies in jail.
I think the most humane thing to do is provide needle exchanges and safe spaces for junkies to use. But to provide in-patient treatment for everyone? Call me heartless, but lets be real, that's just a waste of money. Sooner or later most addicts are going to commit crimes and end up in jail anyway, or dead from an overdose.