Browse Source

门诊收入明细优化

hurugang 5 years ago
parent
commit
fe25906482

+ 23 - 0
src/main/java/cn/hnthyy/thmz/Utils/DateUtil.java

@@ -67,6 +67,29 @@ public class DateUtil {
         }
         return null;
     }
+    /**
+     * 获取昨天的0点0分0秒
+     * @return
+     */
+    public static Date getPrevDayFirstSecond(){
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY,0);
+        calendar.set(Calendar.MINUTE,0);
+        calendar.set(Calendar.SECOND,0);
+        calendar.add(Calendar.DAY_OF_YEAR,-1);
+        return calendar.getTime();
+    }
+    /**
+     * 获取当前日期的0点0分0秒
+     * @return
+     */
+    public static Date getFirstSecond(){
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY,0);
+        calendar.set(Calendar.MINUTE,0);
+        calendar.set(Calendar.SECOND,0);
+        return calendar.getTime();
+    }
 
     /**
      * 获取给定日期的0点0分0秒

+ 15 - 14
src/main/java/cn/hnthyy/thmz/Utils/ExcelUtil.java

@@ -2,6 +2,7 @@ package cn.hnthyy.thmz.Utils;
 
 import cn.hnthyy.thmz.entity.his.MzyReqrec;
 import cn.hnthyy.thmz.entity.his.ZdUnitCode;
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.vo.ChargeFeeVo;
 import cn.hnthyy.thmz.vo.MzyReqrecVo;
@@ -85,7 +86,7 @@ public class ExcelUtil {
      * @param response
      * @param thmzmxsrs
      */
