protected DvtkData.Dimse.DataSet Hl7ToDicom(Hl7Message message) { DvtkData.Dimse.DataSet dataset = new DvtkData.Dimse.DataSet("Transient"); if (message != null) { // try to get the patient id CommonIdFormat patientId = new CommonIdFormat(); patientId.FromHl7Format(message.Value(new Hl7Tag("PID", 3))); if (patientId.ToDicomFormat() != System.String.Empty) { dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENT_ID.GroupNumber, DvtkData.Dimse.Tag.PATIENT_ID.ElementNumber, DvtkData.Dimse.VR.LO, patientId.ToDicomFormat()); } // try to get the patient's name CommonNameFormat patientName = new CommonNameFormat(); patientName.FromHl7Format(message.Value(new Hl7Tag("PID", 5))); if (patientName.ToDicomFormat() != System.String.Empty) { dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_NAME.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_NAME.ElementNumber, DvtkData.Dimse.VR.PN, patientName.ToDicomFormat()); } // try to get the patient's birth date CommonDateFormat patientBirthDate = new CommonDateFormat(); patientBirthDate.FromHl7Format(message.Value(new Hl7Tag("PID", 7))); if (patientBirthDate.ToDicomFormat() != System.String.Empty) { dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_BIRTH_DATE.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_BIRTH_DATE.ElementNumber, DvtkData.Dimse.VR.DA, patientBirthDate.ToDicomFormat()); } // try to get the patient's sex CommonStringFormat patientSex = new CommonStringFormat(); patientSex.FromHl7Format(message.Value(new Hl7Tag("PID", 8))); if (patientSex.ToDicomFormat() != System.String.Empty) { dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_SEX.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_SEX.ElementNumber, DvtkData.Dimse.VR.CS, patientSex.ToDicomFormat()); } // try to get the merge patient id CommonIdFormat mergePatientId = new CommonIdFormat(); mergePatientId.FromHl7Format(message.Value(new Hl7Tag("MRG", 1))); if (mergePatientId.ToDicomFormat() != System.String.Empty) { dataset.AddAttribute(DvtkData.Dimse.Tag.OTHER_PATIENT_IDS.GroupNumber, DvtkData.Dimse.Tag.OTHER_PATIENT_IDS.ElementNumber, DvtkData.Dimse.VR.LO, mergePatientId.ToDicomFormat()); } } return dataset; }
public override System.String FromHl7ToDicom(System.String hl7Value) { CommonStringFormat commonStringFormat = new CommonStringFormat(); commonStringFormat.FromHl7Format(hl7Value); return commonStringFormat.ToDicomFormat(); }