public override void ToXml(XElement document)
        {
            YellowstonePathology.Business.Test.HPV.HPVTestOrder panelSetOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);

            this.AddCompanyHeader(document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("High Risk HPV Report", document);
            this.AddNextNteElement("Master Accession #: " + panelSetOrder.MasterAccessionNo, document);
            this.AddNextNteElement("Report #: " + panelSetOrder.ReportNo, document);
            this.AddBlankNteElement(document);

            string resultText = "Result: " + panelSetOrder.Result;

            this.AddNextNteElement(resultText, document);
            this.AddNextNteElement("Reference: Negative", document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("Specimen: ThinPrep fluid", document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("Test Information: ", document);
            this.HandleLongString(YellowstonePathology.Business.Test.HPV.HPVResult.TestInformation, document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("References: ", document);
            this.HandleLongString(YellowstonePathology.Business.Test.HPV.HPVResult.References, document);
            this.AddBlankNteElement(document);

            string asrComment = "This test was performed using a US FDA approved DNA probe kit.  The FDA procedure was performed using a modified DNA extraction method for test optimization, and the modified procedure was validated by Yellowstone Pathology Institute (YPI).  YPI assumes the responsibility for test performance.";

            this.HandleLongString(asrComment, document);
        }
        public override bool IsRequired(Business.Test.AccessionOrder accessionOrder)
        {
            bool result = false;

            YellowstonePathology.Business.Test.HPV.HPVTest                 panelSetHPV         = new YellowstonePathology.Business.Test.HPV.HPVTest();
            YellowstonePathology.Business.Test.HPV1618.HPV1618Test         panelSetHPV1618     = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
            YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest panelSetThinPrepPap = new YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest();

            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetThinPrepPap.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology panelsetOrderCytology = (YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetThinPrepPap.PanelSetId);
                if (panelsetOrderCytology.Final == true)
                {
                    string papResultCode = panelsetOrderCytology.ResultCode;
                    if (YellowstonePathology.Business.Cytology.Model.CytologyResultCode.IsResultCodeNormal(papResultCode) == true || YellowstonePathology.Business.Cytology.Model.CytologyResultCode.IsResultCodeReactive(papResultCode) == true)
                    {
                        if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true)
                        {
                            YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV.PanelSetId);
                            if (hpvTestOrder.ResultCode == YellowstonePathology.Business.Test.HPV.HPVResult.OveralResultCodePositive)
                            {
                                result = true;
                            }
                        }
                    }
                }
            }

            return(result);
        }
        public HPVResultPage(YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder,
			YellowstonePathology.Business.Test.AccessionOrder accessionOrder,            
			YellowstonePathology.Business.User.SystemIdentity systemIdentity,
			YellowstonePathology.UI.Navigation.PageNavigator pageNavigator)
            : base(hpvTestOrder, accessionOrder)
        {
            this.m_HPVTestOrder = hpvTestOrder;
            this.m_AccessionOrder = accessionOrder;
            this.m_SystemIdentity = systemIdentity;
            this.m_PageNavigator = pageNavigator;

            this.m_ResultCollection = Business.Test.HPV.HPVResultCollection.GetAllResults();
            this.m_PageHeaderText = "HPV Results For: " + this.m_AccessionOrder.PatientDisplayName + "  (" + this.m_HPVTestOrder.ReportNo + ")";

            bool hpv1618HasBeenOrdered = this.m_AccessionOrder.PanelSetOrderCollection.Exists(62);
            if (hpv1618HasBeenOrdered == true)
            {
                this.m_AdditionalTestingComment = YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapWordDocument.HPV1618HasBeenOrderedComment;
            }
            else
            {
                this.m_AdditionalTestingComment = YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapWordDocument.NoAdditionalTestingOrderedComment;
            }

            InitializeComponent();

            DataContext = this;
            Loaded += HPVResultPage_Loaded;
            Unloaded += HPVResultPage_Unloaded;

            this.m_ControlsNotDisabledOnFinal.Add(this.ButtonNext);
            this.m_ControlsNotDisabledOnFinal.Add(this.TextBlockShowDocument);
            this.m_ControlsNotDisabledOnFinal.Add(this.TextBlockNext);
            this.m_ControlsNotDisabledOnFinal.Add(this.TextBlockUnfinalResults);
        }
