如何在 c# 中使用 NHapi dll 添加 OBX-5 观察值

本文关键字:添加 dll OBX-5 观察 NHapi | 更新日期: 2023-09-27 18:31:03

 ORU_R01_OBSERVATION observation = orderObservation.GetOBSERVATION(0);
 OBX obx = observation.OBX;
 obx.ValueType.Value = "AD";
 obx.ObservationIdentifier.Identifier.Value = "Report";
 obx.ObservResultStatus.Value = "F";

在这里,我想添加 OBX-5 观测值。我该如何添加这个?

如何在 c# 中使用 NHapi dll 添加 OBX-5 观察值

我知道

这是一个很晚的答案,但我希望它能在未来帮助某人。这就是我设置 OBX 段值的方式。

ORU_R01 oru = new ORU_R01();
ORU_R01_ORDER_OBSERVATION orderObservation = oru.GetRESPONSE().GetORDER_OBSERVATION();
OBX obx = orderObservation.GetOBSERVATION(0).OBX;
obx.ValueType.Value = "AD";
obx.ObservationIdentifier.Identifier.Value = "Report";
obx.ObservResultStatus.Value = "F";
CE ce = new CE(oru);
ce.Identifier.Value = obv.ObservationValue;
Varies value = obx.GetObservationValue(0);
value.Data = ce;

希望这有帮助。

这是

@hardrada最初指向的代码:这是一个迟到的答案,因为我最近一直在尝试自己找到这样的东西,我觉得没有足够的 HL7 示例

它是通过这里的回道机找到的:

http://web.archive.org/web/20130318202508/http://www.ecomb.ch/nhapi-example-for-creating-a-hl7-message-with-msh-pid-pv1-obr-and-obx-segment/

private string createHL7()
{
    ORU_R01 oruR01 = new ORU_R01();
    ORU_R01_ORDER_OBSERVATION orderObservation = oruR01.GetRESPONSE().GetORDER_OBSERVATION();
    ORU_R01_PATIENT patient = oruR01.GetRESPONSE().PATIENT;
    ORU_R01_VISIT visit = patient.VISIT;
    PV1 pv1 = visit.PV1;
    OBR obr = orderObservation.OBR;
    ORU_R01_OBSERVATION observation = orderObservation.GetOBSERVATION(0);
    OBX obx = observation.OBX;
    oruR01.MSH.FieldSeparator.Value = "|";
    oruR01.MSH.EncodingCharacters.Value = @"^~'&";
    oruR01.MSH.SendingApplication.NamespaceID.Value = "SP";
    oruR01.MSH.SendingFacility.NamespaceID.Value = "SPZH";
    oruR01.MSH.ReceivingApplication.NamespaceID.Value = "MF";
    oruR01.MSH.ReceivingFacility.NamespaceID.Value = "INTRA";
    oruR01.MSH.DateTimeOfMessage.TimeOfAnEvent.SetLongDate(DateTime.Now);
    oruR01.MSH.ProcessingID.ProcessingID.Value = "P";
    oruR01.MSH.VersionID.Value = "2.3";
    PID pid = oruR01.GetRESPONSE().PATIENT.PID;
    pid.SetIDPatientID.Value = "12345";
    pid.PatientName.FamilyName.Value = "Joe";
    pid.PatientName.GivenName.Value = "Bloggs";
    pid.DateOfBirth.TimeOfAnEvent.SetLongDate(DateTime.MinValue);
    pid.Sex.Value = "M";
    pv1.SetIDPatientVisit.Value = "1";
    pv1.VisitNumber.ID.Value = "3333333";
    obr.FillerOrderNumber.UniversalID.Value = "123456";
    obr.UniversalServiceIdentifier.Text.Value = "Document";
    obr.ObservationEndDateTime.TimeOfAnEvent.SetLongDate(DateTime.Now);
    obr.ResultStatus.Value = "F";
    obx.SetIDOBX.Value = "0";
    obx.ValueType.Value = "RP";
    obx.ObservationIdentifier.Identifier.Value = "Report";
    PipeParser parser = new PipeParser();
    string encodedMessage = parser.Encode(oruR01);
    return encodedMessage;
}