Exemple #1
0
        public PatientHistory GetPriorPapRelatedHistory(string masterAccessionNo, DateTime cutoffDate)
        {
            PatientHistory result = new PatientHistory();

            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();

            foreach (YellowstonePathology.Business.Domain.PatientHistoryResult patientHistoryResult in this)
            {
                if (patientHistoryResult.MasterAccessionNo != masterAccessionNo)
                {
                    if (DateTime.Compare(patientHistoryResult.AccessionDate, cutoffDate) >= 0)
                    {
                        if (patientHistoryResult.PanelSetId == panelSetThinPrepPap.PanelSetId ||
                            patientHistoryResult.PanelSetId == panelSetHPV.PanelSetId ||
                            patientHistoryResult.PanelSetId == panelSetHPV1618.PanelSetId ||
                            patientHistoryResult.PanelSetId == panelSetNGCT.PanelSetId ||
                            patientHistoryResult.PanelSetId == panelSetTrichomonas.PanelSetId)
                        {
                            if (result.ContainsMasterAccessionNo(patientHistoryResult.MasterAccessionNo) == false)
                            {
                                result.Add(patientHistoryResult);
                            }
                        }
                    }
                }
            }
            return(result);
        }
        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 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 MultiTestDistributionHandlerWHPStandard(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
            : base(accessionOrder)
        {
            this.m_DistributePap     = true;
            this.m_DistributeHPV     = false;
            this.m_DistributeHPV1618 = false;
            this.m_DistributeNGCT    = false;
            this.m_DistributeTrich   = 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.NGCT.NGCTTest               ngctTTest       = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
            YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest trichomonasTest = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();

            this.m_DistributeWHP = false;
            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true)
            {
                this.m_DistributeWHP = true;
            }
            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == true)
            {
                this.m_DistributeWHP = true;
            }
            if (accessionOrder.PanelSetOrderCollection.Exists(ngctTTest.PanelSetId) == true)
            {
                this.m_DistributeWHP = true;
            }
            if (accessionOrder.PanelSetOrderCollection.Exists(trichomonasTest.PanelSetId) == true)
            {
                this.m_DistributeWHP = true;
            }
        }
