Pārlūkot izejas kodu

日结汇总收费清单导出增加地址功能

hurugang 2 gadi atpakaļ
vecāks
revīzija
bedf551256

+ 21 - 25
src/main/java/cn/hnthyy/thmz/Utils/ExcelUtil.java

@@ -123,7 +123,7 @@ public class ExcelUtil {
      */
     public static byte[] exportExcelForThmzmxsrs(List<Mzmxsr> thmzmxsrs) {
         Map<String, Object> data = fomartThmzmxsr(thmzmxsrs);
-       return exportExcel(null, null, data, YP_REPORT_COLUMNS_LENGTH, VERSION_2007);
+        return exportExcel(null, null, data, YP_REPORT_COLUMNS_LENGTH, VERSION_2007);
     }
 
     /**
@@ -157,12 +157,12 @@ public class ExcelUtil {
             //设置单元格并赋值
             setData(sheet, (List<String[]>) data.get(DATA_KEY), ((List<Map<String, Object>>) data.get(HEAD_KEY)).size());
             log.info("导出解析成功!");
-            if(request!=null && response!=null){
+            if (request != null && response != null) {
                 //设置浏览器下载
                 setBrowser(request, response, workbook, (String) data.get(FILE_NAME_KEY));
                 return null;
-            }else {
-               // return createFile(workbook,(String) data.get(FILE_NAME_KEY));
+            } else {
+                // return createFile(workbook,(String) data.get(FILE_NAME_KEY));
                 return createFile(workbook);
             }
         } catch (Exception e) {
@@ -194,14 +194,14 @@ public class ExcelUtil {
             //设置表头
             setYfInventoryListTitle(workbook, sheet, (List<Map<String, Object>>) data.get(HEAD_KEY), columns);
             //设置单元格并赋值
-            setYfInventoryListData(workbook,sheet, (List<String[]>) data.get(DATA_KEY), ((List<Map<String, Object>>) data.get(HEAD_KEY)).size());
+            setYfInventoryListData(workbook, sheet, (List<String[]>) data.get(DATA_KEY), ((List<Map<String, Object>>) data.get(HEAD_KEY)).size());
             log.info("导出解析成功!");
-            if(request!=null && response!=null){
+            if (request != null && response != null) {
                 //设置浏览器下载
                 setBrowser(request, response, workbook, (String) data.get(FILE_NAME_KEY));
                 return null;
-            }else {
-               // return createFile(workbook,(String) data.get(FILE_NAME_KEY));
+            } else {
+                // return createFile(workbook,(String) data.get(FILE_NAME_KEY));
                 return createFile(workbook);
             }
         } catch (Exception e) {
@@ -354,7 +354,7 @@ public class ExcelUtil {
      * 方法名:setYfInventoryListData
      * 功能:药房库存清单表格赋值
      */
-    private static void setYfInventoryListData(Workbook workbook,Sheet sheet, List<String[]> data, Integer rowNum) {
+    private static void setYfInventoryListData(Workbook workbook, Sheet sheet, List<String[]> data, Integer rowNum) {
         try {
             for (int i = 0; i < data.size(); i++) {
                 Row row = sheet.createRow(rowNum);
@@ -362,8 +362,8 @@ public class ExcelUtil {
                 for (int j = 0; j < data.get(i).length; j++) {
                     Cell cell = row.createCell(j);
                     cell.setCellValue(data.get(i)[j]);
-                    if(j==4 || j==5 || j==6 || j==7){
-                        CellStyle cellStyle=workbook.createCellStyle(); //设置样式
+                    if (j == 4 || j == 5 || j == 6 || j == 7) {
+                        CellStyle cellStyle = workbook.createCellStyle(); //设置样式
                         Font font = workbook.createFont();
                         font.setFontName("宋体");
                         font.setFontHeightInPoints((short) 10);// 字体大小
@@ -417,9 +417,9 @@ public class ExcelUtil {
      * @param workbook
      */
     private static byte[] createFile(Workbook workbook) {
-   //     private static byte[] createFile(Workbook workbook,String fieName) {
+        //     private static byte[] createFile(Workbook workbook,String fieName) {
         ByteArrayOutputStream os = null;
-    //    OutputStream fos = null;
+        //    OutputStream fos = null;
         try {
             os = new ByteArrayOutputStream();
             //将excel写入到输出流中
@@ -449,11 +449,6 @@ public class ExcelUtil {
     }
 
 
-
-
-
-
-
     /**
      * 方法名:importExcel
      * 功能:导入
@@ -569,7 +564,7 @@ public class ExcelUtil {
         data.put(FILE_NAME_KEY, "收费清单.xls");
         List<Map<String, Object>> heads = new ArrayList<>();
         Map<String, Object> map0 = new HashMap<>();
-        String[] head0 = {"病人ID", "机制号", "退欠标识", "金额", "发票号", "付款方式", "收费日期", "项目名称", "合同编号"};
+        String[] head0 = {"病人ID", "机制号", "退欠标识", "金额", "发票号", "付款方式", "收费日期", "项目名称", "合同编号", "患者地址"};
         String[] headNum0 = {"0,0,0,0"};
         map0.put(HEAD_ARR_KEY, head0);
         map0.put(HEAD_NUM_KEY, headNum0);
@@ -584,9 +579,10 @@ public class ExcelUtil {
                         chargeFeeVo.getTotalCharge().setScale(2, BigDecimal.ROUND_HALF_UP).toString(),
                         chargeFeeVo.getReceiptBill(),
                         chargeFeeVo.getChequeType(),
-                        chargeFeeVo.getChargeDate()!=null?DateFormatUtils.format(chargeFeeVo.getChargeDate(), "yyyy-MM-dd HH:mm:ss"):"",
+                        chargeFeeVo.getChargeDate() != null ? DateFormatUtils.format(chargeFeeVo.getChargeDate(), "yyyy-MM-dd HH:mm:ss") : "",
                         chargeFeeVo.getContractName(),
-                        chargeFeeVo.getContractNo()
+                        chargeFeeVo.getContractNo(),
+                        chargeFeeVo.getAddress() == null ? "" : chargeFeeVo.getAddress()
                 };
                 arr.add(temp);
             }
@@ -700,7 +696,7 @@ public class ExcelUtil {
         data.put(FILE_NAME_KEY, "门诊挂号统计.xls");
         List<Map<String, Object>> heads = new ArrayList<>();
         Map<String, Object> map0 = new HashMap<>();
-        String[] head0 = {"病人姓名", "诊疗卡号", "病人ID", "号源日期","号段","挂号科室", "挂号医生", "挂号时间", "挂号费", "诊查费", "其他收费", "就诊状态","病人地址"};
+        String[] head0 = {"病人姓名", "诊疗卡号", "病人ID", "号源日期", "号段", "挂号科室", "挂号医生", "挂号时间", "挂号费", "诊查费", "其他收费", "就诊状态", "病人地址"};
         String[] headNum0 = {"0,0,0,0"};
         map0.put(HEAD_ARR_KEY, head0);
         map0.put(HEAD_NUM_KEY, headNum0);
@@ -729,7 +725,7 @@ public class ExcelUtil {
                         mzyReqrec.getReqFee() == null ? "0" : mzyReqrec.getReqFee().toString(),
                         mzyReqrec.getClinicFee() == null ? "0" : mzyReqrec.getClinicFee().toString(),
                         mzyReqrec.getOthFee() == null ? "0" : mzyReqrec.getOthFee().toString(), status,
-                        mzyReqrecVo.getMzPatientMi().getAddress()==null?"":mzyReqrecVo.getMzPatientMi().getAddress()
+                        mzyReqrecVo.getMzPatientMi().getAddress() == null ? "" : mzyReqrecVo.getMzPatientMi().getAddress()
                 };
                 arr.add(temp);
             }
@@ -751,7 +747,7 @@ public class ExcelUtil {
         }
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
         Map<String, Object> data = new HashMap<>();
-        data.put(FILE_NAME_KEY, "库存清单"+simpleDateFormat.format(new Date())+".xls");
+        data.put(FILE_NAME_KEY, "库存清单" + simpleDateFormat.format(new Date()) + ".xls");
         List<Map<String, Object>> heads = new ArrayList<>();
         Map<String, Object> map0 = new HashMap<>();
         String[] head0 = {"货位号", "药品编码", "药品名称", "规格", "零售价", "库存量", "库存金额", "当前虚存", "生产厂家"};
@@ -770,7 +766,7 @@ public class ExcelUtil {
                         String.format("%.3f", YpZdBaseVo.getPackRetprice()),
                         String.format("%.2f", YpZdBaseVo.getStockAmount()),
                         String.format("%.2f", YpZdBaseVo.getStockValue()),
-                        YpZdBaseVo.getStockAmountVirtual()==null?"":YpZdBaseVo.getStockAmountVirtual().toString(),
+                        YpZdBaseVo.getStockAmountVirtual() == null ? "" : YpZdBaseVo.getStockAmountVirtual().toString(),
                         YpZdBaseVo.getManufactoryName()
                 };
                 arr.add(temp);

+ 44 - 31
src/main/java/cn/hnthyy/thmz/controller/mz/ChargeFeeVoController.java

@@ -13,6 +13,7 @@ import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.FileTypeEnum;
 import cn.hnthyy.thmz.enums.PayMarkEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
+import cn.hnthyy.thmz.service.his.RegionService;
 import cn.hnthyy.thmz.service.his.mz.*;
 import cn.hnthyy.thmz.service.his.zd.ZdChequeTypeService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
@@ -65,7 +66,8 @@ public class ChargeFeeVoController {
     private MzZdCommonService mzZdCommonService;
     @Autowired
     private ZyZdAuditItemService zyZdAuditItemService;
-
+    @Autowired
+    private RegionService regionService;
     /**
      * 查询日结列表收费清单 未结账
      *
@@ -80,7 +82,7 @@ public class ChargeFeeVoController {
             resultMap.put("code", 0);
             resultMap.put("message", "查询日结列表收费清单成功");
             List<ChargeFeeVo> chargeFeeVos = chargeFeeVoService.queryChargeFeeVoUnAccount(tokenUser.getUserIdCode());
-            fomartChargeVo(chargeFeeVos, YesNoEnum.NO);
+            fomartChargeVo(chargeFeeVos, YesNoEnum.NO,YesNoEnum.NO);
             resultMap.put("data", chargeFeeVos);
             return resultMap;
         } catch (MzException e) {
@@ -101,8 +103,9 @@ public class ChargeFeeVoController {
      *
      * @param chargeFeeVos
      * @param fitEmpName 是否设置医生名称
+     * @param fitAddress 是否设置患者地址
      */
-    private void fomartChargeVo(List<ChargeFeeVo> chargeFeeVos, YesNoEnum fitEmpName) {
+    private void fomartChargeVo(List<ChargeFeeVo> chargeFeeVos, YesNoEnum fitEmpName,YesNoEnum fitAddress) {
         if (chargeFeeVos != null && chargeFeeVos.size() > 0) {
             List<ZdChequeType> chequeTypes = zdChequeTypeService.queryAllZdChequeTypeForMz();
             Map<String, String> employeeMap = null;
@@ -116,7 +119,12 @@ public class ChargeFeeVoController {
                 }
             }
             Map<String, String> chequeTypeMap = chequeTypes.stream().collect(Collectors.toMap(ZdChequeType::getCode, ZdChequeType::getName));
-          //  Map<String, List<ChargeFeeVo>> chargeFeeMap = new HashMap();
+            Map<String, String> regionMap=null;
+            StringBuffer sbf =null;
+            if(YesNoEnum.YES.equals(fitAddress)){
+                regionMap = regionService.queryAll().stream().collect(Collectors.toMap(CodeNameEntity::getCode, CodeNameEntity::getName));
+                sbf = new StringBuffer();
+            }
             for (ChargeFeeVo co : chargeFeeVos) {
                 PayMarkEnum payMark = PayMarkEnum.getPayMarkByCode(co.getPayMark());
                 co.setPayMark(payMark == null ? co.getPayMark() : payMark.name);
@@ -131,25 +139,34 @@ public class ChargeFeeVoController {
                 if (YesNoEnum.YES.equals(fitEmpName)) {
                     co.setOpId(employeeMap.get(co.getOpId()));
                 }
-               // List<ChargeFeeVo> tempList = chargeFeeMap.get(co.getSerialNo());
-//                if (tempList == null) {
-//                    tempList = new ArrayList<>();
-//                    chargeFeeMap.put(co.getSerialNo(), tempList);
-//                }
-//                tempList.add(co);
-            }
-//            for (String key : chargeFeeMap.keySet()) {
-//                if (StringUtils.isNotBlank(key)) {
-//                    List<ChargeFeeVo> tempList = chargeFeeMap.get(key);
-//                    if (tempList.size() > 1) {
-//                        for (ChargeFeeVo co : tempList) {
-//                            if ((Constants.BYJZ_NAME.equals(co.getChequeType()) && StringUtils.isNotBlank(co.getReceiptBill())) || (!Constants.BYJZ_NAME.equals(co.getChequeType()) && StringUtils.isBlank(co.getReceiptBill()))) {
-//                                chargeFeeVos.remove(co);
-//                            }
-//                        }
-//                    }
-//                }
-//            }
+                if(YesNoEnum.YES.equals(fitAddress)){
+                    MzPatientMi mzPatientMi=mzPatientMiService.queryByPatientId(co.getPatientId());
+                    if(mzPatientMi==null){
+                        continue;
+                    }
+                    if (mzPatientMi.getAddress() == null || StringUtils.isBlank(mzPatientMi.getAddress())) {
+                        String pro = regionMap.get(mzPatientMi.getProvinceCode());
+                        if (pro != null && StringUtils.isBlank(pro)) {
+                            sbf.append(pro);
+                        }
+                        String city = regionMap.get(mzPatientMi.getCityCode());
+                        if (city != null && StringUtils.isBlank(city)) {
+                            sbf.append(city);
+                        }
+                        String district = regionMap.get(mzPatientMi.getDistrictCode());
+                        if (district != null && StringUtils.isBlank(district)) {
+                            sbf.append(district);
+                        }
+                        if (mzPatientMi.getDetail() != null && StringUtils.isBlank(mzPatientMi.getDetail())) {
+                            sbf.append(mzPatientMi.getDetail());
+                        }
+                        mzPatientMi.setAddress(sbf.toString());
+                        sbf.setLength(0);
+                    }
+                    co.setAddress(mzPatientMi.getAddress());
+                }
+
+            }
         }
     }
 
@@ -197,7 +214,7 @@ public class ChargeFeeVoController {
             resultMap.put("code", 0);
             resultMap.put("message", "日结汇总的收费清单成功");
             List<ChargeFeeVo> chargeFeeVos = chargeFeeVoService.queryChargeFeeVoCollect(chargeFeeParamsVo.getCaseType(), chargeFeeParamsVo.getBeginDate(), chargeFeeParamsVo.getEndDate());
-            fomartChargeVo(chargeFeeVos, YesNoEnum.YES);
+            fomartChargeVo(chargeFeeVos, YesNoEnum.YES,YesNoEnum.NO);
             resultMap.put("data", chargeFeeVos);
             return resultMap;
         } catch (Exception e) {
@@ -236,7 +253,7 @@ public class ChargeFeeVoController {
             resultMap.put("code", 0);
             resultMap.put("message", "重打结算单的收费清单成功");
             List<ChargeFeeVo> chargeFeeVos = chargeFeeVoService.queryChargeFeeVoReprint(chargeFeeParamsVo.getOpId(), chargeFeeParamsVo.getCaseType(), chargeFeeParamsVo.getDcountDate());
-            fomartChargeVo(chargeFeeVos, YesNoEnum.NO);
+            fomartChargeVo(chargeFeeVos, YesNoEnum.NO,YesNoEnum.NO);
             resultMap.put("data", chargeFeeVos);
             return resultMap;
         } catch (Exception e) {
@@ -430,7 +447,7 @@ public class ChargeFeeVoController {
             //重打日结收费清单
             if (type == 1) {
                 List<ChargeFeeVo> chargeFeeVos = chargeFeeVoService.queryChargeFeeVoReprint(opId, YesNoEnum.NO.code.toString(), dcountDateD);
-                fomartChargeVo(chargeFeeVos, YesNoEnum.NO);
+                fomartChargeVo(chargeFeeVos, YesNoEnum.NO,YesNoEnum.NO);
                 ExcelUtil.exportExcelForChargeDetail(request, response, chargeFeeVos);
                 return null;
             }
@@ -440,10 +457,6 @@ public class ChargeFeeVoController {
             ExcelUtil.exportExcelForReqrec(request, response, reqrecVos);
             return null;
         } else if (type == 3 || type == 4) {
-//            if (hisData == null || StringUtils.isBlank(dcountDate) || StringUtils.isBlank(dcountDate2)) {
-//                return null;
-//            }
-//            YesNoEnum yesNoEnum = YesNoEnum.getYesNoByCode(hisData);
             Date dcountDateD = null;
             try {
                 dcountDateD = DateUtils.parseDate(dcountDate, "yyyy-MM-dd HH:mm:ss");
@@ -460,7 +473,7 @@ public class ChargeFeeVoController {
             }
             if (type == 3) {
                 List<ChargeFeeVo> chargeFeeVos = chargeFeeVoService.queryChargeFeeVoCollect(YesNoEnum.NO.code.toString(), dcountDateD, dcountDate2D);
-                fomartChargeVo(chargeFeeVos, YesNoEnum.YES);
+                fomartChargeVo(chargeFeeVos, YesNoEnum.YES,YesNoEnum.YES);
                 ExcelUtil.exportExcelForChargeDetail(request, response, chargeFeeVos);
                 return null;
             }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/vo/ChargeFeeVo.java

@@ -34,4 +34,6 @@ public class ChargeFeeVo {
     private String contractName;
     //合同编号
     private String contractNo;
+    //患者地址
+    private String address;
 }