Patient Authority Update (ADT~A43) Even though PID Segment is there it says PID Id not There in the HL7 Message

20 Views Asked by At

Patient Authority Update Message

MSH^~|&^MP TRIGGER^100M~test-test~DNS^MPIF TRIGGER^100T~test-test~DNS^20170530223231^^ADT~A43^100MApplication^T^2.4^^^AL^AL^USA^ PID^1^^1000000109V281366~~~ABCD~NI~FACILITY&200M&L|109~~~ABCD~PI~EITL&613&L|613000109~~~USSSA~SS~FACILITY&200M&L^^Tatezz~Daniel~Z~~~~L^unknown~~~~~~L^19570420^m^^^^^^^^U^^^^^^U^ MRG^109~~~ABCD~PI~EITL&613&L^

Code for Getting the PID is

 public String validatePIDSegmentPresent(Message msg) throws HL7Exception, IOException {
        logger.info(" validatePIDSegmentPresent >>> "+msg.toString());
        Message ack = msg.generateACK(AcknowledgmentCode.CE,null);
        
        PID pid = (PID)msg.get("PID");  // Here i am getting the Error.
        boolean isPIDempty = pid.isEmpty();
        if(isPIDempty) {
              // do some logic
        }
        
        return null;
    }

it gives below Exception

ca.uhn.hl7v2.HL7Exception: PID does not exist in the group ca.uhn.hl7v2.model.v24.message.ADT_A43 at ca.uhn.hl7v2.model.AbstractGroup.get(AbstractGroup.java:127) at ca.uhn.hl7v2.model.AbstractGroup.get(AbstractGroup.java:102)

PID Segment is already there in the HL7 Message but it is throwing Error like PID Segment is not there. what might cause this issue. can you please help me to resolve this issue.

0

There are 0 best solutions below