Usually, when using a Z code referring to use of medications, the primary code is for the disease being treated by the medication being taken.
For example, if you have a patient taking Plaquenil for Rheumatoid arthitis your coding order would be:
1) Code for rheumatoid arthritis
2) Your Z79.899
3) If the patient is found to have an adverse effect from the medication, you have to look up the Plaquenil up by its generic name, hydroxyquinolone, in the Table of Drugs and Chemicals and put that T code as the third diagnosis code. Remember to add the appropriate A, D or S character at the end.
Tom Cheezum, OD, CPC, COPC