示例#1
0
        private string TestAnd(Model.DTO.PatientDiagnoseResuest request)
        {
            string getDataFromHospitalStr = @"<Response>
                                                <ResultCode>0</ ResultCode>
                                                <ErrorMsg></ErrorMsg>
                                                <reocrd>
                                                  <PatientName>张三</PatientName>
                                                  <Sex>男</Sex>
                                                  <Brithday>1999-01-01</Brithday>
                                                  <CardId>123456789</CardId>
                                                  <Tel>76</Tel>
                                                  <DiagnoseInfo>
                                                    <RegisterNo>11111111</RegisterNo>
                                                    <Icd>Icd123456</Icd>
                                                    <Diagnose>诊断名称</Diagnose>
                                                    <Type>3</Type>
                                                    <Flag>1</Flag>
                                                    <DiagnoseDate>2012-09-01</DiagnoseDate>
                                                    </DiagnoseInfo>
                                                 </reocrd>
                                                </Response>
                                                ";

            return(getDataFromHospitalStr);
        }
示例#2
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);
        }
示例#3
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);
        }
示例#4
0
        private Model.DTO.PatientDiagnoseResuest XmlStrToPatientDiagnoseResuest(string xml)
        {
            Model.DTO.PatientDiagnoseResuest pdr = new Model.DTO.PatientDiagnoseResuest();
            XmlDocument xd = Common.XmlHelper.XMLLoad(xml, Common.XmlHelper.XmlType.String);

            //<Request><cardno>{0}</cardno><cxrq00>{1}</cxrq00></Request>
            try
            {
                XmlNode xn = xd.SelectSingleNode("//Request");
                if (xn != null)
                {
                    string str = JsonConvert.SerializeXmlNode(xn, Newtonsoft.Json.Formatting.None, true);
                    pdr = JsonConvert.DeserializeObject <Model.DTO.PatientDiagnoseResuest>(str);
                }
            }
            catch (Exception ex)
            {
                Common.LogHelper.WriteError(ex);
            }
            return(pdr);
        }
示例#5
0
        //private Model.DTO.PatientDiagnoseResuest request = new Model.DTO.PatientDiagnoseResuest();
        //private Model.QueryRecoder queryRecoderModel = null;
        //private List<string> requestStrList = null;
        public string GetData(Model.QueryRecoder model, bool queryBycode)
        {
            BLL.Request.PatientDiagnoseResuest cq = new Request.PatientDiagnoseResuest(model);
            cq.CreatRequest(queryBycode);
            Model.QueryRecoder  queryRecoderModel = cq.QueryRecoderModel;
            Model.DTO.JsonModel jsonmodel         = new Model.DTO.JsonModel()
            {
                Statu = "err", Msg = "无数据", Data = ""
            };

            //保存记录(查询记录数据,更新或添加)  string.IsNullOrEmpty(cq.RequestStr)存在值 修改修!string.IsNullOrEmpty(cq.RequestStr) kaka
            if (cq.RequestStr != null && cq.RequestStr.Count > 0)
            {
                List <Model.PatientDiagnose> patientDiagnoseList = new List <Model.PatientDiagnose>();
                StringBuilder msg = new StringBuilder();
                //调用接口获取数据
                foreach (var item in cq.RequestStr)
                {
                    string xmlStr = GetWebServiceData(item);
                    string _Msg   = "";
                    //返回数据缺少结束标记
                    if (!xmlStr.Contains("</Response>"))
                    {
                        xmlStr += "</Response>";
                    }
                    Model.DTO.PatientDiagnoseResuest request = XmlStrToPatientDiagnoseResuest(item);
                    if (request != null)
                    {
                        Model.PatientDiagnose patientDiagnose = StrTObject(xmlStr, out _Msg, request);
                        if (patientDiagnose != null)
                        {
                            if (!patientDiagnoseList.Contains(patientDiagnose))
                            {
                                bool check = CheckData(patientDiagnose);
                                if (!check)
                                {
                                    patientDiagnoseList.Add(patientDiagnose);
                                }
                            }
                            if (!string.IsNullOrEmpty(_Msg))
                            {
                                msg.Replace(_Msg, "");
                                msg.Append(" &nbsp " + _Msg);
                            }
                        }
                    }
                    //nnn.Add(model.Code);

                    else
                    {
                        if (!string.IsNullOrEmpty(_Msg))
                        {
                            msg.Replace(_Msg, "");
                            msg.Append(" &nbsp " + _Msg);
                        }
                    }
                }
                if (patientDiagnoseList != null && patientDiagnoseList.Count > 0)
                {
                    //有数据
                    jsonmodel = CreatJsonMode("ok", msg.ToString(), patientDiagnoseList);
                    ChangeQueryRecordStatu(cq, msg.ToString());
                }
                else
                {
                    //无数据
                    jsonmodel = CreatJsonMode("err", msg.ToString(), patientDiagnoseList);
                    ChangeQueryRecordStatu(cq, msg.ToString());
                }
            }
            return(JsonConvert.SerializeObject(jsonmodel));
        }
