Example #1
0
        public override System.String FromHl7ToDicom(System.String hl7Value)
        {
            CommonStringFormat commonStringFormat = new CommonStringFormat();

            commonStringFormat.FromHl7Format(hl7Value);
            return(commonStringFormat.ToDicomFormat());
        }
Example #2
0
        public override System.String FromDicomToHl7(System.String dicomValue)
        {
            CommonStringFormat commonStringFormat = new CommonStringFormat();

            commonStringFormat.FromDicomFormat(dicomValue);
            return(commonStringFormat.ToHl7Format());
        }
Example #3
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 #4
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);
        }