public override void LoadFromXml(XmlNode node) { XmlNamespaceManager nsmgr = new XmlNamespaceManager(node.OwnerDocument.NameTable); nsmgr.AddNamespace(NameSpacePrefix, NameSpaceURI); this.InsuranceClass = new InsuranceClass(node.SelectSingleNode("mmlHi:insuranceClass",nsmgr)); this.InsuranceNumber = node.SelectSingleNode("mmlHi:insuranceNumber", nsmgr).InnerText; this.ClientIdGroup = node.SelectSingleNode("mmlHi:clientId/mmlHi:group", nsmgr).InnerText; this.ClientIdNumber = node.SelectSingleNode("mmlHi:clientId/mmlHi:number", nsmgr).InnerText; bool flag; if (Boolean.TryParse(node.SelectSingleNode("mmlHi:familyClass", nsmgr).InnerText, out flag)) { if (flag) { this.FamilyFlag = false; } else { this.FamilyFlag = true; } } else { this.FamilyFlag = false; } this.StartDate=DateTime.Parse(node.SelectSingleNode("mmlHi:startDate", nsmgr).InnerText); this.EndDate = DateTime.Parse(node.SelectSingleNode("mmlHi:expiredDate", nsmgr).InnerText); XmlNode tmpnode; tmpnode = node.SelectSingleNode("mmlHi:paymentOutRatio", nsmgr); if (tmpnode != null) { double raito; if (Double.TryParse(tmpnode.InnerText, out raito)) { this.PaymentOutRatio = (int)(raito * 100); } else { this.PaymentOutRatio = -1; } } else { //入院負担率があれば同じとする this.PaymentOutRatio = -1; } tmpnode = node.SelectSingleNode("mmlHi:paymentInRatio", nsmgr); if (tmpnode != null) { double raito; if (Double.TryParse(tmpnode.InnerText, out raito)) { this.PaymentInRatio = (int)(raito * 100); } else { this.PaymentInRatio = -1; } } else { //入院負担率がないときは外来と同じとする this.PaymentInRatio = -1; } //どちらかがないときはもう一方の負担率をセットどちらもないときは100% if (this.PaymentInRatio == -1 && this.PaymentOutRatio == -1) { this.PaymentInRatio = 100; this.PaymentOutRatio = 100; } else if (this.PaymentOutRatio == -1) { this.PaymentOutRatio = this.PaymentInRatio; } else if (this.PaymentInRatio == -1) { this.PaymentInRatio = this.PaymentOutRatio; } else { //なにもしない } //保険者情報、被保険者情報は現在読み込み対象外 //公費 this.PublicInsuranceList = new SortedList<int, PublicInsuranceItem>(); foreach (XmlNode pinode in node.SelectNodes("mmlHi:publicInsurance/mmlHi:publicInsuranceItem",nsmgr)) { PublicInsuranceItem pi = new PublicInsuranceItem(pinode); this.PublicInsuranceList.Add(pi.Priority, pi); } }
public override void LoadFromXml(XmlNode node) { XmlNamespaceManager nsmgr = new XmlNamespaceManager(node.OwnerDocument.NameTable); nsmgr.AddNamespace(NameSpacePrefix, NameSpaceURI); this.InsuranceClass = new InsuranceClass(node.SelectSingleNode("mmlHi:insuranceClass", nsmgr)); this.InsuranceNumber = node.SelectSingleNode("mmlHi:insuranceNumber", nsmgr).InnerText; this.ClientIdGroup = node.SelectSingleNode("mmlHi:clientId/mmlHi:group", nsmgr).InnerText; this.ClientIdNumber = node.SelectSingleNode("mmlHi:clientId/mmlHi:number", nsmgr).InnerText; bool flag; if (Boolean.TryParse(node.SelectSingleNode("mmlHi:familyClass", nsmgr).InnerText, out flag)) { if (flag) { this.FamilyFlag = false; } else { this.FamilyFlag = true; } } else { this.FamilyFlag = false; } this.StartDate = DateTime.Parse(node.SelectSingleNode("mmlHi:startDate", nsmgr).InnerText); this.EndDate = DateTime.Parse(node.SelectSingleNode("mmlHi:expiredDate", nsmgr).InnerText); XmlNode tmpnode; tmpnode = node.SelectSingleNode("mmlHi:paymentOutRatio", nsmgr); if (tmpnode != null) { double raito; if (Double.TryParse(tmpnode.InnerText, out raito)) { this.PaymentOutRatio = (int)(raito * 100); } else { this.PaymentOutRatio = -1; } } else { //入院負担率があれば同じとする this.PaymentOutRatio = -1; } tmpnode = node.SelectSingleNode("mmlHi:paymentInRatio", nsmgr); if (tmpnode != null) { double raito; if (Double.TryParse(tmpnode.InnerText, out raito)) { this.PaymentInRatio = (int)(raito * 100); } else { this.PaymentInRatio = -1; } } else { //入院負担率がないときは外来と同じとする this.PaymentInRatio = -1; } //どちらかがないときはもう一方の負担率をセットどちらもないときは100% if (this.PaymentInRatio == -1 && this.PaymentOutRatio == -1) { this.PaymentInRatio = 100; this.PaymentOutRatio = 100; } else if (this.PaymentOutRatio == -1) { this.PaymentOutRatio = this.PaymentInRatio; } else if (this.PaymentInRatio == -1) { this.PaymentInRatio = this.PaymentOutRatio; } else { //なにもしない } //保険者情報、被保険者情報は現在読み込み対象外 //公費 this.PublicInsuranceList = new SortedList <int, PublicInsuranceItem>(); foreach (XmlNode pinode in node.SelectNodes("mmlHi:publicInsurance/mmlHi:publicInsuranceItem", nsmgr)) { PublicInsuranceItem pi = new PublicInsuranceItem(pinode); this.PublicInsuranceList.Add(pi.Priority, pi); } }