<dependency>
<groupId>org.openehealth.ipf.boot</groupId>
<artifactId>ipf-hl7v3-spring-boot-starter</artifactId>
<version>3.3.0</version>
</dependency>
HL7 2.6解析转XML(C#版)
项目中需要解析HL7,所以在网上找到解析代码,但错误很多,所以我修改了一下,测试好用。
XmlElement subComponentRepEl = _xmlDoc.CreateElement(sFields[0] +
"."
+ a.ToString() +
"."
+ b.ToString() +
"."
+ c.ToString() +
"."
+ d.ToString());
subComponentRepEl.InnerText = subComponentRepetitions[d];
componentEl.AppendChild(subComponentRepEl);
XmlElement subComponentEl = _xmlDoc.CreateElement(sFields[0] +
"."
+ a.ToString() +
"."
+ b.ToString() +
"."
+ c.ToString());
subComponentEl.InnerText = subComponents[c];
componentEl.AppendChild(subComponentEl);
fieldEl.AppendChild(componentEl);
else
string
[] sRepetitions = HL7ToXmlConverter.GetSubComponents(sComponents[b]);
if
(sRepetitions.Length > 1)
XmlElement repetitionEl =
null
;
for
(
int
c = 0; c < sRepetitions.Length; c++)
repetitionEl = _xmlDoc.CreateElement(sFields[0] +
"."
+ a.ToString() +
"."
+ b.ToString() +
"."
+ c.ToString());
repetitionEl.InnerText = sRepetitions[c];
componentEl.AppendChild(repetitionEl);
fieldEl.AppendChild(componentEl);
el.AppendChild(fieldEl);
componentEl.InnerText = sComponents[b];
fieldEl.AppendChild(componentEl);
el.AppendChild(fieldEl);
el.AppendChild(fieldEl);
fieldEl.InnerText = sFields[a];
el.AppendChild(fieldEl);
String chuang1 = PT.Common.HL7ToXmlConverter.GetText(xmlObject,
"PV1/PV1.6/PV1.6.0/PV1.6.0.2"
, 0);
String chuang2 = PT.Common.HL7ToXmlConverter.GetText(xmlObject,
"PV1/PV1.3/PV1.3.0/PV1.3.0.2"
, 0);
ThreadUPtextBoxMsg(textBoxMsgAppendText,
"\r\n[解析HL7消息为XML]"
+ name +
"从"
+ chuang1 +
"床换到"
+ chuang2 +
"床"
);