How to create barcode using customer ID

I want to generate barcode from patient number and patient name. I have written the code below but nothing is displayed in the print format result. How do I implement this??

{% for name in patientEncounter %}

 {{ doc.barcode }} = {{ doc.name }}

{% endfor %}