The difference is that the use of duty implies a moral obligation, whereas the use of job typically doesn't carry the same weight. For instance, the examples you used have the have the same meaning. However, if you use "duty" you convey a sense of personal responsibility to the listener. That you have a responsibility to provide the highest level of care to the patients and look out for their best interest. As a native english speaker, I would only use duty when referring to jobs where the listener also agrees that there's an underlying moral obligation.
I'll try my best to give you a few examples.
A doctor has a duty to listen to his patients concerns and provide a high quality of care.
A doctor also has a duty to respect his patient's privacy and not divulge their personal information.
A police officer has a duty to protect and serve the people and not abuse their power.
A soldier has a duty to obey his commanding officer and protect his country.
A parent has a duty to feed, provide shelter, take care of their children.
Hopefully those examples provide a few instances where you might use duty. In the end, you'd be safer using "job" is most situations. FYI - Linda Barrett's response is also correct :) it can refer to specific tasks as a part of your overall role within an organization