Beispiel #4
0
        public override void ToXml(XElement document)
        {
            YellowstonePathology.Business.Test.HPV.HPVTestOrder panelSetOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);

            this.AddCompanyHeader(document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("High Risk HPV Report", document);
            this.AddNextNteElement("Master Accession #: " + panelSetOrder.MasterAccessionNo, document);
            this.AddNextNteElement("Report #: " + panelSetOrder.ReportNo, document);
            this.AddBlankNteElement(document);

            string resultText = "Result: " + panelSetOrder.Result;

            this.AddNextNteElement(resultText, document);
            this.AddNextNteElement("Reference: Negative", document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("Specimen: ThinPrep fluid", document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("Test Information: ", document);
            this.HandleLongString(YellowstonePathology.Business.Test.HPV.HPVResult.TestInformation, document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("References: ", document);
            this.HandleLongString(YellowstonePathology.Business.Test.HPV.HPVResult.References, document);
            this.AddBlankNteElement(document);

            this.HandleLongString(panelSetOrder.ASRComment, document);
        }
        public HPVResultPage(YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder,
                             YellowstonePathology.Business.Test.AccessionOrder accessionOrder,
                             YellowstonePathology.Business.User.SystemIdentity systemIdentity,
                             YellowstonePathology.UI.Navigation.PageNavigator pageNavigator) : base(hpvTestOrder)
        {
            this.m_HPVTestOrder   = hpvTestOrder;
            this.m_AccessionOrder = accessionOrder;
            this.m_SystemIdentity = systemIdentity;
            this.m_PageNavigator  = pageNavigator;

            this.m_ResultCollection = Business.Test.HPV.HPVResultCollection.GetAllResults();
            this.m_PageHeaderText   = "HPV Results For: " + this.m_AccessionOrder.PatientDisplayName + "  (" + this.m_HPVTestOrder.ReportNo + ")";

            bool hpv1618HasBeenOrdered = this.m_AccessionOrder.PanelSetOrderCollection.Exists(62);

            if (hpv1618HasBeenOrdered == true)
            {
                this.m_AdditionalTestingComment = YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapWordDocument.HPV1618HasBeenOrderedComment;
            }
            else
            {
                this.m_AdditionalTestingComment = YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapWordDocument.NoAdditionalTestingOrderedComment;
            }

            InitializeComponent();

            DataContext = this;
            Loaded     += HPVResultPage_Loaded;
            Unloaded   += HPVResultPage_Unloaded;

            this.m_ControlsNotDisabledOnFinal.Add(this.ButtonNext);
            this.m_ControlsNotDisabledOnFinal.Add(this.TextBlockShowDocument);
        }
Beispiel #6
0
 public HPVResultPath(string reportNo, YellowstonePathology.Business.Test.AccessionOrder accessionOrder,            
     YellowstonePathology.UI.Navigation.PageNavigator pageNavigator,
     System.Windows.Window window)
     : base(pageNavigator, window)
 {
     this.m_AccessionOrder = accessionOrder;
     this.m_HPVTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(reportNo);
 }
Beispiel #7
0
 public HPVResultPath(string reportNo, YellowstonePathology.Business.Test.AccessionOrder accessionOrder,
                      YellowstonePathology.UI.Navigation.PageNavigator pageNavigator,
                      System.Windows.Window window)
     : base(pageNavigator, window)
 {
     this.m_AccessionOrder = accessionOrder;
     this.m_HPVTestOrder   = (YellowstonePathology.Business.Test.HPV.HPVTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(reportNo);
 }
Beispiel #8
0
        public override string ToResultString(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
        {
            StringBuilder result = new StringBuilder();

            YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest panelSetThinPrepPap = new YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest();
            YellowstonePathology.Business.Test.HPV.HPVTest                 panelSetHPV         = new YellowstonePathology.Business.Test.HPV.HPVTest();
            YellowstonePathology.Business.Test.HPV1618.HPV1618Test         panelSetHPV1618     = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
            YellowstonePathology.Business.Test.NGCT.NGCTTest               panelSetNGCT        = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
            YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest panelSetTrichomonas = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();

            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetThinPrepPap.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology panelSetOrderCytology = (YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetThinPrepPap.PanelSetId);
                result.AppendLine(panelSetOrderCytology.ToResultString(accessionOrder));
                result.AppendLine();
            }

            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV.PanelSetId);
                result.AppendLine(hpvTestOrder.ToResultString(accessionOrder));
                result.AppendLine();
            }

            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.HPV1618.PanelSetOrderHPV1618 panelSetOrderHPV1618 = (YellowstonePathology.Business.Test.HPV1618.PanelSetOrderHPV1618)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV1618.PanelSetId);
                result.AppendLine(panelSetOrderHPV1618.ToResultString(accessionOrder));
                result.AppendLine();
            }

            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetNGCT.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.NGCT.NGCTTestOrder panelSetOrderNGCT = (YellowstonePathology.Business.Test.NGCT.NGCTTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetNGCT.PanelSetId);
                result.AppendLine(panelSetOrderNGCT.ToResultString(accessionOrder));
                result.AppendLine();
            }

            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetTrichomonas.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder reportOrderTrichomonas = (YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetTrichomonas.PanelSetId);
                result.AppendLine(reportOrderTrichomonas.ToResultString(accessionOrder));
                result.AppendLine();
            }

            return(result.ToString());
        }
        public override bool IsRequired(Business.Test.AccessionOrder accessionOrder)
        {
            bool result = false;

            YellowstonePathology.Business.Test.HPV.HPVTest         panelSetHPV     = new YellowstonePathology.Business.Test.HPV.HPVTest();
            YellowstonePathology.Business.Test.HPV1618.HPV1618Test panelSetHPV1618 = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();

            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV.PanelSetId);
                if (hpvTestOrder.ResultCode == YellowstonePathology.Business.Test.HPV.HPVResult.OveralResultCodePositive)
                {
                    result = true;
                }
            }
            return(result);
        }
Beispiel #10
0
        public HPVResultPage(YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder,
                             YellowstonePathology.Business.Test.AccessionOrder accessionOrder,
                             YellowstonePathology.Business.User.SystemIdentity systemIdentity,
                             YellowstonePathology.UI.Navigation.PageNavigator pageNavigator) : base(hpvTestOrder, accessionOrder)
        {
            this.m_HPVTestOrder   = hpvTestOrder;
            this.m_AccessionOrder = accessionOrder;
            this.m_SystemIdentity = systemIdentity;
            this.m_PageNavigator  = pageNavigator;

            this.m_ResultCollection = Business.Test.HPV.HPVResultCollection.GetAllResults();
            this.m_PageHeaderText   = "HPV Results For: " + this.m_AccessionOrder.PatientDisplayName + "  (" + this.m_HPVTestOrder.ReportNo + ")";

            InitializeComponent();

            DataContext = this;
            Loaded     += HPVResultPage_Loaded;
            Unloaded   += HPVResultPage_Unloaded;

            this.m_ControlsNotDisabledOnFinal.Add(this.ButtonNext);
            this.m_ControlsNotDisabledOnFinal.Add(this.TextBlockShowDocument);
            this.m_ControlsNotDisabledOnFinal.Add(this.TextBlockNext);
            this.m_ControlsNotDisabledOnFinal.Add(this.TextBlockUnfinalResults);
        }
