新增了结算导入
This commit is contained in:
parent
8a99d31e33
commit
94a668864c
@ -13,13 +13,18 @@ import net.lab1024.sa.admin.module.business.caseplatformcase.domain.form.Casepla
|
|||||||
import net.lab1024.sa.admin.module.business.caseplatformcase.domain.vo.EasyExcelCaseDetailVO;
|
import net.lab1024.sa.admin.module.business.caseplatformcase.domain.vo.EasyExcelCaseDetailVO;
|
||||||
import net.lab1024.sa.admin.module.business.caseplatformcase.domain.vo.ExportExpertCaseExcelVo;
|
import net.lab1024.sa.admin.module.business.caseplatformcase.domain.vo.ExportExpertCaseExcelVo;
|
||||||
import net.lab1024.sa.admin.module.business.caseplatformcase.service.CaseplatformCaseService;
|
import net.lab1024.sa.admin.module.business.caseplatformcase.service.CaseplatformCaseService;
|
||||||
|
import net.lab1024.sa.common.common.domain.ResponseDTO;
|
||||||
|
import net.lab1024.sa.common.common.exception.BusinessException;
|
||||||
import net.lab1024.sa.common.module.support.operatelog.annoation.OperateLog;
|
import net.lab1024.sa.common.module.support.operatelog.annoation.OperateLog;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
@ -43,6 +48,7 @@ public class CaseplatformCaseExcelController {
|
|||||||
private CaseplatformCaseService caseplatformCaseService;
|
private CaseplatformCaseService caseplatformCaseService;
|
||||||
|
|
||||||
// 病例管理导出
|
// 病例管理导出
|
||||||
|
@ApiOperation("病例管理导出")
|
||||||
@GetMapping("/caseplatformCase/exportEasyExcel")
|
@GetMapping("/caseplatformCase/exportEasyExcel")
|
||||||
public void exportEasyExcel(HttpServletResponse response, @Valid CaseplatformCaseQueryForm queryForm) {
|
public void exportEasyExcel(HttpServletResponse response, @Valid CaseplatformCaseQueryForm queryForm) {
|
||||||
try {
|
try {
|
||||||
@ -88,7 +94,8 @@ public class CaseplatformCaseExcelController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 结算导出
|
// 结算导出
|
||||||
@GetMapping("/caseplatformCase/exportExpertCaseExcel")
|
@ApiOperation("结算导出")
|
||||||
|
@GetMapping("/caseplatformCase/settlementExcel")
|
||||||
public void exportExpertCaseExcel(HttpServletResponse response, @Valid CaseplatformCaseQueryForm queryForm) {
|
public void exportExpertCaseExcel(HttpServletResponse response, @Valid CaseplatformCaseQueryForm queryForm) {
|
||||||
try {
|
try {
|
||||||
List<ExportExpertCaseExcelVo> list = caseplatformCaseService.exportExpertCaseExcel(queryForm);
|
List<ExportExpertCaseExcelVo> list = caseplatformCaseService.exportExpertCaseExcel(queryForm);
|
||||||
@ -100,7 +107,7 @@ public class CaseplatformCaseExcelController {
|
|||||||
List<List<String>> head = new ArrayList<>();
|
List<List<String>> head = new ArrayList<>();
|
||||||
List<String> titleRow = new ArrayList<>();
|
List<String> titleRow = new ArrayList<>();
|
||||||
titleRow.add("人工肝诊疗病例征集项目专家劳务费表");
|
titleRow.add("人工肝诊疗病例征集项目专家劳务费表");
|
||||||
for (int i = 0; i < 12; i++) { // 假设你总共有 13 列(从"序号"到"身份证号")
|
for (int i = 0; i < 13; i++) { // 假设你总共有 13 列(从"序号"到"身份证号")
|
||||||
if (i > 0) titleRow.add("");
|
if (i > 0) titleRow.add("");
|
||||||
}
|
}
|
||||||
head.add(titleRow);
|
head.add(titleRow);
|
||||||
@ -108,7 +115,7 @@ public class CaseplatformCaseExcelController {
|
|||||||
// 2. 添加第二行字段标题(正常列头)
|
// 2. 添加第二行字段标题(正常列头)
|
||||||
List<String> headerRow = Arrays.asList(
|
List<String> headerRow = Arrays.asList(
|
||||||
"序号", "银行", "账号所在省份", "账户所在地市",
|
"序号", "银行", "账号所在省份", "账户所在地市",
|
||||||
"卡号", "姓名", "实发", "备注", "个税", "应发", "单位", "电话", "身份证号"
|
"卡号", "姓名", "实发", "备注", "个税", "应发", "单位", "电话", "身份证号", "关联病例"
|
||||||
);
|
);
|
||||||
head.add(headerRow);
|
head.add(headerRow);
|
||||||
|
|
||||||
@ -149,4 +156,16 @@ public class CaseplatformCaseExcelController {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("结算导入")
|
||||||
|
@PostMapping("/caseplatformCase/settlementImport")
|
||||||
|
public ResponseDTO<T> caseplatformCaseSettlementImport(@RequestParam("file") MultipartFile file) {
|
||||||
|
try {
|
||||||
|
caseplatformCaseService.caseplatformCaseSettlementImport(file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BusinessException(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseDTO.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,4 +50,5 @@ public class CaseplatformExpertWhiteController {
|
|||||||
public ResponseDTO<PageResult<GetCaseplatformExpertWhitePageVo>> getCaseplatformExpertWhitePage(@RequestBody @Valid CaseplatformExpertWhiteQueryForm queryForm) {
|
public ResponseDTO<PageResult<GetCaseplatformExpertWhitePageVo>> getCaseplatformExpertWhitePage(@RequestBody @Valid CaseplatformExpertWhiteQueryForm queryForm) {
|
||||||
return caseplatformExpertWhiteService.queryPage(queryForm);
|
return caseplatformExpertWhiteService.queryPage(queryForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import net.lab1024.sa.admin.module.app.expert.admin.ExpertWhiteEntity;
|
import net.lab1024.sa.admin.module.app.expert.admin.ExpertWhiteEntity;
|
||||||
|
import net.lab1024.sa.admin.module.app.expert.dao.CasePlatformBankDao;
|
||||||
import net.lab1024.sa.admin.module.app.expert.dao.ExpertWhiteEntityDao;
|
import net.lab1024.sa.admin.module.app.expert.dao.ExpertWhiteEntityDao;
|
||||||
|
import net.lab1024.sa.admin.module.app.expert.domain.entity.CasePlatformBankEntity;
|
||||||
import net.lab1024.sa.admin.module.business.area.domain.vo.ProvVO;
|
import net.lab1024.sa.admin.module.business.area.domain.vo.ProvVO;
|
||||||
import net.lab1024.sa.admin.module.business.caseplatformcase.dao.CaseplatformCaseDao;
|
import net.lab1024.sa.admin.module.business.caseplatformcase.dao.CaseplatformCaseDao;
|
||||||
import net.lab1024.sa.admin.module.business.caseplatformcase.domain.entity.CaseplatformCaseEntity;
|
import net.lab1024.sa.admin.module.business.caseplatformcase.domain.entity.CaseplatformCaseEntity;
|
||||||
@ -78,6 +80,9 @@ public class CaseplatformCaseService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ExpertWhiteEntityDao expertWhiteDao;
|
private ExpertWhiteEntityDao expertWhiteDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CasePlatformBankDao casePlatformBankDao;
|
||||||
|
|
||||||
// 创建 ObjectMapper 实例(建议使用 Spring 注入或静态常量)
|
// 创建 ObjectMapper 实例(建议使用 Spring 注入或静态常量)
|
||||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
@ -152,6 +157,7 @@ public class CaseplatformCaseService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理 结算导出 数据
|
||||||
public List<ExportExpertCaseExcelVo> exportExpertCaseExcelProcess(List<ExportExpertCaseExcelVo> list) {
|
public List<ExportExpertCaseExcelVo> exportExpertCaseExcelProcess(List<ExportExpertCaseExcelVo> list) {
|
||||||
// 存放 expertId -> ExportExpertCaseExcelVo 列表
|
// 存放 expertId -> ExportExpertCaseExcelVo 列表
|
||||||
Map<Long, List<ExportExpertCaseExcelVo>> expertMap = new HashMap<>();
|
Map<Long, List<ExportExpertCaseExcelVo>> expertMap = new HashMap<>();
|
||||||
@ -223,6 +229,95 @@ public class CaseplatformCaseService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 结算导入
|
||||||
|
public void caseplatformCaseSettlementImport(MultipartFile file) throws Exception {
|
||||||
|
try (InputStream is = file.getInputStream();
|
||||||
|
Workbook workbook = WorkbookFactory.create(is)) { // 自动识别 .xls 或 .xlsx
|
||||||
|
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
|
||||||
|
// 从第 1 行开始读取(跳过标题行)
|
||||||
|
int rowNum = 0;
|
||||||
|
for (Iterator<Row> it = sheet.rowIterator(); it.hasNext();) {
|
||||||
|
Row row = it.next();
|
||||||
|
|
||||||
|
// 跳过第一行
|
||||||
|
if (rowNum++ == 0 || rowNum++ == 1) continue;
|
||||||
|
|
||||||
|
// 判断整行是否为空
|
||||||
|
boolean isEmptyRow = true;
|
||||||
|
for (Cell cell : row) {
|
||||||
|
if (cell != null && cell.getCellType() != CellType.BLANK) {
|
||||||
|
isEmptyRow = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEmptyRow) {
|
||||||
|
continue; // 跳过空行
|
||||||
|
}
|
||||||
|
|
||||||
|
String name = "";
|
||||||
|
String bankName = "";
|
||||||
|
String prov = "";
|
||||||
|
String city = "";
|
||||||
|
String bankCardNo = "";
|
||||||
|
String actualAmountStr = "";
|
||||||
|
String remark = "";
|
||||||
|
String taxAmountStr = "";
|
||||||
|
String totalAmountStr = "";
|
||||||
|
String hospitalName = "";
|
||||||
|
String mobile = "";
|
||||||
|
String idCardNo = "";
|
||||||
|
String relatedCaseId = "";
|
||||||
|
|
||||||
|
DataFormatter dataFormatter = new DataFormatter();
|
||||||
|
|
||||||
|
Cell cell0 = row.getCell(0); if (cell0 != null) name = cell0.toString().trim();
|
||||||
|
Cell cell1 = row.getCell(1); if (cell1 != null) bankName = cell1.toString().trim();
|
||||||
|
Cell cell2 = row.getCell(2); if (cell2 != null) prov = cell2.toString().trim();
|
||||||
|
Cell cell3 = row.getCell(3); if (cell3 != null) city = cell3.toString().trim();
|
||||||
|
Cell cell4 = row.getCell(4); if (cell4 != null) bankCardNo = cell4.toString().trim();
|
||||||
|
Cell cell5 = row.getCell(5); if (cell5 != null) actualAmountStr = dataFormatter.formatCellValue(cell5).trim();
|
||||||
|
Cell cell6 = row.getCell(6); if (cell6 != null) remark = cell6.toString().trim();
|
||||||
|
Cell cell7 = row.getCell(7); if (cell7 != null) taxAmountStr = dataFormatter.formatCellValue(cell7).trim();
|
||||||
|
Cell cell8 = row.getCell(8); if (cell8 != null) totalAmountStr = dataFormatter.formatCellValue(cell8).trim();
|
||||||
|
Cell cell9 = row.getCell(9); if (cell9 != null) hospitalName = cell9.toString().trim();
|
||||||
|
Cell cell10 = row.getCell(10); if (cell10 != null) mobile = dataFormatter.formatCellValue(cell10).trim();
|
||||||
|
Cell cell11 = row.getCell(11); if (cell11 != null) idCardNo = dataFormatter.formatCellValue(cell11).trim();
|
||||||
|
Cell cell12 = row.getCell(11); if (cell11 != null) relatedCaseId = dataFormatter.formatCellValue(cell12).trim();
|
||||||
|
|
||||||
|
// 病例id
|
||||||
|
String[] caseIdList = relatedCaseId.split(",");
|
||||||
|
for (String id : caseIdList) {
|
||||||
|
CaseplatformCaseEntity caseplatformCase = caseplatformCaseDao.selectById(id);
|
||||||
|
if (caseplatformCase == null) {
|
||||||
|
throw new BusinessException("处理失败: 存在非法病例 " + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取专家银行卡
|
||||||
|
LambdaQueryWrapper<CasePlatformBankEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CasePlatformBankEntity::getExpertId, caseplatformCase.getExpertId());
|
||||||
|
CasePlatformBankEntity casePlatformBank = casePlatformBankDao.selectOne(queryWrapper);
|
||||||
|
if (casePlatformBank == null) {
|
||||||
|
throw new BusinessException("处理失败: 存在非法病例 " + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(casePlatformBank.getBankCardNo(), bankCardNo)){
|
||||||
|
throw new BusinessException("处理失败: 存在非法病例 " + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改病例结算状态
|
||||||
|
caseplatformCase.setSettlementFlag(1);
|
||||||
|
caseplatformCase.setUpdateTime(LocalDateTime.now());
|
||||||
|
caseplatformCaseDao.updateById(caseplatformCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BusinessException("文件读取失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 添加
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user