public void GetAllPatientNotes_Test_Fails() { GetAllPatientNotesDataRequest request = new GetAllPatientNotesDataRequest { PatientId = "5307b343d433232dd4e94743", Count = 3 }; List <PatientNoteData> response = m.GetAllPatientNotes(request); Assert.IsTrue(response.Count == 0); }
public void GetAllPatientNotes_Test_Passes() { GetAllPatientNotesDataRequest request = new GetAllPatientNotesDataRequest { PatientId = "52f5589c072ef709f84e7798", Count = 3 }; List <PatientNoteData> response = m.GetAllPatientNotes(request); Assert.IsTrue(response.Count > 0); }
public IEnumerable <object> FindByPatientId(object request) { List <PatientNoteData> noteDataList = null; GetAllPatientNotesDataRequest dataRequest = (GetAllPatientNotesDataRequest)request; try { using (PatientNoteMongoContext ctx = new PatientNoteMongoContext(ContractDBName)) { List <IMongoQuery> queries = new List <IMongoQuery>(); queries.Add(Query.EQ(MEPatientNote.PatientIdProperty, ObjectId.Parse(dataRequest.PatientId))); queries.Add(Query.EQ(MEPatientNote.DeleteFlagProperty, false)); IMongoQuery mQuery = Query.And(queries); List <MEPatientNote> meNotes = null; //if (dataRequest.Count > 0) //{ // meNotes = ctx.PatientNotes.Collection.Find(mQuery).OrderByDescending(o => o.RecordCreatedOn).Take(dataRequest.Count).ToList(); //} //else //{ meNotes = ctx.PatientNotes.Collection.Find(mQuery).ToList(); //} if (meNotes != null && meNotes.Count > 0) { noteDataList = new List <PatientNoteData>(); foreach (MEPatientNote meN in meNotes) { noteDataList.Add(new PatientNoteData { Id = meN.Id.ToString(), PatientId = meN.PatientId.ToString(), Text = meN.Text, ProgramIds = Helper.ConvertToStringList(meN.ProgramIds), CreatedOn = meN.RecordCreatedOn, CreatedById = meN.RecordCreatedBy.ToString(), TypeId = meN.Type.ToString(), MethodId = (meN.MethodId == null) ? null : meN.MethodId.ToString(), OutcomeId = (meN.OutcomeId == null) ? null : meN.OutcomeId.ToString(), WhoId = (meN.WhoId == null) ? null : meN.WhoId.ToString(), SourceId = (meN.SourceId == null) ? null : meN.SourceId.ToString(), Duration = meN.Duration, ValidatedIdentity = meN.ValidatedIdentity, ContactedOn = meN.ContactedOn, UpdatedById = (meN.UpdatedBy == null) ? null : meN.UpdatedBy.ToString(), UpdatedOn = meN.LastUpdatedOn, DataSource = meN.DataSource, ExternalRecordId = meN.ExternalRecordId }); } } } return(noteDataList); } catch (Exception) { throw; } }
public List <PatientNoteData> GetAllPatientNotes(GetAllPatientNotesDataRequest request) { try { List <PatientNoteData> response = null; IMongoPatientNoteRepository repo = Factory.GetRepository(RepositoryType.PatientNote); response = repo.FindByPatientId(request) as List <PatientNoteData>; return(response); } catch (Exception ex) { throw ex; } }
public GetAllPatientNotesDataResponse Get(GetAllPatientNotesDataRequest request) { GetAllPatientNotesDataResponse response = new GetAllPatientNotesDataResponse(); try { RequireUserId(request); response.PatientNotes = Manager.GetAllPatientNotes(request); response.Version = request.Version; } catch (Exception ex) { RaiseException(response, ex); } return(response); }
public void GetPatientNotes_Test() { GetAllPatientNotesDataRequest request = new GetAllPatientNotesDataRequest { Context = context, ContractNumber = contractNumber, PatientId = "5325da92d6a4850adcbba6aa", UserId = userId, Version = version }; //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Notes/{Count}", "GET")] GetAllPatientNotesDataResponse response = client.Get <GetAllPatientNotesDataResponse>( string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Notes/{5}?UserId={6}", url, context, version, contractNumber, request.PatientId, 10, request.UserId)); Assert.IsNotNull(response); }
public DeleteNoteByPatientIdDataResponse DeleteNoteByPatientId(DeleteNoteByPatientIdDataRequest request) { DeleteNoteByPatientIdDataResponse response = null; try { response = new DeleteNoteByPatientIdDataResponse(); IMongoPatientNoteRepository repo = Factory.GetRepository(RepositoryType.PatientNote); GetAllPatientNotesDataRequest getAllPatientNotesDataRequest = new GetAllPatientNotesDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }; List <PatientNoteData> patientNotes = repo.FindByPatientId(getAllPatientNotesDataRequest) as List <PatientNoteData>; List <string> deletedIds = null; if (patientNotes != null) { deletedIds = new List <string>(); patientNotes.ForEach(u => { DeletePatientNoteDataRequest deletePatientNoteDataRequest = new DeletePatientNoteDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, Id = u.Id, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }; repo.Delete(deletePatientNoteDataRequest); deletedIds.Add(deletePatientNoteDataRequest.Id); }); response.DeletedIds = deletedIds; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }
public List <PatientNoteData> GetAllPatientNotes(GetAllPatientNotesDataRequest request) { throw new NotImplementedException(); }