Пример #1
0
        public Model.PatientDiagnose DicToNormalLisReportModel(Dictionary <string, string> dic)
        {
            string str = JsonConvert.SerializeObject(dic);

            Model.PatientDiagnose patientDiagnose = JsonConvert.DeserializeObject <Model.PatientDiagnose>(str);
            return(patientDiagnose);
        }
Пример #2
0
        private List <Model.PatientDiagnose> StrTObject(string xmlStr, out string msg, Model.DTO.PatientDiagnoseResuest request)
        {
            XmlDocument xd = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(xmlStr);
            List <Model.PatientDiagnose> list = new List <Model.PatientDiagnose>();

            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);

                                XmlNodeList xns = xd.SelectNodes("//DiagnoseInfo");
                                foreach (XmlNode item in xns)
                                {
                                    Model.PatientDiagnose patientDiagnoseModel = new Model.PatientDiagnose();
                                    patientDiagnoseModel = JsonConvert.DeserializeObject <Model.PatientDiagnose>(strNode);
                                    string diagnoseInfoNode        = JsonConvert.SerializeXmlNode(item, 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;
                                    list.Add(patientDiagnoseModel);
                                }
                            }
                            catch (Exception ex)
                            {
                                Common.LogHelper.WriteError(ex);
                            }
                        }
                        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, 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);
        }
Пример #4
0
        private List <Dictionary <string, string> > GetClinicalInfoDgDicList(string dataStr)
        {
            List <Model.PatientDiagnose> pageClinicalInfoList = new List <Model.PatientDiagnose>();

            Model.PatientDiagnose cl = new Model.PatientDiagnose();
            List <Dictionary <string, string> > ClinicalInfoDgDicList = new List <Dictionary <string, string> >();

            if (!string.IsNullOrEmpty(dataStr) && dataStr != "[]")
            {
                pageClinicalInfoList = FreezerProUtility.Fp_Common.FpJsonHelper.JsonStrToObject <List <Model.PatientDiagnose> >(dataStr);//转换ok
            }
            foreach (Model.PatientDiagnose item in pageClinicalInfoList)
            {
                //给对象拼接--临床数据中需要添加基本信息中的RegisterID,InPatientID
                ClinicalInfoDgDicList.Add(FormToDic.ConvertModelToDic(item));
            }
            return(ClinicalInfoDgDicList);
        }
Пример #5
0
        //获取基本信息字典(样本源)
        private Dictionary <string, string> GetBaseInfoDic(string formStr)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            Model.PatientDiagnose       data = new Model.PatientDiagnose();
            Dictionary <string, string> dicc = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(formStr) && formStr != "[]")
            {
                List <Dictionary <string, string> > dicList = new List <Dictionary <string, string> >();
                dicList = FreezerProUtility.Fp_Common.FpJsonHelper.JsonStrToObject <List <Dictionary <string, string> > >(formStr);
                dicc    = dicList[0];
                string aa = JsonConvert.SerializeObject(dicc);
                data = JsonConvert.DeserializeObject <Model.PatientDiagnose>(aa);
                //data = FormToDic.GetFromInfo<Model.PatientDiagnose>(dicList);
                dic = FormToDic.ConvertModelToDic(data);
            }
            return(dic);
        }
