/** * finds NK1 segments in an ORU_R01 message. all HAPI-rendered Messages have at least one NK1 * segment but if the original message truly does not contain an NK1, the setID will be null on * the generated NK1 * * @param oru ORU_R01 message to be parsed for NK1 segments * @return list of not-null NK1 segments * @throws HL7Exception */ public List<NK1> getNK1List(ORU_R01 oru) throws HL7Exception { List<NK1> res = new ArrayList<>(); // there will always be at least one NK1, even if the original message does not contain one for (int i = 0; i < oru.getPATIENT_RESULT().getPATIENT().getNK1Reps(); i++) { // if the setIDNK1 value is null, this NK1 is blank if (oru.getPATIENT_RESULT().getPATIENT().getNK1(i).getSetIDNK1().getValue() != null) { res.add(oru.getPATIENT_RESULT().getPATIENT().getNK1(i)); } } return res; }