commit
This commit is contained in:
-1
@@ -137,7 +137,6 @@ public class CondolenceMineController {
|
||||
CondolenceType type = condolenceService.dao().fetch(CondolenceType.class, Cnd.where(CondolenceType::getId, "=", condolence.getType()));
|
||||
NutMap nutMap = Lang.obj2nutmap(condolence);
|
||||
nutMap.put("typeName", type.getName());
|
||||
//smsService.send("20182040", "这是一条由智慧工会系统发出的测试消息。");
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
@Inject
|
||||
|
||||
+255
@@ -0,0 +1,255 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApplyCost;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalDiseaseType;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.service.MedicalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/22 11:24
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/medicalMutualAid/medical/apply")
|
||||
@Api("医疗互助申请")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MedicalApplyController {
|
||||
|
||||
@Inject
|
||||
private MedicalApplyService medicalApplyService;
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/medical/apply/index.html")
|
||||
@SaCheckPermission("medicalMutualAid.medical.apply")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取疾病列表")
|
||||
@SaCheckLogin
|
||||
public Result getDiseaseList() {
|
||||
List<MedicalDiseaseType> typeList = medicalApplyService.dao().query(MedicalDiseaseType.class, Cnd.NEW().asc(MedicalDiseaseType::getDiseaseCode));
|
||||
return Result.success(typeList);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取可以申请补助的人")
|
||||
@SaCheckPermission("medicalMutualAid.medical.apply")
|
||||
public Result getSubsidyUser(String id, Integer year, String keyword) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
us.id,
|
||||
us.sex,
|
||||
us.birthday,
|
||||
us.loginname,
|
||||
us.username,
|
||||
us.unitName,
|
||||
us.homeAddress,
|
||||
us.idCard,
|
||||
TIMESTAMPDIFF(YEAR, us.birthday, CURDATE()) AS age
|
||||
FROM
|
||||
vw_user us
|
||||
LEFT JOIN aid_fund_member_pay pay ON pay.userId = us.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("us.username", keyword);
|
||||
group.orLike("us.loginname", keyword);
|
||||
group.orLike("us.oldLoginName", keyword);
|
||||
group.or("us.id", "=", keyword);
|
||||
cnd.and(group);
|
||||
|
||||
cnd.and("pay.isPayed", "=", 1);
|
||||
|
||||
Integer applyYear = DateUtil.thisYear();
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
//如果不等于空的话,则是编辑查询申请年的人员
|
||||
MedicalApply medicalApply = medicalApplyService.dao().fetch(MedicalApply.class, id);
|
||||
applyYear = DateUtil.year(DateUtil.parse(medicalApply.getApplyTime()));
|
||||
} else {
|
||||
//如果等于空,就代表不是编辑
|
||||
if (year != null) {
|
||||
applyYear = year;
|
||||
}
|
||||
}
|
||||
|
||||
cnd.and("pay.`year`", "=", applyYear);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
SqlExpressionGroup group1 = new SqlExpressionGroup();
|
||||
if (AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
group1.and("us.unionId", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
if (AuthUtil.hasRoleOr(RoleConstant.RETIREMENT_WORKPLACE.name())) {
|
||||
group1.and("us.aidFundMemberUserType", "=", "离退休人员");
|
||||
}
|
||||
cnd.and(group1);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
|
||||
Pagination pagination = medicalApplyService.listPageMap(1, 10, sql);
|
||||
List<NutMap> list = pagination.getList();
|
||||
list.forEach(map -> {
|
||||
String loginname = map.getString("loginname");
|
||||
Sys_user user = medicalApplyService.dao().fetch(Sys_user.class, Cnd.where("oldLoginName", "=", loginname));
|
||||
if (Lang.isNotEmpty(user)) {
|
||||
//说明变更过工号 那页面上需要显示变更过的工号
|
||||
map.setv("loginname", user.getLoginname());
|
||||
map.setv("id", user.getId());
|
||||
}
|
||||
});
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取累计补助金额")
|
||||
@SaCheckPermission("medicalMutualAid.medical.apply")
|
||||
public Result getMedicalSubsidyMoney(String userId) {
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
NutMap medicalSubsidyMoney = medicalApplyService.getMedicalSubsidyMoney(userId);
|
||||
return Result.success(medicalSubsidyMoney);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取补助申请次数")
|
||||
@SaCheckPermission("medicalMutualAid.medical.apply")
|
||||
public Result getMedicalApplyNum(String userId) {
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
Integer medicalApplyNum = medicalApplyService.getMedicalApplyNum(userId);
|
||||
return Result.success(medicalApplyNum);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("保存")
|
||||
@SLog(tag = "医疗互助申请", msg = "保存申请")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("medicalMutualAid.medical.apply")
|
||||
public Result save(@Param("data") MedicalApply medicalApply) {
|
||||
|
||||
if (StrUtil.isNotBlank(medicalApply.getId())) {
|
||||
medicalApplyService.dao().clear(MedicalApplyCost.class, Cnd.where(MedicalApplyCost::getApplyId, "=", medicalApply.getId()));
|
||||
medicalApplyService.delete(medicalApply.getId());
|
||||
}
|
||||
medicalApply.setApplyTime(DateUtil.now());
|
||||
medicalApplyService.insertWith(medicalApply, "costList");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("提交")
|
||||
@SLog(tag = "医疗互助申请", msg = "提交申请")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("medicalMutualAid.medical.apply")
|
||||
public Result submit(@Param("data") MedicalApply medicalApply) {
|
||||
if (StrUtil.isNotBlank(medicalApply.getId())) {
|
||||
medicalApplyService.dao().clear(MedicalApplyCost.class, Cnd.where(MedicalApplyCost::getApplyId, "=", medicalApply.getId()));
|
||||
medicalApplyService.delete(medicalApply.getId());
|
||||
}
|
||||
medicalApply.setApplyTime(DateUtil.now());
|
||||
medicalApplyService.insertWith(medicalApply, "costList");
|
||||
Sys_user user = medicalApplyService.dao().fetch(Sys_user.class, medicalApply.getUserId());
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, medicalApply);
|
||||
args.set("aidFundMemberUserType", user.getAidFundMemberUserType());
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("YLBB", medicalApply.getId(), SecurityUtil.getUserId(), args);
|
||||
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("重新提交")
|
||||
@SLog(tag = "医疗互助申请", msg = "重新提交")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("medicalMutualAid.medical.apply")
|
||||
public Result submitAgain(@Param("data") MedicalApply medicalApply, @Param("taskId") Long taskId) {
|
||||
medicalApplyService.update(medicalApply);
|
||||
medicalApplyService.dao().clear(MedicalApplyCost.class, Cnd.where(MedicalApplyCost::getApplyId, "=", medicalApply.getId()));
|
||||
medicalApplyService.insert(medicalApply.getCostList());
|
||||
|
||||
Dict dict = Dict.create();
|
||||
dict.set(FlowConst.PROCESS_TASK_ID_KEY, taskId);
|
||||
dict.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.RE_APPLY.getCode());
|
||||
flowCommonService.executeTask(dict);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("查询是否有进行中的申请")
|
||||
@SaCheckPermission("medicalMutualAid.medical.apply")
|
||||
public Result getIsAfootMedicalApply(String userId, String id) {
|
||||
|
||||
Boolean isAfootMedicalApply = medicalApplyService.getIsAfootMedicalApply(userId, id);
|
||||
if (isAfootMedicalApply) {
|
||||
Sys_user user = medicalApplyService.dao().fetch(Sys_user.class, userId);
|
||||
return Result.error("【%s】有一条进行中的申请,请到“我的补助”菜单中查看。".formatted(user.getUsername()));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalSetting;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/22 08:58
|
||||
* @description 补助参数配置
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/medicalMutualAid/medical/basicSetting")
|
||||
@Api("医疗互助补助参数配置")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MedicalBasicSettingController {
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/medical/basicSetting/index.html")
|
||||
@SaCheckPermission("medicalMutualAid.medical.basicSetting")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result getSetting() {
|
||||
return Result.success(baseService.dao().fetch(MedicalSetting.class, Cnd.NEW()));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("保存/修改参数配置")
|
||||
@SaCheckPermission("medicalMutualAid.medical.basicSetting")
|
||||
public Result doSubmit(MedicalSetting medicalSetting) {
|
||||
baseService.insertOrUpdate(medicalSetting);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalDiseaseType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/21 10:52
|
||||
* @description 医疗互助疾病类型表
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/medicalMutualAid/medical/diseaseType")
|
||||
@Api("医疗互助疾病类型")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MedicalDiseaseTypeController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/medical/diseaseType/index.html")
|
||||
@SaCheckPermission("medicalMutualAid.medical.diseaseType")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("medicalMutualAid.medical.diseaseType")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Sql sql = Sqls.create("SELECT * FROM medical_disease_type $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (ObjectUtil.isNotEmpty(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX("diseaseName", pageForm.getSearchKeyword()));
|
||||
}
|
||||
cnd.asc("diseaseCode");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("保存/修改疾病类型")
|
||||
@SaCheckPermission("medicalMutualAid.medical.diseaseType")
|
||||
public Result doSubmit(MedicalDiseaseType medicalDiseaseType) {
|
||||
baseService.insertOrUpdate(medicalDiseaseType);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除疾病类型")
|
||||
@SaCheckPermission("medicalMutualAid.medical.diseaseType")
|
||||
public Object doDelete(String id) {
|
||||
baseService.dao().clear(MedicalDiseaseType.class, Cnd.where(MedicalDiseaseType::getId, "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApplyCost;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.param.MedicalPageForm;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.service.MedicalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.json.Json;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/23 17:09
|
||||
* @description 互管会审核
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/medicalMutualAid/medical/foundationAudit")
|
||||
@Api("医疗互助校互管会审核")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MedicalFoundationAuditController {
|
||||
|
||||
@Inject
|
||||
private MedicalApplyService medicalApplyService;
|
||||
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/medical/foundationAudit/index.html")
|
||||
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
||||
public Result pageData(MedicalPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.diseaseName,
|
||||
type.isMajorDiseases,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.unitName,
|
||||
us.unionName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN medical_apply info ON info.id = ins.businessNo
|
||||
LEFT JOIN medical_disease_type type ON info.diseaseId = type.id
|
||||
LEFT JOIN vw_user us ON us.id = info.userId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("us.loginname", pageForm.getSearchKeyword());
|
||||
seg.orLike("us.username", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("year(info.applyTime)", "=", pageForm.getYear());
|
||||
cnd.andEX("info.diseaseId", "=", pageForm.getDiseaseId());
|
||||
cnd.andEX("us.unionid", "=", pageForm.getUnionId());
|
||||
cnd.andEX("us.unitid", "=", pageForm.getUnitId());
|
||||
|
||||
cnd.and("t.taskName", "=", "cd560356-cc70-48b5-8d99-ff9bd3505869");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageForm.getApproval()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = medicalApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> costList = medicalApplyService.getCostList(pageVO.getList());
|
||||
pageVO.setList(costList);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "医院补助-互管会审核", msg = "修改了一条住院记录")
|
||||
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
||||
public Result updateCost(String data){
|
||||
List<MedicalApplyCost> applyCosts = Json.fromJsonAsList(MedicalApplyCost.class, data);
|
||||
medicalApplyService.updateIgnoreNull(applyCosts);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "医院补助-互管会审核", msg = "互管会审核了一条记录")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
||||
public Result executeTask(@Param("data") String param, String id){
|
||||
Dict args = Json.fromJson(Dict.class, param);
|
||||
if (args.getInt("submitType") == 1) {
|
||||
|
||||
}
|
||||
flowCommonService.executeTask(args);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApplyCost;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalDiseaseType;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.param.MedicalPageForm;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.service.MedicalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/23 09:17
|
||||
* @description 我的申请
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/medicalMutualAid/medical/mine")
|
||||
@Api("医疗互助我的申请")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MedicalMineController {
|
||||
|
||||
|
||||
@Inject
|
||||
private MedicalApplyService medicalApplyService;
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/medical/mine/index.html")
|
||||
@SaCheckPermission("medicalMutualAid.medical.mine")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("medicalMutualAid.medical.mine")
|
||||
public Result pageData(MedicalPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.diseaseName,
|
||||
type.isMajorDiseases,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.unitName,
|
||||
us.unionName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
|
||||
(SELECT MAX(id) FROM wf_process_task WHERE processInstanceId = ins.id AND taskName = 'startTask') AS startTaskId
|
||||
FROM
|
||||
medical_apply info
|
||||
LEFT JOIN medical_disease_type type ON info.diseaseId = type.id
|
||||
LEFT JOIN vw_user us ON us.id = info.userId
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id
|
||||
AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("us.loginname", pageForm.getSearchKeyword());
|
||||
seg.orLike("us.username", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("year(info.applyTime)", "=", pageForm.getYear());
|
||||
cnd.andEX("info.diseaseId", "=", pageForm.getDiseaseId());
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getPageOrderName()) && StrUtil.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.desc("info.applyTime");
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = medicalApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> costList = medicalApplyService.getCostList(pagination.getList());
|
||||
pagination.setList(costList);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("medicalMutualAid.medical.mine")
|
||||
@SLog(tag = "医疗补助系统-我的补助", msg = "删除我的补助申请")
|
||||
public Result delete(@Param("id") String id) {
|
||||
medicalApplyService.delete(id);
|
||||
medicalApplyService.dao().clear(MedicalApplyCost.class, Cnd.where(MedicalApplyCost::getApplyId, "=", id));
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("medicalMutualAid.medical")
|
||||
public Result info(String id) {
|
||||
MedicalApply medicalApply = medicalApplyService.fetch(id);
|
||||
MedicalDiseaseType diseaseType = medicalApplyService.dao().fetch(MedicalDiseaseType.class, medicalApply.getDiseaseId());
|
||||
MedicalApply fetchLinks = medicalApplyService.fetchLinks(medicalApply, "costList",Cnd.NEW().asc("visitStartTime"));
|
||||
View_user user = medicalApplyService.dao().fetch(View_user.class, Cnd.where(View_user::getId, "=", medicalApply.getUserId()));
|
||||
NutMap nutMap = Lang.obj2nutmap(fetchLinks);
|
||||
nutMap.put("sex", user.getSex());
|
||||
nutMap.put("loginName", user.getLoginname());
|
||||
nutMap.put("userName", user.getUsername());
|
||||
nutMap.put("unitName", user.getUnitName());
|
||||
nutMap.put("unionName", user.getUnionName());
|
||||
nutMap.put("aidFundDeductTime", user.getAidFundDeductTime());
|
||||
nutMap.put("diseaseName", diseaseType.getDiseaseName());
|
||||
nutMap.put("isMajorDiseases", diseaseType.getIsMajorDiseases());
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.param.MedicalPageForm;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.service.MedicalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.json.Json;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/23 16:14
|
||||
* @description 校医院审核
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/medicalMutualAid/medical/schoolHospitalAudit")
|
||||
@Api("医疗互助校医院审核")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MedicalSchoolHospitalAuditController {
|
||||
|
||||
|
||||
@Inject
|
||||
private MedicalApplyService medicalApplyService;
|
||||
|
||||
@Inject
|
||||
private FlowCommonService flowCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/medical/schoolHospitalAudit/index.html")
|
||||
@SaCheckPermission("medicalMutualAid.medical.schoolHospitalAudit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("medicalMutualAid.medical.schoolHospitalAudit")
|
||||
public Result pageData(MedicalPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.diseaseName,
|
||||
type.isMajorDiseases,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.unitName,
|
||||
us.unionName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN medical_apply info ON info.id = ins.businessNo
|
||||
LEFT JOIN medical_disease_type type ON info.diseaseId = type.id
|
||||
LEFT JOIN vw_user us ON us.id = info.userId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("us.loginname", pageForm.getSearchKeyword());
|
||||
seg.orLike("us.username", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("year(info.applyTime)", "=", pageForm.getYear());
|
||||
cnd.andEX("info.diseaseId", "=", pageForm.getDiseaseId());
|
||||
cnd.andEX("us.unionid", "=", pageForm.getUnionId());
|
||||
cnd.andEX("us.unitid", "=", pageForm.getUnitId());
|
||||
|
||||
cnd.and("t.taskName", "=", "39916c1e-857d-407d-86c1-678ccf3011bc");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageForm.getApproval()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = medicalApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> costList = medicalApplyService.getCostList(pageVO.getList());
|
||||
pageVO.setList(costList);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
@At
|
||||
@SLog(tag = "医院补助-校医院审核", msg = "校医院审核了一条记录")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("medicalMutualAid.medical.schoolHospitalAudit")
|
||||
public Result executeTask(@Param("data") String param, String id){
|
||||
Dict args = Json.fromJson(Dict.class, param);
|
||||
if (args.getInt("submitType") == 1) {
|
||||
String tfDiseaseId = args.getStr("tf_diseaseId");
|
||||
medicalApplyService.update(Chain.make("diseaseId", tfDiseaseId), Cnd.where("id", "=", id));
|
||||
}
|
||||
flowCommonService.executeTask(args);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.param.MedicalPageForm;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.service.MedicalApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/23 15:19
|
||||
* @description 分工会审核
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/medicalMutualAid/medical/unionAudit")
|
||||
@Api("医疗互助分工会审核")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class MedicalUnionAuditController {
|
||||
|
||||
@Inject
|
||||
private MedicalApplyService medicalApplyService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/medicalMutualAid/medical/unionAudit/index.html")
|
||||
@SaCheckPermission("medicalMutualAid.medical.unionAudit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("medicalMutualAid.medical.unionAudit")
|
||||
public Result pageData(MedicalPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.diseaseName,
|
||||
type.isMajorDiseases,
|
||||
us.username,
|
||||
us.loginname,
|
||||
us.unitName,
|
||||
us.unionName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN medical_apply info ON info.id = ins.businessNo
|
||||
LEFT JOIN medical_disease_type type ON info.diseaseId = type.id
|
||||
LEFT JOIN vw_user us ON us.id = info.userId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("us.loginname", pageForm.getSearchKeyword());
|
||||
seg.orLike("us.username", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.andEX("year(info.applyTime)", "=", pageForm.getYear());
|
||||
cnd.andEX("info.diseaseId", "=", pageForm.getDiseaseId());
|
||||
|
||||
cnd.and("t.taskName", "=", "a9bbf69c-5edf-4161-a364-47996d212472");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (pageForm.getApproval()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.applyTime");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = medicalApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> costList = medicalApplyService.getCostList(pageVO.getList());
|
||||
pageVO.setList(costList);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/22 09:58
|
||||
* @description 医疗互助申请表
|
||||
*/
|
||||
@Data
|
||||
@Comment("医疗互助申请表")
|
||||
@Accessors(chain = true)
|
||||
@Table("medical_apply")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MedicalApply extends BaseModel {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyTime;
|
||||
|
||||
@Column
|
||||
@Comment("家庭住址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String homeAddress;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("联系电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("身份证号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("年龄")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String age;
|
||||
|
||||
@Column
|
||||
@Comment("申请次数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer applyNum;
|
||||
|
||||
@Column
|
||||
@Comment("累计补助金额")
|
||||
@Default("0")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal medicalSubsidyMoney;
|
||||
|
||||
@Column
|
||||
@Comment("报销类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String subsidyType;
|
||||
|
||||
@Column
|
||||
@Comment("补助金额")
|
||||
@Default("0")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal subsidyMoney;
|
||||
|
||||
@Column
|
||||
@Comment("预测补助金额")
|
||||
@Default("0")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal forecastSubsidyMoney;
|
||||
|
||||
@Column
|
||||
@Comment("爱心补助金额")
|
||||
@Default("0")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal loveSubsidyMoney;
|
||||
|
||||
@Column
|
||||
@Comment("家庭年度总收入")
|
||||
@Default("0")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal familyIncome;
|
||||
|
||||
@Column
|
||||
@Comment("疾病种类id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String diseaseId;
|
||||
|
||||
@Column
|
||||
@Comment("备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 300)
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@Comment("填写人工号")
|
||||
@PrevInsert(els = @EL("$me.operatorLoginName()"))
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyLoginName;
|
||||
|
||||
@Column
|
||||
@Comment("附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> files;
|
||||
|
||||
@Many(field = "applyId")
|
||||
private List<MedicalApplyCost> costList;
|
||||
|
||||
public String operatorLoginName() {
|
||||
return SecurityUtil.getUserLoginname();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/22 11:10
|
||||
* @description 申请住院记录
|
||||
*/
|
||||
@Data
|
||||
@Comment("医疗互助申请表")
|
||||
@Accessors(chain = true)
|
||||
@Table("medical_apply_cost")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MedicalApplyCost extends BaseModel {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("主键Id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyId;
|
||||
|
||||
@Column
|
||||
@Comment("就诊开始时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String visitStartTime;
|
||||
|
||||
@Column
|
||||
@Comment("就诊结束时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String visitEndTime;
|
||||
|
||||
@Column
|
||||
@Comment("就诊医院")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String visitHospital;
|
||||
|
||||
@Column
|
||||
@Comment("住院医疗总额")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal hospitalSumMoney;
|
||||
|
||||
@Column
|
||||
@Comment("实际报销金额")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal reimbursementMoney;
|
||||
|
||||
@Column
|
||||
@Comment("个人承担部分金额")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal singleBearMoney;
|
||||
|
||||
@Column
|
||||
@Comment("自费部分金额")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal personExpenseMoney;
|
||||
|
||||
@Column
|
||||
@Comment("门诊费")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal outpatientServiceMoney;
|
||||
|
||||
@Column
|
||||
@Comment("靶向药")
|
||||
@Default("0")
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
private BigDecimal bxyMoney;
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/21 10:45
|
||||
* @description 疾病类型
|
||||
*/
|
||||
@Data
|
||||
@Comment("医疗互助疾病类型表")
|
||||
@Accessors(chain = true)
|
||||
@Table("medical_disease_type")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MedicalDiseaseType extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("疾病名称")
|
||||
private String diseaseName;
|
||||
|
||||
@Column
|
||||
@Comment("疾病编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String diseaseCode;
|
||||
|
||||
@Column
|
||||
@Comment("是否重大疾病")
|
||||
@Default("1")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isMajorDiseases;
|
||||
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/21 10:45
|
||||
* @description 疾病类型
|
||||
*/
|
||||
@Data
|
||||
@Comment("医疗互助补助参数配置")
|
||||
@Accessors(chain = true)
|
||||
@Table("medical_setting")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MedicalSetting extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
@Comment("公费医疗患大病年度累计补助标准")
|
||||
private BigDecimal publicYearInDiseaseMoney;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
@Comment("社保患大病年度累计补助标准")
|
||||
private BigDecimal socialYearInDiseaseMoney;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
@Comment("患普通疾病单次补助标准")
|
||||
private BigDecimal ordinaryOnceNotInDiseaseMoney;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
@Comment("爱心互助基金标准")
|
||||
private BigDecimal loveMoney;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("补助比例")
|
||||
private Integer subsidyRatio;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
@Comment("患大病补助最高限额")
|
||||
private BigDecimal maxYearInDiseaseMoney;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
@Comment("患普通疾病补助最高限额")
|
||||
private BigDecimal maxYearNotInDiseaseMoney;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
@Comment("历年总额度最高限额")
|
||||
private BigDecimal previousYearMaxMoney;
|
||||
|
||||
@Column
|
||||
@ColDefine(customType = "decimal(10,2)")
|
||||
@Comment("超过最大限额后每年补助最大金额")
|
||||
private BigDecimal beyondMaxQuotaMoney;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("十年未补助首次申请增加比例")
|
||||
private Integer tenYearNeverAddSubsidyRatio;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("十五年未补助首次申请增加比例")
|
||||
private Integer fifteenYearNeverAddSubsidyRatio;
|
||||
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/23 09:46
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class MedicalPageForm extends PageForm {
|
||||
|
||||
|
||||
/**
|
||||
* 疾病id
|
||||
*/
|
||||
private String diseaseId;
|
||||
|
||||
private Integer year;
|
||||
|
||||
private Boolean approval;
|
||||
private String unionId;
|
||||
private String unitId;
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApply;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MedicalApplyService extends BaseService<MedicalApply> {
|
||||
|
||||
/**
|
||||
* 获取累计补助金额
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
NutMap getMedicalSubsidyMoney(String userId);
|
||||
|
||||
|
||||
Integer getMedicalApplyNum(String userId);
|
||||
|
||||
/**
|
||||
* 根据每一条的申请记录获取填写的住院金额
|
||||
*
|
||||
* @param list 申请记录
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> getCostList(List<NutMap> list);
|
||||
|
||||
|
||||
/**
|
||||
* 查询是否有进行中的申请
|
||||
*
|
||||
* @param userId
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Boolean getIsAfootMedicalApply(String userId, String id);
|
||||
|
||||
|
||||
/**
|
||||
* 计算补助金额
|
||||
* @param applyId
|
||||
* @param diseaseId
|
||||
* @return
|
||||
*/
|
||||
NutMap calcMedicalMoney(String applyId, String diseaseId);
|
||||
}
|
||||
+391
@@ -0,0 +1,391 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApply;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApplyCost;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalDiseaseType;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalSetting;
|
||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.service.MedicalApplyService;
|
||||
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.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2026/1/22 18:10
|
||||
* @description
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MedicalApplyServiceImpl extends BaseServiceImpl<MedicalApply> implements MedicalApplyService {
|
||||
public MedicalApplyServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap getMedicalSubsidyMoney(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT SUM(subsidyMoney) medicalSubsidyMoney FROM medical_apply WHERE userId=@userId
|
||||
""").setParam("userId", userId);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao().execute(sql);
|
||||
NutMap info = (NutMap) sql.getResult();
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getMedicalApplyNum(String userId) {
|
||||
return 0 + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NutMap> getCostList(List<NutMap> list) {
|
||||
for (NutMap map : list) {
|
||||
List<MedicalApplyCost> costList = dao().query(MedicalApplyCost.class,
|
||||
Cnd.where(MedicalApplyCost::getApplyId, "=", map.getString("id")));
|
||||
BigDecimal hospitalSumMoney$ = costList.stream()
|
||||
.map(MedicalApplyCost::getHospitalSumMoney)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
map.put("hospitalSumMoney$", hospitalSumMoney$);
|
||||
|
||||
BigDecimal reimbursementMoney$ = costList.stream()
|
||||
.map(MedicalApplyCost::getReimbursementMoney)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
map.put("reimbursementMoney$", reimbursementMoney$);
|
||||
|
||||
BigDecimal singleBearMoney$ = costList.stream()
|
||||
.map(MedicalApplyCost::getSingleBearMoney)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
map.put("singleBearMoney$", singleBearMoney$);
|
||||
|
||||
BigDecimal personExpenseMoney$ = costList.stream()
|
||||
.map(MedicalApplyCost::getPersonExpenseMoney)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
map.put("personExpenseMoney$", personExpenseMoney$);
|
||||
|
||||
BigDecimal outpatientServiceMoney$ = costList.stream()
|
||||
.map(MedicalApplyCost::getOutpatientServiceMoney)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
map.put("outpatientServiceMoney$", outpatientServiceMoney$);
|
||||
|
||||
BigDecimal bxyMoney$ = costList.stream()
|
||||
.map(MedicalApplyCost::getBxyMoney)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
map.put("bxyMoney$", bxyMoney$);
|
||||
|
||||
map.put("totalMoney", hospitalSumMoney$
|
||||
.add(reimbursementMoney$)
|
||||
.add(singleBearMoney$)
|
||||
.add(personExpenseMoney$)
|
||||
.add(outpatientServiceMoney$)
|
||||
.add(bxyMoney$));
|
||||
map.put("costList", costList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getIsAfootMedicalApply(String userId, String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
medical_apply info
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id
|
||||
AND t.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.or("t.taskName", "is", null);
|
||||
group.or("ins.state", "=", ProcessInstanceStateEnum.DOING.getCode());
|
||||
cnd.and(group);
|
||||
cnd.and("info.userId", "=", userId);
|
||||
cnd.andEX("info.id", "!=", id);
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.integer());
|
||||
dao().execute(sql);
|
||||
return sql.getInt() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap calcMedicalMoney(String applyId, String diseaseId) {
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
||||
|
||||
MedicalSetting medicalSetting = dao().fetch(MedicalSetting.class);
|
||||
|
||||
MedicalApply apply = dao().fetch(MedicalApply.class, applyId);
|
||||
MedicalDiseaseType applyDiseaseType = dao().fetch(MedicalDiseaseType.class, Cnd.where(MedicalDiseaseType::getId, "=", apply.getDiseaseId()));
|
||||
List<MedicalApplyCost> costs = dao().query(MedicalApplyCost.class, Cnd.where("applyId", "=", apply.getId()));
|
||||
//个人承担费用
|
||||
BigDecimal singleBearMoney = costs.stream()
|
||||
.map(MedicalApplyCost::getSingleBearMoney)
|
||||
.filter(Objects::nonNull) // 防御性编程,避免 NPE
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//自费
|
||||
BigDecimal personExpenseMoney = costs.stream()
|
||||
.map(MedicalApplyCost::getPersonExpenseMoney)
|
||||
.filter(Objects::nonNull) // 防御性编程,避免 NPE
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//门诊费用
|
||||
BigDecimal outpatientServiceMoney = costs.stream()
|
||||
.map(MedicalApplyCost::getOutpatientServiceMoney)
|
||||
.filter(Objects::nonNull) // 防御性编程,避免 NPE
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// 靶向药
|
||||
BigDecimal bxyMoney = costs.stream()
|
||||
.map(MedicalApplyCost::getBxyMoney)
|
||||
.filter(Objects::nonNull) // 防御性编程,避免 NPE
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
//可能此次申请人退休变号了,所以也要把旧号的申请记录一起查出来
|
||||
Sys_user currentUser = dao().fetch(Sys_user.class, apply.getUserId());
|
||||
List<String> allUserIds = Lang.list(currentUser.getId());
|
||||
|
||||
if (StrUtil.isNotBlank(currentUser.getOldLoginName())) {
|
||||
Sys_user oldUser = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", currentUser.getOldLoginName()));
|
||||
allUserIds.add(oldUser.getId());
|
||||
}
|
||||
|
||||
// 查询申请成功的记录
|
||||
List<NutMap> applyRecords = getApplyRecord(allUserIds);
|
||||
|
||||
//是否首次申请 爱心互助基金 重大疾病
|
||||
boolean isFirstApply = applyRecords.stream().filter(v -> v.getBoolean("isMajorDiseases")).toList().isEmpty();
|
||||
|
||||
//是否重疾
|
||||
Boolean isMajorDiseases = applyDiseaseType.getIsMajorDiseases();
|
||||
if (StrUtil.isNotBlank(diseaseId)) {
|
||||
MedicalDiseaseType diseaseType = dao().fetch(MedicalDiseaseType.class, Cnd.where(MedicalDiseaseType::getId, "=", diseaseId));
|
||||
isMajorDiseases = diseaseType.getIsMajorDiseases();
|
||||
}
|
||||
|
||||
List<NutMap> applyRecordList = applyRecords.stream().filter(applyRecord -> {
|
||||
int applyYear = DateUtil.year(DateUtil.parse(applyRecord.getString("applyTime")));
|
||||
if (!applyRecord.getString("id").equals(apply.getId()) && applyYear == DateUtil.thisYear()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).toList();
|
||||
|
||||
//今年获得的补助(重疾)
|
||||
BigDecimal subsidMoneyCurrentYear999 = applyRecordList.stream()
|
||||
.map(a -> a.getString("loveSubsidyMoney")) // 获取 String
|
||||
.filter(Objects::nonNull) // 过滤 null
|
||||
.filter(s -> !s.trim().isEmpty()) // 过滤空字符串(可选但推荐)
|
||||
.map(BigDecimal::new) // 安全构造 BigDecimal
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
//今年获得的补助(普疾)
|
||||
long subsidMoneyCurrentYear000 = applyRecords.stream().filter(v -> !v.getId().equals(apply.getId()) && !v.getMajorDisease() && v.getApplyTime().substring(0, 4).equals(String.valueOf(year))).mapToLong(v -> (long) (v.getLoveSubsidyMoney() + v.getSubsidyMoney())).sum();
|
||||
|
||||
//历年来所获全部补助
|
||||
long allMoney = applyRecords.stream().mapToLong(v -> (long) (v.getSubsidyMoney() + v.getLoveSubsidyMoney())).sum();
|
||||
|
||||
//是否超过历年所获补助限额
|
||||
Boolean isBeyondAllMoney = allMoney > medicalSetting.getPreviousYearMaxMoney();
|
||||
|
||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
|
||||
|
||||
//近十年是否有申请记录
|
||||
boolean hasApplyInTenYears = applyRecords.stream().filter(v -> !v.getId().equals(apply.getId())).anyMatch(v -> {
|
||||
String applyYear = v.getApplyTime().substring(0, 4);
|
||||
return (currentYear - 10) < Integer.parseInt(applyYear);
|
||||
});
|
||||
|
||||
//近十五年是否有申请记录
|
||||
boolean hasApplyInFifteenYears = applyRecords.stream().filter(v -> !v.getId().equals(apply.getId())).anyMatch(v -> {
|
||||
String applyYear = v.getApplyTime().substring(0, 4);
|
||||
return (currentYear - 15) < Integer.parseInt(applyYear);
|
||||
});
|
||||
|
||||
//是否连续缴纳十年
|
||||
/* String sqlx = """
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
`aid_fund_member_pay`
|
||||
WHERE
|
||||
`year` BETWEEN @YearAgo
|
||||
AND @currentYear
|
||||
AND payed = 1
|
||||
AND userid = @userid
|
||||
""";
|
||||
Sql sqlTen = Sqls.create(sqlx).setParam("currentYear", currentYear).setParam("YearAgo", currentYear - 10).setParam("userid", apply.getApplyUser());
|
||||
Sql sqlFif = Sqls.create(sqlx).setParam("currentYear", currentYear).setParam("YearAgo", currentYear - 15).setParam("userid", apply.getApplyUser());
|
||||
*/
|
||||
Sys_user user = baseService.dao().fetch(Sys_user.class, ShiroUtil.getUserId());
|
||||
|
||||
boolean fullTenYears = DateUtil.thisYear() - Integer.parseInt(user.getAidFundDeductTime()) >= 10;
|
||||
boolean fullFifYears = DateUtil.thisYear() - Integer.parseInt(user.getAidFundDeductTime()) >= 15;
|
||||
|
||||
//补助比例
|
||||
double ratio = medicalSetting.getSubsidyRatio();
|
||||
// if (fullFifYears) {
|
||||
// ratio += medicalSetting.getFifteenYearNeverAddSubsidyRatio();
|
||||
// } else if (fullTenYears) {
|
||||
// ratio += medicalSetting.getTenYearNeverAddSubsidyRatio();
|
||||
// }
|
||||
// if (!hasApplyInFifteenYears) {
|
||||
// ratio += medicalSetting.getFifteenYearNeverAddSubsidyRatio();
|
||||
// } else if (!hasApplyInTenYears) {
|
||||
// ratio += medicalSetting.getTenYearNeverAddSubsidyRatio();
|
||||
// }
|
||||
|
||||
// 连续缴满15年 或者是 连续缴满10年
|
||||
if (fullFifYears) {
|
||||
ratio += medicalSetting.getFifteenYearNeverAddSubsidyRatio();
|
||||
} else if (fullTenYears) {
|
||||
ratio += medicalSetting.getTenYearNeverAddSubsidyRatio();
|
||||
}
|
||||
|
||||
|
||||
// double sumMoney = majorDisease ? personExpenseMoney + outpatientServiceMoney : personExpenseMoney;
|
||||
|
||||
//普通疾病不包含门诊费用 重大疾病包含门诊费
|
||||
//门诊费用 + 自费 + 个人承担
|
||||
double v = 0;
|
||||
|
||||
|
||||
if (majorDisease) {
|
||||
//如果是重大疾病
|
||||
v = personExpenseMoney + singleBearMoney + outpatientServiceMoney + bxyMoney;
|
||||
} else {
|
||||
//个人承担费用
|
||||
singleBearMoney = costs.stream().filter(c -> c.getSingleBearMoney() >= 10000).mapToDouble(MedicalApplyCost::getSingleBearMoney).sum();
|
||||
//自费
|
||||
personExpenseMoney = costs.stream().filter(c -> c.getSingleBearMoney() >= 10000).mapToDouble(MedicalApplyCost::getPersonExpenseMoney).sum();
|
||||
v = personExpenseMoney + singleBearMoney + outpatientServiceMoney + bxyMoney;
|
||||
}
|
||||
v = v * (ratio / 100);
|
||||
|
||||
// double v = (personExpenseMoney + singleBearMoney + (majorDisease ? outpatientServiceMoney : 0)) * (ratio / 100);
|
||||
|
||||
//每年最多补多少钱
|
||||
if (majorDisease) {
|
||||
if (medicalSetting.getMaxYearInDiseaseMoney() - subsidMoneyCurrentYear999 < v) {
|
||||
v = medicalSetting.getMaxYearInDiseaseMoney() - subsidMoneyCurrentYear999;
|
||||
|
||||
}
|
||||
} else {
|
||||
if (medicalSetting.getMaxYearNotInDiseaseMoney() - subsidMoneyCurrentYear000 < v) {
|
||||
v = medicalSetting.getMaxYearNotInDiseaseMoney() - subsidMoneyCurrentYear000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//是否重疾
|
||||
if (majorDisease) {
|
||||
// 连续缴满15年并且未申请并且补助金额等于年度最大金额
|
||||
if (fullFifYears && applyRecords.isEmpty() && v == medicalSetting.getMaxYearInDiseaseMoney()) {
|
||||
double fifteenYearNeverAddSubsidyRatio = medicalSetting.getFifteenYearNeverAddSubsidyRatio() / 100.0;
|
||||
v = (v + v * fifteenYearNeverAddSubsidyRatio);
|
||||
} else if (fullTenYears && applyRecords.isEmpty() && v == medicalSetting.getMaxYearInDiseaseMoney()) {
|
||||
// 连续缴满10年并且未申请并且补助金额等于年度最大金额
|
||||
double tenYearNeverAddSubsidyRatio = medicalSetting.getTenYearNeverAddSubsidyRatio() / 100.0;
|
||||
v = (v + v * tenYearNeverAddSubsidyRatio);
|
||||
}
|
||||
} else {
|
||||
//不是重疾
|
||||
// 连续缴满15年并且未申请并且补助金额等于年度最大金额
|
||||
if (fullFifYears && applyRecords.isEmpty() && v == medicalSetting.getMaxYearNotInDiseaseMoney()) {
|
||||
double fifteenYearNeverAddSubsidyRatio = medicalSetting.getFifteenYearNeverAddSubsidyRatio() / 100.0;
|
||||
v = (v + v * fifteenYearNeverAddSubsidyRatio);
|
||||
} else if (fullTenYears && applyRecords.isEmpty() && v == medicalSetting.getMaxYearNotInDiseaseMoney()) {
|
||||
// 连续缴满10年并且未申请并且补助金额等于年度最大金额
|
||||
double tenYearNeverAddSubsidyRatio = medicalSetting.getTenYearNeverAddSubsidyRatio() / 100.0;
|
||||
v = (v + v * tenYearNeverAddSubsidyRatio);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isBeyondAllMoney) {
|
||||
// if (v > medicalSetting.getBeyondMaxQuotaMoney()) {
|
||||
// v = medicalSetting.getBeyondMaxQuotaMoney();
|
||||
// }
|
||||
v = 10000;
|
||||
}
|
||||
|
||||
if (v < 0) {
|
||||
v = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第一次申请未满5000 补助金额为0 爱心基金为5000
|
||||
*/
|
||||
if (apply.getApplyNum() == 1 && apply.getMajorDisease() && singleBearMoney < 5000) {
|
||||
v = 0;
|
||||
}
|
||||
|
||||
//如果是普通疾病并且多次住院中,个人自付如果没有超过一万的设为0
|
||||
if (!apply.getMajorDisease() && costs.stream().noneMatch(c -> c.getSingleBearMoney() >= 10000)) {
|
||||
v = 0;
|
||||
}
|
||||
|
||||
NutMap nutMap = new NutMap();
|
||||
|
||||
if (apply.getStateId() == 4800) {
|
||||
nutMap.put("loveSubsidyMoney", apply.getLoveSubsidyMoney());
|
||||
} else {
|
||||
nutMap.put("loveSubsidyMoney", (long) (isFirstApply && majorDisease ? medicalSetting.getLoveMoney() : 0));
|
||||
}
|
||||
|
||||
DecimalFormat format = new DecimalFormat("######0.00");
|
||||
|
||||
nutMap.put("forecastSubsidyMoney", format.format(v));
|
||||
|
||||
return nutMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取申请成功的记录
|
||||
*
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
public List<NutMap> getApplyRecord(List<String> userIds) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.isMajorDiseases
|
||||
FROM
|
||||
medical_apply info
|
||||
LEFT JOIN medical_disease_type type ON info.diseaseId = type.id
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("info.userId", "in", userIds);
|
||||
cnd.and("ins.state", "=", ProcessInstanceStateEnum.FINISHED.getCode());
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = listMap(sql);
|
||||
return listMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user