Exemple #5
0
        private void SetPriorResults()
        {
            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();

            DateTime cutoffDate = this.m_AccessionOrder.AccessionDate.Value.AddYears(-5);

            XmlNode mainTableNode  = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='prior_report_no']", this.m_NameSpaceManager);
            XmlNode rowHistoryNode = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='prior_report_no']", this.m_NameSpaceManager);
            XmlNode insertAfterRow = rowHistoryNode;

            YellowstonePathology.Business.Domain.PatientHistory patientHistory = new 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);

            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;
                    DateTime?finalDate = 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;
                        finalDate = panelSetOrder.FinalDate;
                        result    = panelSetOrder.GetResultWithTestName();
                        XmlNode rowHistoryNodeClone = rowHistoryNode.Clone();
                        string  testFinaldate       = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(finalDate);

                        rowHistoryNodeClone.SelectSingleNode("descendant::w:r[w:t='prior_final_date']/w:t", this.m_NameSpaceManager).InnerText = testFinaldate;
                        rowHistoryNodeClone.SelectSingleNode("descendant::w:r[w:t='prior_report_no']/w:t", this.m_NameSpaceManager).InnerText  = reportNo;
                        rowHistoryNodeClone.SelectSingleNode("descendant::w:r[w:t='prior_result']/w:t", this.m_NameSpaceManager).InnerText     = result;
                        mainTableNode.InsertAfter(rowHistoryNodeClone, insertAfterRow);
                        insertAfterRow = rowHistoryNodeClone;
                    }
                }
            }

            if (patientHistory.Count > 0)
            {
                this.DeleteRow("prior_report_no");
            }
            else
            {
                rowHistoryNode.SelectSingleNode("descendant::w:r[w:t='prior_final_date']/w:t", this.m_NameSpaceManager).InnerText = "No prior tests performed";
                rowHistoryNode.SelectSingleNode("descendant::w:r[w:t='prior_report_no']/w:t", this.m_NameSpaceManager).InnerText  = string.Empty;
                rowHistoryNode.SelectSingleNode("descendant::w:r[w:t='prior_result']/w:t", this.m_NameSpaceManager).InnerText     = string.Empty;
            }
        }
        public MultiTestDistributionHandlerWHP(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
            : base(accessionOrder)
        {
            this.m_AccessionOrder = accessionOrder;
            this.m_PanelSetOrderList = new List<Test.PanelSetOrder>();

            this.m_PanelSetThinPrepPap = new YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest();
            this.m_PanelSetHPV = new Test.HPV.HPVTest();
            this.m_PanelSetHPV1618 = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
            this.m_NGCTTest = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
            this.m_TrichomonasTest = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();
            this.m_WomensHealthProfileTest = new YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest();
            this.m_WomensHealthProfileTestOrder = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_WomensHealthProfileTest.PanelSetId);

            if (this.m_WomensHealthProfileTestOrder.Final == false)
            {
                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_PanelSetThinPrepPap.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder psoThinPrep = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetThinPrepPap.PanelSetId);
                    this.m_PanelSetOrderList.Add(psoThinPrep);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_PanelSetHPV.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder psoHPV = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetHPV.PanelSetId);
                    this.m_PanelSetOrderList.Add(psoHPV);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_PanelSetHPV1618.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder pso1618 = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetHPV1618.PanelSetId);
                    this.m_PanelSetOrderList.Add(pso1618);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_NGCTTest.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder psoNGCT = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_NGCTTest.PanelSetId);
                    this.m_PanelSetOrderList.Add(psoNGCT);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_TrichomonasTest.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder psoTrich = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_TrichomonasTest.PanelSetId);
                    this.m_PanelSetOrderList.Add(psoTrich);
                }

                this.m_PanelSetOrderList.Add(this.m_WomensHealthProfileTestOrder);
            }
        }
        public MultiTestDistributionHandlerWHP(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
            : base(accessionOrder)
        {
            this.m_AccessionOrder    = accessionOrder;
            this.m_PanelSetOrderList = new List <Test.PanelSetOrder>();

            this.m_PanelSetThinPrepPap          = new YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest();
            this.m_PanelSetHPV                  = new Test.HPV.HPVTest();
            this.m_PanelSetHPV1618              = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
            this.m_NGCTTest                     = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
            this.m_TrichomonasTest              = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();
            this.m_WomensHealthProfileTest      = new YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest();
            this.m_WomensHealthProfileTestOrder = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_WomensHealthProfileTest.PanelSetId);

            if (this.m_WomensHealthProfileTestOrder.Final == false)
            {
                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_PanelSetThinPrepPap.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder psoThinPrep = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetThinPrepPap.PanelSetId);
                    this.m_PanelSetOrderList.Add(psoThinPrep);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_PanelSetHPV.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder psoHPV = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetHPV.PanelSetId);
                    this.m_PanelSetOrderList.Add(psoHPV);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_PanelSetHPV1618.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder pso1618 = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_PanelSetHPV1618.PanelSetId);
                    this.m_PanelSetOrderList.Add(pso1618);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_NGCTTest.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder psoNGCT = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_NGCTTest.PanelSetId);
                    this.m_PanelSetOrderList.Add(psoNGCT);
                }

                if (this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_TrichomonasTest.PanelSetId) == true)
                {
                    YellowstonePathology.Business.Test.PanelSetOrder psoTrich = this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_TrichomonasTest.PanelSetId);
                    this.m_PanelSetOrderList.Add(psoTrich);
                }

                this.m_PanelSetOrderList.Add(this.m_WomensHealthProfileTestOrder);
            }
        }
        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;
        }
Exemple #9
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());
        }
