VB给 DelPhi7 动态库的结构体数组传值

TKH = array[0..17] of char;
Cinteger = array[0..9] of char;
Creal = array[0..11] of char;

TsfCsingle = record
Jylb: Cinteger; //就医类别
Zybh: Cinteger; //住院编号
sflb: Cinteger; //收费类别
ypbm: array[0..19] of char; //药品编码
sl: Cinteger; //数量
fy: Creal; //费用
zzys_id: Cinteger; //主治医生编码
jyks_id: Cinteger; //就医科室编码
ypmc: array[0..29] of char; //药品名称
gg: array[0..19] of char; //规格
dw: array[0..19] of char; //单位
dj: Creal; //单价]
zgjg: Creal;
jysj: array[0..18] of char;
end;

  ToutputC = record
zybh: Cinteger; //住院编号
fybh: Cinteger; //费用编号
ylf: Creal; //医疗费
zfyfy: Creal; //自费药费用
grzhzf: Creal; //个人帐户支付
ickf: Creal; //IC卡付
tcjjzf: Creal; //统筹基金支付
wqzzf: Creal; //起付内支付
tczzf: Creal; //统筹中支付
gxeylf: Creal; //过限额医疗费
xjzf: Creal; //总现金支付

end;

以上代码是DelPhi7 中定义的动态数组

其提供一个函数如下
int Mzsfgl(int lb,Tsf* sf,Toutput* output);stdcall;
我在VB中这样调用
Public Declare Function mzsfglc Lib "yyjk.dll" (ByRef Lb As String, tsf() As tsf, ByRef Toutput As Toutput) As Long '门诊消费

'定义收费结构体
Public Type tsf
cintJylb As String '※就医类别:1-医疗保险;2-养老保险;3-失业保险;4-工伤保险;5-生育保险;6-居民保险
cIntZybh As String '※住院编号:0-门诊,住院时调用zydj()通过output的zybh字段传入HIS
cintSflb As String '※收费类别
strYpbm As String '※药品编码:医保接口提供的交换表ydk.dbf和czk.dbf获得
cintSl As String '※数量
cfloatFy As String '※费用
cintZzysid As String '※主治医生编码:医保接口提供的交换表ys.dbf获得
cintJyksid As String '※就医科室编码:医保接口提供的交换表ks.dbf获得
strYpmc As String '药品名称
strYpgg As String '药品规格
strJldw As String '※剂量单位
cintYpdj As String '※单价
cintZgjg As String '最高价格
End Type
Public Sf() As tsf

'定义结算信息结构体
Public Type Toutput
cIntZybh As String '住院编号
cIntFybh As String '费用编号
cFloatYlf As String '医疗费
cFloatZfyfy As String '自费药费用
cFloatGrzhzf As String '个人帐户支付
cFloatIckf As String 'IC卡付
cFloatTcjjzf As String '统筹基金支付
cFloatWqzzf As String '起付内支付
cFloatTczzf As String '统筹中支付
cFloatGxeylf As String '过限额医疗费
cFloatXjzf As String '总现金支付
cFloatIckye As String 'IC卡余额
cFloatYlyf As String '乙类药
cFloatZfyf As String '丙类药
cFloatZfcz As String '丙类处置
cFloatYlcz As String '乙类处置
cFloatCxjfy As String '超限价药费
strWmc As String '单位名称
cintBxlb As String '保险类别
End Type
Public Output As Toutput

