Пример #1
0
        /// <summary>
        /// Constructs an instance of <see cref="WorkQueueSummary"/> based on a <see cref="WorkQueue"/> object.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        /// <remark>
        ///
        /// </remark>
        private WorkQueueSummary CreateWorkQueueSummary(WorkQueue item)
        {
            WorkQueueSummary summary = new WorkQueueSummary
            {
                TheWorkQueueItem = item,
                ThePartition     = Partition
            };

            // Fetch the patient info:
            StudyStorageAdaptor ssAdaptor = new StudyStorageAdaptor();
            StudyStorage        storages  = ssAdaptor.Get(item.StudyStorageKey);

            if (storages == null)
            {
                summary.PatientId    = "N/A";
                summary.PatientsName = "N/A";
                return(summary);
            }
            StudyAdaptor        studyAdaptor  = new StudyAdaptor();
            StudySelectCriteria studycriteria = new StudySelectCriteria();

            studycriteria.StudyInstanceUid.EqualTo(storages.StudyInstanceUid);
            studycriteria.ServerPartitionKey.EqualTo(item.ServerPartitionKey);
            IList <Study> studyList = studyAdaptor.Get(studycriteria);

            if (studyList == null || studyList.Count == 0)
            {
                summary.PatientId    = "N/A";
                summary.PatientsName = "N/A";
            }
            else
            {
                summary.PatientId    = studyList[0].PatientId;
                summary.PatientsName = studyList[0].PatientsName;
            }

            if (item.WorkQueueTypeEnum == WorkQueueTypeEnum.WebMoveStudy ||
                item.WorkQueueTypeEnum == WorkQueueTypeEnum.AutoRoute)
            {
                DeviceDataAdapter deviceAdaptor = new DeviceDataAdapter();
                Device            dest          = deviceAdaptor.Get(item.DeviceKey);

                summary.Notes = String.Format("Destination AE : {0}", dest.AeTitle);

                if (item.FailureDescription != null)
                {
                    summary.FullDescription = String.Format("{0}, {1}", summary.Notes, item.FailureDescription);                       //Set the FullDescription for the Tooltip in the GUI
                    summary.Notes           = summary.FullDescription.Length > 60
                                                ? summary.FullDescription.Substring(0, 60)
                                                : summary.FullDescription;
                }
            }
            else if (item.FailureDescription != null)
            {
                // This used to only be shown when the status was "Failed" for a
                // queue entry.  We now show it any time there's
                if (item.FailureDescription.Length > 60)
                {
                    summary.Notes           = item.FailureDescription.Substring(0, 60);
                    summary.Notes          += " ...";
                    summary.FullDescription = item.FailureDescription;                  //Set the FullDescription for the Tooltip in the GUI
                }
                else
                {
                    summary.Notes = item.FailureDescription;
                }
            }

            summary.RequiresAttention = item.WorkQueueStatusEnum.Equals(WorkQueueStatusEnum.Failed) || !ServerPlatform.IsActiveWorkQueue(item);
            return(summary);
        }
