Prescribed opioids in primary care: cross-sectional and longitudinal analyses of influence of patient and practice characteristics