|
From: Martin F. <mar...@po...> - 2023-06-13 21:29:41
|
Hi Russell,
You pasted some code, but I don't see a direct relationship with HAPI.
What class is 'patient'? If it isn't ca.uhn.... something, then i don't
think anyone here can help you.
Wbr
Martin
On 13-06-2023 20:53, Russell Bateman wrote:
> This email originated from outside of CGM. Please do not click links
> or open attachments unless you know the sender and know the content is
> safe.
> In the code below, I have an incoming Patient which has all the fields
> that interest me filled in (see debugger image, but if it doesn't come
> through, it shows that patient is filled out for name, gender,
> birthdate and address).
>
> However, when I attempt to inspect *gender* and *birthdate*, these are
> *null* despite the API telling me they exist (which, of course, they
> do--see attached image). Note that I create a new Patient, named
> worthy, and experimentation demonstrates that my code below copies the
> name and the address successfully to worthy. It's just trying to copy
> gender and birthdate that result in null. If I stop at the lines with
> *******, patient.getGender() and patient.getBirthDate() return null.
>
> There must be some very fundamental bit of understanding of which I'm
> completely ignorant.
>
> {
> worthy = new Patient();
>
> // name
> if( !patient.hasName() )
> patientTooThin( "name" );
> HumanName humanName = patient.getNameFirstRep();
> List< StringType > givens = humanName.getGiven();
> String family = humanName.getFamily();
> String first = null, middle = null;
> for( StringType given : givens )
> {
> if( isNull( first ) )
> first = given.toString();
> else if( isNull( middle ) )
> middle = given.toString();
> else
> break;
> }
>
> if( isNull( family ) || isNull( first ) )
> patientTooThin( "first or last name" );
>
> worthy.setName( Collections.singletonList( humanName ) );
>
> // gender *************
> if( !patient.hasGender() )
> patientTooThin( "gender" );
>
> worthy.setGender( patient.getGender() ); // ***************
>
> // birthDate
> if( !patient.hasBirthDate() )
> patientTooThin( "birth date" );
>
> worthy.setBirthDate( patient.getBirthDate() ); // ***************
>
> // address
> if( !patient.hasAddress() )
> patientTooThin( "address" );
>
> worthy.setAddress( Collections.singletonList(
> patient.getAddressFirstRep() ) );
> }
>
>
>
>
>
> _______________________________________________
> Hl7api-devel mailing list
> Hl7...@li...
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
|