//VIP.net currently doesn't populate MO IDs in the correct fields.
program VIPMOIDs;
var
i: Integer;
recipient: string;
begin
for i := 0 to HL7Data.SegmentCount - 1 do
begin
if SameText(HL7Data.SegmentName[i], 'MSH') then
begin
recipient := HL7Data.GetFieldValue(i, 5, 0, 0, 0);
break;
end;
end;
if ValidateMedicalObjectsID(recipient, false) then
begin
for i := 0 to HL7Data.SegmentCount - 1 do
begin
if SameText(HL7Data.SegmentName[i], 'PRD') and SameText(HL7Data.GetFieldValue(i, 1, 0, 0, 0), 'IR') then
begin
HL7Data.SetFieldValue(recipient, i, 7, 0, 0, 0);
end;
if SameText(HL7Data.SegmentName[i], 'PV1') then
begin
HL7Data.SetFieldValue(recipient, i, 9, 0, 0, 0);
end;
end;
end;
end.