Ejemplo n.º 1
0
        private string GetTargetReport_Child(HospDistMst Hosp)
        {
            IF_Service service = new IF_Service();

            ExtReports hospRep = new ExtReports();

            hospRep.Cd = Hosp.Hospital.Cd;

            List <ModReports> modLists = new List <ModReports>();

            var dispCd     = "";
            var childWhere = "";

            foreach (var mst in HospDistMsts)
            {
                if (mst.Hosp == null)
                {
                    continue;
                }

                foreach (var hos in mst.Hosp)
                {
                    if (hos.Target == Hosp.Hospital.Cd)
                    {
                        dispCd      = mst.Hospital.Name_DB;
                        childWhere += " AND " + hos.Where;
                    }
                }
            }

            foreach (var mod in ModalityList)
            {
                ModReports tmpReps = new ModReports();
                tmpReps.Mod = mod.Value;

                string modWhere = "";
                modWhere += " Modality = '" + mod.Key + "'";

                if (Hosp.Sheet != null)
                {
                    var isData = false;
                    foreach (var sheet in Hosp.Sheet)
                    {
                        if (sheet.Sum == mod.Key)
                        {
                            modWhere += " OR ( Modality = '" + sheet.Target + "'";
                            modWhere += " AND " + sheet.Where + ")";
                            isData    = true;
                        }
                    }
                    if (isData)
                    {
                        modWhere = " AND (" + modWhere + ")";
                    }
                    else
                    {
                        modWhere = " AND " + modWhere;
                    }

                    foreach (var sheet in Hosp.Sheet)
                    {
                        if (sheet.Target == mod.Key)
                        {
                            modWhere += " AND NOT " + sheet.Where;
                        }
                    }
                }
                else
                {
                    modWhere = " AND " + modWhere;
                }

                if (Hosp.Hosp != null)
                {
                    foreach (var mst in Hosp.Hosp)
                    {
                        modWhere += " AND NOT " + mst.Where;
                    }
                }

                tmpReps.Reports = service.GetReport(dispCd, start, end, childWhere + modWhere);

                if (tmpReps.Reports != null)
                {
                    tmpReps.Count  = tmpReps.Reports.Length;
                    hospRep.Count += tmpReps.Reports.Length;
                    modLists.Add(tmpReps);
                }
            }

            hospRep.ModReports = modLists.ToArray();

            HospReports.Add(hospRep);

            return(dispCd);
        }
