예제 #1
0
        /// <summary>
        /// 将数据转换成对象
        /// </summary>
        /// <param name="xmlStr">要转换成对象的数据</param>
        /// <returns></returns>
        private Model.DTO.JsonModel StrTObject(string xmlStr, Model.DTO.PatientDiagnoseResuest request)
        {
            XmlDocument xd = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(xmlStr);

            Model.DTO.JsonModel jsonData = new Model.DTO.JsonModel()
            {
                Statu = "err", Data = "", Msg = "无数据"
            };
            if (xd == null)
            {
            }
            else
            {
                if (xd.HasChildNodes)
                {
                    XmlNode xn = xd.SelectSingleNode("//ResultCode");
                    if (xn != null)
                    {
                        if (xn.InnerText == "0")
                        {
                            string strNode = JsonConvert.SerializeXmlNode(xd.SelectSingleNode("//reocrd"), Newtonsoft.Json.Formatting.None, true);
                            Model.PatientDiagnose patientDiagnoseData = JsonConvert.DeserializeObject <Model.PatientDiagnose>(strNode);
                            string diagnoseInfoNode        = JsonConvert.SerializeXmlNode(xd.SelectSingleNode("//DiagnoseInfo"), Newtonsoft.Json.Formatting.None, true);
                            Model.DTO.DiagnoseInfoModel dg = JsonConvert.DeserializeObject <Model.DTO.DiagnoseInfoModel>(diagnoseInfoNode);
                            patientDiagnoseData.RegisterNo   = dg.RegisterNo;
                            patientDiagnoseData.Type         = dg.Type;
                            patientDiagnoseData.Icd          = dg.Icd;
                            patientDiagnoseData.Flag         = dg.Flag;
                            patientDiagnoseData.DiagnoseDate = dg.DiagnoseDate;
                            patientDiagnoseData.Diagnose     = dg.Diagnose;
                            patientDiagnoseData.Cardno       = request.cardno;
                            patientDiagnoseData.Csrq00       = request.cxrq00;
                            if (patientDiagnoseData == null || patientDiagnoseData.PatientName == "")
                            {
                            }
                            else
                            {
                                jsonData.Data  = patientDiagnoseData;
                                jsonData.Statu = "ok";
                                jsonData.Msg   = "查询成功";
                            }
                        }
                        else
                        {
                            //查询数据出错,联接无问题
                            jsonData.Msg   = xd.SelectSingleNode("//ErrorMsg").InnerText;
                            jsonData.Statu = "err";
                        }
                    }
                    else
                    {
                        //查询数据出错,联接无问题
                        jsonData.Msg   = xd.InnerText;
                        jsonData.Statu = "err";
                    }
                }
            }
            return(jsonData);
        }
예제 #2
0
        private List <Model.NormalLisItems> GetList(string xmlStr, out string Msg)
        {
            List <Model.NormalLisItems> list = new List <Model.NormalLisItems>();
            XmlDocument xd = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(xmlStr);

            Msg = "无数据";
            if (xd == null)
            {
            }
            else
            {
                if (xd.HasChildNodes)
                {
                    XmlNode xn = xd.SelectSingleNode("//ResultCode");
                    if (xn != null)
                    {
                        if (xn.InnerText == "0")
                        {
                            //  有数据
                            XmlNodeList xnl = xd.SelectNodes("//reocrd");
                            if (xnl.Count > 0)
                            {
                                foreach (XmlNode item in xnl)
                                {
                                    Model.NormalLisItems nn = this.XmlTomModel(item);
                                    if (nn.ext_mthd != null && Common.MatchDic.NeedRecordDic.Values.Contains(nn.ext_mthd))
                                    {
                                        if (!string.IsNullOrEmpty(nn.ext_mthd))
                                        {
                                            if (!this.CheckData(nn))
                                            {
                                                list.Add(nn);
                                            }
                                        }
                                    }
                                }
                                if (list.Count > 0)
                                {
                                    Msg = "";
                                }
                            }
                        }
                        else
                        {
                            //  查询数据出错,联接无问题
                            Msg = xd.SelectSingleNode("//ErrorMsg").InnerText;
                        }
                    }
                    else
                    {
                        // 查询数据出错,联接无问题
                        Msg = xd.InnerText;
                        //保存查询记录
                    }
                }
            }
            return(list);
        }
