A man has allegedly been hit in the head with a hammer while in hospital, leaving him in a critical condition.