Пример #2
0
		/// <summary>
		/// Constructs an instance of <see cref="WorkQueueSummary"/> based on a <see cref="WorkQueue"/> object.
		/// </summary>
		/// <param name="item"></param>
		/// <returns></returns>
		/// <remark>
		/// 
		/// </remark>
		private WorkQueueSummary CreateWorkQueueSummary(WorkQueue item)
		{
			WorkQueueSummary summary = new WorkQueueSummary
			                           	{
			                           		TheWorkQueueItem = item,
			                           		ThePartition = Partition
			                           	};

			// Fetch the patient info:
			StudyStorageAdaptor ssAdaptor = new StudyStorageAdaptor();
			StudyStorage storages = ssAdaptor.Get(item.StudyStorageKey);
			if (storages == null)
			{
				summary.PatientId = "N/A";
				summary.PatientsName = "N/A";
				return summary;
			}
			StudyAdaptor studyAdaptor = new StudyAdaptor();
			StudySelectCriteria studycriteria = new StudySelectCriteria();
			studycriteria.StudyInstanceUid.EqualTo(storages.StudyInstanceUid);
			studycriteria.ServerPartitionKey.EqualTo(item.ServerPartitionKey);
			IList<Study> studyList = studyAdaptor.Get(studycriteria);

			if (studyList == null || studyList.Count == 0)
			{
				summary.PatientId = "N/A";
				summary.PatientsName = "N/A";
			}
			else
			{
				summary.PatientId = studyList[0].PatientId;
				summary.PatientsName = studyList[0].PatientsName;
			}

			if (item.WorkQueueTypeEnum == WorkQueueTypeEnum.WebMoveStudy
			    || item.WorkQueueTypeEnum == WorkQueueTypeEnum.AutoRoute)
			{
				DeviceDataAdapter deviceAdaptor = new DeviceDataAdapter();
				Device dest = deviceAdaptor.Get(item.DeviceKey);

				summary.Notes = String.Format("Destination AE : {0}", dest.AeTitle);

				if (item.FailureDescription != null)
				{
					summary.FullDescription = String.Format("{0}, {1}", summary.Notes, item.FailureDescription);   //Set the FullDescription for the Tooltip in the GUI
					summary.Notes = summary.FullDescription.Length > 60 
						? summary.FullDescription.Substring(0, 60) 
						: summary.FullDescription;
				}
			}
			else if (item.FailureDescription != null)
			{
				// This used to only be shown when the status was "Failed" for a 
				// queue entry.  We now show it any time there's 
				if (item.FailureDescription.Length > 60)
				{
					summary.Notes = item.FailureDescription.Substring(0, 60);
					summary.Notes += " ...";
				    summary.FullDescription = item.FailureDescription;  //Set the FullDescription for the Tooltip in the GUI
				}
				else
					summary.Notes = item.FailureDescription;
			}

            summary.RequiresAttention = item.WorkQueueStatusEnum.Equals(WorkQueueStatusEnum.Failed) || !ServerPlatform.IsActiveWorkQueue(item);
			return summary;
		}
        private static WorkQueueDetails CreateWebMoveStudyWorkQueueItemDetails(Model.WorkQueue item)
        {
            var          deviceAdaptor       = new DeviceDataAdapter();
            var          studyStorageAdaptor = new StudyStorageAdaptor();
            StudyStorage studyStorage        = studyStorageAdaptor.Get(item.StudyStorageKey);
            var          wqUidsAdaptor       = new WorkQueueUidAdaptor();
            var          studyAdaptor        = new StudyAdaptor();
            Device       dest = deviceAdaptor.Get(item.DeviceKey);

            var detail = new WebMoveStudyWorkQueueDetails();

            detail.Key = item.GetKey();

            detail.DestinationAE     = dest == null ? string.Empty : dest.AeTitle;
            detail.StudyInstanceUid  = studyStorage == null ? string.Empty : studyStorage.StudyInstanceUid;
            detail.ScheduledDateTime = item.ScheduledTime;
            detail.ExpirationTime    = item.ExpirationTime;
            detail.InsertTime        = item.InsertTime;
            detail.FailureCount      = item.FailureCount;
            detail.Type               = item.WorkQueueTypeEnum;
            detail.Status             = item.WorkQueueStatusEnum;
            detail.Priority           = item.WorkQueuePriorityEnum;
            detail.ServerDescription  = item.ProcessorID;
            detail.FailureDescription = item.FailureDescription;

            StudyStorageLocation storage = WorkQueueController.GetLoadStorageLocation(item);

            detail.StorageLocationPath = storage.GetStudyPath();

            // Fetch UIDs
            var uidCriteria = new WorkQueueUidSelectCriteria();

            uidCriteria.WorkQueueKey.EqualTo(item.GetKey());
            IList <WorkQueueUid> uids = wqUidsAdaptor.Get(uidCriteria);

            var mapSeries = new Hashtable();

            foreach (WorkQueueUid uid in uids)
            {
                if (mapSeries.ContainsKey(uid.SeriesInstanceUid) == false)
                {
                    mapSeries.Add(uid.SeriesInstanceUid, uid.SopInstanceUid);
                }
            }

            detail.NumInstancesPending = uids.Count;
            detail.NumSeriesPending    = mapSeries.Count;


            // Fetch the study and patient info
            if (studyStorage != null)
            {
                var studycriteria = new StudySelectCriteria();
                studycriteria.StudyInstanceUid.EqualTo(studyStorage.StudyInstanceUid);
                studycriteria.ServerPartitionKey.EqualTo(item.ServerPartitionKey);
                Study study = studyAdaptor.GetFirst(studycriteria);

                // Study may not be available until the images are processed.
                if (study != null)
                {
                    var studyAssembler = new StudyDetailsAssembler();
                    detail.Study = studyAssembler.CreateStudyDetail(study);
                }
            }

            return(detail);
        }