Пример #6
0
        /// <summary>
        /// 检查数据对象在本地数据库是否存在 ,true--存在
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private bool CheckData(Model.PatientDiagnose data)
        {
            bool result = false;

            try
            {
                if (data != null)
                {
                    string whereStr = string.Format("Cardno ='{0}' and Csrq00 ='{1}' and DiagnoseDate ='{2}' and Flag='{3}' and Type='{4}'  and Diagnose='{5}'", data.Cardno, data.Csrq00, data.DiagnoseDate, data.Flag, data.Type, data.Diagnose);
                    List <Model.PatientDiagnose> list = this.GetModelList(whereStr);
                    if (list != null && list.Count > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Common.LogHelper.WriteError(ex);
            }
            return(result);
        }
Пример #7
0
        public string PostData(string code, string codeType, string dataStr, string username, bool isP)
        {
            List <Dictionary <string, string> > dicList    = new List <Dictionary <string, string> >();
            List <Dictionary <string, string> > newDicList = new List <Dictionary <string, string> >();
            string mes = "\"{\"success\":false,\"error\":true,\"message\":\"无数据导入\"}\"";

            //if (isP)
            //{
            //    dicList = GetClinicalInfoDgDicList_Q(dataStr);
            //}
            //else
            //{
            dicList = GetClinicalInfoDgDicList(dataStr);
            //}
            if (dicList != null && dicList.Count > 0)
            {
                List <Model.PatientDiagnose> list = new List <Model.PatientDiagnose>();
                for (int i = 0; i < dicList.Count; i++)
                {
                    //把数据添加到数据库
                    Model.PatientDiagnose model = new Model.PatientDiagnose();
                    model = DicToNormalLisReportModel(dicList[i]);
                    try
                    {
                        if (this.CheckData(model))
                        {
                            dicList.Remove(dicList[i]);
                        }
                        else
                        {
                            list.Add(model);
                        }
                    }
                    catch (Exception ex)
                    {
                        Common.LogHelper.WriteError(ex);
                        continue;
                    }
                }

                newDicList = MatchClinicalDic(dicList, codeType);
                // new Dictionary<string, string>() { {"Sample Source", code  } }
                //newDicList[0].Add("Sample Source", code);
                foreach (var item in newDicList)
                {
                    item.Add("Sample Source", code);
                    if (item.Keys.Contains("诊断类型"))
                    {
                        switch (item["诊断类型"])
                        {
                        case "1":
                            item["诊断类型"] = "中医疾病";
                            break;

                        case "2":
                            item["诊断类型"] = "中医症候";
                            break;

                        case "3":
                            item["诊断类型"] = "西医主诊断";
                            break;

                        case "4":
                            item["诊断类型"] = "西医其他诊断";
                            break;

                        default:
                            break;
                        }
                    }
                    if (item.Keys.Contains("诊断类别"))
                    {
                        switch (item["诊断类别"])
                        {
                        case "1":
                            item["诊断类别"] = "西医诊断";
                            break;

                        case "2":
                            item["诊断类别"] = "中医诊断";
                            break;

                        default:
                            break;
                        }
                    }
                }
                string strList = JsonConvert.SerializeObject(newDicList);
                mes = PostData(strList);
                if (mes.Contains("{\"success\":true,"))
                {
                    foreach (var item in list)
                    {
                        PatientDiagnose n = new PatientDiagnose();
                        try
                        {
                            n.Add(item);
                        }
                        catch (Exception ex)
                        {
                            Common.LogHelper.WriteError(ex);
                            continue;
                        }
                    }
                }
            }
            return(mes);
        }
Пример #8
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));
        }