Beispiel #11
0
        private void SetData()
        {
            if (this.m_HasThinPrepPap == true)
            {
                YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology panelSetOrderCytology = (YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetThinPrepPap.PanelSetId);
                this.m_Method.Append("Thin Prep Pap: " + panelSetOrderCytology.Method);
                this.m_References.Append("Thin Prep Pap: " + panelSetOrderCytology.References);
            }

            if (this.m_HasHighRiskHPV == true)
            {
                YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetHPV.PanelSetId);
                if (this.m_HasThinPrepPap == true)
                {
                    this.m_Method.AppendLine();
                    this.m_Method.AppendLine();

                    this.m_References.AppendLine();
                    this.m_References.AppendLine();
                }
                this.m_Method.AppendLine("High Risk HPV: " + hpvTestOrder.TestInformation);
                this.m_References.AppendLine("High Risk HPV: " + hpvTestOrder.References);
            }
        }
        public override void ToXml(XElement document)
        {
            WomensHealthProfileTestOrder womensHealthProfileTestOrder = (WomensHealthProfileTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);
            WomensHealthProfileResult    womensHealthProfileResult    = new WomensHealthProfileResult(this.m_AccessionOrder);

            ThinPrepPap.ThinPrepPapTest thinPrepPapTest = new ThinPrepPap.ThinPrepPapTest();
            bool hasPap = this.m_AccessionOrder.PanelSetOrderCollection.Exists(thinPrepPapTest.PanelSetId);

            this.AddCompanyHeader(document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("Women's Health Profile", document);
            this.AddNextNteElement("Report #: " + womensHealthProfileTestOrder.ReportNo, document);
            this.AddBlankNteElement(document);

            if (hasPap == true)
            {
                this.AddNextNteElement("PAP TEST RESULT: ", document);

                YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology panelSetOrderCytology = (YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(15);
                if (string.IsNullOrEmpty(panelSetOrderCytology.ScreeningImpression) == false)
                {
                    this.AddNextNteElement("Epithelial Cell Description: ", document);
                    this.AddNextNteElement(panelSetOrderCytology.ScreeningImpression, document);
                    this.AddBlankNteElement(document);
                }

                this.AddNextNteElement("Specimen Adequacy:", document);
                this.AddNextNteElement(panelSetOrderCytology.SpecimenAdequacy, document);
                this.AddBlankNteElement(document);

                if (string.IsNullOrEmpty(panelSetOrderCytology.OtherConditions) == false)
                {
                    this.AddNextNteElement("Other Conditions:", document);
                    this.AddNextNteElement(panelSetOrderCytology.OtherConditions, document);
                    this.AddBlankNteElement(document);
                }

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

                YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology screeningPanelOrder = null;
                YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology reviewPanelOrder    = null;

                foreach (YellowstonePathology.Business.Interface.IPanelOrder panelOrder in panelSetOrderCytology.PanelOrders)
                {
                    Type objectType = panelOrder.GetType();
                    if (typeof(YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology).IsAssignableFrom(objectType) == true)
                    {
                        YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology cytologyPanelOrder = (YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology)panelOrder;
                        if (cytologyPanelOrder.PanelId == 38)
                        {
                            if (cytologyPanelOrder.ScreeningType == "Primary Screening")
                            {
                                screeningPanelOrder = cytologyPanelOrder;
                            }
                            else if (cytologyPanelOrder.ScreeningType == "Pathologist Review")
                            {
                                reviewPanelOrder = cytologyPanelOrder;
                            }
                            else if (cytologyPanelOrder.ScreeningType == "Cytotech Review")
                            {
                                if (reviewPanelOrder == null || reviewPanelOrder.ScreeningType != "Pathologist Review")
                                {
                                    reviewPanelOrder = cytologyPanelOrder;
                                }
                            }
                        }
                    }
                }

                YellowstonePathology.Business.User.SystemUser systemUser = YellowstonePathology.Business.User.SystemUserCollectionInstance.Instance.SystemUserCollection.GetSystemUserById(screeningPanelOrder.ScreenedById);
                if (string.IsNullOrEmpty(systemUser.Signature) == false)
                {
                    this.AddNextNteElement("Screened By: " + systemUser.Signature, document);
                }

                string cytoTechFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateAndTimeStringFromNullable(screeningPanelOrder.AcceptedTime);
                this.AddNextNteElement("*** E-Signed " + cytoTechFinal + " ***", document);
                this.AddBlankNteElement(document);

                if (reviewPanelOrder != null)
                {
                    string reviewedBy      = YellowstonePathology.Business.User.SystemUserCollectionInstance.Instance.SystemUserCollection.GetSystemUserById(reviewPanelOrder.ScreenedById).Signature;
                    string reviewedByFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(reviewPanelOrder.AcceptedDate);

                    if (reviewedBy.IndexOf("MD") >= 0)
                    {
                        this.AddNextNteElement("Interpreted By: " + reviewedBy + " " + reviewedByFinal, document);
                    }
                    else
                    {
                        this.AddNextNteElement("Reviewed By: " + reviewedBy + " " + reviewedByFinal, document);
                    }
                    this.AddBlankNteElement(document);
                }
            }

            this.AddAmendments(document, womensHealthProfileTestOrder, this.m_AccessionOrder);

            this.AddNextNteElement("CURRENT MOLECULAR TEST SUMMARY", document);

            YellowstonePathology.Business.Test.HPV.HPVTest                 panelSetHPV         = new YellowstonePathology.Business.Test.HPV.HPVTest();
            YellowstonePathology.Business.Test.HPV1618.HPV1618Test         panelSetHPV1618     = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
            YellowstonePathology.Business.Test.NGCT.NGCTTest               panelSetNGCT        = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
            YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest panelSetTrichomonas = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();

            if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetNGCT.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetTrichomonas.PanelSetId) == false)
            {
                this.AddNextNteElement("No tests performed ", document);
                this.AddBlankNteElement(document);
            }
            else
            {
                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV.PanelSetId);
                    this.AddNextNteElement("High Risk HPV: " + hpvTestOrder.Result, document);
                    this.AddNextNteElement("Reference: Negative", document);
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateAndTimeStringFromNullable(hpvTestOrder.FinalTime);
                    this.AddNextNteElement("Date Finalized: " + hpvFinal, document);
                    this.AddBlankNteElement(document);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.HPV1618.PanelSetOrderHPV1618 panelSetOrderHPV1618 = (YellowstonePathology.Business.Test.HPV1618.PanelSetOrderHPV1618) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV1618.PanelSetId);
                    this.AddNextNteElement("HPV type 16: " + panelSetOrderHPV1618.HPV16Result, document);
                    this.AddNextNteElement("Reference: Negative", document);

                    this.AddNextNteElement("HPV type 18: " + panelSetOrderHPV1618.HPV18Result, document);
                    this.AddNextNteElement("Reference: Negative", document);
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateAndTimeStringFromNullable(panelSetOrderHPV1618.FinalTime);
                    this.AddNextNteElement("Date Finalized: " + hpvFinal, document);
                    this.AddBlankNteElement(document);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetNGCT.PanelSetId) == true)
                {
                    this.AddNextNteElement("Chlamydia Gonorrhea Screening ", document);
                    YellowstonePathology.Business.Test.NGCT.NGCTTestOrder panelSetOrderNGCT = (YellowstonePathology.Business.Test.NGCT.NGCTTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetNGCT.PanelSetId);
                    this.AddNextNteElement("Chlamydia trachomatis: " + panelSetOrderNGCT.ChlamydiaTrachomatisResult, document);
                    this.AddNextNteElement("Reference: Negative", document);

                    this.AddNextNteElement("Neisseria gonorrhoeae: " + panelSetOrderNGCT.NeisseriaGonorrhoeaeResult, document);
                    this.AddNextNteElement("Reference: Negative", document);
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateAndTimeStringFromNullable(panelSetOrderNGCT.FinalTime);
                    this.AddNextNteElement("Date Finalized: " + hpvFinal, document);
                    this.AddBlankNteElement(document);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetTrichomonas.PanelSetId) == true)
                {
                    this.AddNextNteElement("Trichomonas Screening ", document);
                    YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder reportOrderTrichomonas = (YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetTrichomonas.PanelSetId);
                    this.AddNextNteElement("Trichomonas vaginalis: " + reportOrderTrichomonas.Result, document);
                    this.AddNextNteElement("Reference: Negative", document);
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateAndTimeStringFromNullable(reportOrderTrichomonas.FinalTime);
                    this.AddNextNteElement("Date Finalized: " + hpvFinal, document);
                    this.AddBlankNteElement(document);
                }
            }

            this.AddNextNteElement("Specimen Description: Thin Prep Fluid", document);
            this.AddNextNteElement("Specimen Source: " + this.m_AccessionOrder.SpecimenOrderCollection[0].SpecimenSource, document);
            string collectionDateTimeString = this.m_AccessionOrder.SpecimenOrderCollection[0].GetCollectionDateTimeString();

            this.AddNextNteElement("Collection Date/Time: " + collectionDateTimeString, document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("Clinical History: ", document);
            this.HandleLongString(this.m_AccessionOrder.ClinicalHistory, document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("Method: ", document);
            this.HandleLongString(womensHealthProfileResult.Method, document);
            this.AddBlankNteElement(document);

            this.AddNextNteElement("References: ", document);
            this.HandleLongString(womensHealthProfileResult.References, document);
            this.AddBlankNteElement(document);

            string locationPerformed = womensHealthProfileTestOrder.GetLocationPerformedComment();

            this.HandleLongString(locationPerformed, document);
            this.AddNextNteElement(string.Empty, document);

            this.AddNextNteElement("PRIOR PAP AND GYN MOLECULAR TESTS", document);
            YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest panelSetThinPrepPap = new YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest();
            DateTime cutoffDate = this.m_AccessionOrder.AccessionDate.Value.AddYears(-5);

            YellowstonePathology.Business.Domain.PatientHistory patientHistory         = YellowstonePathology.Business.Gateway.AccessionOrderGateway.GetPatientHistory(this.m_AccessionOrder.PatientId);
            YellowstonePathology.Business.Domain.PatientHistory priorPapRelatedHistory = patientHistory.GetPriorPapRelatedHistory(this.m_AccessionOrder.MasterAccessionNo, cutoffDate);

            if (priorPapRelatedHistory.Count == 0)
            {
                this.AddNextNteElement("No prior tests performed ", document);
                this.AddBlankNteElement(document);
            }
            else
            {
                foreach (YellowstonePathology.Business.Domain.PatientHistoryResult patientHistoryResult in priorPapRelatedHistory)
                {
                    YellowstonePathology.Business.Test.AccessionOrder patientHistoryAccessionOrder = YellowstonePathology.Business.Persistence.DocumentGateway.Instance.GetAccessionOrderByMasterAccessionNo(patientHistoryResult.MasterAccessionNo);
                    foreach (YellowstonePathology.Business.Test.PanelSetOrder panelSetOrder in patientHistoryAccessionOrder.PanelSetOrderCollection)
                    {
                        string reportNo = null;
                        string result   = null;

                        if (panelSetOrder.PanelSetId == panelSetThinPrepPap.PanelSetId ||
                            panelSetOrder.PanelSetId == panelSetHPV.PanelSetId ||
                            panelSetOrder.PanelSetId == panelSetHPV1618.PanelSetId ||
                            panelSetOrder.PanelSetId == panelSetNGCT.PanelSetId ||
                            panelSetOrder.PanelSetId == panelSetTrichomonas.PanelSetId)
                        {
                            reportNo = panelSetOrder.ReportNo;
                            string finaldate = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrder.FinalDate);
                            result = panelSetOrder.GetResultWithTestName();
                            this.AddNextNteElement("Test: " + panelSetOrder.PanelSetName + " Report No: " + reportNo + " Result: " + result + " Final Date: " + finaldate, document);
                            this.AddBlankNteElement(document);
                        }
                    }
                }
            }
            this.AddBlankNteElement(document);

            string disclaimer = "This Pap test is only a screening test. A negative result does not definitively rule out the presence of disease. Women should, therefore, in consultation with their physician, have this test performed at mutually agreed intervals.";

            this.AddNextNteElement(disclaimer, document);
            this.AddBlankNteElement(document);
        }
        private void SetData()
        {
            if (this.m_HasThinPrepPap == true)
            {
                YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology panelSetOrderCytology = (YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetThinPrepPap.PanelSetId);
                this.m_Method.Append("Thin Prep Pap: " + panelSetOrderCytology.Method);
                this.m_References.Append("Thin Prep Pap: " + panelSetOrderCytology.ReportReferences);
            }

            if (this.m_HasHighRiskHPV == true)
            {
                YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetHPV.PanelSetId);
                if (this.m_HasThinPrepPap == true)
                {
                    this.m_Method.AppendLine();
                    this.m_Method.AppendLine();

                    this.m_References.AppendLine();
                    this.m_References.AppendLine();
                }
                this.m_Method.AppendLine("High Risk HPV: " + hpvTestOrder.TestInformation);
                this.m_References.AppendLine("High Risk HPV: " + hpvTestOrder.ReportReferences);
            }

            if (this.m_HasHPV1618 == true)
            {
                if (this.m_HasThinPrepPap == true && this.m_HasHighRiskHPV == false)
                {
                    this.m_Method.AppendLine();
                    this.m_Method.AppendLine();
                    this.m_References.AppendLine();
                    this.m_References.AppendLine();
                }
                else if (this.m_HasHighRiskHPV == true)
                {
                    this.m_Method.AppendLine();
                    this.m_References.AppendLine();
                }
                this.m_Method.AppendLine("HPV Genotypes 16 and 18: " + HPV1618.HPV1618Result.Method);
                this.m_References.AppendLine("HPV Genotypes 16 and 18: " + HPV1618.HPV1618Result.References);
            }

            if (this.m_HasNGCT == true)
            {
                if (this.m_HasThinPrepPap == true && this.m_HasHighRiskHPV == false && this.m_HasHPV1618 == false)
                {
                    this.m_Method.AppendLine();
                    this.m_Method.AppendLine();
                    this.m_References.AppendLine();
                    this.m_References.AppendLine();
                }
                else if (m_HasHighRiskHPV == true || this.m_HasHPV1618 == true)
                {
                    this.m_Method.AppendLine();
                    this.m_References.AppendLine();
                }
                this.m_Method.AppendLine("NG-CT:" + NGCT.NGCTResult.Method);
                this.m_References.AppendLine("NG-CT:" + NGCT.NGCTResult.References);
            }

            if (this.m_HasTrichomonas == true)
            {
                if (this.m_HasThinPrepPap == true && this.m_HasHighRiskHPV == false && this.m_HasHPV1618 == false && this.m_HasNGCT == false)
                {
                    this.m_Method.AppendLine();
                    this.m_Method.AppendLine();
                    this.m_References.AppendLine();
                    this.m_References.AppendLine();
                }
                else if (m_HasHighRiskHPV == true || this.m_HasHPV1618 == true || this.m_HasNGCT == true)
                {
                    this.m_Method.AppendLine();
                    this.m_References.AppendLine();
                }
                this.m_Method.AppendLine("Trichomonas Vaginalis:" + Trichomonas.TrichomonasResult.Method);
                this.m_References.AppendLine("Trichomonas Vaginalis:" + Trichomonas.TrichomonasResult.References);
            }
        }
        public override void ToXml(XElement document)
        {
            WomensHealthProfileTestOrder womensHealthProfileTestOrder = (WomensHealthProfileTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);
            WomensHealthProfileResult    womensHealthProfileResult    = new WomensHealthProfileResult(this.m_AccessionOrder);

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

            ThinPrepPap.ThinPrepPapTest thinPrepPapTest = new ThinPrepPap.ThinPrepPapTest();
            bool hasPap = this.m_AccessionOrder.PanelSetOrderCollection.Exists(thinPrepPapTest.PanelSetId);

            this.AddNextObxElementBeaker("Report No: ", this.m_ReportNo, document, "F");

            if (hasPap == true)
            {
                StringBuilder papTest = new StringBuilder();

                YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology panelSetOrderCytology = (YellowstonePathology.Business.Test.ThinPrepPap.PanelSetOrderCytology) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(15);
                if (string.IsNullOrEmpty(panelSetOrderCytology.ScreeningImpression) == false)
                {
                    papTest.AppendLine("Epithelial Cell Description: " + panelSetOrderCytology.ScreeningImpression);
                }

                papTest.AppendLine("Specimen Adequacy: " + panelSetOrderCytology.SpecimenAdequacy);

                if (string.IsNullOrEmpty(panelSetOrderCytology.OtherConditions) == false)
                {
                    papTest.AppendLine("Other Conditions: " + panelSetOrderCytology.OtherConditions);
                }

                if (string.IsNullOrEmpty(panelSetOrderCytology.ReportComment) == false)
                {
                    papTest.AppendLine("Comment: " + panelSetOrderCytology.ReportComment);
                }

                YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology screeningPanelOrder = null;
                YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology reviewPanelOrder    = null;

                foreach (YellowstonePathology.Business.Interface.IPanelOrder panelOrder in panelSetOrderCytology.PanelOrders)
                {
                    Type objectType = panelOrder.GetType();
                    if (typeof(YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology).IsAssignableFrom(objectType) == true)
                    {
                        YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology cytologyPanelOrder = (YellowstonePathology.Business.Test.ThinPrepPap.PanelOrderCytology)panelOrder;
                        if (cytologyPanelOrder.PanelId == 38)
                        {
                            if (cytologyPanelOrder.ScreeningType == "Primary Screening")
                            {
                                screeningPanelOrder = cytologyPanelOrder;
                            }
                            else if (cytologyPanelOrder.ScreeningType == "Pathologist Review")
                            {
                                reviewPanelOrder = cytologyPanelOrder;
                            }
                            else if (cytologyPanelOrder.ScreeningType == "Cytotech Review")
                            {
                                if (reviewPanelOrder == null || reviewPanelOrder.ScreeningType != "Pathologist Review")
                                {
                                    reviewPanelOrder = cytologyPanelOrder;
                                }
                            }
                        }
                    }
                }

                YellowstonePathology.Business.User.SystemUser systemUser = YellowstonePathology.Business.User.SystemUserCollectionInstance.Instance.SystemUserCollection.GetSystemUserById(screeningPanelOrder.ScreenedById);
                if (string.IsNullOrEmpty(systemUser.Signature) == false)
                {
                    papTest.AppendLine("Screened By: " + systemUser.Signature);
                }

                string cytoTechFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(screeningPanelOrder.AcceptedDate);
                papTest.AppendLine("E-Signed " + cytoTechFinal);

                if (reviewPanelOrder != null)
                {
                    string reviewedBy      = YellowstonePathology.Business.User.SystemUserCollectionInstance.Instance.SystemUserCollection.GetSystemUserById(reviewPanelOrder.ScreenedById).Signature;
                    string reviewedByFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(reviewPanelOrder.AcceptedDate);

                    if (reviewedBy.IndexOf("MD") >= 0)
                    {
                        papTest.AppendLine("Interpreted By: " + reviewedBy + " " + reviewedByFinal);
                    }
                    else
                    {
                        papTest.AppendLine("Reviewed By: " + reviewedBy + " " + reviewedByFinal);
                    }
                }
                this.AddNextObxElementBeaker("PAP TEST RESULT: ", papTest.ToString(), 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"));
                        }
                    }
                }
                amendments.AppendLine();
                this.AddNextObxElementBeaker("Amendments", amendments.ToString(), document, "F");
            }

            StringBuilder testsPerformed = new StringBuilder();

            YellowstonePathology.Business.Test.HPV.HPVTest                 panelSetHPV         = new YellowstonePathology.Business.Test.HPV.HPVTest();
            YellowstonePathology.Business.Test.HPV1618.HPV1618Test         panelSetHPV1618     = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
            YellowstonePathology.Business.Test.NGCT.NGCTTest               panelSetNGCT        = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
            YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest panelSetTrichomonas = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();

            if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetNGCT.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetTrichomonas.PanelSetId) == false)
            {
                testsPerformed.AppendLine("No tests performed");
            }
            else
            {
                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV.PanelSetId);
                    testsPerformed.AppendLine("High Risk HPV: " + hpvTestOrder.Result);
                    testsPerformed.AppendLine("Reference: Negative");
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(hpvTestOrder.FinalDate);
                    testsPerformed.AppendLine("Date Finalized: " + hpvFinal);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.HPV1618.PanelSetOrderHPV1618 panelSetOrderHPV1618 = (YellowstonePathology.Business.Test.HPV1618.PanelSetOrderHPV1618) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV1618.PanelSetId);
                    testsPerformed.AppendLine("HPV type 16: " + panelSetOrderHPV1618.HPV16Result);
                    testsPerformed.AppendLine("Reference: Negative");

                    testsPerformed.AppendLine("HPV type 18: " + panelSetOrderHPV1618.HPV18Result);
                    testsPerformed.AppendLine("Reference: Negative");
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrderHPV1618.FinalDate);
                    testsPerformed.AppendLine("Date Finalized: " + hpvFinal);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetNGCT.PanelSetId) == true)
                {
                    //testsPerformed.AppendLine("Chlamydia Gonorrhea Screening");
                    YellowstonePathology.Business.Test.NGCT.NGCTTestOrder panelSetOrderNGCT = (YellowstonePathology.Business.Test.NGCT.NGCTTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetNGCT.PanelSetId);
                    testsPerformed.AppendLine("Chlamydia trachomatis: " + panelSetOrderNGCT.ChlamydiaTrachomatisResult);
                    testsPerformed.AppendLine("Reference: Negative");

                    testsPerformed.AppendLine("Neisseria gonorrhoeae: " + panelSetOrderNGCT.NeisseriaGonorrhoeaeResult);
                    testsPerformed.AppendLine("Reference: Negative");
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrderNGCT.FinalDate);
                    testsPerformed.AppendLine("Date Finalized: " + hpvFinal);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetTrichomonas.PanelSetId) == true)
                {
                    //testsPerformed.AppendLine("Trichomonas Screening");
                    YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder reportOrderTrichomonas = (YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetTrichomonas.PanelSetId);
                    testsPerformed.AppendLine("Trichomonas vaginalis: " + reportOrderTrichomonas.Result);
                    testsPerformed.AppendLine("Reference: Negative");
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(reportOrderTrichomonas.FinalDate);
                    testsPerformed.AppendLine("Date Finalized: " + hpvFinal);
                }
            }
            this.AddNextObxElementBeaker("CURRENT MOLECULAR TEST SUMMARY", testsPerformed.ToString(), document, "F");

            this.AddNextObxElementBeaker("Specimen Description: ", "Thin Prep Fluid", document, "F");
            this.AddNextObxElementBeaker("Specimen Source: ", this.m_AccessionOrder.SpecimenOrderCollection[0].SpecimenSource, document, "F");
            string collectionDateTimeString = this.m_AccessionOrder.SpecimenOrderCollection[0].GetCollectionDateTimeString();

            this.AddNextObxElementBeaker("Collection Date/Time: ", collectionDateTimeString, document, "F");

            this.AddNextObxElementBeaker("Clinical History: ", this.m_AccessionOrder.ClinicalHistory, document, "F");

            this.AddNextObxElementBeaker("Method: ", womensHealthProfileResult.Method, document, "F");

            this.AddNextObxElementBeaker("References: ", womensHealthProfileResult.References, document, "F");

            string locationPerformed = womensHealthProfileTestOrder.GetLocationPerformedComment();

            this.AddNextObxElementBeaker("Location Performed: ", locationPerformed, document, "F");

            StringBuilder priorTests = new StringBuilder();

            YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest panelSetThinPrepPap = new YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest();
            DateTime cutoffDate = this.m_AccessionOrder.AccessionDate.Value.AddYears(-5);

            YellowstonePathology.Business.Domain.PatientHistory patientHistory         = YellowstonePathology.Business.Gateway.AccessionOrderGateway.GetPatientHistory(this.m_AccessionOrder.PatientId);
            YellowstonePathology.Business.Domain.PatientHistory priorPapRelatedHistory = patientHistory.GetPriorPapRelatedHistory(this.m_AccessionOrder.MasterAccessionNo, cutoffDate);

            if (priorPapRelatedHistory.Count == 0)
            {
                priorTests.AppendLine("No prior tests performed");
            }
            else
            {
                foreach (YellowstonePathology.Business.Domain.PatientHistoryResult patientHistoryResult in priorPapRelatedHistory)
                {
                    YellowstonePathology.Business.Test.AccessionOrder accessionOrder = YellowstonePathology.Business.Persistence.DocumentGateway.Instance.GetAccessionOrderByMasterAccessionNo(patientHistoryResult.MasterAccessionNo);
                    foreach (YellowstonePathology.Business.Test.PanelSetOrder panelSetOrder in accessionOrder.PanelSetOrderCollection)
                    {
                        string reportNo = null;
                        string result   = null;

                        if (panelSetOrder.PanelSetId == panelSetThinPrepPap.PanelSetId ||
                            panelSetOrder.PanelSetId == panelSetHPV.PanelSetId ||
                            panelSetOrder.PanelSetId == panelSetHPV1618.PanelSetId ||
                            panelSetOrder.PanelSetId == panelSetNGCT.PanelSetId ||
                            panelSetOrder.PanelSetId == panelSetTrichomonas.PanelSetId)
                        {
                            reportNo = panelSetOrder.ReportNo;
                            string finaldate = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrder.FinalDate);
                            result = panelSetOrder.GetResultWithTestName();
                            priorTests.AppendLine("Test: " + panelSetOrder.PanelSetName + " Report No: " + reportNo + " Result: " + result + " Final Date: " + finaldate);
                        }
                    }
                }
            }
            this.AddNextObxElementBeaker("PRIOR PAP AND GYN MOLECULAR TESTS", priorTests.ToString(), document, "F");
        }
        public Audit.Model.AuditResult CheckFinaledUnsatResultWithAssociatedCases(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
        {
            Audit.Model.AuditResult result = new Audit.Model.AuditResult();
            result.Status = Audit.Model.AuditStatusEnum.OK;

            StringBuilder message = new StringBuilder();

            message.Append("The previously reported ");
            StringBuilder comment = new StringBuilder();

            comment.Append("Because the specimen is unsatisfactory for evaluation, the previously reported ");

            if (this.ScreeningType.ToUpper() == "FINAL RESULT" && Business.User.SystemIdentity.Instance.User.IsUserInRole(User.SystemUserRoleDescriptionEnum.Pathologist) == true)
            {
                if (YellowstonePathology.Business.Cytology.Model.CytologyResultCode.IsResultCodeUnsat(this.ResultCode) == true)
                {
                    bool hasHPVNeg   = false;
                    bool hasNGCTNeg  = false;
                    bool hasTrichNeg = false;

                    YellowstonePathology.Business.Test.HPV.HPVTest   panelSetHPV  = new YellowstonePathology.Business.Test.HPV.HPVTest();
                    YellowstonePathology.Business.Test.NGCT.NGCTTest panelSetNGCT = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
                    YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest panelSetTrichomonas = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();


                    if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true)
                    {
                        YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (HPV.HPVTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV.PanelSetId);
                        if (hpvTestOrder.Final == true && hpvTestOrder.Result == HPV.HPVResult.NegativeResult)
                        {
                            hasHPVNeg = true;
                            message.Append(panelSetHPV.PanelSetName);
                            comment.Append(panelSetHPV.PanelSetName + " (YPI report # " + hpvTestOrder.ReportNo + ")");
                        }
                    }
                    if (accessionOrder.PanelSetOrderCollection.Exists(panelSetNGCT.PanelSetId) == true)
                    {
                        YellowstonePathology.Business.Test.NGCT.NGCTTestOrder ngctTestOrder = (NGCT.NGCTTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetNGCT.PanelSetId);
                        if (ngctTestOrder.Final == true && ngctTestOrder.NGResultCode == NGCT.NGCTResult.NGNegativeResultCode && ngctTestOrder.CTResultCode == NGCT.NGCTResult.CTNegativeResultCode)
                        {
                            hasNGCTNeg = true;
                            if (hasHPVNeg == true)
                            {
                                message.Append(", ");
                                comment.Append(", ");
                            }
                            message.AppendLine(panelSetNGCT.PanelSetName);
                            comment.Append(panelSetNGCT.PanelSetName + " (YPI report # " + ngctTestOrder.ReportNo + ")");
                        }
                    }
                    if (accessionOrder.PanelSetOrderCollection.Exists(panelSetTrichomonas.PanelSetId) == true)
                    {
                        YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder trichTestOrder = (Trichomonas.TrichomonasTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetTrichomonas.PanelSetId);
                        if (trichTestOrder.Final == true && trichTestOrder.ResultCode == "TRCHMNSNEG")
                        {
                            hasTrichNeg = true;
                            if (hasHPVNeg == true || hasNGCTNeg == true)
                            {
                                message.Append(", ");
                                comment.Append(", ");
                            }
                            message.AppendLine(panelSetTrichomonas.PanelSetName);
                            comment.Append(panelSetTrichomonas.PanelSetName + " (YPI report # " + trichTestOrder.ReportNo + ")");
                        }
                    }

                    if (hasHPVNeg || hasNGCTNeg || hasTrichNeg)
                    {
                        result.Status = Audit.Model.AuditStatusEnum.Failure;
                        if ((hasHPVNeg == true && (hasNGCTNeg == true || hasTrichNeg == true)) ||
                            (hasNGCTNeg == true && hasTrichNeg == true))
                        {
                            message.Append(" tests for this sample are NEGATIVE.  As the final Pap interpretation is UNSATIFACTORY, the results of the molecular ");
                            message.AppendLine("tests may not be accurate.  The following comment will be inserted in the report:");
                            comment.Append(" test results");
                        }
                        else
                        {
                            message.Append(" test for this sample is NEGATIVE.  As the final Pap interpretation is UNSATIFACTORY, the results of the molecular ");
                            message.AppendLine("test may not be accurate.  The following comment will be inserted in the report:");
                            comment.Append(" test result");
                        }

                        message.AppendLine();
                        message.Append("Comment: ");

                        comment.Append(" may not be reliable.  Repeat molecular analysis and/or Pap test may be warranted.  Recommend clinical correlation.");
                        message.AppendLine(comment.ToString());

                        if (string.IsNullOrEmpty(this.ReportComment) == false)
                        {
                            this.ReportComment += Environment.NewLine + Environment.NewLine;
                        }
                        this.ReportComment += comment.ToString();
                        result.Message      = message.ToString();
                    }
                }
            }
            return(result);
        }
