Browse Source

修复报表数据溢出问题

hsh 2 năm trước cách đây
mục cha
commit
e27ebeabf0

+ 64 - 64
src/main/java/thyyxxk/webserver/dao/his/ybkf/YbStatDao.java

@@ -23,18 +23,18 @@ public interface YbStatDao {
     @Select("<script>" +
             "select psnCount=count(distinct a.setl_id), " +
             "inDays=sum(datediff(day, zy.admiss_date, zy.dis_date)), " +
-            "avgInDays=cast(round(sum(datediff(day, zy.admiss_date, zy.dis_date))/cast(count(distinct a.setl_id) as decimal(10,2)),2) as decimal(10,2)), " +
-            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(10,2)), " +
-            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(10,2)), " +
-            "acctPay=cast(round(sum(a.acct_pay),2) as decimal(10,2)), " +
-            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(10,2)), " +
-            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(10,2)), " +
-            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(10,2)), " +
-            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(10,2)), " +
-            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(10,2)), " +
-            "drugFeeRatio=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0))/sum(a.medfee_sumamt)*100,2) as decimal(10,2)), " +
-            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(10,2)), " +
-            "matFeeRatio=cast(round(sum(a.charge_sanitary_material)/sum(a.medfee_sumamt)*100,2) as decimal(10,2)) " +
+            "avgInDays=cast(round(sum(datediff(day, zy.admiss_date, zy.dis_date))/cast(count(distinct a.setl_id) as decimal(12,2)),2) as decimal(12,2)), " +
+            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(12,2)), " +
+            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(12,2)), " +
+            "acctPay=cast(round(sum(a.acct_pay),2) as decimal(12,2)), " +
+            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(12,2)), " +
+            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(12,2)), " +
+            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(12,2)), " +
+            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(12,2)), " +
+            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(12,2)), " +
+            "drugFeeRatio=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0))/sum(a.medfee_sumamt)*100,2) as decimal(12,2)), " +
+            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(12,2)), " +
+            "matFeeRatio=cast(round(sum(a.charge_sanitary_material)/sum(a.medfee_sumamt)*100,2) as decimal(12,2)) " +
             "from t_si_setlinfo a " +
             "left join zy_inactpatient zy on (zy.inpatient_no = a.pat_no and zy.admiss_times = a.times) " +
             "where a.revoked=0 and a.setl_type=#{setlType} and a.setl_time&gt;=#{beginTime} and a.setl_time&lt;=#{endTime} " +
@@ -64,18 +64,18 @@ public interface YbStatDao {
     @Select("<script>" +
             "select psnCount=count(distinct a.setl_id), " +
             "inDays=sum(datediff(day, zy.admiss_date, zy.dis_date)), " +
-            "avgInDays=cast(round(sum(datediff(day, zy.admiss_date, zy.dis_date))/cast(count(distinct a.setl_id) as decimal(10,2)),2) as decimal(10,2)), " +
-            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(10,2)), " +
-            "acctPay=cast(round(sum(a.acct_pay),2) as decimal(10,2)), " +
-            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(10,2)), " +
-            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(10,2)), " +
-            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(10,2)), " +
-            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(10,2)), " +
-            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(10,2)), " +
-            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(10,2)), " +
-            "drugFeeRatio=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0))/sum(a.medfee_sumamt)*100,2) as decimal(10,2)), " +
-            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(10,2)), " +
-            "matFeeRatio=cast(round(sum(a.charge_sanitary_material)/sum(a.medfee_sumamt)*100,2) as decimal(10,2)) " +
+            "avgInDays=cast(round(sum(datediff(day, zy.admiss_date, zy.dis_date))/cast(count(distinct a.setl_id) as decimal(12,2)),2) as decimal(12,2)), " +
+            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(12,2)), " +
+            "acctPay=cast(round(sum(a.acct_pay),2) as decimal(12,2)), " +
+            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(12,2)), " +
+            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(12,2)), " +
+            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(12,2)), " +
+            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(12,2)), " +
+            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(12,2)), " +
+            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(12,2)), " +
+            "drugFeeRatio=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0))/sum(a.medfee_sumamt)*100,2) as decimal(12,2)), " +
+            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(12,2)), " +
+            "matFeeRatio=cast(round(sum(a.charge_sanitary_material)/sum(a.medfee_sumamt)*100,2) as decimal(12,2)) " +
             "from t_si_setlinfo a " +
             "left join zy_inactpatient zy on (zy.inpatient_no = a.pat_no and zy.admiss_times = a.times) " +
             "where a.revoked=0 and a.setl_type=#{setlType} and a.setl_time&gt;=#{beginTime} and a.setl_time&lt;=#{endTime} " +
