Thanks for your question.
Catholic moral teaching allows patients to receive medication when it's needed for the purpose of reducing pain, so it sounds like your father's case was part of legitimate medical treatment and conformed to Catholic medical ethics.
Sometimes people are concerned that such a medication might shorten the patient's life. If that is the case, it can still be acceptable as long as the pain-killing effect is worthwhile and the harmful effect is unintended.
There is an article about the care of terminally ill patients and this issue on the U.S. bishop's web site:
I hope this helps. God bless!
— Richard Chonak, for AskACatholic.com