problem with repetitive segments
Posted: Tue Dec 27, 2011 1:55 pm
I have a query:
when I create a message TdiZQA_Z02_24 of authorization, with the repetitive segments that are PR1, AUT and ZAU...
the proper way to create the message should be as follows::
now when I'm creating in my application the message appears as follows:
the problem is the order of PR1 to have to go with their respective segments and Zau AUT.
step the code I was developing:
constructor
create message:
thanks and best regards!!!
when I create a message TdiZQA_Z02_24 of authorization, with the repetitive segments that are PR1, AUT and ZAU...
the proper way to create the message should be as follows::
Code: Select all
MSH|.........
PRD|.........
PRD|.........
PID|.........
PR1|1||420001^^2
AUT||||||||1
ZAU||0
PR1|1||420102^^1
AUT||||||||1
ZAU||0
PV1||O||P|||||||||||||||||||||||||||||||||||||||||||||||V
Code: Select all
MSH|.........
PRD|.........
PRD|.........
PID|.........
PR1|100||420101^^10
PR1|200||420101^^20
AUT||||||||1
AUT||||||||2
ZAU||0
ZAU||1
step the code I was developing:
Code: Select all
TdiZQA_Z02_24 = class(TdiMessage)
private
MSHList:TdiSegmentList;
PRDList:TdiSegmentList;
PIDList:TdiSegmentList;
{Inicio - Segmentos repetitivos}
PR1List:TdiSegmentList;
AUTList:TdiSegmentList;
ZAUList:TdiSegmentList;
{Fin - Segmentos repetitivos}
PV1List:TdiSegmentList;
protected
function GetMSH: TdiMSH_24;
{begin - repeated segments}
function GetPRD(RepCount : Integer ) : TdiPRD_24;
{end - repeated segments}
//function GetPRD1: TdiPRD_24;
function GetPID: TdiPID_24;
{repeated segments}
function GetPR1(RepCount : Integer ) : TdiPR1_24;
function GetAUT(RepCount : Integer ) : TdiAUT_24;
function GetZAU(RepCount : Integer ) : TdiZAU_24;
function GetPV1: TdiPV1_24;
procedure SetMSH(const Value: TdiMSH_24);
{repeated segments}
procedure SetPRD( RepCount : Integer; const Value : TdiPRD_24);
procedure SetPID(const Value: TdiPID_24);
{repeated segments}
procedure SetPR1( RepCount : Integer; const Value : TdiPR1_24);
procedure SetAUT( RepCount : Integer; const Value : TdiAUT_24);
procedure SetZAU( RepCount : Integer; const Value : TdiZAU_24);
procedure SetPV1(const Value: TdiPV1_24);
public
property MSH: TdiMSH_24 read GetMSH write SetMSH;
{repeated segments}
property PRD[RepCount : Integer ] : TdiPRD_24 read GetPRD write SetPRD;
property PID: TdiPID_24 read GetPID write SetPID;
{repeated segments}
property PR1[RepCount : Integer ] : TdiPR1_24 read GetPR1 write SetPR1;
property AUT[RepCount : Integer ] : TdiAUT_24 read GetAUT write SetAUT;
property ZAU[RepCount : Integer ] : TdiZAU_24 read GetZAU write SetZAU;
function PR1RepCount : Integer;
function AUTRepCount : Integer;
function ZAURepCount : Integer;
property PV1: TdiPV1_24 read GetPV1 write SetPV1;
constructor Create; override;
end;
Code: Select all
constructor TdiZQA_Z02_24.Create;
begin
inherited;
Name :='ZQA_Z02';
MessageType :='ZQA';
TriggerEvent :='Z02';
HL7Version :='2.4';
MSHList:=TdiSegmentList.Create;
MSHList.SetDefault('MSH','TdiMSH_24',0,1,1,Self);
Add(MSHList);
PRDList:=TdiSegmentList.Create;
PRDList.SetDefault('PRD','TdiPRD_24',1,1,2,Self);
Add(PRDList);
PIDList:=TdiSegmentList.Create;
PIDList.SetDefault('PID','TdiPID_24',2,1,1,Self);
Add(PIDList);
{repeated segments}
PR1List:=TdiSegmentList.Create;
PR1List.SetDefault('PR1','TdiPR1_24',3,1,5,Self);
Add(PR1List);
AUTList:=TdiSegmentList.Create;
AUTList.SetDefault('AUT','TdiAUT_24',4,1,5,Self);
Add(AUTList);
ZAUList:=TdiSegmentList.Create;
ZAUList.SetDefault('ZAU','TdiZAU_24',5,1,10,Self);
Add(ZAUList);
PV1List:=TdiSegmentList.Create;
PV1List.SetDefault('PV1','TdiPV1_24',6,0,1,Self);
Add(PV1List);
Parse(InitMsg);
end;
Code: Select all
{PRACTICE 1}
msgAuth.PR1[0].SetIDPR1.AsString := '100';
msgAuth.PR1[0].ProcedureCode.Identifier.AsString := '420101';
msgAuth.PR1[0].ProcedureCode.Nameofcodingsystem.AsString := '10';
msgAuth.AUT[0].RequestedNumberofTreatments.AsString := '1';
msgAuth.ZAU[0].inscarrier2.AsString := '0';
{PRACTICE 2}
msgAuth.PR1[1].SetIDPR1.AsString := '200';
msgAuth.PR1[1].ProcedureCode.Identifier.AsString := '420101';
msgAuth.PR1[1].ProcedureCode.Nameofcodingsystem.AsString := '20';
msgAuth.AUT[1].RequestedNumberofTreatments.AsString := '2';
msgAuth.ZAU[1].inscarrier2.AsString := '1';