Browse Source

feature:对账增加备注

wuyongyi 2 years ago
parent
commit
a9cb1ceb53

+ 4 - 2
src/main/java/com/ywt/mg/services/CheckUpOrderService.java

@@ -226,7 +226,8 @@ public class CheckUpOrderService {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal,statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
         } catch (Exception e) {
             logger.error("/checkUp/downloadCheckUpOrderList(): {}", e.getMessage(), e);
@@ -387,7 +388,8 @@ public class CheckUpOrderService {
             }
             int size = checkUpOrderList.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal,statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 1;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
         } catch (Exception e) {
             logger.error("/checkUp/downloadCheckUpOrderBillList(): {}", e.getMessage(), e);
             e.printStackTrace();

+ 5 - 3
src/main/java/com/ywt/mg/services/DepositService.java

@@ -251,7 +251,8 @@ public class DepositService {
             }
             int total = list.getTotal();
             List<ExcelCollectPojo> itemList = getStatisticsData(total, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, total);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, total, bill);
         } catch (Exception e) {
             logger.error("/deposit/downloadDepositList(): {}", e.getMessage(), e);
             e.printStackTrace();
@@ -414,7 +415,8 @@ public class DepositService {
             }
             int total = depositPageList.getTotal();
             List<ExcelCollectPojo> itemList = getStatisticsData(total, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, total);
+            int bill = 1;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, total, bill);
         } catch (Exception e) {
             logger.error("/deposit/downloadDepositBillList(): {}", e.getMessage(), e);
             e.printStackTrace();
@@ -505,7 +507,7 @@ public class DepositService {
     private List<ExcelCollectPojo> getStatisticsData(int size, Map<String, Integer> statisticalDataMap) {
 
         int startRows = size + 3;
-        int startColumn = 3;
+        int startColumn = 0;
 
 
         List<ExcelCollectPojo> customExcelItemList = new ArrayList<>();

+ 2 - 2
src/main/java/com/ywt/mg/services/DownloadRecordService.java

@@ -323,7 +323,7 @@ public class DownloadRecordService {
      * @param itemList         统计map
      * @throws Exception
      */
-    public void createFileAndUploadOssAndSaveToDataBase(String fileName, int downloadRecordId, ExcelDataMap map, List<ExcelCollectPojo> itemList, int size) throws Exception {
+    public void createFileAndUploadOssAndSaveToDataBase(String fileName, int downloadRecordId, ExcelDataMap map, List<ExcelCollectPojo> itemList, int size, int bill) throws Exception {
         // 前缀(路径)
         String preLocalPath = ConstantDef.LOCAL_DOWNLOAD_FILE_PATH;
         // 后缀(下载时间和格式)
@@ -339,7 +339,7 @@ public class DownloadRecordService {
          excelDownloadSrv.outputStreamToFile(localPath, ba);
          // ------ test end ----------
          */
-        OutputStream ba = excelDownloadSrv.generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(fileName, localPath, map, excelStyleMap, itemList, size);
+        OutputStream ba = excelDownloadSrv.generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(fileName, localPath, map, excelStyleMap, itemList, size, bill);
         // 本地文件上传到oss,文件名带后缀
         String ossPath = String.format(ConstantDef.BIG_DATA_EXCEL_FILE_PATH, FormatUtil.formatDate(new Date(), "yyyy-MM"));
         String ossFileName = fileName + suffixFormat;

+ 2 - 1
src/main/java/com/ywt/mg/services/MealOrderService.java

@@ -815,7 +815,8 @@ public class MealOrderService {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
         } catch (Exception e) {
             logger.error("/mealOrder/downloadMealOrderBillsList(): {}", e.getMessage(), e);

+ 4 - 2
src/main/java/com/ywt/mg/services/NatOrderService.java

@@ -243,7 +243,8 @@ public class NatOrderService {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
         } catch (Exception e) {
             logger.error("/natOrder/downloadNatOrderList: {}", e.getMessage(), e);
@@ -396,7 +397,8 @@ public class NatOrderService {
             }
             int size = natOrderList.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(rowSize, payTotal, refundTotal, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 1;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 2 - 1
src/main/java/com/ywt/mg/services/OfflineNewService.java

@@ -361,7 +361,8 @@ public class OfflineNewService {
             int size = offlineList.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, statisticalDataMap);
             // 创建文件 并且上传到 OSS,最后保存到本地数据库
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
         } catch (Exception e) {
             logger.error("/offline/downloadOfflineList(): {}", e.getMessage(), e);
             e.printStackTrace();

+ 4 - 2
src/main/java/com/ywt/mg/services/OutpatientOrderService.java

@@ -385,7 +385,8 @@ public class OutpatientOrderService {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
         } catch (Exception e) {
             logger.error("/outPatient/downloadOutPatientOrderList(): {}", e.getMessage(), e);
             e.printStackTrace();
@@ -588,7 +589,8 @@ public class OutpatientOrderService {
             }
             int size = outpatientOrderList.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(rowSize, payTotal, refundTotal, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 1;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
         } catch (Exception e) {
             logger.error("/registeredOrder/downloadRegisteredOrderList: {}", e.getMessage(), e);
             e.printStackTrace();

+ 2 - 1
src/main/java/com/ywt/mg/services/PharmacyService.java

@@ -474,7 +474,8 @@ public class PharmacyService {
                     posPay, posRefundTotal,
                     medicalInsurancePay, medicalInsuranceRefundTotal,
                     icbcPay, icbcRefundTotal);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
         } catch (Exception e) {
             logger.error("/pharmacy/downloadPrescriptionlist(): {}", e.getMessage(), e);

+ 10 - 5
src/main/java/com/ywt/mg/services/PrescriptionServices.java

@@ -450,8 +450,9 @@ public class PrescriptionServices {
 
             }
             int size = prescriptionInfoList.size();
+            int bill = 0;
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
 
         } catch (Exception e) {
@@ -856,7 +857,8 @@ public class PrescriptionServices {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
         } catch (Exception e) {
             logger.error("/prescription/downloadPrescriptionDrugList(): {}", e.getMessage(), e);
             e.printStackTrace();
@@ -981,7 +983,8 @@ public class PrescriptionServices {
             }
             int size = prescriptionInfoList.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(rowSize, payTotal, refundTotal, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 1;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -1094,7 +1097,8 @@ public class PrescriptionServices {
             }
             int size = prescriptionInfoList.size();
             List<ExcelCollectPojo> itemList = getStatisticsData(size, payTotal, refundTotal, statisticalDataMap);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
 
         } catch (Exception e) {
@@ -1452,7 +1456,8 @@ public class PrescriptionServices {
             }
             int size = list.size();
             List<ExcelCollectPojo> itemList = new ArrayList<>();
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 0;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
         } catch (Exception e) {
             logger.error("/prescription/downloadPrescriptionDrugList(): {}", e.getMessage(), e);
             e.printStackTrace();

+ 4 - 2
src/main/java/com/ywt/mg/services/RegisteredOrderService.java

@@ -447,7 +447,8 @@ public class RegisteredOrderService {
                 billEndTime = DateUtil.stringToDate(request.getRegisteredEndTime() + ConstantDef.BILL_TIME_END_FORMAT);
             }
             List<ExcelCollectPojo> itemList = getStatisticsData(size, billStartTime, billEndTime, registeredOrderList);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 1;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
         } catch (Exception e) {
             logger.error("/registeredOrder/downloadRegisteredOrderList: {}", e.getMessage(), e);
@@ -705,7 +706,8 @@ public class RegisteredOrderService {
                 }
             }
             List<ExcelCollectPojo> itemList = getStatisticsData(size, billStartTime, billEndTime, registeredOrderList);
-            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size);
+            int bill = 1;
+            downloadRecordService.createFileAndUploadOssAndSaveToDataBase(fileName, downloadRecordId, map, itemList, size, bill);
 
         } catch (Exception e) {
             logger.error("/registeredOrder/downloadRegisteredOrderBillsList: {}", e.getMessage(), e);

+ 16 - 2
src/main/java/com/ywt/mg/web/common/ExcelDownloadSrv.java

@@ -275,7 +275,7 @@ public class ExcelDownloadSrv {
      * @author Walker, added on 06/27/2019.
      */
     public OutputStream generateAndReturnExcelByteArrayOutputStreamWithStyleAndCollect(String fileName, String path, ExcelDataMap data, ExcelStyleMap excelStyleMap,
-                                                                                       List<ExcelCollectPojo> collectList, int size) throws AppMessageException {
+                                                                                       List<ExcelCollectPojo> collectList, int size, int bill) throws AppMessageException {
 
         OutputStream ba = null;
         ba = new ByteArrayOutputStream();
@@ -367,14 +367,28 @@ public class ExcelDownloadSrv {
                 }
                 // 最后一页,添加汇总,同时关闭流
                 if (currentSheetIndex == sheetAmount - 1) {
+                    int n = 0;
                     if (!Checker.isNone(collectList)) {
                         for (ExcelCollectPojo pojo : collectList) {
                             String[] dataArr = pojo.getDataArr();
-                            for (int r = 0, j = dataArr.length; r < j; r++) {
+                            for (int r = 0, j = dataArr.length; r <= j; r++) {
+                                if (r < j){
                                 Label lb2 = new Label(pojo.getCol() + r, pojo.getRow() - sheetMaxSize * currentSheetIndex, dataArr[r], cellFormat);
                                 sheet.addCell(lb2);
+                                if(j-r == 1){
+                                    n = pojo.getRow() - sheetMaxSize * currentSheetIndex;
+                                }
+                                }
                             }
                         }
+
+                        if(bill == 1) {
+                             n = n + 1;
+                            Label labelRemark = new Label(1, n, "注意:如果需把excel表导入院内系统, 可按需把上面的“数据汇总表格”和“支付渠道列”删除并保存后,再导入", cellFormat);
+                            sheet.mergeCells(1, n, 6, n);
+                            sheet.addCell(labelRemark);
+                        }
+
                     }
                     // 写入流
                     workbook.write();