我试图使用HapiTestPanel在IHE标准(ORU-R01消息类型)上创建HL7消息,并且我在OBX字段的开头有一个意外的空字,但我没有&# 39;不知道错误在哪里..
发送此消息:
MSH | ^〜\&安培; | LiFETouch17 | LiFETouch17Facility | AnesthesiaApp | AnesthesiaAppFacility | 20141112144500 || ORU ^ R01 ^ ORU_R01 | Q123456789T123456789X123456 | P | 2.6 ||||||||| IHE PCD ORU-R01 PID ||| 123456789 | 012345678 9 ^ AA ^^ JP | BROS ^ MARIO || 19850101000000 | M ||| 123 FAKE STREET ^ MARIO LUIGI BROS PLACE ^ TOADSTOOL KINGDOM ^ NES ^ A1B2C3 ^ JP ^ HOME ^^ 1234 | 1234 PV1 ||Ø| ABCD ^ EFGH |||| 123456 ^ ^ DINO YOSHI ^^^^^^ MSRM ^ CURRENT ^^^ NEIGHBORHOOD DR NBR | ^ DOG ^ DUCKH UNT ^^^^^^^ CURRENT ||||||||| 123456 ^ ^ DINO YOSHI ^^^^^^ MSRM ^ CURRENT ^^^ NEIGHBORHOOD DR NBR || 0123456789 ||||||||||||||||||||||||| 20010101000000 OBR | 1 | 080019FFFF4F6AFE20081211144657 ^ AwareGateway ^ 080019FFFF4F6AC0 ^ EUI-64 | 080019FFFF4F6AC020081211144657 ^ AwareGateway ^ 080019FFFF4F6AC0 ^ EUI-64 | 126.169.95.2 ^ 2000 ^ MDC ||| 20081211144500 OBX | 1 | NM | 147842 ^ MDC_ECG_HEART_RATE ^ MDC | 1.1.1.1 | 60 | 264864 ^ /分钟^ UCUM |||||ř OBX | 2 | NM | 150324 ^ MDC_SAT_O2_ART ^ MDC | 1.2.1.1 | 98 | 262688 ^ MDC_DIM_PERCENT ^ MDC |||||ř OBX | 3 | NM | 150021 ^ MDC_PRESS_BLD_NONINV_SYS ^ MDC | 1.3.1.1 | 120 | 266016 ^ MDC_DIM_MMHG ^ MDC |||||ř OBX | 4 | NM | 150022 ^ MDC_PRESS_BLD_NONINV_DIA ^ MDC | 1.6.1.1 | 80 | 266016 ^ MDC_DIM_MMHG ^ MDC |||||ř OBX | 5 | NM | 150023 ^ MDC_PRESS_BLD_NONINV_MEAN ^ MDC | 1.6.1.1 | 100 | 266016 ^ MDC_DIM_MMHG ^ MDC |||||ř OBX | 6 | NM | 150037 ^ MDC_PRESS_BLD_ART_ABP_SYS ^ MDC | 1.6.1.1 | 126 | 266016 ^ MDC_DIM_MMHG ^ MDC |||||ř OBX | 7 | NM | 150038 ^ MDC_PRESS_BLD_ART_ABP_DIA ^ MDC | 1.6.1.1 | 76 | 266016 ^ MDC_DIM_MMHG ^ MDC |||||ř OBX | 8 | NM | 150039 ^ MDC_PRESS_BLD_ART_ABP_MEAN ^ MDC | 1.6.1.1 | 92 | 266016 ^ MDC_DIM_MMHG ^ MDC |||||ř OBX | 9 | NM | 151728 ^ MDC_AWAY_CO2_ET ^ MDC | 1.6.1.1 | 60 | 266016 ^ MDC_DIM_MMHG ^ MDC |||||ř OBX | 10 | NM | 151562 ^ MDC_RESP_RATE ^ MDC | 1.6.1.1 | 60 | 264928 ^ MDC_DIM_RESP_PER_MIN ^ MDC ||||| |||||||||ř OBX | 11 | NM | 150364 ^ MDC_TEMP_BODY ^ MDC | 1.0.0.9 | 37 | 268192 ^ MDC_DIM_DEGC ^ MDC |||||ř OBX | 12 | NM | 150364 ^ MDC_EEG_BISPECTRAL_INDEX ^ MDC | 1.0.0.9 | 37 | 262656 ^ MDC_DIM_DIMLESS ^ MDC |||||ř OBX | 13 | NM | 131840 ^ MDC_ECG_AMPL_ST | 1.0.0.9 | 37 | 266418 ^ MDC_DIM_MILLI_VOLT ^ MDC ||||| - [R
我在受体中得到了这个:
MSH | ^〜\&安培; | LiFETouch17 | LiFETouch17Facility | AnesthesiaApp | AnesthesiaAppFacility | 20141112144500 || ORU ^ R01 ^ ORU_R01 | Q123456789T123456789X123456 | P | 2.6 ||||||||| IHE PCD ORU-R01
PID ||| 123456789 | 012345678 9 ^ AA ^^ JP | BROS ^ MARIO || 19850101000000 | M ||| 123 FAKE STREET ^ MARIO LUIGI BROS PLACE ^ TOADSTOOL 王国^ NES ^ A1B2C3 ^ JP ^ HOME ^^ 1234 | 1234
PV1 ||ö| ABCD ^ EFGH |||| 123456 ^ DINO ^ YOSHI ^^^^^^ MSRM ^ CURRENT ^^^ NEIGHBORHOOD DR NBR | ^ DOG ^ DUCKH UNT ^^^^^^^ CURRENT ||||||||| 123456 ^ ^ DINO YOSHI ^^^^^^ MSRM ^ CURRENT ^^^ NEIGHBORHOOD DR NBR || 0123456789 ||||||||||||||||||||||||| 20010101000000
OBR | 1 | 080019FFFF4F6AFE20081211144657 ^ AwareGateway ^ 080019FFFF4F6AC0 ^ EUI-64 | 080019FFFF4F6AC020081211144657 ^ AwareGateway ^ 080019FFFF4F6AC0 ^ EUI-64 | 126.169.95.2 ^ 2000 ^ MDC ||| 20081211144500
空 OBX | 1 | NM | 147842 ^ MDC_ECG_HEART_RATE ^ MDC | 1.1.1.1 | 60 | 264864 ^ /分钟^ UCUM ||||| ROBX | 2 | NM | 150324 ^ MDC_SAT_O2_ART ^ MDC | 1.2.1.1 | 98 | 262688 ^ MDC_DIM_PERCENT ^ MDC ||||| ROBX | 3 | NM | 150021 ^ MDC_PRESS_BLD_NONINV_SYS ^ MDC | 1.3.1.1 | 120 | 266016 ^ MDC_DIM_MMHG ^ MDC ||||| ROBX | 4 | NM | 150022 ^ MDC_PRESS_BLD_NONINV_DIA ^ MDC | 1.6.1.1 | 80 | 266016 ^ MDC_DIM_MMHG ^ MDC ||||| ROBX | 5 | NM | 150023 ^ MDC_PRESS_BLD_NONINV_MEAN ^ MDC | 1.6.1.1 | 100 | 266016 ^ MDC_DIM_MMHG ^ MDC ||| || ROBX | 6 | NM | 150037 ^ MDC_PRESS_BLD_ART_ABP_SYS ^ MDC | 1.6.1.1 | 126 | 266016 ^ MDC_DIM_MMHG ^ MDC ||||| ROBX | 7 | NM | 150038 ^ MDC_PRESS_BLD_ART_ABP_DIA ^ MDC | 1.6.1.1 | 76 | 266016 ^ MDC_DIM_MMHG ^ MDC ||||| ROBX | 8 | NM | 150039 ^ MDC_PRESS_BLD_ART_ABP_MEAN ^ MDC | 1.6.1.1 | 92 | 266016 ^ MDC_DIM_MMHG ^ MDC ||||| ROBX | 9 | NM | 151728 ^ MDC_AWAY_CO2_ET ^ MDC | 1.6。 1.1 | 60 | 266016 ^ MDC_DIM_MMHG ^ MDC ||||| ROBX | 10 | NM | 151562 ^ MDC_RESP_RATE ^ MDC | 1.6.1.1 | 60 | 264928 ^ MDC_DIM_RESP_PER_MIN ^ MDC |||||ř||||||| || OBX | 11 | NM | 150364 ^ MDC_TEMP_BODY ^ MDC | 1.0.0.9 | 37 | 268192 ^ MDC_DIM_DEGC ^ MDC ||||| ROBX | 12 | NM | 150364 ^ MDC_EEG_BISPECTRAL_INDEX ^ MDC | 1.0.0.9 | 37 | 262656 ^ MDC_DIM_DIMLESS ^ MDC ||||| - [R
public void onCreate() {
super.onCreate();
serverThread = new Thread(new Runnable(){ public void run() { 尝试{ Looper.prepare(); socket = new ServerSocket(8080); socket.setReuseAddress(真); socket.setPerformancePreferences(100,100,1);
while (!stop){
Socket accept = socket.accept();
accept.setPerformancePreferences(10, 100, 1);
accept.setKeepAlive(true);
try
{
/ 在这里我收到16行的消息 / / 每一行都以一个\ n来结束受体 /
中的不同段 in = new BufferedReader(new InputStreamReader(accept.getInputStream()));
int cont=0;
for (cont=0;cont<16;cont++){
if (cont==0){
aux = in.readLine();
aux=aux.substring(1);
if (aux.contains(inicio)){
hl7Message=aux+separator2;
}
else{
Log.v("Fail", "Error, the received data does not " +"follow the HL7 protocol");
break;
}
}
hl7Message+=in.readLine()+separator2;
}
}catch (IOException e2){
e2.printStackTrace();
}
/ 我用整个消息调用解析器 /
hl7Parser(hl7Message);
}
} catch (Throwable e){
e.printStackTrace();
Log.e(getClass().getSimpleName(), "Error in Listener",e);
}
try
{
socket.close();
}
catch (IOException e)
{
Log.e(getClass().getSimpleName(), "keep it simple");
}
}
},"Server thread");
serverThread.start();
}
/ 这里我解析消息,首先我用\ n分隔每一行,我有:MSH,PID,PV1,OBR和OBX(从1到13) /
public void hl7Parser(String hl7Message){
String[] fieldsOfMessage= null;
fieldsOfMessage=hl7Message.split(separator2);
MSH=fieldsOfMessage[0];
PID=fieldsOfMessage[1];
PV1=fieldsOfMessage[2];
OBR=fieldsOfMessage[3];
for (int x=4; x<16;x++){
OBX+=fieldsOfMessage[x];
}
/ 在这里,我得到第一个段的索引,以便能够搜索段内的所需字段 /
int[] indice;
//MSH SEGMENT
indice=get_indice(MSH);
/ 这些是所需的字段 /
String sending_application, sending_facility, receiving_application,
receiving_facility, date, message_type,
message_control_id, processing_ID, version, sequence_number,
accept_ack_type, app_ack_type, country_code, principle_language, message_profile_id;
sending_application=MSH.substring(indice[1]+1,indice[2]);
sending_facility=MSH.substring(indice[2]+1,indice[3]);
receiving_application=MSH.substring(indice[3]+1,indice[4]);
receiving_facility=MSH.substring(indice[4]+1,indice[5]);
date=MSH.substring(indice[5]+1,indice[6]);
message_type=MSH.substring(indice[7]+1,indice[8]);
int tr=message_type.indexOf("^");
String type=message_type.substring(tr+1);
message_control_id=MSH.substring(indice[8]+1,indice[9]);
processing_ID=MSH.substring(indice[9]+1,indice[10]);
version=MSH.substring(indice[10]+1,indice[11]);
message_profile_id=MSH.substring(indice[19]+1);
Date now = new Date();
String standard_date = new SimpleDateFormat("yyyyMMddHHmmss.SSSZ").format(now);
/ 我在OBX字段获取nullOBX之前得到错误...而不是OBX .. /
答案 0 :(得分:0)
这是消息中的一个问题,我错过了与收容相关的前三个参数:
OBX | 1 || 69965 ^ MDC_DEV_MON_PHYSIO_MULTI_PARAM_MDS ^ MDC | 1.0.0.0 ||||||| X OBX | 2 || 69966 ^ ^ MDC_DEV_MON_PHYSIO_MULTI_PARAM_VMD MDC | 1.1.0.0 ||||||| X OBX | 3 || 69967 ^ MDC_DEV_MON_PHYSIO_MULTI_PARAM_CHAN ^ MDC | 1.1.1.0 ||||||| X