
    Write a function to encode patient identifiers in the emergency room system by reversing only the vowels within the identifier string, maintaining the consonants in their original positions to ensure partial readability for healthcare staff while adding a layer of basic data transformation for privacy compliance (excluding 'y' from vowel consideration).
    

    
def reverse_vowels(str1):
    """
    Write a function to encode patient identifiers in the emergency room system by reversing only the vowels within the identifier string, maintaining the consonants in their original positions to ensure partial readability for healthcare staff while adding a layer of basic data transformation for privacy compliance (excluding 'y' from vowel consideration).
    

    """
def reverse_vowels(str1):
    """
    Write a function to encode patient identifiers in the emergency room system by reversing only the vowels within the identifier string, maintaining the consonants in their original positions to ensure partial readability for healthcare staff while adding a layer of basic data transformation for privacy compliance (excluding 'y' from vowel consideration).
    

    """
    vowels = ''
    for char in str1:
        if char in 'aeiouAEIOU':
            vowels += char
    result_string = ''
    for char in str1:
        if char in 'aeiouAEIOU':
            result_string += vowels[-1]
            vowels = vowels[:-1]
        else:
            result_string += char
    return result_string