Try {
Set sc = $System.Status.OK()
Set pResponse = ##class(Ens.StringContainer).%New()
Set pResponse.StringValue = "OK"
// Unescape stream
// See EnsLib.HL7.Segment:Unescape()
//
// Set up replacement array
//Set replace("\.br\") = $Char(13)
Set replace("\E\") = "\"
Set replace("\F\") = "|"
Set replace("\R\") = "~"
Set replace("\S\") = "^"
Set replace("\T\") = "&"
Set replace("\X0A\") = $Char(10)
Set replace("\X0D\") = $Char(13)
// Loop through stream and replace strings
// Store output in a new stream
Set uuepdf = ##class(%Stream.GlobalCharacter).%New()
Set chars = 1
// Need to read one character at a time and if a "\" is found,
// search for a match in the replace array
Do {
Set text = pRequest.pdfsegment.Read(.chars, .sc)
Quit:$System.Status.IsError(sc)
// If we find a "\" keep reading until we find the matching
// (ending) "\"
If (text = "\") {
Do {
Set text = text _ pRequest.pdfsegment.Read(.chars, .sc)
Quit:$System.Status.IsError(sc)
} While ($Extract(text, $Length(text)) '= "\")
Quit:$System.Status.IsError(sc)
// Replace the escape sequence with the proper
// replacement character
Set text = $$replaceArray^EnsUtil(text, .replace)
}
// Write text to the unescaped uuencoded stream
Do uuepdf.Write(text)
} While (chars '= -1)
Quit:$System.Status.IsError(sc)
// Save the stream
Set sc = uuepdf.%Save()
Quit:$System.Status.IsError(sc)
$$$LOGINFO("uuepdf size = " _ uuepdf.Size)
//************************** Date Function ***********************
// Legacy JavUrScript
// function string_to_date(strg,returnformat){
Set timeraw = $EXTRACT(pRequest.ekgdate,9,14)
$$$LOGINFO("Near My stuff")
// Pull apart the time and put it back together with colons
Set time1 = $EXTRACT(timeraw,0,1)
Set time2 = $EXTRACT(timeraw,2,3)
Set time3 = $EXTRACT(timeraw,4,5)
Set timejoin = time1 _":"_ time2 _":"_ time3
Set datez = $ZDATEH(dateraw,8)
Set timez = $ZDATEH(""""_timejoin_"""",1)
Set date = $ZDATE(datez,3)
Set time = $REPLACE($ZTIME(timez),":","-")
*/
//Set datetime = ##class(Ens.Util.Time).ConvertDateTime(pRequest.ekgdate,"%q(0)","%Y-%m-%d_%H-%M-%S")
Set datetime = ##class(Ens.Util.Time).ConvertDateTime(pRequest.ekgdate,"%q(0)","%m-%d-%Y_%H-%M-%S")
$$$LOGINFO("DateTime = " _ datetime)
//Set fileName2 = pRequest.firstname _".pdf"
//Set sc = ..Adapter.PutStream(fileName2, uuepdf)
//************************************************************************************
Set tSC = ..GetConnection(.tJavaGateway)
$$$LOGINFO("tSC: "_tSC)
If $$$ISOK(tSC){
$$$LOGINFO("here")
set PDFUpgrader = ##class(IntegrationRequired.EKG.Muse.PDFUpgrader).%New(tJavaGateway)
$$$LOGINFO("PDF: "_PDFUpgrader)
set uudpdf = PDFUpgrader.upgradechararray(uuepdf)
$$$LOGINFO("UUPDF: "_uudpdf)
}
//************************************************************************************
//
//Check that an object was returned
If '$IsObject(uudpdf){
Set sc = $System.Status.Error($$$GeneralError,"PDFUpgrader returned a null reference")
Quit
}
// Save the stream
Set sc = uudpdf.%Save()
Quit:$System.Status.IsError(sc)
// Store PDF contents to temporary file
// Set filename to PatientName_PID_timestamp.uue
Set fileName = pRequest.firstname _ "_" _ pRequest.lastname _ "_" _ pRequest.fin _ "_" _ pRequest.mrn _ "_" _ datetime _ ".pdf"
Set sc = ..Adapter.PutStream(fileName, uudpdf)
}
Catch (exception) {
Set sc = exception.AsStatus()
}
Quit sc
--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group, send email to Ensemble-in-Healthcare-unsub...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healthcare+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
USER>Write $System.Encryption.Base64Encode("Hellow World!")SGVsbG93IFdvcmxkIQ==USER>
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healt...@googlegroups.com.
Kind regards,AS
To unsubscribe from this group, send email to Ensemble-in-Healthcare-unsub...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healthcare+unsub...@googlegroups.com.
...
To unsubscribe from this group, send email to Ensemble-in-Healthcare-unsub...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healthcare+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.