@@ -86,18 +86,18 @@ public interface YbStatDao {
     @Select("<script>" +
             "select psnCount=count(distinct a.setl_id), " +
             "inDays=sum(datediff(day, zy.admiss_date, zy.dis_date)), " +
-            "avgInDays=cast(round(sum(datediff(day, zy.admiss_date, zy.dis_date))/cast(count(distinct a.setl_id) as decimal(10,2)),2) as decimal(10,2)), " +
-            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(10,2)), " +
-            "acctPay=cast(round(sum(a.acct_pay),2) as decimal(10,2)), " +
-            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(10,2)), " +
-            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(10,2)), " +
-            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(10,2)), " +
-            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(10,2)), " +
-            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(10,2)), " +
-            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(10,2)), " +
-            "drugFeeRatio=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0))/sum(a.medfee_sumamt)*100,2) as decimal(10,2)), " +
-            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(10,2)), " +
-            "matFeeRatio=cast(round(sum(a.charge_sanitary_material)/sum(a.medfee_sumamt)*100,2) as decimal(10,2)) " +
+            "avgInDays=cast(round(sum(datediff(day, zy.admiss_date, zy.dis_date))/cast(count(distinct a.setl_id) as decimal(12,2)),2) as decimal(12,2)), " +
+            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(12,2)), " +
+            "acctPay=cast(round(sum(a.acct_pay),2) as decimal(12,2)), " +
+            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(12,2)), " +
+            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(12,2)), " +
+            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(12,2)), " +
+            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(12,2)), " +
+            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(12,2)), " +
+            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(12,2)), " +
+            "drugFeeRatio=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0))/sum(a.medfee_sumamt)*100,2) as decimal(12,2)), " +
+            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(12,2)), " +
+            "matFeeRatio=cast(round(sum(a.charge_sanitary_material)/sum(a.medfee_sumamt)*100,2) as decimal(12,2)) " +
             "from t_si_setlinfo a " +
             "left join zy_inactpatient zy on (zy.inpatient_no = a.pat_no and zy.admiss_times = a.times) " +
             "where a.revoked=0 and a.setl_type=#{setlType} and a.setl_time&gt;=#{beginTime} and a.setl_time&lt;=#{endTime} " +
@@ -108,18 +108,18 @@ public interface YbStatDao {
     @Select("<script>" +
             "select psnCount=count(distinct a.setl_id), " +
             "inDays=sum(datediff(day, zy.admiss_date, zy.dis_date)), " +
-            "avgInDays=cast(round(sum(datediff(day, zy.admiss_date, zy.dis_date))/cast(count(distinct a.setl_id) as decimal(10,2)),2) as decimal(10,2)), " +
-            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(10,2)), " +
-            "acctPay=cast(round(sum(a.acct_pay),2) as decimal(10,2)), " +
-            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(10,2)), " +
-            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(10,2)), " +
-            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(10,2)), " +
-            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(10,2)), " +
-            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(10,2)), " +
-            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(10,2)), " +
-            "drugFeeRatio=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0))/sum(a.medfee_sumamt)*100,2) as decimal(10,2)), " +
-            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(10,2)), " +
-            "matFeeRatio=cast(round(sum(a.charge_sanitary_material)/sum(a.medfee_sumamt)*100,2) as decimal(10,2)) " +
+            "avgInDays=cast(round(sum(datediff(day, zy.admiss_date, zy.dis_date))/cast(count(distinct a.setl_id) as decimal(12,2)),2) as decimal(12,2)), " +
+            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(12,2)), " +
+            "acctPay=cast(round(sum(a.acct_pay),2) as decimal(12,2)), " +
+            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(12,2)), " +
+            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(12,2)), " +
+            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(12,2)), " +
+            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(12,2)), " +
+            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(12,2)), " +
+            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(12,2)), " +
+            "drugFeeRatio=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0))/sum(a.medfee_sumamt)*100,2) as decimal(12,2)), " +
+            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(12,2)), " +
+            "matFeeRatio=cast(round(sum(a.charge_sanitary_material)/sum(a.medfee_sumamt)*100,2) as decimal(12,2)) " +
             "from t_si_setlinfo a " +
             "left join zy_inactpatient zy on (zy.inpatient_no = a.pat_no and zy.admiss_times = a.times) " +
             "where a.revoked=0 and a.setl_type=#{setlType} and a.setl_time&gt;=#{beginTime} and a.setl_time&lt;=#{endTime} " +
