Page 1 of 2
Hl7 2.3.1 and problem with demo
Posted: Sat May 11, 2013 10:39 pm
by mariusz.stefaniak
Hi... I just downloaded trial version of HL7 component (2.3.1) - I need this version because it's most commonly used in my country. Also I downloaded your demo application. I replaces 22 and 24 units with 231.
When I tried to run it (Delphi 7 Pro) I got several error messages:
Patient:=msg.PATIENT_RESULT[0].PATIENT.PID.PatientName;
[Error] uDemo.pas(89): '[' expected but ';' found
Memo1.Lines.Append(observation.OBX.ObservationIdentifier.Text.AsString+#9#9+
TdiST_231(observation.OBX.ObservationValue).AsString);
[Error] uDemo.pas(102): '[' expected but ')' found
msg.MSH.Sendingapplication.AsString:='TestSendingSystem';
[Error] uDemo.pas(117): Undeclared identifier: 'AsString'
msg.PID.PatientName.FamilyName.AsString:='Doe';
[Error] uDemo.pas(126): '[' expected but '.' found
and so on...
Could you tip me please - what do I do wrong? Is it really correct demo for this version of components?
best regards
Mario
Re: Hl7 2.3.1 and problem with demo
Posted: Sun May 12, 2013 8:49 am
by admin
Hi,
Each version has its own structure. Can not switch to another version, by changing only the version information.
Version 2.3.1 has different PID segment from version 2.2
In 2.3.1
property PatientName[RepCount:Integer]: TdiXPN_231 read GetPatientName write SetPatientName;
Patient Name, Usage : R, Min : 1,
Max : *
http://www.delphihl7.com/doc/html/diHL7 ... D_231.html
in 2.2
property PatientName : TdiPN_22 read GetPatientName write SetPatientName;
Patient Name, Usage : R, Min : 1,
Max : 1
http://www.delphihl7.com/doc/html/diHL7 ... ID_22.html
Demo is correct.
If you have to work on the sample message you can get results more quickly.
Best regards.
Re: Hl7 2.3.1 and problem with demo
Posted: Sun May 12, 2013 3:00 pm
by mariusz.stefaniak
If you have to work on the sample message you can get results more quickly.
Sorry.. Which sample message? Everything I found is designed for version 2.2. Do you have some samples of code designed for version 2.31?
Re: Hl7 2.3.1 and problem with demo
Posted: Sun May 12, 2013 7:02 pm
by admin
Hi,
Sample messsage generate:
Code: Select all
procedure TForm1.bGen231Click(Sender: TObject);
var
msg : TdiORU_R01_231;
begin
msg :=TdiORU_R01_231.Create;
msg.PATIENT_RESULT[0].PATIENT.PID.PatientID.ID.AsString:='PatientID';
msg.PATIENT_RESULT[0].PATIENT.PID.PatientName[0].Familynamelastnameprefix.FamilyName.AsString:='FamilyName';
msg.PATIENT_RESULT[0].PATIENT.PID.PatientName[0].Givenname.AsString:='GivenName';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBR.SetIDOBR.AsString:='1';
Memo1.Lines.Text:=msg.AsString;
msg.Free;
end;
Output:
Code: Select all
MSH|^~\&|||||20130512221701||ORU^R01||P|2.3.1
PID||PatientID|||FamilyName^GivenName
OBR|1
Re: Hl7 2.3.1 and problem with demo
Posted: Mon May 13, 2013 7:29 pm
by mariusz.stefaniak
I see... I've done part of my work, but I have problem identifying several elements
What do I mean...
On requirements doc given by my partner I have something like this
ORC, field 12.2 - set this
ORC, field 5.7 - set something else
Do you have any documentation composed like following?
ORC - 2.0 - msg.ORDER[0].ORC.PlacerOrderNumber.Entityidentifier
ORC - 2.1 - msg.ORDER[0].ORC.PlacerOrderNumber.NamespaceID
ORC - 3.0 - msg.ORDER[0].ORC.FillerOrderNumber.Entityidentifier
and so on
It would be helpful
Re: Hl7 2.3.1 and problem with demo
Posted: Mon May 13, 2013 7:43 pm
by admin
Re: Hl7 2.3.1 and problem with demo
Posted: Tue May 14, 2013 9:35 am
by mariusz.stefaniak
Thank you... There is one thing more that I need to ask you about...
I did everything except for ObservationValue
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[0].OBX.ObservationValue[0]. ????????
Could you please provide me with small sample of code that will tip me - how to put there values?
best regards
Mario
Re: Hl7 2.3.1 and problem with demo
Posted: Tue May 14, 2013 7:45 pm
by admin
Hi,
Please, check this :
http://www.delphihl7.com/?action=sample#GenerateXmlMsg
Code: Select all
var
sn : TdiSN_24;
begin
...
...
// Your value type is SN and you must create SN type object.
// Not free this object. Automaticly managed. Only Create object.
obx:=msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[0].OBX;
obx.ValueType.AsString:='SN'; // Type Definition
sn:=TdiSN_24.Create;
sn.Num1.AsString:='182';
obx.ObservationValue[0]:= sn;
...
...
end;
Re: Hl7 2.3.1 and problem with demo
Posted: Tue May 14, 2013 10:57 pm
by mariusz.stefaniak
Yeah... but I don't operate on version 2.4 (I saw how to do that on 2.4, but it's not a point). I try to figure out how to do that on 2.3.1.
In 2.3.1
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[0].OBX.ObservationValue
is TdiNode, but how to use TdiNode to save values????
Re: Hl7 2.3.1 and problem with demo
Posted: Wed May 15, 2013 6:29 am
by admin
Hi,
1. You must decide which type that you need.
(ST - String Data ,SN - Structured Numeric,TX - Text Data,ED - Encapsulated Data ... )
For example our type : SN and hl7 version : 231
2. Create a variable for SN type
var
sn : TdiSN_231;
3.Set your type :
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[0].OBX.ValueType.AsString:='SN'; // Type Definition
4. Create your object and set values
sn:=TdiSN_24.Create;
sn.Num1.AsString:='182';
5. Set this object Observation Value
// Your value type is SN and you must create SN type object.
// Not free this object. Automaticly managed. Only Create object.
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[0].OBX.ObservationValue[0]:=sn
Example code :
Code: Select all
procedure TForm1.bGen231Click(Sender: TObject);
var
msg : TdiORU_R01_231;
st : TdiST_231;
sn : TdiSN_231;
ed : TdiED_231;
begin
msg :=TdiORU_R01_231.Create;
msg.PATIENT_RESULT[0].PATIENT.PID.PatientID.ID.AsString:='PatientID';
msg.PATIENT_RESULT[0].PATIENT.PID.PatientName[0].Familynamelastnameprefix.FamilyName.AsString:='FamilyName';
msg.PATIENT_RESULT[0].PATIENT.PID.PatientName[0].Givenname.AsString:='GivenName';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBR.SetIDOBR.AsString:='1';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[0].OBX.SetIDOBX.AsString:='1';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[0].OBX.ValueType.AsString:='ST';
st:=TdiST_231.Create;
st.AsString:='test 1 2 3';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[0].OBX.ObservationValue[0]:=st;
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[1].OBX.SetIDOBX.AsString:='2';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[1].OBX.ValueType.AsString:='SN';
sn:=TdiSN_231.Create;
sn.Num1.AsString:='50';
sn.Num2.AsString:='150';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[1].OBX.ObservationValue[0]:=sn;
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[2].OBX.SetIDOBX.AsString:='3';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[2].OBX.ValueType.AsString:='ED';
ed:=TdiED_231.Create;
ed.Typeofdata.AsString:='TXT';
ed.Data.AsString:='Hello';
msg.PATIENT_RESULT[0].ORDER_OBSERVATION[0].OBSERVATION[2].OBX.ObservationValue[0]:=ed;
Memo1.Lines.Text:=msg.AsString;
msg.Free;
end;
output :
Code: Select all
MSH|^~\&|||||20130515092028||ORU^R01||P|2.3.1
PID||PatientID|||FamilyName^GivenName
OBR|1
OBX|1|ST|||test 1 2 3
OBX|2|SN|||^50^^150
OBX|3|ED|||^TXT^^^Hello