-    public static void exportExcelForThmzmxsrs(HttpServletRequest request, HttpServletResponse response, List<Map<String, Object>> thmzmxsrs) {
+    public static void exportExcelForThmzmxsrs(HttpServletRequest request, HttpServletResponse response, List<Mzmxsr> thmzmxsrs) {
         Map<String, Object> data = fomartThmzmxsr(thmzmxsrs);
         exportExcel(request, response, data, YP_REPORT_COLUMNS_LENGTH,VERSION_2007);
     }
@@ -445,7 +446,7 @@ public class ExcelUtil {
      * @param thmzmxsrs
      * @return
      */
-    private static Map<String, Object> fomartThmzmxsr(List<Map<String, Object>> thmzmxsrs) {
+    private static Map<String, Object> fomartThmzmxsr(List<Mzmxsr> thmzmxsrs) {
         if (thmzmxsrs == null) {
             return Collections.emptyMap();
         }
@@ -462,19 +463,19 @@ public class ExcelUtil {
         List<String[]> arr = new ArrayList<>();
         thmzmxsrs.forEach(thmzmxsr -> {
             if (thmzmxsr != null) {
-                Double quty = (Double) thmzmxsr.get("quty");
-                BigDecimal price = (BigDecimal) thmzmxsr.get("price");
-                Double je = (Double) thmzmxsr.get("je");
-                Date chargeDate= (Date) thmzmxsr.get("charge_date");
-                String[] temp = {(String) thmzmxsr.get("xm"),
-                        (String) thmzmxsr.get("patient_id"),
+                Double quty = thmzmxsr.getQuty();
+                BigDecimal price = thmzmxsr.getPrice();
+                BigDecimal je = thmzmxsr.getJe();
+                Date chargeDate= thmzmxsr.getChargeDate();
+                String[] temp = {thmzmxsr.getXm(),
+                        thmzmxsr.getPatientId(),
                         DateFormatUtils.format(chargeDate, "yyyy-MM-dd HH:mm:ss"),
-                        (String) thmzmxsr.get("jz_sq_dept"),
-                        (String) thmzmxsr.get("jz_sq_doctor"),
-                        (String) thmzmxsr.get("exec_dept"),
-                        (String) thmzmxsr.get("xmm"),
-                        (String) thmzmxsr.get("hsm"),
-                        (String) thmzmxsr.get("parent_code"),
+                        thmzmxsr.getJzSqDept(),
+                        thmzmxsr.getJzSqDoctor(),
+                        thmzmxsr.getExecDept(),
+                        thmzmxsr.getXmm(),
+                        thmzmxsr.getHsm(),
+                        thmzmxsr.getParentCode(),
                         quty == null ? "0" : quty.toString(),
                         price == null ? "0.00" : price.toString(),
                         je == null ? "0.00" : je.toString()

+ 0 - 104
src/main/java/cn/hnthyy/thmz/common/ScheduledService.java

@@ -1,104 +0,0 @@
-package cn.hnthyy.thmz.common;
-
-import cn.hnthyy.thmz.service.his.ChargeFeeVoService;
-import cn.hnthyy.thmz.service.his.ZyDayclosingRecordService;
-import cn.hnthyy.thmz.service.thmz.TokenService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-
-/**
- * 定时任务类
- */
-@Slf4j
-//1.主要用于标记配置类,兼备Component的效果。
-@Configuration
-// 2.开启定时任务
-@EnableScheduling
-public class ScheduledService {
-    @Autowired
-    private TokenService tokenService;
-    @Autowired
-    private ChargeFeeVoService chargeFeeVoService;
-    @Autowired
-    private ZyDayclosingRecordService zyDayclosingRecordService;
-    /**
-     * 每20分钟执行一次
-     */
-    @Scheduled(cron = "0 0/20 * * * ?")
-    public void refreshTokenCache() {
-        tokenService.refreshTokenCache();
-    }
-
-
-
-//    /**
-//     * 每天凌晨零点五分运行一次
-//     */
-//    @Scheduled(cron = "5 0 0 * * *")
-//    public void scheduled() {
-//        process();
-//    }
-
-    /**
-     * 每天23时58分将自助收费做日结
-     */
-    @Scheduled(cron = "0 58 23 * * *")
-    public void scheduledFull() {
-        processZzRj();
-    }
-
-
-//
-//    /**
-//     * 处理入库数据
-//     *
-//     */
-//    private void process() {
-//        List<MzyRequest> requests = mzyRequestService.queryMzyRequestByRequestDay(DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
-//        //此时排班表数据没有同步过来,需要手动同步,以后排班系统重做后需要移除此功能
-//        if(requests==null || requests.size()==0){
-//            mzyRequestService.synchronizationRequest();
-//        }
-//    }
-
-
-
-    /**
-     * 定时处理自助缴费日结
-     *
-     */
-    private void processZzRj() {
-       try {
-           Integer count = chargeFeeVoService.queryCountCanDaily(Constants.BRZZJF_CODE);
-           if (count == null || count == 0) {
-               log.warn("99999 费用结算失败,无可结算费用");
-               return;
-           }
-           count = chargeFeeVoService.queryTFWDFPCount(Constants.BRZZJF_CODE);
-           if (count > 0) {
-               log.warn("99999 存在退费后发票未重打的发票信息,请 处理后再结账!");
-               return;
-           }
-           chargeFeeVoService.dcountCharge(Constants.BRZZJF_CODE);
-       }catch (Exception e){
-           log.error("门诊自助日结出错。");
-       }
-
-        try{
-            zyDayclosingRecordService.dayclosing();
-        }catch (Exception e){
-            log.error("住院自助日结出错。");
-        }
-    }
-
-
-
-
-
-
-
-
-}

+ 123 - 0
src/main/java/cn/hnthyy/thmz/common/scheduled/ProcessYpCountThread.java

@@ -0,0 +1,123 @@
+package cn.hnthyy.thmz.common.scheduled;
+
+
+import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
+import cn.hnthyy.thmz.enums.YesNoEnum;
+import cn.hnthyy.thmz.service.his.ChargeFeeVoService;
+import cn.hnthyy.thmz.service.thmz.MzmxsrService;
+import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
+import org.slf4j.Logger;
+
+import java.util.*;
+
+public class ProcessYpCountThread implements Runnable{
+    private ChargeFeeVoService chargeFeeVoService;
+    private MzmxsrService mzmxsrService;
+    private Integer year;
+    private Logger log=org.slf4j.LoggerFactory.getLogger(ProcessYpCountThread.class);
+    @Override
+    public void run() {
+        log.info("=====>>>>{}年任务启动成功", year);
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.YEAR, year);
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        Date beginTime = calendar.getTime();
+        Date now = DateUtil.getFirstSecond();
+        Date Today = DateUtil.pase("2020-06-22 00:00:00","yyyy-MM-dd HH:mm:ss");
+        if(year < 2020){
+            calendar.add(Calendar.YEAR, 1);
+            now=calendar.getTime();
+            calendar.add(Calendar.YEAR, -1);
+        }
+        while (beginTime.before(now)) {
+            calendar.add(Calendar.DAY_OF_YEAR, 1);
+            Date endTime = calendar.getTime();
+            try {
+                process(beginTime, endTime);
+            }catch (Exception e){
+                log.error("当前日期没有抓取 beginTime="+beginTime+"----endTime="+endTime);
+            }
+            log.info("=====>>>>>开始日期{},结束日期{}初始化统计完成", DateUtil.fomart(beginTime, "yyyy-MM-dd HH:mm:ss"), DateUtil.fomart(endTime, "yyyy-MM-dd HH:mm:ss"));
+            beginTime = endTime;
+            if(beginTime.equals(Today)){
+                break;
+            }
+        }
+        log.info("=====>>>>>全部初始化统计完成");
+    }
+
+    public ProcessYpCountThread(ChargeFeeVoService chargeFeeVoService,MzmxsrService mzmxsrService,Integer year){
+        this.chargeFeeVoService=chargeFeeVoService;
+        this.mzmxsrService=mzmxsrService;
+        this.year=year;
+    }
+
+
+
+
+    /**
+     * 处理入库数据
+     *
+     * @param beginTime 查询开始时间
+     * @param endTime   查询结束时间
+     */
+    private void process(Date beginTime, Date endTime) {
+        ThmzmxsrParamsVo thmzmxsrParamsVo = new ThmzmxsrParamsVo();
+        thmzmxsrParamsVo.setCaseType(YesNoEnum.NO.code.toString());
+        thmzmxsrParamsVo.setBeginDate(beginTime);
+        thmzmxsrParamsVo.setEndDate(endTime);
+        thmzmxsrParamsVo.setHisData(YesNoEnum.NO);
+        List<Mzmxsr> thmzmxsrs = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
+        thmzmxsrParamsVo.setHisData(YesNoEnum.YES);
+        List<Mzmxsr> thmzmxsrsHis = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
+        fomartThmzmxsr(thmzmxsrs, thmzmxsrsHis);
+        Date inputDate = new Date();
+        //批量导入入库方式
+        List<Mzmxsr> insertList = new ArrayList<>();
+        thmzmxsrs.forEach(mzmxsr -> {
+            mzmxsr.setInputDate(inputDate);
+            insertList.add(mzmxsr);
+            if (insertList.size() >= 50) {
+                try {
+                    mzmxsrService.batchSaveMzmxsr(insertList);
+                    insertList.clear();
+                } catch (Exception e) {
+                    log.error("统计门诊收入明细信息保存出错,参数列表长度{},错误信息:{}", thmzmxsrs.size(),e.getMessage());
+                }
+            }
+
+        });
+        if (insertList.size() > 0) {
+            try {
+                mzmxsrService.batchSaveMzmxsr(insertList);
+                insertList.clear();
+            } catch (Exception e) {
+                log.error("统计门诊收入明细信息保存出错,参数列表长度{},错误信息:{}", thmzmxsrs.size(),e.getMessage());
+            }
+        }
+    }
+
+    private void fomartThmzmxsr(List<Mzmxsr> thmzmxsrs, List<Mzmxsr> thmzmxsrsHis) {
+        Set<Date> repeatSet = new HashSet<>();
+        if (thmzmxsrs != null && thmzmxsrs.size() > 0) {
+            for (Mzmxsr mzmxsr : thmzmxsrs) {
+                repeatSet.add(mzmxsr.getDcountDate());
+            }
+        }
+        if (thmzmxsrsHis != null && thmzmxsrsHis.size() > 0) {
+            for (Mzmxsr mzmxsr : thmzmxsrsHis) {
+                if (repeatSet.contains(mzmxsr.getDcountDate())) {
+                    continue;
+                }
+                thmzmxsrs.add(mzmxsr);
+            }
+        }
+    }
+
+
+}

+ 195 - 0
src/main/java/cn/hnthyy/thmz/common/scheduled/ScheduledService.java

@@ -0,0 +1,195 @@
+package cn.hnthyy.thmz.common.scheduled;
+
+import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.common.Constants;
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
+import cn.hnthyy.thmz.enums.YesNoEnum;
+import cn.hnthyy.thmz.service.his.ChargeFeeVoService;
+import cn.hnthyy.thmz.service.his.ZyDayclosingRecordService;
+import cn.hnthyy.thmz.service.thmz.MzmxsrService;
+import cn.hnthyy.thmz.service.thmz.TokenService;
+import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+
+import java.util.*;
+
+/**
+ * 定时任务类
+ */
+@Slf4j
+//1.主要用于标记配置类,兼备Component的效果。
+@Configuration
+// 2.开启定时任务
+@EnableScheduling
+public class ScheduledService {
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private ChargeFeeVoService chargeFeeVoService;
+    @Autowired
+    private ZyDayclosingRecordService zyDayclosingRecordService;
+    @Autowired
+    private MzmxsrService mzmxsrService;
+    /**
+     * 每20分钟执行一次
+     */
+    @Scheduled(cron = "0 0/20 * * * ?")
+    public void refreshTokenCache() {
+        tokenService.refreshTokenCache();
+    }
+
+
+
+    /**
+     * 每天凌晨零点五分运行一次
+     */
+    @Scheduled(cron = "5 0 0 * * *")
+    public void scheduled() {
+        processMzsrmx(DateUtil.getPrevDayFirstSecond(),DateUtil.getFirstSecond());
+    }
+
+    /**
+     * 每天23时58分将自助收费做日结
+     */
+    @Scheduled(cron = "0 58 23 * * *")
+    public void scheduledFull() {
+        processZzRj();
+    }
+
+
+//
+//    /**
+//     * 处理入库数据
+//     *
+//     */
+//    private void process() {
+//        List<MzyRequest> requests = mzyRequestService.queryMzyRequestByRequestDay(DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
+//        //此时排班表数据没有同步过来,需要手动同步,以后排班系统重做后需要移除此功能
+//        if(requests==null || requests.size()==0){
+//            mzyRequestService.synchronizationRequest();
+//        }
+//    }
+
+
+
+    /**
+     * 定时处理自助缴费日结
+     *
+     */
+    private void processZzRj() {
+       try {
+           Integer count = chargeFeeVoService.queryCountCanDaily(Constants.BRZZJF_CODE);
+           if (count == null || count == 0) {
+               log.warn("99999 费用结算失败,无可结算费用");
+               return;
+           }
+           count = chargeFeeVoService.queryTFWDFPCount(Constants.BRZZJF_CODE);
+           if (count > 0) {
+               log.warn("99999 存在退费后发票未重打的发票信息,请 处理后再结账!");
+               return;
+           }
+           chargeFeeVoService.dcountCharge(Constants.BRZZJF_CODE);
+       }catch (Exception e){
+           log.error("门诊自助日结出错。");
+       }
+
+        try{
+            zyDayclosingRecordService.dayclosing();
+        }catch (Exception e){
+            log.error("住院自助日结出错。");
+        }
+    }
+
+
+
+//    @Scheduled(cron = "30 01 11 22 * *")
+//    public void scheduledFullMzsrmx() {
+//        ProcessYpCountThread ypCountThread_2012=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2012);
+//        new Thread(ypCountThread_2012).start();
+//        ProcessYpCountThread ypCountThread_2013=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2013);
+//        new Thread(ypCountThread_2013).start();
+//        ProcessYpCountThread ypCountThread_2014=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2014);
+//        new Thread(ypCountThread_2014).start();
+//        ProcessYpCountThread ypCountThread_2015=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2015);
+//        new Thread(ypCountThread_2015).start();
+//        ProcessYpCountThread ypCountThread_2016=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2016);
+//        new Thread(ypCountThread_2016).start();
+//        ProcessYpCountThread ypCountThread_2017=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2017);
+//        new Thread(ypCountThread_2017).start();
+//        ProcessYpCountThread ypCountThread_2018=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2018);
+//        new Thread(ypCountThread_2018).start();
+//        ProcessYpCountThread ypCountThread_2019=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2019);
+//        new Thread(ypCountThread_2019).start();
+//        ProcessYpCountThread ypCountThread_2020=new ProcessYpCountThread(chargeFeeVoService,mzmxsrService,2020);
+//        new Thread(ypCountThread_2020).start();
+//    }
+
+
+
+
+
+
+
+    /**
+     * 处理入库数据
+     *
+     * @param beginTime 查询开始时间
+     * @param endTime   查询结束时间
+     */
+    private void processMzsrmx(Date beginTime, Date endTime) {
+        ThmzmxsrParamsVo thmzmxsrParamsVo = new ThmzmxsrParamsVo();
+        thmzmxsrParamsVo.setCaseType(YesNoEnum.NO.code.toString());
+        thmzmxsrParamsVo.setBeginDate(beginTime);
+        thmzmxsrParamsVo.setEndDate(endTime);
+        thmzmxsrParamsVo.setHisData(YesNoEnum.NO);
+        List<Mzmxsr> thmzmxsrs = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
+        thmzmxsrParamsVo.setHisData(YesNoEnum.YES);
+        List<Mzmxsr> thmzmxsrsHis = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
+        fomartThmzmxsr(thmzmxsrs, thmzmxsrsHis);
+        Date inputDate = new Date();
+        //批量导入入库方式
+        List<Mzmxsr> insertList = new ArrayList<>();
+        thmzmxsrs.forEach(mzmxsr -> {
+            mzmxsr.setInputDate(inputDate);
+            insertList.add(mzmxsr);
+            if (insertList.size() >= 50) {
+                try {
+                    mzmxsrService.batchSaveMzmxsr(insertList);
+                    insertList.clear();
+                } catch (Exception e) {
+                    log.error("统计门诊收入明细信息保存出错,参数列表长度{},错误信息:{}", thmzmxsrs.size(),e.getMessage());
+                }
+            }
+
+        });
+        if (insertList.size() > 0) {
+            try {
+                mzmxsrService.batchSaveMzmxsr(insertList);
+                insertList.clear();
+            } catch (Exception e) {
+                log.error("统计门诊收入明细信息保存出错,参数列表长度{},错误信息:{}", thmzmxsrs.size(),e.getMessage());
+            }
+        }
+    }
+
+    private void fomartThmzmxsr(List<Mzmxsr> thmzmxsrs, List<Mzmxsr> thmzmxsrsHis) {
+        Set<Date> repeatSet = new HashSet<>();
+        if (thmzmxsrs != null && thmzmxsrs.size() > 0) {
+            for (Mzmxsr mzmxsr : thmzmxsrs) {
+                repeatSet.add(mzmxsr.getDcountDate());
+            }
+        }
+        if (thmzmxsrsHis != null && thmzmxsrsHis.size() > 0) {
+            for (Mzmxsr mzmxsr : thmzmxsrsHis) {
+                if (repeatSet.contains(mzmxsr.getDcountDate())) {
+                    continue;
+                }
+                thmzmxsrs.add(mzmxsr);
+            }
+        }
+    }
+}

+ 50 - 52
src/main/java/cn/hnthyy/thmz/controller/ChargeFeeVoController.java

@@ -8,10 +8,12 @@ import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.*;
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.PayMarkEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.his.*;
+import cn.hnthyy.thmz.service.thmz.MzmxsrService;
 import cn.hnthyy.thmz.service.thmz.UserService;
 import cn.hnthyy.thmz.vo.*;
 import lombok.extern.slf4j.Slf4j;
@@ -46,7 +48,8 @@ public class ChargeFeeVoController {
     private MzBillItemService mzBillItemService;
     @Autowired
     private MzPatientMiService mzPatientMiService;
-
+    @Autowired
+    private MzmxsrService mzmxsrService;
     /**
      * 查询日结列表收费清单 未结账
      *
@@ -1005,9 +1008,9 @@ public class ChargeFeeVoController {
                 resultMap.put("message", "查询门诊收费明细失败,结束时间为空");
                 return resultMap;
             }
-            if(DateTimeUtils.periodDays(DateTimeUtils.date2LocalDate(thmzmxsrParamsVo.getBeginDate()), DateTimeUtils.date2LocalDate(thmzmxsrParamsVo.getEndDate()))>31){
+            if (thmzmxsrParamsVo.getPageSize() == null) {
                 resultMap.put("code", -1);
-                resultMap.put("message", "查询门诊收费明细失败,时间跨度不能大于一个月");
+                resultMap.put("message", "查询门诊收费明细失败,每页显示数据大小不能为空");
                 return resultMap;
             }
             List<MzPatientMi> mzPatientMis = mzPatientMiService.queryByCommonParams(thmzmxsrParamsVo.getCommonParams());
@@ -1040,13 +1043,19 @@ public class ChargeFeeVoController {
             }
             resultMap.put("code", 0);
             resultMap.put("message", "查询门诊收费明细成功");
-            thmzmxsrParamsVo.setHisData(YesNoEnum.NO);
-            List<Map<String, Object>> thmzmxsrs = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
-            thmzmxsrParamsVo.setHisData(YesNoEnum.YES);
-            List<Map<String, Object>> thmzmxsrsHis = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
-            BigDecimal totalAmount = fomartThmzmxsr(thmzmxsrs, thmzmxsrsHis);
-            resultMap.put("data", thmzmxsrs);
-            resultMap.put("totalAmount", totalAmount);
+            List<Mzmxsr> mzmxsrs=mzmxsrService.queryMzmxsrWithPage(thmzmxsrParamsVo);
+            fomartThmzmxsr(mzmxsrs);
+            resultMap.put("data", mzmxsrs);
+            Integer total =thmzmxsrParamsVo.getTotal();
+            if(total<0){
+                total=mzmxsrService.queryCountMzmxsr(thmzmxsrParamsVo);
+            }
+            resultMap.put("total", total);
+            BigDecimal amount=thmzmxsrParamsVo.getAmount();
+            if(amount==null){
+                amount=mzmxsrService.querySumAmount(thmzmxsrParamsVo);
+            }
+            resultMap.put("totalAmount",amount==null?BigDecimal.ZERO:amount .setScale(2, BigDecimal.ROUND_FLOOR));
             return resultMap;
         } catch (Exception e) {
             e.printStackTrace();
@@ -1058,61 +1067,42 @@ public class ChargeFeeVoController {
     }
 
 
-    private BigDecimal fomartThmzmxsr(List<Map<String, Object>> thmzmxsrs, List<Map<String, Object>> thmzmxsrsHis) {
-        BigDecimal totalAmount = BigDecimal.ZERO;
-        if (thmzmxsrs != null && thmzmxsrs.size() > 0) {
+    private void fomartThmzmxsr(List<Mzmxsr> mzmxsrs) {
+        Map<String, String> mzBillItemMap = null;
+        Map<String, String> employeeMap = null;
+        if (mzmxsrs != null && mzmxsrs.size() > 0) {
             List<MzBillItem> mzBillItems = mzBillItemService.queryZyBillItem();
-            Map<String, String> mzBillItemMap = null;
             if (mzBillItems != null) {
                 mzBillItemMap = mzBillItems.stream().collect(Collectors.toMap(MzBillItem::getCode, MzBillItem::getName));
             }
-            Map<String, String> employeeMap = null;
             List<Employee> employees = employeeService.queryAll();
             if (employees != null) {
                 employeeMap = employees.stream().collect(Collectors.toMap(Employee::getEmployeeCode, Employee::getEmployeeName));
             }
-            Set<Date> repeatSet = new HashSet<>();
-            for (Map<String, Object> map : thmzmxsrs) {
-                repeatSet.add((Date) map.get("dcount_date"));
-                totalAmount = getBigDecimal(totalAmount, mzBillItemMap, employeeMap, map);
-            }
-
-            for (Map<String, Object> map : thmzmxsrsHis) {
-                if (repeatSet.contains(map.get("dcount_date"))) {
-                    continue;
-                }
-                totalAmount = getBigDecimal(totalAmount, mzBillItemMap, employeeMap, map);
-                thmzmxsrs.add(map);
+        }
+        if (mzmxsrs != null && mzmxsrs.size() > 0) {
+            for (Mzmxsr mzmxsr : mzmxsrs) {
+                getBigDecimal(mzBillItemMap, employeeMap, mzmxsr);
             }
         }
-        return totalAmount.setScale(2, BigDecimal.ROUND_FLOOR);
     }
 
-    private BigDecimal getBigDecimal(BigDecimal totalAmount, Map<String, String> mzBillItemMap, Map<String, String> employeeMap, Map<String, Object> map) {
+    private void getBigDecimal(Map<String, String> mzBillItemMap, Map<String, String> employeeMap, Mzmxsr mzmxsr) {
         if (mzBillItemMap != null) {
-            map.put("parent_code", mzBillItemMap.get(map.get("parent_code")));
+            mzmxsr.setParentCode(mzBillItemMap.get(mzmxsr.getParentCode()));
         }
-        map.put("jz_sq_dept", zdUnitCodeService.queryDeptNameByIdInCache((String) map.get("jz_sq_dept")));
-        map.put("exec_dept", zdUnitCodeService.queryDeptNameByIdInCache((String) map.get("exec_dept")));
-        String jzSqDoctor = (String) map.get("jz_sq_doctor");
+        mzmxsr.setJzSqDept(zdUnitCodeService.queryDeptNameByIdInCache(mzmxsr.getJzSqDept()));
+        mzmxsr.setExecDept(zdUnitCodeService.queryDeptNameByIdInCache(mzmxsr.getExecDept()));
+        String jzSqDoctor = mzmxsr.getJzSqDoctor();
         if (StringUtils.isNotBlank(jzSqDoctor)) {
             jzSqDoctor = jzSqDoctor.trim();
         }
-        map.put("jz_sq_doctor", employeeMap.get(jzSqDoctor));
-        BigDecimal price = (BigDecimal) map.get("price");
+        mzmxsr.setJzSqDoctor(employeeMap.get(jzSqDoctor));
+        BigDecimal price =mzmxsr.getPrice();
         if (price == null) {
             price = BigDecimal.ZERO;
         }
-        Double je = (Double) map.get("je");
-        BigDecimal jeB;
-        if (je == null) {
-            jeB = BigDecimal.ZERO;
-        } else {
-            jeB = BigDecimal.valueOf(je);
-        }
-        totalAmount = totalAmount.add(jeB);
-        map.put("price", price.setScale(2, BigDecimal.ROUND_FLOOR));
-        return totalAmount;
+        mzmxsr.setPrice(price.setScale(2, BigDecimal.ROUND_FLOOR));
     }
 
 
@@ -1127,7 +1117,7 @@ public class ChargeFeeVoController {
     public Map<String, Object> excelThmzmxsr(@RequestParam("commonParams") String commonParams, @RequestParam("caseType") String caseType, @RequestParam("beginDate") String beginDate,
                                              @RequestParam("endDate") String endDate, @RequestParam("jzSqDept") String jzSqDept, @RequestParam("jzSqDoctor") String jzSqDoctor,
                                              @RequestParam("execDept") String execDept, @RequestParam("hsm") String hsm,
-                                             @RequestParam("parentCode") String parentCode, @RequestParam("xmm") String xmm, HttpServletRequest request, HttpServletResponse response) {
+                                             @RequestParam("parentCode") String parentCode, @RequestParam("xmm") String xmm,@RequestParam("pageSize") String pageSize, HttpServletRequest request, HttpServletResponse response) {
 
         if (StringUtils.isBlank(caseType)) {
             caseType = YesNoEnum.NO.code.toString();
@@ -1150,6 +1140,7 @@ public class ChargeFeeVoController {
         if (StringUtils.isBlank(xmm)) {
             xmm = null;
         }
+        Map<String, Object> resultMap = new HashMap<>();
         ThmzmxsrParamsVo thmzmxsrParamsVo = new ThmzmxsrParamsVo();
         thmzmxsrParamsVo.setCommonParams(commonParams);
         thmzmxsrParamsVo.setCaseType(caseType);
@@ -1161,6 +1152,16 @@ public class ChargeFeeVoController {
         thmzmxsrParamsVo.setHsm(hsm);
         thmzmxsrParamsVo.setParentCode(parentCode);
         thmzmxsrParamsVo.setXmm(xmm);
+        if(DateTimeUtils.periodDays(DateTimeUtils.date2LocalDate(thmzmxsrParamsVo.getBeginDate()), DateTimeUtils.date2LocalDate(thmzmxsrParamsVo.getEndDate()))>180){
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询门诊收费明细失败,时间跨度不能大于六个月");
+            return resultMap;
+        }
+        Integer total =Integer.valueOf(pageSize);
+        if(total<0){
+            total=mzmxsrService.queryCountMzmxsr(thmzmxsrParamsVo);
+        }
+        thmzmxsrParamsVo.setPageSize(total);
         List<MzPatientMi> mzPatientMis = mzPatientMiService.queryByCommonParams(commonParams);
         if (mzPatientMis != null && mzPatientMis.size() > 0) {
             List<String> patientIds = mzPatientMis.stream().filter(m -> StringUtils.isNotBlank(m.getPatientId())).map(m -> m.getPatientId()).collect(Collectors.toList());
@@ -1168,12 +1169,9 @@ public class ChargeFeeVoController {
                 thmzmxsrParamsVo.setPatientIds(patientIds);
             }
         }
-        thmzmxsrParamsVo.setHisData(YesNoEnum.NO);
-        List<Map<String, Object>> thmzmxsrs = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
-        thmzmxsrParamsVo.setHisData(YesNoEnum.YES);
-        List<Map<String, Object>> thmzmxsrsHis = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
-        fomartThmzmxsr(thmzmxsrs, thmzmxsrsHis);
-        ExcelUtil.exportExcelForThmzmxsrs(request, response, thmzmxsrs);
+        List<Mzmxsr> mzmxsrs=mzmxsrService.queryMzmxsrWithPage(thmzmxsrParamsVo);
+        fomartThmzmxsr(mzmxsrs);
+        ExcelUtil.exportExcelForThmzmxsrs(request, response, mzmxsrs);
         return null;
     }
 }

+ 43 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/Mzmxsr.java

@@ -0,0 +1,43 @@
+package cn.hnthyy.thmz.entity.thmz;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 门诊明细收入
+ */
+@Data
+public class Mzmxsr {
+    //主键
+    private Long id;
+    //姓名
+    private String xm;
+    //病人id
+    private String patientId;
+    //就诊/申请科室
+    private String jzSqDept;
+    //就诊/申请医生
+    private String jzSqDoctor;
+    //执行科室
+    private String execDept;
+    //项目名
+    private String xmm;
+    //核算码
+    private String hsm;
+    //金额
+    private BigDecimal je;
+    //缴费时间
+    private Date chargeDate;
+    //日结时间
+    private Date dcountDate;
+    //数量
+    private Double quty;
+    //单价
+    private BigDecimal price;
+    //父类码
+    private String parentCode;
+    //同步入库时间
+    private Date inputDate;
+}

+ 2 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/ChargeFeeVoMapper.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.mapper.his;
 
 import cn.hnthyy.thmz.entity.his.MzReceiptSerial;
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.vo.*;
 import org.apache.ibatis.annotations.Param;
@@ -1047,6 +1048,6 @@ public interface ChargeFeeVoMapper {
             " and mzsr.xmm =#{xmm}" +
             "</when>"
             + "</script>"})
-    List<Map<String, Object>> selectThmzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo);
+    List<Mzmxsr> selectThmzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo);
 
 }

+ 175 - 0
src/main/java/cn/hnthyy/thmz/mapper/thmz/MzmxsrMapper.java

@@ -0,0 +1,175 @@
+package cn.hnthyy.thmz.mapper.thmz;
+
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
+import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+public interface MzmxsrMapper {
+    /**
+     * 单独插入数据
+     * @param mzmxsr
+     * @return
+     */
+    @Insert("INSERT INTO t_mzmxsr(xm, patient_id, jz_sq_dept, jz_sq_doctor, exec_dept, xmm, hsm, je, charge_date, dcount_date, quty, price, parent_code, input_date) VALUES" +
+            " (#{xm,jdbcType=VARCHAR}, #{patientId,jdbcType=VARCHAR}, #{jzSqDept,jdbcType=VARCHAR}, #{jzSqDoctor,jdbcType=VARCHAR}, #{execDept,jdbcType=VARCHAR}, #{xmm,jdbcType=VARCHAR}, #{hsm,jdbcType=VARCHAR}, #{je,jdbcType=DECIMAL}," +
+            " #{chargeDate,jdbcType=TIMESTAMP}, #{dcountDate,jdbcType=TIMESTAMP}, #{quty,jdbcType=DOUBLE}, #{price,jdbcType=DECIMAL}, #{parentCode,jdbcType=VARCHAR}, #{inputDate,jdbcType=TIMESTAMP})")
+    int insertMzmxsr(Mzmxsr mzmxsr);
+
+
+    /**
+     * 批量保存门诊收费明细记录
+     *
+     * @param mzmxsrList
+     * @return
+     */
+    @Insert({
+            "<script>",
+            "INSERT INTO  t_mzmxsr(xm, patient_id, jz_sq_dept, jz_sq_doctor, exec_dept, xmm, hsm, je, charge_date, dcount_date, quty, price, parent_code, input_date) VALUES ",
+            "<foreach collection='mzmxsrList' item='item' index='index' separator=','>",
+            " (#{item.xm,jdbcType=VARCHAR}, #{item.patientId,jdbcType=VARCHAR}, #{item.jzSqDept,jdbcType=VARCHAR}, #{item.jzSqDoctor,jdbcType=VARCHAR}," +
+                    " #{item.execDept,jdbcType=VARCHAR}, #{item.xmm,jdbcType=VARCHAR}, #{item.hsm,jdbcType=VARCHAR}, #{item.je,jdbcType=DECIMAL}," +
+                    "#{item.chargeDate,jdbcType=TIMESTAMP}, #{item.dcountDate,jdbcType=TIMESTAMP}, #{item.quty,jdbcType=DOUBLE}, " +
+                    "#{item.price,jdbcType=DECIMAL}, #{item.parentCode,jdbcType=VARCHAR}, #{item.inputDate,jdbcType=TIMESTAMP}) ",
+            "</foreach>",
+            "</script>"
+    })
+    int batchInsertMzmxsr(@Param(value = "mzmxsrList") List<Mzmxsr> mzmxsrList);
+
+    /**
+     * 分页查询门诊收入明细
+     *
+     *
+     * @param thmzmxsrParamsVo
+     * @return
+     */
+    @Select({"<script>" +
+            "select id,xm, patient_id, jz_sq_dept, jz_sq_doctor, exec_dept, xmm, hsm, je, charge_date, dcount_date, quty, price, parent_code, input_date from t_mzmxsr where 1=1"+
+            "<when test='caseType==1'>" +
+            " and charge_date  <![CDATA[>=]]>#{beginDate,jdbcType=TIMESTAMP} and charge_date  <![CDATA[<=]]>#{endDate,jdbcType=TIMESTAMP}" +
+            "</when>" +
+            "<when test='caseType==0'>" +
+            " and dcount_date  <![CDATA[>=]]>#{beginDate,jdbcType=TIMESTAMP} and dcount_date  <![CDATA[<=]]>#{endDate,jdbcType=TIMESTAMP}" +
+            "</when>" +
+            "<when test='patientIds!=null'>" +
+                    " and patient_id in" +
+                    "<foreach item='item' index='index' collection='patientIds' open='(' separator=',' close=')'>" +
+                    "#{item}" +
+                    "</foreach>" +
+                    "</when>"+
+                    "<when test='jzSqDept!=null'>" +
+                    " and jz_sq_dept =#{jzSqDept}" +
+                    "</when>" +
+                    "<when test='jzSqDoctor!=null'>" +
+                    " and jz_sq_doctor =#{jzSqDoctor}" +
+                    "</when>" +
+                    "<when test='execDept!=null'>" +
+                    " and exec_dept =#{execDept}" +
+                    "</when>" +
+                    "<when test='hsm!=null'>" +
+                    " and hsm =#{hsm}" +
+                    "</when>" +
+                    "<when test='parentCode!=null'>" +
+                    " and parent_code =#{parentCode}" +
+                    "</when>" +
+                    "<when test='xmm!=null'>" +
+                    " and xmm =#{xmm}" +
+                    "</when>"+
+            " order by id limit #{pageSize}"
+            + "</script>"})
+    List<Mzmxsr> selectMzmxsrWithPage(ThmzmxsrParamsVo thmzmxsrParamsVo);
+
+
+
+
+    /**
+     * 查询符合条件的总数
+     *
+     *
+     * @param thmzmxsrParamsVo
+     * @return
+     */
+    @Select({"<script>" +
+            "select count(1) from t_mzmxsr where 1=1"+
+            "<when test='caseType==1'>" +
+            " and charge_date  <![CDATA[>=]]>#{beginDate,jdbcType=TIMESTAMP} and charge_date  <![CDATA[<=]]>#{endDate,jdbcType=TIMESTAMP}" +
+            "</when>" +
+            "<when test='caseType==0'>" +
+            " and dcount_date  <![CDATA[>=]]>#{beginDate,jdbcType=TIMESTAMP} and dcount_date  <![CDATA[<=]]>#{endDate,jdbcType=TIMESTAMP}" +
+            "</when>" +
+            "<when test='patientIds!=null'>" +
+            " and patient_id in" +
+            "<foreach item='item' index='index' collection='patientIds' open='(' separator=',' close=')'>" +
+            "#{item}" +
+            "</foreach>" +
+            "</when>"+
+            "<when test='jzSqDept!=null'>" +
+            " and jz_sq_dept =#{jzSqDept}" +
+            "</when>" +
+            "<when test='jzSqDoctor!=null'>" +
+            " and jz_sq_doctor =#{jzSqDoctor}" +
+            "</when>" +
+            "<when test='execDept!=null'>" +
+            " and exec_dept =#{execDept}" +
+            "</when>" +
+            "<when test='hsm!=null'>" +
+            " and hsm =#{hsm}" +
+            "</when>" +
+            "<when test='parentCode!=null'>" +
+            " and parent_code =#{parentCode}" +
+            "</when>" +
+            "<when test='xmm!=null'>" +
+            " and xmm =#{xmm}" +
+            "</when>"
+            + "</script>"})
+    Integer selectCountMzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo);
+
+
+
+    /**
+     * 查询符合条件的总金额
+     *
+     *
+     * @param thmzmxsrParamsVo
+     * @return
+     */
+    @Select({"<script>" +
+            "select sum(je) from t_mzmxsr where 1=1"+
+            "<when test='caseType==1'>" +
+            " and charge_date  <![CDATA[>=]]>#{beginDate,jdbcType=TIMESTAMP} and charge_date  <![CDATA[<=]]>#{endDate,jdbcType=TIMESTAMP}" +
+            "</when>" +
+            "<when test='caseType==0'>" +
+            " and dcount_date  <![CDATA[>=]]>#{beginDate,jdbcType=TIMESTAMP} and dcount_date  <![CDATA[<=]]>#{endDate,jdbcType=TIMESTAMP}" +
+            "</when>" +
+            "<when test='patientIds!=null'>" +
+            " and patient_id in" +
+            "<foreach item='item' index='index' collection='patientIds' open='(' separator=',' close=')'>" +
+            "#{item}" +
+            "</foreach>" +
+            "</when>"+
+            "<when test='jzSqDept!=null'>" +
+            " and jz_sq_dept =#{jzSqDept}" +
+            "</when>" +
+            "<when test='jzSqDoctor!=null'>" +
+            " and jz_sq_doctor =#{jzSqDoctor}" +
+            "</when>" +
+            "<when test='execDept!=null'>" +
+            " and exec_dept =#{execDept}" +
+            "</when>" +
+            "<when test='hsm!=null'>" +
+            " and hsm =#{hsm}" +
+            "</when>" +
+            "<when test='parentCode!=null'>" +
+            " and parent_code =#{parentCode}" +
+            "</when>" +
+            "<when test='xmm!=null'>" +
+            " and xmm =#{xmm}" +
+            "</when>"
+            + "</script>"})
+    BigDecimal selectSumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo);
+
+}

+ 2 - 1
src/main/java/cn/hnthyy/thmz/service/his/ChargeFeeVoService.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.service.his;
 
 import cn.hnthyy.thmz.entity.his.MzReceiptSerial;
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.vo.*;
 import java.math.BigDecimal;
@@ -295,7 +296,7 @@ public interface ChargeFeeVoService {
      * @param thmzmxsrParamsVo
      * @return
      */
-    List<Map<String, Object>> queryThmzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo);
+    List<Mzmxsr> queryThmzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo);
 
 
 

+ 2 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/ChargeFeeVoServiceImpl.java

@@ -2,6 +2,7 @@ package cn.hnthyy.thmz.service.impl.his;
 
 import cn.hnthyy.thmz.entity.his.MzDepositFile;
 import cn.hnthyy.thmz.entity.his.MzReceiptSerial;
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.mapper.his.ChargeFeeVoMapper;
 import cn.hnthyy.thmz.mapper.his.MzDepositFileMapper;
@@ -236,7 +237,7 @@ public class ChargeFeeVoServiceImpl implements ChargeFeeVoService {
     }
 
     @Override
-    public List<Map<String, Object>> queryThmzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo) {
+    public List<Mzmxsr> queryThmzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo) {
         return chargeFeeVoMapper.selectThmzmxsr(thmzmxsrParamsVo);
     }
 

+ 41 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/MzmxsrServiceImpl.java

@@ -0,0 +1,41 @@
+package cn.hnthyy.thmz.service.impl.thmz;
+
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
+import cn.hnthyy.thmz.mapper.thmz.MzmxsrMapper;
+import cn.hnthyy.thmz.service.thmz.MzmxsrService;
+import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.List;
+@Service
+public class MzmxsrServiceImpl implements MzmxsrService {
+    @SuppressWarnings("all")
+    @Autowired
+    private MzmxsrMapper mzmxsrMapper;
+    @Override
+    public int saveMzmxsr(Mzmxsr mzmxsr) {
+        return mzmxsrMapper.insertMzmxsr(mzmxsr);
+    }
+
+    @Override
+    public int batchSaveMzmxsr(List<Mzmxsr> mzmxsrList) {
+        return mzmxsrMapper.batchInsertMzmxsr(mzmxsrList);
+    }
+
+    @Override
+    public List<Mzmxsr> queryMzmxsrWithPage(ThmzmxsrParamsVo thmzmxsrParamsVo) {
+        return mzmxsrMapper.selectMzmxsrWithPage(thmzmxsrParamsVo);
+    }
+
+    @Override
+    public Integer queryCountMzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo) {
+        return mzmxsrMapper.selectCountMzmxsr(thmzmxsrParamsVo);
+    }
+
+    @Override
+    public BigDecimal querySumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo) {
+        return mzmxsrMapper.selectSumAmount(thmzmxsrParamsVo);
+    }
+}

