Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Segments with repetition data #105

Open
Lifeformwp opened this issue Sep 19, 2023 · 2 comments
Open

Creating Segments with repetition data #105

Lifeformwp opened this issue Sep 19, 2023 · 2 comments

Comments

@Lifeformwp
Copy link

Hello, first of all, thanks for a great library!
I have a question regarding Segment Field Repetition. Is it possible to create hl7 messages using your library with a repetition in some fields? Like this:

$contactData = [
    [
        0 => 'some phone number',
        1 => 'PH',
        2 => 'type_phone',
    ],
    [
        0 => 'some mobile phone',
        1 => 'PH',
        2 => 'type_mobile',
    ],
    [
        0 => 'email',
        1 => 'PH',
        2 => 'type_email',
    ],
]
$segmentPID->setPhoneNumberHome($contactData);

So, in the end, when I'm building a message, I would get this string:

PID|||||||||||||some phone number^PH^type_phone~some mobile phone^PH^type_mobile~email^PH^type_email

Is it possible? Thanks in advance for the answer

@senaranya
Copy link
Owner

Hi,

If you're using the HL7 class to build the object, try the method doNotSplitRepetition(), i.e.

HL7::from(<HL7 string>)
    ->doNotSplitRepetition()
    ...

If you're using the Message class, try the 6th parameter doNotSplitRepetition in the constructor. Search for this parameter in the documentation.

@jay-knight
Copy link
Contributor

The doNotSplitRepetition parameter isn't considered when writing the message to a string ($message->toString()), just when parsing an hl7 message. For this to work correctly, segmentToString() would need to know if nested arrays represent repetition or sub components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants