private void blbiQuery_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { List <EntityParm> parms = new List <EntityParm>(); string search = this.txtClientName.Text; EntityParm vo = new EntityParm(); vo.key = "search"; vo.value = search; parms.Add(vo); List <EntityClientInfo> lstClient = null; string clientNoStr = string.Empty; if (!string.IsNullOrEmpty(search)) { using (ProxyHms proxy = new ProxyHms()) { lstClient = proxy.Service.GetClientInfoAndRpt(parms); } } if (lstClient != null) { foreach (var client in lstClient) { clientNoStr += "'" + client.clientNo + "',"; } } if (!string.IsNullOrEmpty(clientNoStr)) { List <EntityClientTnbResult> lstTnbResult = null; clientNoStr = "(" + clientNoStr.TrimEnd(',') + ")"; using (ProxyHms proxy = new ProxyHms()) { lstTnbResult = proxy.Service.GetClientTnbResults(clientNoStr); } foreach (var clientVo in lstClient) { EntityClientTnbResult tnbResult = null; if (lstTnbResult != null) { tnbResult = lstTnbResult.Find(r => r.clientNo == clientVo.clientNo && r.regTimes == clientVo.regTimes); } else { lstTnbResult = new List <EntityClientTnbResult>(); } if (tnbResult == null) { tnbResult = new EntityClientTnbResult(); lstTnbResult.Add(tnbResult); } tnbResult = Function.MapperToModel(tnbResult, clientVo); } this.gcData.DataSource = lstTnbResult; this.gcData.RefreshDataSource(); } }
private void blbiAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { EntityClientTnbResult gxyResult = GetRowObject(); if (gxyResult == null) { return; } List <EntityParm> parms = new List <EntityParm>(); EntityParm vo1 = new EntityParm(); vo1.key = "clientNo"; vo1.value = gxyResult.clientNo; parms.Add(vo1); EntityParm vo2 = new EntityParm(); vo2.key = "regTimes"; vo2.value = gxyResult.regTimes.ToString(); parms.Add(vo2); using (ProxyHms proxy = new ProxyHms()) { List <EntityTnbRecord> lstRecord = proxy.Service.GetTnbPatients(parms); if (lstRecord != null) { DialogBox.Msg("人员已添加,请重新选择!"); return; } } EntityTnbRecord tnbRecorde = new EntityTnbRecord(); tnbRecorde.clientNo = gxyResult.clientNo; tnbRecorde.regNo = gxyResult.regNo; tnbRecorde.beginDate = DateTime.Now; tnbRecorde.regTimes = gxyResult.regTimes; tnbRecorde.status = 0; decimal recId = 0; using (ProxyHms proxy = new ProxyHms()) { int affect = proxy.Service.SaveTnbRecord(tnbRecorde, out recId); if (affect > 0) { isRefresh = true; tnbRecorde.recId = recId; DialogBox.Msg("添加成功!"); } else { DialogBox.Msg("添加失败!"); } } }
/// <summary> /// /// </summary> /// <param name="clientNo"></param> /// <returns></returns> public List <EntityClientTnbResult> GetClientTnbResults(string clientNoStr) { if (string.IsNullOrEmpty(clientNoStr)) { return(null); } SqlHelper svc = new SqlHelper(EnumBiz.onlineDB); List <EntityClientTnbResult> data = null; string sql = @"select a.clientNo,a.regTimes,b.reg_no,b.reg_time,b.comb_code,b.comb_name,b.result ,b.unit from V_RportRecord a left join V_TJBG b on a.reportId = b.reg_no where b.comb_code in('60152 ','060075') and a.clientNo in {0} order by b.reg_time desc "; sql = string.Format(sql, clientNoStr); DataTable dt = svc.GetDataTable(sql); if (dt != null && dt.Rows.Count > 0) { data = new List <EntityClientTnbResult>(); EntityClientTnbResult vo = null; foreach (DataRow dr in dt.Rows) { string clientNo = dr["clientNo"].ToString(); string regNo = dr["reg_no"].ToString(); string comb_code = dr["comb_code"].ToString(); string result = dr["result"].ToString() + " " + dr["unit"].ToString();; if (data.Any(r => r.regNo == regNo)) { EntityClientTnbResult voClone = data.Find(r => r.regNo == regNo); if (result.Contains("血糖")) { voClone.tnbYc = result; } if (comb_code == "060075") { voClone.tnb = result; } } else { vo = new EntityClientTnbResult(); vo.clientNo = clientNo; vo.regNo = regNo; vo.regTimes = Function.Int(dr["regTimes"]); if (result.Contains("血糖")) { vo.tnbYc = result; } if (comb_code == "060075") { vo.tnb = result; } data.Add(vo); } } } return(data); }