Beispiel #16
0
        private void SetCurrentMolecularResults()
        {
            XmlNode mainTableNode  = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='molecular_test']", this.m_NameSpaceManager);
            XmlNode rowTestNode    = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='molecular_test']", this.m_NameSpaceManager);
            XmlNode rowResultNode  = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='test_result']", this.m_NameSpaceManager);
            XmlNode rowBlankRow    = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='blank_row']", this.m_NameSpaceManager);
            XmlNode insertAfterRow = rowBlankRow;

            string headerText = "High Risk HPV Testing";

            YellowstonePathology.Business.Test.HPV.HPVTest panelSetHPV = new YellowstonePathology.Business.Test.HPV.HPVTest();
            if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.HPV.HPVTestOrder hpvTestOrder = (YellowstonePathology.Business.Test.HPV.HPVTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV.PanelSetId);
                XmlNode rowTestNodeClone = rowTestNode.Clone();
                rowTestNodeClone.SelectSingleNode("descendant::w:r[w:t='molecular_test']/w:t", this.m_NameSpaceManager).InnerText = headerText;
                mainTableNode.InsertAfter(rowTestNodeClone, insertAfterRow);
                insertAfterRow = rowTestNodeClone;

                XmlNode rowResultNodeClone = rowResultNode.Clone();
                rowResultNodeClone.SelectSingleNode("descendant::w:r[w:t='test_name']/w:t", this.m_NameSpaceManager).InnerText      = "High Risk HPV";
                rowResultNodeClone.SelectSingleNode("descendant::w:r[w:t='test_result']/w:t", this.m_NameSpaceManager).InnerText    = hpvTestOrder.Result;
                rowResultNodeClone.SelectSingleNode("descendant::w:r[w:t='test_reference']/w:t", this.m_NameSpaceManager).InnerText = "Negative";
                string testFinaldate = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(hpvTestOrder.FinalDate);
                rowResultNodeClone.SelectSingleNode("descendant::w:r[w:t='test_final_date']/w:t", this.m_NameSpaceManager).InnerText = testFinaldate;
                mainTableNode.InsertAfter(rowResultNodeClone, insertAfterRow);
                insertAfterRow = rowResultNodeClone;

                XmlNode rowBlankRowClone = rowBlankRow.Clone();
                rowBlankRowClone.SelectSingleNode("descendant::w:r[w:t='blank_row']/w:t", this.m_NameSpaceManager).InnerText = string.Empty;
                mainTableNode.InsertAfter(rowBlankRowClone, insertAfterRow);
                insertAfterRow = rowBlankRowClone;
            }

            headerText = "HPV Genotyping";
            YellowstonePathology.Business.Test.HPV1618.HPV1618Test panelSetHPV1618 = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
            if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.HPV1618.PanelSetOrderHPV1618 panelSetOrderHPV1618 = (YellowstonePathology.Business.Test.HPV1618.PanelSetOrderHPV1618) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetHPV1618.PanelSetId);
                XmlNode rowTestNodeClone = rowTestNode.Clone();
                rowTestNodeClone.SelectSingleNode("descendant::w:r[w:t='molecular_test']/w:t", this.m_NameSpaceManager).InnerText = headerText;
                mainTableNode.InsertAfter(rowTestNodeClone, insertAfterRow);
                insertAfterRow = rowTestNodeClone;

                XmlNode rowResultNode16Clone = rowResultNode.Clone();
                rowResultNode16Clone.SelectSingleNode("descendant::w:r[w:t='test_name']/w:t", this.m_NameSpaceManager).InnerText      = "HPV type 16";
                rowResultNode16Clone.SelectSingleNode("descendant::w:r[w:t='test_result']/w:t", this.m_NameSpaceManager).InnerText    = panelSetOrderHPV1618.HPV16Result;
                rowResultNode16Clone.SelectSingleNode("descendant::w:r[w:t='test_reference']/w:t", this.m_NameSpaceManager).InnerText = "Negative";
                string testFinaldate = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrderHPV1618.FinalDate);
                rowResultNode16Clone.SelectSingleNode("descendant::w:r[w:t='test_final_date']/w:t", this.m_NameSpaceManager).InnerText = testFinaldate;
                mainTableNode.InsertAfter(rowResultNode16Clone, insertAfterRow);
                insertAfterRow = rowResultNode16Clone;

                XmlNode rowResultNode18Clone = rowResultNode.Clone();
                rowResultNode18Clone.SelectSingleNode("descendant::w:r[w:t='test_name']/w:t", this.m_NameSpaceManager).InnerText       = "HPV type 18";
                rowResultNode18Clone.SelectSingleNode("descendant::w:r[w:t='test_result']/w:t", this.m_NameSpaceManager).InnerText     = panelSetOrderHPV1618.HPV18Result;
                rowResultNode18Clone.SelectSingleNode("descendant::w:r[w:t='test_reference']/w:t", this.m_NameSpaceManager).InnerText  = "Negative";
                rowResultNode18Clone.SelectSingleNode("descendant::w:r[w:t='test_final_date']/w:t", this.m_NameSpaceManager).InnerText = string.Empty;
                mainTableNode.InsertAfter(rowResultNode18Clone, insertAfterRow);
                insertAfterRow = rowResultNode18Clone;

                XmlNode rowBlankRowClone = rowBlankRow.Clone();
                rowBlankRowClone.SelectSingleNode("descendant::w:r[w:t='blank_row']/w:t", this.m_NameSpaceManager).InnerText = string.Empty;
                mainTableNode.InsertAfter(rowBlankRowClone, insertAfterRow);
                insertAfterRow = rowBlankRowClone;
            }

            headerText = "Chlamydia Gonorrhea Screening";
            YellowstonePathology.Business.Test.NGCT.NGCTTest panelSetNGCT = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
            if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetNGCT.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.NGCT.NGCTTestOrder panelSetOrderNGCT = (YellowstonePathology.Business.Test.NGCT.NGCTTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetNGCT.PanelSetId);
                this.SetXmlNodeData("chlamydia_gonorrhea_screening", string.Empty);
                this.SetXmlNodeData("ct_result", panelSetOrderNGCT.ChlamydiaTrachomatisResult);
                this.SetXmlNodeData("ng_result", panelSetOrderNGCT.NeisseriaGonorrhoeaeResult);
                string hpvFinaldate = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrderNGCT.FinalDate);
                this.SetXmlNodeData("ngct_final_date", hpvFinaldate);


                XmlNode rowTestNodeClone = rowTestNode.Clone();
                rowTestNodeClone.SelectSingleNode("descendant::w:r[w:t='molecular_test']/w:t", this.m_NameSpaceManager).InnerText = headerText;
                mainTableNode.InsertAfter(rowTestNodeClone, insertAfterRow);
                insertAfterRow = rowTestNodeClone;

                XmlNode rowResultNodeCtClone = rowResultNode.Clone();
                rowResultNodeCtClone.SelectSingleNode("descendant::w:r[w:t='test_name']/w:t", this.m_NameSpaceManager).InnerText      = "Chlamydia trachomatis";
                rowResultNodeCtClone.SelectSingleNode("descendant::w:r[w:t='test_result']/w:t", this.m_NameSpaceManager).InnerText    = panelSetOrderNGCT.ChlamydiaTrachomatisResult;
                rowResultNodeCtClone.SelectSingleNode("descendant::w:r[w:t='test_reference']/w:t", this.m_NameSpaceManager).InnerText = "Negative";
                string testFinaldate = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrderNGCT.FinalDate);
                rowResultNodeCtClone.SelectSingleNode("descendant::w:r[w:t='test_final_date']/w:t", this.m_NameSpaceManager).InnerText = testFinaldate;
                mainTableNode.InsertAfter(rowResultNodeCtClone, insertAfterRow);
                insertAfterRow = rowResultNodeCtClone;

                XmlNode rowResultNodeNgClone = rowResultNode.Clone();
                rowResultNodeNgClone.SelectSingleNode("descendant::w:r[w:t='test_name']/w:t", this.m_NameSpaceManager).InnerText       = "Neisseria gonorrhoeae";
                rowResultNodeNgClone.SelectSingleNode("descendant::w:r[w:t='test_result']/w:t", this.m_NameSpaceManager).InnerText     = panelSetOrderNGCT.NeisseriaGonorrhoeaeResult;
                rowResultNodeNgClone.SelectSingleNode("descendant::w:r[w:t='test_reference']/w:t", this.m_NameSpaceManager).InnerText  = "Negative";
                rowResultNodeNgClone.SelectSingleNode("descendant::w:r[w:t='test_final_date']/w:t", this.m_NameSpaceManager).InnerText = string.Empty;
                mainTableNode.InsertAfter(rowResultNodeNgClone, insertAfterRow);
                insertAfterRow = rowResultNodeNgClone;

                XmlNode rowBlankRowClone = rowBlankRow.Clone();
                rowBlankRowClone.SelectSingleNode("descendant::w:r[w:t='blank_row']/w:t", this.m_NameSpaceManager).InnerText = string.Empty;
                mainTableNode.InsertAfter(rowBlankRowClone, insertAfterRow);
                insertAfterRow = rowBlankRowClone;
            }

            headerText = "Trichomonas Screening";
            YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest panelSetTrichomonas = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();
            if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetTrichomonas.PanelSetId) == true)
            {
                YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder reportOrderTrichomonas = (YellowstonePathology.Business.Test.Trichomonas.TrichomonasTestOrder) this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(panelSetTrichomonas.PanelSetId);
                XmlNode rowTestNodeClone = rowTestNode.Clone();
                rowTestNodeClone.SelectSingleNode("descendant::w:r[w:t='molecular_test']/w:t", this.m_NameSpaceManager).InnerText = headerText;
                mainTableNode.InsertAfter(rowTestNodeClone, insertAfterRow);
                insertAfterRow = rowTestNodeClone;

                XmlNode rowResultNodeClone = rowResultNode.Clone();
                rowResultNodeClone.SelectSingleNode("descendant::w:r[w:t='test_name']/w:t", this.m_NameSpaceManager).InnerText      = "Trichomonas vaginalis";
                rowResultNodeClone.SelectSingleNode("descendant::w:r[w:t='test_result']/w:t", this.m_NameSpaceManager).InnerText    = reportOrderTrichomonas.Result;
                rowResultNodeClone.SelectSingleNode("descendant::w:r[w:t='test_reference']/w:t", this.m_NameSpaceManager).InnerText = "Negative";
                string testFinaldate = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(reportOrderTrichomonas.FinalDate);
                rowResultNodeClone.SelectSingleNode("descendant::w:r[w:t='test_final_date']/w:t", this.m_NameSpaceManager).InnerText = testFinaldate;
                mainTableNode.InsertAfter(rowResultNodeClone, insertAfterRow);
                insertAfterRow = rowResultNodeClone;
            }

            if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetNGCT.PanelSetId) == false &&
                this.m_AccessionOrder.PanelSetOrderCollection.Exists(panelSetTrichomonas.PanelSetId) == false)
            {
                rowResultNode.SelectSingleNode("descendant::w:r[w:t='test_name']/w:t", this.m_NameSpaceManager).InnerText       = "No tests performed";
                rowResultNode.SelectSingleNode("descendant::w:r[w:t='test_reference']/w:t", this.m_NameSpaceManager).InnerText  = string.Empty;
                rowResultNode.SelectSingleNode("descendant::w:r[w:t='test_result']/w:t", this.m_NameSpaceManager).InnerText     = string.Empty;
                rowResultNode.SelectSingleNode("descendant::w:r[w:t='test_final_date']/w:t", this.m_NameSpaceManager).InnerText = string.Empty;
            }
            else
            {
                this.DeleteRow("test_result");
            }

            this.DeleteRow("molecular_test");
            this.DeleteRow("blank_row");
        }