@@ -129,10 +129,10 @@ public interface YbStatDao {
 
     @Select("<script>" +
             "select yf=convert(varchar(7), a.setl_time, 120), " +
-            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(10,2)), " +
-            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(10,2)), " +
-            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(10,2)), " +
-            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(10,2)) " +
+            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(12,2)), " +
+            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(12,2)), " +
+            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(12,2)), " +
+            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(12,2)) " +
             "from t_si_setlinfo a " +
             "left join zy_inactpatient zy on (zy.inpatient_no = a.pat_no and zy.admiss_times = a.times) " +
             "where a.revoked=0 and a.setl_type=#{setlType} and a.setl_time&gt;=#{beginTime} and a.setl_time&lt;=#{endTime} " +
@@ -141,10 +141,10 @@ public interface YbStatDao {
     List<YbStatResult> selectYbStatRatio(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("setlType") String setlType);
 
     @Select("<script>" +
-            "select totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(10,2)), " +
-            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(10,2)), " +
-            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(10,2)), " +
-            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(10,2)) " +
+            "select totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(12,2)), " +
+            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(12,2)), " +
+            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(12,2)), " +
+            "matFee=cast(round(sum(a.charge_sanitary_material),2) as decimal(12,2)) " +
             "from t_si_setlinfo a " +
             "left join zy_inactpatient zy on (zy.inpatient_no = a.pat_no and zy.admiss_times = a.times) " +
             "where a.revoked=0 and a.setl_type=#{setlType} and a.setl_time&gt;=#{beginTime} and a.setl_time&lt;=#{endTime} " +
@@ -236,14 +236,14 @@ public interface YbStatDao {
             "select yf=convert(varchar(7), a.setl_time, 120), a.medins_type, " +
             "psnCount=count(distinct a.setl_id), " +
             "inDays=sum(datediff(day, zy.admiss_date, zy.dis_date)), " +
-            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(10,2)), " +
-            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(10,2)), " +
-            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(10,2)), " +
-            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(10,2)), " +
-            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(10,2)), " +
-            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(10,2)), " +
-            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(10,2)), " +
-            "matFee=cast(round(isnull(sum(a.charge_sanitary_material),0),2) as decimal(10,2)) " +
+            "totalFee=cast(round(sum(a.medfee_sumamt),2) as decimal(12,2)), " +
+            "fundPooling=cast(round(sum(a.hifp_pay),2) as decimal(12,2)), " +
+            "bigIllFundPooling=cast(round(sum(a.hifmi_pay),2) as decimal(12,2)), " +
+            "civilServiceFund=cast(round(sum(a.cvlserv_pay),2) as decimal(12,2)), " +
+            "otherFunds=cast(round(sum(isnull(a.fund_pay_sumamt,0)-isnull(a.hifp_pay,0)-isnull(a.cvlserv_pay,0)-isnull(a.hifmi_pay,0)-isnull(a.maf_pay,0)-isnull(a.hifob_pay,0)-isnull(a.hifes_pay,0)),2) as decimal(12,2)), " +
+            "allFunds=cast(round(sum(a.fund_pay_sumamt),2) as decimal(12,2)), " +
+            "drugFee=cast(round(sum(isnull(a.charge_western_medicine,0) + isnull(a.charge_patent_medicine,0) + isnull(a.charge_herbal,0)),2) as decimal(12,2)), " +
+            "matFee=cast(round(isnull(sum(a.charge_sanitary_material),0),2) as decimal(12,2)) " +
             "from t_si_setlinfo a " +
             "left join zy_inactpatient zy on (zy.inpatient_no = a.pat_no and zy.admiss_times = a.times) " +
             "where a.revoked=0 and a.setl_type=#{setlType} and a.setl_time&gt;=#{beginTime} and a.setl_time&lt;=#{endTime} " +

+ 5 - 1
src/main/java/thyyxxk/webserver/service/ybkf/YbStatService.java

@@ -613,11 +613,15 @@ public class YbStatService {
                 int s = i-1;
                 if(i < 10){
                     yf1 = year + "-0"+ i;
-                    yf2 = year + "-0"+ s;
                 } else {
                     yf1 = year + "-" + i;
+                }
+                if(s < 10){
+                    yf2 = year + "-0"+ s;
+                } else {
                     yf2 = year + "-"+ s;
                 }
+
                 YbStatResult r1 = mapYf1.get(yf1);
                 if(i == m){
                     if(!ObjectUtils.isEmpty(r1) && Double.parseDouble(r1.getTotalFee()) > 0){