The article examines legal safeguards for maintaining medical secrecy when confidential patient information is transferred for processing by artificial intelligence systems. It shows that the use of AI in healthcare complicates the circulation of such information, expands the range of actors who may gain access to the data, and increases the importance of legal certainty as to the lawful basis for transfer, patient information requirements, and the limits and procedures for controlling subsequent use of the information. The paper identifies key problem areas: the insufficiency of one-time informed consent to medical intervention as a universal basis for AI processing, the limited protective value of de-identification when used as a stand-alone safeguard, and the risk of re-identification. The article outlines the main directions for improving the legal framework by clarifying the grounds for data transfer, standards for patient information, and mechanisms for access control and accountability in AI-based processing.