示例#1
0
        public new DiagnoseBase Clone()
        {
            DiagnoseBase obj = base.Clone() as DiagnoseBase;

            obj.patient  = patient.Clone();
            obj.DiagType = DiagType.Clone();
            obj.ICD10    = ICD10.Clone();
            obj.Dept     = Dept.Clone();
            obj.Doctor   = Doctor.Clone();
            return(obj);
        }
示例#2
0
        /// <summary>
        /// 克隆
        /// </summary>
        /// <returns></returns>
        public new Diagnose Clone()
        {
            Diagnose diagnose = base.Clone() as Diagnose;

            diagnose.Type    = Type.Clone();
            diagnose.Dept    = Dept.Clone();
            diagnose.Doctor  = Doctor.Clone();
            diagnose.Patient = Patient.Clone();
            diagnose.ICD10   = ICD10.Clone();
            return(diagnose);
        }
        public async Task <IActionResult> Index(IndexViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = await _userManager.GetUserAsync(User);

            await UpdateProfileItems(model, user);

            if (User.IsInRole(Roles.DOCTOR))
            {
                var doctor = await _doctorRepository.ReadAsync(User.Identity.Name);

                if (doctor == null)
                {
                    throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId( User )}'.");
                }

                var currentDoctor = Doctor.Clone(doctor);
                currentDoctor.DegreeAbbreviation = model.DegreeAbbreviation;
                currentDoctor.FirstName          = model.FirstName;
                currentDoctor.LastName           = model.LastName;
                currentDoctor.Address1           = model.Address1;
                currentDoctor.Address2           = model.Address2;
                currentDoctor.City  = model.City;
                currentDoctor.State = model.State;
                currentDoctor.Zip1  = model.Zip1;

                currentDoctor.Zip2        = model.Zip2;
                currentDoctor.Email       = model.Email;
                currentDoctor.PhoneNumber = model.PhoneNumber;

                _logger.LogDebug("****************DOCTOR Degree abbrev.: " + model.DegreeAbbreviation + "****************");

                // Update all common items among ApplicationUsers:
                //await UpdateProfileItems( model, currentDoctor );

                await _doctorRepository.UpdateAsync(User.Identity.Name, currentDoctor);
            }
            else if (User.IsInRole(Roles.PATIENT))
            {
                var patient = await _patientRepository.ReadAsync(User.Identity.Name);

                if (patient == null)
                {
                    throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId( User )}'.");
                }

                _logger.LogDebug("****************PATIENT****************");

                var currentPatient = Patient.Clone(patient);
                currentPatient.FirstName = model.FirstName;
                currentPatient.LastName  = model.LastName;
                currentPatient.Address1  = model.Address1;
                currentPatient.Address2  = model.Address2;
                currentPatient.City      = model.City;
                currentPatient.State     = model.State;
                currentPatient.Zip1      = model.Zip1;

                currentPatient.Zip2        = model.Zip2;
                currentPatient.Email       = model.Email;
                currentPatient.PhoneNumber = model.PhoneNumber;
                //await UpdateProfileItems( model, currentPatient );

                //patient.CopyFrom( user );
                if (model.DoctorUserName != null)
                {
                    currentPatient.Doctor = await _doctorRepository.ReadAsync(model.DoctorUserName);

                    //currentPatient.DrUserName = currentPatient.Doctor.UserName;
                    //currentPatient.DoctorId = currentPatient.Doctor.Id;
                } // if

                await _patientRepository.UpdateAsync(User.Identity.Name, currentPatient);
            } // if patient
            else if (User.IsInRole(Roles.DEVELOPER))
            {
                var dev = new Developer
                {
                    FirstName = model.FirstName,
                    LastName  = model.LastName,
                    Address1  = model.Address1,
                    Address2  = model.Address2,
                    City      = model.City,
                    State     = model.State,
                    Zip1      = model.Zip1,
                    Zip2      = model.Zip2,
                    Title     = model.Title
                };
                await _devRepo.UpdateAsync(User.Identity.Name, dev);
            }
            else
            {
                await _userRepository.UpdateAsync(user.UserName, user);
            }

            StatusMessage = "Your profile has been updated";
            return(RedirectToAction(nameof(Index)));
        } // Index