I went to see my friend in the hospital but he had been alredy discharged from hospital and went to his home. So I went to his home.
Can I say ?
1) I had gone to see you in the Hospital but doctor said you had been discharged today.
Yes¹, but you need to add an article in front of doctor (either a doctor, as in any doctor at the hospital, or the doctor, meaning either specifically the one who spoke to you or perhaps the one who discharged your friend. Otherwise excellent.
@stangdon does make the (reasonable!) point that the past perfect is often overused, and particularly by those learning English as a foreign language. It’s often unnecessary, and even in this case you can avoid it, just by phrasing it as (for example) I went to the hospital to see you, but on arriving there was told you had already been discharged. You can’t avoid it for the second part of the sentence (had been or had already been discharged) because that very definitely happened before you got there and were informed of it.
I think it’s worth noting that often these forms differ between written and spoken English — the “more complex” tenses are much more common in writing; when speaking one tends to avoid them by adding a lot of extra words to indicate when and/or where one is talking about.
¹ For the <!--
pedants--> inquiring minds who think it’s somehow wrong, simply consider that he must mean that he had arrived at the hospital with the intention of seeing his friend, prior to being informed by the doctor that his friend had already been discharged.
No, "I had gone to see you" doesn't make sense here. The past perfect is used when we are discussing an event that happened in the past before another event in the past. That's why "the doctor said you had been discharged" is correct, but "I had gone to see you" doesn't.
The sequence of events looks like this:
1. You are discharged from the hospital
2. I go to see you at the hospital and the doctor tells me about event #1.
3. I tell you about event #2.
So at time #3, I can say that at time #2, you already had been discharged (because the discharge happened before I went to see you), but it doesn't make sense to say "I had gone to see you" because going to see you didn't happen before some other event that we're talking about.