Select hosppatinfo2.patientname patientname,
hosppatinfo2.HospCode hospcode,
hosppatinfo2.subtime subtime,
hosppatinfo2.subsum subsum,
hosppatinfo2.grandprice - hosppatinfo2.selffee infee,
hosppatinfo2.civilfee civilfee,
hosppatinfo2.homeaddr homeaddr,
right(hosppatinfo2.medinumb1,10) medinumb1,
c_nature.nature nature,
c_nature.natureid natureid,
'100%' as bl,
hosppatinfo2.patsort patsort,
hosppatinfo2.hospitalcode hospitalcode,
hosppatinfo2.hospresu hospresu,
hosppatinfo2.hospdate hospdate,
DateDiff(day,hosppatinfo2.hospdate,hosppatinfo2.outdate) hospday,
hosppatinfo2.grandprice grandprice,
hosppatinfo2.grandprice - hosppatinfo2.selffee kpfee,
hosppatinfo2.paysum paysum,
hosp_check_info.addfee4 addfee4,
Case When prechktime Is Null Then chkinittime Else prechktime End paytime
From accountinfo,hosppatinfo2,areaorgancode,hosp_check_info,n_individdata,c_nature
Where bill = :as_bill
And accountinfo.hospitalcode = hosppatinfo2.hospitalcode
And accountinfo.hospid = hosppatinfo2.hospid
And accountinfo.hospitalcode = hosp_check_info.hospitalcode
And accountinfo.hospid = hosp_check_info.hospid
And accountinfo.hospitalcode = areaorgancode.orgcode
And hosppatinfo2.civilfee>0
And hosppatinfo2.MEDINUMB=n_individdata.familyno
And hosppatinfo2.PATIENTID=n_individdata.memberno
And convert(varchar(4),hosppatinfo2.nopaydate,112)=n_individdata.statisticyear
And n_individdata.civiltype=c_nature.natureid |