예제 #3
0
        /// <summary>
        /// 将数据转换成对象
        /// </summary>
        /// <param name="xmlStr">要转换成对象的数据</param>
        /// <returns></returns>
        private Model.DTO.JsonModel StrTObject(string xmlStr)
        {
            XmlDocument xd = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(xmlStr);

            Model.DTO.JsonModel jsonData = new Model.DTO.JsonModel()
            {
                Statu = "err", Data = "", Msg = "无数据"
            };
            if (xd == null)
            {
            }
            else
            {
                if (xd.HasChildNodes)
                {
                    XmlNode xn = xd.SelectSingleNode("//ResultCode");
                    if (xn != null)
                    {
                        if (xn.InnerText == "0")
                        {
                            string         strNode = JsonConvert.SerializeXmlNode(xd.SelectSingleNode("//EmpiInfo"), Newtonsoft.Json.Formatting.None, true);
                            Model.EmpiInfo emp     = JsonConvert.DeserializeObject <Model.EmpiInfo>(strNode);
                            if (!string.IsNullOrEmpty(emp.Birthday))
                            {
                                if (!emp.Birthday.Contains("-") && emp.Birthday.Length == 8)
                                {
                                    emp.Birthday = emp.Birthday.Insert(4, "-").Insert(7, "-");
                                }
                            }

                            if (emp == null || emp.PatientName == "")
                            {
                            }
                            else
                            {
                                jsonData.Data  = emp;
                                jsonData.Statu = "ok";
                                jsonData.Msg   = "查询成功";
                            }
                        }
                        else
                        {
                            //查询数据出错,联接无问题
                            jsonData.Msg   = xd.SelectSingleNode("//ErrorMsg").InnerText;
                            jsonData.Statu = "err";
                        }
                    }
                    else
                    {
                        //查询数据出错,联接无问题
                        jsonData.Msg   = xd.InnerText;
                        jsonData.Statu = "err";
                    }
                }
            }
            return(jsonData);
        }
예제 #4
0
        private Model.PatientDiagnose StrTObject(string xmlStr, out string msg, Model.DTO.PatientDiagnoseResuest request)
        {
            XmlDocument xd = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(xmlStr);

            Model.PatientDiagnose patientDiagnoseModel = null;
            msg = "";
            if (xd == null)
            {
            }
            else
            {
                if (xd.HasChildNodes)
                {
                    XmlNode xn = xd.SelectSingleNode("//ResultCode");
                    if (xn != null)
                    {
                        if (xn.InnerText == "0")
                        {
                            try
                            {
                                string strNode = JsonConvert.SerializeXmlNode(xd.SelectSingleNode("//reocrd"), Newtonsoft.Json.Formatting.None, true);
                                patientDiagnoseModel = JsonConvert.DeserializeObject <Model.PatientDiagnose>(strNode);
                                string diagnoseInfoNode        = JsonConvert.SerializeXmlNode(xd.SelectSingleNode("//DiagnoseInfo"), Newtonsoft.Json.Formatting.None, true);
                                Model.DTO.DiagnoseInfoModel dg = JsonConvert.DeserializeObject <Model.DTO.DiagnoseInfoModel>(diagnoseInfoNode);
                                patientDiagnoseModel.RegisterNo   = dg.RegisterNo;
                                patientDiagnoseModel.Type         = dg.Type;
                                patientDiagnoseModel.Icd          = dg.Icd;
                                patientDiagnoseModel.Flag         = dg.Flag;
                                patientDiagnoseModel.DiagnoseDate = dg.DiagnoseDate;
                                patientDiagnoseModel.Diagnose     = dg.Diagnose;
                                patientDiagnoseModel.Cardno       = request.cardno;
                                patientDiagnoseModel.Csrq00       = request.cxrq00;
                            }
                            catch (Exception ex)
                            {
                                Common.LogHelper.WriteError(ex);
                            }
                        }
                        else
                        {
                            //查询数据出错,联接无问题
                            msg = xd.SelectSingleNode("//ErrorMsg").InnerText;
                        }
                    }
                    else
                    {
                        //查询数据出错,联接无问题
                        msg = xd.InnerText;
                    }
                }
            }
            return(patientDiagnoseModel);
        }