Code snippets for using the careCreditRequestManager

 


Private Sub CareCreditRequestExampleButton_Click()

On Error GoTo Err_Trap

Dim bStatus As Boolean

'### init variables
Dim strFrom As String
strFrom = "2001001302112"
Dim strVia As String
strVia = "2001000012345"
Dim strTo As String
strTo = "2034567890000"
Dim dBirthdate As Date
dBirthdate = DateValue("1944-2-28")
Dim eSex As SexType
eSex = enMale
Dim eCanton As CantonType
eCanton = enBS
Dim eLaw As LawType
eLaw = enKVG
Dim eTreatType As TreatmentType
eTreatType = enAmbulatory
Dim dTreatmentStart As Date
dTreatmentStart = DateValue("2019-09-01")
Dim dTreatmentEnd As Date
dTreatmentEnd = DateValue("2019-08-29")
Dim strPatientInsID As String
strPatientInsID = "123.45.678-012"
Dim eTreatmentReason As TreatmentReasonType
eTreatmentReason = enDisease
Dim eTreatmentType As TreatmentType
eTreatmentType = enAmbulatory
Dim strEanProvider As String
strEanProvider = "2034567890111"
Dim strEanResponsible As String
strEanResponsible = "2034567890333"

'### create the main CareCreditRequestManager interface
Dim careCreditRequestManagerEx As CARECREDITREQUESTMANAGER450Lib.CareCreditRequestManager
Set careCreditRequestManagerEx = New CareCreditRequestManager

'### generate the dependent CareCreditRequest interface (allows to input data)
Dim careCreditRequestEx As CARECREDITREQUESTMANAGER450Lib.CareCreditRequest
Set careCreditRequestEx = careCreditRequestManagerEx.CareCreditRequest

'### start the input of data
careCreditRequestEx.Initialize(enGerman)
careCreditRequestEx.SetRequest(enNo,enNo,enFirstOrdinance,"");

'### generate some routing/transport as well as some identifying data (required for XML only)
bStatus = careCreditRequestEx.SetTransport(strFrom, "", "", strVia, strTo, "")
bStatus = careCreditRequestEx.SetPackage("CareCreditRequestExample", 10001, 4, "sumex1")

'###############################################################################
'### start with nursing care relevant data, followed by the various address data
'###############################################################################
'### set data triple of the credit object (required)
bStatus = careCreditRequestEx.SetCreditObject("SpitexID20190612", dTreatmentStart, 0)

'### set the applicable law (required)
bStatus = careCreditRequestEx.SetLaw(enKVG, 0, "", strPatientInsID)

'### 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 CARECREDITREQUESTMANAGER450Lib.Address
Set addressEx = careCreditRequestEx.CreateAddress

'### define the biller of the nursing care credit (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.SetFax("956 99 10", "061", "+41", "")
bStatus = addressEx.SetOnline("info@biller.ch", "")
bStatus = careCreditRequestEx.SetBiller("2011234567890", "H-1211-11", "", "", addressEx)

'### define the provider of the nursing care data (required)
'### note that only the required parts are defined here
addressEx.Initialize
bStatus = addressEx.SetCompany("Spitex", "Region Liestal", "")
bStatus = addressEx.SetPostal("Spitexgasse 17b5", "", "4410", "Liestal", "", "")
bStatus = careCreditRequestEx.SetProvider(strEanProvider,"P-1234-56","", _
                                          "", addressEx)

'### define the health insurance (required)
addressEx.Initialize
bStatus = addressEx.SetCompany("Krankenkasse AG", "Sektion Basel", "")
bStatus = addressEx.SetPostal("Kassengraben 222", "", "4000", "Basel", "", "")
bStatus = careCreditRequestEx.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 
addressEx.Initialize
bStatus = addressEx.SetPerson("Muster", "Peter", "Herr", "", "c/o Mieter Karl")
bStatus = addressEx.SetPostal("Musterstrasse 5", "", "7304", "Maienfeld", "", "")
bStatus = careCreditRequestEx.SetPatient(eSex, dBirthdate, "756.1234.5678.90",  _
                                         enDisabilityNone, enIncontinenceNone, addressEx)

bStatus = careCreditRequestEx.SetCard("12345678901234567890", DateValue("2019-12-31"),  _
                                      DateValue("2016-02-01"), "", "")

'### define a referrer if any (optional)
addressEx.Initialize
bStatus = addressEx.SetPerson("Ueberweiser", "Herbert", "Herr", "Dr. med.", "")
bStatus = addressEx.SetPostal("Referrerstrasse 11", "", "5000", "Aarau", "", "")
bStatus = careCreditRequestEx.SetReferrer("2034567890333", "R-2345-67", "", "", addressEx)

