public Leadtools.Dicom.Common.DataTypes.PatientUpdater.ChangePatient getChangePatientFromMrg() { if (_changeMrg == null) { _changeMrg = new Dicom.Common.DataTypes.PatientUpdater.ChangePatient(); //transaction info _changeMrg.Description = _adapter.DG1?.Diagnosis_Description.Read(); _changeMrg.Reason = _adapter.EVN?.Event_Reason_Code.Read(); _changeMrg.Operator = _adapter.MSH?.Sending_Application.Read(); _changeMrg.Station = _adapter.MSH?.Sending_Facility.Read(); _changeMrg.Date = DateTime.Now; //LTConvert.ToDateTime(_adapter.MSH?.Date_Time_of_Message?.Month, _adapter.MSH?.Date_Time_of_Message?.Day, _adapter.MSH?.Date_Time_of_Message?.Year); _changeMrg.Time = DateTime.Now; //LTConvert.ToDateTime(_adapter.MSH?.Date_Time_of_Message?.Month, _adapter.MSH?.Date_Time_of_Message?.Day, _adapter.MSH?.Date_Time_of_Message?.Year); _changeMrg.TransactionID = _adapter.MSH?.Message_Control_ID.Read(); //patient - original _changeMrg.OriginalPatientId = DicomValidation.FixText(_adapter.MRG?.Prior_Patient_Identifier_List?[0]?.IDNumber.Read()); if (string.IsNullOrEmpty(_changeMrg.OriginalPatientId)) { _changeMrg.OriginalPatientId = DicomValidation.FixText(_adapter.MRG?.Prior_Patient_ID?.IDNumber.Read()); } //patient - updated _changeMrg.PatientId = DicomValidation.FixText(_adapter.PID?.Patient_Identifier_List?[0]?.IDNumber.Read()); if (string.IsNullOrEmpty(_changeMrg.PatientId)) { _changeMrg.PatientId = DicomValidation.FixText(_adapter.PID?.Patient_ID?.IDNumber.Read()); } _changeMrg.Name = new Dicom.Common.DataTypes.PersonName() { Family = DicomValidation.FixText(_adapter.PID?.Patient_Name?[0]?.FamilyName.Surname.Read()), Given = DicomValidation.FixText(_adapter.PID?.Patient_Name?[0]?.GivenName.Read()), Middle = DicomValidation.FixText(_adapter.PID?.Patient_Name?[0]?.SecondAndFurtherGivenNamesOrInitialsThereof.Read()), Prefix = DicomValidation.FixText(_adapter.PID?.Patient_Name?[0]?.PrefixEgDR.Read()), Suffix = DicomValidation.FixText(_adapter.PID?.Patient_Name?[0]?.SuffixEgJRorIII.Read()), }; _changeMrg.Sex = _adapter.PID?.Administrative_Sex.Read(); if (!DicomValidation.IsValidPatientSex(_changeMrg.Sex)) { _changeMrg.Sex = null; } _changeMrg.Birthdate = LTConvert.ToDateTime(_adapter.PID?.Date_Time_of_Birth?.Month, _adapter.PID?.Date_Time_of_Birth?.Day, _adapter.PID?.Date_Time_of_Birth?.Year); _changeMrg.PatientComments = _adapter.Zxx?.Field_2.Read(); _changeMrg.EthnicGroup = _adapter.PID?.Race.Read(); //_changeMrg.OtherPatientIdsSequence //_changeMrg.ReferencedStudySequence DefaultValuesProvider.Visit(_changeMrg); } return(_changeMrg); }
public Leadtools.Dicom.Common.DataTypes.PatientUpdater.MergePatient getMergePatient() { if (_merge == null) { _merge = new Dicom.Common.DataTypes.PatientUpdater.MergePatient(); _merge.Description = _adapter.DG1?.Diagnosis_Description.Read(); _merge.Reason = _adapter.EVN?.Event_Reason_Code.Read(); _merge.Operator = _adapter.MSH?.Sending_Application.Read(); _merge.Station = _adapter.MSH?.Sending_Facility.Read(); _merge.Date = DateTime.Now; //LTConvert.ToDateTime(_adapter.MSH?.Date_Time_of_Message?.Month, _adapter.MSH?.Date_Time_of_Message?.Day, _adapter.MSH?.Date_Time_of_Message?.Year); _merge.Time = DateTime.Now; //LTConvert.ToDateTime(_adapter.MSH?.Date_Time_of_Message?.Month, _adapter.MSH?.Date_Time_of_Message?.Day, _adapter.MSH?.Date_Time_of_Message?.Year); _merge.TransactionID = _adapter.MSH?.Message_Control_ID.Read(); //patient - updated _merge.PatientId = DicomValidation.FixText(_adapter.PID?.Patient_Identifier_List?[0]?.IDNumber.Read()); if (string.IsNullOrEmpty(_merge.PatientId)) { _merge.PatientId = DicomValidation.FixText(_adapter.PID?.Patient_ID?.IDNumber.Read()); } //patient to merge var mergePatientId = DicomValidation.FixText(_adapter.MRG?.Prior_Patient_Identifier_List?[0]?.IDNumber.Read()); if (string.IsNullOrEmpty(mergePatientId)) { mergePatientId = DicomValidation.FixText(_adapter.MRG?.Prior_Patient_ID?.IDNumber.Read()); } if (!string.IsNullOrEmpty(mergePatientId)) { _merge.PatientToMerge = new List <MergePatientSequence>() { new MergePatientSequence(mergePatientId) }; } //_merge.ReferencedStudySequence DefaultValuesProvider.Visit(_merge); } return(_merge); }