public void Publish(string basePath) { XElement document = new XElement("HL7Message"); Hl7Client client = null; YellowstonePathology.Business.Client.Model.ClientGroupClientCollection hrhGroup = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientGroupClientCollectionByClientGroupId("2"); if (hrhGroup.ClientIdExists(this.m_AccessionOrder.ClientId) == true) { client = new EPICHRHClient(); } else { client = new EPICHl7Client(); } DFTP03 messageType = new DFTP03(); YellowstonePathology.Business.Domain.Physician orderingPhysician = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetPhysicianByPhysicianId(this.m_AccessionOrder.PhysicianId); string locationCode = "YPIIBILLINGS"; if (this.m_PanelSetOrderCPTCodeBill.MedicalRecord.StartsWith("A") == true) { throw new Exception("Cant send CDM for an A Number: " + this.m_AccessionOrder.SvhMedicalRecord); } EPICMshView msh = new EPICMshView(client, messageType, locationCode); msh.ToXml(document); EpicPidView pid = new EpicPidView(this.m_PanelSetOrderCPTCodeBill.MedicalRecord, this.m_AccessionOrder.PLastName, this.m_AccessionOrder.PFirstName, this.m_AccessionOrder.PBirthdate, this.m_AccessionOrder.PSex, this.m_PanelSetOrderCPTCodeBill.Account, this.m_AccessionOrder.PSSN); pid.ToXml(document); Business.Billing.Model.CptCode cptCode = Store.AppDataStore.Instance.CPTCodeCollection.GetClone(this.m_PanelSetOrderCPTCodeBill.CPTCode, this.m_PanelSetOrderCPTCodeBill.Modifier); DateTime transactionDate = m_AccessionOrder.CollectionDate.Value; DateTime transactionPostingDate = this.m_PanelSetOrderCPTCodeBill.PostDate.Value; EPICFT1View epicFT1View = new EPICFT1View(cptCode, transactionDate, transactionPostingDate, this.m_PanelSetOrderCPTCodeBill.Quantity.ToString(), orderingPhysician, this.m_AccessionOrder.MasterAccessionNo); epicFT1View.ToXml(document, 1); string fileName = System.IO.Path.Combine(basePath, this.m_PanelSetOrderCPTCodeBill.PanelSetOrderCPTCodeBillId + "." + cptCode.Code + ".hl7.xml"); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(fileName)) { document.Save(sw); } }
/// <summary> /// Create an Hl7 Client of the given type. /// </summary> /// <param name="hl7ClientType">Hl7 Client Type - enum.</param> /// <param name="fromActor">From Actor instance.</param> /// <param name="toActorName">To Actor Name.</param> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">HL7 Configuration.</param> /// <returns>Hl7 Client.</returns> public static Hl7Client CreateHl7Client(Hl7ClientTypeEnum hl7ClientType, BaseActor fromActor, ActorName toActorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config) { Hl7Client hl7Client = null; switch (hl7ClientType) { case Hl7ClientTypeEnum.Hl7Client: hl7Client = new Hl7Client(fromActor, toActorName, commonConfig, config); break; case Hl7ClientTypeEnum.Unknown: default: break; } return(hl7Client); }
/// <summary> /// Trigger the Actor Instances of the given Actor Type. /// </summary> /// <param name="actorType">Destination Actor Type.</param> /// <param name="trigger">Trigger message.</param> /// <param name="awaitCompletion">Boolean indicating whether this a synchronous call or not.</param> /// <returns>Boolean indicating success or failure.</returns> public bool TriggerActorInstances(ActorTypeEnum actorType, BaseTrigger trigger, bool awaitCompletion) { bool triggerResult = false; // can only trigger an actor that is started if (_actorState == ActorStateEnum.ActorStarted) { triggerResult = true; ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType); foreach (ActorName activeActorName in activeDestinationActors) { if (trigger is Hl7Trigger) { Hl7Client hl7Client = GetHl7Client(activeActorName); if (hl7Client != null) { if (hl7Client.TriggerClient(activeActorName, trigger, awaitCompletion) == false) { // set returned result - but continue with other triggers triggerResult = false; } } } else { DicomClient dicomClient = GetDicomClient(activeActorName); if (dicomClient != null) { if (dicomClient.TriggerClient(activeActorName, trigger, awaitCompletion) == false) { // set returned result - but continue with other triggers triggerResult = false; } } } } } return(triggerResult); }
/// <summary> /// Add an HL7Client for the given Destination Actor Name and Configuration. /// </summary> /// <param name="hl7ClientType">Hl7 Client Type.</param> /// <param name="toActorType">To Actor Type.</param> /// <param name="commonConfig">Common Configuration.</param> /// <param name="peerToPeerConfigCollection">Peer to Peer Configuration collection.</param> protected void AddHl7Client(Hl7ClientTypeEnum hl7ClientType, ActorTypeEnum toActorType, CommonConfig commonConfig, BasePeerToPeerConfigCollection peerToPeerConfigCollection) { foreach (BasePeerToPeerConfig basePeerToPeerConfig in peerToPeerConfigCollection) { if ((basePeerToPeerConfig is Hl7PeerToPeerConfig) && (basePeerToPeerConfig.FromActorName.TypeId == _actorName.TypeId) && (basePeerToPeerConfig.ToActorName.Type == toActorType)) { Hl7Client hl7Client = ClientServerFactory.CreateHl7Client(hl7ClientType, this, basePeerToPeerConfig.ToActorName, commonConfig, (Hl7PeerToPeerConfig)basePeerToPeerConfig); if (hl7Client != null) { SubscribeEvent(hl7Client); _hl7Clients.Add(hl7Client.ActorName.TypeId, hl7Client); // Initialize the connection with the to actor as being active. // - this can always be overruled by the application later. SetActorDefaultConnectionActive(basePeerToPeerConfig.ToActorName); } } } }
public WPHMSHView(Hl7Client client, Hl7MessageType messageType, string locationCode) { this.m_Client = client; this.m_MessageType = messageType; this.m_LocationCode = locationCode; }
public WYDOHMSHView(Hl7Client client, Hl7MessageType messageType) { this.m_Client = client; this.m_MessageType = messageType; }
public PantherMSH() { this.m_Client = new PantherHL7Client(); }
private void SubscribeEvent(Hl7Client hl7Client) { hl7Client.OnTransactionAvailable += new Hl7Client.TransactionAvailableHandler(TransactionIsAvailable); hl7Client.OnMessageAvailable += new Hl7Client.MessageAvailableHandler(MessageIsAvailable); }