protected override RISObject GetRISObject(DICOMObject dicomObject)
 {
     PatientObject risPatient = new PatientObject();
     DICOMPatientObject dicomPatient = (DICOMPatientObject)dicomObject;
     risPatient.ExternalPatientId.Value = dicomPatient.PatientID.Value;
     risPatient.Name.Value = dicomPatient.Name.Value;
     risPatient.DateOfBirth.Value = dicomPatient.DateOfBirth.Value;
     //risPatient.DateOfBirth.Value = DateTime.Now.ToString();
     risPatient.Gender.Value = dicomPatient.Gender.Value;
     return risPatient;
 }
        protected override RISObject GetRISObject(DICOMObject dicomObject)
        {
            StudyObject risStudy = new StudyObject();
            DICOMStudyObject dicomStudy = (DICOMStudyObject)dicomObject;
            risStudy.StudyStatusId.Value = Constants.StudyStatusTypes.PreRelease;
            risStudy.StudyInstance.Value = dicomStudy.StudyInstance.Value;
            risStudy.AccessionNumber.Value = dicomStudy.AccessionNumber.Value;
            if (((string)dicomStudy.StudyInstance.Value).Equals("1.2.840.113619.2.115.6319156.1266579799.0.2"))
            {
                int debug = 0;
            }
            risStudy.StudyDate.Value = DatabaseUtility.GetDateTime(dicomStudy.StudyDate.Value,dicomStudy.StudyTime.Value);

            //risStudy.Description.Value = dicomStudy.StudyDescription.Value;
            //SetReferringPhysician(dicomStudy, risStudy);
            AssignHospital(dicomStudy, risStudy);

            risStudy.PatientWeight.Value = dicomStudy.PatientsWeight.Value;

            ModalityObject modality = new ModalityObject();
            modality.Name.Value = dicomStudy.StudyModal.Value;
            modality.Load();
            if (!modality.IsLoaded)
            {
                modality.Save();
            }
            risStudy.ModalityId.Value = modality.ModalityId.Value;

            /*if (dicomStudy.StationName.Value != null)
            {
                StationObject station = new StationObject();
                station.ModalityId.Value = modality.GetPrimaryKey().Value;
                station.StationName.Value = dicomStudy.StationName.Value;
                station.Instituition.Value = dicomStudy.Instituition.Value;
                station.Load();
                if (!station.IsLoaded)
                {
                    station.Save();
                }
                risStudy.StationId.Value = station.GetPrimaryKey().Value;
            }*/

            if (dicomStudy.StudyDescription.Value != null)
            {
                ProcedureObject procedure = new ProcedureObject();
                procedure.Name.Value = dicomStudy.StudyDescription.Value;
                procedure.ModalityId.Value = modality.ModalityId.Value;
                procedure.Load();
                if (procedure.IsLoaded == false)
                {
                    procedure.Save();
                }
                risStudy.ProcedureId.Value = procedure.ProcedureId.Value;
            }

            PatientObject patient = new PatientObject();
            patient.ExternalPatientId.Value = dicomStudy.PatientID.Value;
            patient.Load();
            if (patient.IsLoaded)
            {
                risStudy.PatientId.Value = patient.GetPrimaryKey().Value;
            }
            else
            {
                patient.Name.Value = dicomStudy.PatientName.Value;
                patient.DateOfBirth.Value = dicomStudy.PatientDateOfBirth.Value;
                patient.Gender.Value = dicomStudy.PatientSex.Value;
                patient.Save();
                risStudy.PatientId.Value = patient.GetPrimaryKey().Value;
            }
            return risStudy;
        }