public DicomQueryParams GetDicomQueryParams() { DicomQueryParams q = new DicomQueryParams(); // Patient q.PatientName = this.PatientName; q.PatientId = this.PatientId; // Modalities q.Modalities = this.Modalities; // Studies q.StudyId = this.StudyId; q.AccessionNumber = this.AccessionNumber; q.ReferringPhysiciansName = this.ReferringPhysiciansName; q.StudyFromChecked = this.StudyFromChecked; q.StudyToChecked = this.StudyToChecked; q.StudyFromDate = this.StudyFromDate; q.StudyToDate = this.StudyToDate; // Storage Date q.StorageDateChecked = this.StorageDateChecked; q.StorageDateRange = this.StorageDateRangeFilter; // q.SeriesDescription = this.SeriesDescription; #if (LEADTOOLS_V19_OR_LATER_STORE_AE_TITLE) || (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V18_OR_LATER) q.StoreAeTitle = this.StoreAETitleTextBox.Text.Trim(); q.RetrieveAeTitle = this.RetrieveAETitleTextBox.Text.Trim(); #endif return(q); }
// To use a custom database schema with the Database Manager, you must define a custom MyPrepareSearch method // and assign it to the StorageDatabaseManager.PrepareSearch delegate. After doing this, the search fields in the Database Manager //will properly refine any database manager search. The MyPrepareSearch() method gets the search fields specified in the database manager // by calling StorageDatabaseManager.GetDicomQueryParams(). This returns any query parameters specified. // The MyPrepareSearch() method then needs to create a MatchingParameterCollection that corresponds to the specified search. // Note that the database manager search fields correspond to items contained in the patient, study, and series tables only. // There are no search fields that correspond to the image table. // Therefore MyPrepareSearch() only needs to add MyPatient, MyStudy, and MySeries objects to the MatchingParameterList. // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial. private void MyPrepareSearch(MatchingParameterCollection matchingCollection) { DicomQueryParams q = __DbManager.GetDicomQueryParams(); try { MatchingParameterList matchingList = new MatchingParameterList(); MyPatient patient = new MyPatient(); MyStudy study = new MyStudy(); MySeries series = new MySeries(); matchingList.Add(patient); matchingList.Add(study); matchingList.Add(series); matchingCollection.Add(matchingList); study.StudyAccessionNumber = q.AccessionNumber; patient.PatientIdentification = q.PatientId; if (!string.IsNullOrEmpty(q.PatientName.FamilyName)) { patient.PatientName = q.PatientName.FamilyName.TrimEnd('*') + "*"; } if (!string.IsNullOrEmpty(q.PatientName.GivenName)) { patient.PatientName = q.PatientName.GivenName.TrimEnd('*') + "*"; } if (!string.IsNullOrEmpty(q.Modalities)) { series.SeriesModality = q.Modalities.Replace(",", "\\"); } ; if (!string.IsNullOrEmpty(q.SeriesDescription)) { series.SeriesSeriesDescription = q.SeriesDescription.TrimEnd('*') + "*"; } if (!string.IsNullOrEmpty(q.ReferringPhysiciansName.FamilyName)) { study.StudyReferringPhysiciansName = q.ReferringPhysiciansName.FamilyName.TrimEnd('*') + "*"; } ; if (!string.IsNullOrEmpty(q.ReferringPhysiciansName.GivenName)) { study.StudyReferringPhysiciansName = q.ReferringPhysiciansName.GivenName.TrimEnd('*') + "*"; } ; if (q.StudyFromChecked || q.StudyToChecked) { DateRange studyDateRange = new DateRange(); if (q.StudyFromChecked) { studyDateRange.StartDate = q.StudyFromDate; } if (q.StudyToChecked) { studyDateRange.EndDate = q.StudyToDate; } study.StudyStudyDate = studyDateRange; } if (q.StorageDateChecked) { MyInstance instance = new MyInstance(); DateRange dateRange = new DateRange(); DateRangeFilter StorageDateRangeFilter = q.StorageDateRange; string startDate = StorageDateRangeFilter.DateRangeFrom; string endDate = StorageDateRangeFilter.DateRangeTo; if (StorageDateRangeFilter.SelectedDateFilter == DateRangeFilter.RangeFilterType.DateRange) { if (!string.IsNullOrEmpty(startDate)) { dateRange.StartDate = DateTime.Parse(startDate); } if (!string.IsNullOrEmpty(endDate)) { dateRange.EndDate = DateTime.Parse(endDate); } } else if (StorageDateRangeFilter.SelectedDateFilter == DateRangeFilter.RangeFilterType.Months) { DateTime lastMonthsDate = DateTime.Now.SubtractMonths(Convert.ToInt32(StorageDateRangeFilter.LastMonths)); dateRange.StartDate = lastMonthsDate; dateRange.EndDate = DateTime.Now; } else { TimeSpan subtractionDays = new TimeSpan(Convert.ToInt32(StorageDateRangeFilter.LastDays), DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond); dateRange.StartDate = DateTime.Now.Subtract(subtractionDays); dateRange.EndDate = DateTime.Now; } instance.ImageLastStoreDate = dateRange; matchingList.Add(instance); } study.StudyStudyId = q.StudyId; } catch (Exception exception) { throw exception; } finally { // do nothing ; } }
public void PrepareSearchDefault(MatchingParameterCollection matchingCollection) { try { // matchingCollection = new MatchingParameterCollection ( ) ; MatchingParameterList matchingList = new MatchingParameterList(); Patient patient = new Patient(); Study study = new Study(); Series series = new Series(); matchingList.Add(patient); matchingList.Add(study); matchingList.Add(series); matchingCollection.Add(matchingList); DicomQueryParams q = GetDicomQueryParams(); study.AccessionNumber = q.AccessionNumber;// txtAccessionNumber.Text ; patient.PatientID = q.PatientId; if (!string.IsNullOrEmpty(q.PatientName.FamilyName)) { patient.FamilyName = q.PatientName.FamilyName.TrimEnd('*') + "*"; } if (!string.IsNullOrEmpty(q.PatientName.GivenName)) { patient.GivenName = q.PatientName.GivenName.TrimEnd('*') + "*"; } if (!string.IsNullOrEmpty(q.Modalities)) { series.Modality = q.Modalities.Replace(",", "\\"); } if (!string.IsNullOrEmpty(q.SeriesDescription)) { series.SeriesDescription = q.SeriesDescription.TrimEnd('*') + "*"; } if (!string.IsNullOrEmpty(q.ReferringPhysiciansName.FamilyName)) { study.ReferDrFamilyName = q.ReferringPhysiciansName.FamilyName.TrimEnd('*') + "*"; } ; if (!string.IsNullOrEmpty(q.ReferringPhysiciansName.GivenName)) { study.ReferDrGivenName = q.ReferringPhysiciansName.GivenName.TrimEnd('*') + "*"; } ; if (q.StudyFromChecked || q.StudyToChecked) { DateRange studyDateRange; studyDateRange = new DateRange(); if (q.StudyFromChecked) { studyDateRange.StartDate = q.StudyFromDate; } if (q.StudyToChecked) { studyDateRange.EndDate = q.StudyToDate; } study.StudyDate = studyDateRange; } Instance instance = null; if (StorageDateCheckBox.Checked) { DateRange dateRange; string startDate; string endDate; instance = new Instance(); dateRange = new DateRange(); startDate = StorageDateRangeFilter.DateRangeFrom; endDate = StorageDateRangeFilter.DateRangeTo; if (StorageDateRangeFilter.SelectedDateFilter == DateRangeFilter.RangeFilterType.DateRange) { if (!string.IsNullOrEmpty(startDate)) { dateRange.StartDate = DateTime.Parse(startDate); } if (!string.IsNullOrEmpty(endDate)) { dateRange.EndDate = DateTime.Parse(endDate); } } else if (StorageDateRangeFilter.SelectedDateFilter == DateRangeFilter.RangeFilterType.Months) { DateTime lastMonthsDate; lastMonthsDate = SubtractMonths(DateTime.Now, Convert.ToInt32(StorageDateRangeFilter.LastMonths)); dateRange.StartDate = lastMonthsDate; dateRange.EndDate = DateTime.Now; } else { TimeSpan subtractionDays; subtractionDays = new TimeSpan(Convert.ToInt32(StorageDateRangeFilter.LastDays), DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond); dateRange.StartDate = DateTime.Now.Subtract(subtractionDays); dateRange.EndDate = DateTime.Now; } instance.ReceiveDate = dateRange; matchingList.Add(instance); } if (!string.IsNullOrEmpty(q.RetrieveAeTitle) || !string.IsNullOrEmpty(q.StoreAeTitle)) { if (instance == null) { instance = new Instance(); matchingList.Add(instance); } instance.RetrieveAETitle = q.RetrieveAeTitle; instance.StoreAETitle = q.StoreAeTitle; } study.StudyID = q.StudyId; } catch (Exception exception) { throw exception; } }