Exemple #1
0
        private HL7Manager.HL7SampleInfo HL7_ParserSampleInfo(string hl7data)
        {
            HL7Manager.HL7SampleInfo hl7info = new HL7Manager.HL7SampleInfo();
            hl7info.ExtraInfo = new List <HL7Manager.HL7ExtraInfo>();

            PipeParser parser = new PipeParser();
            IMessage   m      = parser.Parse(hl7data);
            DSR_Q03    dsr    = m as DSR_Q03;

            #region 解析HL7申请样本信息
            hl7info.AdmissionNumber = dsr.GetDSP(0).DataLine.Value;
            hl7info.BedNumber       = dsr.GetDSP(1).DataLine.Value;
            hl7info.PatientName     = dsr.GetDSP(2).DataLine.Value;
            try
            {
                hl7info.DateOfBirth = DateTime.ParseExact(dsr.GetDSP(3).DataLine.Value, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
            }
            catch
            {
                hl7info.DateOfBirth = GlobalVariable.DefalutTime;
            }
            hl7info.Sex                  = dsr.GetDSP(4).DataLine.Value;
            hl7info.PatientAlias         = dsr.GetDSP(5).DataLine.Value;
            hl7info.Race                 = dsr.GetDSP(6).DataLine.Value;
            hl7info.PatientAddress       = dsr.GetDSP(7).DataLine.Value;
            hl7info.CountryCode          = dsr.GetDSP(8).DataLine.Value;
            hl7info.HomePhoneNumber      = dsr.GetDSP(9).DataLine.Value;
            hl7info.BusinessPhoneNumber  = dsr.GetDSP(10).DataLine.Value;
            hl7info.PrimaryLanguage      = dsr.GetDSP(11).DataLine.Value;
            hl7info.MaritalStatus        = dsr.GetDSP(12).DataLine.Value;
            hl7info.Religion             = dsr.GetDSP(13).DataLine.Value;
            hl7info.PatientAccoutNumber  = dsr.GetDSP(14).DataLine.Value;
            hl7info.SocialSecurityNumber = dsr.GetDSP(15).DataLine.Value;
            hl7info.DriverLicenseNumber  = dsr.GetDSP(16).DataLine.Value;
            hl7info.EthnicGroup          = dsr.GetDSP(17).DataLine.Value;
            hl7info.BirthPlace           = dsr.GetDSP(18).DataLine.Value;
            hl7info.Nationality          = dsr.GetDSP(19).DataLine.Value;
            hl7info.BarCode              = dsr.GetDSP(20).DataLine.Value;
            hl7info.SampleID             = dsr.GetDSP(21).DataLine.Value;
            try
            {
                hl7info.SampleTime = DateTime.ParseExact(dsr.GetDSP(22).DataLine.Value, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
            }
            catch
            {
                hl7info.SampleTime = GlobalVariable.DefalutTime;
            }
            hl7info.IsEmergency      = dsr.GetDSP(23).DataLine.Value == null ? "N" : dsr.GetDSP(23).DataLine.Value;
            hl7info.CollcetionVolume = dsr.GetDSP(24).DataLine.Value;
            hl7info.SampleType       = dsr.GetDSP(25).DataLine.Value;
            hl7info.SampleType       = null;
            hl7info.FetchDoctor      = dsr.GetDSP(26).DataLine.Value;
            hl7info.FetchDepartment  = dsr.GetDSP(27).DataLine.Value;
            hl7info.Device           = dsr.MSH.ReceivingFacility.NamespaceID.Value;
            hl7info.ExtraInfo        = new List <HL7Manager.HL7ExtraInfo>();
            for (int num = 28; (dsr.DSPRepetitionsUsed > 28) && (num < dsr.DSPRepetitionsUsed); ++num)
            {
                HL7Manager.HL7ExtraInfo temp = new HL7Manager.HL7ExtraInfo();
                string   tempString          = dsr.GetDSP(num).DataLine.Value;
                string[] split = tempString.Split(new char[] { '^' });
                temp.TextID   = split[0];
                temp.TextName = split[1];
                temp.Unit     = split[2];
                temp.Normal   = split[3];
                hl7info.ExtraInfo.Add(temp);
            }
            #endregion

            return(hl7info);
        }
 /// <summary>
 /// Add a new DSR_Q03 to DSP
 /// </summary>
 public static DSP AddDSP(this DSR_Q03 message)
 {
     return(message.GetDSP(message.DSPRepetitionsUsed));
 }