instruction: calculate the number of medications that were prescribed to patient 005-18714 until 4 months ago.
response: SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-18714')) AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-4 month')