コード例 #1
0
        public static IMongoQuery ExpressionQueryBuilder(Interface.APIExpression expression)
        {
            IMongoQuery             mQuery            = null;
            List <SelectExpression> selectExpressions = expression.Expressions.ToList();

            selectExpressions.Where(s => s.GroupID == 1).OrderBy(o => o.ExpressionOrder).ToList();

            SelectExpressionGroupType groupType = SelectExpressionGroupType.AND;

            if (selectExpressions.Count > 0)
            {
                IList <IMongoQuery> queries = new List <IMongoQuery>();
                for (int i = 0; i < selectExpressions.Count; i++)
                {
                    groupType = selectExpressions[0].NextExpressionType;

                    IMongoQuery query = SelectExpressionHelper.ApplyQueryOperators(selectExpressions[i].Type, selectExpressions[i].FieldName, selectExpressions[i].Value);
                    if (query != null)
                    {
                        queries.Add(query);
                    }
                }

                mQuery = SelectExpressionHelper.BuildQuery(groupType, queries);
            }
            return(mQuery);
        }
コード例 #2
0
 public Tuple <string, IEnumerable <object> > Select(Interface.APIExpression expression)
 {
     try
     {
         throw new NotImplementedException();
         // code here //
     }
     catch (Exception) { throw; }
 }
コード例 #3
0
        public Tuple <string, IEnumerable <object> > Select(Interface.APIExpression expression)
        {
            IMongoQuery   mQuery   = null;
            List <object> patViews = new List <object>();

            List <SelectExpression> selectExpressions = expression.Expressions.ToList();

            selectExpressions.Where(s => s.GroupID == 1).OrderBy(o => o.ExpressionOrder).ToList();

            SelectExpressionGroupType groupType = SelectExpressionGroupType.AND;

            if (selectExpressions.Count > 0)
            {
                IList <IMongoQuery> queries = new List <IMongoQuery>();
                for (int i = 0; i < selectExpressions.Count; i++)
                {
                    groupType = selectExpressions[0].NextExpressionType;

                    IMongoQuery query = SelectExpressionHelper.ApplyQueryOperators(selectExpressions[i].Type, selectExpressions[i].FieldName, selectExpressions[i].Value);
                    if (query != null)
                    {
                        queries.Add(query);
                    }
                }

                mQuery = SelectExpressionHelper.BuildQuery(groupType, queries);
            }

            using (PatientMongoContext ctx = new PatientMongoContext(_dbName))
            {
                List <MECohortPatientView> cpvs = ctx.CohortPatientViews.Collection.Find(mQuery).ToList();

                if (cpvs != null)
                {
                    cpvs.ForEach(cpv =>
                    {
                        patViews.Add(new CohortPatientViewData
                        {
                            Id           = cpv.Id.ToString(),
                            LastName     = cpv.LastName,
                            PatientID    = cpv.PatientID.ToString(),
                            SearchFields = PatientsUtils.GetSearchFields(cpv.SearchFields),
                            Version      = cpv.Version
                        });
                    });
                }
            }

            return(new Tuple <string, IEnumerable <object> >(expression.ExpressionID, patViews));
        }
コード例 #4
0
        public Tuple <string, IEnumerable <object> > Select(Interface.APIExpression expression)
        {
            try
            {
                IMongoQuery   mQuery = null;
                List <object> pAtts  = new List <object>();

                mQuery = MongoDataUtil.ExpressionQueryBuilder(expression);

                using (ProgramMongoContext ctx = new ProgramMongoContext(_dbName))
                {
                    // check to see which properties from planelement we need.
                    List <MEProgramAttribute> pa = ctx.ProgramAttributes.Collection.Find(mQuery).ToList();

                    if (pa != null)
                    {
                        pa.ForEach(cp => pAtts.Add(new ProgramAttributeData
                        {
                            Id = cp.Id.ToString(),
                            DidNotEnrollReason = cp.DidNotEnrollReason,
                            //DisEnrollReason = cp.DisEnrollReason,
                            Eligibility = (int)cp.Eligibility,
                            //EligibilityEndDate = cp.EligibilityEndDate,
                            //EligibilityOverride = (int)cp.EligibilityOverride,
                            //EligibilityRequirements = cp.EligibilityRequirements,
                            //EligibilityStartDate = cp.EligibilityStartDate,
                            //  AttrEndDate = cp.EndDate, , Sprint 12
                            Enrollment       = (int)cp.Enrollment,
                            GraduatedFlag    = (int)cp.GraduatedFlag,
                            IneligibleReason = cp.IneligibleReason,
                            Locked           = (int)cp.Locked,
                            OptOut           = cp.OptOut,
                            //OptOutDate = cp.OptOutDate,
                            //OptOutReason = cp.OptOutReason,
                            OverrideReason = cp.OverrideReason,
                            PlanElementId  = cp.PlanElementId.ToString(),
                            Population     = cp.Population,
                            RemovedReason  = cp.RemovedReason,
                            Status         = (int)cp.Status
                        }));
                    }
                }

                return(new Tuple <string, IEnumerable <object> >(expression.ExpressionID, pAtts));
            }
            catch (Exception ex)
            {
                throw new Exception("DD:PatientProgramAttributeRepository:Select()::" + ex.Message, ex.InnerException);
            }
        }
