I must generate HL7 file but i 'm facing problem with PV1 segment.
I don't find how to set Facility variable with my value
i use hapi but i don't find their java method that allows that...
i succed for setting PV1-9 Consulting doctor field :
msg.getPV1().insertConsultingDoctor(0).getGivenName().setValue(nomMedecin);
but there is no insertXxx method for setting PV1-3.4 field, just one to get the value :
msg.getPV1().getPv13_AssignedPatientLocation().getFacility();
The API of HAPI is a bit unusual since most of the times, there is no need to instantiate objects. Just calling the get method gives you an object:
HD facility = msg.getPV1().getPv13_AssignedPatientLocation().getPl4_Facility();
This gives you an instance of HD which has more segments:
ST universalID = facility.getHd2_UniversalID();
Once you are down to a String (ST) data type, you can set a value:
universalID.setValue("FooBar");