Visual Basic code snippet for generating a pushAdminMessage XML infoset


Private Sub Command1_Click()

On Error GoTo Err_Trap

'### create main PushAdminMessageManager interface
Dim pushAdminMessageManagerEx As PUSHADMINMESSAGEMANAGER450Lib.PushAdminMessageManager
Set pushAdminMessageManagerEx = New StatusRequestManager

'### Set the module language to german
pushAdminMessageManagerEx.ModuleLanguage = enGerman

'### StatusRequest interface
Dim pushAdminMessageRequestEx As PUSHADMINMESSAGEMANAGER450Lib.StatusRequest
Set pushAdminMessageRequestEx = pushAdminMessageManagerEx.PushAdminMessageRequest

'### Initialize the StatusRequest!!!
pushAdminMessageRequestEx.Initialize(enGerman)

'### create an address interface that is need to add all the following addresses
'### do not forget to initialize the IAddress interface befor using it
Dim addressEx As PUSHADMINMESSAGEMANAGER450Lib.Address
Set addressEx = pushAdminMessageRequestEx.CreateAddress

'### define the 'biller' of the ad minitrative message(required)
'### note that phone, fax and online data are optional
addressEx.Initialize
bStatus = addressEx.SetCompany("Biller AG", "Abteilung Inkasso", "")
bStatus = addressEx.SetPostal("Billerweg 128", "", "4414", "Frenkendorf", "", "")
bStatus = addressEx.AddPhone("956 99 00", "061", "", "")
bStatus = addressEx.SetOnline("info@biller.ch", "")
bStatus = pushAdminMessageRequestEx.SetBiller("2011234567890", "H-1211-11", "", "", addressEx)

'### define the health insurance (required  as debitor address)
addressEx.Initialize
bStatus = addressEx.SetCompany("Krankenkasse AG", "Sektion Basel", "")
bStatus = addressEx.SetPostal("Kassengraben 222", "", "4000", "Basel", "", "")
bStatus = pushAdminMessageRequestEx.SetInsurance("2034567890222", addressEx)

'### define the patient (required)
'### note that more data are needed here (sex, birthdate,ssn). data from the insurance 
'### card can be supplied as well 
Dim dBirthdate As Date
dBirthdate = DateValue("1964-2-28")
addressEx.Initialize
bStatus = addressEx.SetPerson("Muster", "Peter", "Herr", "", "c/o Mieter Karl")
bStatus = addressEx.SetPostal("Musterstrasse 5", "", "7304", "Maienfeld", "", "")
bStatus = pushAdminMessageRequestEx.SetPatient(enMale, dBirthdate, "756.1234.5678.90", addressEx)

bStatus = pushAdminMessageRequestEx.SetCard("12345678901234567890", DateValue("2019-12-31"),  _
                                            DateValue("2019-12-31"), "", "")

'### set the applicable law (required)
bStatus = pushAdminMessageRequestEx.SetLaw(enKVG, 0, "", "123.45.678-012")

'### add the primary administrative message for a statioanry treatment
bStatus = pushAdminMessageRequestEx.SetMessage4Stationary(enActionStart, DateValue("2020-05-05"), enDisease, _
                                                          enRegular, enCantonal, enHospitalComfort, "M100",  _
                                                          "1.2.V02=3")

Dim bStatus As Boolean
'### set the transport, this is just an example
bStatus = pushAdminMessageRequestEx.SetTransport("2012345678901", "7601001304307", _
                                                 "queryRHS(7601001302112,7601003000078)")

'### Finalize!!!
bStatus = pushAdminMessageRequestEx.Finalize()

'### PushAdminMessageResult interface
Dim pushAdminMessageResultEx As PUSHADMINMESSAGEMANAGER450Lib.PushAdminMessageResult

'### write eveything to a file
Dim lValidationError As Long
Dim lTimestamp As Long
Dim strTmpFile As String
Dim strUsedXSDSchema As String
bStatus = pushAdminMessageManagerEx.GetXML(0,strTmpFile, lValidationError, lTimestamp, _ 
                                           strUsedXSDSchema, pushAdminMessageResultEx)

'### release resources
Set pushAdminMessageRequestEx = Nothing
Set pushAdminMessageResultEx = Nothing
Set pushAdminMessageManagerEx = Nothing

Exit Sub

Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)
'### release resources
Set pushAdminMessageRequestEx = Nothing
Set pushAdminMessageResultEx = Nothing
Set pushAdminMessageManagerEx = Nothing

End Sub