private void button5_Click(object sender, EventArgs e) { string WBC = this.textBox5.Text; string RBC = this.textBox6.Text; string PCT = this.textBox8.Text; string PLT = this.textBox7.Text; string HGB = this.textBox11.Text; string HCT = this.textBox10.Text; string MCV = this.textBox13.Text; string MCH = this.textBox12.Text; string MCHC = this.textBox15.Text; string RDWCV = this.textBox14.Text; string RDWSD = this.textBox17.Text; string MONO = this.textBox16.Text; string MONOP = this.textBox19.Text; string GRAN = this.textBox18.Text; string GRANP = this.textBox21.Text; string NEUT = this.textBox20.Text; string NEUTP = this.textBox23.Text; string EO = this.textBox22.Text; string EOP = this.textBox25.Text; string BASO = this.textBox24.Text; string BASOP = this.textBox29.Text; string LYM = this.textBox28.Text; string LYMP = this.textBox31.Text; string MPV = this.textBox30.Text; string PDW = this.textBox33.Text; string MXD = this.textBox32.Text; string MXDP = this.textBox35.Text; string PLCR = this.textBox34.Text; string OTHERS = this.textBox36.Text; //1:判断有没有,有就更新 否则就插入 DataTable selectXuechangguiInfo bool istrue = false; if (_isHaveData == true) { istrue = tjdao.updateXuechangguiInfo(aichive_no, bar_code, WBC, RBC, PCT, PLT, HGB, HCT, MCV, MCH, MCHC, RDWCV, RDWSD, MONO, MONOP, GRAN, GRANP, NEUT, NEUTP, EO, EOP, BASO, BASOP, LYM, LYMP, MPV, PDW, MXD, MXDP, PLCR, OTHERS, _currentdevno, setting.basicInfoSettings.xcg); } else { string[] deviceno = Common._deviceModel.Split(','); xuechangguiBean obj = new xuechangguiBean(); obj.deviceModel = deviceno[1].ToString().Trim(); obj.aichive_no = aichive_no; obj.bar_code = bar_code; obj.id_number = textBox4.Text; obj.HCT = HCT; obj.HGB = HGB; obj.LYM = LYM; obj.LYMP = LYMP; obj.MCH = MCH; obj.MCHC = MCHC; obj.MCV = MCV; obj.MPV = MPV; obj.MXD = MXD; obj.MXDP = MXDP; obj.NEUT = NEUT; obj.NEUTP = NEUTP; obj.PCT = PCT; obj.PDW = PDW; obj.PLT = PLT; obj.RBC = RBC; obj.RDWCV = RDWCV; obj.RDWSD = RDWSD; obj.WBC = WBC; obj.MONO = MONO; obj.MONOP = MONOP; obj.GRAN = GRAN; obj.GRANP = GRANP; obj.PLCR = PLCR; obj.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); obj.ZrysXCG = setting.basicInfoSettings.xcg; //obj.timeCodeUnique = obj.bar_code + "_" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); istrue = tjdao.insertXuechangguiInfo(obj); } if (istrue) { #region 处理下数据判断 int r0 = 1; if (WBC != "" && WBC != "*") { double a = 0; bool b = double.TryParse(WBC, out a); if (b == true) { r0 = GetJudgeResultForWBC(a); } } int r1 = 1; if (RBC != "" && RBC != "*") { double a = 0; bool b = double.TryParse(RBC, out a); if (b == true) { r1 = GetJudgeResultForRBC(a); } } int r2 = 1; if (PCT != "" && PCT != "*") { double a = 0; bool b = double.TryParse(PCT, out a); if (b == true) { r2 = GetJudgeResultForPCT(a); } } int r3 = 1; if (PLT != "" && PLT != "*") { double a = 0; bool b = double.TryParse(PLT, out a); if (b == true) { r3 = GetJudgeResultForPLT(a); } } int r4 = 1; if (HGB != "" && HGB != "*") { double a = 0; bool b = double.TryParse(HGB, out a); if (b == true) { r4 = GetJudgeResultForHGB(a); } } int r5 = 1; if (HCT != "" && HCT != "*") { double a = 0; bool b = double.TryParse(HCT, out a); if (b == true) { r5 = GetJudgeResultForHCT(a); } } int r6 = 1; if (MCV != "" && MCV != "*") { double a = 0; bool b = double.TryParse(MCV, out a); if (b == true) { r6 = GetJudgeResultForMCV(a); } } int r7 = 1; if (MCH != "" && MCH != "*") { double a = 0; bool b = double.TryParse(MCH, out a); if (b == true) { r7 = GetJudgeResultForMCH(a); } } int r8 = 1; if (MCHC != "" && MCHC != "*") { double a = 0; bool b = double.TryParse(MCHC, out a); if (b == true) { r8 = GetJudgeResultForMCHC(a); } } int r9 = 1; if (RDWCV != "" && RDWCV != "*") { double a = 0; bool b = double.TryParse(RDWCV, out a); if (b == true) { r9 = GetJudgeResultForRDWCV(a); } } int r10 = 1; if (RDWSD != "" && RDWSD != "*") { double a = 0; bool b = double.TryParse(RDWSD, out a); if (b == true) { r10 = GetJudgeResultForRDWSD(a); } } int r11 = 1; if (NEUT != "" && NEUT != "*") { double a = 0; bool b = double.TryParse(NEUT, out a); if (b == true) { r11 = GetJudgeResultForNEUT(a); } } int r12 = 1; if (NEUTP != "" && NEUTP != "*") { double a = 0; bool b = double.TryParse(NEUTP, out a); if (b == true) { r12 = GetJudgeResultForNEUTP(a); } } int r13 = 1; if (LYM != "" && LYM != "*") { double a = 0; bool b = double.TryParse(LYM, out a); if (b == true) { r13 = GetJudgeResultForLYM(a); } } int r14 = 1; if (LYMP != "" && LYMP != "*") { double a = 0; bool b = double.TryParse(LYMP, out a); if (b == true) { r14 = GetJudgeResultForLYMP(a); } } int r15 = 1; if (MPV != "" && MPV != "*") { double a = 0; bool b = double.TryParse(MPV, out a); if (b == true) { r15 = GetJudgeResultForMPV(a); } } int r16 = 1; if (PDW != "" && PDW != "*") { double a = 0; bool b = double.TryParse(PDW, out a); if (b == true) { r16 = GetJudgeResultForPDW(a); } } int r17 = 1; if (MXD != "" && MXD != "*") { double a = 0; bool b = double.TryParse(MXD, out a); if (b == true) { r17 = GetJudgeResultForMXD(a); } } int r18 = 1; if (MXDP != "" && MXDP != "*") { double a = 0; bool b = double.TryParse(MXDP, out a); if (b == true) { r18 = GetJudgeResultForMXDP(a); } } int r = 1; r = r0; if (r < r1) { r = r1; } if (r < r2) { r = r2; } if (r < r3) { r = r3; } if (r < r4) { r = r4; } if (r < r5) { r = r5; } if (r < r6) { r = r6; } if (r < r7) { r = r7; } if (r < r8) { r = r8; } if (r < r9) { r = r9; } if (r < r10) { r = r10; } if (r < r11) { r = r11; } if (r < r12) { r = r12; } if (r < r13) { r = r13; } if (r < r14) { r = r14; } if (r < r15) { r = r15; } if (r < r16) { r = r16; } if (r < r17) { r = r17; } if (r < r18) { r = r18; } #endregion tjdao.updateTJbgdcXuechanggui(aichive_no, bar_code, r); tjdao.updatePEXcgInfo(aichive_no, bar_code, HGB, WBC, PLT); testFunDelegate(r, 8, rowIndex); MessageBox.Show("数据保存成功!"); } else { MessageBox.Show("数据保存失败!"); } }
public static void OnChangedForxcg(object source, FileSystemEventArgs e) { xmlDoc.Load(path); node = xmlDoc.SelectSingleNode("config/xuechangguiPath"); xuechangguipath = node.InnerText; xmlDoc.Load(path); node = xmlDoc.SelectSingleNode("config/xcglasttime"); lasttime = node.InnerText; // string sql1 = "select lop.patient_id,lop.send_time,lopr.* from LisOutput lop, LisOutputResult lopr where lop.sample_id=lopr.sample_id and lop.sample_id=(select top 1 l.sample_id from LisOutput l order by l.sample_id desc)"; string sql1 = "select sample_id,patient_id,send_time from LisOutput where send_time > cdate('" + lasttime + "')"; DataTable arr_dt1 = getXuechanggui(sql1).Tables[0]; if (arr_dt1.Rows.Count > 0) { for (int j = 0; j < arr_dt1.Rows.Count; j++) { string sql2 = "select lop.patient_id,lop.send_time,lopr.* from LisOutput lop, LisOutputResult lopr where lop.sample_id=lopr.sample_id and lop.sample_id='" + arr_dt1.Rows[j]["sample_id"].ToString() + "'"; DataTable arr_dt2 = getXuechanggui(sql2).Tables[0]; if (arr_dt2.Rows.Count > 0) { xuechangguiBean xcg = new xuechangguiBean(); xcg.bar_code = arr_dt1.Rows[0]["patient_id"].ToString(); DataTable dtjkinfo = jkdao.selectjkInfoBybarcode(xcg.bar_code); if (dtjkinfo != null && dtjkinfo.Rows.Count > 0) { xcg.aichive_no = dtjkinfo.Rows[0]["aichive_no"].ToString(); xcg.id_number = dtjkinfo.Rows[0]["id_number"].ToString(); } else { return; } DateTime newtime = Convert.ToDateTime(arr_dt1.Rows[0]["send_time"].ToString()); DateTime oldtime = Convert.ToDateTime(lasttime); if (newtime <= oldtime) { return; } xcg.createTime = newtime.ToString("yyyy-MM-dd HH:mm:ss"); for (int i = 0; i < arr_dt2.Rows.Count; i++) { string item = arr_dt2.Rows[i]["item"].ToString(); switch (item) { case "HCT": xcg.HCT = arr_dt2.Rows[i]["result"].ToString(); break; case "HGB": xcg.HGB = arr_dt2.Rows[i]["result"].ToString(); break; case "LYM#": xcg.LYM = arr_dt2.Rows[i]["result"].ToString(); break; case "LYM%": xcg.LYMP = arr_dt2.Rows[i]["result"].ToString(); break; case "MCH": xcg.MCH = arr_dt2.Rows[i]["result"].ToString(); break; case "MCHC": xcg.MCHC = arr_dt2.Rows[i]["result"].ToString(); break; case "MCV": xcg.MCV = arr_dt2.Rows[i]["result"].ToString(); break; case "MPV": xcg.MPV = arr_dt2.Rows[i]["result"].ToString(); break; case "MXD#": xcg.MXD = arr_dt2.Rows[i]["result"].ToString(); break; case "MXD%": xcg.MXDP = arr_dt2.Rows[i]["result"].ToString(); break; case "NEUT#": xcg.NEUT = arr_dt2.Rows[i]["result"].ToString(); break; case "NEUT%": xcg.NEUTP = arr_dt2.Rows[i]["result"].ToString(); break; case "PCT": xcg.PCT = arr_dt2.Rows[i]["result"].ToString(); break; case "PDW": xcg.PDW = arr_dt2.Rows[i]["result"].ToString(); break; case "PLT": xcg.PLT = arr_dt2.Rows[i]["result"].ToString(); break; case "RBC": xcg.RBC = arr_dt2.Rows[i]["result"].ToString(); break; case "RDW_CV": xcg.RDW_CV = arr_dt2.Rows[i]["result"].ToString(); break; case "RDW_SD": xcg.RDW_SD = arr_dt2.Rows[i]["result"].ToString(); break; case "WBC": xcg.WBC = arr_dt2.Rows[i]["result"].ToString(); break; default: break; } } bool istrue = tjdao.insertXuechangguiInfo(xcg); if (istrue) { xmlDoc.Load(path); XmlNode node; node = xmlDoc.SelectSingleNode("config/xcglasttime"); node.InnerText = xcg.createTime; xmlDoc.Save(path); tjdao.updateTJbgdcXuechanggui(xcg.aichive_no, xcg.bar_code, 1); tjdao.updatePEXcgInfo(xcg.aichive_no, xcg.bar_code, xcg.HGB, xcg.WBC, xcg.PLT); } } } } else { //MessageBox.Show(""); } }