public override void startResetThread()
        {
            DialogBoxViewModel.Answer  = "None";
            DialogBoxViewModel.Mode    = "Confirm";
            DialogBoxViewModel.Title   = "Reset Form";
            DialogBoxViewModel.Message = "Resetting form will restore previous values. Proceed?";

            while (DialogBoxViewModel.Answer.Equals("None"))
            {
                Thread.Sleep(100);
            }

            if (DialogBoxViewModel.Answer.Equals("OK"))
            {
                Patient = (Patient)CopyPatient.Clone();
                foreach (PropertyInfo info in GetType().GetProperties())
                {
                    if (info.Name.EndsWith("Error"))
                    {
                        info.SetValue(this, "");
                    }
                }
            }
            DialogBoxViewModel.Answer = "";
        }
示例#2
0
        private void CopyPatient()
        {
            //
            // If the patient ID has changed then we need to see if a patient with that id already exists
            //
            if (_Patient.Id != textBoxId.Text)
            {
                PatientRootQueryPatient query    = new PatientRootQueryPatient();
                List <Patient>          patients = new List <Patient>();

                query.PatientQuery.PatientId = textBoxId.Text;
                try
                {
                    _find.Find <PatientRootQueryPatient, Patient>(_scp, query, (patient, ds) => patients.Add(patient));
                    if (patients.Count > 0)
                    {
                        TaskDialogResult result = TaskDialogResult.Yes;

                        result = TaskDialogHelper.ShowMessageBox(this, "Patient Id Already Exits", "Would you like to merge with existing patient?",
                                                                 "The patient id already exisits.", "Existing Patient: " + patients[0].Name.Full,
                                                                 TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No, TaskDialogStandardIcon.Error, TaskDialogStandardIcon.Warning);

                        if (result == TaskDialogResult.Yes)
                        {
                            radioButtonMerge.Checked = true;
                            textBoxLastname.Text     = patients[0].Name.Family;
                            textBoxFirstname.Text    = patients[0].Name.Given;
                            if (string.IsNullOrEmpty(patients[0].Sex))
                            {
                                comboBoxSex.Text = string.Empty;
                            }
                            else
                            {
                                comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patients[0].Sex);
                            }
                            if (patients[0].BirthDate.HasValue)
                            {
                                dateTimePickerBirth.Value   = patients[0].BirthDate.Value;
                                dateTimePickerBirth.Checked = true;
                            }
                            else
                            {
                                dateTimePickerBirth.Checked = false;
                            }
                        }
                        else
                        {
                            textBoxId.Text = _Patient.Id;
                            return;
                        }
                    }
                }
                catch (Exception e)
                {
                    ApplicationUtils.ShowException(this, e);
                    return;
                }
            }

            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Copying Patient");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                CopyPatient            change = new CopyPatient();
                DicomCommandStatusType status = DicomCommandStatusType.Success;

                change.OriginalPatientId = _Patient.Id.Replace(@"\", @"\\").Replace("'", @"''");
                change.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                change.PatientId         = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Reason            = dlgReason.Reason;
                change.Description       = "Copy Patient";
                change.Name.Given        = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Name.Family       = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Sex = comboBoxSex.Text;
                if (dateTimePickerBirth.Checked)
                {
                    change.Birthdate = dateTimePickerBirth.Value;
                }
                else
                {
                    change.Birthdate = null;
                }

#if (LEADTOOLS_V19_OR_LATER)
                if (textBoxOtherPid.Text.Length > 0)
                {
                    Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID opid = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID();

                    change.OtherPatientIdsSequence = new List <Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID>();
                    opid.PatientId       = textBoxOtherPid.Text.Replace(@"\", @"\\").Replace("'", @"''");
                    opid.TypeOfPatientId = "TEXT";
                    change.OtherPatientIdsSequence.Add(opid);
                }
#endif

                status = _naction.SendNActionRequest <CopyPatient>(_scp, change, NActionScu.CopyPatient, NActionScu.PatientUpdateInstance);
                if (status == DicomCommandStatusType.Success)
                {
                    //_Patient.Id = textBoxId.Text;
                    //_Patient.Name.Given = textBoxFirstname.Text;
                    //_Patient.Name.Family = textBoxLastname.Text;
                    //_Patient.Sex = comboBoxSex.Text;
                    //if (dateTimePickerBirth.Checked)
                    //    _Patient.BirthDate = dateTimePickerBirth.Value;
                    //else
                    //    _Patient.BirthDate = null;
                    Action = ActionType.CopyPatient;
                    TaskDialogHelper.ShowMessageBox(this, "Patient Copied", "The patient has been successfully copied.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    TaskDialogHelper.ShowMessageBox(this, "Copy Error", "The patient has not been successfully copied.", string.Empty,
                                                    "Error - " + _naction.GetErrorMessage(), TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }