public GetPatientProblemsSummaryResponse GetPatientProblemList(GetPatientProblemsSummaryRequest request) { try { GetPatientProblemsSummaryResponse result = new GetPatientProblemsSummaryResponse(); IPatientObservationRepository oRepo = Factory.GetRepository(request, RepositoryType.Observation); IPatientObservationRepository repo = Factory.GetRepository(request, RepositoryType.PatientObservation); // 1) get all observationIds that are of type problem that are active. List <ObservationData> oData = (List <ObservationData>)oRepo.GetObservationsByType("533d8278d433231deccaa62d", null, null); List <string> oIds = oData.Select(i => i.Id).ToList(); // 2) find all current patientobservations within these observationids. List <PatientObservationData> ol = ((MongoPatientObservationRepository)repo).GetAllPatientProblems(request, oIds) as List <PatientObservationData>; result.PatientObservations = ol; return(result); } catch (Exception ex) { throw new Exception("DD.DataPatientObservationManager:GetPatientObservationList()::" + ex.Message, ex.InnerException); } }
public void GetPatientObservationList_Test() { GetPatientProblemsSummaryRequest request = new GetPatientProblemsSummaryRequest(); request.ContractNumber = "InHealth001"; request.Context = "NG"; request.PatientId = "5325db4cd6a4850adcbba8da"; request.Version = 1.0; new PatientObservationDataManager().GetPatientProblemList(request); }
public object GetAllPatientProblems(GetPatientProblemsSummaryRequest request, List <string> oidlist) { try { List <IMongoQuery> queries = new List <IMongoQuery>(); List <ObjectId> oidls = oidlist.Select(r => ObjectId.Parse(r)).ToList <ObjectId>(); queries.Add(Query.EQ(MEPatientObservation.PatientIdProperty, ObjectId.Parse(request.PatientId))); queries.Add(Query.EQ(MEPatientObservation.DeleteFlagProperty, false)); queries.Add(Query.EQ(MEPatientObservation.TTLDateProperty, BsonNull.Value)); queries.Add(Query.EQ(MEPatientObservation.ObservationStateProperty, (int)ObservationState.Active)); queries.Add(Query.In(MEPatientObservation.ObservationIdProperty, new BsonArray(oidls))); IMongoQuery mQuery = Query.And(queries); List <MEPatientObservation> meObservations = null; List <PatientObservationData> observationDataL = new List <PatientObservationData>(); using (PatientObservationMongoContext ctx = new PatientObservationMongoContext(_dbName)) { meObservations = ctx.PatientObservations.Collection.Find(mQuery).ToList(); if (meObservations != null && meObservations.Count > 0) { foreach (MEPatientObservation mePO in meObservations) { IdNamePair oDetails = GetObservationDetails(mePO.ObservationId); PatientObservationData data = new PatientObservationData { Id = mePO.Id.ToString(), ObservationId = mePO.ObservationId.ToString(), DisplayId = (int)mePO.Display, Name = oDetails == null ? null : oDetails.Name, TypeId = oDetails == null ? null : oDetails.Id, StateId = (int)mePO.State, PatientId = request.PatientId, StartDate = mePO.StartDate, EndDate = mePO.EndDate, Source = mePO.Source, DataSource = mePO.DataSource, ExternalRecordId = mePO.ExternalRecordId }; observationDataL.Add(data); } observationDataL = observationDataL.OrderBy(o => o.Name).ToList(); } } return(observationDataL as object); } catch (Exception ex) { throw new Exception("PatientObservationDD:MongoPatientBarrierRepository:GetAllPatientProblems()::" + ex.Message, ex.InnerException); } }
public GetPatientProblemsSummaryResponse Get(GetPatientProblemsSummaryRequest request) { GetPatientProblemsSummaryResponse response = new GetPatientProblemsSummaryResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientObservationDD:Post()::Unauthorized Access"); } response = Omgr.GetPatientProblemList(request); response.Version = request.Version; } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Common.Helper.LogException(int.Parse(aseProcessID), ex); } return(response); }