The Israeli military has detained dozens of medical staff and patients while it occupied a hospital in northern Gaza.