Please read below from 3M ICD10-CM coding handbook:
Codes from category Z79 are assigned to indicate a patient's continuous use of a prescribed drug for an extended period. For example, codes from category Z79 are assigned for long-term use of medication:
As a prophylactic measure (e.g., to prevent deep vein thrombosis)
As treatment of a chronic condition (e.g., arthritis)
For a disease requiring a lengthy course of treatment (e.g., cancer)
A code from category Z79 is appropriately assigned when the patient is currently receiving long-term anticoagulant therapy (Z79.01), antithrombotics/antiplatelets (Z79.02), nonsteroidal anti-inflammatories (Z79.1), antibiotic therapy (Z79.2), hormonal contraceptives (Z79.3), insulin (Z79.4), steroids (Z79.51-Z79.52), immunomodulators and immunosuppressants (Z79.60-Z79.69) or other long-term drug therapy (Z79.81-Z79.899). Subcategory Z79.8 includes long-term use of selective estrogen receptor modulators (Z79.810), aromatase inhibitors (Z79.811), other agents affecting estrogen receptors and estrogen levels (Z79.818), aspirin (Z79.82), bisphosphonates (Z79.83), oral hypoglycemic drugs (Z79.84), injectable non-insulin antidiabetic drugs (Z79.85), hormone replacement therapy (Z79.890), opiate analgesic (Z79.891), and other long-term drug therapy (Z79.899). An additional code is assigned for the condition for which the medication is prescribed.
Note that coding guidelines do not provide a definition or time frame for long-term drug therapy. If a patient receives a drug on a regular basis and has multiple refills available for a prescription, it is appropriate to document long-term drug use. Documentation of long-term drug use is at the discretion of the health care provider.
Do not assign a code from category Z79 when the medication is prescribed to treat an acute illness or injury and is being given for a brief period of time (e.g., antibiotics to treat bronchitis). Codes from category Z79 are also not used when medications are given for detoxification or maintenance programs used to prevent withdrawal symptoms in patients with drug dependence. For example, long-term use of methadone for pain management is coded with Z79.891, Long term (current) use of opiate analgesic, but the use of methadone in a maintenance program to prevent withdrawal symptoms is coded using the drug dependence code (F11.2-).