What causes treatment failure - the patient, primary care, secondary care or inadequate interaction in the health services?

What causes treatment failure - the patient, primary care, secondary care or inadequate interaction in the health services?