Пример #9
0
Файл: PK.cs Проект: aj-hc/SZY
        //解析数据
        //返回数据对象
        //老版本暂时用来参考
        public List<Model.PatientDiagnose> XmlStrToPatientDiagnoseResuestForZhuYuan(string xml, out string _msg)
        {
            List<Model.PatientDiagnose> list = new List<Model.PatientDiagnose>();
            _msg = "";
            XmlDocument xmldoc = new XmlDocument();
            try
            {
                xmldoc.LoadXml(xml);
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmldoc.NameTable);
                nsmgr.AddNamespace("ab", "http://chas.hit.com/transport/integration/common/msg");
                XmlNodeList respHeaderlist = xmldoc.SelectNodes("//ab:respHeader", nsmgr);
                if (respHeaderlist.Count > 0 && respHeaderlist[0].InnerText.Contains("000000"))//判断数据是否成功获取
                {
                    XmlNodeList paitentlist = xmldoc.SelectNodes("//ab:patient", nsmgr);//读取病人数据
                    if (paitentlist.Count > 0)
                    {
                        for (int i = 0; i < paitentlist.Count; i++)
                        {
                            XmlNode xn = paitentlist[i];//基本信息
                            XmlNodeList diagnosis = xn.SelectNodes("//ab:diagnosis", nsmgr);//读取诊断信息
                            if (diagnosis.Count > 0)
                            {
                                for (int j = 0; j < diagnosis.Count; j++)
                                {
                                    //按照类型需要添加进去就好了

                                    Model.PatientDiagnose model = new Model.PatientDiagnose();
                                    DateTime dt = Convert.ToDateTime(xn.SelectSingleNode("//ab:birthday", nsmgr).InnerText);
                                    //基本的
                                    model.Cardno = "";//查询卡号
                                    model.Csrq00 = "";//查询日期
                                    model.PatientName = xn.SelectSingleNode("//ab:name", nsmgr).InnerText;
                                    model.Sex = xn.SelectSingleNode("//ab:sexName", nsmgr).InnerText;
                                    model.Brithday = dt;
                                    model.CardId = xn.SelectSingleNode("//ab:idCardNo", nsmgr).InnerText;
                                    model.Tel = xn.SelectSingleNode("//ab:phone", nsmgr).InnerText;
                                    model.Icd = xn.SelectSingleNode("//ab:diagnosisCode", nsmgr).InnerText;
                                    //诊断的
                                    model.Diagnose = diagnosis[j].SelectSingleNode("//ab:diagnosisName", nsmgr).InnerText;
                                    model.Type = diagnosis[j].SelectSingleNode("//ab:type", nsmgr).InnerText;
                                    if (model.Type.Contains("中医"))
                                    {
                                        model.Flag = "中医诊断";
                                    }
                                    else if (model.Type.Contains("西医"))
                                    {
                                        model.Flag = "西医诊断";
                                    }
                                    model.DiagnoseDate = diagnosis[j].SelectSingleNode("//ab:diagnosisDate", nsmgr).InnerText;
                                    list.Add(model);
                                    model = new Model.PatientDiagnose();
                                }
                            }
                            else
                            {
                                _msg = "查询不到诊断数据";
                            }
                        }
                    }
                    else
                    {
                    }
                }
                else
                {
                    _msg = respHeaderlist[0].InnerText.ToString();
                }
            }
            catch (Exception ex)
            {
                Common.LogHelper.WriteError(ex);
                _msg = ex.ToString();
            }
            return list;
        }
Пример #10
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;
 }
Пример #11
0
 private List<Dictionary<string, string>> GetClinicalInfoDgDicList(string dataStr)
 {
     List<Model.PatientDiagnose> pageClinicalInfoList = new List<Model.PatientDiagnose>();
     Model.PatientDiagnose cl = new Model.PatientDiagnose();
     List<Dictionary<string, string>> ClinicalInfoDgDicList = new List<Dictionary<string, string>>();
     if (!string.IsNullOrEmpty(dataStr) && dataStr != "[]")
     {
         pageClinicalInfoList = FreezerProUtility.Fp_Common.FpJsonHelper.JsonStrToObject<List<Model.PatientDiagnose>>(dataStr);//转换ok
     }
     foreach (Model.PatientDiagnose item in pageClinicalInfoList)
     {
         //给对象拼接--临床数据中需要添加基本信息中的RegisterID,InPatientID
         ClinicalInfoDgDicList.Add(FormToDic.ConvertModelToDic(item));
     }
     return ClinicalInfoDgDicList;
 }
Пример #12
0
 //获取基本信息字典(样本源)
 private Dictionary<string, string> GetBaseInfoDic(string formStr)
 {
     Dictionary<string, string> dic = new Dictionary<string, string>();
     Model.PatientDiagnose data = new Model.PatientDiagnose();
     Dictionary<string, string> dicc = new Dictionary<string, string>();
     if (!string.IsNullOrEmpty(formStr) && formStr != "[]")
     {
         List<Dictionary<string, string>> dicList = new List<Dictionary<string, string>>();
         dicList = FreezerProUtility.Fp_Common.FpJsonHelper.JsonStrToObject<List<Dictionary<string, string>>>(formStr);
         dicc = dicList[0];
         string aa = JsonConvert.SerializeObject(dicc);
         data = JsonConvert.DeserializeObject<Model.PatientDiagnose>(aa);
         //data = FormToDic.GetFromInfo<Model.PatientDiagnose>(dicList);
         dic = FormToDic.ConvertModelToDic(data);
     }
     return dic;
 }
