I’m having an issue in a tclproc with conditionally pairing segments and pulling data out from the 2nd (ZPX) segment in the pair conditionally based upon values in the 1st (PR1) segment.
Specifically this is from an Optum360 HL7 BAR transaction with charge codes (ultimately need to be formatted to Cerner Invision 48/49 format – but that’s another issue!)
The Charge Code is in the ZPX.1 field, but we only want to pull it when the corresponding PR1 segment has PR109 = “CM” and PR115 is valued.
Tried various versions of the tclprocs but at this point they’re all a mess!
Having real difficulty pairing the PR1 and ZPX segments based upon the conditions defined above.
Complete format of Optum360 BAR source is attached.
Excerpt below:
The 1st PR1 PR109 is not valued and PR115 is valued, but there’s no corresponding ZPX segment – so in that case I’d need to skip the PR1
The 2nd PR1 segment matches the conditions and ZPX.1 has the charge code so I’d keep that
The 3rd PR1 segment doesn’t meet the conditions so I’d skip the PR1 and ZPX segments
….etc
PR1|1|C4|20610|DRAIN/INJ JOINT/BURSA W/|201607290000||||||118559||||LT|LT
PR1|2|C4|73564|X-RAY EXAM KNEE 4 OR MOR|201607290000|||1|CM|0320|||||RT|RT
ZPX|41100958|0.00
PR1|3|C4|87205|SMEAR GRAM STAIN |201607290000|||1|CM|0306||||||
ZPX|21107042|0.00
Any suggestions appreciated! Thanks!