private void CreateProblem(ProblemDto dto, long patientKey, Provenance provenance) { var clinicalCase = _clinicalCaseRepository.GetActiveClinicalCaseByPatient(patientKey); CodedConcept problemCode = null; if (dto.ProblemCodeCodedConcept != null) { problemCode = new CodedConceptBuilder().WithCodedConceptDto(dto.ProblemCodeCodedConcept); } var problem = _problemFactory.CreateProblem(clinicalCase, problemCode, provenance); var problemType = _mappingHelper.MapLookupField <ProblemType> (dto.ProblemType); var problemStatus = _mappingHelper.MapLookupField <ProblemStatus> (dto.ProblemStatus); problem.ReviseProblemType(problemType); problem.ReviseOnsetDateRange(new DateRange(dto.OnsetStartDate, dto.OnsetEndDate)); problem.UpdateProblemStatus(problemStatus, dto.StatusChangedDate); problem.ReviseCauseOfDeathIndicator(dto.CauseOfDeathIndicator); if (dto.ObservedByStaff != null) { var staff = Session.Load <Staff> (dto.ObservedByStaff.Key); problem.ReviseObservationInfo(staff, dto.ObservedDate); } }
public IActionResult AddProblem(ProblemDto problemDto) { var problem = _mapper.Map <Problem>(problemDto); _problemService.Add(problem); return(Ok()); }
/// <summary> /// Navigates to default command. /// </summary> /// <param name="parameters">The parameters.</param> protected override void NavigateToDefaultCommand(KeyValuePair <string, string>[] parameters) { var key = parameters.GetValue <long> ("ProblemKey"); _clinicalCaseKey = parameters.GetValue <long> ("ClinicalCaseKey"); var dispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher(); if (key == 0) { Problem = new ProblemDto { Key = key }; _isCreate = true; dispatcher.Add(new GetDtoRequest <StaffSummaryDto> { Key = CurrentUserContext.Staff.Key }); Problem.ClinicalCaseKey = _clinicalCaseKey; Problem.StatusChangedDate = DateTime.Now; } else { dispatcher.Add(new GetProblemByKeyRequest { Key = key }); } dispatcher .AddLookupValuesRequest(ProblemTypeLookupName) .AddLookupValuesRequest(ProblemStatusLookupName); dispatcher.ProcessRequests(HandleRequestComplete, HandleRequestDispatcherException); IsLoading = true; }
private static void CopyProblemDtoTo(ProblemDto from, ProblemDto to) { to.Label = from.Label; to.Status = from.Status; to.Time = from.Time; to.Try = from.Try; }
public IActionResult UpdateProblem(ProblemDto problemDto, [FromRoute] int id) { var problem = _mapper.Map <Problem>(problemDto); problem.Id = id; _problemService.Update(problem); return(Ok()); }
private bool CanExecuteDeleteProblem(ProblemDto arg) { if (arg != null) { return(arg.AssociatedIndicator.HasValue ? !arg.AssociatedIndicator.Value : true); } return(false); }
private void DeleteProblem(ProblemDto dto) { var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher(); requestDispatcher.Add(new DeleteProblemRequest { ProblemKey = dto.Key }); IsLoading = true; requestDispatcher.ProcessRequests(HandleDeleteProblemCompleted, HandleDeleteProblemException); }
private void SaveProblem(ProblemDto dto) { var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher(); requestDispatcher.Add(new SaveDtoRequest <ProblemDto> { DataTransferObject = dto }); IsLoading = true; requestDispatcher.ProcessRequests(HandleSaveProblemCompleted, HandleSaveProblemException); }
private void ExecuteDetachProblem(ProblemDto problemDto) { var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher(); requestDispatcher.Add(new DetachProblemFromVisitRequest { ProblemDto = problemDto, VisitKey = Visit.Key }); IsLoading = true; requestDispatcher.ProcessRequests(HandleDetachProblemFromVisitCompleted, HandleDetachProblemFromVisitException); }
public ProblemDto GetProblemById(string id) { Problem problem = _context.Problems.FirstOrDefault(a => a.Id == id); ProblemDto dto = new ProblemDto { Id = problem.Id, Name = problem.Name, Points = problem.Points, Count = _context.Submissions.Where(a => a.ProblemId == problem.Id).Count(), }; return(dto); }
private void ExecuteGenerateHL7ProblemCommand(ProblemDto problemDto) { var relativePath = string.Format( "../{0}?{1}={2}&{3}={4}", HttpHandlerPaths.PatientModuleHttpHandlerPath, HttpUtility.UrlEncode(HttpHandlerQueryStrings.RequestName), HttpUtility.UrlEncode(HttpHandlerRequestNames.DownloadHl7SyndromicSurveillanceDocument), HttpUtility.UrlEncode(HttpHandlerQueryStrings.ProblemKey), problemDto.Key); var uri = new Uri(Application.Current.Host.Source, relativePath); HtmlPage.Window.Navigate(uri, "_blank"); }
private void ExecuteEditProblemCommand(ProblemDto problemDto) { _popupService.ShowPopup( "EditCaseProblemView", "Create", "Problem", new[] { new KeyValuePair <string, string> ("ProblemKey", problemDto.Key.ToString()), new KeyValuePair <string, string> ("ClinicalCaseKey", _clinicalCaseKey.ToString()) }, false, PopupClosed); }
public async Task <bool> Update(ProblemDto problemDto) { DataAccess.Models.Problem value = Mapper.Map <DataAccess.Models.Problem>(problemDto); try { db.Entry(value).State = EntityState.Modified; await db.SaveChangesAsync(); return(true); } catch { return(false); } }
public async Task <ActionResult> Delete(ProblemDto value) { try { if (ModelState.IsValid) { await db.Delete(value); return(RedirectToAction("Index")); } } catch { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View("index")); }
public async Task <ActionResult> EditType(ProblemDto value) { try { if (ModelState.IsValid) { await db.Update(value); return(RedirectToAction("Index")); } } catch { ViewData["SelectedList"] = new SelectedListHelpers().GetSelectedList(_dbCategory.Get()); ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(value)); }
public async Task <bool> Create(ProblemDto problemDto) { try { DataAccess.Models.Problem value = Mapper.Map <DataAccess.Models.Problem>(problemDto); db.Entry(value).State = EntityState.Added; db.Problems.Add(value); await db.SaveChangesAsync(); return(true); } catch { return(false); } }
public async Task <bool> Delete(ProblemDto problemDto) { try { DataAccess.Models.Problem value = Mapper.Map <DataAccess.Models.Problem>(problemDto); value.DeletedDateTime = DateTime.Now; value.IsDeleted = true; db.Entry(value).State = EntityState.Modified; await db.SaveChangesAsync(); return(true); } catch { return(false); } }
public async Task <bool> CreateReletionUnit(ProblemDto problemDto) { try { DataAccess.Models.Problem value = Mapper.Map <DataAccess.Models.Problem>(problemDto); List <Department> problemDepartments = db.Departments.Where(d => d.Id == problemDto.DepartmentId).ToList(); value.Departments = problemDepartments; db.Problems.Add(value); await db.SaveChangesAsync(); return(true); } catch { return(false); } }
private ProblemDto GetProblemDto(ConditionDto condition) { var problem = new ProblemDto(); if (condition.ProblemCode != null) { problem.ProblemCodeCodedConcept = new CodedConceptDto { CodedConceptCode = condition.ProblemCode.Code, CodeSystemIdentifier = condition.ProblemCode.CodeSystem, DisplayName = condition.ProblemCode.DisplayName, CodeSystemName = condition.ProblemCode.CodeSystemName, }; } if (condition.ProblemStatus != null && !string.IsNullOrEmpty(condition.ProblemStatus.Code)) { var lookup = _codedConceptLookupBaseRepository.GetLookupByCodedConceptCode <ProblemStatus> (condition.ProblemStatus.Code); if (lookup != null) { problem.ProblemStatus = AutoMapper.Mapper.Map <LookupBase, LookupValueDto> (lookup); } } if (condition.ProblemType != null && !string.IsNullOrEmpty(condition.ProblemType.Code)) { var lookup = _codedConceptLookupBaseRepository.GetLookupByCodedConceptCode <ProblemType> (condition.ProblemType.Code); if (lookup != null) { problem.ProblemType = AutoMapper.Mapper.Map <LookupBase, LookupValueDto> (lookup); } } // TODO //Upon to C32DtoFactory, currently, C32dto does not have the following values //AssociatedIndicator,CauseOfDeathIndicator,ClinicalCaseKey,ObservedByStaff,ObservedDate,OnsetEndDate,OnsetStartDate,StatusChangedDate return(problem); }
private void ExecuteDeleteProblem(ProblemDto problemDto) { DeleteProblem(problemDto); }
public ProblemDto Get(int id) { ProblemDto value = Mapper.Map <ProblemDto>(db.Problems.Find(id)); return(value); }
private void ExecuteSaveProblem(ProblemDto problemDto) { SaveProblem(Problem); }
private void ExecuteDtsSearchSelectionChangedCommand(ProblemDto obj) { Problem.ProblemCodeCodedConcept = obj.ProblemCodeCodedConcept; }