Commit a559fd3b authored by zhangwanglin's avatar zhangwanglin

结算代码提交

parent c5e36455
......@@ -3,8 +3,7 @@ package com.hungraim.ltc.account.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.account.service.AccountService;
import com.hungraim.ltc.pojo.entity.account.ChDisabAccounts;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccountsResp;
import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.util.FileUtils;
import com.hungraim.ltc.util.Result;
......@@ -100,8 +99,12 @@ public class AccountController {
@RequestMapping("/organAccountTaskExecute")
/**
* 任务执行
*
* @return
*/
@PostMapping("/organAccountTaskExecute")
public Result organAccountTaskExecute(AccountTaskReqVO accountTaskReqVO){
List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS = accountTaskReqVO.getAccountTaskList();
accountService.organAccountTaskExecute(accountTaskExecuteReqVOS);
......@@ -164,17 +167,136 @@ public class AccountController {
/**
* 查询机构结算信息列表明细
*
* @param id 结算id
* @param accountsId 结算id
* @return
*/
@GetMapping("/queryOrganAccountsDetail")
public Result<List<ChDisabDetailAccountsResp>> queryOrganAccountsDetail(String id) {
List<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(id);
public Result<Page<ChDisabDetailAccountsResp>> queryOrganAccountsDetail(Integer pageNum, Integer pageSize, String accountsId) {
if (StringUtils.isBlank(accountsId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,accountsId,null);
return Result.success(chAssessDetailAccounts);
}
/**
* 基金申报列表查询
* @param
* @return
*/
@GetMapping("/queryAccountsDeclareList")
public Result<Page<ChDisabDetailAccountsResp>> queryAccountsDeclareList(Integer pageNum, Integer pageSize) {
Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,null,0);
return Result.success(chAssessDetailAccounts);
}
/**
* 暂缓列表查询
* @param
* @return
*/
@GetMapping("/queryDelayAccountList")
public Result<Page<ChDisabDetailAccountsResp>> queryDelayAccountList(Integer pageNum, Integer pageSize) {
Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,null,2);
return Result.success(chAssessDetailAccounts);
}
/**
* 暂缓
* @param status 1 恢复 2 暂缓
* @return
*/
@PostMapping("/delayAccountCommit")
public Result<Page<ChDisabDetailAccountsResp>> delayAccountCommit(Long accountsDetailId, Short status) {
int result = accountService.delayAccountCommit(accountsDetailId, status);
if (result > 0) {
return Result.success();
} else {
return Result.failed();
}
}
/**
* 基金申报提交
* @param
* @return
*/
@PostMapping("/accountsFreeCommit")
public Result accountsFreeCommit(Long accountsDetailId) {
int result = accountService.accountsFreeCommit(accountsDetailId);
if (result > 0) {
return Result.success();
} else {
return Result.failed();
}
}
/**
* 查询护理记录
*
* @param taskDetailId 结算详情id
* @return
*/
@GetMapping("/queryNursingRecords")
public Result<Page<NursingRecordsRespVO>> queryNursingRecords(Integer pageNum, Integer pageSize, String taskDetailId) {
Page<NursingRecordsRespVO> nursingRecordsRespVOList = accountService.queryNursingRecords(pageNum,pageSize,taskDetailId);
return Result.success(nursingRecordsRespVOList);
}
@GetMapping("/queryOverallCostRecords")
public Result<OverallEduceDecreaseCostRespVO> queryOverallCostRecords(OverallCostReqVO req) {
String certiCode = req.getCertiCode();
if (StringUtils.isBlank(certiCode)) {
return Result.failed("查询条件证件号不能为空");
}
OverallEduceDecreaseCostRespVO overallCostRecords = accountService.queryOverallCostRecords(req);
return Result.success(overallCostRecords);
}
/**
* 费用扣减提交
*
* @param req
* @return
*/
@PostMapping("/overallCostSubmit")
public Result overallCostSubmit(OverallCostSubmitReqVO req) {
int result = accountService.overallCostSubmit(req);
if(result > 0){
return Result.success();
}else{
return Result.failed();
}
}
/**
* 删除护理机构
*
* @param accountsDetailId 结算详情id
*/
@DeleteMapping("/deleteAccountsDetail")
public Result deleteAccountsDetail(Long accountsDetailId) {
if (null == accountsDetailId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
int result = accountService.deleteAccountsDetail(accountsDetailId);
if(result > 0){
return Result.success();
}else{
return Result.failed();
}
}
@GetMapping("/queryOverallCostList")
public Result<Page<OverallCostListRespVO>> queryOverallCostList(OverallCostReqVO req) {
Page<OverallCostListRespVO> overallCostRecords = accountService.queryOverallCostList(req);
return Result.success(overallCostRecords);
}
/**
* 机构结算管理提交复核
......
......@@ -2,12 +2,11 @@ package com.hungraim.ltc.account.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.account.ChDisabAccounts;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.vo.account.AccountExportDetailListResp;
import com.hungraim.ltc.pojo.vo.account.OrganAccountsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -19,15 +18,22 @@ public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAcc
List<OrganAccountsVO> getOrganAccountsList(String taskDetailId);
Page<SrvOrganAccountListResp> searchSrvOrganAccountList(Page page, List<Long> organIds, SrvOrganListReq req);
List<AccountExportDetailListResp> searchSrvOrganAccountDetailExport(String accountsId);
List<ChDisabDetailAccounts> queryAccountByCondition(@Param("taskDetailIds") List<String> taskDetailIds);
List<OrganAccountsVO> getOtherPlaceList(String programId);
Page<ChDisabDetailAccountsResp> queryOrganAccountsDetail(Page page,String accountsId,Integer status);
Page<NursingRecordsRespVO> queryNursingRecords(Page page, String taskDetailId);
OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req);
Page<OverallCostListRespVO> queryOverallCostList(Page page, OverallCostReqVO req);
int updateByAccountsId(String accountsId);
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.account.ChDisabAccounts;
import com.hungraim.ltc.pojo.vo.account.AccountOperVo;
import com.hungraim.ltc.pojo.vo.account.SrvOrganAccountListResp;
import com.hungraim.ltc.pojo.vo.account.SrvOrganListReq;
import com.hungraim.ltc.pojo.vo.account.SrvOrganListResp;
import org.apache.ibatis.annotations.Mapper;
......@@ -52,5 +53,10 @@ public interface ChDisabAccountsMapper extends BaseMapper<ChDisabAccounts> {
ChDisabAccounts queryAccountByCondition(String accountsTime, String modeName, String srvOrganId);
ChDisabAccounts queryAccountByCondition(String accountsTime, String modeName, String srvOrganId,Integer isDelay);
Page<SrvOrganAccountListResp> searchSrvOrganAccountList(Page page, List<Long> organIds, SrvOrganListReq req);
}
\ No newline at end of file
package com.hungraim.ltc.account.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccountsResp;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author mq
*/
@Mapper
@Repository
public interface ChDisabDetailAccountsMapper extends BaseMapper<ChDisabDetailAccounts> {
List<ChDisabDetailAccountsResp> queryOrganAccountsDetail(String accountsId);
}
......@@ -31,7 +31,16 @@ public interface AccountService extends IService<ChDisabAccounts> {
List<ChDisabDetailAccountsResp> queryOrganAccountsDetail(String id);
Page<ChDisabDetailAccountsResp> queryOrganAccountsDetail(Integer pageNum, Integer pageSize,String accountsId,Integer status);
Page<NursingRecordsRespVO> queryNursingRecords(Integer pageNum, Integer pageSize, String taskDetailId);
OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req);
Page<OverallCostListRespVO> queryOverallCostList(OverallCostReqVO req);
int overallCostSubmit(OverallCostSubmitReqVO req);
int updateChDisabAccounts(int id);
......@@ -39,4 +48,10 @@ public interface AccountService extends IService<ChDisabAccounts> {
void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS);
void otherPlaceHandler(String programId);
int deleteAccountsDetail(Long accountsDetailId);
int accountsFreeCommit(Long accountsDetailId);
int delayAccountCommit(Long accountsDetailId,Short status);
}
......@@ -15,9 +15,7 @@ import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCareService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCostStandard;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.account.ChDisabAccounts;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccountsResp;
import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskFinishItem;
import com.hungraim.ltc.pojo.vo.account.*;
......@@ -53,12 +51,8 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private final ChCfgCostStandardMapper chCfgCostStandardMapper;
private final ChDisabAccountsDetailMapper chDisabAccountsDetailMapper;
/*
private final ChAssessDetailAccountsMapper chAssessDetailAccountsMapper;
*/
private final ChDisabDetailAccountsMapper chDisabDetailAccountsMapper;
private final ChSrvTaskDetailMapper chSrvTaskDetailMapper;
private final ChSrvTaskFinishItemMapper chSrvTaskFinishItemMapper;;
......@@ -72,6 +66,19 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
BeanUtils.copyProperties(accountOperVo, chDisabAccounts);
chDisabAccounts.setChooseSettle((short) 0); // 是否结算(0未结算,1已结算)
this.saveOrUpdate(chDisabAccounts);
Short accountsStatus = accountOperVo.getAccountsStatus();
String accountsId = String.valueOf(accountOperVo.getAccountsId());
if(accountsStatus == 2) {
chDisabAccountsDetailMapper.updateByAccountsId(accountsId);
}
if(accountsStatus == 3) {
ChDisabAccounts chDisabAccountDTO = disabAccountsMapper.selectById(accountOperVo.getAccountsId());
BigDecimal reissueAmountTotal = chDisabAccountDTO.getReissueAmountTotal();
BigDecimal deductionAmountTotal = chDisabAccountDTO.getDeductionAmountTotal();
BigDecimal totalAllocatedExpenses = chDisabAccountDTO.getAllCost().add(reissueAmountTotal).subtract(deductionAmountTotal);
chDisabAccountDTO.setTotalAllocatedExpenses(totalAllocatedExpenses);
disabAccountsMapper.updateById(chDisabAccountDTO);
}
accountOperVo.setAccountsId(chDisabAccounts.getAccountsId());
baseAccountService.updateAttachs(chDisabAccounts.getAccountsId(), accountOperVo.getFileDataList(), AttachType.SRV_ORGAN_ACCOUNT);
}
......@@ -85,7 +92,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
public Page<SrvOrganAccountListResp> searchSrvOrganAccountList(SrvOrganListReq srvOrganListReq) {
List<Long> organIds = baseAccountService.getOrganIds(srvOrganListReq.getOrganId(), srvOrganListReq.getIsInvolveChild());
return chDisabAccountsDetailMapper.searchSrvOrganAccountList(new Page<>(srvOrganListReq.getPageNum(), srvOrganListReq.getPageSize()), organIds, srvOrganListReq);
return disabAccountsMapper.searchSrvOrganAccountList(new Page<>(srvOrganListReq.getPageNum(), srvOrganListReq.getPageSize()), organIds, srvOrganListReq);
}
......@@ -400,24 +407,14 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
//求当月最后一天
private Date getLastDayOfMonth(Date date) {
Calendar cale = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
cale.setTime(date);
cale.add(Calendar.MONTH, 1);
cale.set(Calendar.DAY_OF_MONTH, 0);
return cale.getTime();
}
private Date getFirstDayOfMonth(Date date) {
Calendar cale = Calendar.getInstance();
cale.setTime(date);
cale = Calendar.getInstance();
cale.add(Calendar.MONTH, -1);
cale.set(Calendar.DAY_OF_MONTH, 1);
return cale.getTime();
}
//求年月日中的日
private int getDay(Date date) {
......@@ -449,8 +446,65 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
public List<ChDisabDetailAccountsResp> queryOrganAccountsDetail(String id) {
return chDisabDetailAccountsMapper.queryOrganAccountsDetail(id);
public Page<ChDisabDetailAccountsResp> queryOrganAccountsDetail(Integer pageNum, Integer pageSize,String accountsId,Integer status) {
return chDisabAccountsDetailMapper.queryOrganAccountsDetail(new Page<>(pageNum, pageSize),accountsId,status);
}
@Override
public Page<NursingRecordsRespVO> queryNursingRecords(Integer pageNum, Integer pageSize, String taskDetailId) {
return chDisabAccountsDetailMapper.queryNursingRecords(new Page<>(pageNum, pageSize),taskDetailId);
}
@Override
public OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req) {
return chDisabAccountsDetailMapper.queryOverallCostRecords(req);
}
@Override
public Page<OverallCostListRespVO> queryOverallCostList(OverallCostReqVO req) {
req.setDealType((null ==req.getDealType()||0==req.getDealType())? null : req.getDealType());
Page<OverallCostListRespVO> overallCostListRespVOPage = chDisabAccountsDetailMapper.queryOverallCostList(new Page<>(req.getPageNum(), req.getPageSize()), req);
List<OverallCostListRespVO> records = overallCostListRespVOPage.getRecords();
for (OverallCostListRespVO record : records) {
int dealType = record.getDealType();
if (dealType == 1) {
record.setAmountOfMoney(record.getReissueAmount());
}else if(dealType == 2) {
record.setAmountOfMoney(record.getDeductionAmount());
}
}
return overallCostListRespVOPage;
}
@Override
public int overallCostSubmit(OverallCostSubmitReqVO req){
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
int dealType = req.getDealType();
chDisabDetailAccounts.setAccountsDetailId(req.getAccountsDetailId());
Long accountsId = req.getAccountsId();
ChDisabAccounts chDisabAccounts = disabAccountsMapper.selectById(accountsId);
BigDecimal deductionAmountTotal = chDisabAccounts.getDeductionAmountTotal();
BigDecimal reissueAmountTotal = chDisabAccounts.getReissueAmountTotal();
chDisabDetailAccounts.setDealType(dealType);
String amountOfMoneyStr = req.getAmountOfMoney();
BigDecimal amountOfMoney = new BigDecimal(amountOfMoneyStr);
if(dealType == 1){
// 补发
chDisabDetailAccounts.setReissueAmount(amountOfMoney);
reissueAmountTotal = reissueAmountTotal.add(amountOfMoney);
}else if(dealType == 2){
// 扣减
chDisabDetailAccounts.setDeductionAmount(amountOfMoney);
deductionAmountTotal = deductionAmountTotal.add(amountOfMoney);
}
chDisabDetailAccounts.setRemarks(req.getRemarks());
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
chDisabAccounts.setReissueAmountTotal(reissueAmountTotal);
chDisabAccounts.setDeductionAmountTotal(deductionAmountTotal);
disabAccountsMapper.updateById(chDisabAccounts);
return result;
}
@Override
......@@ -473,11 +527,11 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
}
@Override
@Transactional(rollbackFor = Exception.class)
public void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS) {
if (CollectionUtil.isEmpty(accountTaskExecuteReqVOS)) {
return;
}
List<String> taskDetailIds = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).distinct().collect(Collectors.toList());
// 根据任务id查找结算详情,还没有对应的任务数据说明还未发生过结算,进行插入详情表和结算表
List<ChDisabDetailAccounts> chDisabDetailList = chDisabAccountsDetailMapper.queryAccountByCondition(taskDetailIds);
......@@ -544,15 +598,18 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
BigDecimal personalCost = limit.multiply(personalPercent);
chDisabDetailAccounts.setAccountsPersonalCost(personalCost);
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setEmpId(accountsVO.getEmpId());
chDisabDetailAccounts.setCreationTime(new Date());
// 结算时间为任务时间
chDisabDetailAccounts.setAccountsTime(DateUtils.strToTime(accountsVO.getSrvDate()));
//chDisabDetailAccounts.setAccountsStartTime(DateUtils.strToTime(accountsVO.getSrvStartTime()));
//chDisabDetailAccounts.setAccountsEndTime(DateUtils.strToTime(accountsVO.getSrvEndTime()));
chDisabDetailAccounts.setAccountsTime(DateUtils.strToDate(accountsVO.getSrvDate()));
chDisabDetailAccounts.setAccountsStartTime(DateUtils.getFirstDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.getlastDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setItemIds(accountsVO.getItemId());
chDisabDetailAccounts.setDisabInfoId(accountsVO.getDisabInfoId());
chDisabDetailAccounts.setStatus((short)0);
chDisabDetailAccounts.setReissueAmount(BigDecimal.valueOf(0));
chDisabDetailAccounts.setDeductionAmount(BigDecimal.valueOf(0));
ChDisabAccounts chDisabAccounts = getChDisabAccounts(accountsVO, limit, overallCost, personalCost);
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
......@@ -562,29 +619,21 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private ChDisabAccounts getChDisabAccounts(OrganAccountsVO accountsVO, BigDecimal limit, BigDecimal overallCost, BigDecimal personalCost) {
// 结算表 根据机构和结算时间 服务方式
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(accountsVO.getSrvDate())), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId());
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(accountsVO.getSrvDate())), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId(),null);
if(chDisabAccounts == null) {
chDisabAccounts = new ChDisabAccounts();
chDisabAccounts.setModeName(accountsVO.getSrvModeName());
chDisabAccounts.setAccountsTime(DateUtils.strToTime(accountsVO.getSrvDate()));
chDisabAccounts.setSrvOrganId(Long.valueOf(accountsVO.getSrvOrganId()));
chDisabAccounts.setCreationTime(new Date());
chDisabAccounts.setAccountsStatus((short) 1);
chDisabAccounts.setAllCost(String.valueOf(limit));
chDisabAccounts.setOverallCost(String.valueOf(overallCost));
chDisabAccounts.setPersonalCost(String.valueOf(personalCost));
chDisabAccounts.setAccountsStatus((short) 0);
BigDecimal zero = BigDecimal.valueOf(0);
chDisabAccounts.setAllCost(zero);
chDisabAccounts.setOverallCost(zero);
chDisabAccounts.setPersonalCost(zero);
chDisabAccounts.setReissueAmountTotal(zero);
chDisabAccounts.setDeductionAmountTotal(zero);
disabAccountsMapper.insert(chDisabAccounts);
}else {
String allCostStr = chDisabAccounts.getAllCost();
String overallCostStr = chDisabAccounts.getOverallCost();
String personalCostStr = chDisabAccounts.getPersonalCost();
BigDecimal allCostBig = new BigDecimal(allCostStr).add(limit);
BigDecimal overallCostBig = new BigDecimal(overallCostStr).add(overallCost);
BigDecimal personalCostBig = new BigDecimal(personalCostStr).add(personalCost);
chDisabAccounts.setAllCost(allCostBig.toString());
chDisabAccounts.setOverallCost(String.valueOf(overallCostBig));
chDisabAccounts.setPersonalCost(String.valueOf(personalCostBig));
disabAccountsMapper.updateById(chDisabAccounts);
}
return chDisabAccounts;
}
......@@ -595,20 +644,22 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
for (OrganAccountsVO accountsVO : accountsList) {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId());
// 要判断是养老还是医疗,因为费用不一样
// 异地
BigDecimal limit = BigDecimal.valueOf(20);
BigDecimal zero = BigDecimal.valueOf(0);
chDisabDetailAccounts.setAccountsAllCost(limit);
chDisabDetailAccounts.setAccountsPersonalCost(zero);
chDisabDetailAccounts.setAccountsOverallCost(zero);
chDisabDetailAccounts.setReissueAmount(zero);
chDisabDetailAccounts.setDeductionAmount(zero);
chDisabDetailAccounts.setStatus((short)0);
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(DateUtils.strToDate(accountsVO.getSrvDate()));
chDisabDetailAccounts.setAccountsStartTime(DateUtils.strToTime(accountsVO.getSrvStartTime()));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.strToTime(accountsVO.getSrvEndTime()));
chDisabDetailAccounts.setAccountsStartTime(DateUtils.getFirstDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.getlastDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setItemIds(accountsVO.getItemId());
chDisabDetailAccounts.setDisabInfoId(accountsVO.getDisabInfoId());
ChDisabAccounts chDisabAccounts = getChDisabAccounts(accountsVO, limit, zero, zero);
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
......@@ -616,4 +667,128 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteAccountsDetail(Long accountsDetailId){
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setDeductionAmount(BigDecimal.valueOf(0));
chDisabDetailAccounts.setReissueAmount(BigDecimal.valueOf(0));
chDisabDetailAccounts.setDealType(0);
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int accountsFreeCommit(Long accountsDetailId){
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.selectById(accountsDetailId);
BigDecimal allCost = chDisabDetailAccountsDTO.getAccountsAllCost();
BigDecimal overallCost = chDisabDetailAccountsDTO.getAccountsOverallCost();
BigDecimal personalCost = chDisabDetailAccountsDTO.getAccountsPersonalCost();
Long accountsId = chDisabDetailAccountsDTO.getAccountsId();
ChDisabAccounts chDisabAccountDTO = disabAccountsMapper.selectById(accountsId);
if(chDisabAccountDTO !=null){
BigDecimal accountAllCost = chDisabAccountDTO.getAllCost();
BigDecimal accountOverallCost = chDisabAccountDTO.getOverallCost();
BigDecimal accountPersonalCost = chDisabAccountDTO.getPersonalCost();
chDisabAccountDTO.setAllCost(accountAllCost.add(allCost));
chDisabAccountDTO.setOverallCost(accountOverallCost.add(overallCost));
chDisabAccountDTO.setPersonalCost(accountPersonalCost.add(personalCost));
chDisabAccountDTO.setAccountsStatus((short)1);
disabAccountsMapper.updateById(chDisabAccountDTO);
}
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
chDisabDetailAccounts.setStatus(((short)1));
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
return result;
}
@Override
public int delayAccountCommit(Long accountsDetailId,Short status){
// 暂缓需要将当月的钱减掉
ChDisabDetailAccounts chDisabDetailAccountDTO = chDisabAccountsDetailMapper.selectById(accountsDetailId);
Long accountsId = chDisabDetailAccountDTO.getAccountsId();
BigDecimal accountsAllCost = chDisabDetailAccountDTO.getAccountsAllCost();
BigDecimal accountsOverallCost = chDisabDetailAccountDTO.getAccountsOverallCost();
BigDecimal accountsPersonalCost = chDisabDetailAccountDTO.getAccountsPersonalCost();
ChDisabAccounts chDisabAccountDTO = disabAccountsMapper.selectById(accountsId);
BigDecimal allCost = chDisabAccountDTO.getAllCost();
BigDecimal overallCost = chDisabAccountDTO.getOverallCost();
BigDecimal personalCost = chDisabAccountDTO.getPersonalCost();
// 暂缓
if(status == 2){
allCost = allCost.subtract(accountsAllCost);
overallCost = overallCost.subtract(accountsOverallCost);
personalCost = personalCost.subtract(accountsPersonalCost);
ChDisabAccounts chDisabAccount = new ChDisabAccounts();
chDisabAccount.setAllCost(allCost);
chDisabAccount.setOverallCost(overallCost);
chDisabAccount.setPersonalCost(personalCost);
chDisabAccount.setAccountsId(accountsId);
disabAccountsMapper.updateById(chDisabAccount);
// 恢复
}else if(status == 1){
// 判断恢复时间是否和之前结算时间在同一个月,如果在同一个月把金额加回来,如果不在同一个月,改变结算月份,恢复的时候重新插入一条
//结算记录
Date accountsTime = chDisabDetailAccountDTO.getAccountsTime();
Boolean aBoolean = DateUtils.inCurrentMonth(accountsTime);
if(aBoolean){
allCost = allCost.add(accountsAllCost);
overallCost = overallCost.add(accountsOverallCost);
personalCost = personalCost.add(accountsPersonalCost);
ChDisabAccounts chDisabAccount = new ChDisabAccounts();
chDisabAccount.setAllCost(allCost);
chDisabAccount.setOverallCost(overallCost);
chDisabAccount.setPersonalCost(personalCost);
chDisabAccount.setAccountsId(accountsId);
disabAccountsMapper.updateById(chDisabAccount);
}else {
// 结算表加一个是否暂缓字段 1 暂缓
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(new Date()), chDisabDetailAccountDTO.getModeName(), chDisabDetailAccountDTO.getSrvOrganId(),2);
if (chDisabAccounts == null) {
chDisabAccounts = new ChDisabAccounts();
chDisabAccounts.setIsDelay((short)2);
chDisabAccounts.setAccountsStatus((short)1);
chDisabAccounts.setSrvOrganId(Long.valueOf(chDisabDetailAccountDTO.getSrvOrganId()));
chDisabAccounts.setCreationTime(new Date());
chDisabAccounts.setAccountsTime(new Date());
chDisabAccounts.setModeName(chDisabDetailAccountDTO.getModeName());
chDisabAccounts.setDeductionAmountTotal(chDisabDetailAccountDTO.getDeductionAmount());
chDisabAccounts.setReissueAmountTotal(chDisabDetailAccountDTO.getReissueAmount());
chDisabAccounts.setAllCost(chDisabDetailAccountDTO.getAccountsAllCost());
chDisabAccounts.setOverallCost(chDisabDetailAccountDTO.getAccountsOverallCost());
chDisabAccounts.setPersonalCost(chDisabDetailAccountDTO.getAccountsPersonalCost());
chDisabAccounts.setSvrStartTime(chDisabDetailAccountDTO.getAccountsStartTime());
chDisabAccounts.setSvrEndTime(chDisabDetailAccountDTO.getAccountsEndTime());
chDisabAccounts.setTotalAllocatedExpenses(BigDecimal.valueOf(0));
disabAccountsMapper.insert(chDisabAccounts);
accountsId = chDisabAccounts.getAccountsId();
}else {
BigDecimal allCost1 = chDisabAccounts.getAllCost();
BigDecimal overallCost1 = chDisabAccounts.getOverallCost();
BigDecimal personalCost1 = chDisabAccounts.getPersonalCost();
allCost1 = allCost1.add(accountsAllCost);
overallCost1 = overallCost1.add(accountsOverallCost);
personalCost1 = personalCost1.add(accountsPersonalCost);
ChDisabAccounts chDisabAccount = new ChDisabAccounts();
chDisabAccount.setAllCost(allCost1);
chDisabAccount.setOverallCost(overallCost1);
chDisabAccount.setPersonalCost(personalCost1);
chDisabAccount.setAccountsId(accountsId);
disabAccountsMapper.updateById(chDisabAccount);
}
}
}
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
chDisabDetailAccounts.setStatus(status);
chDisabDetailAccounts.setAccountsId(accountsId);
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
return result;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hungraim.ltc.account.dao.ChDisabAccountsDetailMapper">
<select id="queryOrganAccountsDetail" resultType="com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccountsResp">
select
d.MODE_NAME modeName,
to_char(d.ACCOUNTS_START_TIME,'yyyy-MM-dd') accountsStartTime,
to_char(d.ACCOUNTS_END_TIME,'yyyy-MM-dd') accountsEndTime,
to_char(d.ACCOUNTS_TIME,'yyyy-MM') accountsTime,
emp.EMP_NAME empName,
d.ACCOUNTS_ALL_COST accountsAllCost,
d.ACCOUNTS_OVERALL_COST accountsOverallCost,
d.ACCOUNTS_PERSONAL_COST accountsPersonalCost,
d.TASK_DETAIL_ID taskDetailId,
(select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea,
o.SRV_ORGAN_NAME srvOrganName,
info.REAL_NAME realName,
d.DEDUCTION_AMOUNT deductionAmount,
d.REISSUE_AMOUNT reissueAmount,
d.ACCOUNTS_DETAIL_ID accountsDetailId,
d.STATUS
from CH_DISAB_ACCOUNTS_DETAIL d
left join CH_DISABLE_INFO info on d.DISAB_INFO_ID = info.DISAB_INFO_ID
left join CH_DISABLE_APPLY apply on info.APPLY_ID=apply.APPLY_ID
left join CH_SRV_ORGAN o on d.SRV_ORGAN_ID = o.SRV_ORGAN_ID
left join ch_srv_organ_emp emp on d.emp_id = emp.emp_id
<where>
1=1
<if test="accountsId != null and accountsId != ''">
and d.ACCOUNTS_ID = #{accountsId}
</if>
<if test="status != null and status == 2">
and d.status in (1,2)
</if>
<if test="status == null">
and d.status != 2
</if>
<if test="status != null and status != 2">
and d.status = #{status}
</if>
</where>
</select>
<select id="queryNursingRecords" resultType="com.hungraim.ltc.pojo.entity.account.NursingRecordsRespVO">
select organ.SRV_ORGAN_NAME srvOrganName,
detail.MODE_NAME modeName,
to_char(item.FCD,'yyyy-MM-dd HH:mm:ss') executionTime,
service.SERVICE_TYPE_DETAILED_NAME itemName
from CH_DISAB_ACCOUNTS_DETAIL detail
left join CH_SRV_TASK_FINISH_ITEM item on detail.TASK_DETAIL_ID = item.TASK_DETAIL_ID
left join CH_SRV_ORGAN organ on organ.SRV_ORGAN_ID = detail.SRV_ORGAN_ID
LEFT JOIN CH_SRV_ORGAN_PROJECT CSOP ON CSOP.PROJECT_ID = item.ITEM_ID
left join CH_SERVICE_TYPE_DETAILED service on service.SERVICE_TYPE_DETAILED_ID = CSOP.ITEM_NAME
where detail.TASK_DETAIL_ID = #{taskDetailId}
</select>
<select id="queryOverallCostList" resultType="com.hungraim.ltc.pojo.entity.account.OverallCostListRespVO">
select info.REAL_NAME realName,
info.CERTI_CODE certiCode,
apply.MEDICAL_AREA medicalArea,
detail.ACCOUNTS_DETAIL_ID accountsDetailId,
detail.ACCOUNTS_START_TIME svrStartTime,
detail.ACCOUNTS_END_TIME svrEndTime,
detail.DEAL_TYPE dealType,
organ.SRV_ORGAN_NAME srvOrganName,
detail.ACCOUNTS_OVERALL_COST accountsOverallCost,
detail.REISSUE_AMOUNT reissueAmount,
detail.ACCOUNTS_ID accountsId,
detail.DEDUCTION_AMOUNT deductionAmount
from CH_DISAB_ACCOUNTS_DETAIL detail
left join CH_DISABLE_INFO info on info.DISAB_INFO_ID = detail.DISAB_INFO_ID
left join CH_DISABLE_APPLY apply on apply.APPLY_ID = info.APPLY_ID
left join CH_SRV_ORGAN organ on organ.SRV_ORGAN_ID = detail.SRV_ORGAN_ID
<where>
<if test="req.realName != null and req.realName != ''">
and info.REAL_NAME = #{req.realName}
</if>
<if test="req.accountsTime != null and req.accountsTime != ''">
and to_char(detail.accounts_time,'yyyy-MM-dd') = #{req.accountsTime}
</if>
<if test="req.srvOrganName != null and req.srvOrganName != ''">
and organ.SRV_ORGAN_NAME = #{req.srvOrganName}
</if>
<if test="req.certiCode != null and req.certiCode != ''">
and info.certi_Code = #{req.certiCode}
</if>
<if test="req.dealType != null">
and detail.DEAL_TYPE = #{req.dealType}
</if>
<if test="req.dealType == null ">
and detail.DEAL_TYPE in (1,2)
</if>
</where>
</select>
<select id="queryOverallCostRecords"
resultType="com.hungraim.ltc.pojo.entity.account.OverallEduceDecreaseCostRespVO">
select info.REAL_NAME realName,
info.CERTI_CODE certiCode,
apply.MEDICAL_AREA medicalArea,
detail.ACCOUNTS_DETAIL_ID accountsDetailId,
detail.ACCOUNTS_START_TIME svrStartTime,
detail.ACCOUNTS_END_TIME svrEndTime,
detail.DEAL_TYPE dealType,
organ.SRV_ORGAN_NAME srvOrganName,
detail.ACCOUNTS_OVERALL_COST accountsOverallCost,
detail.REISSUE_AMOUNT reissueAmount,
detail.ACCOUNTS_ID accountsId,
detail.DEDUCTION_AMOUNT deductionAmount
from CH_DISAB_ACCOUNTS_DETAIL detail
left join CH_DISABLE_INFO info on info.DISAB_INFO_ID = detail.DISAB_INFO_ID
left join CH_DISABLE_APPLY apply on apply.APPLY_ID = info.APPLY_ID
left join CH_SRV_ORGAN organ on organ.SRV_ORGAN_ID = detail.SRV_ORGAN_ID
<where>
detail.status = 1
<if test="realName != null and realName != ''">
and info.REAL_NAME = #{realName}
</if>
<if test="accountsTime != null and accountsTime != ''">
and to_char(detail.accounts_time,'yyyy-MM-dd') = #{accountsTime}
</if>
<if test="srvOrganName != null and srvOrganName != ''">
and organ.SRV_ORGAN_NAME = #{srvOrganName}
</if>
<if test="certiCode != null and certiCode != ''">
and info.certi_Code = #{certiCode}
</if>
and rownum =1
</where>
</select>
<select id="getOrganAccountsList" resultType="com.hungraim.ltc.pojo.vo.account.OrganAccountsVO">
select
......@@ -19,13 +148,12 @@
organ.srv_organ_id srvOrganId,
--护理机构名称
organ.srv_organ_name srvOrganName,
--护理服务人员
emp.emp_name empName,
--护理服务人员 Id
emp.EMP_ID empId,
--任务时间
detail.SRV_DATE srvDate,
-- 机构等级
organ.LEVEL_CODE levelCode,
CSTFI.ITEM_ID itemId
organ.LEVEL_CODE levelCode
from ch_srv_task_detail detail--服务计划
left join ch_srv_task task on task.srv_task_id = detail.srv_task_id--服务计划详情
left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员
......@@ -84,42 +212,6 @@
</select>
<select id="searchSrvOrganAccountList" resultType="com.hungraim.ltc.pojo.vo.account.SrvOrganAccountListResp">
SELECT
t1.ACCOUNTS_ID,
t3.ORGAN_ID,
t3.ORGAN_NAME,
t2.SRV_ORGAN_ID,
t2.SRV_ORGAN_NAME,
t1.ACCOUNTS_TIME,
t1.ACCOUNTS_STATUS,
t1.ALL_COST,
t1.OVERALL_COST,
t1.PERSONAL_COST,
t1.SVR_START_TIME,
t1.MODE_NAME,
to_char(t1.SVR_START_TIME,'yyyy-MM-dd') svrStartTime,
to_char(t1.SVR_END_TIME,'yyyy-MM-dd') svrEndTime,
t1.TOTAL_ALLOCATED_EXPENSES totalAllocatedExpenses
FROM
CH_DISAB_ACCOUNTS t1
LEFT JOIN CH_SRV_ORGAN t2 ON t1.SRV_ORGAN_ID = t2.SRV_ORGAN_ID
LEFT JOIN CH_FND_ORGAN t3 ON t2.ORGAN_ID = t3.ORGAN_ID
<where>
<if test='organIds != null and organIds.size()>0'>
t3.ORGAN_ID IN
<foreach collection="organIds" open="(" close=")" item="organId" separator=",">
#{organId}
</foreach>
</if>
<if test='req.srvOrganId != null'>
AND t2.SRV_ORGAN_ID = #{req.srvOrganId}
</if>
<if test='req.accountsTime != null'>
AND t1.ACCOUNTS_TIME = #{req.accountsTime}
</if>
</where>
</select>
......@@ -141,8 +233,8 @@
</select>
<select id="getOtherPlaceList" resultType="com.hungraim.ltc.pojo.vo.account.OrganAccountsVO">
select
detail.TASK_DETAIL_ID taskDetailId,
select
--失能人员姓名
disable.real_name realName,
disable.DISAB_INFO_ID disabInfoId,
......@@ -150,13 +242,14 @@ select
disable.CERTI_CODE certiCode,
--所在省市
(select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea,
mode1.MODE_ID modeId,
--服务方式
mode1.mode_name srvModeName,
program.SRV_MODE_ID modeId,
--服务方式
DECODE(program.SRV_MODE_ID, '1','医疗','2', '养老','3','上门', '4', '异地') srvModeName,
--护理机构名称
organ.srv_organ_id srvOrganId,
--护理机构名称
organ.srv_organ_name srvOrganName,
detail.TASK_DETAIL_ID taskDetailId,
--护理服务人员
emp.emp_name empName,
--任务时间
......@@ -164,22 +257,22 @@ select
detail.SRV_START_TIME srvStartTime,
detail.SRV_END_TIME srvEndTime,
-- 机构等级
organ.LEVEL_CODE levelCode,
-- 失能等级
level1.DISABLE_LEVEL_NAME disableLevelName
from ch_srv_task_detail detail--服务计划
left join ch_srv_task task on task.srv_task_id = detail.srv_task_id--服务计划详情
left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员
left join CH_DEV.CH_DISABLE_APPLY apply on apply.apply_id = disable.apply_id
left join ch_apr_task aprtask on disable.last_task_id = aprtask.task_id--评定任务
left join ch_apr_report report on aprtask.task_id = report.task_id--评定报告
left join ch_srv_program program on task.program_id = program.program_id--服务方案
left join ch_srv_organ organ on program.srv_organ_id = organ.srv_organ_id--服务机构
left join ch_cfg_srv_mode mode1 on program.srv_mode_id = mode1.mode_id--服务方式
left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
-- 失能等级
left join ch_cfg_srv_disable_level level1 on report.disable_level_id = level1.disable_level_id
where mode1.MODE_ID = '4' and level1.DISABLE_LEVEL_NAME like '重度%' and program.program_id = #{programId}
organ.LEVEL_CODE levelCode
from ch_srv_task_detail detail--服务计划
left join ch_srv_task task on task.srv_task_id = detail.srv_task_id--服务计划详情
left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员
left join CH_DEV.CH_DISABLE_APPLY apply on apply.apply_id = disable.apply_id
left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
left join ch_srv_program program on task.program_id = program.program_id--服务方案
left join ch_srv_organ organ on program.srv_organ_id = organ.srv_organ_id--服务机构
where program.srv_organ_id = '4' and program.program_id = #{programId}
</select>
<update id="updateByAccountsId">
update CH_DISAB_ACCOUNTS_DETAIL d set d.status = 3 where d.ACCOUNTS_ID = #{accountsId}
</update>
</mapper>
......@@ -17,15 +17,59 @@
</sql>
<select id="queryAccountByCondition" resultType="com.hungraim.ltc.pojo.entity.account.ChDisabAccounts">
select * from CH_DISAB_ACCOUNTS t where t.MODE_NAME = #{modeName}
and to_char(t.ACCOUNTS_TIME,'yyyy-MM') = #{accountsTime}
and t.SRV_ORGAN_ID = #{srvOrganId}
<if test="isDelay !=null">
and t.IS_DELAY = 2
</if>
</select>
<select id="searchSrvOrganAccountList" resultType="com.hungraim.ltc.pojo.vo.account.SrvOrganAccountListResp">
SELECT
t1.ACCOUNTS_ID,
t3.ORGAN_ID,
t3.ORGAN_NAME,
t2.SRV_ORGAN_ID,
t2.SRV_ORGAN_NAME,
t1.ACCOUNTS_TIME,
t1.ACCOUNTS_STATUS,
t1.ALL_COST,
t1.OVERALL_COST,
t1.PERSONAL_COST,
t1.SVR_START_TIME,
t1.MODE_NAME,
to_char(t1.SVR_START_TIME,'yyyy-MM-dd') svrStartTime,
to_char(t1.SVR_END_TIME,'yyyy-MM-dd') svrEndTime,
t1.TOTAL_ALLOCATED_EXPENSES totalAllocatedExpenses,
t1.REISSUE_AMOUNT_TOTAL reissueAmountTotal,
t1.DEDUCTION_AMOUNT_TOTAL deductionAmountTotal
FROM
CH_DISAB_ACCOUNTS t1
LEFT JOIN CH_SRV_ORGAN t2 ON t1.SRV_ORGAN_ID = t2.SRV_ORGAN_ID
LEFT JOIN CH_FND_ORGAN t3 ON t2.ORGAN_ID = t3.ORGAN_ID
<where>
t1.ACCOUNTS_STATUS !=0
<if test='organIds != null and organIds.size()>0'>
AND t3.ORGAN_ID IN
<foreach collection="organIds" open="(" close=")" item="organId" separator=",">
#{organId}
</foreach>
</if>
<if test='req.srvOrganId != null'>
AND t2.SRV_ORGAN_ID = #{req.srvOrganId}
</if>
<if test='req.accountsTime != null'>
AND t1.ACCOUNTS_TIME = #{req.accountsTime}
</if>
<if test="req.accountsStatus != null and req.accountsStatus != ''">
and t1.ACCOUNTS_STATUS = #{req.accountsStatus}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hungraim.ltc.account.dao.ChDisabDetailAccountsMapper">
<select id="queryOrganAccountsDetail" resultType="com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccountsResp">
select
d.MODE_NAME modeName,
to_char(d.ACCOUNTS_START_TIME,'yyyy-MM-dd HH24:mi:ss') accountsStartTime,
to_char(d.ACCOUNTS_END_TIME,'yyyy-MM-dd HH24:mi:ss') accountsEndTime,
to_char(d.ACCOUNTS_TIME,'yyyy-MM') accountsTime,
d.ACCOUNTS_ALL_COST accountsAllCost,
d.ACCOUNTS_OVERALL_COST accountsOverallCost,
d.ACCOUNTS_PERSONAL_COST accountsPersonalCost,
(select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea,
o.SRV_ORGAN_NAME srvOrganName,
info.REAL_NAME realName
from CH_DISAB_ACCOUNTS_DETAIL d
left join CH_DISABLE_INFO info on d.DISAB_INFO_ID = info.DISAB_INFO_ID
left join CH_DISABLE_APPLY apply on info.APPLY_ID=apply.APPLY_ID
left join CH_SRV_ORGAN o on d.SRV_ORGAN_ID = o.SRV_ORGAN_ID
where d.ACCOUNTS_ID = #{accountsId}
</select>
</mapper>
\ No newline at end of file
......@@ -18,13 +18,13 @@
left join ch_srv_organ_emp emp on plan.emp_id = emp.emp_id
left join CH_SRV_ORGAN organ on organ.SRV_ORGAN_ID = plan.SRV_ORGAN_ID
<where>
<if test="req.status != null">
<if test="req.status != null and req.status != ''">
and plan.IS_STATUS = #{req.status}
</if>
<if test="req.realName != null">
<if test="req.realName != null and req.realName != ''">
AND info.real_name LIKE CONCAT('%',CONCAT(#{req.realName},'%'))
</if>
<if test="req.srvOrganName != null">
<if test="req.srvOrganName != null and req.srvOrganName != ''">
AND organ.SRV_ORGAN_NAME LIKE CONCAT('%',CONCAT(#{req.srvOrganName},'%'))
</if>
</where>
......
......@@ -9,6 +9,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
......@@ -33,7 +34,7 @@ public class ChDisabAccounts implements Serializable {
/**
* 实拨总费用
*/
private String totalAllocatedExpenses;
private BigDecimal totalAllocatedExpenses;
/**
* 创建时间
......@@ -52,7 +53,7 @@ public class ChDisabAccounts implements Serializable {
/**
* 应拨总费用
*/
private String totalExpensesPayable;
private BigDecimal totalExpensesPayable;
/**
* 是否结算(0未结算,1已结算)
......@@ -60,7 +61,7 @@ public class ChDisabAccounts implements Serializable {
private Short chooseSettle;
/**
* 状态(0-待提交;1-待审核;2-已审核;3-已失效;
* 状态(1 待审核 2 已审核 3 已结算
*/
private Short accountsStatus;
......@@ -90,17 +91,33 @@ public class ChDisabAccounts implements Serializable {
/**
* 总费用合计
*/
private String allCost;
private BigDecimal allCost;
/**
* 统筹支出
*/
private String overallCost;
private BigDecimal overallCost;
/**
* 个人支出
*/
private String personalCost;
private BigDecimal personalCost;
/**
*扣减金额合计
*/
private BigDecimal deductionAmountTotal;
/**
*补发金额
*/
private BigDecimal reissueAmountTotal;
/**
* 是否暂缓 2 暂缓
*/
private Short isDelay;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -52,9 +52,16 @@ public class ChDisabDetailAccounts implements Serializable {
*/
private BigDecimal accountsAllCost;
/**
* 统筹费用
*/
private BigDecimal accountsOverallCost;
/**
* 个人支付
*/
private BigDecimal accountsPersonalCost;
/**
* 服务方式
*/
......@@ -64,16 +71,50 @@ public class ChDisabDetailAccounts implements Serializable {
* 费用开始日期
*/
private Date accountsStartTime;
/**
* 费用结束日期
*/
private Date accountsEndTime;
/**
* 任务详情id
*/
private String taskDetailId;
/**
* 护理人员id
*/
private Long empId;
/**
* 统筹区
*/
private String medicalArea;
private String itemIds;
/**
*交易类型 1、补发 2、扣减
*/
private int dealType;
/**
*扣减金额
*/
private BigDecimal deductionAmount;
/**
*补发金额
*/
private BigDecimal reissueAmount;
/**
* 备注
*/
private String remarks;
/**
* 状态(1 恢复状态 2 暂缓状态 3)
*/
private Short status;
private static final long serialVersionUID = 1L;
......
......@@ -35,6 +35,8 @@ public class ChDisabDetailAccountsResp implements Serializable {
*/
private String modeName;
private String empName;
/**
* 费用开始日期
*/
......@@ -51,5 +53,15 @@ public class ChDisabDetailAccountsResp implements Serializable {
private String realName;
private String taskDetailId;
private String deductionAmount;
private String reissueAmount;
private String accountsDetailId;
private Integer status;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.hungraim.ltc.pojo.entity.account;
import lombok.Data;
/**
* @author zwl
* @ClassName NursingRecordsRespVO
* @description
* @date 2023/2/14 10:10
**/
@Data
public class NursingRecordsRespVO {
/**
* 护理机构
**/
private String srvOrganName;
/**
* 服务方式
**/
private String modeName;
/**
*执行日期
**/
private String executionTime;
/**
*任务名称
**/
private String itemName;
}
package com.hungraim.ltc.pojo.entity.account;
import lombok.Data;
/**
* @author zwl
* @ClassName OverallCostListRespVO
* @description
* @date 2023/2/14 21:10
**/
@Data
public class OverallCostListRespVO {
/**
*失能人员姓名
*/
private String realName;
/**
*身份证号
*/
private String certiCode;
/**
*医保统筹区
*/
private String medicalArea;
/**
* 费用开始时间
*/
private String svrStartTime;
/**
* 费用结束时间
*/
private String svrEndTime;
/**
*交易类型 1、补发 2、扣减
*/
private int dealType;
/**
*扣减金额
*/
private String deductionAmount;
/**
*补发金额
*/
private String reissueAmount;
private String amountOfMoney;
private String accountsDetailId;
private String accountsOverallCost;
private String srvOrganName;
}
package com.hungraim.ltc.pojo.entity.account;
import com.hungraim.ltc.pojo.vo.BaseReq;
import lombok.Data;
/**
* @author zwl
* @ClassName OverallCostReqVO
* @description
* @date 2023/2/14 15:11
**/
@Data
public class OverallCostReqVO extends BaseReq {
/**
*失能人员姓名
*/
private String realName;
/**
*身份证号
*/
private String certiCode;
/**
* 护理机构名称
*/
private String srvOrganName;
private String accountsTime;
private Integer dealType;
}
package com.hungraim.ltc.pojo.entity.account;
import lombok.Data;
/**
* @author zwl
* @ClassName OverallCostSubmitReqVO
* @description
* @date 2023/2/14 16:56
**/
@Data
public class OverallCostSubmitReqVO {
/**
* 结算详情Id
*/
private Long accountsDetailId;
private Long accountsId;
/**
* 交易类型 1、补发 2、扣减
*/
private int dealType;
/**
* 金额
*/
private String amountOfMoney;
/**
* 备注
*/
private String remarks;
}
package com.hungraim.ltc.pojo.entity.account;
import lombok.Data;
/**
* @author zwl
* @ClassName OverallEduceDecreaseCostRespVO
* @description
* @date 2023/2/14 15:11
**/
@Data
public class OverallEduceDecreaseCostRespVO {
/**
*失能人员姓名
*/
private String realName;
/**
*身份证号
*/
private String certiCode;
/**
*医保统筹区
*/
private String medicalArea;
/**
* 费用开始时间
*/
private String svrStartTime;
/**
* 费用结束时间
*/
private String svrEndTime;
/**
*交易类型 1、补发 2、扣减
*/
private int dealType;
/**
*扣减金额
*/
private String deductionAmount;
/**
*补发金额
*/
private String reissueAmount;
private String accountsDetailId;
private String accountsOverallCost;
private String srvOrganName;
private Long accountsId;
}
......@@ -49,9 +49,9 @@ public class OrganAccountsVO {
*/
private String medicalArea;
/**
* 护理服务人员
* 护理服务人员Id
*/
private String empName;
private Long empId;
/**
* 任务时间
*/
......@@ -70,10 +70,7 @@ public class OrganAccountsVO {
* 机构等级
*/
private String levelCode;
/**
* 失能等级
*/
private String disableLevelName;
/**
* 总费用
*/
......
......@@ -5,6 +5,7 @@ import lombok.Data;
import org.checkerframework.checker.units.qual.C;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Data
......@@ -81,5 +82,15 @@ public class SrvOrganAccountListResp {
*/
private String totalAllocatedExpenses;
/**
*扣减金额总合计
*/
private String deductionAmountTotal;
/**
*补发总金额
*/
private String reissueAmountTotal;
}
......@@ -39,4 +39,6 @@ public class SrvOrganListReq extends BaseReq {
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
private Date accountsTime;
private String accountsStatus;
}
......@@ -3,7 +3,6 @@ package com.hungraim.ltc.util;
import cn.hutool.core.util.StrUtil;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
......@@ -879,27 +878,42 @@ public class DateUtils {
*
* @return
*/
public static String getlastMonth(){
SimpleDateFormat ym=new SimpleDateFormat(DATE_PATTERN_yyyy_MM_dd);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH,-1);
String lastMonth =ym.format(calendar.getTime());
return lastMonth;
public static Date getlastDayOfMonth(Date date){
Calendar cale = Calendar.getInstance();
cale.setTime(date);
cale.add(Calendar.MONTH, 1);
cale.set(Calendar.DAY_OF_MONTH, 0);
return cale.getTime();
}
/**
* 获取当前月份的上个月
* 获取月份的第一天
*
* @return
*/
public static Date getlastMonth(String str){
DateFormat fmt =new SimpleDateFormat(DATE_PATTERN_yyyy_MM_dd);
Date date = null;
try {
date = fmt.parse(str);
} catch (ParseException e) {
e.printStackTrace();
public static Date getFirstDayOfMonth(Date date) {
Calendar cale = Calendar.getInstance();
cale.setTime(date);
cale.add(Calendar.MONTH, 0);
cale.set(Calendar.DAY_OF_MONTH, 1);
return cale.getTime();
}
public static Boolean inCurrentMonth(Date date) {
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
//set the given date in date of the instance and current date in the other
cal1.setTime(date);
cal2.setTime(new Date());
//now compare the dates using methods on Calendar
if (cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)) {
if (cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH)) {
return true;
}
}
return date;
return false;
}
}
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