Пример #1
0
        public static void PLdataReceived(object receivedata, string name)//处理血小板样本测试结果  ORU_RO1
        {
            PLManager.PL12       data = (PLManager.PL12)receivedata;
            HL7Manager.HL7Struct hl7  = new HL7Manager.HL7Struct();
            hl7.Item = new List <string>();

            PipeParser Parser = new PipeParser();
            ORU_R01    oruR01 = new ORU_R01();

            #region 消息段封装
            //MSH段,位于消息最前面
            oruR01.MSH.FieldSeparator.Value                 = "|";
            oruR01.MSH.EncodingCharacters.Value             = @"^~\&";
            oruR01.MSH.SendingApplication.NamespaceID.Value = GlobalVariable.Manufacturer; //仪器供应商
            oruR01.MSH.SendingFacility.NamespaceID.Value    = data.DEVEICE;
            oruR01.MSH.DateTimeOfMessage.TimeOfAnEvent.SetLongDate(DateTime.Now);          //当前时间
            oruR01.MSH.MessageType.MessageType.Value       = "ORU";
            oruR01.MSH.MessageType.TriggerEvent.Value      = "R01";
            oruR01.MSH.MessageControlID.Value              = "1";
            oruR01.MSH.ProcessingID.ProcessingID.Value     = "P";
            oruR01.MSH.VersionID.VersionID.Value           = "2.3.1";
            oruR01.MSH.ApplicationAcknowledgmentType.Value = "0";//样本测试结果
            oruR01.MSH.GetCharacterSet(0).Value            = GlobalVariable.SocketCode ? "ASCII" : "UTF8";
            //没有病人信息,PID段直接省略
            //OBR段,用于传输关于检验报告相关的医嘱信息
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.SetIDOBR.Value = "1";
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.PlacerOrderNumber.EntityIdentifier.Value = data.SAMPLE_ID;
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.ObservationDateTime.TimeOfAnEvent.SetLongDate(data.TEST_TIME);
            //0BX段,用于在报告消息中传递观察的信息
            ORU_R01_ORDER_OBSERVATION orderObservation = oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION();

            int num = data.Result.Count();
            if (num != 0)
            {
                OBX[]  obx = new OBX[num + 1];
                CE[]   ce  = new CE[num + 1];
                Varies value;

                obx[0] = orderObservation.GetOBSERVATION(0).OBX;
                obx[0].SetIDOBX.Value         = "1";
                obx[0].ValueType.Value        = "NM";
                obx[0].ObservationSubID.Value = "AAP";
                obx[0].ObservationIdentifier.Identifier.Value = "诱聚剂项目";
                ce[0]                  = new CE(oruR01);
                value                  = obx[0].GetObservationValue(0);
                value.Data             = ce[0];
                ce[0].Identifier.Value = data.AAP;
                for (int i = 1; i <= num; i++)
                {
                    obx[i] = orderObservation.GetOBSERVATION(i).OBX;
                    obx[i].SetIDOBX.Value         = (i + 1).ToString();
                    obx[i].ValueType.Value        = "NM";
                    obx[i].ObservationSubID.Value = data.Result[i - 1].ITEM;
                    obx[i].ObservationIdentifier.Identifier.Value = data.Result[i - 1].FULL_NAME;

                    ce[i]                  = new CE(oruR01);
                    value                  = obx[i].GetObservationValue(0);
                    value.Data             = ce[i];
                    ce[i].Identifier.Value = data.Result[i - 1].RESULT.ToString();
                    if (data.Result[i - 1].UNIT != string.Empty)
                    {
                        obx[i].Units.Identifier.Value = data.Result[i - 1].UNIT;
                    }
                    if (data.Result[i - 1].NORMAL_HIGH != 0)
                    {
                        obx[i].ReferencesRange.Value     = data.Result[i - 1].NORMAL_LOW.ToString() + "---" + data.Result[i - 1].NORMAL_HIGH.ToString();
                        obx[i].GetAbnormalFlags(0).Value = data.Result[i - 1].INDICATE;
                    }
                    hl7.Item.Add(data.Result[i - 1].ITEM);
                }
            }
            #endregion

            hl7.HL7Message = Parser.Encode(oruR01);
            hl7.Sample_ID  = data.SAMPLE_ID;
            hl7.Device     = data.DEVEICE;
            hl7Manager.AddHL7(hl7);
        }
