All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, is His slave and Messenger.
Offering gifts to the doctors often leads them to fall into Islamic violations. They may prescribe the medicine to those who do not need it, or prescribe it to patients on the basis that it has some specifications (or benefits) while in reality this medicine does not have them, or that other medicines are better than it and more beneficial to the patient but the doctors do not prescribe it because of receiving a bribe [to prescribe the medicine of the person who bribed him].
You mentioned in your question that the doctor does not prescribe the medicine to his patients unless he had received some gifts or money from the company or the wholesaler, and that he does not prescribe it based on medical ethics but rather depending on the gift or bribe that he gets.
Even if we presume that the doctor is not like this and that he prescribes the medicine based on the patient's need and the quality of the medicine, then the patient's best interest and welfare require closing this door, lest it would lead to cheating patients, greed, and corruption.
The Fatwa of the Standing Committee for Iftaa' reads: “The representative of the company who offers gifts to the doctors in order to promote the medicines of that company at the expense of other companies is considered a middle man who intermediates between the person who offers the bribe and the one who takes it. The Prophet cursed these three types of people as he said: “The curse of Allah is upon the one who offers a bribe, the one who takes it and the one who intermediates between the two.” [Ahmad]
For more benefit on doctors taking a bribe to prescribe medicines, please refer to Fataawa 115843, 329050, and 99730.
Allah knows best.