/// <summary> /// Sets the common tags for a typical Modality Worklist Request. /// </summary> public static void SetCommonTags(IDicomAttributeProvider dicomAttributeProvider) { ModalityWorklistIod iod = new ModalityWorklistIod(dicomAttributeProvider); //iod.PatientIdentificationModule.PatientsName.FirstName = "*"; iod.DicomAttributeProvider[DicomTags.PatientsName].SetStringValue("*"); iod.SetAttributeNull(DicomTags.PatientId); iod.SetAttributeNull(DicomTags.PatientsBirthDate); iod.SetAttributeNull(DicomTags.PatientsBirthTime); iod.SetAttributeNull(DicomTags.PatientsWeight); iod.SetAttributeNull(DicomTags.RequestedProcedureId); iod.SetAttributeNull(DicomTags.RequestedProcedureDescription); iod.SetAttributeNull(DicomTags.StudyInstanceUid); iod.SetAttributeNull(DicomTags.ReasonForTheRequestedProcedure); iod.SetAttributeNull(DicomTags.RequestedProcedureComments); iod.SetAttributeNull(DicomTags.RequestedProcedurePriority); iod.SetAttributeNull(DicomTags.ImagingServiceRequestComments); iod.SetAttributeNull(DicomTags.RequestingPhysician); iod.SetAttributeNull(DicomTags.ReferringPhysiciansName); iod.SetAttributeNull(DicomTags.RequestedProcedureLocation); iod.SetAttributeNull(DicomTags.AccessionNumber); iod.SetAttributeNull(DicomTags.PatientsSex); ScheduledProcedureStepSequenceIod scheduledProcedureStepSequenceIod = new ScheduledProcedureStepSequenceIod(); scheduledProcedureStepSequenceIod.SetCommonTags(); iod.ScheduledProcedureStepModule.ScheduledProcedureStepSequenceList.Add(scheduledProcedureStepSequenceIod); //// TODO: this better and easier... //DicomAttributeSQ dicomAttributeSQ = dicomAttributeProvider[DicomTags.ScheduledProcedureStepSequence] as DicomAttributeSQ; //DicomSequenceItem dicomSequenceItem = new DicomSequenceItem(); //dicomAttributeSQ.Values = dicomSequenceItem; //dicomSequenceItem[DicomTags.Modality].SetNullValue(); //dicomSequenceItem[DicomTags.ScheduledProcedureStepId].SetNullValue(); //dicomSequenceItem[DicomTags.ScheduledProcedureStepDescription].SetNullValue(); //dicomSequenceItem[DicomTags.ScheduledStationAeTitle].SetNullValue(); //dicomSequenceItem[DicomTags.ScheduledProcedureStepStartDate].SetNullValue(); //dicomSequenceItem[DicomTags.ScheduledProcedureStepStartTime].SetNullValue(); //dicomSequenceItem[DicomTags.ScheduledPerformingPhysiciansName].SetNullValue(); //dicomSequenceItem[DicomTags.ScheduledProcedureStepLocation].SetNullValue(); //dicomSequenceItem[DicomTags.ScheduledProcedureStepStatus].SetNullValue(); //dicomSequenceItem[DicomTags.CommentsOnTheScheduledProcedureStep].SetNullValue(); }
/// <summary> /// Begins the find request in asynchronous mode. /// </summary> /// <param name="clientAETitle">The client AE title.</param> /// <param name="remoteAE">The remote AE.</param> /// <param name="remoteHost">The remote host.</param> /// <param name="remotePort">The remote port.</param> /// <param name="requestAttributeCollection">The request attribute collection.</param> /// <param name="callback">The callback.</param> /// <param name="asyncState">State of the async.</param> /// <returns></returns> public IAsyncResult BeginGetWorkList(string clientAETitle, string remoteAE, string remoteHost, int remotePort, ModalityWorklistIod modalityWorklistIod, AsyncCallback callback, object asyncState) { ModalityWorklistDelegate modalityWorklistDelegate = new ModalityWorklistDelegate(this.GetWorkList); return modalityWorklistDelegate.BeginInvoke(clientAETitle, remoteAE, remoteHost, remotePort, modalityWorklistIod, callback, asyncState); }
/// <summary> /// Finds the specified modality worklist Iod. /// </summary> /// <param name="clientAETitle">The client AE title.</param> /// <param name="remoteAE">The remote AE.</param> /// <param name="remoteHost">The remote host.</param> /// <param name="remotePort">The remote port.</param> /// <param name="modalityWorklistIod">The modality worklist iod.</param> /// <returns></returns> public IList<ModalityWorklistIod> GetWorkList(string clientAETitle, string remoteAE, string remoteHost, int remotePort, ModalityWorklistIod modalityWorklistIod) { base.Find(clientAETitle, remoteAE, remoteHost, remotePort, modalityWorklistIod.DicomAttributeProvider as DicomAttributeCollection); return this.ModalityWorklistResults; }
void IDicomServerHandler.OnReceiveRequestMessage(DicomServer server, ServerAssociationParameters association, byte presentationID, DicomMessage message) { if (message.CommandField == DicomCommandField.CEchoRequest) { server.SendCEchoResponse(presentationID, message.MessageId, DicomStatuses.Success); return; } ushort id = message.MessageId; String studyInstanceUid = null; String seriesInstanceUid = null; DicomUid sopInstanceUid; String patientId = null; string patientsName = string.Empty; DateTime scheduledProcedureStepStartDate = new DateTime(); PatientIdentificationModuleIod patientIdentificationModuleIod = new PatientIdentificationModuleIod(message.DataSet); PatientMedicalModule patientMedicalModule = new PatientMedicalModule(message.DataSet); ImagingServiceRequestModule imagingServiceRequestModule = new ImagingServiceRequestModule(message.DataSet); ModalityWorklistIod modalityWorklistIod = new ModalityWorklistIod(); modalityWorklistIod.SetCommonTags(); DicomSequenceItem[] seq = message.DataSet[DicomTags.ScheduledProcedureStepSequence].Values as DicomSequenceItem[]; bool patientIdExist = message.DataSet[DicomTags.PatientId].TryGetString(0, out patientId); message.DataSet[DicomTags.PatientsName].TryGetString(0, out patientsName); if (seq != null) { bool ok = seq[0][DicomTags.ScheduledProcedureStepStartDate].TryGetDateTime(0, out scheduledProcedureStepStartDate); if (!(ok|patientIdExist)) { Platform.Log(LogLevel.Error, "Unable to retrieve UIDs from request message, sending failure status."); server.SendCFindCancelRequest(presentationID, message.MessageId); return; } } message.DataSet[DicomTags.SpecificCharacterSet].SetStringValue("ISO_IR 100"); message.DataSet.RemoveAttribute(DicomTags.ReferencedStudySequence); DataSet ds = GetPatientList(scheduledProcedureStepStartDate, scheduledProcedureStepStartDate, patientId, patientsName, 1); if (ds != null) { foreach (DataRow _row in ds.Tables[0].Rows) { message.CommandSet.RemoveAttribute(DicomTags.MessageId); Platform.Log(LogLevel.Debug, "Test", _row); message.DataSet[DicomTags.PatientId].SetStringValue(_row["Patient_ID"].ToString()); message.DataSet[DicomTags.PatientsName].SetStringValue(_row["Nosign_name"].ToString()); message.DataSet[DicomTags.AccessionNumber].SetStringValue(_row["Barcode"].ToString()); if(_row["Sex"].ToString() == "1") { message.DataSet[DicomTags.PatientsSex].SetStringValue("M"); } else { message.DataSet[DicomTags.PatientsSex].SetStringValue("F"); } message.DataSet[DicomTags.PatientsBirthDate].SetNullValue(); message.DataSet[DicomTags.PatientsAge].SetStringValue(_row["AGE"].ToString()); //message.DataSet[DicomTags.RequestedProcedureId].SetStringValue("0000018705"); message.DataSet[DicomTags.StudyInstanceUid].SetUid(0, DicomUid.GenerateUid()); seq[0].RemoveAttribute(DicomTags.ScheduledProtocolCodeSequence); //message.DataSet[DicomTags.ScheduledProcedureStepSequence].SetEmptyValue(); seq[0][DicomTags.Modality].SetStringValue("CR"); seq[0][DicomTags.ScheduledStationAeTitle].SetStringValue("VIETBAIT"); seq[0][DicomTags.ScheduledProcedureStepStartDate].SetDateTime(0, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)); seq[0][DicomTags.ScheduledProcedureStepStartTime].SetNullValue(); DataTable tblTestList = GetTestList(_row["PID"].ToString()); string _testListString = string.Empty; foreach (DataRow testListRow in tblTestList.Rows) { _testListString = string.Concat(_testListString, testListRow["CodeMeaning"].ToString(),"\r\n"); } seq[0][DicomTags.ScheduledProcedureStepDescription].SetStringValue(_testListString); seq[0].RemoveAttribute(DicomTags.ScheduledProcedureStepId); server.SendCFindResponse(presentationID, id, message, DicomStatuses.Pending); } } //Platform.Log(LogLevel.Info, "Received SOP Instance: {0} for patient {1} in syntax {2}", sopInstanceUid, // patientName, syntax.Name); DicomMessage noDataSetMessage = new DicomMessage(); server.SendCFindResponse(presentationID, id, noDataSetMessage, DicomStatuses.Success); }