Пример #4
0
        private static WorkQueueDetails CreateWebMoveStudyWorkQueueItemDetails(Model.WorkQueue item)
        {
            var deviceAdaptor = new DeviceDataAdapter();
            var studyStorageAdaptor = new StudyStorageAdaptor();
            StudyStorage studyStorage = studyStorageAdaptor.Get(item.StudyStorageKey);
            var wqUidsAdaptor = new WorkQueueUidAdaptor();
            var studyAdaptor = new StudyAdaptor();
            Device dest = deviceAdaptor.Get(item.DeviceKey);

            var detail = new WebMoveStudyWorkQueueDetails();
            detail.Key = item.GetKey();

            detail.DestinationAE = dest == null ? string.Empty : dest.AeTitle;
            detail.StudyInstanceUid = studyStorage == null ? string.Empty : studyStorage.StudyInstanceUid;
            detail.ScheduledDateTime = item.ScheduledTime;
            detail.ExpirationTime = item.ExpirationTime;
            detail.InsertTime = item.InsertTime;
            detail.FailureCount = item.FailureCount;
            detail.Type = item.WorkQueueTypeEnum;
            detail.Status = item.WorkQueueStatusEnum;
            detail.Priority = item.WorkQueuePriorityEnum;
            detail.ServerDescription = item.ProcessorID;
            detail.FailureDescription = item.FailureDescription;

            StudyStorageLocation storage = WorkQueueController.GetLoadStorageLocation(item);
            detail.StorageLocationPath = storage.GetStudyPath();

            // Fetch UIDs
            var uidCriteria = new WorkQueueUidSelectCriteria();
            uidCriteria.WorkQueueKey.EqualTo(item.GetKey());
            IList<WorkQueueUid> uids = wqUidsAdaptor.Get(uidCriteria);

            var mapSeries = new Hashtable();
            foreach (WorkQueueUid uid in uids)
            {
                if (mapSeries.ContainsKey(uid.SeriesInstanceUid) == false)
                    mapSeries.Add(uid.SeriesInstanceUid, uid.SopInstanceUid);
            }

            detail.NumInstancesPending = uids.Count;
            detail.NumSeriesPending = mapSeries.Count;


            // Fetch the study and patient info
            if (studyStorage != null)
            {
                var studycriteria = new StudySelectCriteria();
                studycriteria.StudyInstanceUid.EqualTo(studyStorage.StudyInstanceUid);
                studycriteria.ServerPartitionKey.EqualTo(item.ServerPartitionKey);
                Study study = studyAdaptor.GetFirst(studycriteria);

                // Study may not be available until the images are processed.
                if (study != null)
                {
                    var studyAssembler = new StudyDetailsAssembler();
                    detail.Study = studyAssembler.CreateStudyDetail(study);
                }
            }

            return detail;
        }