Ejemplo n.º 1
0
        /// <summary>
        /// 处理数据到数据库中
        /// </summary>
        /// <param name="dt_all"></param>
        /// <returns></returns>
        public string Upd_all(DataTable dt_all)
        {
            if (dt_all.Rows.Count > 0)
            {
                //过滤数据 得到数据行  身份证号
                DataRow[] drs = dt_all.Select("xmdh='NAME'");
                for (int i = 0; i < drs.Length; i++)
                {
                    string    ybh       = drs[i]["ybh"].ToString();
                    DBAccess  dbjkdah   = new DBAccess();
                    DataTable dt_access = dbjkdah.ExecuteQueryBySql(@"select *  from T_JK_lis_result_re where ybh='" + ybh + "'  ");
                    if (dt_access != null && dt_access.Rows.Count > 0)
                    {
                        for (int j = 0; j < dt_access.Rows.Count; j++)
                        {
                            DataTable dt_tem = new DataTable();
                            dt_tem.Columns.Add("yybm");
                            dt_tem.Columns["yybm"].DefaultValue = dt_access.Rows[j]["yybm"];
                            dt_tem.Columns.Add("yq");
                            dt_tem.Columns["yq"].DefaultValue = dt_access.Rows[j]["yq"];
                            dt_tem.Columns.Add("jyrq");
                            dt_tem.Columns["jyrq"].DefaultValue = dt_access.Rows[j]["jyrq"];
                            dt_tem.Columns.Add("ybh");
                            dt_tem.Columns["ybh"].DefaultValue = dt_access.Rows[j]["ybh"];
                            dt_tem.Columns.Add("xmdh");
                            dt_tem.Columns.Add("result");
                            DataRow[] drss = dt_all.Select("jyrq='" + drs[i]["jyrq"].ToString() + "' and ybh='" + drs[i]["ybh"].ToString() + "'");
                            for (int k = 0; k < drss.Length; k++)
                            {
                                dt_tem.Rows.Add();
                                dt_tem.Rows[k]["xmdh"]   = drss[k]["xmdh"];
                                dt_tem.Rows[k]["result"] = drss[k]["result"];
                            }
                            Form_lisBll form_lisbll = new Form_lisBll();
                            form_lisbll.Upd_all(dt_tem, "sql042_update");
                        }
                    }
                    else
                    {
                        DataTable dt_insert_tem = dt_all.Clone();
                        DataRow[] drss          = dt_all.Select("jyrq='" + drs[i]["jyrq"].ToString() + "' and ybh='" + drs[i]["ybh"].ToString() + "'");
                        if (drss != null && drss.Length > 0)
                        {
                            for (int k = 0; k < drss.Length; k++)
                            {
                                dt_insert_tem.ImportRow(drss[k]);
                            }

                            Form_lisBll form_lisbll = new Form_lisBll();

                            form_lisbll.Add(dt_insert_tem, "sql042");
                        }
                    }
                }
            }

            return("");
        }
