public ActionResult GetCreatePatientConsultationView()
        {
            PatientConsultationViewModel model = new PatientConsultationViewModel()
            {
                PatientId = PatientId, ConsultationStatus = "NEW"
            };

            ViewBag.Doctors = _IListHandler.GetDoctors();

            return(PartialView("PatientConsultationEditor", model));
        }
        public ActionResult SavePatientConsultation(PatientConsultationViewModel model)
        {
            try
            {
                PatientConsultationViewModel patientConsultationViewModel = _IPatientConsultationHandler.SavePatientConsultation(model);

                PatientConsultationId = patientConsultationViewModel.PatientConsultationId;

                string returnUrl = Url.Action("PatientVitalSigns", "PatientVitalSigns", new { area = "PatientManagement" });

                return(JavaScript("window.location='" + returnUrl + "'"));
            }
            catch (ModelException ex)
            {
                return(Json(new { errors = ex.ModelErrors }));
            }
        }
        public PatientConsultationViewModel SavePatientConsultation(PatientConsultationViewModel patientConsultationViewModel)
        {
            PatientConsultationDtoResponse response = _PhekoServiceClient.SavePatientConsultation(_PatientConsultationViewModelMapper.MapToPatientConsultationDto(patientConsultationViewModel));

            if (response.HasErrors)
            {
                ModelException modelException = new ModelException();

                response.FieldErrors.ToList <FieldError>().ForEach(item => modelException.ModelErrors.Add(new ModelError()
                {
                    FieldName = item.FieldName, Message = item.ErrorMessage
                }));

                throw modelException;
            }

            return(_PatientConsultationViewModelMapper.MapToPatientConsultationViewModel(response.Model));
        }
Exemple #4
0
        public PatientConsultationViewModel MapToPatientConsultationViewModel(PatientConsultationDto patientConsultationDto)
        {
            if (patientConsultationDto == null)
            {
                return(null);
            }

            PatientConsultationViewModel patientConsultationViewModel = new PatientConsultationViewModel();
            CrudOperationsMapper         crudOperationsMapper         = new CrudOperationsMapper();

            patientConsultationViewModel.PatientConsultationId = patientConsultationDto.PatientConsultationId;
            patientConsultationViewModel.PatientId             = patientConsultationDto.PatientId;
            patientConsultationViewModel.DoctorId           = patientConsultationDto.DoctorId;
            patientConsultationViewModel.ConsultationStatus = patientConsultationDto.ConsultationStatus;
            patientConsultationViewModel.StartDate          = Converter.DateToString(patientConsultationDto.StartDate);
            patientConsultationViewModel.EndDate            = Converter.DateToString(patientConsultationDto.EndDate);
            patientConsultationViewModel.CrudOperation      = crudOperationsMapper.MapToModelCrudOperations(patientConsultationDto.CrudOperation);

            return(patientConsultationViewModel);
        }
Exemple #5
0
        public PatientConsultationDto MapToPatientConsultationDto(PatientConsultationViewModel patientConsultationViewModel)
        {
            if (patientConsultationViewModel == null)
            {
                return(null);
            }

            PatientConsultationDto patientConsultationDto = new PatientConsultationDto();
            CrudOperationsMapper   crudOperationsMapper   = new CrudOperationsMapper();

            patientConsultationDto.PatientConsultationId = patientConsultationViewModel.PatientConsultationId;
            patientConsultationDto.PatientId             = patientConsultationViewModel.PatientId == null? int.MinValue : patientConsultationViewModel.PatientId.Value;
            patientConsultationDto.DoctorId           = patientConsultationViewModel.DoctorId == null ? int.MinValue : patientConsultationViewModel.DoctorId.Value;
            patientConsultationDto.ConsultationStatus = patientConsultationViewModel.ConsultationStatus;
            patientConsultationDto.StartDate          = Converter.StringToDate(patientConsultationViewModel.StartDate);
            patientConsultationDto.EndDate            = Converter.StringToDate(patientConsultationViewModel.EndDate);
            patientConsultationDto.CrudOperation      = crudOperationsMapper.MapToCrudOperations(patientConsultationViewModel.CrudOperation);

            return(patientConsultationDto);
        }