Decode and create a pdf from a ED HL7 message
Hello Gentlemen,
My Business process connector receive a Oru_01 hl7 message with an ED segment inside (Base64 pdf). How is it possible to extract it and create a pdf file within?
Here is the sample of function I have. I know it doesn't work but if you could help me, it would be perfect. Here is my function, the goal would be it create the file where I want and return me the link of the file.
Method getPdfFromED(req As EnsLib.HL7.Message,segment As %String) As %Status
{
do req.GetFieldStreamBase64(.base64, segment)
set stream1=##class(%Stream.FileCharacter).%New()
set stream2=##class(%Stream.FileCharacter).%New()
set sc = stream2.LinkToFile("\\chr13139\test\ceciEstUnTest.txt")
while 'base64.AtEnd {
set temp=base64.Read()
set temp=$translate(temp, $c(13,10))
do stream1.Write(temp)
}
do stream1.Rewind()
while 'stream1.AtEnd {
set temp=stream.Read(4000)
set temp=$system.Encryption.Base64Decode(temp)
do stream2.Write(temp)
}
do stream2.%Save()
return $$$OK
}
Thomas