示例#6
0
文件: PK.cs 项目: aj-hc/SZY
 //解析数据
 //返回数据对象
 public List<Model.PatientDiagnose> XmlStrToPatientDiagnoseResuestForZhuYuan(XmlNodeList xml, XmlNamespaceManager nsmgr)
 {
     Model.DTO.PatientDiagnoseResuest pdr = new Model.DTO.PatientDiagnoseResuest();
     List<Model.PatientDiagnose> list = new List<Model.PatientDiagnose>();
     Model.PatientDiagnose patient = new Model.PatientDiagnose();
     if (xml.Count > 0)
     {
         foreach (var item in xml)
         {
             XmlElement xe = (XmlElement)item;
             try
             {
                 if (xe != null)
                 {
                     XmlNodeList xn = xe.SelectNodes("ab:diagnosis", nsmgr);
                     if (xn.Count > 0 && xn != null)
                     {
                         for (int i = 0; i < xn.Count; i++)
                         {
                             //把数据赋值给PatientDiagnose
                             patient.Cardno = xe.SelectSingleNode("ab:patientNo", nsmgr).InnerText;
                             patient.PatientName = xe.SelectSingleNode("ab:name", nsmgr).InnerText;
                             patient.Sex = xe.SelectSingleNode("ab:sexName", nsmgr).InnerText;
                             DateTime dt = new DateTime();
                             dt = Convert.ToDateTime(xe.SelectSingleNode("ab:birthday", nsmgr).InnerText);
                             patient.Brithday = dt;
                             patient.Csrq00 = DateTime.Now.ToString("yyyy-MM-dd");
                             patient.Icd = xn[i].SelectSingleNode("ab:diagnosisCode", nsmgr).InnerText;
                             patient.Diagnose = xn[i].SelectSingleNode("ab:diagnosisName", nsmgr).InnerText;
                             patient.Type = xn[i].SelectSingleNode("ab:type", nsmgr).InnerText;
                             if (xn[i].SelectSingleNode("ab:type", nsmgr).InnerText.Contains("中医"))
                             {
                                 patient.Flag = "中医诊断";
                             }
                             if (xn[i].SelectSingleNode("ab:type", nsmgr).InnerText.Contains("西医"))
                             {
                                 patient.Flag = "西医诊断";
                             }
                             patient.DiagnoseDate = xn[i].SelectSingleNode("ab:diagnosisDate", nsmgr).InnerText;
                             list.Add(patient);
                             patient = new Model.PatientDiagnose();
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
                 Common.LogHelper.WriteError(ex);
             }
         }
     }
     return list;
 }
示例#7
0
        public string GetData(Model.DTO.PatientDiagnose_list_F model)
        {
            Model.DTO.JsonModel jsonmodel = new Model.DTO.JsonModel()
            {
                Statu = "err", Msg = "无数据", Data = ""
            };
            List <string> requestStr = new List <string>();

            #region 返回卡号
            if (model.codeType == "0")
            {
                requestStr = GetRequestStr(model);
                //保存记录(查询记录数据,更新或添加)  string.IsNullOrEmpty(requestStr)存在值 修改修!string.IsNullOrEmpty(requestStr) kaka
                if (requestStr != null && requestStr.Count > 0)
                {
                    List <Model.PatientDiagnose> patientDiagnoseList = new List <Model.PatientDiagnose>();
                    StringBuilder msg = new StringBuilder();
                    //调用接口获取数据
                    foreach (var item in requestStr)
                    {
                        string xmlStr = GetWebServiceData(item);
                        string _Msg   = "";
                        //返回数据缺少结束标记
                        if (!xmlStr.Contains("</Response>"))
                        {
                            xmlStr += "</Response>";
                        }
                        Model.DTO.PatientDiagnoseResuest request = XmlStrToPatientDiagnoseResuest(item);
                        if (request != null)
                        {
                            List <Model.PatientDiagnose> patientDiagnoses = StrTObject(xmlStr, out _Msg, request);
                            if (patientDiagnoses != null)
                            {
                                foreach (Model.PatientDiagnose patientDiagnose in patientDiagnoses)
                                {
                                    if (!patientDiagnoseList.Contains(patientDiagnose))
                                    {
                                        bool check = CheckData(patientDiagnose);
                                        if (!check)
                                        {
                                            patientDiagnoseList.Add(patientDiagnose);
                                        }
                                    }
                                    if (!string.IsNullOrEmpty(_Msg))
                                    {
                                        msg.Replace(_Msg, "");
                                        msg.Replace("&nbsp", "");
                                        msg.Replace(" ", "");
                                        msg.Append(" &nbsp " + _Msg);
                                    }
                                }
                            }
                        }
                        //nnn.Add(model.Code);

                        else
                        {
                            if (!string.IsNullOrEmpty(_Msg))
                            {
                                msg.Replace(_Msg, "");
                                msg.Replace("&nbsp", "");
                                msg.Replace(" ", "");
                                msg.Append(" &nbsp " + _Msg);
                            }
                        }
                    }
                    if (patientDiagnoseList != null && patientDiagnoseList.Count > 0)
                    {
                        //有数据
                        jsonmodel = CreatJsonMode("ok", msg.ToString(), patientDiagnoseList);
                        // ChangeQueryRecordStatu(cq, msg.ToString());
                    }
                    else
                    {
                        //无数据
                        jsonmodel = CreatJsonMode("err", msg.ToString(), patientDiagnoseList);
                        ///ChangeQueryRecordStatu(cq, msg.ToString());
                    }
                }
            }
            #endregion
            #region 返回住院号
            else if (model.codeType == "1")
            {
                RuRo.BLL.PK pk = new PK();
                //获取住院入参
                List <string> requestStrAdmissionDate = new List <string>();
                requestStrAdmissionDate = pk.GetRequestStrForAdmissionDate(model);
                //获取出院入参
                List <string> requestStrDischargeDate = new List <string>();
                requestStrDischargeDate = pk.GetRequestStrForDischargeDate(model);
                #region 获取住院日期数据
                //判断返回数据是否成功
                if (requestStrAdmissionDate != null && requestStrAdmissionDate.Count > 0)
                {
                    List <Model.PatientDiagnose> patientDiagnoseList = new List <Model.PatientDiagnose>();
                    StringBuilder msg = new StringBuilder();
                    foreach (var item in requestStrAdmissionDate)
                    {
                        string xmlStr = pk.GetHTTPWebServiceData(item);
                        string _Msg   = "";
                        List <Model.PatientDiagnose> patientDiagnoses = pk.XmlStrToPatientDiagnoseResuestForZhuYuan(xmlStr, out _Msg);
                        if (patientDiagnoses != null)
                        {
                            foreach (Model.PatientDiagnose patientDiagnose in patientDiagnoses)
                            {
                                if (!patientDiagnoseList.Contains(patientDiagnose))
                                {
                                    bool check = CheckData(patientDiagnose);
                                    if (!check)
                                    {
                                        patientDiagnoseList.Add(patientDiagnose);
                                    }
                                }
                                if (!string.IsNullOrEmpty(_Msg))
                                {
                                    msg.Replace(_Msg, "");
                                    msg.Replace("&nbsp", "");
                                    msg.Replace(" ", "");
                                    msg.Append(" &nbsp " + _Msg);
                                }
                            }
                        }
                        if (patientDiagnoseList != null && patientDiagnoseList.Count > 0)
                        {
                            //有数据
                            jsonmodel = CreatJsonMode("ok", msg.ToString(), patientDiagnoseList);
                            // ChangeQueryRecordStatu(cq, msg.ToString());
                        }
                        else
                        {
                            //无数据
                            jsonmodel = CreatJsonMode("err", msg.ToString(), patientDiagnoseList);
                            ///ChangeQueryRecordStatu(cq, msg.ToString());
                        }
                    }
                }
                #endregion
                #region 获取出院日期数据
                //if (requestStrDischargeDate != null && requestStrDischargeDate.Count > 0)
                //{
                //    List<Model.PatientDiagnose> patientDiagnoseList = new List<Model.PatientDiagnose>();
                //    StringBuilder msg = new StringBuilder();
                //    foreach (var item in requestStrDischargeDate)
                //    {
                //        string xmlStr = pk.GetHTTPWebServiceData(item);
                //        string _Msg = "";
                //        List<Model.PatientDiagnose> patientDiagnoses = pk.XmlStrToPatientDiagnoseResuestForZhuYuan(xmlStr, out _Msg);
                //        if (patientDiagnoses != null)
                //        {
                //            foreach (Model.PatientDiagnose patientDiagnose in patientDiagnoses)
                //            {
                //                if (!patientDiagnoseList.Contains(patientDiagnose))
                //                {
                //                    bool check = CheckData(patientDiagnose);
                //                    if (!check)
                //                    {
                //                        patientDiagnoseList.Add(patientDiagnose);
                //                    }
                //                }
                //                if (!string.IsNullOrEmpty(_Msg))
                //                {
                //                    msg.Replace(_Msg, "");
                //                    msg.Replace("&nbsp", "");
                //                    msg.Replace(" ", "");
                //                    msg.Append(" &nbsp " + _Msg);
                //                }
                //            }

                //        }
                //        if (patientDiagnoseList != null && patientDiagnoseList.Count > 0)
                //        {
                //            //有数据
                //            jsonmodel = CreatJsonMode("ok", msg.ToString(), patientDiagnoseList);
                //            // ChangeQueryRecordStatu(cq, msg.ToString());
                //        }
                //        else
                //        {
                //            //无数据
                //            jsonmodel = CreatJsonMode("err", msg.ToString(), patientDiagnoseList);
                //            ///ChangeQueryRecordStatu(cq, msg.ToString());
                //        }
                //    }
                //}
                #endregion
            }
            #endregion
            return(JsonConvert.SerializeObject(jsonmodel));
        }
示例#8
0
 private Model.DTO.PatientDiagnoseResuest XmlStrToPatientDiagnoseResuest(string xml)
 {
     Model.DTO.PatientDiagnoseResuest pdr = new Model.DTO.PatientDiagnoseResuest();
     XmlDocument xd = Common.XmlHelper.XMLLoad(xml, Common.XmlHelper.XmlType.String);
     //<Request><cardno>{0}</cardno><cxrq00>{1}</cxrq00></Request>
     try
     {
         XmlNode xn = xd.SelectSingleNode("//Request");
         if (xn != null)
         {
             string str = JsonConvert.SerializeXmlNode(xn, Newtonsoft.Json.Formatting.None, true);
             pdr = JsonConvert.DeserializeObject<Model.DTO.PatientDiagnoseResuest>(str);
         }
     }
     catch (Exception ex)
     {
         Common.LogHelper.WriteError(ex);
     }
     return pdr;
 }