Exemple #1
0
        protected virtual ISegment CreateORCSegment(PathologyRequest Request)
        {
            var oORC = Creator.Segment("ORC");

            oORC.Field(1).AsString = "RE";
            //Placer Order number
            oORC.Field(2).AsString = Request.OrderIdentifier;
            //Filler Order number
            oORC.Field(3).AsString = Request.ReportIdentifier;
            //Order status
            oORC.Field(5).AsString = "CM";
            return(oORC);
        }
Exemple #2
0
        protected virtual ISegment CreateOBRSegment(PathologyOrder Order, PathologyRequest Request)
        {
            var oOBR = Creator.Segment("OBR");

            oOBR.Field(1).AsString = "RE";
            //Placer Order number
            oOBR.Field(2).AsString = Request.OrderIdentifier;
            //Filler Order number
            oOBR.Field(3).AsString = Request.ReportIdentifier;

            //Report Name Code (Ordered Item)
            if (Request.ReportName != null)
            {
                //Local Code
                if ((Request.ReportName.LocalCode.IsSet() || Request.ReportName.LocalCodeDescription.IsSet()) && Request.ReportName.LocalCodeSystemCode.IsSet())
                {
                    oOBR.Field(4).Component(3).AsString = Request.ReportName.LocalCodeSystemCode;
                    if (Request.ReportName.LocalCode.IsSet())
                    {
                        oOBR.Field(4).Component(1).AsString = Request.ReportName.LocalCode;
                    }
                    if (Request.ReportName.LocalCodeDescription.IsSet())
                    {
                        oOBR.Field(4).Component(2).AsString = Request.ReportName.LocalCodeDescription;
                    }
                }

                //Snomed-CT Term
                if ((Request.ReportName.SnomedTermValue.IsSet() || Request.ReportName.SnomedPreferedTerm.IsSet()) && Request.ReportName.SnomedSystemCode.IsSet())
                {
                    oOBR.Field(4).Component(6).AsString = Request.ReportName.SnomedSystemCode;
                    if (Request.ReportName.SnomedTermValue.IsSet())
                    {
                        oOBR.Field(4).Component(4).AsString = Request.ReportName.SnomedTermValue;
                    }
                    if (Request.ReportName.SnomedPreferedTerm.IsSet())
                    {
                        oOBR.Field(4).Component(5).AsString = Request.ReportName.SnomedPreferedTerm;
                    }
                }
            }

            //Collection DateTime
            oOBR.Field(7).Convert.DateTime.SetDateTimeOffset(Order.CollectionDateTime, true, PeterPiper.Hl7.V2.Support.Tools.DateTimeSupportTools.DateTimePrecision.DateHourMin);

            //Ordering Provider (We really only need the Family name as mandatory!
            if (Order.OrderingProvider != null)
            {
                if (Order.OrderingProvider.Identifer != null)
                {
                    oOBR.Field(16).Component(1).AsString = Order.OrderingProvider.Identifer.Value;
                    oOBR.Field(16).Component(9).AsString = Order.OrderingProvider.Identifer.AssigningAuthority;
                }
                if (Order.OrderingProvider.Family.IsSet())
                {
                    oOBR.Field(16).Component(2).AsString = Order.OrderingProvider.Family;
                }
                if (Order.OrderingProvider.Given.IsSet())
                {
                    oOBR.Field(16).Component(3).AsString = Order.OrderingProvider.Given;
                }
                if (Order.OrderingProvider.Title.IsSet())
                {
                    oOBR.Field(16).Component(6).AsString = Order.OrderingProvider.Title;
                }
            }

            //Does PCEHR Exist Flag
            if (Order.IsMyHealthRecordDisclosed.HasValue)
            {
                if (Order.IsMyHealthRecordDisclosed.Value)
                {
                    oOBR.Field(20).AsString = $"{Common.HIPS.HipsConfig.MyHealthRecordDiscoveredFlagCode}=Y";
                }
                else
                {
                    oOBR.Field(20).AsString = $"{Common.HIPS.HipsConfig.MyHealthRecordDiscoveredFlagCode}=N";
                }
            }

            //Reported DateTime
            oOBR.Field(22).Convert.DateTime.SetDateTimeOffset(Request.ReportedDateTime, true, PeterPiper.Hl7.V2.Support.Tools.DateTimeSupportTools.DateTimePrecision.DateHourMin);

            //Diagnostic Service Sect ID 0074
            if (Request.DepartmentCode.IsSet())
            {
                oOBR.Field(24).AsString = Request.DepartmentCode;
            }

            //Result Status
            oOBR.Field(25).AsString = Request.ReportStatus.GetLiteral();

            //Ordered DateTime
            oOBR.Field(27).Component(4).Convert.DateTime.SetDateTimeOffset(Order.OrderedDateTime, true, PeterPiper.Hl7.V2.Support.Tools.DateTimeSupportTools.DateTimePrecision.DateHourMin);


            //Author Reporting Pathologists
            if (Request.DocumentAuthor != null)
            {
                if (Request.DocumentAuthor.Identifer != null && Request.DocumentAuthor.Identifer.Value.IsSet() && Request.DocumentAuthor.Identifer.AssigningAuthority.IsSet())
                {
                    oOBR.Field(32).Component(1).SubComponent(1).AsString = Request.DocumentAuthor.Identifer.Value;
                    oOBR.Field(32).Component(1).SubComponent(9).AsString = Request.DocumentAuthor.Identifer.AssigningAuthority;
                }

                if (Request.DocumentAuthor.Family.IsSet())
                {
                    oOBR.Field(32).Component(1).SubComponent(2).AsString = Request.DocumentAuthor.Family;
                }
                if (Request.DocumentAuthor.Given.IsSet())
                {
                    oOBR.Field(32).Component(1).SubComponent(3).AsString = Request.DocumentAuthor.Given;
                }
                if (Request.DocumentAuthor.Title.IsSet())
                {
                    oOBR.Field(32).Component(1).SubComponent(6).AsString = Request.DocumentAuthor.Title;
                }
            }



            return(oOBR);
        }