调用处代码:

    For i = 0 To rs明细.RecordCount - 1
        '验证是否对码
        gstrSQL = "SELECT A.ID As 收费细目ID,A.编码 As HIS编码,A.名称 As HIS名称,A.规格 As HIS规格," & vbNewLine & _
            "       B.项目编码 As YB编码,B.项目名称 As YB名称,C.编码 As YB大类编码" & vbNewLine & _
            "FROM 收费细目 A, 保险支付项目 B,保险支付大类 C" & vbNewLine & _
            "Where A.ID = B.收费细目ID(+) And B.大类ID=C.ID(+) And B.险类=C.险类(+)" & vbNewLine & _
            "      And A.ID=[1] And B.险类(+)=[2]"
        Set rsTmp = zlDatabase.OpenSQLRecord(gstrSQL, "", Val(rs明细!收费细目ID), intInsure)
        If ChkRsState(rsTmp) = True Then
            If Nvl(rsTmp!YB大类编码) = "" Then
                MsgBox "HIS编码:" & rsTmp!HIS编码 & vbCrLf & _
                    "HIS名称:" & rsTmp!HIS名称 & vbCrLf & _
                    "HIS规格:" & Nvl(rsTmp!HIS规格) & vbCrLf & _
                    "未对码,不能进行预结算!", vbCritical, gstrSysName
                Exit Function
            End If
        End If
        '组织上传数据
        gstrSQL = " Select 1 Jylb, 0 Zybh, c.大类编码 Sflb, c.编码 Ypbm, a.数次 * a.付数 Sl, 应收金额 Fy, d.Id Zzysid, 开单部门id Jyksid, " & vbNewLine & _
                         " c.名称 Ypmc, e.规格 Gg, a.计算单位 Dw, 标准单价 Dj, 0 zgjg " & vbNewLine & _
                  " From 门诊费用记录 a, 保险支付项目 b, 保险项目 c, 人员表 d, 收费项目目录 e " & vbNewLine & _
                  " Where  a.收费细目id = b.收费细目id And b.项目编码 = c.编码 And a.收费细目id = e.Id And " & vbNewLine & _
                        " a.开单人 = d.姓名 And a.No=[1] and a.序号=[2]"
        Set rsTmp = zlDatabase.OpenSQLRecord(gstrSQL, "", rs明细!NO, rs明细!序号)
        '暂存明细信息
        ''strZint strZfloat strFint strFfloat
        If Not ChkRsState(rsTmp) Then
            Sf(i).cintJylb = mFormat(rsTmp!Jylb, strZint)
            Sf(i).cIntZybh = mFormat(rsTmp!zybh, strZint)
            Sf(i).cintSflb = mFormat(rsTmp!Sflb, strZint)
            Sf(i).strYpbm = rsTmp!Ypbm
            Sf(i).cintSl = mFormat(rsTmp!Sl, strZint)
            Sf(i).cfloatFy = mFormat(rsTmp!Fy, strZfloat)
            Sf(i).cintZzysid = mFormat(rsTmp!Zzysid, strZint)
            Sf(i).cintJyksid = mFormat(rsTmp!Jyksid, strZint)
            Sf(i).strYpmc = rsTmp!Ypmc
            Sf(i).strYpgg = Nvl(rsTmp!Gg, "")
            Sf(i).strJldw = rsTmp!Dw
            Sf(i).cintYpdj = mFormat(rsTmp!Dj, strZint)
            Sf(i).cintZgjg = mFormat(rsTmp!Zgjg, strZint)
        End If
        rs明细.MoveNext
    Next i

If mzsfglc(Lb, Sf(), Output) = 1 Then
        With g结算数据
                        '获取结算数据
                        .发生费用金额 = Val(Output.cFloatYlf)
                        .全自费金额 = Val(Output.cFloatZfyfy)
                        .统筹报销金额 = Val(Output.cFloatTcjjzf)
                        .个人帐户支付 = Val(Output.cFloatGrzhzf)
                        .支付顺序号 = Output.cIntFybh
                        .医疗类别 = Val(Output.cintBxlb)
                        .就诊流水号 = Output.cIntZybh

                        dbl医保基金 = .统筹报销金额
                        dbl个人帐户 = .个人帐户支付
                        str结算方式 = "医保基金;" & dbl医保基金 & ";0" & _
                                                "|个人帐户;" & dbl个人帐户 & ";0"

                End With
end if
-----------调用结束------------
大体的调用方法就是上面这些,现在的问题是调用Delphi7 提供的函数后,对方好像未能获取到我传入的数据,是否是tsf 这个结构体里面的字段定义的有问题,求助大神!
若能解决问题,可有酬劳答谢

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问