If you have come to Barcelona to live and want access to public healthcare (CatSalut) you must get an individual healthcare card (TSI).
The TSI is a personal and non-transferable document that gives you access to public health system centres and services, and to pharmacy provision at a subsidised rate.
If you work, having your TSI is worthwhile even if you have private medical insurance. The reason is that only a public health system doctor can authorise paid leave if you are ill.
When a company hires you and registers you with the social security system, you are entitled to public healthcare for you and for your dependants.
If you are insured, you can request your TSI; if not, first you must request recognition of entitlement to healthcare.