AI to be used in bid to cut hospital waiting times