コード例 #5
0
        public Tuple <string, IEnumerable <object> > Select(Interface.APIExpression expression)
        {
            try
            {
                IMongoQuery   mQuery = null;
                List <object> rps;

                mQuery = MongoDataUtil.ExpressionQueryBuilder(expression);

                using (ProgramMongoContext ctx = new ProgramMongoContext(_dbName))
                {
                    rps = ctx.Responses.Collection.Find(mQuery).ToList <object>();
                }

                return(new Tuple <string, IEnumerable <object> >(expression.ExpressionID, rps));
            }
            catch (Exception ex)
            {
                throw new Exception("DD:ResponseRepository:Select()::" + ex.Message, ex.InnerException);
            }
        }
コード例 #6
0
 public Tuple <string, IEnumerable <object> > Select(Interface.APIExpression expression)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
        public Tuple <string, IEnumerable <object> > Select(Interface.APIExpression expression)
        {
            try
            {
                IMongoQuery   mQuery  = null;
                List <object> patList = new List <object>();

                List <SelectExpression> selectExpressions = expression.Expressions.ToList();
                selectExpressions.Where(s => s.GroupID == 1).OrderBy(o => o.ExpressionOrder).ToList();

                SelectExpressionGroupType groupType = SelectExpressionGroupType.AND;

                if (selectExpressions.Count > 0)
                {
                    IList <IMongoQuery> queries = new List <IMongoQuery>();
                    for (int i = 0; i < selectExpressions.Count; i++)
                    {
                        groupType = selectExpressions[0].NextExpressionType;

                        IMongoQuery query = SelectExpressionHelper.ApplyQueryOperators(selectExpressions[i].Type, selectExpressions[i].FieldName, selectExpressions[i].Value);
                        if (query != null)
                        {
                            queries.Add(query);
                        }
                    }

                    mQuery = SelectExpressionHelper.BuildQuery(groupType, queries);
                }

                using (ProgramMongoContext ctx = new ProgramMongoContext(_dbName))
                {
                    //var findcp = Query<MEPatientProgram>.EQ(b => b.Id, ObjectId.Parse(request.PatientProgramId));
                    //MEPatientProgram cp = ctx.PatientPrograms.Collection.Find(findcp).FirstOrDefault();
                    List <MEPatientProgram> cps = ctx.PatientPrograms.Collection.Find(mQuery).ToList();

                    if (cps != null)
                    {
                        cps.ForEach(cp => patList.Add(new ProgramDetail
                        {
                            Id                = cp.Id.ToString(),
                            Client            = cp.Client != null ? cp.Client.ToString() : null,
                            ContractProgramId = cp.ContractProgramId.ToString(),
                            Description       = cp.Description,
                            EndDate           = cp.EndDate,
                            AssignBy          = cp.AssignedBy.ToString(),
                            AssignDate        = cp.AssignedOn,
                            Completed         = cp.Completed,
                            CompletedBy       = cp.CompletedBy,
                            DateCompleted     = cp.DateCompleted,
                            ElementState      = (int)cp.State,
                            StateUpdatedOn    = cp.StateUpdatedOn,
                            Enabled           = cp.Enabled,
                            Next              = cp.Next != null ? cp.Next.ToString() : string.Empty,
                            Order             = cp.Order,
                            Previous          = cp.Previous != null ? cp.Previous.ToString() : string.Empty,
                            SourceId          = cp.SourceId.ToString(),
                            SpawnElement      = DTOUtils.GetResponseSpawnElement(cp.Spawn),
                            Modules           = DTOUtils.GetModules(cp.Modules, _dbName, this.UserId),
                            Name              = cp.Name,
                            PatientId         = cp.PatientId.ToString(),
                            // ProgramState = (int)cp.ProgramState, depricated - Use Element state instead.
                            ShortName = cp.ShortName,
                            StartDate = cp.StartDate,
                            Status    = (int)cp.Status,
                            Version   = cp.Version
                        }));
                    }
                }

                return(new Tuple <string, IEnumerable <object> >(expression.ExpressionID, patList));
            }
            catch (Exception ex)
            {
                throw new Exception("DD:PatientProgramRepository:Select()::" + ex.Message, ex.InnerException);
            }
        }