大病互助
This commit is contained in:
@@ -6,15 +6,19 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import io.v.nutz.annontation.ViReturn;
|
import io.v.nutz.annontation.ViReturn;
|
||||||
import io.v.nutz.sickHelp.model.SickHelp;
|
import io.v.nutz.sickHelp.model.SickHelp;
|
||||||
|
import io.v.nutz.sickHelp.model.SickHelpMedicalIns;
|
||||||
import io.v.nutz.sickHelp.service.SickHelpImportService;
|
import io.v.nutz.sickHelp.service.SickHelpImportService;
|
||||||
import io.v.nutz.util.ViTool;
|
import io.v.nutz.util.ViTool;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.lang.Lang;
|
import org.nutz.lang.Lang;
|
||||||
@@ -28,6 +32,7 @@ import org.nutz.mvc.upload.UploadAdaptor;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@IocBean
|
@IocBean
|
||||||
@At("/platform/sickHelp/import")
|
@At("/platform/sickHelp/import")
|
||||||
@@ -51,6 +56,8 @@ public class SickHelpImportController {
|
|||||||
// excelTemplateEntityList.add(new ExcelExportEntity("补助比例", "", 20));
|
// excelTemplateEntityList.add(new ExcelExportEntity("补助比例", "", 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
@Inject
|
@Inject
|
||||||
private SickHelpImportService sickHelpImportService;
|
private SickHelpImportService sickHelpImportService;
|
||||||
|
|
||||||
@@ -186,4 +193,27 @@ public class SickHelpImportController {
|
|||||||
return sickHelpImportService.dao().fetch(SickHelp.class, id);
|
return sickHelpImportService.dao().fetch(SickHelp.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At("/convertIns")
|
||||||
|
@Ok("json:full")
|
||||||
|
@RequiresPermissions("sickHelp.import.excel")
|
||||||
|
public Result convertIns(){
|
||||||
|
List<SickHelpMedicalIns> insList = dao.query(SickHelpMedicalIns.class, Cnd.where("year", "=", DateUtil.thisYear() - 1));
|
||||||
|
|
||||||
|
List<SickHelp> collect = insList.stream().map(v -> {
|
||||||
|
SickHelp sickHelp = new SickHelp();
|
||||||
|
sickHelp.setYear(v.getYear());
|
||||||
|
sickHelp.setLoginName(v.getLoginName());
|
||||||
|
sickHelp.setUserName(v.getUserName());
|
||||||
|
sickHelp.setMedicalFourTotalMoney(v.getSxzf());
|
||||||
|
sickHelp.setSelfPayTotalMoney(v.getLxzf());
|
||||||
|
sickHelp.setSchoolSecondSubsidyMoney(v.getEcbx());
|
||||||
|
sickHelp.setSelfPayMoney(v.getCalc());
|
||||||
|
return sickHelp;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<SickHelp> sickHelps = sickHelpImportService.checkData(collect);
|
||||||
|
return Result.success(sickHelps);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,335 @@
|
|||||||
|
package io.v.nutz.sickHelp.controller;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||||
|
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.wizzer.framework.base.Result;
|
||||||
|
import io.v.nutz.base.page.Pagination;
|
||||||
|
import io.v.nutz.modules.models.PageForm;
|
||||||
|
import io.v.nutz.sickHelp.model.SickHelpMedicalIns;
|
||||||
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
|
import io.v.nutz.util.ViTool;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
|
import org.nutz.dao.Sqls;
|
||||||
|
import org.nutz.dao.sql.Sql;
|
||||||
|
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||||
|
import org.nutz.ioc.aop.Aop;
|
||||||
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
|
import org.nutz.mvc.annotation.AdaptBy;
|
||||||
|
import org.nutz.mvc.annotation.At;
|
||||||
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
import org.nutz.mvc.upload.TempFile;
|
||||||
|
import org.nutz.mvc.upload.UploadAdaptor;
|
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@IocBean
|
||||||
|
@At("/platform/sickHelp/medicalIns")
|
||||||
|
@Ok("json:full")
|
||||||
|
public class SickHelpMedicalInsController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
@Inject
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
|
@At("")
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
@Ok("beetl:/platform/sickHelp/medicalIns/index.html")
|
||||||
|
public void index() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
public Result importIns(@Param("file") TempFile tempFile) {
|
||||||
|
if (ObjectUtil.isEmpty(tempFile)) {
|
||||||
|
return Result.error("excel为空");
|
||||||
|
}
|
||||||
|
if (!tempFile.getFile().getName().endsWith(".xlsx")) {
|
||||||
|
return Result.error("请上传xlsx格式的excel文件");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SickHelpMedicalIns> list = ExcelImportUtil.importExcel(tempFile.getFile(), SickHelpMedicalIns.class, new ImportParams());
|
||||||
|
|
||||||
|
// 按身份证分组并聚合数据 过滤出四项之和大于10000的
|
||||||
|
List<SickHelpMedicalIns> aggregatedData = list.stream()
|
||||||
|
.collect(Collectors.groupingBy(SickHelpMedicalIns::getIdCard))
|
||||||
|
.entrySet().stream()
|
||||||
|
.map(entry -> {
|
||||||
|
List<SickHelpMedicalIns> group = entry.getValue();
|
||||||
|
SickHelpMedicalIns aggregated = new SickHelpMedicalIns();
|
||||||
|
aggregated.setUserName(group.get(0).getUserName());
|
||||||
|
aggregated.setIdCard(entry.getKey());
|
||||||
|
|
||||||
|
aggregated.setZhzl(group.stream().map(SickHelpMedicalIns::getZhzl).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
aggregated.setZhzf(group.stream().map(SickHelpMedicalIns::getZhzf).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
aggregated.setXjzl(group.stream().map(SickHelpMedicalIns::getXjzl).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
aggregated.setXjzf(group.stream().map(SickHelpMedicalIns::getXjzf).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
aggregated.setSxzf(aggregated.getZhzl()
|
||||||
|
.add(aggregated.getZhzf())
|
||||||
|
.add(aggregated.getXjzl())
|
||||||
|
.add(aggregated.getXjzf()));
|
||||||
|
aggregated.setLxzf(aggregated.getZhzf().add(aggregated.getXjzf()));
|
||||||
|
|
||||||
|
return aggregated;
|
||||||
|
})
|
||||||
|
.filter(data -> data.getSxzf().compareTo(BigDecimal.valueOf(10000)) > 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
t1.loginName,
|
||||||
|
t1.userName,
|
||||||
|
t2.idcard AS idCard
|
||||||
|
FROM
|
||||||
|
sick_fund_member t1
|
||||||
|
LEFT JOIN sys_user t2 ON t2.loginname = t1.loginName
|
||||||
|
""");
|
||||||
|
sql.setCallback(Sqls.callback.maps());
|
||||||
|
dao.execute(sql);
|
||||||
|
List<NutMap> userList = sql.getList(NutMap.class);
|
||||||
|
for (SickHelpMedicalIns ins : aggregatedData) {
|
||||||
|
String idCard = ins.getIdCard();
|
||||||
|
String userName = ins.getUserName();
|
||||||
|
ins.setYear(DateUtil.thisYear() - 1);
|
||||||
|
// 先通过身份证匹配用户
|
||||||
|
Optional<NutMap> idCardOptional = userList.stream().filter(v -> v.getString("idCard", "").equals(idCard)).findFirst();
|
||||||
|
if (idCardOptional.isPresent()) {
|
||||||
|
ins.setUserId(idCardOptional.get().getString("id"));
|
||||||
|
ins.setLoginName(idCardOptional.get().getString("loginName"));
|
||||||
|
ins.setUserName(idCardOptional.get().getString("userName"));
|
||||||
|
ins.setUserId(idCardOptional.get().getString("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有匹配到用户,则通过姓名匹配用户
|
||||||
|
if (idCardOptional.isEmpty()) {
|
||||||
|
if (StrUtil.isNotBlank(userName) && userName.equals("徐为民")) {
|
||||||
|
System.out.println(1);
|
||||||
|
}
|
||||||
|
Optional<NutMap> userNameOptional = userList.stream().filter(v -> v.getString("userName", "").equals(userName)).findFirst();
|
||||||
|
if (userNameOptional.isPresent()) {
|
||||||
|
ins.setUserId(userNameOptional.get().getString("id"));
|
||||||
|
ins.setLoginName(userNameOptional.get().getString("loginName"));
|
||||||
|
ins.setUserName(userNameOptional.get().getString("userName"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 再次过滤
|
||||||
|
List<SickHelpMedicalIns> successData = aggregatedData.stream().filter(v -> StrUtil.isNotBlank(v.getLoginName())).collect(Collectors.toList());
|
||||||
|
List<SickHelpMedicalIns> failData = aggregatedData.stream().filter(v -> StrUtil.isBlank(v.getLoginName())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
dao.clear(SickHelpMedicalIns.class, Cnd.where("year", "=", DateUtil.thisYear() - 1));
|
||||||
|
dao.insert(successData);
|
||||||
|
|
||||||
|
HashMap<String, Object> hashMap = new HashMap<>();
|
||||||
|
hashMap.put("total", aggregatedData.size());
|
||||||
|
hashMap.put("success", successData.size());
|
||||||
|
hashMap.put("fail", failData.size());
|
||||||
|
hashMap.put("totalData", aggregatedData);
|
||||||
|
hashMap.put("failData", failData);
|
||||||
|
return Result.success(hashMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
public Result importEc(@Param("file") TempFile tempFile) {
|
||||||
|
if (ObjectUtil.isEmpty(tempFile)) {
|
||||||
|
return Result.error("excel为空");
|
||||||
|
}
|
||||||
|
if (!tempFile.getFile().getName().endsWith(".xlsx")) {
|
||||||
|
return Result.error("请上传xlsx格式的excel文件");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SickHelpMedicalIns> excelList = ExcelImportUtil.importExcel(tempFile.getFile(), SickHelpMedicalIns.class, new ImportParams());
|
||||||
|
List<SickHelpMedicalIns> list = dao.query(SickHelpMedicalIns.class, Cnd.where("year", "=", DateUtil.thisYear() - 1));
|
||||||
|
|
||||||
|
int success = 0;
|
||||||
|
|
||||||
|
List<SickHelpMedicalIns> failData = new ArrayList<>();
|
||||||
|
|
||||||
|
for (SickHelpMedicalIns ins : list) {
|
||||||
|
if (StrUtil.isNotBlank(ins.getLoginName())) {
|
||||||
|
Optional<SickHelpMedicalIns> optional = excelList.stream().filter(x -> x.getLoginName().equals(ins.getLoginName())).findFirst();
|
||||||
|
if (optional.isPresent()) {
|
||||||
|
ins.setEcbx(optional.get().getEcbx());
|
||||||
|
BigDecimal subtract = ins.getSxzf().subtract(optional.get().getEcbx());
|
||||||
|
ins.setCalc(subtract);
|
||||||
|
success += 1;
|
||||||
|
} else {
|
||||||
|
failData.add(ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
dao.update(list, "ecbx|calc");
|
||||||
|
HashMap<String, Object> hashMap = new HashMap<>();
|
||||||
|
hashMap.put("success", success);
|
||||||
|
hashMap.put("fail", failData.size());
|
||||||
|
hashMap.put("totalData", excelList);
|
||||||
|
hashMap.put("failData", failData);
|
||||||
|
|
||||||
|
return Result.success(hashMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
public Result pageData(PageForm pageForm, Integer year, String dataCheck) {
|
||||||
|
Sql sql = Sqls.create("select * from sick_help_medical_ins $condition");
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
cnd.asc("ecbx");
|
||||||
|
cnd.asc("loginName");
|
||||||
|
cnd.andEX("year", "=", year);
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(dataCheck)) {
|
||||||
|
if (dataCheck.equals("1")) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
seg.or("loginName", "is", null);
|
||||||
|
seg.or("loginName", "=", "");
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
if (dataCheck.equals("2")) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
seg.or("ecbx", "is", null);
|
||||||
|
seg.or("ecbx", "=", "");
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
seg.orLike("loginName", pageForm.getSearchKeyword());
|
||||||
|
seg.orLike("userName", pageForm.getSearchKeyword());
|
||||||
|
seg.orLike("idCard", pageForm.getSearchKeyword());
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
sql.setCondition(cnd);
|
||||||
|
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||||
|
return Result.success(pagination);
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
public Result delete(String id) {
|
||||||
|
dao.delete(SickHelpMedicalIns.class, id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
public Result update(SickHelpMedicalIns ins) {
|
||||||
|
dao.updateIgnoreNull(ins);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
public Result queryUser(String query) {
|
||||||
|
Sql sql = Sqls.create("select id,loginname,username from `user` $condition limit 0,10");
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
seg.orLike("loginname", query);
|
||||||
|
seg.orLike("username", query);
|
||||||
|
cnd.and(seg);
|
||||||
|
sql.setCondition(cnd);
|
||||||
|
List<NutMap> list = sysUserService.listMap(sql);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否还有错误的医保数据
|
||||||
|
*/
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
public Result checkIns() {
|
||||||
|
int count = dao.count(SickHelpMedicalIns.class, Cnd.where("year", "=", DateUtil.thisYear() - 1)
|
||||||
|
.and("loginName", "is", null));
|
||||||
|
if (count > 0) {
|
||||||
|
return Result.error("医保数据还有" + count + "条未核对正确,请先核对!");
|
||||||
|
}
|
||||||
|
|
||||||
|
int fullCount = dao.count(SickHelpMedicalIns.class, Cnd.where("year", "=", DateUtil.thisYear() - 1));
|
||||||
|
if (fullCount == 0) {
|
||||||
|
return Result.success("医保数据未导入!");
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
public Result checkEc() {
|
||||||
|
int count = dao.count(SickHelpMedicalIns.class, Cnd.where("year", "=", DateUtil.thisYear() - 1)
|
||||||
|
.and("ecbx", "is", null));
|
||||||
|
if (count > 0) {
|
||||||
|
return Result.error("二次报销数据还有" + count + "条未核对正确,请先核对!");
|
||||||
|
}
|
||||||
|
int fullCount = dao.count(SickHelpMedicalIns.class, Cnd.where("year", "=", DateUtil.thisYear() - 1));
|
||||||
|
if (fullCount == 0) {
|
||||||
|
return Result.success("二次报销数据未导入!");
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@RequiresPermissions("sickHelp.medicalIns")
|
||||||
|
@Ok("void")
|
||||||
|
public Result exportXlsx(int year, HttpServletResponse response) {
|
||||||
|
List<SickHelpMedicalIns> list = dao.query(SickHelpMedicalIns.class, Cnd.where("year", "=", year));
|
||||||
|
|
||||||
|
List<ExcelExportEntity> entities = new ArrayList<>();
|
||||||
|
entities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||||
|
entities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||||
|
entities.add(new ExcelExportEntity("身份证号码", "idCard", 30));
|
||||||
|
entities.add(new ExcelExportEntity("账户自理", "zhzl", 20));
|
||||||
|
entities.add(new ExcelExportEntity("账户自付", "zhzf", 20));
|
||||||
|
entities.add(new ExcelExportEntity("现金自理", "xjzl", 20));
|
||||||
|
entities.add(new ExcelExportEntity("现金自付", "xjzf", 20));
|
||||||
|
entities.add(new ExcelExportEntity("四项之和", "sxzf", 20));
|
||||||
|
entities.add(new ExcelExportEntity("两项之和", "lxzf", 20));
|
||||||
|
entities.add(new ExcelExportEntity("学校二次报销", "ecbx", 20));
|
||||||
|
entities.add(new ExcelExportEntity("补助计算额度", "calc", 20));
|
||||||
|
|
||||||
|
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||||
|
ViTool.excelResponse(response, year + "医保数据.xlsx");
|
||||||
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entities, list);
|
||||||
|
workbook.write(outputStream);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package io.v.nutz.sickHelp.model;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
|
import cn.wizzer.framework.base.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.nutz.dao.entity.annotation.*;
|
||||||
|
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Table
|
||||||
|
@Comment("大病互助医保数据")
|
||||||
|
@Data
|
||||||
|
public class SickHelpMedicalIns extends BaseModel {
|
||||||
|
|
||||||
|
@Name
|
||||||
|
@Comment("id")
|
||||||
|
@PrevInsert(uu32 = true)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR)
|
||||||
|
@Comment("用户id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR)
|
||||||
|
@Comment("工号")
|
||||||
|
@Excel(name = "工号")
|
||||||
|
private String loginName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR)
|
||||||
|
@Comment("人员姓名")
|
||||||
|
@Excel(name = "人员姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR)
|
||||||
|
@Comment("身份证号")
|
||||||
|
@Excel(name = "身份证号")
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
@Comment("账户自理")
|
||||||
|
@Excel(name = "账户自理")
|
||||||
|
private BigDecimal zhzl;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
@Comment("账户自付")
|
||||||
|
@Excel(name = "账户自付")
|
||||||
|
private BigDecimal zhzf;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
@Comment("现金自理")
|
||||||
|
@Excel(name = "现金自理")
|
||||||
|
private BigDecimal xjzl;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
@Comment("现金自付")
|
||||||
|
@Excel(name = "现金自付")
|
||||||
|
private BigDecimal xjzf;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
@Comment("四项之和金额")
|
||||||
|
@Excel(name = "两项自付之和金额")
|
||||||
|
private BigDecimal sxzf;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
@Comment("两项自付之和金额")
|
||||||
|
@Excel(name = "两项自付之和金额")
|
||||||
|
private BigDecimal lxzf;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
@Comment("学校二次报销金额")
|
||||||
|
@Excel(name = "学校二次报销金额")
|
||||||
|
private BigDecimal ecbx;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
@Comment("补助计算额度")
|
||||||
|
@Excel(name = "补助计算额度")
|
||||||
|
private BigDecimal calc;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.INT)
|
||||||
|
@Comment("年份")
|
||||||
|
private Integer year;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wp-upload-vue/font/iconfont.css">
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wp-upload-vue/font/iconfont.css">
|
||||||
<link rel="stylesheet" href="${base!}/assets/platform/plugins/video/css/video-js.min.css">
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/video/css/video-js.min.css">
|
||||||
<link rel="stylesheet" href="${base!}/assets/platform/css/vivify.min.css">
|
<link rel="stylesheet" href="${base!}/assets/platform/css/vivify.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window._AMapSecurityConfig = {
|
window._AMapSecurityConfig = {
|
||||||
|
|||||||
@@ -97,9 +97,12 @@ layout("/layouts/platform.html"){
|
|||||||
<!-- <el-input v-model="row.unitName" maxlength="10" size="small"></el-input>-->
|
<!-- <el-input v-model="row.unitName" maxlength="10" size="small"></el-input>-->
|
||||||
<!-- </template>-->
|
<!-- </template>-->
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="医保四项之和金额(元)" prop="medicalFourTotalMoney" width="200"></el-table-column>
|
<el-table-column label="医保四项之和金额(元)" prop="medicalFourTotalMoney"
|
||||||
<el-table-column label="两项自付之和金额(元)" prop="selfPayTotalMoney" width="200"></el-table-column>
|
width="200"></el-table-column>
|
||||||
<el-table-column label="学校二次报销金额(元)" prop="schoolSecondSubsidyMoney" width="200"></el-table-column>
|
<el-table-column label="两项自付之和金额(元)" prop="selfPayTotalMoney"
|
||||||
|
width="200"></el-table-column>
|
||||||
|
<el-table-column label="学校二次报销金额(元)" prop="schoolSecondSubsidyMoney"
|
||||||
|
width="200"></el-table-column>
|
||||||
<el-table-column label="个人支付金额(元)" prop="selfPayMoney" width="200"></el-table-column>
|
<el-table-column label="个人支付金额(元)" prop="selfPayMoney" width="200"></el-table-column>
|
||||||
<el-table-column label="未补助年份" prop="noSubsidyYear" width="200"></el-table-column>
|
<el-table-column label="未补助年份" prop="noSubsidyYear" width="200"></el-table-column>
|
||||||
<el-table-column label="计算金额(元)" prop="noLimitSubsidyMoney" width="200"></el-table-column>
|
<el-table-column label="计算金额(元)" prop="noLimitSubsidyMoney" width="200"></el-table-column>
|
||||||
@@ -274,6 +277,29 @@ layout("/layouts/platform.html"){
|
|||||||
})
|
})
|
||||||
return sums
|
return sums
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
const mode = GetQueryString("mode")
|
||||||
|
if (mode && mode === 'ins') {
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: '读取医保、二次报销数据中',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
});
|
||||||
|
|
||||||
|
$.post('/platform/sickHelp/import/convertIns').then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
this.tableLoading = false
|
||||||
|
this.tableData = res.data
|
||||||
|
} else {
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
}
|
||||||
|
}).always(() => {
|
||||||
|
loading.close()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
const ecImport = {
|
||||||
|
template: /*language=HTML*/ `
|
||||||
|
<el-dialog :visible.sync="importVisible" title="导入学校二次报销金额数据" width="50%"
|
||||||
|
class="medical-import-dialog">
|
||||||
|
<div class="import-container">
|
||||||
|
|
||||||
|
<div class="template-download">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-download"
|
||||||
|
@click="downloadTemplate"
|
||||||
|
size="small">
|
||||||
|
下载导入模板
|
||||||
|
</el-button>
|
||||||
|
<span class="template-tip">请按照模板格式填写数据后上传</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center upload-area" v-loading="importLoading" element-loading-text="数据导入中">
|
||||||
|
<el-upload
|
||||||
|
class="mt10"
|
||||||
|
:action="uploadUrl"
|
||||||
|
:auto-upload="true"
|
||||||
|
:file-list="files"
|
||||||
|
:limit="1"
|
||||||
|
:on-exceed="()=>{this.notifyWarning('只能上传一个文件')}"
|
||||||
|
:on-progress="handleProgress"
|
||||||
|
:on-remove="(f,fl)=>{fileList = fl;}"
|
||||||
|
:on-success="handleSuccess"
|
||||||
|
accept=".xls,.xlsx"
|
||||||
|
drag
|
||||||
|
ref="excelUpload">
|
||||||
|
<i class="el-icon-upload"></i>
|
||||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="import-results" v-if="importResult">
|
||||||
|
<el-card shadow="never" class="result-card">
|
||||||
|
<div slot="header" class="result-header">
|
||||||
|
<span>导入结果</span>
|
||||||
|
</div>
|
||||||
|
<div class="result-content">
|
||||||
|
<div class="result-item">
|
||||||
|
<span class="result-label">匹配成功数据数:</span>
|
||||||
|
<span class="result-value success">
|
||||||
|
{{ importResult.success || 0 }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="result-item">
|
||||||
|
<span class="result-label">匹配失败数据数:</span>
|
||||||
|
<span class="result-value warning">
|
||||||
|
{{ importResult.fail || 0 }}
|
||||||
|
<el-tooltip content="下载匹配失败数据" placement="top">
|
||||||
|
<i class="el-icon-download download-icon" @click="exportExcel('fail')"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
`,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
files: [],
|
||||||
|
fileList: [],
|
||||||
|
uploadUrl: loc() + '/importEc',
|
||||||
|
importVisible: false,
|
||||||
|
importData: {},
|
||||||
|
importLoading: false,
|
||||||
|
importResult: {
|
||||||
|
totalData: [],
|
||||||
|
successData: [],
|
||||||
|
failData: [],
|
||||||
|
total: 0,
|
||||||
|
success: 0,
|
||||||
|
fail: 0
|
||||||
|
},
|
||||||
|
excelKeyMap: {
|
||||||
|
"userName": '姓名',
|
||||||
|
"loginName": '工号',
|
||||||
|
"ecbx": '学校二次报销金额'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onOpen() {
|
||||||
|
this.importVisible = true
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSuccess(resp) {
|
||||||
|
this.importLoading = false
|
||||||
|
if (resp.code === 0) {
|
||||||
|
this.$message.success('导入成功')
|
||||||
|
this.importResult = resp.data
|
||||||
|
this.$emit('refresh', null)
|
||||||
|
} else {
|
||||||
|
this.$message.error('导入失败')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleProgress() {
|
||||||
|
this.importLoading = true
|
||||||
|
},
|
||||||
|
beforeUpload(file, files) {
|
||||||
|
const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
|
||||||
|
const whiteList = ['xlsx']
|
||||||
|
if (!whiteList.includes(fileSuffix)) {
|
||||||
|
this.files = []
|
||||||
|
this.$message.warning('上传文件只能是' + whiteList.join(',') + '格式')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.files = files
|
||||||
|
},
|
||||||
|
|
||||||
|
transformData(dataArray, excelKeyMap) {
|
||||||
|
if (!Array.isArray(dataArray) || dataArray.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return dataArray.map(v => {
|
||||||
|
let row = {};
|
||||||
|
const keys = Object.keys(excelKeyMap); // 缓存 keys 避免重复计算
|
||||||
|
keys.forEach(k1 => {
|
||||||
|
row[excelKeyMap[k1]] = v[k1];
|
||||||
|
});
|
||||||
|
return row;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
exportExcel(type) {
|
||||||
|
let data = [];
|
||||||
|
|
||||||
|
if (type === 'total') {
|
||||||
|
if (!Array.isArray(this.importResult.totalData) || this.importResult.totalData.length === 0) {
|
||||||
|
this.$message.warning('没有数据可导出');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data = this.transformData(this.importResult.totalData, this.excelKeyMap);
|
||||||
|
} else if (type === 'fail') {
|
||||||
|
if (!Array.isArray(this.importResult.failData) || this.importResult.failData.length === 0) {
|
||||||
|
this.$message.warning('没有数据可导出');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data = this.transformData(this.importResult.failData, this.excelKeyMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
const workName = type === 'total' ? '匹配成功数据' : '匹配失败数据';
|
||||||
|
const worksheetName = "Sheet1";
|
||||||
|
const fileName = workName + ".xlsx";
|
||||||
|
|
||||||
|
if (data.length === 0) {
|
||||||
|
this.$message.warning('没有数据可以生成工作表');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const worksheet = XLSX.utils.json_to_sheet(data);
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, worksheetName);
|
||||||
|
XLSX.writeFile(workbook, fileName);
|
||||||
|
},
|
||||||
|
|
||||||
|
downloadTemplate() {
|
||||||
|
// 创建一个空工作簿
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
// 创建示例数据
|
||||||
|
const templateData = [
|
||||||
|
{
|
||||||
|
"工号": "000001",
|
||||||
|
"姓名": "张三",
|
||||||
|
"学校二次报销金额": "10000.00"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
// 创建工作表
|
||||||
|
const worksheet = XLSX.utils.json_to_sheet(templateData);
|
||||||
|
// 添加到工作簿
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, "医保数据");
|
||||||
|
// 导出文件
|
||||||
|
XLSX.writeFile(workbook, "医保数据导入模板.xlsx");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,324 @@
|
|||||||
|
<!--#
|
||||||
|
layout("/layouts/platform.html"){
|
||||||
|
#-->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.table-error-row {
|
||||||
|
color: #f00 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .import-container {
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .import-warnings {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .warning-list {
|
||||||
|
margin: 8px 0 0 20px;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .warning-list li {
|
||||||
|
list-style-type: decimal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .warning-list .important {
|
||||||
|
color: #e6a23c;
|
||||||
|
font-weight: bold;
|
||||||
|
list-style-type: none;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .upload-area {
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px dashed #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .upload-area:hover {
|
||||||
|
border-color: #c0c4cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .import-results {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-card {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-header {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-content {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-item {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-item:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-label {
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-value {
|
||||||
|
font-weight: bold;
|
||||||
|
position: relative;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-value.success {
|
||||||
|
color: #67c23a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .result-value.warning {
|
||||||
|
color: #e6a23c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .download-icon {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
cursor: pointer;
|
||||||
|
color: #409EFF;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .download-icon:hover {
|
||||||
|
color: #66b1ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .mb-10 {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .mt10 {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .template-download {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medical-import-dialog .template-tip {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div id="app" v-cloak>
|
||||||
|
<guava ref="guava">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<div class="search">
|
||||||
|
<div class="search-item">
|
||||||
|
<div class="search-item-label">年度:</div>
|
||||||
|
<div class="search-item-option">
|
||||||
|
<el-date-picker
|
||||||
|
placeholder="选择年度"
|
||||||
|
style="width: 100%"
|
||||||
|
type="year"
|
||||||
|
v-model="pageForm.year"
|
||||||
|
value-format="yyyy">
|
||||||
|
</el-date-picker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-item">
|
||||||
|
<div class="search-item-label">关键字:</div>
|
||||||
|
<div class="search-item-option">
|
||||||
|
<el-input clearable placeholder="可输入工号、姓名、身份证号查询"
|
||||||
|
v-model.trim="pageForm.searchKeyword"></el-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-item">
|
||||||
|
<div class="search-item-label">数据检查:</div>
|
||||||
|
<div class="search-item-option">
|
||||||
|
<el-select v-model="pageForm.dataCheck" clearable style="width: 100%">
|
||||||
|
<el-option label="医保数据匹配失败记录" value="1"></el-option>
|
||||||
|
<el-option label="学习二次报销数据匹配失败记录" value="2"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="search-query">
|
||||||
|
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="mt10" shadow="never">
|
||||||
|
<table-tool :app="this" label="补助列表">
|
||||||
|
<template #func>
|
||||||
|
<el-button @click="$refs.insImportRef.onOpen()" size="small" type="primary">① 导入医保数据
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="openEc" size="small" type="primary">② 导入学校二次报销数据
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="exportXlsx" size="small" type="primary">导出汇总表</el-button>
|
||||||
|
<el-button @click="doCalculate" size="small" type="primary">计算补助数据</el-button>
|
||||||
|
</template>
|
||||||
|
</table-tool>
|
||||||
|
<el-table :data="tableData"
|
||||||
|
:row-class-name="tableRowClassName"
|
||||||
|
:size="tableSize"
|
||||||
|
@sort-change="pageOrder"
|
||||||
|
align="center"
|
||||||
|
header-align="center">
|
||||||
|
<el-table-column align="center" header-align="center" label="序号" type="index" width="80" fixed="left">
|
||||||
|
<template scope="scope">
|
||||||
|
<span>{{ scope.$index + (pageForm.pageNumber - 1) * pageForm.pageSize + 1 }} </span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
:label="column.label"
|
||||||
|
:prop="column.prop"
|
||||||
|
:sortable="column.sortable"
|
||||||
|
:width="column.width"
|
||||||
|
align="center"
|
||||||
|
header-align="center"
|
||||||
|
:fixed="column.fixed"
|
||||||
|
show-overflow-tooltip
|
||||||
|
v-for="column in tableColumns"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" header-align="center" fixed="right" width="200">
|
||||||
|
<template scope="scope">
|
||||||
|
<el-button @click="onEdit(scope.row)" size="mini" type="primary">编辑</el-button>
|
||||||
|
<el-button @click="onDelete(scope.row.id)" size="mini" type="danger">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--#include("/layouts/pagination.html"){}#-->
|
||||||
|
</el-card>
|
||||||
|
</guava>
|
||||||
|
<ins-import ref="insImportRef" @refresh="doSearch"></ins-import>
|
||||||
|
<ec-import ref="ecImportRef" @refresh="doSearch"></ec-import>
|
||||||
|
<ins-form ref="insFormRef" @refresh="doSearch"></ins-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
<!--#include('insImport.js'){}#-->
|
||||||
|
<!--#include('insForm.js'){}#-->
|
||||||
|
<!--#include('ecImport.js'){}#-->
|
||||||
|
|
||||||
|
const vue = new Vue({
|
||||||
|
el: '#app',
|
||||||
|
mixins: [initTableMixins],
|
||||||
|
components: {
|
||||||
|
"ins-import": insImport,
|
||||||
|
"ec-import": ecImport,
|
||||||
|
"ins-form": insForm
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableColumns: [
|
||||||
|
{prop: 'userName', label: '姓名'},
|
||||||
|
{prop: 'loginName', label: '工号'},
|
||||||
|
{prop: 'idCard', label: '身份证号', width: 200},
|
||||||
|
{prop: 'zhzl', label: '账户自理'},
|
||||||
|
{prop: 'zhzf', label: '账户自付'},
|
||||||
|
{prop: 'xjzl', label: '现金自理'},
|
||||||
|
{prop: 'xjzf', label: '现金自付'},
|
||||||
|
{prop: 'sxzf', label: '四项之和'},
|
||||||
|
{prop: 'lxzf', label: '两项之和'},
|
||||||
|
{prop: 'ecbx', label: '学校二次报销金额'},
|
||||||
|
{prop: 'calc', label: '补助计算金额'},
|
||||||
|
],
|
||||||
|
pageForm: {
|
||||||
|
year: (new Date().getFullYear() - 1).toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openEc() {
|
||||||
|
$.post('/platform/sickHelp/medicalIns/checkIns').then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$refs.ecImportRef.onOpen()
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onEdit(row) {
|
||||||
|
this.$refs.insFormRef.onOpen(row)
|
||||||
|
},
|
||||||
|
|
||||||
|
onDelete(id) {
|
||||||
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
$.post(loc() + '/delete', {id: id}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
this.doSearch()
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
async doCalculate() {
|
||||||
|
const {code, msg} = await $.post(loc() + '/checkIns')
|
||||||
|
if (code === 0) {
|
||||||
|
$.post(loc() + '/checkEc').then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
sublime.jumpPagePjax('/platform/sickHelp/importByExcel?mode=ins')
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(msg)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
exportXlsx() {
|
||||||
|
const {year} = this.pageForm
|
||||||
|
if (!year) {
|
||||||
|
this.$message.error('请选择年份')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.open(loc() + '/exportXlsx?year=' + year)
|
||||||
|
},
|
||||||
|
|
||||||
|
tableRowClassName({row, rowIndex}) {
|
||||||
|
if (!row.loginName || row.loginName === '' || row.loginName === undefined) {
|
||||||
|
return 'table-error-row'
|
||||||
|
}
|
||||||
|
if (!row.ecbx || row.ecbx === '' || row.ecbx === undefined) {
|
||||||
|
return 'table-error-row'
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.pageData()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!--#
|
||||||
|
}
|
||||||
|
#-->
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
const insForm = {
|
||||||
|
template: /*language=HTML*/ `
|
||||||
|
<el-dialog :title="title" :visible.sync="visible" :close-on-click-modal="false">
|
||||||
|
<el-form :model="form" :rules="rules" ref="form" label-width="150px">
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="工号" prop="loginName">
|
||||||
|
<el-select
|
||||||
|
v-model="form.loginName"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="loginNameChange"
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
reserve-keyword
|
||||||
|
placeholder="请输入关键词"
|
||||||
|
:remote-method="remoteMethod">
|
||||||
|
<el-option
|
||||||
|
v-for="item in userOptions"
|
||||||
|
:key="item.loginname"
|
||||||
|
:label="item.username+'-'+item.loginname"
|
||||||
|
:value="item.loginname">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="姓名" prop="userName">
|
||||||
|
<el-input v-model="form.userName" maxlength="50" disabled></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-form-item label="身份证号" prop="idCard">
|
||||||
|
<el-input v-model="form.idCard"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="账户自理" prop="zhzl">
|
||||||
|
<el-input-number v-model="form.zhzl" :precision="2" :step="0.1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="账户自付" prop="zhzf">
|
||||||
|
<el-input-number v-model="form.zhzf" :precision="2" :step="0.1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="现金自理" prop="xjzl">
|
||||||
|
<el-input-number v-model="form.xjzl" :precision="2" :step="0.1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="现金自付" prop="xjzf">
|
||||||
|
<el-input-number v-model="form.xjzf" :precision="2" :step="0.1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="两项自付之和" prop="lxzf">
|
||||||
|
<el-input-number v-model="form.lxzf" :precision="2" :step="0.1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="四项之和金额" prop="sxzf">
|
||||||
|
<el-input-number v-model="form.sxzf" :precision="2" :step="0.1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-form-item label="学校二次报销金额" prop="ecbx">
|
||||||
|
<el-input-number v-model="form.ecbx" :precision="2" :step="0.1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="onSave">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
`,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '新增',
|
||||||
|
visible: false,
|
||||||
|
form: {},
|
||||||
|
rules: {
|
||||||
|
loginName: [
|
||||||
|
{required: true, message: '请输入工号', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
userName: [
|
||||||
|
{required: true, message: '请输入姓名', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
idCard: [
|
||||||
|
{required: true, message: '请输入身份证号', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
zhzl: [
|
||||||
|
{required: true, message: '请输入账户自理', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
zhzf: [
|
||||||
|
{required: true, message: '请输入账户自付', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
xjzl: [
|
||||||
|
{required: true, message: '请输入现金自理', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
xjzf: [
|
||||||
|
{required: true, message: '请输入现金自付', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
lxzf: [
|
||||||
|
{required: true, message: '请输入两项自付之和', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
sxzf: [
|
||||||
|
{required: true, message: '请输入四项之和金额', trigger: 'blur'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
userOptions: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onOpen(row = {}) {
|
||||||
|
this.visible = true
|
||||||
|
this.form = {...row}
|
||||||
|
},
|
||||||
|
remoteMethod(query) {
|
||||||
|
if (query) {
|
||||||
|
$.post('/platform/sickHelp/medicalIns/queryUser', {query}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.userOptions = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loginNameChange(val) {
|
||||||
|
console.log(val)
|
||||||
|
const user = this.userOptions.find(v => v.loginname === val)
|
||||||
|
if (user) {
|
||||||
|
this.form.userName = user.username
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSave() {
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
$.post('/platform/sickHelp/medicalIns/update', this.form).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.visible = false
|
||||||
|
this.$message.success("保存成功")
|
||||||
|
this.$emit('refresh')
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
const insImport = {
|
||||||
|
template: /*language=HTML*/ `
|
||||||
|
<el-dialog :visible.sync="importVisible" title="导入医保数据" width="50%" class="medical-import-dialog">
|
||||||
|
|
||||||
|
<div class="import-container">
|
||||||
|
|
||||||
|
<div class="template-download">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-download"
|
||||||
|
@click="downloadTemplate"
|
||||||
|
size="small">
|
||||||
|
下载导入模板
|
||||||
|
</el-button>
|
||||||
|
<span class="template-tip">请按照模板格式填写数据后上传,填写不完整将会导致数据解析错误</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="import-warnings">
|
||||||
|
<el-alert type="warning" :closable="false" show-icon class="mb-10">
|
||||||
|
<ul class="warning-list">
|
||||||
|
<li>导入之前请确认大病互助会员库数据是最新且准确的</li>
|
||||||
|
<li>导入会先过滤掉四项之和小于10000的(达不到补助标准)</li>
|
||||||
|
<li>导入会过滤掉非会员数据</li>
|
||||||
|
<li>导入会覆盖上一次同年份的数据</li>
|
||||||
|
</ul>
|
||||||
|
</el-alert>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center upload-area" v-loading="importLoading" element-loading-text="数据导入中">
|
||||||
|
<el-upload
|
||||||
|
class="mt10"
|
||||||
|
:action="uploadUrl"
|
||||||
|
:auto-upload="true"
|
||||||
|
:file-list="files"
|
||||||
|
:limit="1"
|
||||||
|
:on-exceed="()=>{this.$message.warning('只能上传一个文件')}"
|
||||||
|
:on-progress="handleProgress"
|
||||||
|
:on-remove="(f,fl)=>{fileList = fl;}"
|
||||||
|
:on-success="handleSuccess"
|
||||||
|
accept=".xls,.xlsx"
|
||||||
|
drag
|
||||||
|
ref="excelUpload">
|
||||||
|
<i class="el-icon-upload"></i>
|
||||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="import-results" v-if="importResult">
|
||||||
|
<el-card shadow="never" class="result-card">
|
||||||
|
<div slot="header" class="result-header">
|
||||||
|
<span>导入结果</span>
|
||||||
|
</div>
|
||||||
|
<div class="result-content">
|
||||||
|
<div class="result-item">
|
||||||
|
<span class="result-label">人员总数据数:</span>
|
||||||
|
<span class="result-value">
|
||||||
|
{{ importResult.total || 0 }}
|
||||||
|
<el-tooltip content="下载完整数据" placement="top">
|
||||||
|
<i class="el-icon-download download-icon" @click="exportExcel('total')"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="result-item">
|
||||||
|
<span class="result-label">匹配成功数据数:</span>
|
||||||
|
<span class="result-value success">
|
||||||
|
{{ importResult.success || 0 }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="result-item">
|
||||||
|
<span class="result-label">匹配失败数据数:</span>
|
||||||
|
<span class="result-value warning">
|
||||||
|
{{ importResult.fail || 0 }}
|
||||||
|
<el-tooltip content="下载匹配失败数据" placement="top">
|
||||||
|
<i class="el-icon-download download-icon" @click="exportExcel('fail')"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
`,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
files: [],
|
||||||
|
fileList: [],
|
||||||
|
uploadUrl: loc() + '/importIns',
|
||||||
|
importVisible: false,
|
||||||
|
importData: {},
|
||||||
|
importLoading: false,
|
||||||
|
importResult: {
|
||||||
|
totalData: [],
|
||||||
|
successData: [],
|
||||||
|
failData: [],
|
||||||
|
total: 0,
|
||||||
|
success: 0,
|
||||||
|
fail: 0
|
||||||
|
},
|
||||||
|
excelKeyMap: {
|
||||||
|
"idCard": '身份证号',
|
||||||
|
"userName": '姓名',
|
||||||
|
"zhzl": '账户自理',
|
||||||
|
"zhzf": '账户自付',
|
||||||
|
"xjzl": '现金自理',
|
||||||
|
"xjzf": '现金自付'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onOpen() {
|
||||||
|
this.importVisible = true
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSuccess(resp) {
|
||||||
|
this.importLoading = false
|
||||||
|
if (resp.code === 0) {
|
||||||
|
this.$message.success('导入成功')
|
||||||
|
this.importResult = resp.data
|
||||||
|
this.$emit('refresh', null)
|
||||||
|
} else {
|
||||||
|
this.$message.error('导入失败')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleProgress() {
|
||||||
|
this.importLoading = true
|
||||||
|
},
|
||||||
|
beforeUpload(file, files) {
|
||||||
|
const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
|
||||||
|
const whiteList = ['xlsx']
|
||||||
|
if (!whiteList.includes(fileSuffix)) {
|
||||||
|
this.files = []
|
||||||
|
this.$message.warning('上传文件只能是' + whiteList.join(',') + '格式')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.files = files
|
||||||
|
},
|
||||||
|
|
||||||
|
transformData(dataArray, excelKeyMap) {
|
||||||
|
if (!Array.isArray(dataArray) || dataArray.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return dataArray.map(v => {
|
||||||
|
let row = {};
|
||||||
|
const keys = Object.keys(excelKeyMap); // 缓存 keys 避免重复计算
|
||||||
|
keys.forEach(k1 => {
|
||||||
|
row[excelKeyMap[k1]] = v[k1];
|
||||||
|
});
|
||||||
|
return row;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
exportExcel(type) {
|
||||||
|
let data = [];
|
||||||
|
|
||||||
|
if (type === 'total') {
|
||||||
|
if (!Array.isArray(this.importResult.totalData) || this.importResult.totalData.length === 0) {
|
||||||
|
this.$message.warning('没有数据可导出');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data = this.transformData(this.importResult.totalData, this.excelKeyMap);
|
||||||
|
} else if (type === 'fail') {
|
||||||
|
if (!Array.isArray(this.importResult.failData) || this.importResult.failData.length === 0) {
|
||||||
|
this.$message.warning('没有数据可导出');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data = this.transformData(this.importResult.failData, this.excelKeyMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
const workName = type === 'total' ? '总数据' : '匹配失败数据';
|
||||||
|
const worksheetName = "Sheet1";
|
||||||
|
const fileName = workName + ".xlsx";
|
||||||
|
|
||||||
|
if (data.length === 0) {
|
||||||
|
this.$message.warning('没有数据可以生成工作表');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const worksheet = XLSX.utils.json_to_sheet(data);
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, worksheetName);
|
||||||
|
XLSX.writeFile(workbook, fileName);
|
||||||
|
},
|
||||||
|
|
||||||
|
downloadTemplate() {
|
||||||
|
// 创建一个空工作簿
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
// 创建示例数据
|
||||||
|
const templateData = [
|
||||||
|
{
|
||||||
|
"人员姓名": "张三",
|
||||||
|
"身份证号": "1234567890",
|
||||||
|
"账户自理": "10000.00",
|
||||||
|
"账户自付": "10000.00",
|
||||||
|
"现金自理": "10000.00",
|
||||||
|
"现金自付": "10000.00"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
// 创建工作表
|
||||||
|
const worksheet = XLSX.utils.json_to_sheet(templateData);
|
||||||
|
// 添加到工作簿
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, "医保数据");
|
||||||
|
// 导出文件
|
||||||
|
XLSX.writeFile(workbook, "医保数据导入模板.xlsx");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user