'###############################################################################
'### define some treatment data for an ambulatory case and supply a drug service
'### and a Tarmed consultation
'###############################################################################
'### set treatment information (required)
bStatus = careCreditRequestEx.SetTreatment(dTreatmentStart, dTreatmentEnd, eCanton, _
                                           eTreatmentType, eTreatmentReason, enTiersPayant)

'### set the data for a home care case ("Spitex") (required)
Dim lDomesticAidDaysPerWeek as Long
lDomesticAidDaysPerWeek = 1
Dim lDomesticAidHoursPerDay as Long
lDomesticAidHoursPerDay = 3
bStatus = careCreditRequestEx.SetHomeCare("RAI-HC 2018", enNo,   _
                                          lDomesticAidDaysPerWeek, lDomesticAidHoursPerDay,  _
                                          enYes)

'### add planning records and one extra service record
bStatus = careCreditRequestEx.AddPlanningRecord("RAI-HC","10907", _
                                    "Konsultation Arzt - Spitex zur Bedarfsabklärung", _
                                    1.0, "e", 1.0, 11.0, 0, 0.0, 0.0, "", _
                                    "532", "53201",  _
                                    "Massnahmen der Abklärung, Beratung und Koordination, pro 1 Min.", _
                                    11.0, 1.33, 1.0, 1.0)

bStatus = careCreditRequestEx.AddPlanningRecord("RAI-HC","10115","Kompressionsstrümpfe/-verband", _
                                    2.0, "t7", 182.0, 10.0, 0, 0.0, 0.0, "", _
                                    "532", "53203", "Massnahmen der Grundpflege, pro 1 Min.", _
                                    3640.0, 0.91, 1.0, 1.0)

bStatus = careCreditRequestEx.AddPlanningRecord("RAI-HC","10802","Blutdruckmessung", _
                                    2.0, "w", 26.0, 5.0, 0, 0.0, 0.0, "", _
                                    "532", "53202",  _
                                    "Massnahmen der Untersuchung und der Behandlung, pro 1 Min.", _
                                    260.0, 1.09, 1.0, 1.0)

bStatus = careCreditRequestEx.AddPlanningRecord("RAI-HC","10601","Medikamente richten", _
                                    1.0, "w", 26.0, 10.0, 0, 0.0, 0.0, "", _
                                    "532", "53202",  _
                                    "Massnahmen der Untersuchung und der Behandlung, pro 1 Min.", _
                                    260.0, 1.09, 1.0, 1.0)

bStatus = careCreditRequestEx.AddService("452", "15.01.01.00.1", "Material für mittlere Inkontinenz", _
                                    0.498630, 624.0, 1.0, "")


'### finalize the input
bStatus = careCreditRequestEx.Finalize()

'### print the care credit request out as defined by the data 
Dim lTimestamp As Integer
Dim careCreditResultEx As CARECREDITREQUESTMANAGER450Lib.CareCreditResult
bStatus = careCreditRequestManagerEx.Print("",0,enNo,"",  _
                                           lTimestamp,careCreditResultEx)
Set careCreditResultEx = Nothing

'### finally produce the XML infoset
'### note that the interface careCreditResultEx is returned by the method
'### if the call was successful - it must not be created! 
Dim lGenerationAttribute As Long
lGenerationAttribute = 0
Dim lValidationError As Long
Dim strXMLFile As String
Dim strUsedXSDSchema As String
bStatus = careCreditRequestManagerEx.GetXML(lGenerationAttribute, strXMLFile, lValidationError, _
                                                lTimestamp, strUsedXSDSchema, careCreditResultEx)


'### copy the XML infoset away
Dim strTargetFile As String
strTargetFile = "C:\\CareCreditRequestExample.xml"
FileCopy strXMLFile, strTargetFile


'### relase all resources
Set addressEx = Nothing
Set careCreditResultEx = Nothing
Set careCreditRequestEx = Nothing
Set careCreditRequestManagerEx = Nothing

Exit Sub

'### error situation
Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)

'### release all resources
Set addressEx = Nothing
Set careCreditResultEx = Nothing
Set careCreditRequestEx = Nothing
Set careCreditRequestManagerEx = Nothing

End Sub


