示例#1
0
    protected override void Page_Load_Extended(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            lblStudyId.Value = Request[ParameterNames.Request.StudyId];
            if (IsFindingInRequest)
                lblFindingId.Value = Request[ParameterNames.Request.FindingId];
            ShowButtons();

            StudyObject study = new StudyObject();
            study.StudyId.Value = int.Parse(Request[ParameterNames.Request.StudyId]);
            study.Load(loggedInUserId);
            lblExamDate.Text = study.StudyDate.Value.ToString();
            PatientObject patient = new PatientObject();
            patient.PatientId.Value = study.PatientId.Value;
            patient.Load(loggedInUserId);
            lblPatientId.Text = (string)patient.ExternalPatientId.Value;
            lblPatientName.Text = (string)patient.Name.Value;
            StudyStatusTypeObject studyStatusType = new StudyStatusTypeObject();
            studyStatusType.StudyStatusTypeId.Value = study.StudyStatusId.Value;
            studyStatusType.Load(loggedInUserId);
            lblStatus.Text = (string)studyStatusType.Status.Value;
            ProcedureObject procedure = new ProcedureObject();
            procedure.ProcedureId.Value = study.ProcedureId.Value;
            procedure.Load(loggedInUserId);
            if (procedure.IsLoaded)
            {
                lblProcedure.Text = (string)procedure.Name.Value;
            }
            ModalityObject modality = new ModalityObject();
            modality.ModalityId.Value = procedure.ModalityId.Value;
            modality.Load(loggedInUserId);
            lblModality.Text = (string)modality.Name.Value;
            if (study.ReferringPhysicianId.Value != null)
            {
                UserObject referringPhysician = new UserObject();
                referringPhysician.UserId.Value = study.ReferringPhysicianId.Value;
                referringPhysician.Load(loggedInUserId);
                lblPhysician.Text = (string)referringPhysician.Name.Value;
            }
            FindingObject finding = new FindingObject();
            if (IsFindingInRequest)
            {
                finding.GetPrimaryKey().Value = int.Parse(Request[ParameterNames.Request.FindingId]);
                finding.Load(loggedInUserId);
            }
            else if (study.LatestFindingId.Value != null)
            {
                finding.FindingId.Value = study.LatestFindingId.Value;
                finding.Load(loggedInUserId);
            }
            if (finding.IsLoaded)
            {
                tbTrancription.Text = (string)finding.TextualTranscript.Value;
                if (finding.AudioUserId.Value != null)
                {
                    UserObject radiologist = new UserObject();
                    radiologist.UserId.Value = finding.AudioUserId.Value;
                    radiologist.Load(loggedInUserId);
                    lblRadiologist.Text = (string)radiologist.Name.Value;
                }
            }
            int studyStatusId = (int)study.StudyStatusId.Value;

            LogObject log = new LogObject();
            log.UserId.Value = loggedInUserId;
            log.StudyId.Value = study.StudyId.Value;
            log.PatientId.Value = study.PatientId.Value;
            log.Action.Value = Constants.LogActions.ViewedStudy;
            log.ActionTime.Value = DateTime.Now;
            log.Save();
        }
    }
