Here is one example where we are looking for the patient id identified as NHS in PID-3.4.
For this example we will look at a PID-3 segment taht looks like the following:
PID|1||670^^^XYZ^AN~MR-000-090^^^NHS^MR~753745187^^^ABC^SS|
Code Sample:
var i = 1;
while (StringUtils.isNotBlank(source.getNode('PID-3['+ i+']'))) {
if (StringUtils.equals('NHS', source.getNode('PID-3['+ i +'].4'))) {
message.setNode('PID-3', source.getNode('PID-3['+ i +']'));
break;
}
i++;
}