瀏覽代碼

添加合计的功能

xiaochan 4 年之前
父節點
當前提交
148fc4f7d3

+ 13 - 3
src/main/java/thyyxxk/webserver/dao/his/yibao/TransferInOfExpensesDao.java

@@ -72,15 +72,15 @@ public interface TransferInOfExpensesDao {
             "zy_serial_no " +
             "from zy_detail_charge a,zd_charge_item b  where (code=charge_code) and order_no=6 and inpatient_no = #{inpatientNo} " +
             "<if test=\"chargeCodeMX!=null and chargeCodeMX!=''\"> " +
-            "and charge_code_mx = #{chargeCodeMX} " +
+            "and (charge_code_mx = #{chargeCodeMX} or charge_code = #{chargeCodeMX}) " +
             "</if> " +
             "union " +
             "select rtrim(inpatient_no)inpatient_no,admiss_times,detail_sn,ledger_sn, " +
             "charge_date,charge_code,charge_fee,a.charge_amount,charge_code_mx,(b.name)charge_code_name, " +
             "zy_serial_no " +
-            "from zy_detail_charge a,yp_zd_dict b where (code=charge_code) and  order_no=6 and inpatient_no = #{inpatientNo} " +
+            "from zy_detail_charge a,yp_zd_dict b where (code=charge_code) and order_no=6 and inpatient_no = #{inpatientNo} " +
             "<if test=\"chargeCodeMX!=null and chargeCodeMX!=''\"> " +
-            "and charge_code_mx = #{chargeCodeMX} " +
+            "and (charge_code_mx = #{chargeCodeMX} or charge_code = #{chargeCodeMX}) " +
             "</if>" +
             ") temp" +
             "</script> ")
@@ -88,6 +88,16 @@ public interface TransferInOfExpensesDao {
                                                        @Param("inpatientNo") String inpatientNo,
                                                        @Param("chargeCodeMX") String chargeCodeMX);
 
+    @Select("<script>" +
+            "select charge_fee,charge_amount " +
+            "from zy_detail_charge a  where  order_no=6 and inpatient_no = #{inpatientNo} " +
+            "<if test=\"chargeCodeMX!=null and chargeCodeMX!=''\"> " +
+            "and (charge_code_mx = #{chargeCodeMX} or charge_code = #{chargeCodeMX}) " +
+            "</if> " +
+            "</script>")
+    List<ZyDetailCharge> sumZyFee(@Param("inpatientNo") String inpatientNo,
+                                  @Param("chargeCodeMX") String chargeCodeMX);
+
     /**
      * 删除病人通过急门诊转入的费用 数据
      *

+ 8 - 0
src/main/java/thyyxxk/webserver/service/yibao/TransferInOfExpensesService.java

@@ -18,6 +18,7 @@ import thyyxxk.webserver.entity.yibao.ZyActpatient;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.TokenUtil;
 
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -90,10 +91,17 @@ public class TransferInOfExpensesService {
         log.info("查看患者是通过门急诊转入的费用项目 --> 住院号:{},收费编码:{},当前页:{},页数:{}", inpatientNo, chargeCodeMX, currentPage, pageSize);
         IPage<ZyDetailCharge> page = new Page<>(currentPage, pageSize);
         List<ZyDetailCharge> list = dao.getZyJiMenZhenZhuangRuFeiYong(page, inpatientNo, chargeCodeMX);
+        List<ZyDetailCharge> sumList = dao.sumZyFee(inpatientNo, chargeCodeMX);
         Map<String, Object> map = new HashMap<>(Capacity.TWO);
         if (page.getTotal() > 0 || list.size() > 0) {
+            double sum = 0;
+            for (ZyDetailCharge zyDetailCharge : sumList) {
+                sum += BigDecimal.valueOf(zyDetailCharge.getChargeFee() * zyDetailCharge.getChargeAmount())
+                        .setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+            }
             map.put("data", list);
             map.put("total", page.getTotal());
+            map.put("sum", sum);
             return ResultVoUtil.success(map);
         }
         return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);