示例#2
0
    public bool Load()
    {
        StudyObject study = new StudyObject();
        study.StudyId.Value = studyId;
        study.Load();
        if (study.IsLoaded)
        {
            if (study.ClientId.Value != null)
            {
                ClientObject client = new ClientObject();
                client.ClientId.Value = study.ClientId.Value;
                client.Load();
                if (client.IsLoaded)
                {
                    _clientName = client.Name.Value.ToString();
                    if (client.Address.Value != null)
                        _clientAddress = client.Address.Value.ToString() + ", ";
                    if (client.City.Value != null)
                        _clientAddress += client.City.Value.ToString() + ", ";
                    if (client.State.Value != null)
                        _clientAddress += client.State.Value.ToString() + " ";
                    if (client.Zip.Value != null)
                        _clientAddress += client.Zip.Value.ToString();
                }
            }
            ModalityObject modality = new ModalityObject();
            modality.ModalityId.Value = study.ModalityId.Value;
            modality.Load();
            if (modality.IsLoaded)
            {
                _modality = modality.Name.Value.ToString();
            }
            if (study.IsManual.Value != null && study.IsManual.Value.ToString().Equals("Y"))
            {
                _manualStatus = "This report was imported from another system.";
            }
            PatientObject patient = new PatientObject();
            patient.GetPrimaryKey().Value = study.PatientId.Value;
            patient.Load();
            if (patient.IsLoaded)
            {
                _patientId = (int)patient.PatientId.Value;
                _patientName = (string)patient.Name.Value;
                if (patient.DateOfBirth.Value != null)
                {
                    _dateOfBirth = ((DateTime)patient.DateOfBirth.Value).ToShortDateString();
                }
            }
            if (study.ReferringPhysicianId != null && study.ReferringPhysicianId.Value != null)
            {
                UserObject user = new UserObject();
                user.UserId.Value = study.ReferringPhysicianId.Value;
                user.Load();
                _referringPhysician = user.Name.Value.ToString();

            }
            else
            {
                _referringPhysician = "(N/A)";
            }
            _studyDate = ((DateTime)study.StudyDate.Value).ToShortDateString();

            FindingObject finding = new FindingObject();
            finding.FindingId.Value = (int)study.LatestFindingId.Value;
            finding.Load();
            if (finding.IsLoaded)
            {
                _transcription = GetTrascription((string)finding.TextualTranscript.Value);
                if (finding.AudioDate.Value != null)
                {
                    _reportDateTime = ((DateTime)finding.AudioDate.Value).ToString();
                    _reportDate = ((DateTime)finding.AudioDate.Value).ToShortDateString();
                }

                if (finding.AudioUserId.Value != null)
                {
                    UserObject radiologist = new UserObject();
                    radiologist.UserId.Value = finding.AudioUserId.Value;
                    radiologist.Load();
                    if (radiologist.IsLoaded)
                    {
                        string[] names = radiologist.Name.Value.ToString().Split(',');
                        if (names != null && names.Length == 2)
                        {
                            string space = " ";
                            if (isHTML) space = " " ;
                            _radiologist = names[1] + space + names[0] + "," + space + "M.D.";
                        }
                        else
                        {
                            _radiologist = radiologist.Name.Value.ToString();
                        }
                    }
                }
            }
            StudyStatusTypeObject studyStatus = new StudyStatusTypeObject();
            studyStatus.StudyStatusTypeId.Value = study.StudyStatusId.Value;
            studyStatus.Load();
            if (studyStatus.IsLoaded)
            {
                _status = (string)studyStatus.Status.Value;
            }

            HospitalObject hospital = new HospitalObject();
            hospital.HospitalId.Value = study.HospitalId.Value;
            hospital.Load();
            if (hospital.IsLoaded)
            {
                _hospitalName = hospital.Name.Value.ToString();
                if (hospital.Fax.Value != null)
                {
                    _fax = (string)hospital.Fax.Value;
                }
            }
            return true;
        }
        return false;
    }
        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;
        }
        protected override RISObject GetRISObject(DICOMObject dicomObject)
        {
            SeriesObject risSeries = new SeriesObject();
            DICOMSeriesObject dicomSeries = (DICOMSeriesObject)dicomObject;
            risSeries.SeriesInstance.Value = dicomSeries.SeriesInstance.Value;
            risSeries.SeriesNumber.Value = dicomSeries.SeriesNumber.Value;
            risSeries.SeriesDate.Value = DatabaseUtility.GetDateTime(dicomSeries.SeriesDate.Value, dicomSeries.SeriesTime.Value);
            risSeries.Description.Value = dicomSeries.Description.Value;
            risSeries.PatientPosition.Value = dicomSeries.PatientPosition.Value;
            risSeries.Contrast.Value = dicomSeries.ContrastBo.Value;
            risSeries.ProtocolName.Value = dicomSeries.ProtocolNa.Value;
            risSeries.FrameOfReference.Value = dicomSeries.FrameOfRef.Value;
            risSeries.BodyPartExamined.Value = dicomSeries.BodyPartEx.Value;

            ModalityObject risModality = new ModalityObject();
            risModality.Name.Value = dicomSeries.Modality.Value;
            risModality.Load();
            if (!risModality.IsLoaded)
            {
                risModality.Save();
            }
            ModalityDetailObject modalityDetail = new ModalityDetailObject();
            modalityDetail.ModalityId.Value = risModality.GetPrimaryKey().Value;
            modalityDetail.Manufacturer.Value = dicomSeries.Manufactur.Value;
            modalityDetail.ModelName.Value = dicomSeries.ModelName.Value;
            modalityDetail.Load();
            if (!modalityDetail.IsLoaded)
            {
                modalityDetail.Save();
            }

            risSeries.ModalityDetailId.Value = modalityDetail.GetPrimaryKey().Value;

            risStudy = new StudyObject();
            risStudy.StudyInstance.Value = dicomSeries.StudyInsta.Value;
            risStudy.Load();
            if (risStudy.IsLoaded)
            {
                risSeries.StudyId.Value = risStudy.StudyId.Value;
                if (dicomSeries.StationName.Value != null)
                {
                    StationObject station = new StationObject();
                    station.ModalityId.Value = risModality.GetPrimaryKey().Value;
                    station.StationName.Value = dicomSeries.StationName.Value;
                    station.Instituition.Value = dicomSeries.Instituition.Value;
                    station.Load();
                    if (!station.IsLoaded)
                    {
                        station.Save();
                    }
                    risStudy.StationId.Value = station.GetPrimaryKey().Value;
                    if (station.HospitalId.Value != null)
                    {
                        risStudy.HospitalId.Value = station.HospitalId.Value;
                    }
                    if (station.ClientId.Value != null)
                    {
                        risStudy.ClientId.Value = station.ClientId.Value;
                    }
                    risStudy.Save();
                }
            }
            else
            {
                risSeries = null;
            }
            return risSeries;
        }