Exemplo n.º 1
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));
        }
Exemplo n.º 2
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);
        }