Effectiveness of primary health care evaluated by a longitudinal ecological approach