コード例 #1
0
ファイル: StudyDataSource.cs プロジェクト: hksonngan/Xian
        /// <summary>
        /// Returns an instance of <see cref="StudySummary"/> based on a <see cref="Study"/> object.
        /// </summary>
        /// <param name="study"></param>
        /// <param name="read"></param>
        /// <returns></returns>
        /// <remark>
        ///
        /// </remark>
        static public StudySummary CreateStudySummary(IPersistenceContext read, Study study)
        {
            if (study == null)
            {
                return(null);
            }

            var studySummary = new StudySummary();
            var controller   = new StudyController();

            studySummary.Key             = study.GetKey();
            studySummary.AccessionNumber = study.AccessionNumber;
            studySummary.NumberOfStudyRelatedInstances = study.NumberOfStudyRelatedInstances;
            studySummary.NumberOfStudyRelatedSeries    = study.NumberOfStudyRelatedSeries;
            studySummary.PatientId               = study.PatientId;
            studySummary.PatientsName            = study.PatientsName;
            studySummary.StudyDate               = study.StudyDate;
            studySummary.StudyInstanceUid        = study.StudyInstanceUid;
            studySummary.StudyDescription        = study.StudyDescription;
            studySummary.ModalitiesInStudy       = controller.GetModalitiesInStudy(read, study);
            studySummary.ReferringPhysiciansName = study.ReferringPhysiciansName;
            studySummary.ResponsibleOrganization = study.ResponsibleOrganization;
            studySummary.ResponsiblePerson       = study.ResponsiblePerson;
            studySummary.StudyTime               = study.StudyTime;
            studySummary.StudyId  = study.StudyId;
            studySummary.TheStudy = study;

            studySummary.ThePartition = ServerPartitionMonitor.Instance.FindPartition(study.ServerPartitionKey) ??
                                        ServerPartition.Load(read, study.ServerPartitionKey);

            studySummary.ReferringPhysiciansName = study.ReferringPhysiciansName;
            studySummary.TheStudyStorage         = StudyStorage.Load(read, study.StudyStorageKey);
            studySummary.StudyStatusEnum         = studySummary.TheStudyStorage.StudyStatusEnum;
            studySummary.QueueStudyStateEnum     = studySummary.TheStudyStorage.QueueStudyStateEnum;

            studySummary.TheArchiveLocation = controller.GetFirstArchiveStudyStorage(read, studySummary.TheStudyStorage.Key);

            studySummary.IsArchiving = controller.GetArchiveQueueCount(study) > 0;

            studySummary.IsProcessing = studySummary.TheStudyStorage.WriteLock;

            // the study is considered "locked" if it's being processed or some action which requires the lock has been scheduled
            // No additional action should be allowed on the study until everything is completed.
            studySummary.IsLocked = studySummary.IsProcessing ||
                                    (studySummary.TheStudyStorage.QueueStudyStateEnum != QueueStudyStateEnum.Idle);

            if (controller.GetStudyIntegrityQueueCount(studySummary.TheStudyStorage.Key) > 0)
            {
                studySummary.IsReconcileRequired = true;
            }

            studySummary.HasPendingExternalEdit = controller.GetCountPendingExternalEditWorkQueueItems(study) > 0;
            if (studySummary.HasPendingExternalEdit)
            {
                studySummary.HasPendingWorkQueueItems = true;
            }
            else
            {
                studySummary.HasPendingWorkQueueItems = controller.GetCountPendingWorkQueueItems(study) > 0;
            }

            var ep = new StudySummaryAssemblerExtensionPoint();

            foreach (IStudySummaryAssembler assemblerPlugin in ep.CreateExtensions())
            {
                assemblerPlugin.PopulateStudy(studySummary, study);
            }

            return(studySummary);
        }
