/// <summary> /// Handle an HL7 Transation from the given Actor Name. /// </summary> /// <param name="actorName">Source Actor Name.</param> /// <param name="hl7Transaction">HL7 Transaction.</param> protected override void HandleTransactionFrom(ActorName actorName, Hl7Transaction hl7Transaction) { Hl7Message request = hl7Transaction.Request; switch (actorName.Type) { case ActorTypeEnum.DssOrderFiller: // received Procedure Scheduled [RAD-4] or // received Patient Update [Rad-12] or // received Procedure Updated [RAD-13] UpdateImageArchiveActor(request); break; default: break; } }
/// <summary> /// Handle an HL7 Transation from the given Actor Name. /// </summary> /// <param name="actorName">Source Actor Name.</param> /// <param name="hl7Transaction">HL7 Transaction.</param> protected override void HandleTransactionFrom(ActorName actorName, Hl7Transaction hl7Transaction) { switch (actorName.Type) { case ActorTypeEnum.AdtPatientRegistration: // received Patient Registration [RAD-1] or // received Patient Update [RAD-12] break; case ActorTypeEnum.DssOrderFiller: // received Filler Order Management [RAD-3] or // received Appointment Notification [RAD-48] break; default: break; } }
/// <summary> /// Set the Comparators needed to handle each message in the Transaction. /// </summary> /// <param name="comparatorCollection">Comparator collection to fill.</param> public void SetComparators(Dvtk.Comparator.BaseComparatorCollection comparatorCollection) { if (_transaction is DicomTransaction) { System.String name = System.String.Empty; DicomTransaction dicomTransaction = (DicomTransaction)_transaction; switch (dicomTransaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0}:{1} from {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0}:{1} to {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; default: break; } for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++) { DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i]; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.DicomComparator dicomComparator = comparator.InitializeDicomComparator(dicomMessage); if (dicomComparator != null) { comparatorCollection.Add(dicomComparator); } } } else if (_transaction is Hl7Transaction) { System.String name = System.String.Empty; Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction; switch (hl7Transaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0}:{1} from {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0}:{1} to {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; default: break; } Hl7Message hl7Message = hl7Transaction.Request; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.Hl7Comparator hl7Comparator = comparator.InitializeHl7Comparator(hl7Message); if (hl7Comparator != null) { comparatorCollection.Add(hl7Comparator); } } }
/// <summary> /// Log the transaction to the given stream. /// </summary> /// <param name="sw">Stream Writer - log the transaction to this stream.</param> public void LogToStream(StreamWriter sw) { sw.WriteLine("<<- {0} -------------------------------------------------------------->>", _transactionNumber); if (_transaction is DicomTransaction) { DicomTransaction dicomTransaction = (DicomTransaction)_transaction; switch (dicomTransaction.Direction) { case TransactionDirectionEnum.TransactionSent: sw.WriteLine("DICOM Transaction received by {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("from {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; case TransactionDirectionEnum.TransactionReceived: sw.WriteLine("DICOM Transaction sent from {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("to {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; default: break; } sw.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings); for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++) { sw.WriteLine("DICOM Message {0}...", i + 1); DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i]; if (dicomMessage.CommandSet != null) { sw.WriteLine("Command: {0} \"{1}\"", dicomMessage.CommandSet.DimseCommandName, dicomMessage.CommandSet.GetSopClassUid()); } if (dicomMessage.DataSet != null) { sw.WriteLine("Dataset Attributes: {0}", dicomMessage.DataSet.Count); } } } else { Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction; switch (hl7Transaction.Direction) { case TransactionDirectionEnum.TransactionSent: sw.WriteLine("HL7 Transaction received by {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("from {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; case TransactionDirectionEnum.TransactionReceived: sw.WriteLine("HL7 Transaction sent from {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("to {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; default: break; } sw.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings); } sw.WriteLine("Results Filename: \"{0}\"", _resultsFilename); sw.WriteLine("Results Pathname: \"{0}\"", _resultsPathname); sw.WriteLine("<<------------------------------------------------------------------>>"); }
/// <summary> /// Handle an HL7 Transation from the given Actor Name. /// </summary> /// <param name="actorName">Source Actor Name.</param> /// <param name="hl7Transaction">HL7 Transaction.</param> protected override void HandleTransactionFrom(ActorName actorName, Hl7Transaction hl7Transaction) { Hl7Message request = hl7Transaction.Request; switch (actorName.Type) { case ActorTypeEnum.AdtPatientRegistration: // received Patient Registration [RAD-1] or // received Patient Update [RAD-12] if (request.MessageType == "ADT") { switch (request.MessageSubType) { case "A01": { // HandlePatientRegistration(request); } break; case "A08": { HandlePatientUpdate(request); // Generate trigger Hl7Trigger trigger = new Hl7Trigger(TransactionNameEnum.RAD_12); trigger.Trigger = request; // RAD-12 - trigger the ImageManager bool triggerResult = TriggerActorInstances(ActorTypeEnum.ImageManager, trigger, false); } break; case "A40": { HandlePatientMerge(request); // Generate trigger Hl7Trigger trigger = new Hl7Trigger(TransactionNameEnum.RAD_12); trigger.Trigger = request; // RAD-12 - trigger the ImageManager bool triggerResult = TriggerActorInstances(ActorTypeEnum.ImageManager, trigger, false); } break; } } break; case ActorTypeEnum.OrderPlacer: // received Placer Order Management [RAD-2] if (request.MessageType == "ORM") { switch (request.MessageSubType) { case "O01": HandlePlacerOrderManagement(request); break; } } break; default: break; } }
/// <summary> /// Handle an HL7 Transation from the given Actor Name. /// </summary> /// <param name="actorName">Source Actor Name.</param> /// <param name="hl7Transaction">HL7 Transaction.</param> protected virtual void HandleTransactionFrom(ActorName actorName, Hl7Transaction hl7Transaction) { }