This is another dismissal you rarely see in cricket.
But a batter can be given out "hit the ball twice" if the second strike is deliberate.
There are two exceptions that allow a batsman to hit the ball on a second occasion:
Protecting their wicket (ie: stopping the ball from rolling back on to the stumps).
And returning the ball to the fielding team, with their permission
The batsman is not allowed to hit the ball a second time to prevent a catch - and he is also out if in hitting the ball a second time to protect his wicket, he prevents a catch.
The bowler does not get credit for the wicket.