快速获取到里面的数据:?
package test;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.model.v26.group.ORU_R01_OBSERVATION;
import ca.uhn.hl7v2.model.v26.message.ORU_R01;
import ca.uhn.hl7v2.parser.Hl7Parser;
import java.util.List;
public class Test {
public static void main(String[] args) throws Exception {
try {
String hl7 = "MSH|^~\\&|MINDRAY_EGATEWAY^00A037002732C4AA^EUI-64|MINDRAY|||20231228145610.0000+0800||ORU^R01^ORU_R01|173|P|2.6|||NE|NE|||||IHE_PCD_001^IHE PCD^1.3.6.1.4.1.19376.1.6.1.1.1^ISO\r" +
"PID|||^^^Hospital^PI||John^Smith-Demo^^^^^L|||M||unknownrace\r" +
"PV1||I|EICU^^05^^^^^^00-0F-14-33-36-C3\r" +
"OBR|1|173^MINDRAY_EGATEWAY^00A037002732C4AA^EUI-64|173^MINDRAY_EGATEWAY^00A037002732C4AA^EUI-64|182777000^monitoring of patient^SCT|||20231228145607.0000+0800\r" +
"OBX|1|NM|150037^MDC_PRESS_BLD_ART_ABP_SYS^MDC|1.1.1.150037|84|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800||||000F14049B3336C3^BIG_DIPPER^000F14049B3336C3^EUI-64\r" +
"OBX|2|NM|150039^MDC_PRESS_BLD_ART_ABP_MEAN^MDC|1.1.1.150039|81|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|3|NM|150038^MDC_PRESS_BLD_ART_ABP_DIA^MDC|1.1.1.150038|80|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|4|NM|364^MNDRY_BLD_PULS_RATE_ART_ABP^99MNDRY|1.1.1.364|60|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|5|NM|150033^MDC_PRESS_BLD_ART_SYS^MDC|1.1.11.150033|86|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|6|NM|150035^MDC_PRESS_BLD_ART_MEAN^MDC|1.1.11.150035|82|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|7|NM|150034^MDC_PRESS_BLD_ART_DIA^MDC|1.1.11.150034|80|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|8|NM|364^MNDRY_BLD_PULS_RATE_ART_ABP^99MNDRY|1.1.11.364|60|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|9|NM|150087^MDC_PRESS_BLD_VEN_CENT_MEAN^MDC|1.1.12.150087|28|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|10|NM|150344^MDC_TEMP^MDC|1.2.1.150344|99.5|266560^MDC_DIM_FAHR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|11|NM|150344^MDC_TEMP^MDC|1.2.2.150344|97.7|266560^MDC_DIM_FAHR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|12|NM|188440^MDC_TEMP_DIFF^MDC|1.2.4.188440|0.7|266560^MDC_DIM_FAHR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|13|NM|407^MNDRY_CPR_COMP_RATE^99MNDRY|1.3.1.407|107|10024^MNDRY_DIM_COMPRESSIONS_PER_MIN^99MNDRY||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|14|NM|150488^MDC_BLD_PERF_INDEX^MDC|1.3.1.150488|3.06|262688^MDC_DIM_PERCENT^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|15|NM|409^MNDRY_CPR_COMP_QUALITY_INDEX^99MNDRY|1.3.1.409|71|262656^MDC_DIM_DIMLESS^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|16|NM|150456^MDC_PULS_OXIM_SAT_O2^MDC|1.3.1.150456|93|262688^MDC_DIM_PERCENT^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|17|NM|149530^MDC_PULS_OXIM_PULS_RATE^MDC|1.3.1.149530|91|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|18|NM|312^MNDRY_TEMP_BLD_DIFF^99MNDRY|1.6.1.312|0.0|266560^MDC_DIM_FAHR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|19|NM|188436^MDC_TEMP_BLD^MDC|1.6.1.188436|98.6|266560^MDC_DIM_FAHR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|20|NM|150492^MDC_OUTPUT_CARD_CTS^MDC|1.6.2.150492|6.00|265216^MDC_DIM_L_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|21|NM|378^MNDRY_OUTPUT_CARD_INDEX_CTS^99MNDRY|1.6.2.378|9.08|264992^MDC_DIM_L_PER_MIN_PER_M_SQ^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|22|NM|150404^MDC_VOL_BLD_STROKE^MDC|1.6.3.150404|118|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|23|NM|150636^MDC_VOL_BLD_STROKE_INDEX^MDC|1.6.3.150636|35.0|263570^MDC_DIM_MILLI_L_PER_M_SQ^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|24|NM|148^MNDRY_VOL_BLD_STROKE_VARIATION^99MNDRY|1.6.3.148|29.0|262688^MDC_DIM_PERCENT^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|25|NM|153^MNDRY_PRESS_PULSE_VARIATION^99MNDRY|1.6.3.153|1|262688^MDC_DIM_PERCENT^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|26|NM|160^MNDRY_POWER_CARD_OUTPUT^99MNDRY|1.6.3.160|1.69|266176^MDC_DIM_WATT^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|27|NM|161^MNDRY_POWER_CARD_OUTPUT_INDEX^99MNDRY|1.6.3.161|0.30|10013^MNDRY_DIM_WATT_PER_M_SQ^99MNDRY||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|28|NM|156^MNDRY_CONTRACTILITY_LEFT_VENT^99MNDRY|1.6.3.156|243|10014^MNDRY_DIM_MMHG_PER_SEC^99MNDRY||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|29|NM|147842^MDC_ECG_CARD_BEAT_RATE^MDC|1.6.3.147842|60|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|30|NM|150312^MDC_RES_VASC_SYS^MDC|1.6.4.150312|747|270656^MDC_DIM_DYNE_SEC_PER_CM_5^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|31|NM|149760^MDC_RES_VASC_SYS_INDEX^MDC|1.6.4.149760|1000|270464^MDC_DIM_DYNE_SEC_M_SQ_PER_CM_5^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|32|NM|151578^MDC_TTHOR_RESP_RATE^MDC|1.7.1.151578|40|264928^MDC_DIM_RESP_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|33|NM|148066^MDC_ECG_V_P_C_RATE^MDC|1.7.2.148066|0|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|34|NM|108^MNDRY_ECG_PAUSE_RATE^99MNDRY|1.7.2.108|0|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|35|NM|352^MNDRY_ECG_VPB_RATE^99MNDRY|1.7.2.352|0|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|36|NM|580^MNDRY_ECG_RHY_MISSB_RATE^99MNDRY|1.7.2.580|0|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|37|NM|581^MNDRY_ECG_BEAT_V_P_C_RonT_RATE^99MNDRY|1.7.2.581|0|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|38|NM|579^MNDRY_ECG_RHY_V_P_C_CPLT_RATE^99MNDRY|1.7.2.579|0|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|39|NM|148216^MDC_ECG_SV_BEATS^MDC|1.7.2.148216|0|262656^MDC_DIM_DIMLESS^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|40|NM|147842^MDC_ECG_HEART_RATE^MDC|1.7.4.147842|128|264864^MDC_DIM_BEAT_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|41|NM|151708^MDC_CONC_AWAY_CO2_ET^MDC|1.8.1.151708|38|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|42|NM|151716^MDC_CONC_AWAY_CO2_INSP^MDC|1.8.1.151716|1|266016^MDC_DIM_MMHG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|43|NM|151594^MDC_CO2_RESP_RATE^MDC|1.8.1.151594|18|264928^MDC_DIM_RESP_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|44|NM|188740^MDC_LEN_BODY_ACTUAL^MDC|1.10.1.188740|170.0|263441^MDC_DIM_CENTI_M^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|45|NM|188736^MDC_MASS_BODY_ACTUAL^MDC|1.10.1.188736|66.0|263875^MDC_DIM_KILO_G^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|46|NM|151817^MDC_PRESS_AWAY_INSP_PEAK^MDC|1.13.1.151817|18.0|266048^MDC_DIM_CM_H2O^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|47|NM|151784^MDC_PRESS_RESP_PLAT^MDC|1.13.1.151784|15.0|266048^MDC_DIM_CM_H2O^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|48|NM|151819^MDC_PRESS_AWAY_INSP_MEAN^MDC|1.13.1.151819|6.0|266048^MDC_DIM_CM_H2O^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|49|NM|151972^MDC_VENT_PRESS_AWAY^MDC|1.13.1.151972|9.0|266048^MDC_DIM_CM_H2O^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|50|NM|16929196^MDC_VENT_VOL_TIDAL_SETTING^MDC|1.13.1.16929196|300.0|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|51|NM|152664^MDC_VOL_AWAY_TIDAL_EXP^MDC|1.13.1.152664|300.0|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|52|NM|152660^MDC_VOL_AWAY_TIDAL_INSP^MDC|1.13.1.152660|500.0|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|53|NM|153208^MDC_VOL_AWAY_TIDAL_PER_IBW^MDC|1.13.1.153208|7.20|265330^MDC_DIM_MILLI_L_PER_KG^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|54|NM|152676^MDC_VOL_AWAY_TIDAL_EXP_BTSD_PS^MDC|1.13.1.152676|500.0|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|55|NM|20062^MNDRY_VOL_AWAY_TIDAL_APNEA_SETTING^99MNDRY|1.13.1.20062|490.0|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|56|NM|152008^MDC_VENT_VOL_MINUTE_AWAY^MDC|1.13.1.152008|15.000|265216^MDC_DIM_L_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|57|NM|152000^MDC_VENT_VOL_MINUTE_EXP^MDC|1.13.1.152000|15.00|265216^MDC_DIM_L_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|58|NM|152016^MDC_VENT_VOL_MINUTE_AWAY_INSP^MDC|1.13.1.152016|15.00|265216^MDC_DIM_L_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|59|NM|152490^MDC_VENT_RESP_BTSD_PSAZC_RATE^MDC|1.13.1.152490|30|264928^MDC_DIM_RESP_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|60|NM|152538^MDC_VENT_RESP_BTSD_PS_RATE^MDC|1.13.1.152538|30|264928^MDC_DIM_RESP_PER_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|61|NM|151976^MDC_VENT_PRESS_AWAY_END_EXP_POS^MDC|1.13.1.151976|12.0|266048^MDC_DIM_CM_H2O^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|62|NM|16929192^MDC_VENT_PRESS_AWAY_END_EXP_POS_SETTING^MDC|1.13.1.16929192|12.0|266048^MDC_DIM_CM_H2O^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|63|ST|184352^MDC_VENT_MODE^MDC|1.13.3.184352|VCV|262656^MDC_DIM_DIMLESS^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|64|CNE|241^MNDRY_PRESS_PULSE_VARIATION_SOURCE^99MNDRY|1.18.1.241|60025^MNDRY_SRC_PRESS_BLD_ART^99MNDRY|262656^MDC_DIM_DIMLESS^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|65|NM|157888^MDC_VOL_FLUID_DELIV_TOTAL_SET^MDC|1.37.1.157888|12.50|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|66|NM|157784^MDC_FLOW_FLUID_PUMP^MDC|1.37.1.157784|2.00|265266^MDC_DIM_MILLI_L_PER_HR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|67|NM|157872^MDC_VOL_FLUID_TBI_REMAIN^MDC|1.37.1.157872|37.50|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|68|NM|157916^MDC_TIME_PD_REMAIN^MDC|1.37.1.157916|450.00|264352^MDC_DIM_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|69|NM|157796^MDC_FLOW_FLUID_PUMP_PROP^MDC|1.37.1.157796|5.00|265266^MDC_DIM_MILLI_L_PER_HR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|70|NM|157772^MDC_TIME_PD_FLUID_DELIV_SINCE_START^MDC|1.37.1.157772|140.00|264352^MDC_DIM_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|71|ST|184468^MDC_DRUG_NAME_POINTER^MDC|1.37.1.184468|多巴胺|262656^MDC_DIM_DIMLESS^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|72|NM|157796^MDC_FLOW_FLUID_PUMP_PROP^MDC|1.37.2.157796|5.00|265266^MDC_DIM_MILLI_L_PER_HR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|73|NM|157772^MDC_TIME_PD_FLUID_DELIV_SINCE_START^MDC|1.37.2.157772|140.00|264352^MDC_DIM_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|74|NM|157872^MDC_VOL_FLUID_TBI_REMAIN^MDC|1.37.2.157872|37.50|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|75|NM|157916^MDC_TIME_PD_REMAIN^MDC|1.37.2.157916|450.00|264352^MDC_DIM_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|76|NM|157888^MDC_VOL_FLUID_DELIV_TOTAL_SET^MDC|1.37.2.157888|12.50|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|77|NM|157784^MDC_FLOW_FLUID_PUMP^MDC|1.37.2.157784|2.00|265266^MDC_DIM_MILLI_L_PER_HR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|78|ST|184468^MDC_DRUG_NAME_POINTER^MDC|1.37.2.184468|去甲肾上腺素|262656^MDC_DIM_DIMLESS^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|79|NM|157796^MDC_FLOW_FLUID_PUMP_PROP^MDC|1.37.3.157796|5.00|265266^MDC_DIM_MILLI_L_PER_HR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|80|NM|157772^MDC_TIME_PD_FLUID_DELIV_SINCE_START^MDC|1.37.3.157772|140.00|264352^MDC_DIM_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|81|NM|157888^MDC_VOL_FLUID_DELIV_TOTAL_SET^MDC|1.37.3.157888|12.50|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|82|NM|157872^MDC_VOL_FLUID_TBI_REMAIN^MDC|1.37.3.157872|37.50|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|83|NM|157916^MDC_TIME_PD_REMAIN^MDC|1.37.3.157916|450.00|264352^MDC_DIM_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|84|NM|157784^MDC_FLOW_FLUID_PUMP^MDC|1.37.3.157784|2.00|265266^MDC_DIM_MILLI_L_PER_HR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|85|ST|184468^MDC_DRUG_NAME_POINTER^MDC|1.37.3.184468|肾上腺素|262656^MDC_DIM_DIMLESS^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|86|NM|157796^MDC_FLOW_FLUID_PUMP_PROP^MDC|1.37.4.157796|5.00|265266^MDC_DIM_MILLI_L_PER_HR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|87|NM|157772^MDC_TIME_PD_FLUID_DELIV_SINCE_START^MDC|1.37.4.157772|140.00|264352^MDC_DIM_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|88|NM|157888^MDC_VOL_FLUID_DELIV_TOTAL_SET^MDC|1.37.4.157888|12.50|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|89|NM|157872^MDC_VOL_FLUID_TBI_REMAIN^MDC|1.37.4.157872|37.50|263762^MDC_DIM_MILLI_L^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|90|NM|157916^MDC_TIME_PD_REMAIN^MDC|1.37.4.157916|450.00|264352^MDC_DIM_MIN^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|91|NM|157784^MDC_FLOW_FLUID_PUMP^MDC|1.37.4.157784|2.00|265266^MDC_DIM_MILLI_L_PER_HR^MDC||DEMO|||R|||20231228145607.0000+0800\r" +
"OBX|92|ST|184468^MDC_DRUG_NAME_POINTER^MDC|1.37.4.184468|咪达唑仑|262656^MDC_DIM_DIMLESS^MDC||DEMO|||R|||20231228145607.0000+0800";
Message message = Hl7Parser.hl7ToMsg(hl7);
ORU_R01 r01 = (ORU_R01) message;
System.out.println(r01.getMSH().getMsh3_SendingApplication().encode());
//获取所有观察结果
List<ORU_R01_OBSERVATION> observations = r01.getPATIENT_RESULT().getORDER_OBSERVATION().getOBSERVATIONAll();
System.out.println(observations.toString());
for (ORU_R01_OBSERVATION observation : observations) {
// 获取到的id值
System.out.println(observation.toString());
System.out.println("Observation ID: " + observation.getOBX().getObservationIdentifier().getIdentifier().getValue());
// 获取观察对象的参数值
String parameterValue = observation.getOBX().getObservationValue(0).getData().toString();
System.out.println("Observation Parameter Value: " + parameterValue);
// 获取参数
String parameterValue2 = observation.getOBX().getObservationIdentifier().getCwe2_Text().getValue();
System.out.println("Parameter Value: " + parameterValue2);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
System.exit(0);
}
}
}