The Shulchan Aruch 204:8 writes that any food or drink that one eats for medicinal purposes and has a good flavor requires a bracha before and after (if they eat a shiur). However, in si'if 11 the Rama writes that we don't make the appropriate bracha, rather we always make the bracha of shehakol. The M.B. explains the rationale is that since it is a medicine only eaten by sick people, even though there is benefit, the primary benefit is the medicinal purpose. We only make the appropriate bracha when the primary benefit is for the food, because the bracha is designed to be food specific, but when the primary benefit is medicinal, the bracha is the general bracha. The M.B. cites many achronim who disagree with the Rama and hold that one always makes the appropriate bracha. The M.B. and Rav Moshe (Igros Moshe 1:?) rule that the appropriate bracha for that food should be recited.
The source of this discussion is the gemara regarding shesisa which is made thick for eating purposes, since it contains grain the bracha is mezonos, but when it is made thin and liquidy for the purpose of refuah the bracha is shehakol. It isn't clear whether the primary distinction of the gemara is how it is prepared, or what purpose one is using it for.
Rabbeinu Yona explains that the gemara doesn't mean to say that it loses its normal bracha because it is being used for medicinal purposes. The fact that one uses it for medicine is not a reason for the bracha to change. Rather, the gemara is saying that when it is made so thin and liquidy, the grain is not a primary ingredient (maybe it is only there to give some consistency - לדבק), therefore even if eaten for enjoyment and not for medicine one makes a shehakol. According to Rabbeinu Yona, this gemara is not mechadesh that for medicines the bracha is always shehakol, rather we always make the proper bracha on the medicine based on its ingredients.
The source of the ruling of the Rama is the Rosh (13) who writes very simply that when the purpose of the eating is for "achila" the bracha on the shesisa is mezonos, when the purpose is "refuah" the bracha is shehakol. The Rosh seems to understand that regardless of whether it is made from grains that should be mezonos or other vegetables that should be ha'adoma, if eaten for refuah it is always shehakol, as the Rama writes. The Divrei Chamudos explains that it is different than anigron which contains a lot of oil and is eaten for refuah, yet the gemara says we make ha'eitz, because that is something that even healthy people drink. But, something which is really a medicine and eaten primarily by sick people always gets a shehakol.
It seems to me that Tosafos has an opinion somewhere in between Rabbeinu Yona and the Rosh. Tosafos writes that the bracha on shesisa when made thin for refuah purposes is shehakol -
ומ"מ לא יברך אלא שהכל כיון שאינו עשוי לסעוד כי אם לשתות, וא"כ כל דבר שיש בו מחמשת המינין ואינו עשוי לסעוד כי אם לשתות כגון שכר וכיוצ"ב מברך שהכל
Tosafos seems to understand that the rationale behind shehakol has nothing to do with the consistency being thin, and nothing to do with the intent to use it for refuah. Rather, the rule of Rav and Shmuel that grains are always considered a primary ingredient even when they are a minority is because they are meant to be סועד - to satisfy and fill one up. Tosafos understands that whenever one is eating something that contains grains and their intent is not to be סועד, rather they are intending to use it as a refuah i.e. shesisa, or meant to be a drink i.e. beer, we don't apply the rule of כל שיש בו מחמשת המינין מברכין עליו בורא מיני מזונות, therefore the bracha is shehakol. According to this approach, Tosafos is saying a chiddush in the halacha of כל שיש בו מחמשת המינין וכו, not a chiddush in the halacha of making brachos on medicine. Therefore, if for example the medicine will contain a majority of grain so that even without this din of כל שיש בו the bracha would be mezonos, one would make mezonos even if it is for refuah. Similarly, if it is made from vegetables the bracha will be ho'adama. Only when it is made from grain and the grain is a minority ingredient will Tosafos say that the bracha is shehakol since the chiddusho of Rav and Shmuel that when something contains grain it is always mezonos, only applies if it is functioning to be סועד.
Based on this, it seems to me that even if we pasken like the other achronim who hold that the appropriate bracha is always made, nevertheless, if it is made from grain and that grain is a minority, the bracha should be shehakol when eaten for refuah. We would reject the ruling of the Rama when the appropriate bracha based on the majority ingredient is mezonos or ho'adama, and make the appropriate bracha. But, we would accept the Rama when the mezonos is a minority ingredient, based on Tosafos.
According to my approach, the language of the M.B. in the sha'ar hatziyun 204:45 that the Rama rules that you make a shehakol "even when made from the 5 grains" is not so accurate. Perhaps only when it is an issue of being made from the 5 grains and they are a minority ingredient would we make shehakol, but if made from a vegetables we would make ho'adama when it is the majority ingredient.