private void QueryData(HttpContext context) { string code = context.Request.Params["code"].Trim(); string codeType = context.Request.Params["codeType"].Trim(); string ksrq00 = context.Request.Params["ksrq00"]; string jsrq00 = context.Request.Params["jsrq00"]; string username = Common.CookieHelper.GetCookieValue("username").Trim(); Model.DTO.PatientDiagnose_list_F model = new Model.DTO.PatientDiagnose_list_F() { code = code, codeType = codeType, ksrq00 = ksrq00, jsrq00 = jsrq00 }; BLL.SZY.PatientDiagnose_list_F bll = new BLL.SZY.PatientDiagnose_list_F(); string result = bll.GetData(model); context.Response.Write(result); }
private List <string> GetRequestStr(Model.DTO.PatientDiagnose_list_F model) { List <string> list = new List <string>(); DateTime ksrq00 = new DateTime(); DateTime jsrq00 = new DateTime(); if (DateTime.TryParse(model.ksrq00, out ksrq00) && DateTime.TryParse(model.jsrq00, out jsrq00)) { if (ksrq00 <= jsrq00) { string str = CreatRequestStr(model.code, ksrq00, jsrq00); list.Add(str); } if (ksrq00 > jsrq00) { string str = CreatRequestStr(model.code, jsrq00, ksrq00); list.Add(str); } } return(list); }
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)); }