Ejemplo n.º 1
0
        /// <summary>
        /// 更新ボタン
        /// </summary>
        private void Btn_DgvUpdate_Click(object sender, EventArgs e)
        {
            if (ShowResultDialog("更新を行ってよろしいですか?"))
            {
                List <Report> tmplistRep = new List <Report>();

                for (int i = 0; i < Dgv_InspectionResult.Rows.Count; i++)
                {
                    if (Dgv_InspectionResult.Rows[i].Cells[24].Value == "D")
                    {
                        continue;
                    }

                    Report rep = new Report();

                    if (Dgv_InspectionResult.Rows[i].Cells[0].Value != null)
                    {
                        rep.PayFlg = Convert.ToInt32(Dgv_InspectionResult.Rows[i].Cells[0].Value);
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[1].Value != null)
                    {
                        rep.ClaimFlg = Convert.ToInt32(Dgv_InspectionResult.Rows[i].Cells[1].Value);
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[4].Value != null)
                    {
                        rep.PatID = Dgv_InspectionResult.Rows[i].Cells[4].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[5].Value != null)
                    {
                        rep.PatName = Dgv_InspectionResult.Rows[i].Cells[5].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[6].Value != null)
                    {
                        rep.StudyDate = Dgv_InspectionResult.Rows[i].Cells[6].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[7].Value != null)
                    {
                        rep.Modality = Dgv_InspectionResult.Rows[i].Cells[7].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[8].Value != null)
                    {
                        rep.Accept = Dgv_InspectionResult.Rows[i].Cells[8].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[9].Value != null)
                    {
                        rep.BodyPart = Dgv_InspectionResult.Rows[i].Cells[9].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[10].Value != null)
                    {
                        rep.AddMGFlg = Convert.ToInt32(Dgv_InspectionResult.Rows[i].Cells[10].Value);
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[11].Value != null)
                    {
                        rep.ReadDate = Dgv_InspectionResult.Rows[i].Cells[11].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[12].Value != null)
                    {
                        rep.ReadCd = Dgv_InspectionResult.Rows[i].Cells[12].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[13].Value != null)
                    {
                        rep.BodyPartFlg = Convert.ToInt32(Dgv_InspectionResult.Rows[i].Cells[13].Value);
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[14].Value != null)
                    {
                        rep.PriorityFlg = Convert.ToInt32(Dgv_InspectionResult.Rows[i].Cells[14].Value);
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[15].Value != null)
                    {
                        rep.ImageCnt = Convert.ToInt32(Dgv_InspectionResult.Rows[i].Cells[15].Value);
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[16].Value != null)
                    {
                        rep.AddImageFlg = Convert.ToInt32(Dgv_InspectionResult.Rows[i].Cells[16].Value);
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[17].Value != null)
                    {
                        rep.MailFlg = Convert.ToInt32(Dgv_InspectionResult.Rows[i].Cells[17].Value);
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[18].Value != null)
                    {
                        rep.Contact = Dgv_InspectionResult.Rows[i].Cells[18].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[19].Value != null)
                    {
                        rep.OrderDetail = Dgv_InspectionResult.Rows[i].Cells[19].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[20].Value != null)
                    {
                        rep.Memo = Dgv_InspectionResult.Rows[i].Cells[20].Value.ToString();
                    }
                    rep.OrderNo = Dgv_InspectionResult.Rows[i].Cells[21].Value.ToString();
                    rep.HCd     = GetDBCd(Dgv_InspectionResult.Rows[i].Cells[22].Value.ToString());
                    if (Dgv_InspectionResult.Rows[i].Cells[23].Value != null)
                    {
                        rep.PhysicianName = Dgv_InspectionResult.Rows[i].Cells[23].Value.ToString();
                    }
                    if (Dgv_InspectionResult.Rows[i].Cells[26].Value != null)
                    {
                        rep.Department = Dgv_InspectionResult.Rows[i].Cells[26].Value.ToString();
                    }

                    if (rep.ReadCd == "テストオーダー")
                    {
                        rep.PayFlg   = 0;
                        rep.ClaimFlg = 0;
                    }

                    tmplistRep.Add(rep);
                }
                IF_Service service = new IF_Service();

                service.DelReport(HospCd, listRep.ToArray());

                if (service.SetReport(HospCd, tmplistRep.ToArray()))
                {
                    var end = dateTimePicker1.Value.ToString("yyyyMMdd");

                    LogUtil.Info(form_menu.form_login.UserRet.Name + " " + HospCd + " " + end + "  レポートデータ更新");
                    MessageBox.Show("レポートデータの更新が完了いたしました。", "完了", MessageBoxButtons.OK);
                    confirmationExit = true;
                    Btn_Search_Click(sender, e);
                }
                else
                {
                    MessageBox.Show("レポートデータの更新に失敗いたしました。", "エラー", MessageBoxButtons.OK);
                }
            }
        }
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)
            {
            }
        }