Пример #13
0
        public string PostData(string code, string codeType, string dataStr, string username, bool isP)
        {
            List<Dictionary<string, string>> dicList = new List<Dictionary<string, string>>();
            List<Dictionary<string, string>> newDicList = new List<Dictionary<string, string>>();
            string mes = "\"{\"success\":false,\"error\":true,\"message\":\"无数据导入\"}\"";
            //if (isP)
            //{
            //    dicList = GetClinicalInfoDgDicList_Q(dataStr);
            //}
            //else
            //{
            dicList = GetClinicalInfoDgDicList(dataStr);
            //}
            if (dicList != null && dicList.Count > 0)
            {
                List<Model.PatientDiagnose> list = new List<Model.PatientDiagnose>();
                for (int i = 0; i < dicList.Count; i++)
                {
                    //把数据添加到数据库
                    Model.PatientDiagnose model = new Model.PatientDiagnose();
                    model = DicToNormalLisReportModel(dicList[i]);
                    try
                    {
                        if (this.CheckData(model))
                        {
                            dicList.Remove(dicList[i]);
                        }
                        else
                        {
                            list.Add(model);
                        }
                    }
                    catch (Exception ex)
                    {
                        Common.LogHelper.WriteError(ex);
                        continue;
                    }
                }

                newDicList = MatchClinicalDic(dicList, codeType);
               // new Dictionary<string, string>() { {"Sample Source", code  } }
                //newDicList[0].Add("Sample Source", code);
                foreach (var item in newDicList)
                {
                    item.Add("Sample Source", code);
                    if (item.Keys.Contains("诊断类型"))
                    {
                        switch (item["诊断类型"])
                        {
                            case "1":
                                item["诊断类型"] = "中医疾病";
                                break;

                            case "2":
                                item["诊断类型"] = "中医症候";
                                break;

                            case "3":
                                item["诊断类型"] = "西医主诊断";
                                break;

                            case "4":
                                item["诊断类型"] = "西医其他诊断";
                                break;

                            default:
                                break;
                        }
                    }
                    if (item.Keys.Contains("诊断类别"))
                    {
                        switch (item["诊断类别"])
                        {
                            case "1":
                                item["诊断类别"] = "西医诊断";
                                break;

                            case "2":
                                item["诊断类别"] = "中医诊断";
                                break;

                            default:
                                break;
                        }
                    }
                }
                string strList = JsonConvert.SerializeObject(newDicList);
                mes = PostData(strList);
                if (mes.Contains("{\"success\":true,"))
                {
                    foreach (var item in list)
                    {
                        PatientDiagnose n = new PatientDiagnose();
                        try
                        {
                            n.Add(item);
                        }
                        catch (Exception ex)
                        {
                            Common.LogHelper.WriteError(ex);
                            continue;
                        }
                    }
                }
            }
            return mes;
        }
