Example #1
0
        /// <summary>
        /// Check if the objects are equal.
        /// </summary>
        /// <param name="obj">Comparison object.</param>
        /// <returns>bool indicating true = equal or false  = not equal.</returns>
        public override bool Equals(object obj)
        {
            bool equals = false;

            if (obj is CommonIdFormat)
            {
                CommonIdFormat thatCommonId = (CommonIdFormat)obj;
                if (this.Id == thatCommonId.Id)
                {
                    equals = true;
                }
            }
            return(equals);
        }
Example #2
0
        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;
        }
Example #3
0
 public override System.String FromHl7ToDicom(System.String hl7Value)
 {
     CommonIdFormat commonIdFormat = new CommonIdFormat();
     commonIdFormat.FromHl7Format(hl7Value);
     return commonIdFormat.ToDicomFormat();
 }
Example #4
0
        private BaseCommonDataFormat CreateCommonDateFormat(AttributeBase attribute)
        {
            BaseCommonDataFormat commonDataFormat = new CommonStringFormat();

            switch (this.compareRule.CompareValueType)
            {
                case CompareValueTypes.Date:
                    commonDataFormat = new CommonDateFormat();
                    break;

                case CompareValueTypes.ID:
                    commonDataFormat = new CommonIdFormat();
                    break;

                case CompareValueTypes.Name:
                    commonDataFormat = new CommonNameFormat();
                    break;

                case CompareValueTypes.String:
                    commonDataFormat = new CommonStringFormat();
                    break;

                case CompareValueTypes.Time:
                    commonDataFormat = new CommonTimeFormat();
                    break;

                case CompareValueTypes.UID:
                    commonDataFormat = new CommonUidFormat();
                    break;

                default:
                    // Do nothing.
                    break;
            }

            if (attribute is DicomAttribute)
            {
                DvtkHighLevelInterface.Dicom.Other.Attribute dicomAttributeOnly = (attribute as DicomAttribute).AttributeOnly;

                if (dicomAttributeOnly.VM == 0)
                {
                    commonDataFormat.FromDicomFormat("");
                }
                else
                {
                    commonDataFormat.FromDicomFormat(dicomAttributeOnly.Values[0]);
                }

            }
            else if (attribute is Hl7Attribute)
            {
                commonDataFormat.FromHl7Format((attribute as Hl7Attribute).AttributeOnly);
            }
            else
            {
                throw new System.Exception("Not supposed to get here.");
            }

            return(commonDataFormat);
        }
Example #5
0
 public override System.String FromDicomToHl7(System.String dicomValue)
 {
     CommonIdFormat commonIdFormat = new CommonIdFormat();
     commonIdFormat.FromDicomFormat(dicomValue);
     return commonIdFormat.ToHl7Format();
 }