示例#1
0
        public static long?GetMax(this ResultInterpretation resultInterpretation, IEnumerable <long> resultInterpretations)
        {
            if (resultInterpretations == null || resultInterpretations.Count() < 1)
            {
                return(null);
            }

            if (resultInterpretations.Any(i => i == (long)ResultInterpretation.Critical))
            {
                return((long)ResultInterpretation.Critical);
            }

            if (resultInterpretations.Any(i => i == (long)ResultInterpretation.Urgent))
            {
                return((long)ResultInterpretation.Urgent);
            }

            if (resultInterpretations.Any(i => i == (long)ResultInterpretation.Abnormal))
            {
                return((long)ResultInterpretation.Abnormal);
            }

            return((long)ResultInterpretation.Normal);
        }
示例#2
0
        public IEnumerable <HospitalPartnerCustomer> GetHospitalPartnerCustomersByHospitalPartnerId(long hospitalPartnerId, ResultInterpretation resultInterpretation, int validityPeriod = 0)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entities = (from hpc in linqMetaData.VwHospitalPartnerCustomers
                                join ehp in linqMetaData.EventHospitalPartner on hpc.EventId equals ehp.EventId
                                join ecr in linqMetaData.EventCustomerResult on new { hpc.EventId, hpc.CustomerId } equals new { ecr.EventId, ecr.CustomerId }
                                join e in linqMetaData.Events on ecr.EventId equals e.EventId
                                where ehp.HospitalPartnerId == hospitalPartnerId &&
                                ecr.ResultSummary == (long)resultInterpretation &&
                                (validityPeriod < 1 || e.EventDate >= DateTime.Now.Date.AddDays(-1 * validityPeriod))
                                select hpc).ToArray();
                return(Mapper.Map <IEnumerable <VwHospitalPartnerCustomersEntity>, IEnumerable <HospitalPartnerCustomer> >(entities));
            }
        }
示例#3
0
        public IEnumerable <HospitalPartnerCustomer> GetHospitalFacilityCustomersByHospitalFacilityIdForCritical(long hospitalFacilityId, ResultInterpretation resultInterpretation, int validityPeriod = 0)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var criticalEventCustomerResultIds = (from ecr in linqMetaData.EventCustomerResult
                                                      join cest in linqMetaData.CustomerEventScreeningTests on ecr.EventCustomerResultId equals cest.EventCustomerResultId
                                                      join cect in linqMetaData.CustomerEventCriticalTestData on cest.CustomerEventScreeningTestId equals cect.CustomerEventScreeningTestId
                                                      where cect.CustomerEventScreeningTestId > 0 &&
                                                      (cect.IsActive.HasValue ? cect.IsActive.Value : true) &&
                                                      (ecr.ResultState <= (int)TestResultStateNumber.PreAudit)
                                                      select ecr.EventCustomerResultId);

                var entities = (from hpc in linqMetaData.VwHospitalPartnerCustomers
                                join ehf in linqMetaData.EventHospitalFacility on hpc.EventId equals ehf.EventId
                                join ecr in linqMetaData.EventCustomerResult on new { hpc.EventId, hpc.CustomerId } equals new { ecr.EventId, ecr.CustomerId }
                                join ec in linqMetaData.EventCustomers on ecr.EventCustomerResultId equals ec.EventCustomerId
                                join e in linqMetaData.Events on ecr.EventId equals e.EventId
                                where ehf.HospitalFacilityId == hospitalFacilityId && ec.HospitalFacilityId == hospitalFacilityId &&
                                (ecr.ResultSummary == (long)resultInterpretation || criticalEventCustomerResultIds.Contains(ecr.EventCustomerResultId)) &&
                                (validityPeriod < 1 || e.EventDate >= DateTime.Now.Date.AddDays(-1 * validityPeriod))
                                select hpc).ToArray();
                return(Mapper.Map <IEnumerable <VwHospitalPartnerCustomersEntity>, IEnumerable <HospitalPartnerCustomer> >(entities));
            }
        }