An UDI-DI is the Device Identifier incorporated in the UDI, also known as the GTIN. EAN and GTIN are two names for the same thing, both are article codes. The GTIN is the article code that uniquely identifies the product.
For medical devices, the GTIN must contain 14 positions. Therefore, simply add a leading zero to a 13-digit article code (EAN) to create a 14-digit GTIN. For more information on GS1 article codes (GTINs), please refer to Chapter 2 of the GS1 GTIN Allocation Rules and Chapter 3.3.2 of the GS1 General Specifications.
For the UDI-DI, the Application Identifier (AI) 01 is used to add the GTIN, as a unique article identifier, to the barcode. For the UDI-PI, for example, the Application Identifiers 17 (expiration date), 10 (batch/lot number), 21 (serial number) and 11 (production date) can be included in the barcode. Which AIs apply to the UDI-PI for you is your own interpretation of the legislation.

GS1 Application Identifiers (AI's) are prefixes used in GS1 barcodes. They include additional information in the barcode. The numbers in parentheses reflect which information follows (e.g. (01): article code/GTIN). So the information is in the number sequence behind the brackets. Some common AI's in healthcare:
Article code/GTIN: AI (01) - numeric, 14 digits. Example: 08712345000738
Lot/batch number: AI (10) - alphanumeric, 20 digits. Example: AB1234...
Serial number: AI (21) - alphanumeric, 20 digits. Example: 123456789...
Expiration date: AI (17) - YYMMDD, 6 digits. Example: 220529
Production date: AI (11) - YYMMDD, 6 digits. Example: 180320
More information about the different application identifiers and their structure can be found in chapter 3 of the GS1 General Specifications.