Well, the first episode of the sopranos aired january 10th, 1999 while analyze this was released march 5th, 1999. That being said, its impossible to know who wrote it first.
I just found out that who came up idea was the movie called "The Don's Analyst".