public Result <PatientVitalSignDto> GetPatientVitalSigns(int patientConsultationId) { Result <PatientVitalSignDto> response = new Result <PatientVitalSignDto>(); using (UnitOfWork unitOfWork = new UnitOfWork()) { IEnumerable <VitalSign> vitalSigns = unitOfWork.VitalSignRepository.GetEntities(); IEnumerable <PatientVitalSign> patientVitalSigns = unitOfWork.PatientVitalSignRepository.GetEntities(item => item.PatientConsultationId == patientConsultationId, p => p.OrderBy(o => o.VitalSign.Name)); foreach (VitalSign vitalSign in vitalSigns) { VitalSignDto vitalSignDto = _VitalSignMapper.MapToVitalSignDto(vitalSign); PatientVitalSign patientVitalSign = patientVitalSigns.Where(item => item.VitalSignId == vitalSign.VitalSignId).FirstOrDefault(); PatientVitalSignDto patientVitalSignDto = new PatientVitalSignDto() { PatientVitalSignId = patientVitalSign == null ? default(int?) : patientVitalSign.PatientVitalSignId, PatientConsultationId = patientConsultationId, VitalSign = vitalSignDto, VitalSignValue = patientVitalSign == null ? null : patientVitalSign.VitalSignValue }; response.Models.Add(patientVitalSignDto); } } return(response); }
private VitalSignDto GetVitalSignFromC32Dto(C32Dto c32Dto) { if (c32Dto == null || c32Dto.Body == null || c32Dto.Body.VitalSignsDto == null || c32Dto.Body.VitalSignsDto.VitalSignResults == null || c32Dto.Body.VitalSignsDto.VitalSignResults.Count <= 0) { return(null); } var vitalSignResults = c32Dto.Body.VitalSignsDto.VitalSignResults; var vitalSignDto = new VitalSignDto(); var activityStartDate = DateTime.MinValue; vitalSignDto.WeightLbsMeasure = GetWeightLbs(vitalSignResults, ref activityStartDate); vitalSignDto.BloodPressures = GetBloodPressures(vitalSignResults, ref activityStartDate); vitalSignDto.HeartRates = GetHeartRates(vitalSignResults, ref activityStartDate); CalculateHeight(vitalSignDto, vitalSignResults, ref activityStartDate); //if (c32Dto.Body.PlanOfCare != null && c32Dto.Body.PlanOfCare.PlannedEvents != null) //{ // SetDietaryConsultationOrderIndicator ( vitalSignDto, c32Dto.Body.PlanOfCare.PlannedEvents ); // SetBmiFollowUpPlanIndicator ( vitalSignDto, c32Dto.Body.PlanOfCare.PlannedEvents ); //} if (activityStartDate != DateTime.MinValue) { vitalSignDto.ActivityStartDateTime = vitalSignDto.ActivityEndDateTime = activityStartDate; } else { vitalSignDto.ActivityStartDateTime = vitalSignDto.ActivityEndDateTime = DateTime.Now; } return(vitalSignDto); }
private void CreateVitalSign(VitalSignDto dto, long patientKey, Provenance provenance) { if (dto == null) { return; } var clinicalCase = _clinicalCaseRepository.GetActiveClinicalCaseByPatient(patientKey); var vitalSign = _vitalSignFactory.CreateVitalSign( clinicalCase, provenance, new DateTimeRange(dto.ActivityStartDateTime, dto.ActivityEndDateTime)); vitalSign.ReviseHeight(new Height(dto.HeightFeetMeasure, dto.HeightInchesMeasure)); vitalSign.ReviseWeight(dto.WeightLbsMeasure); new AggregateNodeCollectionMapper <BloodPressureDto, VitalSign, BloodPressure> ( dto.BloodPressures, vitalSign, vitalSign.BloodPressures) .MapRemovedItem(RemoveBloodPressure) .MapAddedItem(AddBloodPressure) .MapChangedItem(ChangeBloodPressure) .Map(); new AggregateNodeCollectionMapper <HeartRateDto, VitalSign, HeartRate> (dto.HeartRates, vitalSign, vitalSign.HeartRates) .MapRemovedItem(RemoveHeartRate) .MapAddedItem(AddHeartRate) .MapChangedItem(ChangeHeartRate) .Map(); }
private void SetBmiFollowUpPlanIndicator(VitalSignDto vitalSignDto, List <PlannedEventDto> plannedEventDtos) { var bmiFollowUpPlanIndicatorEvent = plannedEventDtos.FirstOrDefault(ped => ped.PlanType.Code == BmiFollowUpPlanIndicatorEventCode); if (bmiFollowUpPlanIndicatorEvent != null) { vitalSignDto.BmiFollowUpPlanIndicator = true; } }
private void SetDietaryConsultationOrderIndicator(VitalSignDto vitalSignDto, List <PlannedEventDto> plannedEventDtos) { var dietaryConsultationOrderIndicatorEvent = plannedEventDtos.FirstOrDefault(ped => ped.PlanType.Code == DietaryConsultationOrderIndicatorEventCode); if (dietaryConsultationOrderIndicatorEvent != null) { vitalSignDto.DietaryConsultationOrderIndicator = true; } }
public VitalSignDto MapToVitalSignDto(VitalSign vitalSign) { if (vitalSign == null) { return(null); } VitalSignDto vitalSignDto = new VitalSignDto(); vitalSignDto.VitalSignId = vitalSign.VitalSignId; vitalSignDto.Name = vitalSign.Name; vitalSignDto.SortKey = vitalSign.SortKey; return(vitalSignDto); }
public VitalSign MapToVitalSign(VitalSignDto vitalSignDto) { if (vitalSignDto == null) { return(null); } VitalSign vitalSign = new VitalSign(); if (vitalSignDto.VitalSignId != null) { vitalSign.VitalSignId = vitalSignDto.VitalSignId.Value; } vitalSign.Name = vitalSignDto.Name; vitalSign.SortKey = vitalSignDto.SortKey; return(vitalSign); }
private void CalculateHeight(VitalSignDto vitalSignDto, List <ResultDto> vitalSignResults, ref DateTime activityStartDate) { var heightResult = vitalSignResults.FirstOrDefault(vsr => vsr.ResultType.DisplayName == BodyHeight); SetActivityDate(heightResult, ref activityStartDate); if (heightResult != null && heightResult.ResultValue != null && heightResult.ResultValue.PhysicalQuantity != null && !string.IsNullOrEmpty(heightResult.ResultValue.PhysicalQuantity.Value)) { var height = GetNullableDoubleValue(heightResult.ResultValue.PhysicalQuantity.Value); if (height.HasValue) { var feet = Math.Floor(height.Value / 12); var inches = ((height.Value - (feet * 12)) / 2.54); vitalSignDto.HeightFeetMeasure = (( int )feet); vitalSignDto.HeightInchesMeasure = Math.Round(inches, 1); } } }