/// <summary> /// 根据本地Date文件获取医院数据并将数据转换成字典集合 /// </summary> /// <returns>字典集合</returns> private List<Dictionary<string, string>> GetOPListForSpecimensByLocalDateFileToDic() { //创建病人字典集合。 List<Dictionary<string, string>> oPListForSpecimensDicList = new List<Dictionary<string, string>>(); string oPListForSpecimenStr = HospitalXmlStrHelper.HospitalXmlFileToXmlStr("configXML\\WS.ForCenterLabServiceByDate.xml"); XmlDocument getDataFromHospitalXml = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(oPListForSpecimenStr); if (getDataFromHospitalXml != null)//有数据并且能转换成xml文档 { if (getDataFromHospitalXml.HasChildNodes) { XmlNode xmlNode = getDataFromHospitalXml.SelectSingleNode("/OPListForSpecimenRt/ResultCode"); //创建临时集合保存多个人的数据 Dictionary<string, string> oPListForSpecimenTempDic = new Dictionary<string, string>(); if (xmlNode.InnerText == "0") //获取数据成功 { //OPListForSpecimens/OPListForSpecimen XmlNodeList xmlNodeList = getDataFromHospitalXml.SelectNodes("//OPListForSpecimens/*"); foreach (XmlNode item in xmlNodeList) { string tempOPListForSpecimenXml = item.OuterXml; oPListForSpecimenTempDic = ConvertOPListForSpecimenStrToDic(tempOPListForSpecimenXml); oPListForSpecimensDicList.Add(oPListForSpecimenTempDic); } } else //获取数据失败 { oPListForSpecimenTempDic.Clear(); oPListForSpecimenTempDic.Add("OPListForSpecimenRt", getDataFromHospitalXml.SelectSingleNode("/OPListForSpecimenRt/ResultContent").InnerText); oPListForSpecimensDicList.Add(oPListForSpecimenTempDic); } } } return oPListForSpecimensDicList; }
//根据日期和调用webservice查询数据 /// <summary> /// 根据日期和调用webservice查询数据 /// </summary> /// <param name="dateBegin">开始时间</param> /// <param name="dateEnd">结束时间</param> /// <returns>OPInfoListForSpecimen数据字典集合</returns> private List<Dictionary<string, string>> GetOPInfoListForSpecimenByTimeRangeAndToDicList(string dateBegin, string dateEnd) { //创建病人字典集合。 List<Dictionary<string, string>> oPListForSpecimensDicList = new List<Dictionary<string, string>>(); RuRo.BLL.WebService.ForCenterLabService centerLabServiceSoapClient = new RuRo.BLL.WebService.ForCenterLabService(); try { string oPInfoListForSpecimenStr = centerLabServiceSoapClient.GetOPInfoListForSpecimen(dateBegin, dateEnd); if (oPInfoListForSpecimenStr != null && oPInfoListForSpecimenStr != "")//有数据并且不为null { //02.将数据转换成xml数据 XmlDocument getDataFromHospitalXml = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(oPInfoListForSpecimenStr); if (getDataFromHospitalXml != null)//有数据并且能转换成xml文档 { if (getDataFromHospitalXml.HasChildNodes) { XmlNode xmlNode = getDataFromHospitalXml.SelectSingleNode("/OPListForSpecimenRt/ResultCode"); //创建临时集合保存多个人的数据 Dictionary<string, string> oPListForSpecimenTempDic = new Dictionary<string, string>(); if (xmlNode.InnerText == "0") //获取数据成功 { //OPListForSpecimens/OPListForSpecimen XmlNodeList xmlNodeList = getDataFromHospitalXml.SelectNodes("//OPListForSpecimens/*"); foreach (XmlNode item in xmlNodeList) { string tempOPListForSpecimenXml = item.OuterXml; oPListForSpecimenTempDic = ConvertOPListForSpecimenStrToDic(tempOPListForSpecimenXml); oPListForSpecimensDicList.Add(oPListForSpecimenTempDic); } } else if (xmlNode.InnerText == "-1") //获取数据失败 { oPListForSpecimenTempDic.Clear(); oPListForSpecimenTempDic.Add("OPListForSpecimenRt", FpJsonHelper.SerializationStr(getDataFromHospitalXml.SelectSingleNode("/OPListForSpecimenRt/ResultContent").InnerText)); oPListForSpecimensDicList.Add(oPListForSpecimenTempDic); } } } } } catch (Exception) { oPListForSpecimensDicList.Clear(); } return oPListForSpecimensDicList; }
/// <summary> /// 根据条码号获取医院数据并将数据转换成字典 /// </summary> /// <param name="barcode">条码</param> /// <returns>数据字典</returns> private Dictionary<string, string> GetOPListForSpecimenByBarcodeAndToDic(string barcode) { //01.创建字典 Dictionary<string, string> hospitalDic = new Dictionary<string, string>(); //02.创建webservice获取数据 RuRo.BLL.WebService.ForCenterLabService centerLabServiceSoapClient = new RuRo.BLL.WebService.ForCenterLabService(); try { //02.1 根据条码号调用GetPatientInfoSpecimen方法获取单个人的数据 string getDataFromHospitalStr = centerLabServiceSoapClient.GetPatientInfoSpecimen(barcode); // string getDataFromHospitalStr = GetOPListForSpecimenByLocalBracodeFileToJsonStr();//调用本地数据 if (getDataFromHospitalStr != null && getDataFromHospitalStr != "")//有数据并且不为null { //03.将数据转换成xml数据有数据并且能转换成xml文档 XmlDocument getDataFromHospitalXml = new XmlDocument(); //转换失败时返回null getDataFromHospitalXml = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(getDataFromHospitalStr); //转换成功 if (getDataFromHospitalXml != null) { //有子元素 if (getDataFromHospitalXml.HasChildNodes) { ////获取OPListForSpecimen下的所有子节点 //XmlNodeList xmlnodelist = getDataFromHospitalXml.SelectNodes("/OPListForSpecimen/*"); ////有子节点返回节点数据 //if (xmlnodelist.Count > 0) //{ hospitalDic = ConvertOPListForSpecimenStrToDic(getDataFromHospitalStr); //} } } } else //没数据返回 { hospitalDic.Clear(); } } catch (Exception ex) { hospitalDic.Clear(); } return hospitalDic; }
/// <summary> /// 将传入的OPListForSpecimen xml字符串信息转换成字段信息字典,数据传入时已经做了筛选包含OPListForSpecimen节点且有子节点 /// </summary> /// <param name="oPListForSpecimenStr">xml格式的字符串</param> /// <returns>字段信息字典</returns> private Dictionary<string, string> ConvertOPListForSpecimenStrToDic(string oPListForSpecimenStr) { //OPListForSpecimen字典 Dictionary<string, string> oPListForSpecimenDic = new Dictionary<string, string>(); //将OPListForSpecimen XML格式的数据转换成XML文档 XmlDocument oPListForSpecimenXmlDoc = new XmlDocument(); oPListForSpecimenXmlDoc = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(oPListForSpecimenStr); //能转换成xml文档 if (oPListForSpecimenXmlDoc != null) { //获取文档下的OPListForSpecimen下的子节点集合 XmlNodeList oPListForSpecimenNodeList = oPListForSpecimenXmlDoc.SelectNodes("/OPListForSpecimen/*"); //有子节点 if (oPListForSpecimenNodeList.Count > 0) { //循环节点 foreach (XmlNode item in oPListForSpecimenNodeList) { //字典中不包含当前节点name就加入到节点中 if (!oPListForSpecimenDic.Keys.Contains(item.Name)) { oPListForSpecimenDic.Add(item.Name, item.InnerText); } } } //OPListForSpecimen下面没有子节点,获取当前节点的值 else if (oPListForSpecimenNodeList.Count == 0) { try { XmlNode xd = oPListForSpecimenXmlDoc.SelectSingleNode("/OPListForSpecimen"); oPListForSpecimenDic.Add(xd.Name, FpJsonHelper.SerializationStr(xd.InnerText)); } catch (Exception) { oPListForSpecimenDic.Clear(); } } } else { //xml文档为null oPListForSpecimenDic.Clear(); } return oPListForSpecimenDic; }