|
@@ -15,14 +15,11 @@ import com.kcim.common.util.Result;
|
|
import com.kcim.common.util.UserContext;
|
|
import com.kcim.common.util.UserContext;
|
|
import com.kcim.common.constants.NumberConstant;
|
|
import com.kcim.common.constants.NumberConstant;
|
|
import com.kcim.common.util.excel.ExcelStyleUtil;
|
|
import com.kcim.common.util.excel.ExcelStyleUtil;
|
|
-import com.kcim.common.util.excel.entity.PatientItemImportEntity;
|
|
|
|
import com.kcim.common.util.excel.entity.ProductTemplateEntity;
|
|
import com.kcim.common.util.excel.entity.ProductTemplateEntity;
|
|
-import com.kcim.common.util.excel.handler.ItemTypeHandler;
|
|
|
|
import com.kcim.dao.model.*;
|
|
import com.kcim.dao.model.*;
|
|
import com.kcim.service.impl.DepartmentServiceImpl;
|
|
import com.kcim.service.impl.DepartmentServiceImpl;
|
|
import com.kcim.service.impl.ProductServiceImpl;
|
|
import com.kcim.service.impl.ProductServiceImpl;
|
|
import com.kcim.service.*;
|
|
import com.kcim.service.*;
|
|
-import com.kcim.vo.DictDataVo;
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -41,8 +38,6 @@ import java.net.URLEncoder;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import static com.kcim.common.constants.Constant.CHARGE_ITEM_TYPE;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 相关导入导出操作
|
|
* 相关导入导出操作
|
|
*/
|
|
*/
|
|
@@ -79,15 +74,19 @@ public class ExcelController extends AbstractController{
|
|
|
|
|
|
private final CostCostingCollectionService costCostingCollectionService;
|
|
private final CostCostingCollectionService costCostingCollectionService;
|
|
|
|
|
|
- private final AllocationService allocationServicel;
|
|
|
|
|
|
+ private final AllocationService allocationService;
|
|
|
|
|
|
private final CostDepartmentProfitService costDepartmentProfitService;
|
|
private final CostDepartmentProfitService costDepartmentProfitService;
|
|
|
|
|
|
|
|
+ private final CostShareLevelService shareLevelService;
|
|
|
|
+
|
|
public ExcelController(UserService userService, DepartmentServiceImpl departmentService, ProductServiceImpl productService,
|
|
public ExcelController(UserService userService, DepartmentServiceImpl departmentService, ProductServiceImpl productService,
|
|
AccountingService accountingService, AccountingProductService accountingProductService,
|
|
AccountingService accountingService, AccountingProductService accountingProductService,
|
|
ResponsibilityDepartmentService responsibilityDepartmentService,
|
|
ResponsibilityDepartmentService responsibilityDepartmentService,
|
|
CostShareParamService costShareParamService, CostIncomeGroupService costIncomeGroupService,
|
|
CostShareParamService costShareParamService, CostIncomeGroupService costIncomeGroupService,
|
|
- CostCostingGroupService costCostingGroupService, ShareParamValueService shareParamValueService, CostCostingCollectionService costCostingCollectionService, AllocationService allocationServicel, CostDepartmentProfitService costDepartmentProfitService) {
|
|
|
|
|
|
+ CostCostingGroupService costCostingGroupService, ShareParamValueService shareParamValueService,
|
|
|
|
+ CostCostingCollectionService costCostingCollectionService, AllocationService allocationService,
|
|
|
|
+ CostDepartmentProfitService costDepartmentProfitService, CostShareLevelService shareLevelService) {
|
|
this.userService = userService;
|
|
this.userService = userService;
|
|
this.departmentService = departmentService;
|
|
this.departmentService = departmentService;
|
|
this.productService = productService;
|
|
this.productService = productService;
|
|
@@ -99,8 +98,9 @@ public class ExcelController extends AbstractController{
|
|
this.costCostingGroupService = costCostingGroupService;
|
|
this.costCostingGroupService = costCostingGroupService;
|
|
this.shareParamValueService = shareParamValueService;
|
|
this.shareParamValueService = shareParamValueService;
|
|
this.costCostingCollectionService = costCostingCollectionService;
|
|
this.costCostingCollectionService = costCostingCollectionService;
|
|
- this.allocationServicel = allocationServicel;
|
|
|
|
|
|
+ this.allocationService = allocationService;
|
|
this.costDepartmentProfitService = costDepartmentProfitService;
|
|
this.costDepartmentProfitService = costDepartmentProfitService;
|
|
|
|
+ this.shareLevelService = shareLevelService;
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("用户导出模板设置")
|
|
@ApiOperation("用户导出模板设置")
|
|
@@ -313,11 +313,11 @@ public class ExcelController extends AbstractController{
|
|
@GetMapping("/getImportIncomeProductAccountTemplate")
|
|
@GetMapping("/getImportIncomeProductAccountTemplate")
|
|
public void getImportProductAccountTemplate(HttpServletResponse response,String token) throws IOException {
|
|
public void getImportProductAccountTemplate(HttpServletResponse response,String token) throws IOException {
|
|
Long hospId = UserContext.getHospId();
|
|
Long hospId = UserContext.getHospId();
|
|
- String uuid = UUID.randomUUID().toString();
|
|
|
|
- String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
|
- FileUtil.del(FileUtil.file(url));
|
|
|
|
|
|
+// String uuid = UUID.randomUUID().toString();
|
|
|
|
+// String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
|
+// FileUtil.del(FileUtil.file(url));
|
|
|
|
|
|
- ExcelWriter writer = new ExcelWriter(url);
|
|
|
|
|
|
+ ExcelWriter writer = new ExcelWriter();
|
|
// 样式
|
|
// 样式
|
|
Sheet sheet = writer.getSheet();
|
|
Sheet sheet = writer.getSheet();
|
|
// 内容
|
|
// 内容
|
|
@@ -332,9 +332,9 @@ public class ExcelController extends AbstractController{
|
|
"病人ID", "住院号/门诊号", "患者姓名", "病人费别", "收据费别", "数量", "单位", "金额", "费用发生时间"));
|
|
"病人ID", "住院号/门诊号", "患者姓名", "病人费别", "收据费别", "数量", "单位", "金额", "费用发生时间"));
|
|
int accountType = NumberConstant.ONE;
|
|
int accountType = NumberConstant.ONE;
|
|
int column = NumberConstant.FOUR;
|
|
int column = NumberConstant.FOUR;
|
|
- FileOutputStream outputStream = new FileOutputStream("E:\\收入数据导出模板设置.xlsx");
|
|
|
|
|
|
+// FileOutputStream outputStream = new FileOutputStream("E:\\收入数据导出模板设置.xlsx");
|
|
|
|
|
|
- getProductByAccountType(hospId, writer, accountType, column);
|
|
|
|
|
|
+// getProductByAccountType(hospId, writer, accountType, column);
|
|
writer.setColumnWidth(0, 20);
|
|
writer.setColumnWidth(0, 20);
|
|
writer.setColumnWidth(1, 20);
|
|
writer.setColumnWidth(1, 20);
|
|
writer.setColumnWidth(2, 10);
|
|
writer.setColumnWidth(2, 10);
|
|
@@ -352,8 +352,12 @@ public class ExcelController extends AbstractController{
|
|
writer.setColumnWidth(14, 10);
|
|
writer.setColumnWidth(14, 10);
|
|
writer.setColumnWidth(15, 10);
|
|
writer.setColumnWidth(15, 10);
|
|
writer.setColumnWidth(16, 15);
|
|
writer.setColumnWidth(16, 15);
|
|
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
|
|
|
+ response.setCharacterEncoding("UTF-8");
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
+ String fileName ="收入数据导入模板";
|
|
|
|
+ response.setHeader("Content-Disposition", URLEncoder.encode(fileName, "UTF-8"));
|
|
|
|
+// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
|
+// response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
ServletOutputStream out = null;
|
|
ServletOutputStream out = null;
|
|
out = response.getOutputStream();
|
|
out = response.getOutputStream();
|
|
writer.flush(out, true);
|
|
writer.flush(out, true);
|
|
@@ -372,11 +376,11 @@ public class ExcelController extends AbstractController{
|
|
// throw new CostException(500,"用户不存在");
|
|
// throw new CostException(500,"用户不存在");
|
|
// }
|
|
// }
|
|
Long hospId = UserContext.getHospId();
|
|
Long hospId = UserContext.getHospId();
|
|
- String uuid = UUID.randomUUID().toString();
|
|
|
|
- String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
|
- FileUtil.del(FileUtil.file(url));
|
|
|
|
|
|
+// String uuid = UUID.randomUUID().toString();
|
|
|
|
+// String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
|
+// FileUtil.del(FileUtil.file(url));
|
|
|
|
|
|
- ExcelWriter writer = new ExcelWriter(url);
|
|
|
|
|
|
+ ExcelWriter writer = new ExcelWriter();
|
|
// 样式
|
|
// 样式
|
|
// 所有科室里面对应存在责任中心对应的科室
|
|
// 所有科室里面对应存在责任中心对应的科室
|
|
List<Department> departmentLinkedList = getDepartments(hospId);
|
|
List<Department> departmentLinkedList = getDepartments(hospId);
|
|
@@ -406,8 +410,12 @@ public class ExcelController extends AbstractController{
|
|
getProductByAccountType(hospId, writer, accountType, column);
|
|
getProductByAccountType(hospId, writer, accountType, column);
|
|
writer.setColumnWidth(0, 15);
|
|
writer.setColumnWidth(0, 15);
|
|
writer.setColumnWidth(1, 15);
|
|
writer.setColumnWidth(1, 15);
|
|
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
|
|
|
+// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
|
+// response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
|
+ response.setCharacterEncoding("UTF-8");
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
+ String fileName ="成本数据导入模板";
|
|
|
|
+ response.setHeader("Content-Disposition", URLEncoder.encode(fileName, "UTF-8"));
|
|
ServletOutputStream out = null;
|
|
ServletOutputStream out = null;
|
|
out = response.getOutputStream();
|
|
out = response.getOutputStream();
|
|
writer.flush(out, true);
|
|
writer.flush(out, true);
|
|
@@ -451,15 +459,21 @@ public class ExcelController extends AbstractController{
|
|
// throw new CostException(500,"用户不存在");
|
|
// throw new CostException(500,"用户不存在");
|
|
// }
|
|
// }
|
|
Long hospId = UserContext.getHospId();
|
|
Long hospId = UserContext.getHospId();
|
|
- String uuid = UUID.randomUUID().toString();
|
|
|
|
- String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
|
- FileUtil.del(FileUtil.file(url));
|
|
|
|
- ExcelWriter writer = new ExcelWriter(url);
|
|
|
|
|
|
+// String uuid = UUID.randomUUID().toString();
|
|
|
|
+// String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
|
+// FileUtil.del(FileUtil.file(url));
|
|
|
|
+ ExcelWriter writer = new ExcelWriter();
|
|
Sheet sheet = writer.getSheet();
|
|
Sheet sheet = writer.getSheet();
|
|
- // 第几次分摊
|
|
|
|
- writer= allocationServicel.getShareReportTemplate(writer,levelSort,sheet,year,month,shareLevelId);
|
|
|
|
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
|
|
|
+
|
|
|
|
+ CostShareLevel service = shareLevelService.getById(shareLevelId); // 第几次分摊
|
|
|
|
+ writer= allocationService.getShareReportTemplate(writer,levelSort,sheet,year,month,shareLevelId);
|
|
|
|
+// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
|
+// response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
|
+
|
|
|
|
+ response.setCharacterEncoding("UTF-8");
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
+ String fileName = service.getShareName()+"分摊";
|
|
|
|
+ response.setHeader("Content-Disposition", URLEncoder.encode(fileName, "UTF-8"));
|
|
ServletOutputStream out = null;
|
|
ServletOutputStream out = null;
|
|
out = response.getOutputStream();
|
|
out = response.getOutputStream();
|
|
writer.flush(out, true);
|
|
writer.flush(out, true);
|
|
@@ -561,7 +575,7 @@ public class ExcelController extends AbstractController{
|
|
writer.passCurrentRow();
|
|
writer.passCurrentRow();
|
|
writer.merge(2, 2, 0, departmentCodeList.size()==0?3:departmentCodeList.size()+1, "医院成本分摊参数数据批量导入", false);
|
|
writer.merge(2, 2, 0, departmentCodeList.size()==0?3:departmentCodeList.size()+1, "医院成本分摊参数数据批量导入", false);
|
|
writer.passCurrentRow();
|
|
writer.passCurrentRow();
|
|
- writer.merge(3,3,2,departmentCodeList.size()==0?3:departmentCodeList.size()+1,"科室",false);
|
|
|
|
|
|
+ writer.merge(3,3,2,departmentCodeList.size()==0?3:departmentCodeList.size()+1,"科室",true);
|
|
writer.passCurrentRow();
|
|
writer.passCurrentRow();
|
|
departmentCodeList.add(0, null);
|
|
departmentCodeList.add(0, null);
|
|
departmentCodeList.add(1, null);
|
|
departmentCodeList.add(1, null);
|
|
@@ -579,17 +593,29 @@ public class ExcelController extends AbstractController{
|
|
}
|
|
}
|
|
writer.setColumnWidth(0, 15);
|
|
writer.setColumnWidth(0, 15);
|
|
writer.setColumnWidth(1, 22);
|
|
writer.setColumnWidth(1, 22);
|
|
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
|
|
|
+// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
|
+// response.setHeader("Content-Disposition", "attachment;filename=" + "成本分摊参数值导出模板" + ".xls");
|
|
|
|
+
|
|
|
|
+ response.setCharacterEncoding("UTF-8");
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
+ String fileName ="成本分摊参数值导入模板";
|
|
|
|
+ response.setHeader("Content-Disposition", URLEncoder.encode(fileName, "UTF-8"));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
ServletOutputStream out = null;
|
|
ServletOutputStream out = null;
|
|
|
|
+// FileOutputStream outputStream = new FileOutputStream("E:\\患者信息导入模版.xlsx");
|
|
out = response.getOutputStream();
|
|
out = response.getOutputStream();
|
|
writer.flush(out, true);
|
|
writer.flush(out, true);
|
|
writer.close();
|
|
writer.close();
|
|
IoUtil.close(out);
|
|
IoUtil.close(out);
|
|
}
|
|
}
|
|
private List<Department> getDepartments(Long hospId) {
|
|
private List<Department> getDepartments(Long hospId) {
|
|
|
|
+
|
|
|
|
+
|
|
List<Department> departmentLinkedList = new LinkedList<>();
|
|
List<Department> departmentLinkedList = new LinkedList<>();
|
|
- List<Department> departmentList = departmentService.list(new QueryWrapper<Department>().lambda().eq(Department::getHospId, hospId).orderByDesc(Department::getCreateTime));
|
|
|
|
|
|
+ List<Department> departmentList = departmentService.getDepartments();
|
|
|
|
+// List<Department> departmentList = departmentService.list(new QueryWrapper<Department>().lambda().eq(Department::getHospId, hospId).orderByDesc(Department::getCreateTime));
|
|
List<ResponsibilityDepartment> responsibilityDepartmentList = responsibilityDepartmentService.list(new QueryWrapper<ResponsibilityDepartment>().lambda()
|
|
List<ResponsibilityDepartment> responsibilityDepartmentList = responsibilityDepartmentService.list(new QueryWrapper<ResponsibilityDepartment>().lambda()
|
|
.eq(ResponsibilityDepartment::getHospId, hospId));
|
|
.eq(ResponsibilityDepartment::getHospId, hospId));
|
|
Map<Long, List<ResponsibilityDepartment>> responsibilityDepartmentMap = responsibilityDepartmentList.stream().collect(Collectors.groupingBy(ResponsibilityDepartment::getDepartmentId));
|
|
Map<Long, List<ResponsibilityDepartment>> responsibilityDepartmentMap = responsibilityDepartmentList.stream().collect(Collectors.groupingBy(ResponsibilityDepartment::getDepartmentId));
|