/// <summary> /// 前台调用方法 /// </summary> /// <returns></returns> public string GetSampleSourceData(Model.DTO.EmpiInfoRequest request) { string xmlStr = GetData(request); Model.DTO.JsonModel jsonmodel = StrTObject(xmlStr); return(JsonConvert.SerializeObject(jsonmodel)); }
/// <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); }
/// <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); }
/// <summary> /// 上传数据 /// </summary> /// <param name="code">条码</param> /// <param name="codeType">条码的类型:0 卡号,1 住院号</param> /// <param name="dataStr">传入数据</param> /// <returns></returns> public string PostData(string dataStr, string username) { List <Dictionary <string, string> > dicList = GetClinicalInfoDgDicList(dataStr); string mes = ""; //读取code和codeType if (dicList != null && dicList.Count > 0) { for (int i = 0; i < dicList.Count; i++) { Model.QueryRecoder model = new Model.QueryRecoder(); model = DicToQueryRecoderModel(dicList[i]);//转化为MODEL //获取值 string code = dicList[i]["Code"]; string codeType = dicList[i]["CodeType"]; //string date = dicList[i]["LastQueryDate"]; //判断传入类型 if (model.QueryType == "NormalLisReport") { // BLL.Request.NormalLisReportRequest nrr = new Request.NormalLisReportRequest(model); BLL.NormalLisReport nr = new NormalLisReport(); //nrr.CreatRequest(false); string result = nr.GetData(model, false); Model.DTO.JsonModel jsonModel_N = JsonConvert.DeserializeObject <Model.DTO.JsonModel>(result); if (jsonModel_N.Statu == "ok") { string strdata = JsonConvert.SerializeObject(jsonModel_N.Data); mes = mes + nr.PostData(code, codeType, strdata, username, true);//导入到临床检验数据 } else { mes = mes + "," + jsonModel_N.Msg; } } else if (model.QueryType == "PatientDiagnose") { BLL.Request.PatientDiagnoseResuest nrr = new Request.PatientDiagnoseResuest(model); BLL.PatientDiagnose nr = new PatientDiagnose(); nrr.CreatRequest(false); string result = nr.GetData(model, false); Model.DTO.JsonModel jsonModel_N = JsonConvert.DeserializeObject <Model.DTO.JsonModel>(result); if (jsonModel_N.Statu == "ok") { string strdata = JsonConvert.SerializeObject(jsonModel_N.Data); mes = mes + nr.PostData(strdata, code, codeType, username, true);//导入到患者信息 } else { mes = mes + "," + jsonModel_N.Msg; } } } } return(mes); }
public string GetData(Model.DTO.NormalLisReport_list_F model) { //List<Model.NormalLisItems> normalLisItemsList = GetNormalLisItemsList(model, queryBycode); //requestStr = GetRequestList(normalLisItemsList); Model.DTO.JsonModel jsonmodel = new Model.DTO.JsonModel() { Statu = "err", Msg = "无数据", Data = "" }; List <string> requestStr = new List <string>(); requestStr = GetRequestStr(model); if (requestStr != null && requestStr.Count > 0) { List <Model.NormalLisReport> normalLisReportList = new List <Model.NormalLisReport>(); StringBuilder msg = new StringBuilder(); //调用接口获取数据 foreach (var item in requestStr) { string xmlStr = GetWebServiceData(item); string Msg = ""; //将xml数据转换成list集合会查询本地数据库去除重复项 List <Model.NormalLisReport> nnn = this.GetList(xmlStr, out Msg); if (nnn != null && nnn.Count > 0) { //有数据 normalLisReportList.AddRange(nnn); if (!string.IsNullOrEmpty(Msg)) { msg.Replace(" ", ""); msg.Replace(" ", ""); msg.Append("   " + Msg); } } else { //无数据 jsonmodel = CreatJsonMode("err", Msg, nnn); //ChangeQueryRecordStatu(this.queryRecoderModel, Msg); } } if (normalLisReportList != null && normalLisReportList.Count > 0) { jsonmodel = CreatJsonMode("ok", msg.ToString(), normalLisReportList); //更新记录表状态 //ChangeQueryRecordStatu(this.queryRecoderModel, msg.ToString()); } else { //无数据 jsonmodel = CreatJsonMode("err", msg.ToString(), normalLisReportList); //ChangeQueryRecordStatu(this.queryRecoderModel, msg.ToString()); } } return(JsonConvert.SerializeObject(jsonmodel)); }
public string GetData(Model.DTO.NormalLisReport_list_F model) { //List<Model.NormalLisItems> normalLisItemsList = GetNormalLisItemsList(model, queryBycode); //requestStr = GetRequestList(normalLisItemsList); Model.DTO.JsonModel jsonmodel = new Model.DTO.JsonModel() { Statu = "err", Msg = "无数据", Data = "" }; List<string> requestStr = new List<string>(); requestStr = GetRequestStr(model); if (requestStr != null && requestStr.Count > 0) { List<Model.NormalLisReport> normalLisReportList = new List<Model.NormalLisReport>(); StringBuilder msg = new StringBuilder(); //调用接口获取数据 foreach (var item in requestStr) { string xmlStr = GetWebServiceData(item); string Msg = ""; //将xml数据转换成list集合会查询本地数据库去除重复项 List<Model.NormalLisReport> nnn = this.GetList(xmlStr, out Msg); if (nnn != null && nnn.Count > 0) { //有数据 normalLisReportList.AddRange(nnn); if (!string.IsNullOrEmpty(Msg)) { msg.Replace(" ", ""); msg.Replace(" ", ""); msg.Append("   " + Msg); } } else { //无数据 jsonmodel = CreatJsonMode("err", Msg, nnn); //ChangeQueryRecordStatu(this.queryRecoderModel, Msg); } } if (normalLisReportList != null && normalLisReportList.Count > 0) { jsonmodel = CreatJsonMode("ok", msg.ToString(), normalLisReportList); //更新记录表状态 //ChangeQueryRecordStatu(this.queryRecoderModel, msg.ToString()); } else { //无数据 jsonmodel = CreatJsonMode("err", msg.ToString(), normalLisReportList); //ChangeQueryRecordStatu(this.queryRecoderModel, msg.ToString()); } } return JsonConvert.SerializeObject(jsonmodel); }
private Model.DTO.JsonModel CreatJsonMode(string statu, string msg, object data) { Model.DTO.JsonModel jsonModel = new Model.DTO.JsonModel(); if (statu == "err") { jsonModel.Statu = statu; jsonModel.Msg = msg; } else { jsonModel.Statu = statu; jsonModel.Msg = msg; jsonModel.Data = data; } return(jsonModel); }
/// <summary> /// 创建返回数据对象 /// </summary> /// <param name="obj"></param> /// <param name="msg"></param> /// <returns></returns> private Model.DTO.JsonModel CreatJsonModel(object obj, string msg) { Model.DTO.JsonModel jsonModel = new Model.DTO.JsonModel(); if (string.IsNullOrEmpty(msg)) { jsonModel.Data = obj; jsonModel.Msg = "查询成功"; jsonModel.Statu = "ok"; } else { jsonModel.Data = obj; jsonModel.Msg = msg; jsonModel.Statu = "err"; } return(jsonModel); }
//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("   " + _Msg); } } } //nnn.Add(model.Code); else { if (!string.IsNullOrEmpty(_Msg)) { msg.Replace(_Msg, ""); msg.Append("   " + _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)); }
/// <summary> /// 创建返回数据对象 /// </summary> /// <param name="obj"></param> /// <param name="msg"></param> /// <returns></returns> private Model.DTO.JsonModel CreatJsonModel(object obj, string msg) { Model.DTO.JsonModel jsonModel = new Model.DTO.JsonModel(); if (string.IsNullOrEmpty(msg)) { jsonModel.Data = obj; jsonModel.Msg = "查询成功"; jsonModel.Statu = "ok"; } else { jsonModel.Data = obj; jsonModel.Msg = msg; jsonModel.Statu = "err"; } return jsonModel; }
private Model.DTO.JsonModel CreatJsonMode(string statu, string msg, object data) { Model.DTO.JsonModel jsonModel = new Model.DTO.JsonModel(); if (statu == "err") { jsonModel.Statu = statu; jsonModel.Msg = msg; } else { jsonModel.Statu = statu; jsonModel.Msg = msg; jsonModel.Data = data; } return jsonModel; }
/// <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; }
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(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _Msg); } } } } //nnn.Add(model.Code); else { if (!string.IsNullOrEmpty(_Msg)) { msg.Replace(_Msg, ""); msg.Replace(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _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(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _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(" ", ""); // msg.Replace(" ", ""); // msg.Append("   " + _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)); }
/// <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; }
//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("   " + _Msg); } } } //nnn.Add(model.Code); else { if (!string.IsNullOrEmpty(_Msg)) { msg.Replace(_Msg, ""); msg.Append("   " + _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); }
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(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _Msg); } } } } //nnn.Add(model.Code); else { if (!string.IsNullOrEmpty(_Msg)) { msg.Replace(_Msg, ""); msg.Replace(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _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.GetRequestStr(model,"AdmissionDate"); //获取出院入参 List<string> requestStrDischargeDate = new List<string>(); requestStrDischargeDate = pk.GetRequestStr(model,"DischargeDate"); List<Model.PatientDiagnose> patientDiagnoseList = new List<Model.PatientDiagnose>();//最终数据存放处 StringBuilder msg = new StringBuilder(); #region 获取住院日期数据 //判断返回数据是否成功 if (requestStrAdmissionDate != null && requestStrAdmissionDate.Count > 0) { foreach (var item in requestStrAdmissionDate) { string _Msg = ""; List<Model.PatientDiagnose> patientDiagnoses = pk.GetHTTPWebServiceData(item); if (patientDiagnoses != null && patientDiagnoses.Count > 0) { 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(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _Msg); } } } else { if (!string.IsNullOrEmpty(_Msg)) { msg.Replace(_Msg, ""); msg.Replace(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _Msg); } } } } #endregion #region 获取出院日期数据 if (requestStrDischargeDate != null && requestStrDischargeDate.Count > 0) { foreach (var item in requestStrDischargeDate) { string _Msg = ""; List<Model.PatientDiagnose> patientDiagnoses = pk.GetHTTPWebServiceData(item); if (patientDiagnoses != null && patientDiagnoses.Count > 0) { 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(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _Msg); } } } else { if (!string.IsNullOrEmpty(_Msg)) { msg.Replace(_Msg, ""); msg.Replace(" ", ""); msg.Replace(" ", ""); msg.Append("   " + _Msg); } } } } #endregion 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 return JsonConvert.SerializeObject(jsonmodel); }