Ejemplo n.º 2
0
 private void LisResultReOperation(DataTable dt) //用来判断进行插入修改操作
 {
     if (dt != null && dt.Rows.Count > 0)
     {
         Form_lisBll form_lisbll = new Form_lisBll();
         if (LisResultReDataIsExist(dt.Rows[0]["ybh"].ToString(), dt.Rows[0]["jyrq"].ToString(),
                                    dt.Rows[0]["yq"].ToString(), dt.Rows[0]["yybm"].ToString()))
         {
             form_lisbll.Upd_all(dt, "sql042_update");
         }
         else
         {
             form_lisbll.AddNoNeedStateCheck(dt, "sql042");
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取结果
        /// </summary>
        /// <returns></returns>
        public DataTable dataRecive_again()
        {
            DataTable dt     = null;
            string    errMsg = "";

            try
            {
                string paratime = "";

                //开始时间
                if (dateTimePicker_start.Checked == true)
                {
                    paratime = paratime + dateTimePicker_start.Value.ToString("yyyy-MM-dd") + " 00:00:00" + "|";
                }

                //结束时间
                if (dateTimePicker_end.Checked == true)
                {
                    if (paratime.Length > 0)
                    {
                        paratime = paratime + dateTimePicker_end.Value.ToString("yyyy-MM-dd") + " 23:59:59";
                    }
                    else
                    {
                        paratime = paratime + "|" + dateTimePicker_end.Value.ToString("yyyy-MM-dd") + " 23:59:59";
                    }
                }

                if (paratime.Length == 0)
                {
                    paratime = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00" + "|";
                }

                //0:获取新数据  1:获取所有数据
                paratime = paratime + "|" + "1";

                if (yqDemo != null)
                {
                    if (yqDemo.IsOpen(out errMsg) == false)
                    {
                        yqDemo.open(out errMsg);
                    }
                    dt = yqDemo.YQDataReturn(paratime, out errMsg);
                }
                else
                {
                    if (yqxh.Trim().Length == 0)
                    {
                        timer_lis.Enabled = false;

                        return(null);
                    }

                    if (yqDemo == null)
                    {
                        string yqVersion = XmlRW.GetValueFormXML(Common.getyqPath(yqxh), "YQ_Version", "value");
                        yqDemo = LisFactory.LisCreate(yqVersion);
                    }

                    if (yqDemo.IsOpen(out errMsg) == false)
                    {
                        yqDemo.open(out errMsg);
                    }

                    dt = yqDemo.YQDataReturn(paratime, out errMsg);
                }

                //将取得的结果保存到数据库中
                if (dt != null && dt.Rows.Count > 0)
                {
                    if (!dt.Columns.Contains("yybm"))
                    {
                        DataColumn dtcolumn = new DataColumn("yybm");
                        dtcolumn.DefaultValue = UserInfo.Yybm;
                        dt.Columns.Add(dtcolumn);
                    }

                    if (!dt.Columns.Contains("yq"))
                    {
                        DataColumn dtcolumn = new DataColumn("yq");
                        dtcolumn.DefaultValue = timer_lis;
                        dt.Columns.Add(dtcolumn);
                    }

                    //再次处理

                    //将获得的结果匹配体检表中的心电图的结果
                    dt = dt_pp(dt);

                    DataTable dt_again = dt.Clone();

                    DataRow[] dtrow_again = dt.Select(" qf='1'");
                    if (dtrow_again.Length > 0)
                    {
                        for (int i = 0; i < dtrow_again.Length; i++)
                        {
                            dt_again.ImportRow(dtrow_again[i]);
                        }
                    }

                    //新数据
                    DataTable dt_new    = dt.Clone();
                    DataRow[] dtrow_new = dt.Select(" qf='2'");
                    if (dtrow_new.Length > 0)
                    {
                        for (int i = 0; i < dtrow_new.Length; i++)
                        {
                            dt_new.ImportRow(dtrow_new[i]);
                            //置变量,以后不再读取此记录
                            MedExSqlHelper DBF = new MedExSqlHelper();
                            DBF.ExecuteNonQuery("update PACS_APPLY set work_status = 1 where PATIENT_ID = '" + dtrow_new[i]["ybh"].ToString() + "'");
                        }
                    }

                    Form_lisBll form_lisbll = new Form_lisBll();

                    if (dt_new != null && dt_new.Rows.Count > 0)
                    {
                        form_lisbll.Add(dt, "sql042");
                        string xmlPath   = Common.getyqPath("MECG200");
                        string YQ_YQtype = XmlRW.GetValueFormXML(xmlPath, "YQ_YQType", "value");
                        button_save_sys(dt, YQ_YQtype);
                    }

                    if (dt_again != null && dt_again.Rows.Count > 0)
                    {
                        //更新数据
                        form_lisbll.Upd_all(dt_again, "sql042_update");
                        string xmlPath   = Common.getyqPath("MECG200");
                        string YQ_YQtype = XmlRW.GetValueFormXML(xmlPath, "YQ_YQType", "value");

                        //更新数据
                        button_save_sys_again(dt_again, YQ_YQtype);
                    }
                }
            }
            catch (Exception ex)
            {
                timer_lis.Enabled = false;
                Jktj_lis.msgShow(ex.Message);
            }
            return(dt);
        }