+ 55 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/MzmxsrService.java

@@ -0,0 +1,55 @@
+package cn.hnthyy.thmz.service.thmz;
+
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
+import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+public interface MzmxsrService {
+    /**
+     * 单独插入数据
+     * @param mzmxsr
+     * @return
+     */
+    int saveMzmxsr(Mzmxsr mzmxsr);
+
+
+    /**
+     * 批量保存门诊收费明细记录
+     *
+     * @param mzmxsrList
+     * @return
+     */
+    int batchSaveMzmxsr(List<Mzmxsr> mzmxsrList);
+
+    /**
+     * 分页查询门诊收入明细
+     *
+     *
+     * @param thmzmxsrParamsVo
+     * @return
+     */
+    List<Mzmxsr> queryMzmxsrWithPage(ThmzmxsrParamsVo thmzmxsrParamsVo);
+
+
+    /**
+     * 查询符合条件的总数
+     *
+     *
+     * @param thmzmxsrParamsVo
+     * @return
+     */
+    Integer queryCountMzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo);
+
+
+    /**
+     * 查询符合条件的总金额
+     *
+     *
+     * @param thmzmxsrParamsVo
+     * @return
+     */
+    BigDecimal querySumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo);
+
+}

+ 8 - 0
src/main/java/cn/hnthyy/thmz/vo/ThmzmxsrParamsVo.java