Ejemplo n.º 2
0
        //ここから------------------------------------------------ボタンクリック処理-----------------------------------------------
        /// <summary>
        /// 検索ボタン
        /// </summary>
        private void Btn_Search_Click(object sender, EventArgs e)
        {
            confirmationExit = true;
            Dgv_InspectionResult.Rows.Clear();
            lblCnt.Text = "";

            IF_Service service = new IF_Service();
            var        start   = Dtp_SearchDate.Value.ToString("yyyyMMdd");
            var        end     = dateTimePicker1.Value.ToString("yyyyMMdd");
            var        cd      = Cmb_Facility.SelectedValue.ToString();

            var dispCd = "";

            foreach (var hosp in RetHospList)
            {
                if (hosp.Cd == cd)
                {
                    dispCd = hosp.Name_DB;
                    break;
                }
            }

            HospCd = dispCd;

            Report[] retRep = null;
            //service.GetReport(dispCd, start, end, "");
            Report[] retHisRep = null;
            //= service.GetReportHist(dispCd, start, end, "");
            listRep    = new List <Report>();
            listHisRep = new List <Report>();
            //if (retRep != null)
            //    listRep.AddRange(retRep);
            //if (listHisRep != null)
            //    listHisRep.AddRange(retRep);

            var where = "";
            var mywhere = "";

            if (cd == "SYSTEM")
            {
                mywhere += " AND hcd IN (";

                var wh = "";

                foreach (var hosp in RetHospList)
                {
                    if (SysList.Contains(hosp.Cd))
                    {
                        if (!string.IsNullOrEmpty(wh))
                        {
                            wh += ",";
                        }

                        wh += "'";
                        wh += hosp.Name_DB;
                        wh += "'";
                    }
                }

                mywhere += wh;
                mywhere += ") ";
                dispCd   = "";
            }
            else if (cd == "OTHER")
            {
                mywhere += " AND hcd IN (";

                var wh = "";

                foreach (var hosp in RetHospList)
                {
                    if (!SysList.Contains(hosp.Cd))
                    {
                        if (!string.IsNullOrEmpty(wh))
                        {
                            wh += ",";
                        }

                        wh += "'";
                        wh += hosp.Name_DB;
                        wh += "'";
                    }
                }

                mywhere += wh;

                mywhere += ") ";
                dispCd   = "";
            }
            else
            {
                foreach (var hosp in RetHospList)
                {
                    if (HospMst.Keys.Contains(hosp.Name_DB))
                    {
                        foreach (var mst in HospMst[hosp.Name_DB])
                        {
                            if (mst.Target == cd)
                            {
                                where += " AND " + mst.Where;
                            }
                            else if (hosp.Name_DB == dispCd)
                            {
                                mywhere += " AND NOT " + mst.Where;
                            }
                        }

                        if (!string.IsNullOrEmpty(where))
                        {
                            if (!string.IsNullOrEmpty(SearchMod.SelectedValue.ToString()))
                            {
                                where += " AND Modality='" + SearchMod.SelectedValue.ToString() + "'";
                            }
                            if (!string.IsNullOrEmpty(SearchDoc.SelectedValue.ToString()))
                            {
                                where += " AND ReadCd='" + SearchDoc.SelectedValue.ToString() + "'";
                            }
                            Report[] tmp = service.GetReport(hosp.Name_DB, start, end, where);
                            if (tmp != null)
                            {
                                foreach (var t in tmp)
                                {
                                    if (string.IsNullOrEmpty(GetHospCd(t.HCd)))
                                    {
                                        continue;
                                    }
                                    listRep.Add(t);
                                }
                            }
                            tmp = service.GetReportHist(hosp.Name_DB, start, end, where);
                            if (tmp != null)
                            {
                                foreach (var t in tmp)
                                {
                                    if (string.IsNullOrEmpty(GetHospCd(t.HCd)))
                                    {
                                        continue;
                                    }
                                    listHisRep.Add(t);
                                }
                            }
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(SearchMod.SelectedValue.ToString()))
            {
                mywhere += " AND Modality='" + SearchMod.SelectedValue.ToString() + "'";
            }
            if (!string.IsNullOrEmpty(SearchDoc.SelectedValue.ToString()))
            {
                mywhere += " AND ReadCd='" + SearchDoc.SelectedValue.ToString() + "'";
            }

            retRep    = service.GetReport(dispCd, start, end, mywhere);
            retHisRep = service.GetReportHist(dispCd, start, end, mywhere);
            if (retRep != null)
            {
                foreach (var t in retRep)
                {
                    if (string.IsNullOrEmpty(GetHospCd(t.HCd)))
                    {
                        continue;
                    }
                    listRep.Add(t);
                }
            }
            if (retHisRep != null)
            {
                foreach (var t in retHisRep)
                {
                    if (string.IsNullOrEmpty(GetHospCd(t.HCd)))
                    {
                        continue;
                    }
                    listHisRep.Add(t);
                }
            }

            for (int i = 0; i < listRep.Count; i++)
            {
                Dgv_InspectionResult.Rows.Add();
                Dgv_InspectionResult.Rows[i].Cells[0].Value  = listRep[i].PayFlg;
                Dgv_InspectionResult.Rows[i].Cells[1].Value  = listRep[i].ClaimFlg;
                Dgv_InspectionResult.Rows[i].Cells[4].Value  = listRep[i].PatID;
                Dgv_InspectionResult.Rows[i].Cells[5].Value  = listRep[i].PatName;
                Dgv_InspectionResult.Rows[i].Cells[6].Value  = listRep[i].StudyDate;
                Dgv_InspectionResult.Rows[i].Cells[7].Value  = listRep[i].Modality;
                Dgv_InspectionResult.Rows[i].Cells[8].Value  = listRep[i].Accept;
                Dgv_InspectionResult.Rows[i].Cells[9].Value  = listRep[i].BodyPart;
                Dgv_InspectionResult.Rows[i].Cells[10].Value = listRep[i].AddMGFlg;
                Dgv_InspectionResult.Rows[i].Cells[11].Value = listRep[i].ReadDate;

                var isDoc = false;
                foreach (var doc in RetdocList)
                {
                    if (doc.Name == listRep[i].ReadCd)
                    {
                        Dgv_InspectionResult.Rows[i].Cells[12].Value = listRep[i].ReadCd;
                        isDoc = true;
                        break;
                    }
                }

                if (!isDoc)
                {
                    Dgv_InspectionResult.Rows[i].Cells[0].Value = false;
                    Dgv_InspectionResult.Rows[i].Cells[1].Value = false;
                }

                Dgv_InspectionResult.Rows[i].Cells[13].Value = listRep[i].BodyPartFlg;
                Dgv_InspectionResult.Rows[i].Cells[14].Value = listRep[i].PriorityFlg;
                Dgv_InspectionResult.Rows[i].Cells[15].Value = listRep[i].ImageCnt;
                Dgv_InspectionResult.Rows[i].Cells[16].Value = listRep[i].AddImageFlg;
                Dgv_InspectionResult.Rows[i].Cells[17].Value = listRep[i].MailFlg;
                Dgv_InspectionResult.Rows[i].Cells[18].Value = listRep[i].Contact;
                Dgv_InspectionResult.Rows[i].Cells[19].Value = listRep[i].OrderDetail;
                Dgv_InspectionResult.Rows[i].Cells[20].Value = listRep[i].Memo;
                Dgv_InspectionResult.Rows[i].Cells[21].Value = listRep[i].OrderNo;
                Dgv_InspectionResult.Rows[i].Cells[22].Value = GetHospCd(listRep[i].HCd);
                Dgv_InspectionResult.Rows[i].Cells[23].Value = listRep[i].PhysicianName;
                Dgv_InspectionResult.Rows[i].Cells[26].Value = listRep[i].Department;

                if (listRep[i].OrderNo.IndexOf("_C") > 0)
                {
                    Dgv_InspectionResult.Rows[i].DefaultCellStyle.BackColor = Color.LimeGreen;
                }
            }

            CheckData();

            lblCnt.Text = listRep.Count + " 件";
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   レポートデータ取得(親施設)
        /// </summary>
        /// <param name="Hosp"></param>
        private void GetTargetReport(HospDistMst Hosp)
        {
            IF_Service service = new IF_Service();

            ExtReports hospRep = new ExtReports();

            hospRep.Cd = Hosp.Hospital.Cd;

            List <ModReports> modLists = new List <ModReports>();

            foreach (var mod in ModalityList)
            {
                ModReports tmpReps = new ModReports();
                tmpReps.Mod = mod.Value;


                string modWhere = "";
                modWhere += " Modality = '" + mod.Key + "'";

                if (Hosp.Sheet != null)
                {
                    var isData = false;
                    foreach (var sheet in Hosp.Sheet)
                    {
                        if (sheet.Sum == mod.Key)
                        {
                            modWhere      += " OR ( Modality = '" + sheet.Target + "'";
                            modWhere      += " AND " + sheet.Where + ")";
                            tmpReps.DocMod = sheet.DocMod;

                            isData = true;
                        }
                    }
                    if (isData)
                    {
                        modWhere = " AND (" + modWhere + ")";
                    }
                    else
                    {
                        modWhere = " AND " + modWhere;
                    }

                    foreach (var sheet in Hosp.Sheet)
                    {
                        if (sheet.Target == mod.Key)
                        {
                            modWhere += " AND NOT " + sheet.Where;
                        }
                    }
                }
                else
                {
                    modWhere = " AND " + modWhere;
                }

                if (Hosp.Hosp != null)
                {
                    foreach (var mst in Hosp.Hosp)
                    {
                        modWhere += " AND NOT " + mst.Where;
                    }
                }

                tmpReps.Reports = service.GetReport(Hosp.Hospital.Name_DB, start, end, modWhere);

                if (tmpReps.Reports != null)
                {
                    tmpReps.Count  = tmpReps.Reports.Length;
                    hospRep.Count += tmpReps.Reports.Length;
                    modLists.Add(tmpReps);
                }
            }

            hospRep.ModReports = modLists.ToArray();

            HospReports.Add(hospRep);
        }