private void careCreditRequestExampleButton_Click()
{
    ServiceExInput serviceInputEx;
    CARECREDITREQUESTMANAGER450Lib.Address addressEx;
    CARECREDITREQUESTMANAGER450Lib.CareCreditRequest careCreditRequestEx;
    CARECREDITREQUESTMANAGER450Lib.CareCreditRequestManager careCreditRequestManagerEx;
    CARECREDITREQUESTMANAGER450Lib.CareCreditResult careCreditResultEx;

    try
    {
        bool bStatus;
        // ### init variables
        string strFrom = "2001001302112";
        string strVia = "2001000012345";
        string strTo = "2034567890000";
        DateTime dBirthdate = DateTime.ParseExact("1944-02-28", "yyyy-MM-dd", 
                                                  System.Globalization.CultureInfo.InvariantCulture);
        SexType eSex = SexType.enMale;
        CantonType eCanton = CantonType.enBS;
        LawType eLaw = LawType.enKVG;
        TreatmentType eTreatType = TreatmentType.enAmbulatory;
        DateTime dTreatmentStart = DateTime.ParseExact("2019-03-01", "yyyy-MM-dd", 
                                                       System.Globalization.CultureInfo.InvariantCulture);
        DateTime dTreatmentEnd = DateTime.ParseExact("2019-08-29", "yyyy-MM-dd", 
                                                     System.Globalization.CultureInfo.InvariantCulture);
        string strPatientInsID = "123.45.678-012";
        TreatmentReasonType eTreatmentReason = TreatmentReasonType.enDisease;
        TreatmentType eTreatmentType = TreatmentType.enAmbulatory;
        string strEanProvider = "2034567890111";
        string strEanResponsible = "2034567890333";

        // ### create the main CareCreditRequestManager interface
        careCreditRequestManagerEx = new CareCreditRequestManager();
		careCreditRequestManagerEx.SetModuleLanguage(LanguageType.enGerman);

        // ### generate the dependent CareCreditRequest interface (allows to input data)
        careCreditRequestEx = careCreditRequestManagerEx.CareCreditRequest;

        // ### start the input of data
        careCreditRequestEx.Initialize(LanguageType.enGerman);
        careCreditRequestEx.SetRequest(YesNoType.enNo,YesNoType.enNo,OrdinanceType.enFirstOrdinance,"");

        // ### generate some routing/transport  as well as some identifying data (required for XML only)
        bStatus = careCreditRequestEx.SetTransport(strFrom, "", "", strVia, strTo, "");
        bStatus = careCreditRequestEx.SetPackage("CareCreditRequestExample", 10001, 4, "sumex1");

        // ###############################################################################
        // ### start with nursing care relevant data, followed by the various address data
        // ###############################################################################
        // ### set data triple of the credit object (required)
        bStatus = careCreditRequestEx.SetCreditObject("SpitexID20190612", dTreatmentStart, 0);

        // ### set the applicable law (required)
        bStatus = careCreditRequestEx.SetLaw(LawType.enKVG, DateTime.MinValue, "", strPatientInsID);

        // ### create an address interface that is need to add all the following addresses
        // ### do not forget to initialize the IAddress interface befor using it
        addressEx = careCreditRequestEx.CreateAddress;

        // ### define the biller of the nursing care credit (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.SetFax("956 99 10", "061", "+41", "");
        bStatus = addressEx.SetOnline("info@biller.ch", "");
        bStatus = careCreditRequestEx.SetBiller("2011234567890", "H-1211-11", "", "", addressEx);

        // ### define the provider of the nursing care data (required)
        // ### note that only the required parts are defined here
        addressEx.Initialize();
        bStatus = addressEx.SetCompany("Spitex", "Region Liestal", "");
        bStatus = addressEx.SetPostal("Spitexgasse 17b5", "", "4410", "Liestal", "", "");
        bStatus = careCreditRequestEx.SetProvider(strEanProvider, "", "", "", addressEx);

        // ### define the health insurance (required)
        addressEx.Initialize();
        bStatus = addressEx.SetCompany("Krankenkasse AG", "Sektion Basel", "");
        bStatus = addressEx.SetPostal("Kassengraben 222", "", "4000", "Basel", "", "");
        bStatus = careCreditRequestEx.SetInsurance("2034567890222", addressEx);

        // ### define the patient (required)
        // ### note that more data are needed here (sex, birthdate,ssn) as well as insurance card data
        addressEx.Initialize();
        bStatus = addressEx.SetPerson("Muster", "Peter", "Herr", "", "c/o Mieter Karl");
        bStatus = addressEx.SetPostal("Musterstrasse 5", "", "7304", "Maienfeld", "", "");
        bStatus = careCreditRequestEx.SetPatient(eSex, dBirthdate, "756.1234.5678.90", 
		                                         DisabilityAllowanceType.enDisabilityNone,
		                                         IncontinenceDegreeType.enIncontinenceNone, addressEx);
        bStatus = careCreditRequestEx.SetCard("12345678901234567890", DateTime.ParseExact("2019-12-31", 
                                                  "yyyy-MM-dd", 
                                                  System.Globalization.CultureInfo.InvariantCulture), 
                                                  DateTime.ParseExact("2019-02-01", "yyyy-MM-dd", 
                                                  System.Globalization.CultureInfo.InvariantCulture), 
                                                  "", "");

        // ### define a referrer if any (optional)
        addressEx.Initialize();
        bStatus = addressEx.SetPerson("Ueberweiser", "Herbert", "Herr", "Dr. med.", "Allgemeinmedizin FMH");
        bStatus = addressEx.SetPostal("Referrerstrasse 11", "", "5000", "Aarau", "", "");
        bStatus = careCreditRequestEx.SetReferrer("2034567890333", "R-2345-67", "", "", addressEx);

        // ###############################################################################
        // ### define some treatment data for an ambulatory case and supply some nursing
        // ### care data
        // ###############################################################################
        // ### set treatment information (required)
        bStatus = careCreditRequestEx.SetTreatment(dTreatmentStart, dTreatmentEnd,  
                                                   eCanton, eTreatmentType, eTreatmentReason, 
                                                   TiersModeType.enTiersPayant);

        // ### set the data for a home care case ("Spitex") (required)
        int lDomesticAidDaysPerWeek = 1;
        int lDomesticAidHoursPerDay = 3;
		
        bStatus = careCreditRequestEx.SetHomeCare("RAI-HC 2018", YesNoType.enNo,  
                                                   lDomesticAidDaysPerWeek, lDomesticAidHoursPerDay, 
                                                   YesNoType.enYes);

        // ### add planning records and one extra service record
        bStatus = careCreditRequestEx.AddPlanningRecord("RAI-HC","10907",
                                            "Konsultation Arzt - Spitex zur Bedarfsabklärung",
                                            1.0, "e", 1.0, 11.0, 0, 0.0, 0.0, "",
                                            "532", "53201", 
                                            "Massnahmen der Abklärung, Beratung und Koordination, pro 1 Min.",
                                            11.0, 1.33, 1.0, 1.0);

        bStatus = careCreditRequestEx.AddPlanningRecord("RAI-HC","10115","Kompressionsstrümpfe/-verband",
                                            2.0, "t7", 182.0, 10.0, 0, 0.0, 0.0, "",
                                            "532", "53203", "Massnahmen der Grundpflege, pro 1 Min.",
                                            3640.0, 0.91, 1.0, 1.0);

        bStatus = careCreditRequestEx.AddPlanningRecord("RAI-HC","10802","Blutdruckmessung",
                                            2.0, "w", 26.0, 5.0, 0, 0.0, 0.0, "",
                                            "532", "53202", 
                                            "Massnahmen der Untersuchung und der Behandlung, pro 1 Min.",
                                            260.0, 1.09, 1.0, 1.0);

        bStatus = careCreditRequestEx.AddPlanningRecord("RAI-HC","10601","Medikamente richten",
                                            1.0, "w", 26.0, 10.0, 0, 0.0, 0.0, "",
                                            "532", "53202", 
                                            "Massnahmen der Untersuchung und der Behandlung, pro 1 Min.",
                                            260.0, 1.09, 1.0, 1.0);

        bStatus = careCreditRequestEx.AddService("452", "15.01.01.00.1", "Material für mittlere Inkontinenz",
                                            0.498630, 624.0, 1.0, "");


        // ### finalize the input
        bStatus = careCreditRequestEx.Finalize();

        // ### finally produce the XML infoset
        // ### note that the interface careCreditResultEx is returned by the method
        // ### if the call was successful - it must not be created! 
        int lGenerationAttribute = 0;
        int lValidationError;
        int lTimestamp = 0;

        string strXMLFile;
        string strUsedXSDSchema;
        bStatus = careCreditRequestManagerEx.GetXML(lGenerationAttribute, out strXMLFile, 
                                                        out lValidationError, out lTimestamp,
                                                        out strUsedXSDSchema, out careCreditResultEx);
														
        // ### copy the XML infoset away
        string strTargetFile = "CareCreditRequestExample.xml";
        System.IO.File.Copy(strXMLFile, strTargetFile);
    }
    catch (Exception ex)
    {
        MessageBox.Show("Opps! Error " + ex.ToString(), "OK");
    }

    finally
    {
        // ### relase all resources
        serviceInputEx = null;
        addressEx = null;
        careCreditResultEx = null;
        careCreditRequestEx = null;
        careCreditRequestManagerEx = null;

    }
}