public object Search(object request) { int result = 0; GetPatientMedSuppsCountDataRequest dataRequest = (GetPatientMedSuppsCountDataRequest)request; try { using (MedicationMongoContext ctx = new MedicationMongoContext(ContractDBName)) { List <IMongoQuery> queries = new List <IMongoQuery>(); if (string.IsNullOrEmpty(dataRequest.Name)) { queries.Add(Query.EQ(MEPatientMedSupp.NameProperty, BsonNull.Value)); } else { queries.Add(Query.EQ(MEPatientMedSupp.NameProperty, dataRequest.Name)); } if (string.IsNullOrEmpty(dataRequest.Route)) { queries.Add(Query.EQ(MEPatientMedSupp.RouteProperty, BsonNull.Value)); } else { queries.Add(Query.EQ(MEPatientMedSupp.RouteProperty, dataRequest.Route)); } if (string.IsNullOrEmpty(dataRequest.Form)) { queries.Add(Query.EQ(MEPatientMedSupp.FormProperty, BsonNull.Value)); } else { queries.Add(Query.EQ(MEPatientMedSupp.FormProperty, dataRequest.Form)); } if (string.IsNullOrEmpty(dataRequest.Strength)) { queries.Add(Query.EQ(MEPatientMedSupp.StrengthProperty, BsonNull.Value)); } else { queries.Add(Query.EQ(MEPatientMedSupp.StrengthProperty, dataRequest.Strength)); } queries.Add(Query.EQ(MEPatientMedSupp.DeleteFlagProperty, false)); queries.Add(Query.EQ(MEPatientMedSupp.TTLDateProperty, BsonNull.Value)); IMongoQuery mQuery = Query.And(queries); List <MEPatientMedSupp> list = ctx.PatientMedSupps.Collection.Find(mQuery).SetFields(MEPatientMedSupp.PatientIdProperty).ToList(); result = list.Select(s => s.PatientId).Distinct().Count(); } return(result); } catch (Exception) { throw; } }
public int GetPatientMedSuppsCount(GetPatientMedSuppsCountDataRequest request) { try { int count = 0; { var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp); count = (int)repo.Search(request); } return(count); } catch (Exception ex) { throw ex; } }
public GetPatientMedSuppsCountDataResponse Get(GetPatientMedSuppsCountDataRequest request) { var response = new GetPatientMedSuppsCountDataResponse { Version = request.Version }; try { RequireUserId(request); response.PatientCount = Manager.GetPatientMedSuppsCount(request); } catch (Exception ex) { RaiseException(response, ex); } return(response); }
public int GetPatientMedSuppsCount(GetPatientMedSuppsCountDataRequest request) { throw new NotImplementedException(); }