public List <PatientNoteModel> GetPatientNotes(int id) { SqlDataAccess sql = new SqlDataAccess(); var patientNotes = new List <PatientNoteModel>(); var notesOutput = sql.LoadData <PatientNoteModel, dynamic>("dbo.spPatient_GetNotes", new { id }, "PrescriptionDataManagerUpdated"); foreach (PatientNoteModel noteData in notesOutput) { var note = new PatientNoteModel { Id = noteData.Id, PatientId = noteData.Id, Title = noteData.Title, Text = noteData.Text, AuthorId = noteData.AuthorId, CreatedDate = noteData.CreatedDate }; patientNotes.Add(note); } return(patientNotes); }
public void AddNote(PatientNoteModel note) { SqlDataAccess sql = new SqlDataAccess(); try { sql.StartTransaction("PrescriptionDataManagerUpdated"); sql.SaveDataInTransaction("dbo.spNote_Add", new { note.PatientId, note.Title, note.Text, note.AuthorId }); sql.CommitTransaction(); } catch { sql.RollbackTransation(); throw; } }
public async Task UpdateAsync(string id, PatientNoteModel patientNoteModel) { var content = new StringContent(JsonConvert.SerializeObject(patientNoteModel), Encoding.UTF8, "application/json"); var response = await _httpClient.PutAsync($"{_baseUrl}{id}", content); response.EnsureSuccessStatusCode(); }
public async Task SavePatientNoteAsync(PatientNoteModel patientNote) { if (!await _patientService.PatientExists(patientNote.PatientId)) { throw new NotFoundException("Patient", patientNote.PatientId); } await _dbConnector.InsertAsync(MapPatientNoteModelToPatientNote(patientNote)); }
public async Task UpdatePatientAsync(PatientNoteModel patientNoteModel) { if (!await _patientService.PatientExists(patientNoteModel.PatientId)) { throw new NotFoundException("Patient", patientNoteModel.PatientId); } var patientNoteEntity = MapPatientNoteModelToPatientNote(patientNoteModel); await _dbConnector.UpdateAsync(patientNoteEntity); }
public async Task <ActionResult> Update(string id, PatientNoteModel patientNoteModel) { if (id != patientNoteModel.Id) { return(BadRequest()); } await _patientNoteService.UpdatePatientAsync(patientNoteModel); return(Ok("success")); }
public void UpdatePatient_PatientAndDoctorId(PatientNoteModel noteModel) { var Parameters = new { @Id = noteModel.Id, @Body = noteModel.Body, @ShowToPatient = noteModel.ShowToPatient }; _sqlDataAccess.SaveData <dynamic>("dbo.spPatientNote_UpdatePatientByPatientAndDoctorID", Parameters); }
public void AddNewPatientNote(PatientNoteModel patientNote) { var Parameters = new { @Id = patientNote.Id, @Body = patientNote.Body, @PatientId = patientNote.PatientId, @AddedBy = patientNote.AddedBy, @ShowToPatient = patientNote.ShowToPatient }; _sqlDataAccess.SaveData <dynamic>("dbo.spPatientNote_AddNote", Parameters); }
public IActionResult InsertPatientNote(PatientNoteModel note) { if (note != null && ModelState.IsValid) { note.CreationDate = DateTime.Now; if (_validatorRepository.Validate(note)) { _patientNoteRepository.Insert(note); _patientNoteRepository.Save(); return(RedirectToAction("ViewPatientNotes", "PatientNote", new { patientId = note.PatientId })); } } return(BadRequest(ModelState)); }
public async Task AddNote(PatientNoteModel note) { using (HttpResponseMessage response = await _apiHelper.ApiClient.PostAsJsonAsync("/api/Notes/Add", note)) { if (response.IsSuccessStatusCode) { //log success } else { throw new Exception(response.ReasonPhrase); } } }
public async Task GivenInvalidPatientNotesItem_ReturnsNotFound() { var client = _factory.CreateClient(); var patientNote = new PatientNoteModel { PatientId = 2, Note = "Note" }; var content = IntegrationTestHelper.GetRequestContent(patientNote); var response = await client.PostAsync("/api/patientnotes", content); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); }
public void InsertPatientActionResult_ValidPatientModel_RedirectToIndexView() { //Arrange PatientNoteModel validModel = new PatientNoteModel { PatientId = 1, PractitionerId = 1, NoteId = 1, NoteDescription = "Description", CreationDate = DateTime.Now }; var controller = new PatientNoteController(userRepo.Object, patientNoteRepo.Object, patientRepo.Object, validatorRepo.Object); validatorRepo.Setup(repo => repo.Validate(It.IsAny <PatientNoteModel>())).Returns(true); //Act var result = controller.InsertPatientNote(validModel) as RedirectToActionResult; // Assert Assert.That(result.ActionName, Is.EqualTo("ViewPatientNotes")); }
public async Task GivenValidPatientNotesItem_ReturnsSuccessStatusCode() { var client = _factory.CreateClient(); var patientNote = new PatientNoteModel { PatientId = 1, Note = "Note" }; var content = IntegrationTestHelper.GetRequestContent(patientNote); var response = await client.PostAsync("/api/patientnotes", content); response.EnsureSuccessStatusCode(); }
public IActionResult CreatePatientNote(int patientId) { if (HttpContext.Session.GetInt32("UserId") == null) { return(LocalRedirect("/Home/Login?error=2")); } var userId = HttpContext.Session.GetInt32("UserId"); var userObj = _userRepository.GetById(userId); PatientNoteModel patientNote = new PatientNoteModel(); patientNote.PatientId = patientId; patientNote.PractitionerId = userObj.PractitionerId; return(View(patientNote)); }
private PatientNote MapPatientNoteModelToPatientNote(PatientNoteModel patientNoteModel) { var patientNote = new PatientNote { Note = patientNoteModel.Note, PatientId = patientNoteModel.PatientId, Created = patientNoteModel.Created, Edited = patientNoteModel.Edited }; if (!string.IsNullOrEmpty(patientNoteModel.Id)) { patientNote.Id = new MongoDB.Bson.ObjectId(patientNoteModel.Id ?? string.Empty); } return(patientNote); }
public async Task GivenValidPatientNotesItem_ReturnsSuccessStatusCode() { var client = _factory.CreateClient(); var patientNote = new PatientNoteModel { Id = "5e4835f48ca24a0c5e408313", PatientId = 1, Note = "Note" }; var content = IntegrationTestHelper.GetRequestContent(patientNote); var response = await client.PutAsync($"/api/patientnotes/{patientNote.Id}", content); response.EnsureSuccessStatusCode(); }
public async Task <IActionResult> Edit(string id, PatientNoteModel patientNoteModel) { await _patientNoteService.UpdateAsync(id, patientNoteModel); return(RedirectToAction("Details", "Patient", new { id = patientNoteModel.PatientId })); }
public async Task <IActionResult> Create(PatientNoteModel patientNoteModel) { await _patientNoteService.CreateAsync(patientNoteModel); return(RedirectToAction("Details", "Patient", new { id = patientNoteModel.PatientId })); }
public void AddNote(PatientNoteModel note) { NoteData data = new NoteData(); data.AddNote(note); }
public async Task <ActionResult> Create(PatientNoteModel patientNoteModel) { await _patientNoteService.SavePatientNoteAsync(patientNoteModel); return(Ok("success")); }