Exemple #10
0
 private void IsMarkedOnWomensHealthProfile(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
 {
     YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest womensHealthProfileTest = new YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest();
     if (accessionOrder.PanelSetOrderCollection.Exists(womensHealthProfileTest.PanelSetId) == true)
     {
         YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTestOrder womensHealthProfileTestOrder = (YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(womensHealthProfileTest.PanelSetId);
         if (womensHealthProfileTestOrder.OrderHPV1618 == true)
         {
             YellowstonePathology.Business.Test.HPV1618.HPV1618Test panelSetHPV1618 = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
             if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == false)
             {
                 this.m_ActionRequired = true;
                 this.m_Message.AppendLine("An " + panelSetHPV1618.PanelSetName + " is required but not ordered.");
             }
         }
     }
 }
        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);
        }
 private void IsMarkedOnWomensHealthProfile(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
 {
     YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest womensHealthProfileTest = new YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest();
     if (accessionOrder.PanelSetOrderCollection.Exists(womensHealthProfileTest.PanelSetId) == true)
     {
         YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTestOrder womensHealthProfileTestOrder = (YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(womensHealthProfileTest.PanelSetId);
         if (womensHealthProfileTestOrder.OrderHPV1618 == true)
         {
             YellowstonePathology.Business.Test.HPV1618.HPV1618Test panelSetHPV1618 = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
             if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == false)
             {
                 this.m_ActionRequired = true;
                 this.m_Message.AppendLine("An " + panelSetHPV1618.PanelSetName + " is required but not ordered.");
             }
         }
     }
 }
 private void IsRequiredByStandingOrder(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
 {
     YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest womensHealthProfileTest = new YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest();
     if (accessionOrder.PanelSetOrderCollection.Exists(womensHealthProfileTest.PanelSetId) == true)
     {
         YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTestOrder womensHealthProfileTestOrder = (YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(womensHealthProfileTest.PanelSetId);
         YellowstonePathology.Business.Client.Model.StandingOrder standingOrder = YellowstonePathology.Business.Client.Model.StandingOrderCollection.GetByStandingOrderCode(womensHealthProfileTestOrder.HPV1618StandingOrderCode);
         if (standingOrder.IsRequired(accessionOrder) == true)
         {
             YellowstonePathology.Business.Test.HPV1618.HPV1618Test panelSetHPV1618 = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
             if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == false)
             {
                 this.m_ActionRequired = true;
                 this.m_Message.AppendLine("An " + panelSetHPV1618.PanelSetName + " is required but not ordered.");
             }
         }
     }
 }
Exemple #14
0
 private void IsRequiredByStandingOrder(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
 {
     YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest womensHealthProfileTest = new YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTest();
     if (accessionOrder.PanelSetOrderCollection.Exists(womensHealthProfileTest.PanelSetId) == true)
     {
         YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTestOrder womensHealthProfileTestOrder = (YellowstonePathology.Business.Test.WomensHealthProfile.WomensHealthProfileTestOrder)accessionOrder.PanelSetOrderCollection.GetPanelSetOrder(womensHealthProfileTest.PanelSetId);
         YellowstonePathology.Business.Client.Model.StandingOrder standingOrder = YellowstonePathology.Business.Client.Model.StandingOrderCollection.GetByStandingOrderCode(womensHealthProfileTestOrder.HPV1618StandingOrderCode);
         if (standingOrder.IsRequired(accessionOrder) == true)
         {
             YellowstonePathology.Business.Test.HPV1618.HPV1618Test panelSetHPV1618 = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
             if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == false)
             {
                 this.m_ActionRequired = true;
                 this.m_Message.AppendLine("An " + panelSetHPV1618.PanelSetName + " is required but not ordered.");
             }
         }
     }
 }
        public MultiTestDistributionHandlerWHPStandard(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
            : base(accessionOrder)
        {
            this.m_DistributePap = true;
            this.m_DistributeHPV = false;
            this.m_DistributeHPV1618 = false;
            this.m_DistributeNGCT = false;
            this.m_DistributeTrich = 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.NGCT.NGCTTest ngctTTest = new YellowstonePathology.Business.Test.NGCT.NGCTTest();
            YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest trichomonasTest = new YellowstonePathology.Business.Test.Trichomonas.TrichomonasTest();

            this.m_DistributeHWP = false;
            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV.PanelSetId) == true) this.m_DistributeHWP = true;
            if (accessionOrder.PanelSetOrderCollection.Exists(panelSetHPV1618.PanelSetId) == true) this.m_DistributeHWP = true;
            if (accessionOrder.PanelSetOrderCollection.Exists(ngctTTest.PanelSetId) == true) this.m_DistributeHWP = true;
            if (accessionOrder.PanelSetOrderCollection.Exists(trichomonasTest.PanelSetId) == true) this.m_DistributeHWP = true;
        }
        public WomensHealthProfileResult(YellowstonePathology.Business.Test.AccessionOrder accessionOrder)
        {
            this.m_References = new StringBuilder();
            this.m_Method     = new StringBuilder();

            this.m_AccessionOrder      = accessionOrder;
            this.m_PanelSetThinPrepPap = new YellowstonePathology.Business.Test.ThinPrepPap.ThinPrepPapTest();
            this.m_PanelSetHPV         = new Business.Test.HPV.HPVTest();
            this.m_HPV1618Test         = new HPV1618.HPV1618Test();
            this.m_NGCTTest            = new NGCT.NGCTTest();
            this.m_TrichomonasTest     = new Trichomonas.TrichomonasTest();

            this.m_HasThinPrepPap = this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_PanelSetThinPrepPap.PanelSetId);
            this.m_HasHighRiskHPV = this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_PanelSetHPV.PanelSetId);
            this.m_HasHPV1618     = this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_HPV1618Test.PanelSetId);
            this.m_HasNGCT        = this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_NGCTTest.PanelSetId);
            this.m_HasTrichomonas = this.m_AccessionOrder.PanelSetOrderCollection.Exists(this.m_TrichomonasTest.PanelSetId);

            this.SetData();
        }
        private void HyperLinkOrderHPV1618_Click(object sender, RoutedEventArgs e)
        {
            int HPV1618PanelSetId = 62;

            if (this.m_AccessionOrder.PanelSetOrderCollection.HasPanelSetBeenOrdered(HPV1618PanelSetId) == false)
            {
                YellowstonePathology.Business.Interface.IOrderTarget   orderTarget   = this.m_AccessionOrder.SpecimenOrderCollection.GetOrderTarget(this.m_WomensHealthProfileTestOrder.OrderedOnId);
                YellowstonePathology.Business.Test.HPV1618.HPV1618Test hpv1618Test   = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
                YellowstonePathology.Business.Test.TestOrderInfo       testOrderInfo = new Business.Test.TestOrderInfo(hpv1618Test, orderTarget, true);

                YellowstonePathology.Business.Visitor.OrderTestOrderVisitor orderTestOrderVisitor = new Business.Visitor.OrderTestOrderVisitor(testOrderInfo);
                this.m_AccessionOrder.TakeATrip(orderTestOrderVisitor);

                this.m_AuditCollection.Run();
                this.NotifyPropertyChanged(string.Empty);
            }
            else
            {
                MessageBox.Show("HPV 16/18 has already been ordered.");
            }
        }
        public override void ToXml(XElement document)
        {
            WomensHealthProfileTestOrder womensHealthProfileTestOrder = (WomensHealthProfileTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);
            WomensHealthProfileResult womensHealthProfileResult = new WomensHealthProfileResult(this.m_AccessionOrder);

            this.AddHeader(document, womensHealthProfileTestOrder, "Women's Health Profile");
            this.AddNextObxElement("", document, "F");

            this.AddNextObxElement("PAP TEST RESULT: ", document, "F");

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

            this.AddNextObxElement("Specimen Adequacy:", document, "F");
            this.AddNextObxElement(panelSetOrderCytology.SpecimenAdequacy, document, "F");
            this.AddNextObxElement("", document, "F");

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

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

            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.AddNextObxElement("Screened By: " + systemUser.Signature, document, "F");
            }

            string cytoTechFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(screeningPanelOrder.AcceptedDate);
            this.AddNextObxElement("Date Finalized: " + cytoTechFinal, document, "F");
            this.AddNextObxElement("", document, "F");

            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.AddNextObxElement("Interpreted By: " + reviewedBy + " " + reviewedByFinal, document, "F");
                }
                else
                {
                    this.AddNextObxElement("Reviewed By: " + reviewedBy + " " + reviewedByFinal, document, "F");
                }
                this.AddNextObxElement("", document, "F");
            }

            this.AddAmendments(document);

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

            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.AddNextObxElement("No tests performed ", document, "F");
                this.AddNextObxElement("", document, "F");
            }
            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.AddNextObxElement("High Risk HPV: " + hpvTestOrder.Result, document, "F");
                    this.AddNextObxElement("Reference: Negative", document, "F");
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(hpvTestOrder.FinalDate);
                    this.AddNextObxElement("Date Finalized: " + hpvFinal, document, "F");
                    this.AddNextObxElement("", document, "F");
                }

                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.AddNextObxElement("HPV type 16: " + panelSetOrderHPV1618.HPV16Result, document, "F");
                    this.AddNextObxElement("Reference: Negative", document, "F");

                    this.AddNextObxElement("HPV type 18: " + panelSetOrderHPV1618.HPV18Result, document, "F");
                    this.AddNextObxElement("Reference: Negative", document, "F");
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrderHPV1618.FinalDate);
                    this.AddNextObxElement("Date Finalized: " + hpvFinal, document, "F");
                    this.AddNextObxElement("", document, "F");
                }

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

                    this.AddNextObxElement("Neisseria gonorrhoeae: " + panelSetOrderNGCT.NeisseriaGonorrhoeaeResult, document, "F");
                    this.AddNextObxElement("Reference: Negative", document, "F");
                    string hpvFinal = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(panelSetOrderNGCT.FinalDate);
                    this.AddNextObxElement("Date Finalized: " + hpvFinal, document, "F");
                    this.AddNextObxElement("", document, "F");
                }

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

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

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

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

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

            string locationPerformed = womensHealthProfileTestOrder.GetLocationPerformedComment();
            this.HandleLongString(locationPerformed, document, "F");
            this.AddNextObxElement(string.Empty, document, "F");

            this.AddNextObxElement("PRIOR PAP AND GYN MOLECULAR TESTS", document, "F");
            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.AddNextObxElement("No prior tests performed ", document, "F");
                this.AddNextObxElement("", document, "F");
            }
            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();
                            this.AddNextObxElement("Test: " + panelSetOrder.PanelSetName + " Report No: " + reportNo + " Result: " + result + " Final Date: " + finaldate, document, "F");
                            this.AddNextObxElement("", document, "F");
                        }
                    }
                }
            }
            this.AddNextObxElement("", document, "F");
        }
        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 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 HyperLinkOrderHPV1618_Click(object sender, RoutedEventArgs e)
        {
            int HPV1618PanelSetId = 62;
            if (this.m_AccessionOrder.PanelSetOrderCollection.HasPanelSetBeenOrdered(HPV1618PanelSetId) == false)
            {
                YellowstonePathology.Business.Interface.IOrderTarget orderTarget = this.m_AccessionOrder.SpecimenOrderCollection.GetOrderTarget(this.m_WomensHealthProfileTestOrder.OrderedOnId);
                YellowstonePathology.Business.Test.HPV1618.HPV1618Test hpv1618Test = new YellowstonePathology.Business.Test.HPV1618.HPV1618Test();
                YellowstonePathology.Business.Test.TestOrderInfo testOrderInfo = new Business.Test.TestOrderInfo(hpv1618Test, orderTarget, true);

                YellowstonePathology.Business.Visitor.OrderTestOrderVisitor orderTestOrderVisitor = new Business.Visitor.OrderTestOrderVisitor(testOrderInfo);
                this.m_AccessionOrder.TakeATrip(orderTestOrderVisitor);

                this.m_AuditCollection.Run();
                this.NotifyPropertyChanged(string.Empty);
            }
            else
            {
                MessageBox.Show("HPV 16/18 has already been ordered.");
            }
        }
        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");
        }
