I'm pretty sure there's no RAW reason why this spell can't be cast on oneself. Is this the case? As an example, could a recovering alcoholic cast geas on themselves to refrain from drinking?
Certainly, but you could also remove it
It has been established that in normal circumstances, you can see yourself. So you are a valid target of this spell.
But it's worth noting that:
You can end the spell early by using an action to dismiss it. (PHB, p. 245)
So this spell would only last as long as you wanted. If you are trying to force yourself to do something, that takes some out of the teeth out of the tactic.
You can target yourself
The only requirements are
on a creature that you can see within range
You are a creature, you can see yourself - unless you are blinded, invisible or something like that - and you are within range. You are a valid target.
For reference, Crawford talks about this targetting for other spells.
I don't know about you, but when I look down, I can see myself. Blinding me would definitely change that. #DnD #Optics
Now, how does it affect you? RAW, it does what it says
If the creature can understand you, it must succeed on a Wisdom saving throw or become charmed by you for the duration. While the creature is charmed by you, it takes 5d10 psychic damage each time it acts in a manner directly counter to your instructions, but no more than once each day.
You will, awkwardly, have to roll a saving throw against yourself and be charmed by yourself (which doesn't actually change many things). If the PC tries to drink, he takes 5d10 damage.