Ejemplo n.º 1
0
            /// <summary>
            /// Gets the cost quality hospitals.
            /// </summary>
            /// <param name="cqReportGen">The cq report gen.</param>
            /// <param name="hospitalIds">The hospital ids.</param>
            /// <param name="measureids">The measureids.</param>
            /// <returns></returns>
            public static IEnumerable <CostQualityHospital> GetCostQualityHospitals(CostQualityReportGenerator cqReportGen, string hospitalIds, string measureids)
            {
                CostQualityReportGenerator = cqReportGen;

                using (var session = CostQualityReportGenerator.DataServiceProvider.SessionFactory.OpenSession())
                {
                    //	var query = String.Format("SELECT MeasureId, HospitalId, CountyId, RegionId, ZipCode, HospitalType, '' as Value, NatRating, PeerRating FROM Temp_Quality WHERE HospitalId in ({0}) and MeasureId in ({1})", hospitalIds, measureids);
                    //	var result = session.CreateSQLQuery(query)
                    //	    .AddScalar("MeasureId", NHibernateUtil.Int32)
                    //	    .AddScalar("HospitalId", NHibernateUtil.Int32)
                    //	    .AddScalar("CountyId", NHibernateUtil.Int32)
                    //	    .AddScalar("RegionId", NHibernateUtil.Int32)
                    //	    .AddScalar("ZipCode", NHibernateUtil.String)
                    //	    .AddScalar("HospitalType", NHibernateUtil.String)
                    //	    .AddScalar("Value", NHibernateUtil.String)
                    //	    .AddScalar("NatRating", NHibernateUtil.String)
                    //	    .AddScalar("PeerRating", NHibernateUtil.String)
                    //	    .SetResultTransformer(new AliasToBeanResultTransformer(typeof(CostQualityHospital)))
                    //	    .List<CostQualityHospital>();


                    var result =
                        session.Query <TempQuality>()
                        .Where(tq =>
                               hospitalIds.Split(',').ToList().Contains(tq.HospitalId.Value.ToString()) &&
                               measureids.Split(',').ToList().Contains(tq.MeasureId.ToString()))
                        .Join(
                            session.Query <Measure>(),
                            tq => tq.MeasureId,
                            m => m.Id,
                            (tq, m) =>
                            new CostQualityHospital(tq, m))
                        //		{
                        //			MeasureId = tq.MeasureId,
                        //			HospitalId = tq.HospitalId.GetValueOrDefault(),
                        //			CountyId = tq.CountyId.GetValueOrDefault(),
                        //			RegionId = tq.RegionId.GetValueOrDefault(),
                        //			ZipCode = tq.ZipCode,
                        //			HospitalType = tq.HospitalType,
                        //			Value = "",
                        //			NatRating = tq.NatRating,
                        //			PeerRating = tq.PeerRating,
                        //			Rate = (m.MeasureCode.IsContainedIn("IQI 12", "IQI 14")) ? tq.RateAndCI : ""
                        //		})
                        .ToList();

                    return(result);
                }
            }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the cost quality measure descriptions.
 /// </summary>
 /// <param name="cqReportGen">The cq report gen.</param>
 /// <param name="hasAllAudiences">if set to <c>true</c> [has all audiences].</param>
 /// <param name="selectedMeasures">The selected measures.</param>
 /// <returns></returns>
 public static IEnumerable <CostQualityMeasureDescription> GetCostQualityMeasureDescriptions(CostQualityReportGenerator cqReportGen, bool hasAllAudiences, IList <Measure> selectedMeasures)
 {
     CostQualityReportGenerator = cqReportGen;
     using (session = CostQualityReportGenerator.DataServiceProvider.SessionFactory.OpenSession())
     {
         var measures =
             session.Query <Measure>()
             .Where(m => (m.SupportsCost || m.MeasureType == "CostQuality"))
             .DistinctBy(m => m.MeasureCode)
             //		.Select(x => GeneratetCostQualityMeasureDescription(x, hasAllAudiences))
             .ToList();
         return(measures
                .Where(m =>
         {
             return
             selectedMeasures.Select(sm => sm.Id).Contains(m.Id) &&
             IsCostQualityMeasureDataAvailable(m);
         })
                .Select(m => GeneratetCostQualityMeasureDescription(m, hasAllAudiences))
                .ToList());
     }
 }