Hi,
I'm using HAPI, and I'm trying to do conditional creates, where the condition (that prevents the create) is exact matching of first name, last name and date of birth. This is to prevent duplicates; it may not be the best way, but it's what we're going to do for now at least.
Anyways, I've come to this:
MethodOutcome outcome = client.create()
.resource(patient)
.conditional()
.where(Patient.NAME.matchesExactly().value(patient.getName().get(0).getGivenAsSingleString()))
.where(Patient.NAME.matchesExactly().value(patient.getName().get(0).getFamily()))
.where(Patient.BIRTHDATE.exactly().day(patient.getBirthDate()))
.prettyPrint()
.encodedJson()
.execute();
This sort of works -- if I try to insert Bob Smith with birthdate 1999-12-14 multiple times, it only shows up once. But if I insert Bob Smith and Smith Bob, only Bob Smith is created. This isn't suprising, since the code doesn't indicate to the value function that it wants to match to the Patient's first or last name (since getFamily() and getGivenAsSingleString() only return strings, there would be no way to do this). How can I get the conditional create to match specifically on first name and last name separately?
Thanks,
Jordan