以下のメソッドは、PDF ドキュメントに対して XDS Provide and Register を生成します。このメソッドを使用するには、Foundation プロダクションの HS.IHE.XDSb.DocumentSource.Operations に移動して、XDSbConsumerOperations 設定の値を HS.IHE.XDSb.Consumer.Operations から HS.HC.IHE.XDSb.Consumer.Operations に変更します。
ClassMethod CDAPnR2()
{
// Create the message, which automatically assigns a document unique ID
Set tMessage=##class(HS.Message.IHE.XDSb.ProvideAndRegisterRequest).%New()
// Provide SubmissionSet metadata (see "Note 1" below)
Set tMessage.PatientId="100000001^^^&1.3.6.1.4.1.21367.2010.1.2.300&ISO"
Set tMessage.SourceId="1.3.6.1.4.1.21367.2010.1.2.300.2.0"
Set tMessage.ContentTypeCode = ##class(HS.IHE.XDSb.Types.CodedValue).Create(
"11488-4","2.16.840.1.113883.6.1","Consultation Note")
// Create a document instance to hold the document metadata
Set tDocument = ##class(HS.Message.IHE.XDSb.Document).%New()
// Open the document (see "Note 2" below)
Set tFile = ##class(%Stream.FileBinary).%New()
Set tFile.Filename="C:\wtemp\testdoc.pdf"
Do tFile.Rewind()
Do tDocument.Body.CopyFrom(tFile)
Kill tFile
// Set the "MIMEType" (see "Note 3" below)
Set tDocument.MimeType="application/pdf"
// Enter the document metadata (see "Note 4" below)
Set tDocument.CreationTime="20180821102615-0400"
Set tDocument.LanguageCode="en-CA"
Set tDocument.ClassCode=##class(HS.IHE.XDSb.Types.CodedValue).Create(
"26435-8","2.16.840.1.113883.6.1","MOLECULAR PATHOLOGY STUDIES")
Set tDocument.FormatCode=##class(HS.IHE.XDSb.Types.CodedValue).Create(
"urn:ihe:iti:xds-sd:pdf:2008","1.3.6.1.4.1.19376.1.2.3","Scanned Documents PDF")
Set tDocument.HealthcareFacilityTypeCode=##class(HS.IHE.XDSb.Types.CodedValue).Create(
"OF","2.16.840.1.113883.5.11","Outpatient facility")
Set tDocument.PracticeSettingCode=##class(HS.IHE.XDSb.Types.CodedValue).Create(
"394802001","2.16.840.1.113883.6.96","General Medicine")
Set tDocument.TypeCode=##class(HS.IHE.XDSb.Types.CodedValue).Create(
"18768-2","2.16.840.1.113883.6.1","CELL COUNTS+DIFFERENTIAL STUDIES")
Do tDocument.ConfidentialityCode.Insert(##class(HS.IHE.XDSb.Types.CodedValue).Create(
"N","2.16.840.1.113883.5.25","Normal"))
Do tDocument.EventCodeList.Insert(##class(HS.IHE.XDSb.Types.CodedValue).Create(
"1.2.840.10065.1.12.1.13","1.2.840.10065.1.12","Review Signature"))
// Patient demographics
Set tDocument.SourcePatientId="1111222^^^&1.3.6.1.4.1.21367.2010.1.2.310&ISO"
Do tDocument.SourcePatientInfo.Insert(##class(HS.IHE.XDSb.Types.SlotValue).%New(
"PID-3|1111222^^^&1.3.6.1.4.1.21367.2010.1.2.310&ISO"))
Do tDocument.SourcePatientInfo.Insert(##class(HS.IHE.XDSb.Types.SlotValue).%New(
"PID-5|Smith^James^"))
Do tDocument.SourcePatientInfo.Insert(##class(HS.IHE.XDSb.Types.SlotValue).%New(
"PID-7|20000930"))
Do tDocument.SourcePatientInfo.Insert(##class(HS.IHE.XDSb.Types.SlotValue).%New("PID-8|M"))
Do tDocument.SourcePatientInfo.Insert(##class(HS.IHE.XDSb.Types.SlotValue).%New(
"PID-11|123 Money Street^^Somewhere^SW^"))
// Document author
Set tAuthor= ##class(HS.IHE.XDSb.Types.Author).%New()
Set tAuthor.AuthorPerson="John Smith"
Do tAuthor.AuthorInstitution.Insert(##class(HS.IHE.XDSb.Types.SlotValue).%New("Johns Hopkins"))
Do tAuthor.AuthorRole.Insert(##class(HS.IHE.XDSb.Types.SlotValue).%New("Role"))
Do tAuthor.AuthorSpecialty.Insert(##class(HS.IHE.XDSb.Types.SlotValue).%New("Specialty"))
Do tDocument.Author.Insert(tAuthor)
// Optional replacement context (see "Note 5" below)
Set tContext = ##class(HS.Message.IHE.XDSb.QueryItem).CodedValue("$XDSDocumentEntryEventCodeList",
"1.2.840.10065.1.12.1.13","1.2.840.10065.1.12")
Do tDocument.ReplacementContext.Insert(tContext)
// Insert the document metadata into the message
Do tMessage.Documents.Insert(tDocument)
// Send the message to the test service (or directly to HS.IHE.XDSb.DocumentSource.Operations)
Write ##class(HS.Test.Service).SendSync(tMessage,.rr)
Quit
}
Set tSC = ##class(HS.Test.Service).SendSync(tMessage,.rr)
if $$$ISOK(tSC) {
set statusSuccess=rr.ContentStream.FindAt(
1,"urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success")
set statusFail=rr.ContentStream.FindAt(
1,"urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure")
if statusFail0 { w !, "Response Status was a failure!"
Do rr.ContentStream.Rewind() w !, rr.ContentStream.Read(231), " ... " }
if statusSuccess>0 { w !, "Response Status was Success" }
} else { Do $System.Status.DisplayError(tSC) }