How can I check if a cow has been hit in Minecraft?

De
1

I need help with Minecraft version 1.15.2 because I want to use a repeating command to check whether a cow has been attacked so that a playsound command comes in, but I don't know if this is possible!

an

You could check if the cow has fewer hearts than normal.