Goteni (御典医)
Goteni (御典医) were doctors who belonged to Tenyakuryo (the Bureau of Medicine) in the Imperial Court, and were simply called teni. In extension, in the Edo period the doctors who were employed by the shogun family or daimyo (feudal lord) were also called by this name. In this case, it is sometimes described as 御殿医 (goteni).
Goteni in the meaning of doctors of Tenyakuryo indicates, except Tenyaku no kami (the head of tenyakuryo) which was an honorary position, the doctors who were indeed engaged in treatment of emperors. In the early modern times, in most cases, when a private doctor was employed by the Court, he was given an official court rank at the same time and became jigenin (a lower rank of ancient Japanese nobility).
On the other hand, in the case of goteni of samurai, the doctors who got close with the shogun or hanshu (the lord of domain) to treat them were given a position of quasi-samurai.