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); } }
private XElement CreateDocument() { XElement document = new XElement("HL7Message"); EPICHl7Client client = new EPICHl7Client(); DFTP03 messageType = new DFTP03(); string locationCode = "YPIIBILLINGS"; if (this.m_AccessionOrder.SvhMedicalRecord.StartsWith("A") == true) { locationCode = "SVHNPATH"; } EPICMshView msh = new EPICMshView(client, messageType, locationCode); msh.ToXml(document); EpicPidView pid = new EpicPidView(this.m_AccessionOrder.SvhMedicalRecord, this.m_AccessionOrder.PLastName, this.m_AccessionOrder.PFirstName, this.m_AccessionOrder.PBirthdate, this.m_AccessionOrder.PSex, this.m_AccessionOrder.SvhAccount, this.m_AccessionOrder.PSSN); pid.ToXml(document); DateTime transactionDate = this.m_PanelSetOrderCPTCodeBill.PostDate.Value; EPICFT1View epicFT1View = new EPICFT1View(this.m_CptCode, transactionDate, transactionDate, this.m_PanelSetOrderCPTCodeBill.Quantity.ToString(), this.m_OrderingPhysician); epicFT1View.ToXml(document); return document; }