UniECG: Understanding and Generating ECG in One Unified Model