当前位置:网站首页>HL7Exception: Can‘t XML-encode a GenericMessage. Message must have a recognized struct
HL7Exception: Can‘t XML-encode a GenericMessage. Message must have a recognized struct
2022-06-26 03:19:00 【More books】
Catalog
3、 ... and 、 Why does it enter the error reporting judgment ?
Use today Hapi Analyze a hl7v2 And try to switch to xml Format encountered such an error
Exception in thread "main" ca.uhn.hl7v2.HL7Exception: Can't XML-encode a GenericMessage. Message must have a recognized structure.
at ca.uhn.hl7v2.parser.XMLParser.doEncode(XMLParser.java:237)
at ca.uhn.hl7v2.parser.Parser.encode(Parser.java:276)
at com.cr.hesb.hl7v2.HL7Helper.hl72xml(HL7Helper.java:164)
at com.cr.hesb.hl7v2.HL7Helper.main(HL7Helper.java:25)
Baidu spent half a day , No gain , I can only go to see the source code .
One 、 Sample code
public static String hl72xml() throws HL7Exception {
String message = "MSH|^~\\&|UMC||ZZJ||20220105101052||ADT^A01^ADT^A01|a8f662b8-6e7a|P|2.6^^&&&&D56D2C42401AAC6F36&&V1.0|||NE|AL||utf-8\n" +
"EVN|REG|20220121235249|||01970836\n" +
"PID||201532012|6521011986122213xx^^^^01|| Horse x bright ^^^MA ZHI MING||19861222000000|1|||& Huarong culture road 179 Number ^ Huarong ^ Yueyang ^ hunan |||||^^2|||652101198612221332|||^ The han nationality ^1||||||86^ China \n" +
"PV1||1|311403^126^^&H002^^^^^^ Pediatric Emergency Room \\T\\ Emergency Department \\T\\ Specialist code ||123||08311056\\S\\ zhu X peak |||2||||2|2|3|1056\\S\\ Zhuxifeng ||1||||||||||||||||||||H0002|0||||20220105100100||||||03-01970836-100^123456^124512^1&4513&2412^^&9:00\\R\\12:00|0|0^1123&20220105100100&245\\S\\ Zhang Xiao ^^^^\n" +
"IN1|1|A| At his own expense ";
HapiContext context = new DefaultHapiContext();
GenericParser normalParse = new GenericParser();
normalParse.getParserConfiguration().setValidating(false);
Message hapiMessage = normalParse.parse(message);
Parser xmlParser = context.getXMLParser();
return xmlParser.encode(hapiMessage);
}Two 、 Find the wrong place

3、 ... and 、 Why does it enter the error reporting judgment ?
Come straight to ca.uhn.hl7v2.parser.PipeParser Under the getStructure(String message) Method
1. As shown in the figure below , First get hl7v2 To the data column of the implementation class .
2. According to the obtained data, it is divided into arrays
2.1. If the array length is greater than or equal to 3 The subscript of the array is 2 The data of
2.2. If the array length is less than or equal to 0&& Or for ACK, The value is directly assigned to ACK
2.3. If array length is equal to 2 Then use the two data as “_” Splicing
3. Finally, according to the variable messageStructure To find the corresponding Message Implementation class , If empty, use GenericMessage Class to implement

Four 、 summary
reason :
So the error report is because XMLParser.doEncode(Message source) Methods cannot implement classes as GenericMessage The transformation of is to xml Format
resolvent :
1. Change the of data messageStructure value (hl7v2 The column of data that implements the class ), Make it find the corresponding entity .
2. Inherited abstract class AbstractMessage, Rewrite a corresponding entity !
边栏推荐
- golang正則regexp包使用-06-其他用法(特殊字符轉換、查找正則共同前綴、切換貪婪模式、查詢正則分組個數、查詢正則分組名稱、用正則切割、查詢正則字串)
- 经典模型——NiN&GoogLeNet
- kotlin快速上手
- 【QT】自定义控件-开关
- Route jump: click the operation button of the list to jump to another menu page and activate the corresponding menu
- 2022年挖财证券开户安全嘛?
- 渐变
- todolist未完成,已完成
- 【哈希表】很简单的拉链法哈希结构,以至于效果太差,冲突太多,链表太长
- 进度条
猜你喜欢

拖放

Qt编译出错ERROR: Unknown module(s) in QT: script

点击事件

【哈希表】很简单的拉链法哈希结构,以至于效果太差,冲突太多,链表太长

《你不可不知的人性》经典语录

双碳红利+基建大年 | 图扑深耕水利水电绿色智能装备领域

《你不可不知的人性》經典語錄

Hardware creation principle of campus maker space

【论文笔记】Manufacturing Control in Job Shop Environments with Reinforcement Learning

QT compilation error: unknown module (s) in qt: script
随机推荐
如何筹备一场感人的婚礼
经典模型——ResNet
Cliquez sur le bouton action de la liste pour passer à une autre page de menu et activer le menu correspondant
ORB-SLAM系列论文翻译笔记
[solution] the blue screen restart problem of the virtual machine started by the VMware of Lenovo Savior
【QT】自定义控件-空气质量仪表盘
经典模型——NiN&GoogLeNet
工业机器人之“慧眼”——机器视觉
Interpreting Oracle
丝网印刷的种类及其应用方法
Oracle exercise
分割、柱子、list
Preparation for wechat applet development
How Inkscape converts PNG pictures to SVG pictures without distortion
How to add a table to a drawing in ggplot2
Survival analysis based on ovarian data set
Inkscape如何将png图片转换为svg图片并且不失真
Learn from Taiji makers - mqtt (V) publish, subscribe and unsubscribe
Group note data representation and operation check code
进度条