xml.mmlPi :PatientModule do
xml.mmlPi :uniqueInfo do xml.mmlPi :masterId do xml << masterId.to_xml end otherId.each do |item| xml.mmlPi :otherId, {'mmlPi:type' => item.type} do xml << item.id.to_xml end end if otherId end personName.each do |name| xml.mmlPi :personName do xml << name.to_xml end end xml.mmlPi :birthday, birthday xml.mmlPi :sex, sex if nationality attributes = Hash.new attributes = {'mmlPi:subtype' => nationality.subtype} if nationality.subtype xml.mmlPi :nationality, nationality.value, attributes end if race attributes = Hash.new attributes = {'mmlPi:raceCode' => race.raceCode} if race.raceCode attributes['mmlPi:raceCodeId'] = race.raceCodeId if race.raceCodeId xml.mmlPi :race, race.value, attributes end xml.mmlPi :marital, marital xml.mmlPi :addresses do addresses.each do |address| xml << address.to_xml end end if addresses xml.mmlPi :emailAddresses do emailAddresses.each do |email| xml.mmlCm :email, email end if emailAddresses end if emailAddresses xml.mmlPi :phones do phones.each do |phone| xml << phone.to_xml end end if phones xml.mmlPi :accountNumber, accountNumber if accountNumber xml.mmlPi :socialIdentification, socialIdentification if socialIdentification death_attr = Hash.new death_attr = {'mmlPi:date' => death.date} if death.date xml.mmlPi :death, death.flag.to_s, death_attr unless death.nil?
end