commit
This commit is contained in:
+19
-3
@@ -134,7 +134,7 @@ public class MedicalFoundationAuditController {
|
|||||||
@At
|
@At
|
||||||
@SLog(tag = "医院补助-互管会审核", msg = "修改了一条住院记录")
|
@SLog(tag = "医院补助-互管会审核", msg = "修改了一条住院记录")
|
||||||
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
||||||
public Result updateCost(String data){
|
public Result updateCost(String data) {
|
||||||
List<MedicalApplyCost> applyCosts = Json.fromJsonAsList(MedicalApplyCost.class, data);
|
List<MedicalApplyCost> applyCosts = Json.fromJsonAsList(MedicalApplyCost.class, data);
|
||||||
medicalApplyService.updateIgnoreNull(applyCosts);
|
medicalApplyService.updateIgnoreNull(applyCosts);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
@@ -145,14 +145,30 @@ public class MedicalFoundationAuditController {
|
|||||||
@SLog(tag = "医院补助-互管会审核", msg = "互管会审核了一条记录")
|
@SLog(tag = "医院补助-互管会审核", msg = "互管会审核了一条记录")
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
||||||
public Result executeTask(@Param("data") String param, String id){
|
public Result executeTask(@Param("data") String param) {
|
||||||
|
if (StrUtil.isBlank(param)) {
|
||||||
|
return Result.error("参数错误");
|
||||||
|
}
|
||||||
Dict args = Json.fromJson(Dict.class, param);
|
Dict args = Json.fromJson(Dict.class, param);
|
||||||
|
String loveSubsidyMoney = args.getStr("tf_loveSubsidyMoney");
|
||||||
|
String forecastSubsidyMoney = args.getStr("tf_forecastSubsidyMoney");
|
||||||
if (args.getInt("submitType") == 1) {
|
if (args.getInt("submitType") == 1) {
|
||||||
|
medicalApplyService.update(Chain.make("loveSubsidyMoney", loveSubsidyMoney)
|
||||||
|
.add("forecastSubsidyMoney", forecastSubsidyMoney),
|
||||||
|
Cnd.where("id", "=", args.getStr("id")));
|
||||||
}
|
}
|
||||||
flowCommonService.executeTask(args);
|
flowCommonService.executeTask(args);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
@ApiOperation("预测补助金额")
|
||||||
|
@SaCheckPermission("medicalMutualAid.medical.foundationAudit")
|
||||||
|
public Result calcMedicalMoney(String id, String diseaseId) {
|
||||||
|
NutMap nutMap = medicalApplyService.calcMedicalMoney(id, diseaseId);
|
||||||
|
return Result.success(nutMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+127
-120
@@ -6,6 +6,7 @@ import com.budwk.app.base.result.Result;
|
|||||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||||
import com.budwk.app.sys.models.Sys_user;
|
import com.budwk.app.sys.models.Sys_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.MedicalApply;
|
||||||
import com.budwk.app.zhgh.staffbenefit.medicalMutualAid.medical.model.MedicalApplyCost;
|
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.MedicalDiseaseType;
|
||||||
@@ -21,6 +22,7 @@ import org.nutz.lang.Lang;
|
|||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -133,13 +135,14 @@ public class MedicalApplyServiceImpl extends BaseServiceImpl<MedicalApply> imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NutMap calcMedicalMoney(String applyId, String diseaseId) {
|
public NutMap calcMedicalMoney(String applyId, String diseaseId) {
|
||||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
|
||||||
|
|
||||||
MedicalSetting medicalSetting = dao().fetch(MedicalSetting.class);
|
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()));
|
NutMap applyInfo = this.getApplyInfo(applyId);
|
||||||
List<MedicalApplyCost> costs = dao().query(MedicalApplyCost.class, Cnd.where("applyId", "=", apply.getId()));
|
//获取申请疾病类型
|
||||||
|
MedicalDiseaseType applyDiseaseType = dao().fetch(MedicalDiseaseType.class, Cnd.where(MedicalDiseaseType::getId, "=", applyInfo.getString("diseaseId")));
|
||||||
|
//获取申请住院信息
|
||||||
|
List<MedicalApplyCost> costs = dao().query(MedicalApplyCost.class, Cnd.where("applyId", "=", applyId));
|
||||||
//个人承担费用
|
//个人承担费用
|
||||||
BigDecimal singleBearMoney = costs.stream()
|
BigDecimal singleBearMoney = costs.stream()
|
||||||
.map(MedicalApplyCost::getSingleBearMoney)
|
.map(MedicalApplyCost::getSingleBearMoney)
|
||||||
@@ -162,7 +165,7 @@ public class MedicalApplyServiceImpl extends BaseServiceImpl<MedicalApply> imple
|
|||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
//可能此次申请人退休变号了,所以也要把旧号的申请记录一起查出来
|
//可能此次申请人退休变号了,所以也要把旧号的申请记录一起查出来
|
||||||
Sys_user currentUser = dao().fetch(Sys_user.class, apply.getUserId());
|
Sys_user currentUser = dao().fetch(Sys_user.class, applyInfo.getString("userId"));
|
||||||
List<String> allUserIds = Lang.list(currentUser.getId());
|
List<String> allUserIds = Lang.list(currentUser.getId());
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(currentUser.getOldLoginName())) {
|
if (StrUtil.isNotBlank(currentUser.getOldLoginName())) {
|
||||||
@@ -176,16 +179,10 @@ public class MedicalApplyServiceImpl extends BaseServiceImpl<MedicalApply> imple
|
|||||||
//是否首次申请 爱心互助基金 重大疾病
|
//是否首次申请 爱心互助基金 重大疾病
|
||||||
boolean isFirstApply = applyRecords.stream().filter(v -> v.getBoolean("isMajorDiseases")).toList().isEmpty();
|
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 -> {
|
List<NutMap> applyRecordList = applyRecords.stream().filter(applyRecord -> {
|
||||||
int applyYear = DateUtil.year(DateUtil.parse(applyRecord.getString("applyTime")));
|
int applyYear = DateUtil.year(DateUtil.parse(applyRecord.getString("applyTime")));
|
||||||
if (!applyRecord.getString("id").equals(apply.getId()) && applyYear == DateUtil.thisYear()) {
|
if (!applyRecord.getString("id").equals(applyId) && applyYear == DateUtil.thisYear()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -193,68 +190,36 @@ public class MedicalApplyServiceImpl extends BaseServiceImpl<MedicalApply> imple
|
|||||||
|
|
||||||
//今年获得的补助(重疾)
|
//今年获得的补助(重疾)
|
||||||
BigDecimal subsidMoneyCurrentYear999 = applyRecordList.stream()
|
BigDecimal subsidMoneyCurrentYear999 = applyRecordList.stream()
|
||||||
.map(a -> a.getString("loveSubsidyMoney")) // 获取 String
|
.filter(s -> s.getBoolean("isMajorDiseases"))
|
||||||
.filter(Objects::nonNull) // 过滤 null
|
.map(a -> a.getString("loveSubsidyMoney") + a.getString("subsidyMoney"))
|
||||||
.filter(s -> !s.trim().isEmpty()) // 过滤空字符串(可选但推荐)
|
.map(BigDecimal::new)
|
||||||
.map(BigDecimal::new) // 安全构造 BigDecimal
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.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();
|
BigDecimal subsidMoneyCurrentYear000 = applyRecordList.stream()
|
||||||
|
.filter(s -> !s.getBoolean("isMajorDiseases"))
|
||||||
|
.map(a -> a.getString("loveSubsidyMoney") + a.getString("subsidyMoney"))
|
||||||
|
.map(BigDecimal::new)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
//历年来所获全部补助
|
//历年来所获全部补助
|
||||||
long allMoney = applyRecords.stream().mapToLong(v -> (long) (v.getSubsidyMoney() + v.getLoveSubsidyMoney())).sum();
|
BigDecimal allMoney = applyRecords.stream()
|
||||||
|
.map(a -> a.getString("loveSubsidyMoney") + a.getString("subsidyMoney"))
|
||||||
|
.map(BigDecimal::new)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
//是否超过历年所获补助限额
|
//是否超过历年所获补助限额
|
||||||
Boolean isBeyondAllMoney = allMoney > medicalSetting.getPreviousYearMaxMoney();
|
Boolean isBeyondAllMoney = allMoney.compareTo(medicalSetting.getPreviousYearMaxMoney()) > 0;
|
||||||
|
|
||||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
|
||||||
|
|
||||||
|
|
||||||
//近十年是否有申请记录
|
Sys_user user = dao().fetch(Sys_user.class, SecurityUtil.getUserId());
|
||||||
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 fullTenYears = DateUtil.thisYear() - Integer.parseInt(user.getAidFundDeductTime()) >= 10;
|
||||||
boolean fullFifYears = DateUtil.thisYear() - Integer.parseInt(user.getAidFundDeductTime()) >= 15;
|
boolean fullFifYears = DateUtil.thisYear() - Integer.parseInt(user.getAidFundDeductTime()) >= 15;
|
||||||
|
|
||||||
//补助比例
|
//补助比例
|
||||||
double ratio = medicalSetting.getSubsidyRatio();
|
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年
|
// 连续缴满15年 或者是 连续缴满10年
|
||||||
if (fullFifYears) {
|
if (fullFifYears) {
|
||||||
@@ -264,99 +229,114 @@ public class MedicalApplyServiceImpl extends BaseServiceImpl<MedicalApply> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// double sumMoney = majorDisease ? personExpenseMoney + outpatientServiceMoney : personExpenseMoney;
|
//是否重疾
|
||||||
|
Boolean isMajorDiseases = applyDiseaseType.getIsMajorDiseases();
|
||||||
|
if (StrUtil.isNotBlank(diseaseId)) {
|
||||||
|
MedicalDiseaseType diseaseType = dao().fetch(MedicalDiseaseType.class, Cnd.where(MedicalDiseaseType::getId, "=", diseaseId));
|
||||||
|
isMajorDiseases = diseaseType.getIsMajorDiseases();
|
||||||
|
}
|
||||||
|
|
||||||
//普通疾病不包含门诊费用 重大疾病包含门诊费
|
//普通疾病不包含门诊费用 重大疾病包含门诊费
|
||||||
//门诊费用 + 自费 + 个人承担
|
//门诊费用 + 自费 + 个人承担
|
||||||
double v = 0;
|
BigDecimal allMedicalMoney;
|
||||||
|
|
||||||
|
|
||||||
if (majorDisease) {
|
if (isMajorDiseases) {
|
||||||
//如果是重大疾病
|
//如果是重大疾病
|
||||||
v = personExpenseMoney + singleBearMoney + outpatientServiceMoney + bxyMoney;
|
allMedicalMoney = personExpenseMoney.add(singleBearMoney).add(outpatientServiceMoney).add(bxyMoney);
|
||||||
} else {
|
} else {
|
||||||
//个人承担费用
|
//个人承担费用
|
||||||
singleBearMoney = costs.stream().filter(c -> c.getSingleBearMoney() >= 10000).mapToDouble(MedicalApplyCost::getSingleBearMoney).sum();
|
singleBearMoney = costs.stream()
|
||||||
|
.map(MedicalApplyCost::getSingleBearMoney)
|
||||||
|
.filter(amount -> amount.compareTo(BigDecimal.valueOf(10000)) >= 0) // >= 10000
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
//自费
|
//自费
|
||||||
personExpenseMoney = costs.stream().filter(c -> c.getSingleBearMoney() >= 10000).mapToDouble(MedicalApplyCost::getPersonExpenseMoney).sum();
|
personExpenseMoney = costs.stream()
|
||||||
v = personExpenseMoney + singleBearMoney + outpatientServiceMoney + bxyMoney;
|
.map(MedicalApplyCost::getPersonExpenseMoney)
|
||||||
|
.filter(amount -> amount.compareTo(BigDecimal.valueOf(10000)) >= 0) // >= 10000
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
allMedicalMoney = personExpenseMoney.add(singleBearMoney).add(outpatientServiceMoney).add(bxyMoney);
|
||||||
}
|
}
|
||||||
v = v * (ratio / 100);
|
allMedicalMoney = allMedicalMoney
|
||||||
|
.multiply(BigDecimal.valueOf(ratio))
|
||||||
// double v = (personExpenseMoney + singleBearMoney + (majorDisease ? outpatientServiceMoney : 0)) * (ratio / 100);
|
.divide(BigDecimal.valueOf(100), 10, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
//每年最多补多少钱
|
//每年最多补多少钱
|
||||||
if (majorDisease) {
|
if (isMajorDiseases) {
|
||||||
if (medicalSetting.getMaxYearInDiseaseMoney() - subsidMoneyCurrentYear999 < v) {
|
BigDecimal maxYearInDiseaseMoney = medicalSetting.getMaxYearInDiseaseMoney();
|
||||||
v = medicalSetting.getMaxYearInDiseaseMoney() - subsidMoneyCurrentYear999;
|
//最大补助金额减去今年已获得
|
||||||
|
BigDecimal availableLimit = maxYearInDiseaseMoney.subtract(subsidMoneyCurrentYear999);
|
||||||
|
if (allMedicalMoney.compareTo(availableLimit) > 0) {
|
||||||
|
allMedicalMoney = availableLimit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (medicalSetting.getMaxYearNotInDiseaseMoney() - subsidMoneyCurrentYear000 < v) {
|
BigDecimal maxYearNotInDiseaseMoney = medicalSetting.getMaxYearNotInDiseaseMoney();
|
||||||
v = medicalSetting.getMaxYearNotInDiseaseMoney() - subsidMoneyCurrentYear000;
|
//最大补助金额减去今年已获得
|
||||||
|
BigDecimal availableLimit = maxYearNotInDiseaseMoney.subtract(subsidMoneyCurrentYear000);
|
||||||
|
if (allMedicalMoney.compareTo(availableLimit) > 0) {
|
||||||
|
allMedicalMoney = availableLimit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//是否重疾
|
// 根据是否为重大疾病,确定对应的年度补助上限
|
||||||
if (majorDisease) {
|
BigDecimal maxYearMedicalMoney = isMajorDiseases
|
||||||
// 连续缴满15年并且未申请并且补助金额等于年度最大金额
|
? medicalSetting.getMaxYearInDiseaseMoney() // 重大疾病年度最高补助金额
|
||||||
if (fullFifYears && applyRecords.isEmpty() && v == medicalSetting.getMaxYearInDiseaseMoney()) {
|
: medicalSetting.getMaxYearNotInDiseaseMoney(); // 非重大疾病年度最高补助金额
|
||||||
double fifteenYearNeverAddSubsidyRatio = medicalSetting.getFifteenYearNeverAddSubsidyRatio() / 100.0;
|
|
||||||
v = (v + v * fifteenYearNeverAddSubsidyRatio);
|
// 判断是否满足“从未申请 + 补助金额恰好等于年度上限”的上浮条件
|
||||||
} else if (fullTenYears && applyRecords.isEmpty() && v == medicalSetting.getMaxYearInDiseaseMoney()) {
|
boolean isEligibleForBonus = applyRecords.isEmpty()
|
||||||
// 连续缴满10年并且未申请并且补助金额等于年度最大金额
|
&& allMedicalMoney.compareTo(maxYearMedicalMoney) == 0;
|
||||||
double tenYearNeverAddSubsidyRatio = medicalSetting.getTenYearNeverAddSubsidyRatio() / 100.0;
|
|
||||||
v = (v + v * tenYearNeverAddSubsidyRatio);
|
// 若满足条件,根据连续缴费年限应用对应上浮比例
|
||||||
}
|
if (isEligibleForBonus) {
|
||||||
} else {
|
if (fullFifYears) {
|
||||||
//不是重疾
|
// 连续缴满15年且从未申请:应用15年专属上浮比例(如10%)
|
||||||
// 连续缴满15年并且未申请并且补助金额等于年度最大金额
|
double ratioPercent = medicalSetting.getFifteenYearNeverAddSubsidyRatio(); // 例如返回 10.0 表示 10%
|
||||||
if (fullFifYears && applyRecords.isEmpty() && v == medicalSetting.getMaxYearNotInDiseaseMoney()) {
|
BigDecimal ratioFactor = BigDecimal.valueOf(ratioPercent).divide(BigDecimal.valueOf(100), 10, RoundingMode.HALF_UP);
|
||||||
double fifteenYearNeverAddSubsidyRatio = medicalSetting.getFifteenYearNeverAddSubsidyRatio() / 100.0;
|
allMedicalMoney = allMedicalMoney.multiply(BigDecimal.ONE.add(ratioFactor)).setScale(2, RoundingMode.HALF_UP);
|
||||||
v = (v + v * fifteenYearNeverAddSubsidyRatio);
|
} else if (fullTenYears) {
|
||||||
} else if (fullTenYears && applyRecords.isEmpty() && v == medicalSetting.getMaxYearNotInDiseaseMoney()) {
|
// 连续缴满10年且从未申请:应用10年专属上浮比例(如5%)
|
||||||
// 连续缴满10年并且未申请并且补助金额等于年度最大金额
|
double ratioPercent = medicalSetting.getTenYearNeverAddSubsidyRatio(); // 例如返回 5.0 表示 5%
|
||||||
double tenYearNeverAddSubsidyRatio = medicalSetting.getTenYearNeverAddSubsidyRatio() / 100.0;
|
BigDecimal ratioFactor = BigDecimal.valueOf(ratioPercent).divide(BigDecimal.valueOf(100), 10, RoundingMode.HALF_UP);
|
||||||
v = (v + v * tenYearNeverAddSubsidyRatio);
|
allMedicalMoney = allMedicalMoney.multiply(BigDecimal.ONE.add(ratioFactor)).setScale(2, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
|
// 注意:15年条件优先于10年,若同时满足,仅执行15年分支
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isBeyondAllMoney) {
|
if (isBeyondAllMoney) {
|
||||||
// if (v > medicalSetting.getBeyondMaxQuotaMoney()) {
|
allMedicalMoney = new BigDecimal("10000");
|
||||||
// v = medicalSetting.getBeyondMaxQuotaMoney();
|
}
|
||||||
// }
|
if (allMedicalMoney.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
v = 10000;
|
allMedicalMoney = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v < 0) {
|
// 规则1:首次申请的重大疾病患者,若个人自付不足5000元,不给予常规补助(由爱心基金覆盖)
|
||||||
v = 0;
|
if (applyInfo.getInt("applyNum") == 1
|
||||||
|
&& applyDiseaseType.getIsMajorDiseases()
|
||||||
|
&& singleBearMoney != null
|
||||||
|
&& singleBearMoney.compareTo(new BigDecimal("5000")) < 0) {
|
||||||
|
allMedicalMoney = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// 规则2:普通疾病患者,只有当至少有一次住院自付 ≥ 10000元时才给予补助;否则补助为0
|
||||||
* 第一次申请未满5000 补助金额为0 爱心基金为5000
|
if (!applyDiseaseType.getIsMajorDiseases()
|
||||||
*/
|
&& costs.stream().noneMatch(c -> {
|
||||||
if (apply.getApplyNum() == 1 && apply.getMajorDisease() && singleBearMoney < 5000) {
|
BigDecimal bear = c.getSingleBearMoney();
|
||||||
v = 0;
|
return bear != null && bear.compareTo(new BigDecimal("10000")) >= 0;
|
||||||
}
|
})) {
|
||||||
|
allMedicalMoney = BigDecimal.ZERO;
|
||||||
//如果是普通疾病并且多次住院中,个人自付如果没有超过一万的设为0
|
|
||||||
if (!apply.getMajorDisease() && costs.stream().noneMatch(c -> c.getSingleBearMoney() >= 10000)) {
|
|
||||||
v = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NutMap nutMap = new NutMap();
|
NutMap nutMap = new NutMap();
|
||||||
|
|
||||||
if (apply.getStateId() == 4800) {
|
if (Objects.equals(applyInfo.getString("state"), ProcessInstanceStateEnum.FINISHED.getCode())) {
|
||||||
nutMap.put("loveSubsidyMoney", apply.getLoveSubsidyMoney());
|
nutMap.put("loveSubsidyMoney", applyInfo.getString("loveSubsidyMoney"));
|
||||||
} else {
|
} else {
|
||||||
nutMap.put("loveSubsidyMoney", (long) (isFirstApply && majorDisease ? medicalSetting.getLoveMoney() : 0));
|
nutMap.put("loveSubsidyMoney", (isFirstApply && isMajorDiseases ? medicalSetting.getLoveMoney() : 0));
|
||||||
}
|
}
|
||||||
|
nutMap.put("forecastSubsidyMoney", allMedicalMoney.setScale(2, RoundingMode.HALF_UP));
|
||||||
DecimalFormat format = new DecimalFormat("######0.00");
|
|
||||||
|
|
||||||
nutMap.put("forecastSubsidyMoney", format.format(v));
|
|
||||||
|
|
||||||
return nutMap;
|
return nutMap;
|
||||||
}
|
}
|
||||||
@@ -388,4 +368,31 @@ public class MedicalApplyServiceImpl extends BaseServiceImpl<MedicalApply> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取申请信息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public NutMap getApplyInfo(String id) {
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
info.*,
|
||||||
|
ins.state,
|
||||||
|
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.id", "=", id);
|
||||||
|
sql.setCondition(cnd);
|
||||||
|
sql.setCallback(Sqls.callback.map());
|
||||||
|
dao().execute(sql);
|
||||||
|
return (NutMap) sql.getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-3
@@ -75,11 +75,23 @@ const MEDICAL_INFO = {
|
|||||||
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
|
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
|
||||||
:value="task.ext.submitType"></dict-tag>
|
:value="task.ext.submitType"></dict-tag>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
|
|
||||||
<el-descriptions-item label="详细疾病名称" v-if="task.taskFormData.diseaseDetailName" :span="3">{{
|
<el-descriptions-item label="详细疾病名称"
|
||||||
|
v-if="task.taskName==='39916c1e-857d-407d-86c1-678ccf3011bc'"
|
||||||
|
:span="3">{{
|
||||||
task.taskFormData.diseaseDetailName }}
|
task.taskFormData.diseaseDetailName }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="办理意见" v-if="!task.ext.isFirstTaskNode":span="3">{{
|
<template v-if="task.taskName==='cd560356-cc70-48b5-8d99-ff9bd3505869'">
|
||||||
|
<el-descriptions-item label="预测补助金额" :span="3">
|
||||||
|
{{
|
||||||
|
task.taskFormData.tf_forecastSubsidyMoney }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="爱心基金(元)" :span="3">
|
||||||
|
{{
|
||||||
|
task.taskFormData.tf_loveSubsidyMoney }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</template>
|
||||||
|
<el-descriptions-item label="办理意见" v-if="!task.ext.isFirstTaskNode" :span="3">{{
|
||||||
task.taskFormData.opinion }}
|
task.taskFormData.opinion }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
|
|||||||
+14
-4
@@ -65,7 +65,7 @@ layout("/layouts/platform.html"){
|
|||||||
<el-button v-if="row.taskState === 10" @click="onAudit(row)" size="mini" type="primary">
|
<el-button v-if="row.taskState === 10" @click="onAudit(row)" size="mini" type="primary">
|
||||||
审核
|
审核
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="row.canRevoke" @click="onRevoke(row)" size="mini" type="danger">撤回
|
<el-button v-if="row.canRevoke||row.curTaskName==='结束'" @click="onRevoke(row)" size="mini" type="danger">撤回
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -167,7 +167,9 @@ layout("/layouts/platform.html"){
|
|||||||
</span>
|
</span>
|
||||||
<el-input-number v-model="formData.tf_forecastSubsidyMoney"
|
<el-input-number v-model="formData.tf_forecastSubsidyMoney"
|
||||||
style="width: 50%"></el-input-number>
|
style="width: 50%"></el-input-number>
|
||||||
<el-button @click="calcMoney(formData.id)" type="primary">重新计算金额</el-button>
|
<el-button @click="calcMedicalMoney(formData.id,formData.tf_diseaseId)" type="primary">
|
||||||
|
重新计算金额
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
@@ -227,7 +229,6 @@ layout("/layouts/platform.html"){
|
|||||||
const personExpenseMoney = cost.hospitalSumMoney - cost.reimbursementMoney - cost.singleBearMoney
|
const personExpenseMoney = cost.hospitalSumMoney - cost.reimbursementMoney - cost.singleBearMoney
|
||||||
cost.personExpenseMoney = isNaN(personExpenseMoney) ? 0 : personExpenseMoney < 0 ? 0 : personExpenseMoney.toFixed(2)
|
cost.personExpenseMoney = isNaN(personExpenseMoney) ? 0 : personExpenseMoney < 0 ? 0 : personExpenseMoney.toFixed(2)
|
||||||
})
|
})
|
||||||
console.log(this.costList)
|
|
||||||
this.$axios.post("/platform/medicalMutualAid/medical/foundationAudit/updateCost", {
|
this.$axios.post("/platform/medicalMutualAid/medical/foundationAudit/updateCost", {
|
||||||
data: JSON.stringify(this.costList)
|
data: JSON.stringify(this.costList)
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
@@ -237,7 +238,15 @@ layout("/layouts/platform.html"){
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 重新计算预测补助金额
|
// 重新计算预测补助金额
|
||||||
calcMoney() {
|
calcMedicalMoney(id, diseaseId) {
|
||||||
|
this.$axios.post("/platform/medicalMutualAid/medical/foundationAudit/calcMedicalMoney", {
|
||||||
|
id, diseaseId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$set(this.formData, 'tf_loveSubsidyMoney', res.data.loveSubsidyMoney)
|
||||||
|
this.$set(this.formData, 'tf_forecastSubsidyMoney', res.data.forecastSubsidyMoney)
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
diseaseIdChange(val) {
|
diseaseIdChange(val) {
|
||||||
const disease = this.diseaseList.find(i => i.id === val)
|
const disease = this.diseaseList.find(i => i.id === val)
|
||||||
@@ -263,6 +272,7 @@ layout("/layouts/platform.html"){
|
|||||||
taskName: row.curTaskName
|
taskName: row.curTaskName
|
||||||
}
|
}
|
||||||
this.diseaseIdChange(row.diseaseId)
|
this.diseaseIdChange(row.diseaseId)
|
||||||
|
this.calcMedicalMoney(row.id, row.diseaseId)
|
||||||
this.$refs.medicalInfoRef.onOpen(row)
|
this.$refs.medicalInfoRef.onOpen(row)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user