Changed query in summarize_patients to handle all patients