コード例 #1
0
def responder(m):
    # cria uma mensagem de resposta RSP_K11
    response = Message("RSP_K11")
    response.MSH.MSH_9 = "RSP^K11^RSP_K11"
    response.MSA = "MSA|AA"
    response.MSA.MSA_2 = m.MSH.MSH_10
    qak = Segment("QAK")
    qak.qak_1 = m.QPD.QPD_2
    qak.qak_2 = "OK"
    qak.qak_3 = "Q22^Specimen Labeling Instructions^IHE_LABTF"
    qak.qak_4 = "1"
    response.add(qak)
    response.QPD = m.QPD
    response.PID.PID_1 = '1'
    response.PID.PID_5.PID_5_1 = 'CUNHA'
    response.PID.PID_5.PID_5_2 = 'JOSE'
    response.PID.PID_6 = "19800101"
    response.PID.PID_7 = "F"
    response.PID.PID_23 = "Brasil"
    spm = Segment("SPM")
    obr = Segment("OBR")
    spm.SPM_1 = '1'
    spm.SPM_2 = "12345"
    obr.OBR_4 = "ORDER^DESCRIPTION"
    response.add(spm)
    response.add(obr)
    return response.to_mllp()
コード例 #2
0
ファイル: actor.py プロジェクト: dbunskoek/hl7apy
    def reply(message):
        """
        Parse the incoming message and return the ER7 encoded response

        :param message: incoming message
        :return: response encoded to ER7 - it can be a NAK or RSP_K11 message
        """
        print "Received by LIP", repr(message)

        try:
            # parse the incoming message
            m = parse_message(message, find_groups=False)
        except:
            print 'parsing failed', repr(message)
            response = LIP.nak()
        else:
            print "Message type:", m.MSH.message_type.to_er7()
            print "Message content:", repr(m.to_er7())
            if m.MSH.MSH_9.MSH_9_3.to_er7() == 'QBP_Q11':
                # create a new RSP_K11 message
                response = Message("RSP_K11")
                response.MSH.MSH_9 = "RSP^K11^RSP_K11"
                # add MSA segment
                response.MSA = "MSA|AA"
                response.MSA.MSA_2 = m.MSH.MSH_10
                # create a QAK segment
                qak = Segment("QAK")
                qak.qak_1 = m.QPD.QPD_2
                qak.qak_2 = "OK"
                qak.qak_3 = "Q22^Specimen Labeling Instructions^IHE_LABTF"
                qak.qak_4 = "1"
                # add the QAK segment to the RSP_K11 message
                response.add(qak)
                # copy the QPD segment from the incoming message
                response.QPD = m.QPD
                # create a PID segment
                response.PID.PID_1 = '1'
                response.PID.PID_5.PID_5_1 = 'PATIENT_SURNAME'
                response.PID.PID_5.PID_5_2 = 'PATIENT_NAME'
                response.PID.PID_6 = "19800101"
                response.PID.PID_7 = "F"
                # create a SPM segment
                spm = Segment("SPM")
                # create an OBR segment
                obr = Segment("OBR")
                spm.SPM_1 = '1'
                spm.SPM_2 = "12345"
                obr.OBR_4 = "ORDER^DESCRIPTION"
                # add spm and obr to the RSP_K11 response
                response.add(spm)
                response.add(obr)
            else:
                response = LIP.nak(m)
        return response.to_mllp() # encode to ER7
コード例 #3
0
ファイル: actor.py プロジェクト: tomchiverton/hl7apy
    def reply(message):
        """
        Parse the incoming message and return the ER7 encoded response

        :param message: incoming message
        :return: response encoded to ER7 - it can be a NAK or RSP_K11 message
        """
        print("Received by LIP", repr(message))

        try:
            # parse the incoming message
            m = parse_message(message, find_groups=False)
        except:
            print('parsing failed', repr(message))
            response = LIP.nak()
        else:
            print("Message type:", m.MSH.message_type.to_er7())
            print("Message content:", repr(m.to_er7()))
            if m.MSH.MSH_9.MSH_9_3.to_er7() == 'QBP_Q11':
                # create a new RSP_K11 message
                response = Message("RSP_K11")
                response.MSH.MSH_9 = "RSP^K11^RSP_K11"
                # add MSA segment
                response.MSA = "MSA|AA"
                response.MSA.MSA_2 = m.MSH.MSH_10
                # create a QAK segment
                qak = Segment("QAK")
                qak.qak_1 = m.QPD.QPD_2
                qak.qak_2 = "OK"
                qak.qak_3 = "Q22^Specimen Labeling Instructions^IHE_LABTF"
                qak.qak_4 = "1"
                # add the QAK segment to the RSP_K11 message
                response.add(qak)
                # copy the QPD segment from the incoming message
                response.QPD = m.QPD
                # create a PID segment
                response.PID.PID_1 = '1'
                response.PID.PID_5.PID_5_1 = 'PATIENT_SURNAME'
                response.PID.PID_5.PID_5_2 = 'PATIENT_NAME'
                response.PID.PID_6 = "19800101"
                response.PID.PID_7 = "F"
                # create a SPM segment
                spm = Segment("SPM")
                # create an OBR segment
                obr = Segment("OBR")
                spm.SPM_1 = '1'
                spm.SPM_2 = "12345"
                obr.OBR_4 = "ORDER^DESCRIPTION"
                # add spm and obr to the RSP_K11 response
                response.add(spm)
                response.add(obr)
            else:
                response = LIP.nak(m)
        return response.to_mllp()  # encode to ER7