Mental health teams are to be placed in police stations and courts across London to help cut reoffending.