コード例 #2
0
ファイル: StudyDataSource.cs プロジェクト: nhannd/Xian
		/// <summary>
		/// Returns an instance of <see cref="StudySummary"/> based on a <see cref="Study"/> object.
		/// </summary>
		/// <param name="study"></param>
		/// <param name="read"></param>
		/// <returns></returns>
		/// <remark>
		/// 
		/// </remark>
		static public StudySummary CreateStudySummary(IPersistenceContext read, Study study)
		{
            if (study==null)
			{
			    return null;
			}

			var studySummary = new StudySummary();
			var controller = new StudyController();

			studySummary.Key = study.GetKey();
			studySummary.AccessionNumber = study.AccessionNumber;
			studySummary.NumberOfStudyRelatedInstances = study.NumberOfStudyRelatedInstances;
			studySummary.NumberOfStudyRelatedSeries = study.NumberOfStudyRelatedSeries;
			studySummary.PatientId = study.PatientId;
			studySummary.PatientsName = study.PatientsName;
			studySummary.StudyDate = study.StudyDate;
			studySummary.StudyInstanceUid = study.StudyInstanceUid;
			studySummary.StudyDescription = study.StudyDescription;
			studySummary.ModalitiesInStudy = controller.GetModalitiesInStudy(read, study);
		    studySummary.ReferringPhysiciansName = study.ReferringPhysiciansName;
		    studySummary.ResponsibleOrganization = study.ResponsibleOrganization;
		    studySummary.ResponsiblePerson = study.ResponsiblePerson;
			studySummary.StudyTime = study.StudyTime;
			studySummary.StudyId = study.StudyId;
			studySummary.TheStudy = study;

			studySummary.ThePartition = ServerPartitionMonitor.Instance.FindPartition(study.ServerPartitionKey) ??
			                            ServerPartition.Load(read, study.ServerPartitionKey);

		    studySummary.ReferringPhysiciansName = study.ReferringPhysiciansName;
			studySummary.TheStudyStorage = StudyStorage.Load(read, study.StudyStorageKey);
			studySummary.StudyStatusEnum = studySummary.TheStudyStorage.StudyStatusEnum;
			studySummary.QueueStudyStateEnum = studySummary.TheStudyStorage.QueueStudyStateEnum;

			studySummary.TheArchiveLocation = controller.GetFirstArchiveStudyStorage(read, studySummary.TheStudyStorage.Key);

			studySummary.IsArchiving = controller.GetArchiveQueueCount(study) > 0;

			studySummary.IsProcessing = studySummary.TheStudyStorage.WriteLock;

			// the study is considered "locked" if it's being processed or some action which requires the lock has been scheduled
			// No additional action should be allowed on the study until everything is completed.
			studySummary.IsLocked = studySummary.IsProcessing ||
			                        (studySummary.TheStudyStorage.QueueStudyStateEnum != QueueStudyStateEnum.Idle);
           
    		if (controller.GetStudyIntegrityQueueCount(studySummary.TheStudyStorage.Key) > 0)
			{
				studySummary.IsReconcileRequired = true;
			}

		    studySummary.HasPendingExternalEdit = controller.GetCountPendingExternalEditWorkQueueItems(study) > 0;
            if (studySummary.HasPendingExternalEdit)            
                studySummary.HasPendingWorkQueueItems = true;            
            else
		        studySummary.HasPendingWorkQueueItems = controller.GetCountPendingWorkQueueItems(study) > 0;
            
            var ep = new StudySummaryAssemblerExtensionPoint();
            foreach (IStudySummaryAssembler assemblerPlugin in ep.CreateExtensions())
            {
                assemblerPlugin.PopulateStudy(studySummary, study);
            }

			return studySummary;
		}
コード例 #3
0
        protected void LoadStudy()
        {
            if (String.IsNullOrEmpty(_studyInstanceUid))
                return;

            if (_partition == null)
                return;

		
			StudyAdaptor studyAdaptor = new StudyAdaptor();
			StudySelectCriteria criteria = new StudySelectCriteria();
			criteria.StudyInstanceUid.EqualTo(_studyInstanceUid);
			criteria.ServerPartitionKey.EqualTo(Partition.GetKey());
			Study study = studyAdaptor.GetFirst(HttpContextData.Current.ReadContext, criteria);

            if (study != null)
            {
                _study = StudySummaryAssembler.CreateStudySummary(HttpContextData.Current.ReadContext, study);
            }
            else
            {
                StudyNotFoundException exception =
                    new StudyNotFoundException(_studyInstanceUid);
                ExceptionHandler.ThrowException(exception);
            }
			
        	StudyDetailsPanel.Study = _study;
            StudyDetailsPanel.DataBind();

	        GenerateAuditLog();
        }
コード例 #4
0
		/// <summary>
		/// Tries to find the study that appears on the current page.
		/// </summary>
		/// <param name="key"></param>
		/// <param name="study"></param>
		/// <returns></returns>
	    private bool TryFindStudySummaryOnCurrentPage(string key, out StudySummary study)
	    {
		    study = null;
			if (_studies != null && _studies.ToList().Exists(x => x.Key.Key.ToString().Equals(key)))
				study = _studies.First(x => x.Key.Key.ToString().Equals(key));

		    return study != null;

	    }