コード例 #1
0
ファイル: PatientModule.cs プロジェクト: anhlai/EMR-MML
        public override void LoadFromXml(XmlNode node)
        {
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(node.OwnerDocument.NameTable);

            nsmgr.AddNamespace(NameSpacePrefix, NameSpaceURI);
            nsmgr.AddNamespace(MmlNm.Name.NameSpacePrefix, MmlNm.Name.NameSpaceURI);
            nsmgr.AddNamespace(MmlAd.Address.NameSpacePrefix, MmlAd.Address.NameSpaceURI);
            nsmgr.AddNamespace(MmlCm.MailAddress.NameSpacePrefix, MmlCm.MailAddress.NameSpaceURI);
            nsmgr.AddNamespace(MmlPh.Phone.NameSpacePrefix, MmlPh.Phone.NameSpaceURI);

            this.MasterId = new MmlCm.Id(node.SelectSingleNode("mmlPi:uniqueInfo/mmlPi:masterId", nsmgr).FirstChild);

            foreach (XmlNode oid in node.SelectNodes("mmlPi:uniqueInfo/mmlPi:otherId", nsmgr))
            {
                XmlAttribute attr = oid.Attributes["mmlPi:type"];
                if (!this.OtherIdList.ContainsKey(attr.Value))
                {
                    this.OtherIdList.Add(attr.Value, new List <MmlCm.Id>());
                }
                this.OtherIdList[attr.Value].Add(new MmlCm.Id(oid.FirstChild));
            }

            foreach (XmlNode nm in node.SelectNodes("mmlPi:personName/mmlNm:Name", nsmgr))
            {
                MmlNm.Name name = new MmlNm.Name(nm);
                if (name.RepCode == "I")
                {
                    this.KanjiName = name;
                }
                else if (name.RepCode == "P")
                {
                    this.KanaName = name;
                }
                else
                {
                    this.AlphaName = name;
                }
            }

            this.Birthday = DateTime.Parse(node.SelectSingleNode("mmlPi:birthday", nsmgr).InnerText.Trim());
            this.Sex      = node.SelectSingleNode("mmlPi:sex", nsmgr).InnerText.Trim();
            XmlNode marital = node.SelectSingleNode("mmlPi:marital", nsmgr);

            if (marital != null)
            {
                this.Marital = marital.InnerText.Trim();
            }

            XmlNode nation = node.SelectSingleNode("mmlPi:nationality", nsmgr);

            if (nation != null)
            {
                this.Nationality = nation.InnerText.Trim();
                XmlAttribute attr = nation.Attributes["mmlPi:subtype"];
                if (attr != null)
                {
                    this.SecondNationality = attr.Value;
                }
                else
                {
                    this.SecondNationality = "";
                }
            }
            else
            {
                this.Nationality       = "JPN";
                this.SecondNationality = "";
            }

            XmlNode death = node.SelectSingleNode("mmlPi:death", nsmgr);

            if (death != null)
            {
                if (Boolean.Parse(death.InnerText.Trim()) == true)
                {
                    this.DeathFlag = true;
                }
                else
                {
                    this.DeathFlag = false;
                }
                XmlAttribute attr = GetAttribute(death, "mmlPi:date");
                if (attr != null)
                {
                    this.DeathDate = DateTime.Parse(attr.Value);
                }
            }

            XmlNode acc = node.SelectSingleNode("mmlPi:accountNumber", nsmgr);

            if (acc != null)
            {
                this.AccountNumber = acc.InnerText.Trim();
            }

            XmlNode sid = node.SelectSingleNode("mmlPi:socialIdentification", nsmgr);

            if (sid != null)
            {
                this.SocialIdentification = sid.InnerText.Trim();
            }

            foreach (XmlNode addr in node.SelectNodes("mmlPi:addresses/mmlAd:Address", nsmgr))
            {
                this.AddressList.Add(new MmlAd.Address(addr));
            }
            foreach (XmlNode email in node.SelectNodes("mmlPi:emailAddresses/mmlCm:email", nsmgr))
            {
                this.MailAddressList.Add(new MmlCm.MailAddress(email));
            }
            foreach (XmlNode phone in node.SelectNodes("mmlPi:phones/mmlPh:Phone", nsmgr))
            {
                this.PhoneList.Add(new MmlPh.Phone(phone));
            }
        }
