public override void ToXml(XElement document) { SurgicalTestOrder panelSetOrderSurgical = (SurgicalTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo); this.AddNextObxElementBeaker("Report No", this.m_ReportNo, document, "F"); YellowstonePathology.Business.Amendment.Model.AmendmentCollection amendmentCollection = this.m_AccessionOrder.AmendmentCollection.GetAmendmentsForReport(panelSetOrderSurgical.ReportNo); this.InformRevisedDiagnosis(document, amendmentCollection); StringBuilder finalDiagnosis = new StringBuilder(); foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection) { finalDiagnosis.AppendLine("Specimen: " + surgicalSpecimen.SpecimenOrder.SpecimenNumber.ToString()); YellowstonePathology.Business.Helper.DateTimeJoiner collectionDateTimeJoiner = new YellowstonePathology.Business.Helper.DateTimeJoiner(surgicalSpecimen.SpecimenOrder.CollectionDate.Value, surgicalSpecimen.SpecimenOrder.CollectionTime); finalDiagnosis.AppendLine("Collection Date: " + collectionDateTimeJoiner.DisplayString); YellowstonePathology.Business.Test.Model.TestOrderCollection specimenTestOrders = surgicalSpecimen.SpecimenOrder.GetTestOrders(panelSetOrderSurgical.GetTestOrders()); if (this.ERPRExistsInCollection(specimenTestOrders) == true) { finalDiagnosis.AppendLine("Fixation type: " + surgicalSpecimen.SpecimenOrder.LabFixation); finalDiagnosis.AppendLine("Time to fixation: " + surgicalSpecimen.SpecimenOrder.TimeToFixationHourString); finalDiagnosis.AppendLine("Duration of Fixation: " + surgicalSpecimen.SpecimenOrder.FixationDurationString); } finalDiagnosis.AppendLine("Diagnosis: " + surgicalSpecimen.Diagnosis); finalDiagnosis.AppendLine(); } this.AddNextObxElementBeaker("Final Diagnosis", finalDiagnosis.ToString(), document, "F"); if (string.IsNullOrEmpty(panelSetOrderSurgical.Comment) == false) { this.AddNextObxElementBeaker("Comment", panelSetOrderSurgical.Comment, document, "F"); } if (string.IsNullOrEmpty(panelSetOrderSurgical.CancerSummary) == false) { this.AddNextObxElementBeaker("Cancer Summary", panelSetOrderSurgical.CancerSummary, document, "F"); if (string.IsNullOrEmpty(panelSetOrderSurgical.AJCCStage) == false) { this.AddNextObxElementBeaker("TNM Stage", panelSetOrderSurgical.AJCCStage, document, "F"); } } this.AddNextObxElementBeaker("Pathologist Signature", panelSetOrderSurgical.Signature, document, "F"); if (panelSetOrderSurgical.FinalTime.HasValue == true) { this.AddNextObxElementBeaker("Final Date", panelSetOrderSurgical.FinalTime.Value.ToString("MM/dd/yyyy HH:mm"), document, "F"); } if (amendmentCollection.Count != 0) { StringBuilder amendments = new StringBuilder(); foreach (YellowstonePathology.Business.Amendment.Model.Amendment amendment in amendmentCollection) { if (amendment.Final == true) { amendments.AppendLine(amendment.AmendmentType + ": " + amendment.AmendmentDate.Value.ToString("MM/dd/yyyy")); amendments.AppendLine(amendment.Text); if (amendment.RequirePathologistSignature == true) { amendments.AppendLine("Signature: " + amendment.PathologistSignature); amendments.AppendLine("E-signed " + amendment.FinalTime.Value.ToString("MM/dd/yyyy HH:mm")); } if (amendment.RevisedDiagnosis == true || amendment.ShowPreviousDiagnosis == true) { amendments.AppendLine(); string amendmentId = amendment.AmendmentId; foreach (YellowstonePathology.Business.Test.Surgical.SurgicalAudit surgicalAudit in panelSetOrderSurgical.SurgicalAuditCollection) { if (surgicalAudit.AmendmentId == amendmentId) { string finalDateP = YellowstonePathology.Business.BaseData.GetShortDateString(panelSetOrderSurgical.FinalDate); finalDateP += " " + YellowstonePathology.Business.BaseData.GetMillitaryTimeString(panelSetOrderSurgical.FinalTime); amendments.AppendLine("Previous diagnosis on " + finalDateP); foreach (YellowstonePathology.Business.Test.Surgical.SurgicalSpecimenAudit specimenAudit in surgicalAudit.SurgicalSpecimenAuditCollection) { if (specimenAudit.AmendmentId == amendmentId) { string diagnosisIDP = specimenAudit.DiagnosisId + ". "; string specimenTypeP = specimenAudit.SpecimenOrder.Description + ":"; amendments.AppendLine(diagnosisIDP + specimenTypeP); amendments.AppendLine(specimenAudit.Diagnosis); amendments.AppendLine(); } } YellowstonePathology.Business.User.SystemUser pathologistUser = YellowstonePathology.Business.User.SystemUserCollectionInstance.Instance.SystemUserCollection.GetSystemUserById(surgicalAudit.PathologistId); amendments.AppendLine("Signature: " + pathologistUser.Signature); amendments.AppendLine(); } } } } } amendments.AppendLine(); this.AddNextObxElementBeaker("Amendments", amendments.ToString(), document, "F"); } this.AddNextObxElementBeaker("Microscopic Description", panelSetOrderSurgical.MicroscopicX, document, "F"); if (panelSetOrderSurgical.SurgicalSpecimenCollection.HasIC() == true) { StringBuilder intraoperativeConsultation = new StringBuilder(); foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection) { if (surgicalSpecimen.IntraoperativeConsultationResultCollection.Count != 0) { foreach (IntraoperativeConsultationResult icItem in surgicalSpecimen.IntraoperativeConsultationResultCollection) { intraoperativeConsultation.AppendLine(surgicalSpecimen.DiagnosisId + ". " + surgicalSpecimen.SpecimenOrder.Description); intraoperativeConsultation.AppendLine(icItem.Result); } } } this.AddNextObxElementBeaker("Intraoperative Consultation", intraoperativeConsultation.ToString(), document, "F"); } if (panelSetOrderSurgical.TypingStainCollection.Count > 0) { StringBuilder ancillaryStudies = new StringBuilder(); ancillaryStudies.AppendLine(panelSetOrderSurgical.GetAncillaryStudyComment()); foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection) { if (surgicalSpecimen.StainResultItemCollection.Count > 0) { ancillaryStudies.AppendLine(surgicalSpecimen.SpecimenOrder.SpecimenNumber.ToString() + ". " + surgicalSpecimen.SpecimenOrder.Description); foreach (YellowstonePathology.Business.SpecialStain.StainResultItem stainResultItem in surgicalSpecimen.StainResultItemCollection) { if (stainResultItem.Reportable) { string stainResult = stainResultItem.Result; if (string.IsNullOrEmpty(stainResult) == true) { stainResult = "Pending"; } else if (stainResult.ToUpper() == "SEE COMMENT") { stainResult = stainResultItem.ReportComment; } else { string specialStainReportComment = stainResultItem.ReportComment; if (!string.IsNullOrEmpty(specialStainReportComment)) { stainResult += " - " + specialStainReportComment; } } ancillaryStudies.AppendLine("Test: " + stainResultItem.ProcedureName); ancillaryStudies.AppendLine("Result: " + stainResultItem.Result); } ancillaryStudies.AppendLine(); } } } this.AddNextObxElementBeaker("Ancillary Studies", ancillaryStudies.ToString(), document, "F"); } if (string.IsNullOrEmpty(this.m_AccessionOrder.ClinicalHistory) == false) { this.AddNextObxElementBeaker("Clinical Information", this.m_AccessionOrder.ClinicalHistory, document, "F"); } this.AddNextObxElementBeaker("Gross Description", panelSetOrderSurgical.GrossX, document, "F"); this.AddNextObxElementBeaker("Additional Testing", this.m_AccessionOrder.PanelSetOrderCollection.GetAdditionalTestingString(panelSetOrderSurgical.ReportNo), document, "F"); string immunoComment = panelSetOrderSurgical.GetImmunoComment(); if (immunoComment.Length > 0) { this.AddNextObxElementBeaker("Immuno Comment", immunoComment, document, "F"); } YellowstonePathology.Business.Test.Model.TestOrderCollection testOrders = panelSetOrderSurgical.GetTestOrders(); if (this.ERPRExistsInCollection(testOrders) == true) { YellowstonePathology.Business.Test.ErPrSemiQuantitative.ErPrSemiQuantitativeResult result = new ErPrSemiQuantitative.ErPrSemiQuantitativeResult(); this.AddNextObxElementBeaker("References", result.ReportReferences, document, "F"); } string locationPerformed = panelSetOrderSurgical.GetLocationPerformedComment(); this.AddNextObxElementBeaker("Location Performed", locationPerformed, document, "F"); }
public override void ToXml(XElement document) { SurgicalTestOrder panelSetOrderSurgical = (SurgicalTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo); this.AddHeader(document, panelSetOrderSurgical, "Surgical Pathology Report"); this.AddNextObxElement("", document, "F"); YellowstonePathology.Business.Amendment.Model.AmendmentCollection amendmentCollection = this.m_AccessionOrder.AmendmentCollection.GetAmendmentsForReport(panelSetOrderSurgical.ReportNo); this.InformRevisedDiagnosis(document, amendmentCollection); foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection) { this.AddNextObxElement("Specimen: " + surgicalSpecimen.SpecimenOrder.SpecimenNumber.ToString(), document, "F"); this.HandleLongString(surgicalSpecimen.SpecimenOrder.Description, document, "F"); YellowstonePathology.Business.Helper.DateTimeJoiner collectionDateTimeJoiner = new YellowstonePathology.Business.Helper.DateTimeJoiner(surgicalSpecimen.SpecimenOrder.CollectionDate.Value, surgicalSpecimen.SpecimenOrder.CollectionTime); this.AddNextObxElement("Collection Date/Time: " + collectionDateTimeJoiner.DisplayString, document, "F"); YellowstonePathology.Business.Test.Model.TestOrderCollection specimenTestOrders = surgicalSpecimen.SpecimenOrder.GetTestOrders(panelSetOrderSurgical.GetTestOrders()); if (this.ERPRExistsInCollection(specimenTestOrders) == true) { this.AddNextObxElement("Fixation type: " + surgicalSpecimen.SpecimenOrder.LabFixation, document, "F"); this.AddNextObxElement("Time to fixation: " + surgicalSpecimen.SpecimenOrder.TimeToFixationHourString, document, "F"); this.AddNextObxElement("Duration of Fixation: " + surgicalSpecimen.SpecimenOrder.FixationDurationString, document, "F"); } this.AddNextObxElement("", document, "F"); this.AddNextObxElement("Diagnosis: ", document, "F"); this.HandleLongString(surgicalSpecimen.Diagnosis, document, "F"); this.AddNextObxElement("", document, "F"); } if (string.IsNullOrEmpty(panelSetOrderSurgical.Comment) == false) { this.AddNextObxElement("Comment: ", document, "F"); this.HandleLongString(panelSetOrderSurgical.Comment, document, "F"); this.AddNextObxElement("", document, "F"); } if (string.IsNullOrEmpty(panelSetOrderSurgical.CancerSummary) == false) { this.AddNextObxElement("Cancer Summary: ", document, "F"); this.HandleLongString(panelSetOrderSurgical.CancerSummary, document, "F"); this.AddNextObxElement("", document, "F"); if (string.IsNullOrEmpty(panelSetOrderSurgical.AJCCStage) == false) { this.HandleLongString("Pathologic TNM Stage: " + panelSetOrderSurgical.AJCCStage, document, "F"); this.AddNextObxElement(string.Empty, document, "F"); } } this.AddNextObxElement("Pathologist: " + panelSetOrderSurgical.Signature, document, "F"); if (panelSetOrderSurgical.FinalTime.HasValue == true) { this.AddNextObxElement("E-signed " + panelSetOrderSurgical.FinalTime.Value.ToString("MM/dd/yyyy HH:mm"), document, "F"); } this.AddNextObxElement("", document, "F"); this.AddAmendments(document); this.AddNextObxElement("Microscopic Description: ", document, "F"); this.HandleLongString(panelSetOrderSurgical.MicroscopicX, document, "F"); this.AddNextObxElement(string.Empty, document, "F"); if (panelSetOrderSurgical.SurgicalSpecimenCollection.HasIC() == true) { foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection) { if (surgicalSpecimen.IntraoperativeConsultationResultCollection.Count != 0) { foreach (IntraoperativeConsultationResult icItem in surgicalSpecimen.IntraoperativeConsultationResultCollection) { this.AddNextObxElement(surgicalSpecimen.DiagnosisId + ". " + surgicalSpecimen.SpecimenOrder.Description, document, "F"); this.HandleLongString(icItem.Result, document, "F"); } } } this.AddNextObxElement(string.Empty, document, "F"); } if (panelSetOrderSurgical.TypingStainCollection.Count > 0) { this.AddNextObxElement("Ancillary Studies:", document, "F"); string ancillaryComment = panelSetOrderSurgical.GetAncillaryStudyComment(); this.HandleLongString(ancillaryComment, document, "F"); foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection) { if (surgicalSpecimen.StainResultItemCollection.Count > 0) { this.HandleLongString(surgicalSpecimen.SpecimenOrder.SpecimenNumber.ToString() + ". " + surgicalSpecimen.SpecimenOrder.Description, document, "F"); foreach (YellowstonePathology.Business.SpecialStain.StainResultItem stainResultItem in surgicalSpecimen.StainResultItemCollection) { if (stainResultItem.Reportable) { string stainResult = stainResultItem.Result; if (string.IsNullOrEmpty(stainResult) == true) { stainResult = "Pending"; } else if (stainResult.ToUpper() == "SEE COMMENT") { stainResult = stainResultItem.ReportComment; } else { string specialStainReportComment = stainResultItem.ReportComment; if (!string.IsNullOrEmpty(specialStainReportComment)) { stainResult += " - " + specialStainReportComment; } } this.HandleLongString("Test: " + stainResultItem.ProcedureName + " Result: " + stainResult, document, "F"); } } this.AddNextObxElement(string.Empty, document, "F"); } } } this.AddNextObxElement("Clinical Information: ", document, "F"); if (string.IsNullOrEmpty(this.m_AccessionOrder.ClinicalHistory) == false) { this.HandleLongString(this.m_AccessionOrder.ClinicalHistory, document, "F"); } else { this.AddNextObxElement("none", document, "F"); } this.AddNextObxElement("", document, "F"); this.AddNextObxElement("Gross Description: ", document, "F"); this.HandleLongString(panelSetOrderSurgical.GrossX, document, "F"); this.AddNextObxElement("", document, "F"); this.AddNextObxElement("Additional Testing: ", document, "F"); this.HandleLongString(this.m_AccessionOrder.PanelSetOrderCollection.GetAdditionalTestingString(panelSetOrderSurgical.ReportNo), document, "F"); this.AddNextObxElement("", document, "F"); string immunoComment = panelSetOrderSurgical.GetImmunoComment(); if (immunoComment.Length > 0) { this.HandleLongString(immunoComment, document, "F"); this.AddNextObxElement(string.Empty, document, "F"); } YellowstonePathology.Business.Test.Model.TestOrderCollection testOrders = panelSetOrderSurgical.GetTestOrders(); if (this.ERPRExistsInCollection(testOrders) == true) { YellowstonePathology.Business.Test.ErPrSemiQuantitative.ErPrSemiQuantitativeResult result = new ErPrSemiQuantitative.ErPrSemiQuantitativeResult(); this.AddNextObxElement("ER/PR References:", document, "F"); this.HandleLongString(result.ReportReferences, document, "F"); this.AddNextObxElement("", document, "F"); } string locationPerformed = panelSetOrderSurgical.GetLocationPerformedComment(); this.AddNextObxElement(locationPerformed, document, "F"); this.AddNextObxElement(string.Empty, document, "F"); }
private bool SpecimenHasERPR(YellowstonePathology.Business.Specimen.Model.SpecimenOrder specimenOrder, SurgicalTestOrder panelSetOrder) { bool result = false; YellowstonePathology.Business.Test.Model.TestOrderCollection testOrders = specimenOrder.GetTestOrders(panelSetOrder.GetTestOrders()); if (testOrders.ExistsByTestId("99") == true) { result = true; } return(result); }