Пример #1
0
        public override void AddAmendments(XElement document)
        {
            SurgicalTestOrder panelSetOrder = (SurgicalTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);

            YellowstonePathology.Business.Amendment.Model.AmendmentCollection amendmentCollection = this.m_AccessionOrder.AmendmentCollection.GetAmendmentsForReport(panelSetOrder.ReportNo);
            foreach (YellowstonePathology.Business.Amendment.Model.Amendment amendment in amendmentCollection)
            {
                if (amendment.Final == true)
                {
                    this.AddNextObxElement(amendment.AmendmentType + ": " + amendment.AmendmentDate.Value.ToString("MM/dd/yyyy"), document, "C");
                    this.HandleLongString(amendment.Text, document, "C");
                    if (amendment.RequirePathologistSignature == true)
                    {
                        this.AddNextObxElement("Signature: " + amendment.PathologistSignature, document, "C");
                        this.AddNextObxElement("E-signed " + amendment.FinalTime.Value.ToString("MM/dd/yyyy HH:mm"), document, "C");
                    }
                    this.AddNextObxElement("", document, "C");

                    if (amendment.RevisedDiagnosis == true || amendment.ShowPreviousDiagnosis == true)
                    {
                        string amendmentId = amendment.AmendmentId;
                        foreach (YellowstonePathology.Business.Test.Surgical.SurgicalAudit surgicalAudit in panelSetOrder.SurgicalAuditCollection)
                        {
                            if (surgicalAudit.AmendmentId == amendmentId)
                            {
                                string finalDateP = YellowstonePathology.Business.BaseData.GetShortDateString(panelSetOrder.FinalDate);
                                finalDateP += " " + YellowstonePathology.Business.BaseData.GetMillitaryTimeString(panelSetOrder.FinalTime);

                                string previousDiagnosisHeader = "Previous diagnosis on " + finalDateP;
                                this.AddNextObxElement(previousDiagnosisHeader, document, "C");

                                foreach (YellowstonePathology.Business.Test.Surgical.SurgicalSpecimenAudit specimenAudit in surgicalAudit.SurgicalSpecimenAuditCollection)
                                {
                                    if (specimenAudit.AmendmentId == amendmentId)
                                    {
                                        string diagnosisIDP  = specimenAudit.DiagnosisId + ".";
                                        string specimenTypeP = specimenAudit.SpecimenOrder.Description + ":";
                                        this.AddNextObxElement(diagnosisIDP + specimenTypeP, document, "C");

                                        this.HandleLongString(specimenAudit.Diagnosis, document, "C");
                                    }
                                }

                                YellowstonePathology.Business.User.SystemUser pathologistUser = YellowstonePathology.Business.User.SystemUserCollectionInstance.Instance.SystemUserCollection.GetSystemUserById(surgicalAudit.PathologistId);
                                this.AddNextObxElement(pathologistUser.Signature, document, "C");
                                this.AddNextObxElement("", document, "F");
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public override void Render()
        {
            SurgicalTestOrder panelSetOrderSurgical = (SurgicalTestOrder)this.m_PanelSetOrder;

            this.m_TemplateName = @"\\Cfileserver\Documents\ReportTemplates\XmlTemplates\Surgical.3.xml";

            base.OpenTemplate();

            YellowstonePathology.Business.Amendment.Model.AmendmentCollection amendmentCollection = this.m_AccessionOrder.AmendmentCollection.GetAmendmentsForReport(this.m_PanelSetOrder.ReportNo);

            panelSetOrderSurgical.GrossX          = YellowstonePathology.Business.Common.SpellChecker.FixString(panelSetOrderSurgical.GrossX);
            panelSetOrderSurgical.MicroscopicX    = YellowstonePathology.Business.Common.SpellChecker.FixString(panelSetOrderSurgical.MicroscopicX);
            panelSetOrderSurgical.CancerSummary   = YellowstonePathology.Business.Common.SpellChecker.FixString(panelSetOrderSurgical.CancerSummary);
            this.m_AccessionOrder.ClinicalHistory = YellowstonePathology.Business.Common.SpellChecker.FixString(this.m_AccessionOrder.ClinicalHistory);
            panelSetOrderSurgical.Comment         = YellowstonePathology.Business.Common.SpellChecker.FixString(panelSetOrderSurgical.Comment);

            foreach (YellowstonePathology.Business.Test.Surgical.SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection)
            {
                surgicalSpecimen.Diagnosis = YellowstonePathology.Business.Common.SpellChecker.FixString(surgicalSpecimen.Diagnosis);
            }

            foreach (YellowstonePathology.Business.Amendment.Model.Amendment amendment in amendmentCollection)
            {
                amendment.Text = YellowstonePathology.Business.Common.SpellChecker.FixString(amendment.Text);
            }

            this.SetDemographicsV2();

            this.SetReportDistribution();
            this.SetCaseHistory();

            string amendmentTitle = string.Empty;

            if (amendmentCollection.Count > 0)
            {
                for (int i = amendmentCollection.Count - 1; i >= 0; i--)
                {
                    if (amendmentCollection[i].Final == true)
                    {
                        amendmentTitle = amendmentCollection[i].AmendmentType;
                        if (amendmentTitle == "Correction")
                        {
                            amendmentTitle = "Corrected";
                        }
                        if (amendmentCollection[i].RevisedDiagnosis == true)
                        {
                            this.SetXmlNodeData("Amendment", "Revised");
                        }
                        else
                        {
                            this.SetXmlNodeData("Amendment", amendmentTitle);
                        }
                        break;
                    }
                }
            }
            this.SetXmlNodeData("Amendment", amendmentTitle);

            XmlNode mainTableNode       = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='microscopic_description']", this.m_NameSpaceManager);
            XmlNode diagnosisTableNode  = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='s_id']", this.m_NameSpaceManager);
            XmlNode rowSpecimenNode     = diagnosisTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='s_id']", this.m_NameSpaceManager);
            XmlNode rowDiagnosisNode    = diagnosisTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='diagnosis']", this.m_NameSpaceManager);
            XmlNode rowSpecimenBlankRow = diagnosisTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='specimen_blank_row']", this.m_NameSpaceManager);
            XmlNode insertAfterRow      = rowSpecimenNode;

            foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection)
            {
                XmlNode rowSpecimenNodeClone = rowSpecimenNode.Clone();
                string  diagnosisID          = surgicalSpecimen.DiagnosisId + ".";
                string  specimenType         = surgicalSpecimen.SpecimenOrder.Description + ":";
                rowSpecimenNodeClone.SelectSingleNode("descendant::w:r[w:t='s_id']/w:t", this.m_NameSpaceManager).InnerText          = diagnosisID;
                rowSpecimenNodeClone.SelectSingleNode("descendant::w:r[w:t='specimen_type']/w:t", this.m_NameSpaceManager).InnerText = specimenType;
                diagnosisTableNode.InsertAfter(rowSpecimenNodeClone, insertAfterRow);

                XmlNode rowDiagnosisNodeClone = rowDiagnosisNode.Clone();
                string  diagnosis             = surgicalSpecimen.Diagnosis;

                this.SetXMLNodeParagraphDataNode(rowDiagnosisNodeClone, "diagnosis", diagnosis);
                diagnosisTableNode.InsertAfter(rowDiagnosisNodeClone, rowSpecimenNodeClone);

                insertAfterRow = rowDiagnosisNodeClone;
            }

            if (string.IsNullOrEmpty(panelSetOrderSurgical.Comment) == true | panelSetOrderSurgical.Comment.ToUpper() == "NONE")
            {
                XmlNode rowComment = diagnosisTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='report_comment']", this.m_NameSpaceManager);
                diagnosisTableNode.RemoveChild(rowComment);
            }
            else
            {
                this.SetXMLNodeParagraphData("report_comment", panelSetOrderSurgical.Comment);
            }

            YellowstonePathology.Business.Document.AmendmentSection amendmentSection = new YellowstonePathology.Business.Document.AmendmentSection();
            amendmentSection.SetAmendment(amendmentCollection, this.m_ReportXml, this.m_NameSpaceManager, true);

            diagnosisTableNode.RemoveChild(rowSpecimenNode);
            diagnosisTableNode.RemoveChild(rowDiagnosisNode);
            diagnosisTableNode.RemoveChild(rowSpecimenBlankRow);

            XmlNode tableNodeP            = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='sidp']", this.m_NameSpaceManager);
            XmlNode rowPreviousDiagnosis  = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='previous_diagnosis_header']", this.m_NameSpaceManager);
            XmlNode rowSpecimenNodeP      = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='sidp']", this.m_NameSpaceManager);
            XmlNode rowDiagnosisNodeP     = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='diagnosis_previous']", this.m_NameSpaceManager);
            XmlNode rowCommentP           = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='report_comment_previous']", this.m_NameSpaceManager);
            XmlNode rowPreviousSignatureP = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='previous_signature']", this.m_NameSpaceManager);
            XmlNode rowBlankLine1P        = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='previous_diagnosis_blank_line1']", this.m_NameSpaceManager);
            XmlNode rowBlankLine2P        = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='previous_diagnosis_blank_line2']", this.m_NameSpaceManager);

            if (amendmentCollection.Count != 0)
            {
                if (amendmentCollection.HasFinalRevisedDiagnosis() == true)
                {
                    YellowstonePathology.Business.Amendment.Model.Amendment revisedDiagnosisAmendment = amendmentCollection.GetMostRecentFinalRevisedDiagnosis();
                    XmlNode rowRevisedDiagnosisHeader = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='Diagnosis:']", this.m_NameSpaceManager);
                    string  finalDateHead             = YellowstonePathology.Business.BaseData.GetShortDateString(revisedDiagnosisAmendment.FinalDate);
                    finalDateHead += " " + YellowstonePathology.Business.BaseData.GetMillitaryTimeString(revisedDiagnosisAmendment.FinalTime);
                    rowRevisedDiagnosisHeader.SelectSingleNode("descendant::w:r[w:t='Diagnosis:']/w:t", this.m_NameSpaceManager).InnerText = "Revised Diagnosis: " + finalDateHead;
                }

                XmlNode insertAfterRowP = rowPreviousDiagnosis;

                for (int counter = 0; counter < amendmentCollection.Count; counter++)
                {
                    YellowstonePathology.Business.Amendment.Model.Amendment amendment = amendmentCollection[counter];
                    if (amendment.RevisedDiagnosis == true || amendment.ShowPreviousDiagnosis == true)
                    {
                        string amendmentId = amendment.AmendmentId;
                        foreach (YellowstonePathology.Business.Test.Surgical.SurgicalAudit surgicalAudit in panelSetOrderSurgical.SurgicalAuditCollection)
                        {
                            if (surgicalAudit.AmendmentId == amendmentId)
                            {
                                string finalDateP = string.Empty;

                                finalDateP  = YellowstonePathology.Business.BaseData.GetShortDateString(this.m_PanelSetOrder.FinalDate);
                                finalDateP += " " + YellowstonePathology.Business.BaseData.GetMillitaryTimeString(panelSetOrderSurgical.FinalTime);

                                XmlNode rowSpecimenBlankRowP            = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='specimen_blank_row_previous']", this.m_NameSpaceManager);
                                XmlNode rowPreviousDiagnosisHeaderClone = rowPreviousDiagnosis.Clone();
                                string  previousDiagnosisHeader         = "Previous diagnosis on " + finalDateP;
                                rowPreviousDiagnosisHeaderClone.SelectSingleNode("descendant::w:r[w:t='previous_diagnosis_header']/w:t", this.m_NameSpaceManager).InnerText = previousDiagnosisHeader;
                                tableNodeP.InsertAfter(rowPreviousDiagnosisHeaderClone, insertAfterRowP);
                                insertAfterRowP = rowPreviousDiagnosisHeaderClone;

                                foreach (YellowstonePathology.Business.Test.Surgical.SurgicalSpecimenAudit specimenAudit in surgicalAudit.SurgicalSpecimenAuditCollection)
                                {
                                    if (specimenAudit.AmendmentId == amendmentId)
                                    {
                                        XmlNode rowSpecimenNodeCloneP = rowSpecimenNodeP.Clone();
                                        string  diagnosisIDP          = specimenAudit.DiagnosisId + ".";
                                        string  specimenTypeP         = specimenAudit.SpecimenOrder.Description + ":";

                                        rowSpecimenNodeCloneP.SelectSingleNode("descendant::w:r[w:t='sidp']/w:t", this.m_NameSpaceManager).InnerText = diagnosisIDP;
                                        rowSpecimenNodeCloneP.SelectSingleNode("descendant::w:r[w:t='specimen_type_previous']/w:t", this.m_NameSpaceManager).InnerText = specimenTypeP;
                                        tableNodeP.InsertAfter(rowSpecimenNodeCloneP, insertAfterRowP);

                                        XmlNode rowDiagnosisNodeCloneP = rowDiagnosisNodeP.Clone();
                                        string  diagnosisP             = specimenAudit.Diagnosis;
                                        this.SetXMLNodeParagraphDataNode(rowDiagnosisNodeCloneP, "diagnosis_previous", diagnosisP);
                                        mainTableNode.InsertAfter(rowDiagnosisNodeCloneP, rowSpecimenNodeCloneP);
                                        insertAfterRowP = rowDiagnosisNodeCloneP;
                                    }
                                }

                                XmlNode rowCommentPClone = rowCommentP.Clone();
                                string  reportCommentP   = surgicalAudit.Comment;
                                rowCommentPClone.SelectSingleNode("descendant::w:r[w:t='report_comment_previous']/w:t", this.m_NameSpaceManager).InnerText = reportCommentP;
                                tableNodeP.InsertAfter(rowCommentPClone, insertAfterRowP);

                                insertAfterRowP = rowCommentPClone;
                                XmlNode rowPreviousSignaturePClone = rowPreviousSignatureP.Clone();
                                YellowstonePathology.Business.User.SystemUser pathologistUser = YellowstonePathology.Business.User.SystemUserCollectionInstance.Instance.SystemUserCollection.GetSystemUserById(surgicalAudit.PathologistId);

                                string previousSignautreP = pathologistUser.Signature;
                                rowPreviousSignaturePClone.SelectSingleNode("descendant::w:r[w:t='previous_signature']/w:t", this.m_NameSpaceManager).InnerText = previousSignautreP;
                                tableNodeP.InsertAfter(rowPreviousSignaturePClone, insertAfterRowP);
                                insertAfterRowP = rowPreviousSignaturePClone;
                            }
                        }
                    }
                }
            }

            tableNodeP.RemoveChild(rowSpecimenNodeP);
            tableNodeP.RemoveChild(rowDiagnosisNodeP);
            tableNodeP.RemoveChild(rowPreviousDiagnosis);
            tableNodeP.RemoveChild(rowCommentP);
            tableNodeP.RemoveChild(rowPreviousSignatureP);
            tableNodeP.RemoveChild(rowBlankLine1P);
            tableNodeP.RemoveChild(rowBlankLine2P);


            if (this.m_PanelSetOrder.Final == true)
            {
                this.SetXmlNodeData("pathologist_signature", this.m_PanelSetOrder.Signature);
            }
            else
            {
                this.SetXmlNodeData("pathologist_signature", "THIS CASE IS NOT FINAL");
            }

            XmlNode rowCancerSummaryHeader = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='Cancer Case Summary']", this.m_NameSpaceManager);
            XmlNode rowCancerSummary       = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='cancer_summary']", this.m_NameSpaceManager);
            XmlNode rowAJCCStage           = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='ajcc_stage']", this.m_NameSpaceManager);

            if (panelSetOrderSurgical.CancerSummary == string.Empty)
            {
                mainTableNode.RemoveChild(rowCancerSummaryHeader);
                mainTableNode.RemoveChild(rowCancerSummary);
            }
            else
            {
                this.SetXMLNodeParagraphData("cancer_summary", panelSetOrderSurgical.CancerSummary);
                if (panelSetOrderSurgical.AJCCStage != string.Empty)
                {
                    this.SetXmlNodeData("ajcc_stage", "Pathologic TNM Stage: " + panelSetOrderSurgical.AJCCStage);
                }
                else
                {
                    this.SetXmlNodeData("ajcc_stage", string.Empty);
                }
            }

            this.SetXmlNodeData("client_case", this.m_AccessionOrder.PCAN);
            this.SetXMLNodeParagraphData("microscopic_description", panelSetOrderSurgical.MicroscopicX);

            //Stains
            XmlNode rowAncillaryCommentNode = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='ancillary_studies_comment']", this.m_NameSpaceManager);
            XmlNode tableNodeSS             = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='specimen_type']", this.m_NameSpaceManager);
            XmlNode rowSpecimenTypeNode     = tableNodeSS.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='specimen_type']", this.m_NameSpaceManager);
            XmlNode rowSinglePlexNode       = tableNodeSS.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='Immunohistochemistry(single)']", this.m_NameSpaceManager);
            XmlNode rowMultiPlexNode        = tableNodeSS.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='Immunohistochemistry(dual)']", this.m_NameSpaceManager);
            XmlNode rowCytochemicalNode     = tableNodeSS.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='Cytochemical']", this.m_NameSpaceManager);
            XmlNode rowTestHeaderNode       = tableNodeSS.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='Result']", this.m_NameSpaceManager);
            XmlNode rowSpecialStainNode     = tableNodeSS.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='stain_description']", this.m_NameSpaceManager);

            bool   commentSet       = false;
            string ancillaryComment = panelSetOrderSurgical.GetAncillaryStudyComment();

            if (this.m_PanelSetOrder.FinalDate.HasValue == false || this.m_PanelSetOrder.FinalDate >= DateTime.Parse("11/7/07"))
            {
                XmlNode insertAfterRowSS = rowAncillaryCommentNode;
                YellowstonePathology.Business.Test.Model.TestOrderCollection allTests = this.m_PanelSetOrder.GetTestOrders();
                foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection)
                {
                    YellowstonePathology.Business.Test.Model.TestOrderCollection         specimenTestCollection            = surgicalSpecimen.SpecimenOrder.GetTestOrders(allTests);
                    YellowstonePathology.Business.SpecialStain.StainResultItemCollection singleplexStainResultCollection   = surgicalSpecimen.StainResultItemCollection.GetSingleplexStains(specimenTestCollection);
                    YellowstonePathology.Business.SpecialStain.StainResultItemCollection multiplexStainResultCollection    = surgicalSpecimen.StainResultItemCollection.GetMultiplexStains(specimenTestCollection);
                    YellowstonePathology.Business.SpecialStain.StainResultItemCollection cytochemicalStainResultCollection = surgicalSpecimen.StainResultItemCollection.GetCytochemicalStains(specimenTestCollection);

                    if ((singleplexStainResultCollection.Count > 0 || multiplexStainResultCollection.Count > 0 || cytochemicalStainResultCollection.Count > 0))
                    {
                        if (commentSet == false)
                        {
                            this.SetXMLNodeParagraphData("ancillary_studies_comment", ancillaryComment);
                            commentSet = true;
                        }

                        XmlNode rowSpecimenTypeClone = rowSpecimenTypeNode.Clone();
                        string  specimenType         = surgicalSpecimen.DiagnosisId + ". " + surgicalSpecimen.SpecimenOrder.Description;
                        rowSpecimenTypeClone.SelectSingleNode("descendant::w:r[w:t='specimen_type']/w:t", this.m_NameSpaceManager).InnerText = specimenType;
                        tableNodeSS.InsertAfter(rowSpecimenTypeClone, insertAfterRowSS);
                        insertAfterRowSS = rowSpecimenTypeClone;

                        if (singleplexStainResultCollection.Count > 0)
                        {
                            insertAfterRowSS = this.SetStains(tableNodeSS, rowSinglePlexNode, rowTestHeaderNode, insertAfterRowSS, rowSpecialStainNode, surgicalSpecimen, singleplexStainResultCollection);
                        }

                        if (multiplexStainResultCollection.Count > 0)
                        {
                            insertAfterRowSS = this.SetStains(tableNodeSS, rowMultiPlexNode, rowTestHeaderNode, insertAfterRowSS, rowSpecialStainNode, surgicalSpecimen, multiplexStainResultCollection);
                        }

                        if (cytochemicalStainResultCollection.Count > 0)
                        {
                            insertAfterRowSS = this.SetStains(tableNodeSS, rowCytochemicalNode, rowTestHeaderNode, insertAfterRowSS, rowSpecialStainNode, surgicalSpecimen, cytochemicalStainResultCollection);
                        }
                    }
                }
            }

            tableNodeSS.RemoveChild(rowSpecimenTypeNode);
            tableNodeSS.RemoveChild(rowTestHeaderNode);
            tableNodeSS.RemoveChild(rowSpecialStainNode);
            tableNodeSS.RemoveChild(rowSinglePlexNode);
            tableNodeSS.RemoveChild(rowMultiPlexNode);
            tableNodeSS.RemoveChild(rowCytochemicalNode);

            if (commentSet == false)
            {
                XmlNode rowAncillaryStudiesNode = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='Ancillary Studies']", this.m_NameSpaceManager);
                mainTableNode.RemoveChild(rowAncillaryStudiesNode);
                mainTableNode.RemoveChild(rowAncillaryCommentNode);
            }

            this.SetXMLNodeParagraphData("clinical_information", this.m_AccessionOrder.ClinicalHistory);

            XmlNode rowICHeaderNode   = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='intraoperative_consultation_header']", this.m_NameSpaceManager);
            XmlNode rowICSpecimenNode = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='intraoperative_consultation_specimen']", this.m_NameSpaceManager);
            XmlNode rowICTextNode     = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='intraoperative_consultation_text']", this.m_NameSpaceManager);

            XmlNode insertAfterRowIC = rowICHeaderNode;
            int     icCount          = 0;

            this.SetXMLNodeParagraphDataNode(rowICHeaderNode, "intraoperative_consultation_header", "Intraoperative Consultation");
            foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection)
            {
                foreach (IntraoperativeConsultationResult icItem in surgicalSpecimen.IntraoperativeConsultationResultCollection)
                {
                    XmlNode rowICSpecimenNodeClone = rowICSpecimenNode.Clone();
                    string  specimenString         = surgicalSpecimen.DiagnosisId + ". " + surgicalSpecimen.SpecimenOrder.Description + ":";
                    this.SetXMLNodeParagraphDataNode(rowICSpecimenNodeClone, "intraoperative_consultation_specimen", specimenString);
                    mainTableNode.InsertAfter(rowICSpecimenNodeClone, insertAfterRowIC);
                    insertAfterRowIC = rowICSpecimenNodeClone;

                    XmlNode rowICTextNodeClone = rowICTextNode.Clone();
                    this.SetXMLNodeParagraphDataNode(rowICTextNodeClone, "intraoperative_consultation_text", icItem.Result);
                    mainTableNode.InsertAfter(rowICTextNodeClone, insertAfterRowIC);
                    insertAfterRowIC = rowICTextNodeClone;
                    icCount         += 1;
                }
            }

            if (icCount == 0)
            {
                mainTableNode.RemoveChild(rowICHeaderNode);
            }
            mainTableNode.RemoveChild(rowICSpecimenNode);
            mainTableNode.RemoveChild(rowICTextNode);

            XmlNode rowSpecimenDescriptionNode            = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='specimen_description']", this.m_NameSpaceManager);
            XmlNode rowFixationTypeNode                   = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='specimen_fixation_type']", this.m_NameSpaceManager);
            XmlNode rowTimeToFixationNode                 = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='time_to_fixation']", this.m_NameSpaceManager);
            XmlNode rowFixationDurationNode               = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='duration_of_fixation']", this.m_NameSpaceManager);
            XmlNode rowFixationCommentNode                = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='fixation_comment']", this.m_NameSpaceManager);
            XmlNode rowInsertSpecimenDescriptionAfterNode = rowSpecimenDescriptionNode;

            foreach (YellowstonePathology.Business.Specimen.Model.SpecimenOrder specimenOrder in this.m_AccessionOrder.SpecimenOrderCollection)
            {
                XmlNode rowSpecimenDescriptionClone = rowSpecimenDescriptionNode.Clone();
                rowSpecimenDescriptionClone.SelectSingleNode("descendant::w:r[w:t='specimen_description']/w:t", this.m_NameSpaceManager).InnerText = specimenOrder.GetSpecimenDescriptionString();

                YellowstonePathology.Business.Helper.DateTimeJoiner collectionDateTimeJoiner = new YellowstonePathology.Business.Helper.DateTimeJoiner(specimenOrder.CollectionDate.Value, specimenOrder.CollectionTime);
                rowSpecimenDescriptionClone.SelectSingleNode("descendant::w:r[w:t='date_time_collected']/w:t", this.m_NameSpaceManager).InnerText = collectionDateTimeJoiner.DisplayString;
                mainTableNode.InsertAfter(rowSpecimenDescriptionClone, rowInsertSpecimenDescriptionAfterNode);
                rowInsertSpecimenDescriptionAfterNode = rowSpecimenDescriptionClone;

                bool specimenHasERPR = this.SpecimenHasERPR(specimenOrder);
                if (specimenHasERPR == true)
                {
                    XmlNode rowFixationTypeNodeClone = rowFixationTypeNode.Clone();
                    rowFixationTypeNodeClone.SelectSingleNode("descendant::w:r[w:t='specimen_fixation_type']/w:t", this.m_NameSpaceManager).InnerText = specimenOrder.LabFixation;
                    mainTableNode.InsertAfter(rowFixationTypeNodeClone, rowInsertSpecimenDescriptionAfterNode);
                    rowInsertSpecimenDescriptionAfterNode = rowFixationTypeNodeClone;

                    XmlNode rowTimeToFixationNodeClone = rowTimeToFixationNode.Clone();
                    rowTimeToFixationNodeClone.SelectSingleNode("descendant::w:r[w:t='time_to_fixation']/w:t", this.m_NameSpaceManager).InnerText = specimenOrder.TimeToFixationHourString;
                    mainTableNode.InsertAfter(rowTimeToFixationNodeClone, rowInsertSpecimenDescriptionAfterNode);
                    rowInsertSpecimenDescriptionAfterNode = rowTimeToFixationNodeClone;

                    XmlNode rowFixationDurationNodeClone = rowFixationDurationNode.Clone();
                    rowFixationDurationNodeClone.SelectSingleNode("descendant::w:r[w:t='duration_of_fixation']/w:t", this.m_NameSpaceManager).InnerText = specimenOrder.FixationDurationString;
                    mainTableNode.InsertAfter(rowFixationDurationNodeClone, rowInsertSpecimenDescriptionAfterNode);
                    rowInsertSpecimenDescriptionAfterNode = rowFixationDurationNodeClone;

                    XmlNode rowFixationCommentNodeClone = rowFixationCommentNode.Clone();
                    rowFixationCommentNodeClone.SelectSingleNode("descendant::w:r[w:t='fixation_comment']/w:t", this.m_NameSpaceManager).InnerText = specimenOrder.FixationComment;
                    mainTableNode.InsertAfter(rowFixationCommentNodeClone, rowInsertSpecimenDescriptionAfterNode);
                    rowInsertSpecimenDescriptionAfterNode = rowFixationCommentNodeClone;
                }
            }
            mainTableNode.RemoveChild(rowSpecimenDescriptionNode);
            mainTableNode.RemoveChild(rowFixationTypeNode);
            mainTableNode.RemoveChild(rowTimeToFixationNode);
            mainTableNode.RemoveChild(rowFixationDurationNode);
            mainTableNode.RemoveChild(rowFixationCommentNode);

            this.SetXMLNodeParagraphData("gross_description", panelSetOrderSurgical.GrossX);
            this.SetXMLNodeParagraphData("client_name", this.m_AccessionOrder.ClientName);

            string finalDate = YellowstonePathology.Business.BaseData.GetShortDateString(this.m_PanelSetOrder.FinalDate) + " - " + YellowstonePathology.Business.BaseData.GetMillitaryTimeString(this.m_PanelSetOrder.FinalTime);

            this.SetXmlNodeData("final_date", finalDate);

            string immunoComment = panelSetOrderSurgical.GetImmunoComment();

            if (immunoComment.Length > 0)
            {
                this.SetXmlNodeData("immuno_comment", immunoComment);
            }
            else
            {
                this.DeleteRow("immuno_comment");
            }

            this.SetXMLNodeParagraphData("additional_testing", this.m_AccessionOrder.PanelSetOrderCollection.GetAdditionalTestingString(this.m_PanelSetOrder.ReportNo));

            this.HandleERPRStatements();

            this.SaveReport();
        }
