VB code snippet for using the hospitalMCDRequestManager


Private Sub Create_Click()

On Error GoTo Err_Trap

Dim bStatus As Boolean
Dim strAbortInfo As String

'### HospitalMCDRequestManager interface
Dim hospitalMCDRequestManagerEx As HOSPITALMCDREQUESTMANAGER452Lib.HospitalMCDRequestManager
Set hospitalMCDRequestManagerEx = New HospitalMCDRequestManager

hospitalMCDRequestManagerEx.Modus = enDebug
hospitalMCDRequestManagerEx.ModuleLanguage = enEnglish

'### HospitalMCDRequest interface
Dim hospitalMCDRequestEx As HOSPITALMCDREQUESTMANAGER452Lib.HospitalMCDRequest
Set hospitalMCDRequestEx = hospitalMCDRequestManagerEx.HospitalMCDRequest

'### Initialize before starting
bStatus = hospitalMCDRequestEx.Initialize(enGerman)

bStatus = hospitalMCDRequestEx.SetRequest(enNo, enNo, "")

'### set the transport, this is just an example
bStatus = hospitalMCDRequestEx.SetTransport("7600123456789", "", "", "7600001234567",  _
                                            "7600000012345", "")

'### set invoice and mcd, this is only a test
Dim dInvoiceDate As Date
dInvoiceDate = Now
Dim lInvoiceTimestamp As Long
lInvoiceTimestamp = 0 ' 1970-01-01
bStatus = hospitalMCDRequestEx.SetInvoice("INVOICE_ID", dInvoiceDate, lInvoiceTimestamp)

Dim dRequestMCDDate As Date
dRequestMCDDate = Now
Dim lRequestMCDTimestamp As Long
lRequestMCDTimestamp = 0 ' 1970-01-01
bStatus = hospitalMCDRequestEx.SetMCD("MCD_ID", dRequestMCDDate, lRequestMCDTimestamp)

'###
Dim IAddress As HOSPITALMCDREQUESTMANAGER452Lib.Address
Set IAddress = hospitalMCDRequestEx.CreateAddress

'### set biller
bStatus = IAddress.SetCompany("Biller AG", "Abteilung Inkasso", "")
bStatus = IAddress.SetPostal("Billerweg 128", "", "4410", "Liestal", "BL", "CH")
bStatus = hospitalMCDRequestEx.SetBiller("7634567890111", "H121111", "", "", IAddress)

'### set provider
IAddress.Initialize
bStatus = IAddress.SetCompany("Spital im Park", "Abteilung Neurologie", "")
bStatus = IAddress.SetPostal("Spitalgasse 17b6", "", "4000", "Basel", "BS", "CH")
bStatus = hospitalMCDRequestEx.SetProvider("7634567890111", "P123456", "", "FMH Innere Medizin", _
                                           IAddress)

'### set insurance
IAddress.Initialize
bStatus = IAddress.SetCompany("Unfallkasse AG", "Bereich Nord", "")
bStatus = IAddress.SetPostal("Kassengraben 222", "Postfach 2222", "4000", "Basel", "BS", "CH")
bStatus = hospitalMCDRequestEx.SetInsurance("2034567890222", IAddress)

'### set patient
bStatus = hospitalMCDRequestEx.SetPatient(enMale, DateValue("1940-01-01"))

'### set the treatment data
bStatus = hospitalMCDRequestEx.SetTreatment("someCaseID",DateValue("2017-07-04"), _
                                            DateValue("2017-08-03"),31)

'### set the grouper data
bStatus = hospitalMCDRequestEx.SetGrouperData(68.5, 0, "swissDRG 6.0")

'### set the grouper records
bStatus = hospitalMCDRequestEx.AddGrouperRecord(enGrouperAdmissionType, 0, "normal")
bStatus = hospitalMCDRequestEx.AddGrouperRecord(enGrouperDischargeType, 0, "normal")
bStatus = hospitalMCDRequestEx.AddGrouperRecord(enGrouperProviderType, 0, "Akutspital")

'### add a diagnosis
bStatus = hospitalMCDRequestEx.AddDiagnosis(drgID,"Q75.0","Dysotosis craniofacialis","ICD10-2016","")

'### add a procedure
bStatus = hospitalMCDRequestEx.AddProcedure(drgID, "Z01.24", "Sonstigte Kraniotomie", "CHOP9-2016",  _
                                            enSideLeft, DateValue("2017-07-20"), "")

'### Finalize
bStatus = hospitalMCDRequestEx.Finalize()

'### write eveything to a file
Dim strTmpFile As String
Dim lValidationError As Long
Dim lTimestamp As Long
Dim lXMLGenerationAttributes As Long
lXMLGenerationAttributes = 1
Dim hospitalMCDResultEx As HospitalMCDResult
bStatus = hospitalMCDRequestManagerEx.GetXML(lXMLGenerationAttributes, strTmpFile, lValidationError,  _
                                             lTimestamp, hospitalMCDResultEx)
If Not bStatus Then
    GoTo Abort
End If
Dim lPrintTimestamp As Long

'### print preview
'### set receiver address
IAddress.Initialize
bStatus = IAddress.SetCompany("Some Company", "A department", "")
bStatus = IAddress.SetPostal("XY-Strasse 17b6", "", "4000", "Basel", "BS", "CH")

bStatus = hospitalMCDRequestManagerEx.Print("", enYes, enYes, "senderID", IAddress, lPrintTimestamp,  _
                                            hospitalMCDResultEx)

'### release resources
Set IAddress = Nothing
Set hospitalMCDResultEx = Nothing
Set hospitalMCDRequestEx = Nothing
Set hospitalMCDRequestManagerEx = Nothing

Exit Sub

Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)
Abort:
Set IAddress = Nothing
Set hospitalMCDResultEx = Nothing
Set hospitalMCDRequestEx = Nothing
Set hospitalMCDRequestManagerEx = Nothing


End Sub