public static PersonName valueOf( String s, FuzzyStr fuzzyStr, String nullValueStr, PersonName prev) { if (s == null) return null; org.dcm4che3.data.PersonName pn = new org.dcm4che3.data.PersonName(s, true); if (pn.isEmpty()) return null; if (prev != null) { if (!pn.equals(prev.toPersonName())) prev.fromDicom(pn, fuzzyStr, nullValueStr); // update values return prev; } else return new PersonName(pn, fuzzyStr, nullValueStr); // create new }
public org.dcm4che3.data.PersonName toPersonName() { org.dcm4che3.data.PersonName pn = new org.dcm4che3.data.PersonName(); pn.set(Group.Alphabetic, Component.FamilyName, familyName); pn.set(Group.Alphabetic, Component.GivenName, givenName); pn.set(Group.Alphabetic, Component.MiddleName, middleName); pn.set(Group.Alphabetic, Component.NamePrefix, namePrefix); pn.set(Group.Alphabetic, Component.NameSuffix, nameSuffix); pn.set(Group.Ideographic, Component.FamilyName, ideographicFamilyName); pn.set(Group.Ideographic, Component.GivenName, ideographicGivenName); pn.set(Group.Ideographic, Component.MiddleName, ideographicMiddleName); pn.set(Group.Ideographic, Component.NamePrefix, ideographicNamePrefix); pn.set(Group.Ideographic, Component.NameSuffix, ideographicNameSuffix); pn.set(Group.Phonetic, Component.FamilyName, phoneticFamilyName); pn.set(Group.Phonetic, Component.GivenName, phoneticGivenName); pn.set(Group.Phonetic, Component.MiddleName, phoneticMiddleName); pn.set(Group.Phonetic, Component.NamePrefix, phoneticNamePrefix); pn.set(Group.Phonetic, Component.NameSuffix, phoneticNameSuffix); return pn; }
private void fromDicom(org.dcm4che3.data.PersonName pn, FuzzyStr fuzzyStr, String nullValueStr) { familyName = pn.get(Group.Alphabetic, Component.FamilyName); givenName = pn.get(Group.Alphabetic, Component.GivenName); middleName = pn.get(Group.Alphabetic, Component.MiddleName); namePrefix = pn.get(Group.Alphabetic, Component.NamePrefix); nameSuffix = pn.get(Group.Alphabetic, Component.NameSuffix); ideographicFamilyName = pn.get(Group.Ideographic, Component.FamilyName); ideographicGivenName = pn.get(Group.Ideographic, Component.GivenName); ideographicMiddleName = pn.get(Group.Ideographic, Component.MiddleName); ideographicNamePrefix = pn.get(Group.Ideographic, Component.NamePrefix); ideographicNameSuffix = pn.get(Group.Ideographic, Component.NameSuffix); phoneticFamilyName = pn.get(Group.Phonetic, Component.FamilyName); phoneticGivenName = pn.get(Group.Phonetic, Component.GivenName); phoneticMiddleName = pn.get(Group.Phonetic, Component.MiddleName); phoneticNamePrefix = pn.get(Group.Phonetic, Component.NamePrefix); phoneticNameSuffix = pn.get(Group.Phonetic, Component.NameSuffix); createOrUpdateSoundexCodes(fuzzyStr, nullValueStr, familyName, givenName, middleName); }