Exemple #23
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");
        }
        private void SetPriorResults()
        {
            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();

            DateTime cutoffDate = this.m_AccessionOrder.AccessionDate.Value.AddYears(-5);

            XmlNode mainTableNode = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='prior_report_no']", this.m_NameSpaceManager);
            XmlNode rowHistoryNode = mainTableNode.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='prior_report_no']", this.m_NameSpaceManager);
            XmlNode insertAfterRow = rowHistoryNode;

            YellowstonePathology.Business.Domain.PatientHistory patientHistory = new 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);

            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;
                    DateTime? finalDate = 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;
                        finalDate = panelSetOrder.FinalDate;
                        result = panelSetOrder.GetResultWithTestName();
                        XmlNode rowHistoryNodeClone = rowHistoryNode.Clone();
                        string testFinaldate = YellowstonePathology.Business.Helper.DateTimeExtensions.DateStringFromNullable(finalDate);

                        rowHistoryNodeClone.SelectSingleNode("descendant::w:r[w:t='prior_final_date']/w:t", this.m_NameSpaceManager).InnerText = testFinaldate;
                        rowHistoryNodeClone.SelectSingleNode("descendant::w:r[w:t='prior_report_no']/w:t", this.m_NameSpaceManager).InnerText = reportNo;
                        rowHistoryNodeClone.SelectSingleNode("descendant::w:r[w:t='prior_result']/w:t", this.m_NameSpaceManager).InnerText = result;
                        mainTableNode.InsertAfter(rowHistoryNodeClone, insertAfterRow);
                        insertAfterRow = rowHistoryNodeClone;
                    }
                }
            }

            if (patientHistory.Count > 0)
            {
                this.DeleteRow("prior_report_no");
            }
            else
            {
                rowHistoryNode.SelectSingleNode("descendant::w:r[w:t='prior_final_date']/w:t", this.m_NameSpaceManager).InnerText = "No prior tests performed";
                rowHistoryNode.SelectSingleNode("descendant::w:r[w:t='prior_report_no']/w:t", this.m_NameSpaceManager).InnerText = string.Empty;
                rowHistoryNode.SelectSingleNode("descendant::w:r[w:t='prior_result']/w:t", this.m_NameSpaceManager).InnerText = string.Empty;
            }
        }
        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");
        }