Hi everyone, please check out our new discussion forum located in our GitHub site: https://github.com/nextgenhealthcare/connect/discussions. Let us know your feedback as we try out this new part of GitHub! Don't worry, the content in these forums won't be going away and will at a minimum be preserved for historical reference.
Announcement
Collapse
No announcement yet.
Looping through multiple sub-components (MRNs in PID 3.1.x)
I'd like to do something similar, so PID3 is repeating but not in all the messages. I'd like to loop PID3 values then map them to the outbound HL7, what do you suggest?
I have a similar issue where I need to remove all the SSN's in the PID segment. One of these is in this PID-3 segment which repeats a bit. Here's my solution which might be of use to people looking at this thread. Obviously, I'm doing something a lot simpler than the OP requested, but... still.
Code:
// Remove the SSN from various locations.
var ssnPattern = /^[0-9]{3}\-?[0-9]{2}\-?[0-9]{4}$/;
msg['PID']['PID.19']['PID.19.1'] = '';
msg['PID']['PID.20']['PID.20.1'] = '';
for (var i = 0; i < 20; i++) {
try {
var pid31 = msg['PID']['PID.3'][i]['PID.3.1'].toString();
if (ssnPattern.test(pid31)) {
//msg['PID']['PID.3'][i]['PID.3.1'] = '';
delete msg['PID']['PID.3'][i];
}
} catch(err) {
i = 50;
}
}
// save your changes
hl7_xml = msg;
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. We may share certain information about our users with our advertising and analytics partners. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment