示例#1
0
        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());
        }
示例#3
0
        /// <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;
        }
示例#4
0
 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());
        }
示例#6
0
 private bool CanExecuteDeleteProblem(ProblemDto arg)
 {
     if (arg != null)
     {
         return(arg.AssociatedIndicator.HasValue ? !arg.AssociatedIndicator.Value : true);
     }
     return(false);
 }
示例#7
0
        private void DeleteProblem(ProblemDto dto)
        {
            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher();

            requestDispatcher.Add(new DeleteProblemRequest {
                ProblemKey = dto.Key
            });
            IsLoading = true;
            requestDispatcher.ProcessRequests(HandleDeleteProblemCompleted, HandleDeleteProblemException);
        }
示例#8
0
        private void SaveProblem(ProblemDto dto)
        {
            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher();

            requestDispatcher.Add(new SaveDtoRequest <ProblemDto> {
                DataTransferObject = dto
            });
            IsLoading = true;
            requestDispatcher.ProcessRequests(HandleSaveProblemCompleted, HandleSaveProblemException);
        }
示例#9
0
        private void ExecuteDetachProblem(ProblemDto problemDto)
        {
            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher();

            requestDispatcher.Add(new DetachProblemFromVisitRequest {
                ProblemDto = problemDto, VisitKey = Visit.Key
            });
            IsLoading = true;
            requestDispatcher.ProcessRequests(HandleDetachProblemFromVisitCompleted, HandleDetachProblemFromVisitException);
        }
示例#10
0
        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);
        }
示例#11
0
        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");
        }
示例#12
0
 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);
 }
示例#13
0
        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); }
        }
示例#14
0
        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"));
        }
示例#15
0
        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));
        }
示例#16
0
        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);
            }
        }
示例#17
0
        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);
            }
        }
示例#18
0
        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);
        }
示例#20
0
 private void ExecuteDeleteProblem(ProblemDto problemDto)
 {
     DeleteProblem(problemDto);
 }
示例#21
0
        public ProblemDto Get(int id)
        {
            ProblemDto value = Mapper.Map <ProblemDto>(db.Problems.Find(id));

            return(value);
        }
示例#22
0
 private void ExecuteSaveProblem(ProblemDto problemDto)
 {
     SaveProblem(Problem);
 }
示例#23
0
 private void ExecuteDtsSearchSelectionChangedCommand(ProblemDto obj)
 {
     Problem.ProblemCodeCodedConcept = obj.ProblemCodeCodedConcept;
 }