internal static void UpdateCohortPatientViewProblem(CohortPatientViewData cpvd, string patientId, IAppDomainRequest request) { try { double version = request.Version; string contractNumber = request.ContractNumber; string context = "NG"; IRestClient client = new JsonServiceClient(); string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}/cohortpatientview/update", DDPatientServiceUrl, context, version, contractNumber, patientId), request.UserId); PutUpdateCohortPatientViewResponse response = client.Put <PutUpdateCohortPatientViewResponse>(url, new PutUpdateCohortPatientViewRequest { CohortPatientView = cpvd, ContractNumber = contractNumber, PatientID = patientId } as object); } catch (Exception ex) { throw new Exception("AD:PlanElementEndpointUtil:UpdateCohortPatientViewProblem()::" + ex.Message, ex.InnerException); } }
public void Put_Problem_In_CohortPatientView_Response_Test() { double version = 1.0; string contractNumber = "InHealth001"; string context = "NG"; string patientId = "52e26f11072ef7191c111c54"; CohortPatientViewData cohortPatientView = GetCohortPatientView(); IRestClient client = new JsonServiceClient(); JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df")); PutUpdateCohortPatientViewResponse response = client.Put <PutUpdateCohortPatientViewResponse>(string.Format("{0}/{1}/{2}/{3}/patient/{4}/cohortpatientview/update", "http://localhost:8888/Patient", context, version, contractNumber, patientId), new PutUpdateCohortPatientViewRequest { CohortPatientView = cohortPatientView, ContractNumber = contractNumber, PatientID = patientId } as object); }
public CohortPatientViewData FindCohortPatientViewByPatientId(string patientId) { CohortPatientViewData data = null; try { using (PatientMongoContext ctx = new PatientMongoContext(_dbName)) { List <IMongoQuery> queries = new List <IMongoQuery>(); queries.Add(Query.EQ(MECohortPatientView.PatientIDProperty, ObjectId.Parse(patientId))); //queries.Add(Query.EQ(MECohortPatientView.DeleteFlagProperty, false)); Commented out this line as there are few records in Prod that do not contain basic fields like del, ttl, uon, etc. IMongoQuery mQuery = Query.And(queries); MECohortPatientView meCPV = ctx.CohortPatientViews.Collection.Find(mQuery).FirstOrDefault(); if (meCPV != null) { data = new CohortPatientViewData { Id = meCPV.Id.ToString(), LastName = meCPV.LastName, PatientID = meCPV.PatientID.ToString(), AssignedToContactIds = meCPV.AssignedToContactIds }; } } return(data); } catch (Exception) { throw; } }
private CohortPatientViewData GetCohortPatientView() { CohortPatientViewData cpv = new CohortPatientViewData { Id = "52e26f11072ef7191c111c53", LastName = "Tomerlin", PatientID = "52e26f11072ef7191c111c54", SearchFields = searchFields() }; return(cpv); }
private CohortPatientViewData GetCohortPatientView() { CohortPatientViewData cpv = new CohortPatientViewData { Id = "52f55858072ef709f84e5ded", LastName = "Blad", PatientID = "52f55858072ef709f84e5dee", SearchFields = searchFields() }; return(cpv); }
public object Update(object entity) { PutUpdateCohortPatientViewRequest p = (PutUpdateCohortPatientViewRequest)entity; PutUpdateCohortPatientViewResponse resp = new PutUpdateCohortPatientViewResponse(); try { CohortPatientViewData cpvd = p.CohortPatientView; using (PatientMongoContext ctx = new PatientMongoContext(_dbName)) { var q = MB.Query <MECohortPatientView> .EQ(b => b.Id, ObjectId.Parse(p.CohortPatientView.Id)); List <SearchField> sfds = Utils.CloneAppDomainCohortPatientViews(p.CohortPatientView.SearchFields); var uv = new List <MB.UpdateBuilder>(); if (!String.IsNullOrEmpty(cpvd.LastName)) { uv.Add(MB.Update.Set(MECohortPatientView.LastNameProperty, cpvd.LastName)); } if (!String.IsNullOrEmpty(cpvd.PatientID)) { uv.Add(MB.Update.Set(MECohortPatientView.PatientIDProperty, ObjectId.Parse(cpvd.PatientID))); } uv.Add(MB.Update.Set(MECohortPatientView.UpdatedByProperty, ObjectId.Parse(this.UserId))); uv.Add(MB.Update.Set(MECohortPatientView.LastUpdatedOnProperty, DateTime.UtcNow)); // uv.Add(MB.Update.Set(MECohortPatientView.AssignedToProperty, p.CohortPatientView.AssignedToContactIds.Select(c => BsonValue.Create(c)))); if (p.CohortPatientView != null) { uv.Add(MB.Update.SetWrapped <List <SearchField> >(MECohortPatientView.SearchFieldsProperty, sfds)); } IMongoUpdate update = MB.Update.Combine(uv); ctx.CohortPatientViews.Collection.Update(q, update); AuditHelper.LogDataAudit(this.UserId, MongoCollectionName.CohortPatientView.ToString(), p.CohortPatientView.Id.ToString(), Common.DataAuditType.Update, p.ContractNumber); } resp.CohortPatientViewId = p.CohortPatientView.Id; return(resp); } catch (Exception ex) { throw new Exception("CohortPatientDD:Update()::" + ex.Message, ex.InnerException); } }
public void UpdateCohortPatientView(string patientId, string careMemberContactId) { GetCohortPatientViewResponse getResponse = GetCohortPatientView(patientId); if (getResponse != null && getResponse.CohortPatientView != null) { CohortPatientViewData cpvd = getResponse.CohortPatientView; // check to see if primary care manager's contactId exists in the searchfield if (!cpvd.SearchFields.Exists(sf => sf.FieldName == "PCM")) { cpvd.SearchFields.Add(new SearchFieldData { Value = careMemberContactId, Active = true, FieldName = "PCM" }); } else { cpvd.SearchFields.ForEach(sf => { if (sf.FieldName == "PCM") { sf.Value = careMemberContactId; sf.Active = true; } }); } PutUpdateCohortPatientViewRequest request = new PutUpdateCohortPatientViewRequest { CohortPatientView = cpvd, ContractNumber = ContractNumber, PatientID = patientId }; PutUpdateCohortPatientViewResponse response = UpdateCohortPatientView(request, patientId); if (string.IsNullOrEmpty(response.CohortPatientViewId)) { throw new Exception("Unable to update Cohort Patient View"); } } }
private List <CohortPatientViewData> getMECohortPatientView(List <PatientData> patients) { List <CohortPatientViewData> list = new List <CohortPatientViewData>(); foreach (var p in patients) { List <SearchFieldData> data = new List <SearchFieldData>(); data.Add(new SearchFieldData { Active = true, FieldName = Constants.FN, Value = p.FirstName }); data.Add(new SearchFieldData { Active = true, FieldName = Constants.LN, Value = p.LastName }); data.Add(new SearchFieldData { Active = true, FieldName = Constants.G, Value = p.Gender.ToUpper() }); data.Add(new SearchFieldData { Active = true, FieldName = Constants.DOB, Value = p.DOB }); data.Add(new SearchFieldData { Active = true, FieldName = Constants.MN, Value = p.MiddleName }); data.Add(new SearchFieldData { Active = true, FieldName = Constants.SFX, Value = p.Suffix }); data.Add(new SearchFieldData { Active = true, FieldName = Constants.PN, Value = p.PreferredName }); data.Add(new SearchFieldData { Active = true, FieldName = Constants.PCM }); //value left null on purpose CohortPatientViewData cpvData = new CohortPatientViewData { PatientID = p.Id, LastName = p.LastName, SearchFields = data, }; list.Add(cpvData); } ; return(list); }
public void UpdatePatientView_Test() { double version = 1.0; string contractNumber = "InHealth001"; string context = "NG"; string patientId = "52f55858072ef709f84e5dee"; string userId = "DDTestHarness"; CohortPatientViewData view = GetCohortPatientView(); PutUpdateCohortPatientViewRequest request = new PutUpdateCohortPatientViewRequest { CohortPatientView = view, Context = context, ContractNumber = contractNumber, PatientID = patientId, UserId = userId, Version = version }; IPatientDataManager pm = new PatientDataManager(); PutUpdateCohortPatientViewResponse response = pm.UpdateCohortPatientViewProblem(request); }
public DeleteCohortPatientViewDataResponse DeleteCohortPatientViewByPatientId(DeleteCohortPatientViewDataRequest request) { DeleteCohortPatientViewDataResponse response = null; try { response = new DeleteCohortPatientViewDataResponse(); IPatientRepository cpvRepo = Factory.GetRepository(request, RepositoryType.CohortPatientView); CohortPatientViewData cpvData = cpvRepo.FindCohortPatientViewByPatientId(request.PatientId); if (cpvData != null) { request.Id = cpvData.Id; cpvRepo.Delete(request); response.DeletedId = request.Id; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }
public void UpdateCohortPatientViewProblem(CohortPatientViewData cpvd, string patientId, IAppDomainRequest request) { throw new NotImplementedException(); }
private void upsertCohortPatientView(string patientId, string contactId, double version, string contractNumber, string userId) { string context = "NG"; try { IRestClient client = new JsonServiceClient(); string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}/cohortpatientview/", DDPatientServiceURL, context, version, contractNumber, patientId), userId); GetCohortPatientViewResponse getResponse = client.Get <GetCohortPatientViewResponse>(url); if (getResponse != null && getResponse.CohortPatientView != null) { CohortPatientViewData cpvd = getResponse.CohortPatientView; // check to see if primary care manager's contactId exists in the searchfield if (!cpvd.SearchFields.Exists(sf => sf.FieldName == Constants.PCM)) { cpvd.SearchFields.Add(new SearchFieldData { Value = contactId, Active = true, FieldName = Constants.PCM }); } else { cpvd.SearchFields.ForEach(sf => { if (sf.FieldName == Constants.PCM) { sf.Value = contactId; sf.Active = true; } }); } string cohortPatientViewURL = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}/cohortpatientview/update", DDPatientServiceURL, context, version, contractNumber, patientId), userId); PutUpdateCohortPatientViewResponse putResponse = client.Put <PutUpdateCohortPatientViewResponse>(cohortPatientViewURL, new PutUpdateCohortPatientViewRequest { CohortPatientView = cpvd, ContractNumber = contractNumber, PatientID = patientId } as object); } } catch (WebServiceException ex) { throw new WebServiceException("AD:UpsertCohortPatientView()::" + ex.Message, ex.InnerException); } }