Пример #3
0
        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");
        }
Пример #4
0
        public override void ToXml(XElement document)
        {
            SurgicalTestOrder panelSetOrderSurgical = (SurgicalTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);

            this.AddCompanyHeader(document);
            this.AddBlankNteElement(document);
            this.AddNextNteElement("Surgical Pathology Report: ", document);
            this.AddNextNteElement("Master Accession #: " + panelSetOrderSurgical.MasterAccessionNo, document);
            this.AddNextNteElement("Report #: " + panelSetOrderSurgical.ReportNo, document);

            this.AddBlankNteElement(document);

            foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection)
            {
                this.AddNextNteElement("Specimen: " + surgicalSpecimen.SpecimenOrder.SpecimenNumber.ToString(), document);
                this.HandleLongString(surgicalSpecimen.SpecimenOrder.Description, document);

                this.AddBlankNteElement(document);

                this.AddNextNteElement("Diagnosis: ", document);
                this.HandleLongString(surgicalSpecimen.Diagnosis, document);

                this.AddBlankNteElement(document);
            }

            if (string.IsNullOrEmpty(panelSetOrderSurgical.Comment) == false)
            {
                this.AddNextNteElement("Comment: ", document);
                this.HandleLongString(panelSetOrderSurgical.Comment, document);
                this.AddBlankNteElement(document);
            }

            if (string.IsNullOrEmpty(panelSetOrderSurgical.CancerSummary) == false)
            {
                this.AddNextNteElement("Cancer Summary: ", document);
                this.HandleLongString(panelSetOrderSurgical.CancerSummary, document);
                this.AddBlankNteElement(document);

                if (string.IsNullOrEmpty(panelSetOrderSurgical.AJCCStage) == false)
                {
                    this.HandleLongString("Pathologic TNM Stage: " + panelSetOrderSurgical.AJCCStage, document);
                    this.AddBlankNteElement(document);
                }
            }

            this.AddNextNteElement("Pathologist: " + panelSetOrderSurgical.Signature, document);
            this.AddNextNteElement("*** E-signed: " + panelSetOrderSurgical.FinalTime.Value.ToString("MM/dd/yyyy HH:mm") + " ***", document);

            this.AddBlankNteElement(document);

            foreach (YellowstonePathology.Business.Amendment.Model.Amendment amendment in panelSetOrderSurgical.AmendmentCollection)
            {
                this.AddNextNteElement(amendment.AmendmentType + ": " + amendment.AmendmentDate.Value.ToString("MM/dd/yyyy"), document);
                this.HandleLongString(amendment.Text, document);
                if (amendment.RequirePathologistSignature == true)
                {
                    this.AddNextNteElement("Signature: " + amendment.PathologistSignature, document);
                }
                this.AddBlankNteElement(document);
            }

            this.AddNextNteElement("Microscopic Description: ", document);
            this.HandleLongString(panelSetOrderSurgical.MicroscopicX, document);

            this.AddBlankNteElement(document);

            if (panelSetOrderSurgical.TypingStainCollection.Count > 0)
            {
                this.AddNextNteElement("Ancillary Studies:", document);
                string ancillaryComment = panelSetOrderSurgical.GetAncillaryStudyComment();
                this.HandleLongString(ancillaryComment, document);

                foreach (YellowstonePathology.Business.Test.Surgical.SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection)
                {
                    if (surgicalSpecimen.StainResultItemCollection.Count > 0)
                    {
                        this.HandleLongString(surgicalSpecimen.SpecimenOrder.SpecimenNumber.ToString() + ". " + surgicalSpecimen.SpecimenOrder.Description, document);

                        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);
                            }
                        }
                    }
                }
                this.AddBlankNteElement(document);
            }

            this.AddNextNteElement("Gross Description: ", document);
            this.HandleLongString(panelSetOrderSurgical.GrossX, document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("Clinical Information: ", document);
            this.HandleLongString(this.m_AccessionOrder.ClinicalHistory, document);
        }
        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");
        }
Пример #6
0
        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);
        }
Пример #7
0
        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");

            foreach (SurgicalSpecimen surgicalSpecimen in panelSetOrderSurgical.SurgicalSpecimenCollection)
            {
                this.AddNextObxElement("Specimen: " + surgicalSpecimen.SpecimenOrder.SpecimenNumber.ToString(), document, "F");
                this.HandleLongString(surgicalSpecimen.SpecimenOrder.Description, 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.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("Gross Description: ", document, "F");
            this.HandleLongString(panelSetOrderSurgical.GrossX, 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");
            }

            string locationPerformed = panelSetOrderSurgical.GetLocationPerformedComment();

            this.AddNextObxElement(locationPerformed, document, "F");
            this.AddNextObxElement(string.Empty, document, "F");
        }