Beispiel #1
0
        public List <ImagingResult> ByXrayResultList(string hn, DateTime dateStart, DateTime dateEnd)
        {
            try
            {
                using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                {
                    using (InhCheckupDataContext contxt = new InhCheckupDataContext())
                    {
                        //dateStart = "1-Dec-2017";
                        //string iDate = "01/12/2017";
                        //DateTime oDate = Convert.ToDateTime(iDate);
                        //var RawMateWS = ws.GetXrayResultList_XrayResult(hn, oDate.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"), "").AsEnumerable();
                        var RawMateWS = ws.GetXrayResultList_XrayResult(hn, dateStart.ToString("yyyy-MM-dd"), dateEnd.ToString("yyyy-MM-dd"), "").AsEnumerable();

                        var RawMateFirstOnGrp = RawMateWS.GroupBy(x => new { en = x.Field <string>("PAADMADMNo"), order = x.Field <string>("ARCIMRowId") })
                                                .Select(x => x.OrderByDescending(y => y.Field <string>("ChildID")).FirstOrDefault())
                                                .ToList();

                        List <ImagingResult> results = (from mate in RawMateFirstOnGrp
                                                        join mst in contxt.mst_order_plans
                                                        on mate.Field <string>("ARCIMRowId") equals mst.mop_item_row_id
                                                        select new ImagingResult
                        {
                            hn_no = mate.Field <string>("PAPMINo"),
                            en_no = mate.Field <string>("PAADMADMNo"),
                            mvt_id = mst.mvt_id,
                            mvt_code = mst.mst_event.mvt_code,
                            OEORISttDat = mate.Field <DateTime?>("OEORISttDat"),
                            OEORITimeOrd = mate.Field <TimeSpan?>("OEORITimeOrd"),
                            ARCIMCode = mate.Field <string>("ARCIMCode"),
                            ARCIMDesc = mate.Field <string>("ARCIMDesc"),
                            ARCIMRowId = mate.Field <string>("ARCIMRowId"),
                            ChildID = mate.Field <string>("ChildID"),
                            PathHTML = mate.Field <string>("PathHTML"),
                            ReportBy = mate.Field <string>("ReportBy"),
                            ReportDate = mate.Field <string>("ReportDate"),
                            RequestDate = mate.Field <string>("RequestDate"),
                            RESDateVerified = mate.Field <DateTime?>("RESDateVerified"),
                            RESTimeVerified = mate.Field <TimeSpan?>("RESTimeVerified"),
                            RESFileName = mate.Field <string>("RESFileName"),
                            Result1 = mate.Field <string>("Result1"),
                            Result2 = mate.Field <string>("Result2"),
                            SSUSR_Name = mate.Field <string>("SSUSRName"),
                            XrayType = mate.Field <string>("XrayType"),
                            LicenseNo = mate.Field <string>("LicenseNo"),
                            OEORIAccessionNumber = mate.Field <string>("OEORIAccessionNumber")
                        }).ToList();

                        if (results.Count > 0)
                        {
                            string DefaultFileType = Class.GetDBConfigCls.GetConfig("DefaultFileTypeXray");
                            string PathFileXray    = Class.GetDBConfigCls.GetConfig("PathFileXray");
                            string LinkPacSheet    = Class.GetDBConfigCls.GetConfig("LinkPacSheet");
                            string LinkPDF         = Class.GetDBConfigCls.GetConfig("LinkPDF");

                            var grpEvent = results.GroupBy(x => x.mvt_code).ToList();
                            foreach (var grp in grpEvent)
                            {
                                var grpList = grp.ToList();
                                switch (grp.Key)
                                {
                                case "XR":
                                    SetDataXray(ref grpList, LinkPacSheet, DefaultFileType, PathFileXray);
                                    break;

                                case "UU":
                                case "UL":
                                case "UB":
                                case "UW":
                                    SetDataUltrasound(ref grpList, LinkPacSheet, DefaultFileType, PathFileXray);
                                    break;

                                case "UG":
                                    SetDataUGI(ref grpList, LinkPacSheet, DefaultFileType, PathFileXray);
                                    break;

                                case "DM":
                                    SetDataMammogram(ref grpList, LinkPacSheet, DefaultFileType, PathFileXray);
                                    break;

                                case "BD":
                                    SetDataBMD(ref grpList, LinkPacSheet, DefaultFileType, PathFileXray);
                                    break;

                                case "CD":
                                    SetDataCarotid(ref grpList, DefaultFileType, PathFileXray);
                                    break;

                                case "ES":
                                case "EC":
                                case "EK":
                                    SetLink(ref grpList, LinkPDF);
                                    break;
                                }
                            }
                        }
                        return(results);
                    }
                }
            }
            catch (Exception ex)
            {
                Class.globalCls.MessageError("Webservice", "GetTextFileCls.GetResultXray", ex.Message);
                return(new List <ImagingResult>());
            }
        }