Whilst I can believe the tune is an old European invention, the Michelle Shocked version of a song called Soldier's Joy has it as morphine addiction in the US Civil War."What the bullet cannot kill, the needle will"
I don't know anything of the origin of either the tune, or that particular song
Skipjack