Пример #2
0
        public static void DSdataReceived(object receivedata, string name)//处理生化仪样本测试结果 ORU_R01
        {
            DI800Manager.DI800   data = (DI800Manager.DI800)receivedata;
            HL7Manager.HL7Struct hl7  = new HL7Manager.HL7Struct();
            hl7.Item = new List <string>();

            PipeParser Parser = new PipeParser();
            ORU_R01    oruR01 = new ORU_R01();

            #region 消息段封装
            //MSH段,位于消息最前面
            oruR01.MSH.FieldSeparator.Value                 = "|";
            oruR01.MSH.EncodingCharacters.Value             = @"^~\&";
            oruR01.MSH.SendingApplication.NamespaceID.Value = GlobalVariable.Manufacturer; //仪器供应商
            oruR01.MSH.SendingFacility.NamespaceID.Value    = data.Device;
            oruR01.MSH.DateTimeOfMessage.TimeOfAnEvent.SetLongDate(DateTime.Now);          //当前时间
            oruR01.MSH.MessageType.MessageType.Value       = "ORU";
            oruR01.MSH.MessageType.TriggerEvent.Value      = "R01";
            oruR01.MSH.MessageControlID.Value              = "1";
            oruR01.MSH.ProcessingID.ProcessingID.Value     = "P";
            oruR01.MSH.VersionID.VersionID.Value           = "2.3.1";
            oruR01.MSH.ApplicationAcknowledgmentType.Value = "0";//样本测试结果
            oruR01.MSH.GetCharacterSet(0).Value            = GlobalVariable.SocketCode ? "ASCII" : "UTF8";
            //PID段,主要用来构建病人的个人信息
            oruR01.GetPATIENT_RESULT().PATIENT.PID.SetIDPID.Value = "1";//这个值还要商榷
            oruR01.GetPATIENT_RESULT().PATIENT.PID.GetPatientIdentifierList(0).ID.Value = data.PATIENT_ID;
            oruR01.GetPATIENT_RESULT().PATIENT.PID.GetAlternatePatientIDPID(0).ID.Value = data.BED;
            oruR01.GetPATIENT_RESULT().PATIENT.PID.GetPatientName(0).FamilyLastName.FamilyName.Value = data.FIRST_NAME;
            oruR01.GetPATIENT_RESULT().PATIENT.PID.GetMotherSMaidenName(0).FamilyLastName.FamilyName.Value = data.AREA;
            oruR01.GetPATIENT_RESULT().PATIENT.PID.Sex.Value = data.SEX;

            //OBR段,用于传输关于检验报告相关的医嘱信息
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.SetIDOBR.Value = "1";
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.PlacerOrderNumber.EntityIdentifier.Value = data.SAMPLE_ID;
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.ObservationDateTime.TimeOfAnEvent.SetLongDate(data.TIME);
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.SpecimenReceivedDateTime.TimeOfAnEvent.SetLongDate(data.SEND_TIME);
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.FillerField1.Value = data.DOCTOR;
            oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.FillerField2.Value = data.DEPARTMENT;
            //oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.SpecimenReceivedDateTime.TimeOfAnEvent.Value = data.TIME;
            //0BX段,用于在报告消息中传递观察的信息
            ORU_R01_ORDER_OBSERVATION orderObservation = oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION();
            int num = data.Result.Count();
            if (num != 0)
            {
                OBX[]  obx = new OBX[num];
                CE[]   ce  = new CE[num];
                Varies value;
                for (int i = 0; i < num; i++)
                {
                    obx[i] = orderObservation.GetOBSERVATION(i).OBX;
                    obx[i].SetIDOBX.Value         = (i + 1).ToString();
                    obx[i].ValueType.Value        = "NM";
                    obx[i].ObservationSubID.Value = data.Result[i].ITEM;
                    obx[i].ObservationIdentifier.Identifier.Value = data.Result[i].FULL_NAME;

                    ce[i]                  = new CE(oruR01);
                    value                  = obx[i].GetObservationValue(0);
                    value.Data             = ce[i];
                    ce[i].Identifier.Value = data.Result[i].RESULT.ToString();

                    obx[i].Units.Identifier.Value     = data.Result[i].UNIT;
                    obx[i].ReferencesRange.Value      = data.Result[i].NORMAL_LOW.ToString() + "---" + data.Result[i].NORMAL_HIGH.ToString();
                    obx[i].GetAbnormalFlags(0).Value  = data.Result[i].RESULT > data.Result[i].NORMAL_HIGH ? "H" : (data.Result[i].RESULT < data.Result[i].NORMAL_LOW ? "L" : "N");
                    obx[i].NatureOfAbnormalTest.Value = data.Result[i].INDICATE;
                    hl7.Item.Add(data.Result[i].ITEM);
                }
            }
            #endregion
            hl7.HL7Message = Parser.Encode(oruR01);
            hl7.Sample_ID  = data.SAMPLE_ID;
            hl7.Device     = data.Device;
            hl7.SendTime   = data.SEND_TIME.ToString();
            hl7Manager.AddHL7(hl7);
            log.Info("HL7 DS package " + hl7.Sample_ID);
        }