public void InitKey(string where, List<LabPK> PKList) { LabPK pk = null; string sql = GetSQLString(where); LOG.Info("查询主键SQL语句:" + sql); DataTable dt = GetDataTable(sql); if (dt == null) { LOG.Error("获取主键集合失败"); return; } if (dt.Rows.Count > 0) { LOG.Info("填充主键集合"); foreach (DataRow dr in dt.Rows) { pk = new LabPK(); if (SetKey(dr, pk)) { pk.Configured = true; PKList.Add(pk); } else { LOG.Warn("主键集合数据填充有错误项"); } } } }
public void InitKey(Require require, List<LabPK> PKList) { LabPK pk = null; string sql = GetSQLString(require.ToString()); DataTable dt = GetDataTable(sql); if (dt == null) { LOG.Error("获取主键集合失败"); return; } if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { pk = new LabPK(); SetKey(dr, pk); pk.Configured = true; PKList.Add(pk); } } }
private bool InnerHandleItem(LabReport report, LabPK RK) { bool result = false; List<IFillElement> ls = new List<IFillElement>(32); LOG.Info("报告明细项处理"); result = this.ItemHandler.HandleElement(ls, RK, typeof(ItemElement)); if (result) { this.ItemConvert(report, ls); report.ItemList.Sort(); } return result; }
private bool InnerHandleImage(LabReport report, LabPK RK) { bool result = false; List<IFillElement> ls = new List<IFillElement>(6); //处理image result = this.ImageHandler.HandleElement(ls, RK, typeof(ImageElement)); if (result) { this.ImageConvert(report, ls); } return result; }
private bool InnerHandleGS(LabReport report, LabPK RK) { bool result = false; List<IFillElement> ls = new List<IFillElement>(50); result = this.GSItemHandler.HandleElement(ls, RK, typeof(GSItem)); if (result) { this.GSItemConvert(ls, report.CustomList); ls.Clear(); result = this.GeneCustomHandler.HandleElement(ls, RK, typeof(GSCustom)); if (result) { this.GSCustomConvert(report.Info, report.ImageList, ls); } } return result; }
private bool InnerHandleGene(LabReport report, LabPK RK) { bool result = false; GeneCustom ci = null; CustomElement custom = null; List<IFillElement> items = null; List<LabPK> PKList = new List<LabPK>(3); this.PKDAL.InitKey(RK, PKList); foreach (LabPK key in PKList) { ci = new GeneCustom(); custom = new CustomElement(); result = this.GeneCustomHandler.HandleElement(ci, key); if (result) { this.GeneConvert(custom, ci); items = new List<IFillElement>(5); result = this.ItemHandler.HandleElement(items, key, typeof(ItemElement)); if (result) { this.GeneConvert(custom, report.SuperList, items); } } else { break; } report.CustomList.Add(custom); } return result; }
//数据填充、清洗、转换等操作 private bool InnerHandle(LabReport report, LabPK RK) { bool result = false; //处理info result = this.InfoHandler.HandleElement(report.Info, RK); switch (RK.SectionNo) { //无图无特殊内容 case 2: case 27: case 62: case 17: case 23: case 29: case 34: case 5: case 19: case 20: case 21: case 25: case 30: case 33: case 63: case 14: case 4: case 24: case 18: LOG.Info("通用无图类型报告处理"); result = this.InnerHandleItem(report, RK); break; //基因配型 case 45: LOG.Info("基因配型报告处理"); result = this.InnerHandleGene(report, RK); break; case 39: LOG.Info("骨髓报告处理"); result = this.InnerHandleGS(report, RK); break; //默认 default: LOG.Info("通用有图类型报告处理(默认处理方式)"); result = this.InnerHandleItem(report, RK); result = this.InnerHandleImage(report, RK); break; } return result; }
//内部操作,处理成功后触发成功事件,失败后触发失败事件 private void InnerHandle(LabPK RK) { LabReport report = new LabReport(); bool result = this.InnerHandle(report, RK); if (result) { //后续处理 LOG.Info("报告后续处理"); this.HandleAfter(report, RK); LOG.Info("触发处理完成事件"); this.OnSuccess(report); } else { LOG.Info("触发处理失败事件"); this.OnError(report); } }
public void InitReport(LabPK PK) { if (PK != null && PK.Configured) { LOG.Info("将ID为" + PK.ID + "的主键添加到待处理队列"); this.RequestQueue.Add(PK); } }
//基因配型特殊代码处理 public void InitKey(LabPK PK, List<LabPK> PKList) { LOG.Info("利用通用主键获取基因配型特殊主键"); string sql = "select patno,paritemname from reportform" + PK.KeyWhere(); DataTable dt = GetDataTable(sql); if (dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append(" where"); sb.Append(" receivedate='"); sb.Append(PK.ReceiveDate.ToString("yyyy-MM-dd")); sb.Append("' and sectionno="); sb.Append(PK.SectionNo); sb.Append(" and testtypeno="); sb.Append(PK.TestTypeNo); sb.Append(" and patno='"); sb.Append(dt.Rows[0]["patno"].ToString()); sb.Append("' and paritemname='"); sb.Append(dt.Rows[0]["paritemname"].ToString()); sb.Append("'"); string where = sb.ToString(); LOG.Info("获取基因配型特殊主键的where语句" + where); this.InitKey(where, PKList); } }
protected bool SetKey(DataRow dr, LabPK PK) { try { PK.SampleNo = dr["sampleno"].ToString(); PK.ReceiveDate = (DateTime)dr["receivedate"]; PK.SectionNo = Convert.ToInt32(dr["sectionno"]); PK.TestTypeNo = Convert.ToInt32(dr["testtypeno"]); return true; } catch (Exception ex) { LOG.Error("填充主键数据异常", ex); return false; } }