コード例 #2
0
ファイル: PatientModule.cs プロジェクト: anhlai/EMR-MML
        public override void LoadFromXml(XmlNode node)
        {
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(node.OwnerDocument.NameTable);
            nsmgr.AddNamespace(NameSpacePrefix, NameSpaceURI);
            nsmgr.AddNamespace(MmlNm.Name.NameSpacePrefix, MmlNm.Name.NameSpaceURI);
            nsmgr.AddNamespace(MmlAd.Address.NameSpacePrefix, MmlAd.Address.NameSpaceURI);
            nsmgr.AddNamespace(MmlCm.MailAddress.NameSpacePrefix, MmlCm.MailAddress.NameSpaceURI);
            nsmgr.AddNamespace(MmlPh.Phone.NameSpacePrefix, MmlPh.Phone.NameSpaceURI);

            this.MasterId = new MmlCm.Id(node.SelectSingleNode("mmlPi:uniqueInfo/mmlPi:masterId", nsmgr).FirstChild);

            foreach (XmlNode oid in node.SelectNodes("mmlPi:uniqueInfo/mmlPi:otherId",nsmgr)) {
                XmlAttribute attr = oid.Attributes["mmlPi:type"];
                if (!this.OtherIdList.ContainsKey(attr.Value)) {
                    this.OtherIdList.Add(attr.Value,new List<MmlCm.Id>());
                }
                this.OtherIdList[attr.Value].Add(new MmlCm.Id(oid.FirstChild));
            }

            foreach (XmlNode nm in node.SelectNodes("mmlPi:personName/mmlNm:Name", nsmgr)) {
                MmlNm.Name name=new MmlNm.Name(nm);
                if (name.RepCode == "I") {
                    this.KanjiName = name;
                } else if(name.RepCode=="P"){
                    this.KanaName = name;
                } else {
                    this.AlphaName = name;
                }
            }

            this.Birthday = DateTime.Parse(node.SelectSingleNode("mmlPi:birthday", nsmgr).InnerText.Trim());
            this.Sex = node.SelectSingleNode("mmlPi:sex", nsmgr).InnerText.Trim();
            XmlNode marital = node.SelectSingleNode("mmlPi:marital", nsmgr);
            if (marital != null) {
                this.Marital = marital.InnerText.Trim();
            }

            XmlNode nation = node.SelectSingleNode("mmlPi:nationality", nsmgr);
            if (nation != null) {
                this.Nationality = nation.InnerText.Trim();
                XmlAttribute attr = nation.Attributes["mmlPi:subtype"];
                if (attr != null) {
                    this.SecondNationality = attr.Value;
                } else {
                    this.SecondNationality = "";
                }
            } else {
                this.Nationality = "JPN";
                this.SecondNationality = "";
            }

            XmlNode death = node.SelectSingleNode("mmlPi:death", nsmgr);
            if (death != null) {
                if (Boolean.Parse(death.InnerText.Trim()) == true) {
                    this.DeathFlag = true;
                } else {
                    this.DeathFlag = false;
                }
                XmlAttribute attr = GetAttribute(death, "mmlPi:date");
                if (attr != null) {
                    this.DeathDate = DateTime.Parse(attr.Value);
                }
            }

            XmlNode acc = node.SelectSingleNode("mmlPi:accountNumber", nsmgr);
            if (acc != null) {
                this.AccountNumber = acc.InnerText.Trim();
            }

            XmlNode sid = node.SelectSingleNode("mmlPi:socialIdentification", nsmgr);
            if (sid != null) {
                this.SocialIdentification = sid.InnerText.Trim();
            }

            foreach (XmlNode addr in node.SelectNodes("mmlPi:addresses/mmlAd:Address",nsmgr)) {
                this.AddressList.Add(new MmlAd.Address(addr));
            }
            foreach (XmlNode email in node.SelectNodes("mmlPi:emailAddresses/mmlCm:email", nsmgr)) {
                this.MailAddressList.Add(new MmlCm.MailAddress(email));
            }
            foreach (XmlNode phone in node.SelectNodes("mmlPi:phones/mmlPh:Phone", nsmgr)) {
                this.PhoneList.Add(new MmlPh.Phone(phone));
            }
        }