Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            IF_Service serv = new IF_Service();

            string set     = "server=157.2.1.100;database=ProRadRSWebDB;uid=sa;pwd=tryfor;MultipleActiveResultSets=true";
            var    reports = serv.GetReport_Org("20170831", "20170831", set, "KHM");

            serv.GetHospital();
        }
Ejemplo n.º 2
0
        private void btn_Get_Click(object sender, EventArgs e)
        {
            string levelCode = ConfigurationManager.AppSettings["LevelCode"]; /*n次事業所コード*/

            try
            {
                IF_Service service = new IF_Service();

                var start    = dateTimePicker1.Value.ToString("yyyyMMdd");
                var end      = dateTimePicker2.Value.ToString("yyyyMMdd");
                var imgstart = dateTimePicker1.Value.AddMonths(-1).ToString("yyyy/MM/dd");
                var imgend   = dateTimePicker2.Value.ToString("yyyy/MM/dd");

                var setting = "";

                RetHospList = service.GetHospital().ToList();
                RetdocList  = service.GetDoctor().ToList();

                foreach (var conf in form_menu.SystemConfig)
                {
                    if ("RefDB_RS" == conf.Key)
                    {
                        setting = conf.Value;
                        break;
                    }
                }

                /*☆★↓↓↓2016/06/08 処理分岐用に事業所コード追加↓↓↓★☆*/
                //var reports = service.GetReport_Org(start, end, setting);
                var reports = service.GetReport_Org(start, end, setting, levelCode);
                /*☆★↑↑↑2016/06/08↑↑↑★☆*/

                var pro = "";
                foreach (var conf in form_menu.SystemConfig)
                {
                    if ("RefDB_PACS" == conf.Key)
                    {
                        setting = conf.Value;
                    }
                    if ("RefPro_PACS" == conf.Key)
                    {
                        pro = conf.Value;
                    }
                }

                var images = service.GetImageCnt_Org(imgstart, imgend, setting, pro);

                var noHos = "";
                var noDoc = "";

                List <Report> addData = new List <Report>();
                string        sHosp   = ConfigurationManager.AppSettings["ImageSpecial"];
                foreach (var rep in reports)
                {
                    if (sHosp.IndexOf(rep.HCd) < 0)
                    {
                        if (images != null)
                        {
                            foreach (var img in images)
                            {
                                if (rep.Modality == img.Modality &&
                                    img.PatID == rep.PatID &&
                                    img.StudyDate == rep.StudyDate)
                                {
                                    rep.ImageCnt = img.ImageCnt;
                                    break;
                                }
                            }
                        }
                    }

                    if (rep.ImageCnt > 0)
                    {
                        switch (rep.HCd)
                        {
                        case "ASE":
                            rep.AddImageFlg = rep.ImageCnt / 1000;

                            if (rep.ImageCnt - rep.AddImageFlg * 1000 == 0)
                            {
                                rep.AddImageFlg--;
                            }
                            break;

                        case "HKR":
                            if (rep.ImageCnt > 500)
                            {
                                rep.AddImageFlg = 1;
                            }
                            break;

                        default:
                            rep.AddImageFlg = rep.ImageCnt / 500;

                            if (rep.ImageCnt - rep.AddImageFlg * 500 == 0)
                            {
                                rep.AddImageFlg--;
                            }
                            break;
                        }
                    }

                    if (string.IsNullOrEmpty(GetHospCd(rep.HCd)))
                    {
                        if (noHos != "")
                        {
                            if (noHos.IndexOf(rep.HCd) < 0)
                            {
                                noHos += "," + rep.HCd;
                            }
                        }
                        else
                        {
                            noHos = rep.HCd;
                        }
                    }
                    if (string.IsNullOrEmpty(GetDocCd(rep.ReadCd)))
                    {
                        if (noDoc != "")
                        {
                            if (noDoc.IndexOf(rep.HCd) < 0)
                            {
                                noDoc += "," + rep.HCd;
                            }
                        }
                        else
                        {
                            noDoc = rep.HCd;
                        }

                        rep.PayFlg   = 0;
                        rep.ClaimFlg = 0;
                    }

                    var datas = service.GetReportOrderNos(rep.HCd, start, end).ToList();

                    if (!datas.Contains(rep.OrderNo))
                    {
                        addData.Add(rep);
                    }
                    //else
                    //    service.SetImageCnt(rep.HCd, rep);
                }

                if (!string.IsNullOrEmpty(noHos))
                {
                    MessageBox.Show("登録されていない施設が取り込まれています。\n\n" + noHos, "警告");
                }
                if (!string.IsNullOrEmpty(noDoc))
                {
                    MessageBox.Show("登録されていない読影医が記録されたオーダーが取り込まれています。\n\n" + noHos, "警告");
                }

                if (!service.SetReport("", addData.ToArray()))
                {
                    MessageBox.Show("取り込みに失敗いたしました。", "エラー", MessageBoxButtons.OK);
                }
                if (!service.SetReportHist("", addData.ToArray()))
                {
                    MessageBox.Show("取り込みに失敗いたしました。", "エラー", MessageBoxButtons.OK);
                }
                else
                {
                    LogUtil.Info(form_menu.form_login.UserRet.Name + " " + start + " " + end + "  サーバから取り込み");
                    MessageBox.Show("取り込みが完了いたしました。", "取り込み完了", MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
            }
        }