我正在开发一个接收HL7消息并返回HL7 ACK的简单应用程序。我使用此处的示例开始实现:Acknowledgement example in HL7 DataWeave Examples section
在测试示例代码时,如果HL7中没有错误,则ACK很好,但是当解析HL7时出现任何错误时,ERR段不包含任何字段:
MSH|^~\'|LABADT|MCM|ADT1|MCM|198808181126|SECURITY|ACK^A01^ACK|MSG00001-|P|2.6
MSA|AE|MSG00001-
ERR
在日志中还可以找到以下警告:
WARN 2018-03-28 10:01:13,110 [[hl7ack].HTTP_Listener_Configuration.worker.01]
com.mulesoft.flatfile.1.3.0.lib.schema.hl7.HL7SchemaWriter: missing required value for component ERR-03: 'HL7 Error Code' for segment ERR at index 2
WARN 2018-03-28 10:01:13,110 [[hl7ack].HTTP_Listener_Configuration.worker.01]
com.mulesoft.flatfile.1.3.0.lib.schema.hl7.HL7SchemaWriter: missing required value for component ERR-04: 'Severity' for segment ERR at index 2
似乎HL7 EDI转换器组件生成的ERR段的架构与默认的HL7架构不匹配。有什么我做错了吗?我尝试在HL7配置中包含ACK模式,但遇到了同样的问题。
以下是Mule应用程序代码(与示例相同):
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp"
xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:hl7-edi="http://www.mulesoft.org/schema/mule/hl7-edi"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd http://www.mulesoft.org/schema/mule/tcp
http://www.mulesoft.org/schema/mule/tcp/current/mule-tcp.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/hl7-edi
http://www.mulesoft.org/schema/mule/hl7-edi/current/mule-hl7-edi.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/dw
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/ee/tracking
http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8080" doc:name="HTTP Listener Configuration"/>
<hl7-edi:config name="HL7_EDI__Configuration" identKeys="true" doc:name="HL7 EDI: Configuration">
<hl7-edi:schemas>
<hl7-edi:schema>hl7/v2_6/ADT_A01.esl</hl7-edi:schema>
</hl7-edi:schemas>
</hl7-edi:config>
<flow name="Acknowledgment">
<http:listener config-ref="HTTP_Listener_Configuration" path="/ack" allowedMethods="POST" doc:name="HTTP"/>
<hl7-edi:read config-ref="HL7_EDI__Configuration" doc:name="HL7 EDI"/>
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
{
Name: "ACK",
MSH: payload.ACK.MSH,
Id: "ACK",
Data: {
ACK: payload.ACK
}
}]]></dw:set-payload>
</dw:transform-message>
<hl7-edi:write config-ref="HL7_EDI__Configuration" messageStructure="InMessage" doc:name="HL7 EDI"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
答案 0 :(得分:0)
HL7 EDI组件生成的ACK与HL7架构不匹配。具体而言,ERR结构不包含ERR-01列表。我使用以下转换(代替上面的简单转换)来生成正确的确认。
%dw 1.0
%output application/java
---
{
Id: "ACK",
Name: "ACK",
MSH: payload.ACK.MSH,
Data: {
ACK: {
MSH: payload.ACK.MSH,
MSA: payload.ACK.MSA,
ERR: [{
ERR-01: (payload.ACK.ERR map ((eRR , indexOfERR) -> {
ERR-01-01: eRR.ERR-01-01,
ERR-01-02: eRR.ERR-01-02,
ERR-01-03: eRR.ERR-01-03,
ERR-01-04-01: eRR.ERR-01-04-01,
ERR-01-04-02: eRR.ERR-01-04-02,
ERR-01-04-03: eRR.ERR-01-04-03
}))
}]
}
}
}