Пример #14
0
        //解析数据
        //返回数据对象
        public List <Model.PatientDiagnose> XmlStrToPatientDiagnoseResuestForZhuYuan(string xml, out string _msg)
        {
            List <Model.PatientDiagnose> list = new List <Model.PatientDiagnose>();

            _msg = "";
            XmlDocument xmldoc = new XmlDocument();

            try
            {
                xmldoc.LoadXml(xml);
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmldoc.NameTable);
                nsmgr.AddNamespace("ab", "http://chas.hit.com/transport/integration/common/msg");
                XmlNodeList respHeaderlist = xmldoc.SelectNodes("//ab:respHeader", nsmgr);
                if (respHeaderlist.Count > 0 && respHeaderlist[0].InnerText.Contains("000000")) //判断数据是否成功获取
                {
                    XmlNodeList paitentlist = xmldoc.SelectNodes("//ab:patient", nsmgr);        //读取病人数据
                    if (paitentlist.Count > 0)
                    {
                        for (int i = 0; i < paitentlist.Count; i++)
                        {
                            XmlNode     xn        = paitentlist[i];                          //基本信息
                            XmlNodeList diagnosis = xn.SelectNodes("//ab:diagnosis", nsmgr); //读取诊断信息
                            if (diagnosis.Count > 0)
                            {
                                for (int j = 0; j < diagnosis.Count; j++)
                                {
                                    //按照类型需要添加进去就好了

                                    Model.PatientDiagnose model = new Model.PatientDiagnose();
                                    DateTime dt = Convert.ToDateTime(xn.SelectSingleNode("//ab:birthday", nsmgr).InnerText);
                                    //基本的
                                    model.Cardno      = ""; //查询卡号
                                    model.Csrq00      = ""; //查询日期
                                    model.PatientName = xn.SelectSingleNode("//ab:name", nsmgr).InnerText;
                                    model.Sex         = xn.SelectSingleNode("//ab:sexName", nsmgr).InnerText;
                                    model.Brithday    = dt;
                                    model.CardId      = xn.SelectSingleNode("//ab:idCardNo", nsmgr).InnerText;
                                    model.Tel         = xn.SelectSingleNode("//ab:phone", nsmgr).InnerText;
                                    model.Icd         = xn.SelectSingleNode("//ab:diagnosisCode", nsmgr).InnerText;
                                    //诊断的
                                    model.Diagnose = diagnosis[j].SelectSingleNode("//ab:diagnosisName", nsmgr).InnerText;
                                    model.Type     = diagnosis[j].SelectSingleNode("//ab:type", nsmgr).InnerText;
                                    if (model.Type.Contains("中医"))
                                    {
                                        model.Flag = "中医诊断";
                                    }
                                    else if (model.Type.Contains("西医"))
                                    {
                                        model.Flag = "西医诊断";
                                    }
                                    model.DiagnoseDate = diagnosis[j].SelectSingleNode("//ab:diagnosisDate", nsmgr).InnerText;
                                    list.Add(model);
                                    model = new Model.PatientDiagnose();
                                }
                            }
                            else
                            {
                                _msg = "查询不到诊断数据";
                            }
                        }
                    }
                    else
                    {
                    }
                }
                else
                {
                    _msg = respHeaderlist[0].InnerText.ToString();
                }
            }
            catch (Exception ex)
            {
                Common.LogHelper.WriteError(ex);
                _msg = ex.ToString();
            }
            return(list);
        }
Пример #15
0
        private List<Model.PatientDiagnose> StrTObject(string xmlStr, out string msg, Model.DTO.PatientDiagnoseResuest request)
        {
            XmlDocument xd = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(xmlStr);
            List<Model.PatientDiagnose> list = new List<Model.PatientDiagnose>();
            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);

                                XmlNodeList xns = xd.SelectNodes("//DiagnoseInfo");
                                foreach (XmlNode item in xns)
                                {
                                    Model.PatientDiagnose patientDiagnoseModel = new Model.PatientDiagnose();
                                    patientDiagnoseModel = JsonConvert.DeserializeObject<Model.PatientDiagnose>(strNode);
                                    string diagnoseInfoNode = JsonConvert.SerializeXmlNode(item, 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;
                                    list.Add(patientDiagnoseModel);
                                }
                            }
                            catch (Exception ex)
                            {
                                Common.LogHelper.WriteError(ex);
                            }

                        }
                        else
                        {
                            //查询数据出错,联接无问题
                            msg = xd.SelectSingleNode("//ErrorMsg").InnerText;
                        }
                    }
                    else
                    {
                        //查询数据出错,联接无问题
                        msg = xd.InnerText;
                    }
                }
            }
            return list;
        }