A review said staffing shortages also contributed to delays and patients being harmed at the Royal Infirmary of Edinburgh.