@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -45,6 +46,13 @@ public class ThmzmxsrParamsVo {
     private String firstTableName;
     //第二个表名
     private String secondTableName;
+    //每页显示的数据
+    private Integer pageSize;
+    //上一次查询到的总额
+    private BigDecimal amount;
+    //上一次查询到的总数
+    private Integer total;
+
 
 
     public void setHisData(YesNoEnum hisData) {

+ 43 - 0
src/main/resources/otherSource/t_mzmxsr.sql

@@ -0,0 +1,43 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : mine (test)
+ Source Server Type    : MariaDB
+ Source Server Version : 100315
+ Source Host           : localhost:3306
+ Source Schema         : thyy_mz_system
+
+ Target Server Type    : MariaDB
+ Target Server Version : 100315
+ File Encoding         : 65001
+
+ Date: 20/06/2020 11:00:09
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for t_mzmxsr
+-- ----------------------------
+DROP TABLE IF EXISTS `t_mzmxsr`;
+CREATE TABLE `t_mzmxsr`  (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `xm` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '姓名',
+  `patient_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '病人id',
+  `jz_sq_dept` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '就诊/申请科室',
+  `jz_sq_doctor` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '就诊/申请医生',
+  `exec_dept` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '执行科室',
+  `xmm` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '项目名',
+  `hsm` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '核算码',
+  `je` decimal(10, 0) DEFAULT NULL COMMENT '金额',
+  `charge_date` datetime(0) DEFAULT NULL COMMENT '缴费时间',
+  `dcount_date` datetime(0) DEFAULT NULL COMMENT '日结时间',
+  `quty` double(255, 0) DEFAULT NULL COMMENT '数量',
+  `price` decimal(10, 2) DEFAULT NULL COMMENT '单价',
+  `parent_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '父类码',
+  `input_date` datetime(0) DEFAULT NULL COMMENT '同步入库时间',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 19 - 10
src/main/resources/static/js/mzsrmx.js

@@ -1,4 +1,6 @@
 //@ sourceURL=mzsrmx.js
+var amount;
+var total;
 $(function () {
     init_daterangepicker();
     //daterangepicker(getAllOperator);
@@ -157,6 +159,8 @@ function initDoctorSelect() {
  * 门诊收入明细
  */
 function initMzsrmxTable() {
+    amount=null;
+    total=-1;
     $('#tb_table').bootstrapTable("destroy");
     $('#tb_table').bootstrapTable({
         url: '/thmz/getThmzmxsr',         //请求后台的URL(*)
@@ -168,7 +172,7 @@ function initMzsrmxTable() {
         sortable: true,                     //是否启用排序
         sortOrder: "asc",                   //排序方式
         queryParams: queryParams,           //传递参数(*)
-        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
+        sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)
         pageNumber: 1,                       //初始化加载第一页,默认第一页
         pageSize: 10,                       //每页的记录行数(*)
         pageList: [10, 25, 50, 100],        //可供选择的每页的行数(*)
@@ -196,12 +200,12 @@ function initMzsrmxTable() {
                 align: "center",
                 valign: 'middle'
             }, {
-                field: 'patient_id',
+                field: 'patientId',
                 title: '病人ID',
                 align: "center",
                 valign: 'middle',
             }, {
-                field: 'charge_date',
+                field: 'chargeDate',
                 title: '缴费时间',
                 align: "center",
                 valign: 'middle',
@@ -209,17 +213,17 @@ function initMzsrmxTable() {
                     return format(value, "yyyy-MM-dd HH:mm:ss");
                 }
             }, {
-                field: 'jz_sq_dept',
+                field: 'jzSqDept',
                 title: '就诊/申请科室',
                 align: "center",
                 valign: 'middle',
             }, {
-                field: 'jz_sq_doctor',
+                field: 'jzSqDoctor',
                 title: '就诊/申请医生',
                 align: "center",
                 valign: 'middle',
             }, {
-                field: 'exec_dept',
+                field: 'execEept',
                 title: '执行科室',
                 align: "center",
                 valign: 'middle'
@@ -234,7 +238,7 @@ function initMzsrmxTable() {
                 align: "center",
                 valign: 'middle',
             }, {
-                field: 'parent_code',
+                field: 'parentCode',
                 title: '父类码',
                 align: "center",
                 valign: 'middle'
@@ -283,8 +287,10 @@ function initMzsrmxTable() {
                 };
             }
             $("#totalAmount").text(ress.totalAmount.toFixed(2));
+            amount=ress.totalAmount.toFixed(2);
+            total=ress.total;
             return {
-                "total": ress.data.length,//总页数
+                "total": ress.total,//总页数
                 "rows": ress.data   //数据
             };
         },
@@ -308,7 +314,10 @@ function queryParams(params) {
         execDept:$("#execDept").val(),
         hsm:$("#hsm").val(),
         parentCode:$("#parentCode").val(),
-        xmm:$("#xmm").val()
+        xmm:$("#xmm").val(),
+        pageSize: params.limit,
+        amount:amount,
+        total:total
     };
 
     return temp;
@@ -358,5 +367,5 @@ function exportExcel() {
     var rePortRangeArr = getRePortRangeArr();
     window.location.href = "/thmz/excelThmzmxsr?beginDate=" + rePortRangeArr[0] + "&endDate=" + rePortRangeArr[1]+"&commonParams="+$('#commonParams').val()
         +"&caseType="+$('#timeParam').val()+"&jzSqDept="+$("#jzSqDept").val()+"&jzSqDoctor="+$("#jzSqDoctor").val()+"&execDept="+$("#execDept").val()+"&hsm="
-        +$("#hsm").val()+"&parentCode="+$("#parentCode").val()+"&xmm="+$("#xmm").val();
+        +$("#hsm").val()+"&parentCode="+$("#parentCode").val()+"&xmm="+$("#xmm").val()+"&pageSize="+total;
 }