List
List
List
XmlDocument doc = new XmlDocument();
doc.LoadXml(message);
XmlNodeList OrderInfoList = doc.SelectNodes("OrderInfo");
foreach (XmlNode OrderInfo in OrderInfoList)
{
OrderInfoEntity medicineHisData1Entity = new OrderInfoEntity();
medicineHisData1Entity.Uuid = Guid.NewGuid().ToString();
medicineHisData1Entity.HsptCd = OrderInfo.ChildNodes[0].InnerText;
medicineHisData1Entity.DptmtCd = OrderInfo.ChildNodes[1].InnerText;
medicineHisData1Entity.WardCd = OrderInfo.ChildNodes[2].InnerText;
medicineHisData1Entity.DataClsf = OrderInfo.ChildNodes[3].InnerText;
medicineHisData1Entity.InOutClsf = OrderInfo.ChildNodes[4].InnerText;
medicineHisData1Entity.OrderDt = OrderInfo.ChildNodes[5].InnerText;
medicineHisData1Entity.OrderDtm = OrderInfo.ChildNodes[6].InnerText;
medicineHisData1Entity.OrderNum = OrderInfo.ChildNodes[7].InnerText;
medicineHisData1Entity.RoomNum = OrderInfo.ChildNodes[8].InnerText;
medicineHisData1Entity.PtntNm = OrderInfo.ChildNodes[9].InnerText;
medicineHisData1Entity.PtntNum = OrderInfo.ChildNodes[10].InnerText;
medicineHisData1Entity.Sex = OrderInfo.ChildNodes[11].InnerText;
medicineHisData1Entity.DoctorNm = OrderInfo.ChildNodes[12].InnerText;
medicineHisData1Entity.Birthday = OrderInfo.ChildNodes[13].InnerText;
medicineHisData1Entity.PtntAddr = OrderInfo.ChildNodes[14].InnerText;
medicineHisData1Entity.PtntTel = OrderInfo.ChildNodes[15].InnerText;
medicineHisData1Entity.flag = 0;
bool ifHasHospitalCode = false;
for (int i = 0; i < OrderInfo.ChildNodes.Count; i++)
{
XmlNode MedItem = OrderInfo.ChildNodes[i];
if (MedItem.Name == "MedItem")
{
MedItemEntity medItemEntity = new MedItemEntity();
medItemEntity.Uuid = Guid.NewGuid().ToString();
medItemEntity.MedCd = MedItem.ChildNodes[0].InnerText;
medItemEntity.MedNm = MedItem.ChildNodes[1].InnerText;
medItemEntity.MedNote = MedItem.ChildNodes[2].InnerText;
medItemEntity.MedSpec = MedItem.ChildNodes[3].InnerText;
medItemEntity.MedUnit = MedItem.ChildNodes[4].InnerText;
medItemEntity.UseAtcYn = MedItem.ChildNodes[5].InnerText;
medItemEntity.OrderInfoId = medicineHisData1Entity.Uuid;
MedItemList.Add(medItemEntity);
for(int j=0;j< MedItem.ChildNodes.Count; j++)
{
XmlNode MedItemDose = MedItem.ChildNodes[j];
if (MedItemDose.Name == "MedItemDose")
{
MedItemDoseEntity medItemDoseEntity = new MedItemDoseEntity();
medItemDoseEntity.Uuid = Guid.NewGuid().ToString();
medItemDoseEntity.DoseList = MedItemDose.ChildNodes[0].InnerText;
medItemDoseEntity.TakeDays = MedItemDose.ChildNodes[1].InnerText;
medItemDoseEntity.TakeDt = MedItemDose.ChildNodes[2].InnerText;
medItemDoseEntity.DrtsCd = MedItemDose.ChildNodes[3].InnerText;
medItemDoseEntity.MedItemId = medItemEntity.Uuid;
MedItemDoseList.Add(medItemDoseEntity);
}
}
}
if (MedItem.Name == "HospitalCode")
{
ifHasHospitalCode = true;
}
}
if (ifHasHospitalCode)
{
medicineHisData1Entity.HospitalCode = OrderInfo.ChildNodes[16].InnerText;
}
else
{
medicineHisData1Entity.HospitalCode = "000";
}
OrderInfoEntityList.Add(medicineHisData1Entity);
}