예제 #1
0
        private void 导入资源ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fBatchInsert fb = new fBatchInsert();
            Form2WaittingGetTotalRecords form = new Form2WaittingGetTotalRecords();

            form.Show();
            int totalrecord = fb.GetTotalXS(form.GetTotalNum);

            form.Close();
            daoruxuansan daoru = new daoruxuansan();

            daoru.TotalRecords = totalrecord;
            daoru.fBatchInsert = fb;
            daoru.ShowDialog();
        }
예제 #2
0
        private void 新建ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fBatchInsert fb = new fBatchInsert();
            // batchinsert.Show();
            Form2WaittingGetTotalRecords frmwatiting = new Form2WaittingGetTotalRecords();

            frmwatiting.Show();
            int totalrecord = fb.GetTotalN(frmwatiting.GetTotalNum);

            frmwatiting.Close();
            Output output = new Output();

            output.TotalRecords = totalrecord;
            output.fBatchInsert = fb;
            output.ShowDialog();
        }
예제 #3
0
        //导入到宣三系统
        /// <summary>
        /// 根据算法按照分配百分比,导入相对应数据
        /// </summary>
        /// <param name="gettotal"></param>
        /// <param name="sw"></param>
        /// <param name="rich"></param>
        public void daoruxuansan(GetTotaldaoruxuansan gettotal, GetMday getmtotal, System.Diagnostics.Stopwatch sw, System.Windows.Forms.RichTextBox rich)
        {
            wznr_Servise service = new wznr_Servise();

            servicemodel.service model = new servicemodel.service();
            serviceBLL           bll   = new serviceBLL();
            StringBuilder        sb    = new StringBuilder();
            string sql      = "";
            string sqlfenye = "";

            double[] numbers = new double[5] {
                0.31, 0.27, 0.08, 0.21, 0.13
            };
            int    totalRecords = 0;
            int    total        = 0;
            string name         = "";
            int    temp         = 0;//循环第一次的值

            //for 两个循环,第一循环控制年份,第二循环控制月份,
            sw.Start();
            for (int y = 2010; y < 2013; y++)
            {
                for (int m = 1; m < 13; m++)
                {
                    int    temp1 = 0; //计数器
                    double num   = 0; //获取人员分配条数
                    sql = "select * from KFLR where datepart(mm,pubtime)=" + m + " and DATEPART(yy,pubtime)=" + y;
                    ////获取每月数据
                    int count = service.GetRecordCount("select count(*) from KFLR where datepart(mm,pubtime)=" + m + " and DATEPART(yy,pubtime)=" + y);
                    //按照比例分配 count*numbers[i],按照每个部门分配比例循环获按月份取条数
                    Form2WaittingGetTotalRecords form = new Form2WaittingGetTotalRecords();
                    form.Show();
                    form.Text    = string.Format("{2}年-{0}月数据:{1}条", m.ToString(), count.ToString(), y.ToString());
                    totalRecords = GetTotalMXS(form.GetTotalNum, sql);//fBatchInsert.GetTotalXS(form.GetTotalNum);
                    for (int t = 0; t < numbers.Length; t++)
                    {
                        switch (numbers[t].ToString())
                        {
                        case "0.31":
                            name = "杨敏月";
                            break;

                        case "0.27":
                            name = "刘洪那";
                            break;

                        case "0.08":
                            name = "朱欢";
                            break;

                        case "0.21":
                            name = "门诊";    //默认刘雪梅部门
                            break;

                        case "0.13":
                            name = "马健";
                            break;

                        default:
                            break;
                        }
                        num  = Convert.ToInt32(Math.Round((totalRecords * numbers[t]), 0)); //Round((totalRecords * numbers[t]), 0);
                        temp = Convert.ToInt32(Math.Round((totalRecords * numbers[0]), 0)); //记录第一次值
                        //select top 10 * from KFLR where ID not in(select top (10*(2-1)) ID from KFLR where DATEPART(MM,PubTime)=5 and DATEPART(YY,PubTime)=2010) and datepart(mm,pubtime)=5 and DATEPART(yy,pubtime)=2010
                        sqlfenye = "select top " + num + " * from KFLR where ID not in(select top " + temp1 + " ID from KFLR where DATEPART(MM,PubTime)=" + m + " and DATEPART(YY,PubTime)=" + y + ") and datepart(mm,pubtime)=" + m + " and DATEPART(yy,pubtime)=" + y + "";
                        temp1    = temp1 + Convert.ToInt32(num);//每次循环出来的值+上一次num的值
                        //DataTable dt = service.GetDataTable2("select top " + num + " * from KFLR where datepart(mm,pubtime)=" + m + " and DATEPART(yy,pubtime)=" + y);
                        DataTable dt = service.GetDataTable2(sqlfenye);
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            model.username     = Convert.ToString(dt.Rows[i]["username"]);                                                                                      //患者名称
                            model.userage      = Convert.ToString(dt.Rows[i]["age"]);                                                                                           //患者年龄
                            model.usersex      = "不详";                                                                                                                          //患者性别
                            model.userphoto    = Convert.ToString(dt.Rows[i]["tel"]);                                                                                           //患者电话
                            model.useraddress  = Convert.ToString(dt.Rows[i]["address"]);                                                                                       //患者地址
                            model.subtime      = Convert.ToDateTime(dt.Rows[i]["pubtime"]);                                                                                     //提交时间
                            model.zhengzhuang  = Convert.ToString(dt.Rows[i]["bingzhong"]);                                                                                     //病情症状
                            model.chats        = Convert.ToString(dt.Rows[i]["ltrecord"]);                                                                                      //内容
                            model.eatime       = dt.Rows[i]["teltime"] == DBNull.Value ? Convert.ToDateTime(dt.Rows[i]["pubtime"]) : Convert.ToDateTime(dt.Rows[i]["teltime"]); //通话日期
                            model.telextract   = null;
                            model.eaname       = Convert.ToString(dt.Rows[i]["zbusername"]);                                                                                    //值班人
                            model.userweb      = Convert.ToString(dt.Rows[i]["webaddress"]);                                                                                    //所属网站
                            model.theirpeople  = Convert.ToString(dt.Rows[i]["pubusername"]);                                                                                   //录入人员
                            model.flag         = 0;
                            model.memo         = Convert.ToString(dt.Rows[i]["beizhu"]).Trim();                                                                                 //备注
                            model.bj           = "0";
                            model.sfzy         = "1";
                            model.typeflag     = "1";
                            model.hfdata       = dt.Rows[i]["retime"] == DBNull.Value ? Convert.ToDateTime(dt.Rows[i]["pubtime"]) : Convert.ToDateTime(dt.Rows[i]["retime"]); //回复日期
                            model.sfyx         = "0";                                                                                                                         //是否有效
                            model.zzy          = "所属资源是:" + Convert.ToString(dt.Rows[i]["zbusername"]);                                                                       //所属资源
                            model.sfdh         = "1";
                            model.deleflag     = "0";
                            model.zhenduan     = Convert.ToString(dt.Rows[i]["bingzhong"]);//病种
                            model.stas         = "0";
                            model.zzystas      = "0";
                            model.lasttime     = dt.Rows[i]["teltime"] == DBNull.Value ? Convert.ToDateTime(dt.Rows[i]["pubtime"]) : Convert.ToDateTime(dt.Rows[i]["teltime"]);
                            model.flagbumen    = name + "部门";
                            model.xcbumen      = "宣传四";
                            model.kfbumen      = "宣传四";
                            model.bianyuan     = "0";
                            model.urltext      = null;
                            model.bqname       = null;
                            model.byname       = Convert.ToString(dt.Rows[i]["username"]);
                            model.byphone      = Convert.ToString(dt.Rows[i]["tel2"]);
                            model.zydate       = Convert.ToDateTime(dt.Rows[i]["pubtime"]);
                            model.strurl       = "没有网址";
                            model.hotflag      = "";
                            model.menzhenname  = Convert.ToString(dt.Rows[i]["username2"]);
                            model.menzhenphone = Convert.ToString(dt.Rows[i]["tel2"]);
                            model.kefuname     = Convert.ToString(dt.Rows[i]["username"]);
                            model.kefuphone    = Convert.ToString(dt.Rows[i]["tel"]);
                            model.memo2        = Convert.ToString(dt.Rows[i]["juage3"]);
                            model.flag2        = "0";
                            model.jdflag       = "0";
                            model.xcname       = null;
                            model.baobei       = Convert.ToDateTime("1987-06-19 00:00:00.000");
                            bll.Add(model);
                            total++;
                            gettotal(total);
                        }
                        //rich.AppendText(string.Format("{2}年-{0}月数据:{1}条", m.ToString(), count.ToString(), y.ToString()) + "分配给" + name + "" + num + "条分配语句:\n" + sqlfenye+ temp1 + "\n");
                        rich.AppendText(string.Format("{2}年-{0}月数据:{1}条", m.ToString(), count.ToString(), y.ToString()) + "分配给" + name + "" + num + "\n");
                        rich.ForeColor = System.Drawing.Color.Green;//设置字体颜色
                        rich.Focus();
                    }
                    form.Close();
                }
            }
            // 停止计时
            sw.Stop();
        }