对于 HL7(健康级别 7),我使用的是Hapi
写操作:-
ADT_A01 adt = new ADT_A01();
adt.initQuickstart("ADT", "A01", "P");
// Populate the MSH Segment
MSH mshSegment = adt.getMSH();
mshSegment.getSendingApplication().getNamespaceID().setValue("TestSendingSystem");
mshSegment.getSequenceNumber().setValue("123");
// Populate the PID Segment
PID pid = adt.getPID();
pid.getPatientName(0).getFamilyName().getSurname().setValue("Doe");
pid.getPatientName(0).getGivenName().setValue("John");
pid.getPatientIdentifierList(0).getID().setValue("123456");
pid.getAdministrativeSex().setValue("M");
pid.getPhoneNumberHome(0).getPhoneNumber().setValue("90000000000");
pid.getPatientAddress(0).getStreetAddress().getStreetName().setValue("B201, Abc street");
pid.getPatientAddress(0).getCity().setValue("Noida");
pid.getPatientAddress(0).getStateOrProvince().setValue("UP");
pid.getPatientAddress(0).getCountry().setValue("India");
// Now, let's encode the message and look at the output
HapiContext context = new DefaultHapiContext();
Parser parser = context.getPipeParser();
String encodedMessage = parser.encode(adt);
System.out.println("Printing ER7 Encoded Message:");
System.out.println(encodedMessage);
输出:
打印 ER7 编码消息:MSH|^~\&|TestSendingSystem||||20170227154106.754+0530||ADT^A01^ADT_A01|1301|P|2.4|123 PID|||123456||Doe^John|||M| ||&B201, Abc 街^^诺伊达^UP^^印度||^^^^^^90000000000
读取操作:
HapiContext context2 = new DefaultHapiContext();
Parser p = context2.getGenericParser();
Message hapiMsg;
try {
hapiMsg = p.parse(encodedMessage);
} catch (EncodingNotSupportedException e) {
return;
} catch (HL7Exception e) {
return;
}
ADT_A01 adtMsg = (ADT_A01)hapiMsg;
MSH msh = adtMsg.getMSH();
// Retrieve some data from the MSH segment
String msgType = msh.getMessageType().getMessageType().getValue();
String msgTrigger = msh.getMessageType().getTriggerEvent().getValue();
System.out.println("Decode : ");
System.out.println(msgType + " " + msgTrigger);
输出:
解码:ADT A01
我如何从此消息中获取患者信息。请建议我!谢谢