Input is HL7 2.4 Output is 2.3
PID-3 (00106) is repeatable, and contains subfields on both standards.
Destination system would rather have one, and only one value in the PID-3 field (the medical record number), although their variant documentation allows for what the standard shows.
Pathcopy has already been completed to populate all the fields.
Input field:
M000001234^^^^MR^MGI~123-45-6789^^^^SS^MGI~M9876^^^^PI^MGI~MGIV0003456^^^^HUB^MGI
Desired output field (the MR number prefixed with a literal ‘MC’):
MCM000001234
Surely there is a way to null out the entire field (all repeats) with a single command, but I am drawing a blank (pun intended 😆 )
Here’s the iterate I used to get it to work, but I don’t like doing all of those individual copy commands:
{ { OP ITERATE }
{ BASIS 0(0).PID.00106 }
{ VAR %f1 }
{ TYPE field }
{ BODY {
{ { OP COMMENT }
{ COMMENT {PACS system prefers only the MR number in PID-3, nothing else.} }
}
{ { OP COMMENT }
{ COMMENT {Parse through PID.106 fields, blank out the previous PATHCOPY’d information.} }
}
{ { OP COMMENT }
{ COMMENT {Check input subfield 4, if it is MR, prefix subfield 0 with “MC”, and place in PID-3} }
}
{ { OP COPY }
{ ERR 0 }
{ IN @null }
{ OUT {{0(0).PID.00106(%f1).[0]}} }
}
{ { OP COPY }
{ ERR 0 }
{ IN @null }
{ OUT {{0(0).PID.00106(%f1).[1]}} }
}
{ { OP COPY }
{ ERR 0 }
{ IN @null }
{ OUT {{0(0).PID.00106(%f1).[2]}} }
}
{ { OP COPY }
{ ERR 0 }
{ IN @null }
{ OUT {{0(0).PID.00106(%f1).[3]}} }
}
{ { OP COPY }
{ ERR 0 }
{ IN @null }
{ OUT {{0(0).PID.00106(%f1).[4]}} }
}
{ { OP COPY }
{ ERR 0 }
{ IN @null }
{ OUT {{0(0).PID.00106(%f1).[5]}} }
}
{ { OP IF }
{ ERR 0 }
{ COND {0(0).PID.00106(%f1).[0] ne @null && 0(0).PID.00106(%f1).[4] eq @tmpmr} }
{ THENBODY {
{ { OP COMMENT }
{ COMMENT {IF PID3.0 is not blank, and PID3.4 is MR, concat MC and PID3.0} }
}
{ { OP COPY }
{ ERR 0 }
{ IN {=MC {0(0).PID.00106(%f1).[0]}} }
{ OUT {{0(0).PID.00106(0).[0]}} }
{ COPYSEP {} }
}
}}
{ ELSEBODY {
}}
}
}}
}
I have tried copying @null to 0(0).PID.00106 prior to the iterate, but all that seems to null out is the first subfield on the first instance of the fields. That copy looks like:
input:
M000001234^^^^MR^MGI~123-45-6789^^^^SS^MGI~M9876^^^^PI^MGI~MGIV0003456^^^^HUB^MGI
output:
^^^^MR^MGI~123-45-6789^^^^SS^MGI~M9876^^^^PI^MGI~MGIV0003456^^^^HUB^MGI
So.. what’s the right way to do this?
Thanks
Todd