Use automatic data binding in templates.
Get barcode of selected patient from model instead of data attribute.