Commit 7a83fb60 authored by 蔡镇泽's avatar 蔡镇泽

费用结算

parent 7af024ff
......@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
......@@ -83,8 +84,8 @@ public class AccountController {
* @return 返回机构结当月算详情
*/
@GetMapping("/expenseSettlement")
public Result<ExpenseVo> expenseSettlement(ExpenseSettlementReq req) {
if (null == req.getSrvOrganId() || null == req.getAccountsTime()) {
public Result<ExpenseVo> expenseSettlement(ExpenseSettlementReq req) throws ParseException {
if (null == req.getSrvOrganId() || StringUtils.isBlank(req.getAccountsTime())) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (req.getPageNum() == null) {
......
......@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.hungraim.ltc.pojo.entity.account.ChDisabAccounts;
import com.hungraim.ltc.pojo.vo.account.*;
import java.text.ParseException;
public interface AccountService extends IService<ChDisabAccounts> {
/**
......@@ -16,5 +18,5 @@ public interface AccountService extends IService<ChDisabAccounts> {
AccountOperVo getSrvOrganDetail(Long accountsId);
ExpenseVo expenseSettlement(ExpenseSettlementReq req);
ExpenseVo expenseSettlement(ExpenseSettlementReq req) throws ParseException;
}
......@@ -22,6 +22,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
......@@ -79,7 +81,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
}
@Override
public ExpenseVo expenseSettlement(ExpenseSettlementReq req) {
public ExpenseVo expenseSettlement(ExpenseSettlementReq req) throws ParseException {
Page<ExpenseSettlementInfoBo> page = new Page<>(req.getPageNum(), req.getPageSize());
Page<ExpenseSettlementInfoBo> expenseSettlementInfo = srvTaskMapper.getExpenseSettlementInfo(page, req);
List<ExpenseSettlementVo> vos = new ArrayList<>();
......@@ -87,17 +89,21 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
for (ExpenseSettlementInfoBo bo : expenseSettlementInfo.getRecords()) {
ExpenseSettlementVo vo = new ExpenseSettlementVo();
BeanUtil.copyProperties(bo, vo);
//护理等级
vo.setNursingGrade(CfgSrvLevel.getMsg(bo.getSrvLevelId()));
//服务开始时间
DateFormat df = new SimpleDateFormat("yyyy-MM");
Date parse = df.parse(req.getAccountsTime());
if (bo.getSrvStartTime() != null) {
if (bo.getSrvStartTime().getTime() > req.getAccountsTime().getTime()) {
if (bo.getSrvStartTime().getTime() > parse.getTime()) {
vo.setSrvStartTime(bo.getSrvStartTime());
} else {
vo.setSrvStartTime(req.getAccountsTime());
vo.setSrvStartTime(parse);
}
}
//服务结束时间
if (bo.getSrvEndTime() != null) {
Date lastDayOfMonth = getLastDayOfMonth(req.getAccountsTime());
Date lastDayOfMonth = getLastDayOfMonth(parse);
if (bo.getSrvEndTime().getTime() > lastDayOfMonth.getTime()) {
vo.setSrvEndTime(lastDayOfMonth);
} else {
......@@ -112,7 +118,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
Integer effectiveSettlementDate = vo.getEffectiveSettlementDate();//有效结算日
ChCfgCostStandard costStandard = chCfgCostStandardMapper.selectOne(new LambdaQueryWrapper<ChCfgCostStandard>()
.eq(ChCfgCostStandard::getOrganId, bo.getOrganId())
.eq(ChCfgCostStandard::getSrvlevelId, bo.getSrvLevelId())
.eq(ChCfgCostStandard::getSrvLevelId, bo.getSrvLevelId())
.eq(ChCfgCostStandard::getSrvModeId, bo.getSrvModeId()));//基护费用标准(可配置)
BigDecimal foundation = BigDecimal.valueOf(costStandard.getCost()).multiply(BigDecimal.valueOf(effectiveSettlementDate));
vo.setFoundationProtectionCost(foundation.doubleValue());
......@@ -314,15 +320,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
//合计
ExpenseSettlementTotalVo totalVo = new ExpenseSettlementTotalVo();
BigDecimal foundationProtectionCost = BigDecimal.valueOf(0);
totalVo.setFoundationProtectionCost(foundationProtectionCost.doubleValue());
BigDecimal expensesPayableFoundationProtection = BigDecimal.valueOf(0);
totalVo.setExpensesPayableFoundationProtection(foundationProtectionCost.doubleValue());
BigDecimal careCosts = BigDecimal.valueOf(0);
totalVo.setCareCosts(foundationProtectionCost.doubleValue());
BigDecimal carePayable = BigDecimal.valueOf(0);
totalVo.setCarePayable(foundationProtectionCost.doubleValue());
BigDecimal totalAmountDue = BigDecimal.valueOf(0);
totalVo.setTotalAmountDue(foundationProtectionCost.doubleValue());
for (ExpenseSettlementVo vo : vos) {
//基护费用
foundationProtectionCost = foundationProtectionCost.add(BigDecimal.valueOf(vo.getFoundationProtectionCost()));
......@@ -335,6 +336,11 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
//应拨付总金额
totalAmountDue = totalAmountDue.add(BigDecimal.valueOf(vo.getTotalAmountDue()));
}
totalVo.setFoundationProtectionCost(foundationProtectionCost.doubleValue());
totalVo.setExpensesPayableFoundationProtection(foundationProtectionCost.doubleValue());
totalVo.setCareCosts(foundationProtectionCost.doubleValue());
totalVo.setCarePayable(foundationProtectionCost.doubleValue());
totalVo.setTotalAmountDue(foundationProtectionCost.doubleValue());
ExpenseVo expenseVo = new ExpenseVo();
expenseVo.setExpenseSettlements(vos);
expenseVo.setTotal(totalVo);
......@@ -357,7 +363,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private int getDay(Date date) {
Calendar cale = Calendar.getInstance();
cale.setTime(date);
return cale.get(Calendar.DAY_OF_WEEK);
return cale.get(Calendar.DAY_OF_MONTH);
}
}
......@@ -36,7 +36,7 @@ public class ChCfgCostStandard implements Serializable {
/**
* 服务等级id
*/
private Integer srvlevelId;
private Integer srvLevelId;
/**
* 费用(元/人/天)
......
......@@ -27,7 +27,7 @@ public class ExpenseSettlementInfoBo {
/**
* 失能人员身份证号
*/
private Long certiCode;
private String certiCode;
/**
* 服务方式id
......
package com.hungraim.ltc.pojo.vo.account;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hungraim.ltc.pojo.vo.BaseReq;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class ExpenseSettlementReq extends BaseReq {
......@@ -18,8 +14,6 @@ public class ExpenseSettlementReq extends BaseReq {
/**
* 结算月份
*/
@DateTimeFormat(pattern = "yyyy-MM")
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
private Date accountsTime;
private String accountsTime;
}
......@@ -15,12 +15,12 @@ public class ExpenseSettlementVo {
/**
* 失能人员身份证号
*/
private Long certiCode;
private String certiCode;
/**
* 护理等级
*/
private Long nursingGrade;
private String nursingGrade;
/**
* 服务方式名称
......@@ -43,11 +43,6 @@ public class ExpenseSettlementVo {
private Integer effectiveSettlementDate;
/**
* 基护费用标准
*/
private String costStandardOfFoundationProtection;
/**
* 基护费用
*/
private Double foundationProtectionCost;
......@@ -97,9 +92,4 @@ public class ExpenseSettlementVo {
*/
private Double totalAmountDue;
/**
* 合计
*/
private ExpenseSettlementTotalVo total;
}
......@@ -25,4 +25,14 @@ public enum CfgSrvLevel {
public String getMsg() {
return msg;
}
public static String getMsg(String code) {
CfgSrvLevel[] enums = values();
for (CfgSrvLevel state : enums) {
if (state.getCode().equals(code)) {
return state.getMsg();
}
}
return "";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment