Hi Folks, I am hoping that someone can help me out here...
I was given this example code above from the company who puts out this API. As you can see, it looks like you have to create a ServiceLineReq item for each item you are passing in. The issue for us is that we do not know how many items we are passing in. So, I assumed that I could pass in an array of items ServiceLineReq(). So, I tried the following
The issue is that when I git svLineTemp(i).ServiceStartDate it always says the Index was outside the bounds of the array. How can I loop through and add items to the array and then return the whole array?
VB.NET:
// Create the service lines for this encounter
ServiceLineReq serviceLine1 = new ServiceLineReq();
serviceLine1.ServiceStartDate = DateTime.Today.AddDays(-1);
serviceLine1.ProcedureCode = "99201";
serviceLine1.DiagnosisCode1 = "600.00";
serviceLine1.Units = 1;
serviceLine1.UnitCharge = 3.4;
ServiceLineReq serviceLine2 = new ServiceLineReq();
serviceLine2.ServiceStartDate = DateTime.Today.AddDays(-1);
serviceLine2.ProcedureCode = "62311";
serviceLine2.DiagnosisCode1 = "495.4";
serviceLine2.Units = 2;
serviceLine2.UnitCharge = 6.5;
// Make sure you set the encounter's practice, service location, patient, case, and
// provider (and any other objects you create relating to the encounter)
newEncounter.Practice = practice;
newEncounter.ServiceLocation = location;
newEncounter.Patient = patient;
newEncounter.Case = encounterCase;
newEncounter.RenderingProvider = provider;
newEncounter.ServiceLines = new ServiceLineReq[] { serviceLine1, serviceLine2 };
I was given this example code above from the company who puts out this API. As you can see, it looks like you have to create a ServiceLineReq item for each item you are passing in. The issue for us is that we do not know how many items we are passing in. So, I assumed that I could pass in an array of items ServiceLineReq(). So, I tried the following
VB.NET:
Private Function ReturnServiceRequest(ByVal patientId As Integer, ByVal pnoteID As Integer, ByVal pt As nextEMRDataLayer.Patients, ByVal pnList As List(Of nextEMRDataLayer.progressNotes))
Dim svLineTemp() As ServiceLineReq = {}
Dim cptList As New List(Of nextEMRDataLayer.Patients)
Dim icd9List As New List(Of nextEMRDataLayer.Patients)
Dim svLineCtr As Integer
Dim billLineCtr As Integer
' get procedures associated with the pnote/encounter
cptList = pt.selectPatientProgressNoteCPTAndBilling(patientId, pnoteID)
If cptList.Count > 0 Then
svLineCtr = cptList.Count
'svLineTemp = New ServiceLineReq() {}
For i = 0 To cptList.Count - 1
Dim cmpDate As String = cptList(i).procedureDate.ToString
If cmpDate.StartsWith("1/1/0001") Then
svLineTemp(i).ServiceStartDate = pnList(0).dos.ToShortDateString
Else
svLineTemp(i).ServiceStartDate = cptList(i).procedureDate.ToString
End If
svLineTemp(i).ServiceStartDateSpecified = True
svLineTemp(i).ProcedureCode = cptList(i).cptCode
svLineTemp(i).UnitsSpecified = True
svLineTemp(i).Units = 1
svLineTemp(i).ServiceStartDate = svLineTemp(i).ServiceStartDate
icd9List = pt.selectPatientICD9ByProgressNote(patientId, pnoteID)
If icd9List.Count > 0 Then
For j = 0 To icd9List.Count - 1
If j = 0 Then
svLineTemp(i).DiagnosisCode1 = icd9List(j).icd9Code
End If
If j = 1 Then
svLineTemp(i).DiagnosisCode2 = icd9List(j).icd9Code
End If
If j = 2 Then
svLineTemp(i).DiagnosisCode3 = icd9List(j).icd9Code
End If
If j = 3 Then
svLineTemp(i).DiagnosisCode4 = icd9List(j).icd9Code
End If
Next
End If
Next
End If
Return svLineTemp
End Function
The issue is that when I git svLineTemp(i).ServiceStartDate it always says the Index was outside the bounds of the array. How can I loop through and add items to the array and then return the whole array?