Commit 3d59a414 authored by zhangwanglin's avatar zhangwanglin

结算及评估代码

parent 53347a2e
...@@ -3,7 +3,8 @@ package com.hungraim.ltc.account.controller; ...@@ -3,7 +3,8 @@ package com.hungraim.ltc.account.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.account.service.AccountService; import com.hungraim.ltc.account.service.AccountService;
import com.hungraim.ltc.pojo.entity.account.*; import com.hungraim.ltc.pojo.entity.account.ChDisabAccounts;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccountsResp;
import com.hungraim.ltc.pojo.vo.account.*; import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.util.FileUtils; import com.hungraim.ltc.util.FileUtils;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
...@@ -97,22 +98,13 @@ public class AccountController { ...@@ -97,22 +98,13 @@ public class AccountController {
return Result.success(accountService.expenseSettlement(req)); return Result.success(accountService.expenseSettlement(req));
} }
// todo 后续改成每月定时
@GetMapping("/organAccount")
public void organAccount(){
accountService.organAccount();
}
// todo 后续改成每月定时
@GetMapping("/assessAccount")
public void getAssessAccount(){
accountService.getAssessAccount();
}
// 执行
@PostMapping("/organAccountTaskExecute") @RequestMapping("/organAccountTaskExecute")
public Result organAccountTaskExecute(@RequestBody List<String> taskDetailIds){ public Result organAccountTaskExecute(AccountTaskReqVO accountTaskReqVO){
accountService.organAccountTaskExecute(taskDetailIds); List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS = accountTaskReqVO.getAccountTaskList();
accountService.organAccountTaskExecute(accountTaskExecuteReqVOS);
return Result.success(); return Result.success();
} }
...@@ -155,41 +147,12 @@ public class AccountController { ...@@ -155,41 +147,12 @@ public class AccountController {
} }
/**
* 查询评估结算列表
*
* @param srvOrganListReq 请求参数对象
* @return 返回
*/
@GetMapping("/searchAssessAccountsList")
public Result<Page<AssessAccountsListResp>> searchAssessAccountsList(SrvOrganListReq srvOrganListReq) {
return Result.success(accountService.searchAssessAccountsList(srvOrganListReq));
}
/**
* 评估结算导出明细
*
*/
@GetMapping("/assessAccountExport")
public void assessAccountExport(String assessAccountsId,HttpServletResponse response){
Workbook workbook = accountService.assessAccountExport(assessAccountsId);
// 命名表格
String fileName = "assessAccount.xlsx";
FileUtils.exportResponse(workbook,fileName,response);
}
/**
* 评估人员结算列表明细
*
* @param assessAccountsId 评估结算id
* @return 返回
*/
@GetMapping("/queryAssessAccountsDetail")
public Result<List<ChAssessDetailAccountsResp>> queryAssessAccountsDetail(String assessAccountsId) {
List<ChAssessDetailAccountsResp> chAssessDetailAccounts = accountService.queryAssessAccountsDetail(assessAccountsId);
return Result.success(chAssessDetailAccounts);
}
/** /**
* 查询机构结算信息列表明细 * 查询机构结算信息列表明细
...@@ -203,6 +166,9 @@ public class AccountController { ...@@ -203,6 +166,9 @@ public class AccountController {
return Result.success(chAssessDetailAccounts); return Result.success(chAssessDetailAccounts);
} }
/** /**
* 机构结算管理提交复核 * 机构结算管理提交复核
* *
...@@ -220,22 +186,7 @@ public class AccountController { ...@@ -220,22 +186,7 @@ public class AccountController {
} }
/**
* 评估人员结算提交复核
*
* @param id 结算id
* @return 返回雷彪
*/
@PostMapping("/updateChAssessAccounts")
public Result updateChAssessAccounts(int id) {
int bl = accountService.updateChAssessAccounts(id);
if(bl>0){
return Result.success();
}else{
return Result.failed();
}
}
} }
...@@ -4,10 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,10 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.account.ChDisabAccounts; import com.hungraim.ltc.pojo.entity.account.ChDisabAccounts;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts; import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.vo.account.AccountOperVo; import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.pojo.vo.account.SrvOrganListReq;
import com.hungraim.ltc.pojo.vo.account.SrvOrganListResp;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -17,5 +16,14 @@ import java.util.List; ...@@ -17,5 +16,14 @@ import java.util.List;
@Repository @Repository
public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAccounts> { public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAccounts> {
List<OrganAccountsVO> getOrganAccountsList(@Param("taskDetailIds") List<String> taskDetailIds, String status);
Page<SrvOrganAccountListResp> searchSrvOrganAccountList(Page page, List<Long> organIds, SrvOrganListReq req);
List<AccountExportDetailListResp> searchSrvOrganAccountDetailExport(String accountsId);
List<ChDisabDetailAccounts> queryAccountByCondition(@Param("taskDetailIds") List<String> taskDetailIds,String accountsTime);
} }
\ No newline at end of file
...@@ -49,4 +49,8 @@ public interface ChDisabAccountsMapper extends BaseMapper<ChDisabAccounts> { ...@@ -49,4 +49,8 @@ public interface ChDisabAccountsMapper extends BaseMapper<ChDisabAccounts> {
"WHERE " + "WHERE " +
" t1.ACCOUNTS_ID = #{accountsId}") " t1.ACCOUNTS_ID = #{accountsId}")
AccountOperVo getDetailById(Long accountsId); AccountOperVo getDetailById(Long accountsId);
ChDisabAccounts queryAccountByCondition(String accountsTime, String modeName, String srvOrganId);
} }
\ No newline at end of file
package com.hungraim.ltc.account.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.vo.account.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
@Repository
@Mapper
public interface ChOrganAccountsMapper {
List<OrganAccountsVO> getOrganAccountsList(String lastMonth);
List<OrganAccountsVO> getOrganAccountsList22(@Param("taskDetailIds") List<String> taskDetailIds);
Page<SrvOrganAccountListResp> searchSrvOrganAccountList(Page page, List<Long> organIds, SrvOrganListReq req);
List<AccountExportDetailListResp> searchSrvOrganAccountDetailExport(String accountsId);
}
...@@ -8,8 +8,11 @@ import com.hungraim.ltc.pojo.vo.account.SrvTaskRespVO; ...@@ -8,8 +8,11 @@ import com.hungraim.ltc.pojo.vo.account.SrvTaskRespVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper @Mapper
@Repository @Repository
public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> { public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> {
Page<SrvTaskRespVO> getSrvTaskList(Page page,SrvTaskReqVO req); Page<SrvTaskRespVO> getSrvTaskList(Page page,SrvTaskReqVO req);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hungraim.ltc.pojo.entity.account.*; import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.vo.account.*; import com.hungraim.ltc.pojo.vo.account.*;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import java.text.ParseException; import java.text.ParseException;
...@@ -26,28 +27,14 @@ public interface AccountService extends IService<ChDisabAccounts> { ...@@ -26,28 +27,14 @@ public interface AccountService extends IService<ChDisabAccounts> {
ExpenseVo expenseSettlement(ExpenseSettlementReq req) throws ParseException; ExpenseVo expenseSettlement(ExpenseSettlementReq req) throws ParseException;
void organAccount();
void getAssessAccount();
Workbook srvOrganAccountExport(String accountsId); Workbook srvOrganAccountExport(String accountsId);
Page<AssessAccountsListResp> searchAssessAccountsList(SrvOrganListReq srvOrganListReq);
Workbook assessAccountExport(String assessAccountsId);
/**
* 列表明细
* @param assessAccountsId
* @return
*/
List<ChAssessDetailAccountsResp> queryAssessAccountsDetail(String assessAccountsId);
List<ChDisabDetailAccountsResp> queryOrganAccountsDetail(String id); List<ChDisabDetailAccountsResp> queryOrganAccountsDetail(String id);
int updateChDisabAccounts(int id); int updateChDisabAccounts(int id);
int updateChAssessAccounts(int id);
void organAccountTaskExecute(List<String> taskDetailIds); void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS);
} }
...@@ -15,8 +15,11 @@ import com.hungraim.ltc.api.AttachFeignService; ...@@ -15,8 +15,11 @@ import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCareService; import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCareService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCostStandard; import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCostStandard;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach; import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.account.*; 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.serviceManage.ChSrvTaskDetail; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskFinishItem;
import com.hungraim.ltc.pojo.vo.account.*; import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.util.*; import com.hungraim.ltc.util.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -30,7 +33,10 @@ import java.math.BigDecimal; ...@@ -30,7 +33,10 @@ import java.math.BigDecimal;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -48,15 +54,17 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -48,15 +54,17 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private final ChSrvProgramSetMapper programSetMapper; private final ChSrvProgramSetMapper programSetMapper;
private final ChCfgCareServiceMapper chCfgCareServiceMapper; private final ChCfgCareServiceMapper chCfgCareServiceMapper;
private final ChCfgCostStandardMapper chCfgCostStandardMapper; private final ChCfgCostStandardMapper chCfgCostStandardMapper;
private final ChOrganAccountsMapper chOrganAccountsMapper;
private final ChAssessAccountsMapper chAssessAccountsMapper;
private final ChDisabAccountsDetailMapper chDisabAccountsDetailMapper; private final ChDisabAccountsDetailMapper chDisabAccountsDetailMapper;
private final ChAssessAccountsDetailMapper chAssessAccountsDetailMapper;
/*
private final ChAssessDetailAccountsMapper chAssessDetailAccountsMapper; private final ChAssessDetailAccountsMapper chAssessDetailAccountsMapper;
*/
private final ChDisabDetailAccountsMapper chDisabDetailAccountsMapper; private final ChDisabDetailAccountsMapper chDisabDetailAccountsMapper;
private final ChSrvTaskDetailMapper chSrvTaskDetailMapper; private final ChSrvTaskDetailMapper chSrvTaskDetailMapper;
private final ChSrvTaskFinishItemMapper chSrvTaskFinishItemMapper;;
...@@ -80,15 +88,11 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -80,15 +88,11 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override @Override
public Page<SrvOrganAccountListResp> searchSrvOrganAccountList(SrvOrganListReq srvOrganListReq) { public Page<SrvOrganAccountListResp> searchSrvOrganAccountList(SrvOrganListReq srvOrganListReq) {
List<Long> organIds = baseAccountService.getOrganIds(srvOrganListReq.getOrganId(), srvOrganListReq.getIsInvolveChild()); List<Long> organIds = baseAccountService.getOrganIds(srvOrganListReq.getOrganId(), srvOrganListReq.getIsInvolveChild());
return chOrganAccountsMapper.searchSrvOrganAccountList(new Page<>(srvOrganListReq.getPageNum(), srvOrganListReq.getPageSize()), organIds, srvOrganListReq); return chDisabAccountsDetailMapper.searchSrvOrganAccountList(new Page<>(srvOrganListReq.getPageNum(), srvOrganListReq.getPageSize()), organIds, srvOrganListReq);
} }
@Override
public Page<SrvTaskRespVO> getSrvTaskList(SrvTaskReqVO srvTaskReqVO){
return taskDetailMapper.getSrvTaskList(new Page<>(srvTaskReqVO.getPageNum(), srvTaskReqVO.getPageSize()),srvTaskReqVO);
}
@Override @Override
public AccountOperVo getSrvOrganDetail(Long accountsId) { public AccountOperVo getSrvOrganDetail(Long accountsId) {
...@@ -418,8 +422,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -418,8 +422,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
} }
//求年月日中的日 //求年月日中的日
private int getDay(Date date) { private int getDay(Date date) {
Calendar cale = Calendar.getInstance(); Calendar cale = Calendar.getInstance();
...@@ -427,220 +429,21 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -427,220 +429,21 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
return cale.get(Calendar.DAY_OF_MONTH); return cale.get(Calendar.DAY_OF_MONTH);
} }
private static String lastMonth = DateUtils.getlastMonth();
@Override
public void organAccount() {
List<OrganAccountsVO> accountsList = chOrganAccountsMapper.getOrganAccountsList(lastMonth);
// 根据护理机构分组
Map<String, List<OrganAccountsVO>> organAccountMap = accountsList.stream().collect(Collectors.groupingBy(OrganAccountsVO::getSrvOrganId));
for(Map.Entry<String, List<OrganAccountsVO>> entry:organAccountMap.entrySet()){
String organId = entry.getKey();
List<OrganAccountsVO> organAccountsList = entry.getValue();
if (CollectionUtil.isNotEmpty(organAccountsList)) {
List<OrganAccountsVO> growOldOrganAccountList = organAccountsList.stream().filter(s -> "养老".equals(s.getSrvModeName())).collect(Collectors.toList());
// 养老机构护理,其限额为 50 元/人/天 由长期护理保险基金支付 70% 个人支付 30%
computeCostAndSave(organId,growOldOrganAccountList, 50, 0.7, 0.3);
List<OrganAccountsVO> visitingOrganAccountList = organAccountsList.stream().filter(s -> "上门".equals(s.getSrvModeName())).collect(Collectors.toList());
// 机构上门护理,其限额为 40 元/人/天 由长期护理保险基金支付 80% 个人支付 20% (两天上门一次,一个月最多16次,一次75)
computeCostAndSave(organId,visitingOrganAccountList, 75, 0.8, 0.2);
// 医疗机构护理,原则上收治医疗护理需求为主的重度失能人员一级及以下医疗机构其限额为 80 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
List<OrganAccountsVO> oneLevelList = organAccountsList.stream()
.filter(s -> "医疗".equals(s.getSrvModeName()) && "1".equals(s.getLevelCode()) && s.getDisableLevelName().contains("重度"))
.collect(Collectors.toList());
OrganAccountsVO organAccountsVO1 = computeCostAndSave(organId,oneLevelList, 80, 0.7, 0.3);
// 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
List<OrganAccountsVO> aboveLevel2List = organAccountsList.stream()
.filter(s -> "医疗".equals(s.getSrvModeName()) && (!"1".equals(s.getLevelCode())) && s.getDisableLevelName().contains("重度"))
.collect(Collectors.toList());
OrganAccountsVO organAccountsVO2 = computeCostAndSave(organId,aboveLevel2List, 100, 0.7, 0.3);
BigDecimal allCost = organAccountsVO1.getAllCost().add(organAccountsVO2.getAllCost());
BigDecimal overallCost = organAccountsVO1.getOverallCost().add(organAccountsVO2.getOverallCost());
BigDecimal personalCost = organAccountsVO1.getPersonalCost().add(organAccountsVO2.getPersonalCost());
Long accountsId = saveOrganAccount(organId, aboveLevel2List, allCost, overallCost, personalCost);
saveorganAccountDetail(oneLevelList, BigDecimal.valueOf(80), organAccountsVO1.getOverallCost(), organAccountsVO1.getPersonalCost(),accountsId);
saveorganAccountDetail(aboveLevel2List, BigDecimal.valueOf(100), organAccountsVO2.getOverallCost(), organAccountsVO2.getPersonalCost(),accountsId);
List<OrganAccountsVO> otherPlaceList = organAccountsList.stream()
.filter(s -> "异地".equals(s.getSrvModeName()) && (!"1".equals(s.getLevelCode())) && s.getDisableLevelName().contains("重度"))
.collect(Collectors.toList());
// 异地 按照 20 元/人/天的标准给予小额补助,实行按月支付
computeCostAndSave(organId,otherPlaceList, 20, 1, 0);
}
}
}
/**
* @param organAccountList 数据
* @param limitCost 限额费用
* @param overallPercent 统筹比例
* @param personalPercent 个人支付比例
* @return OrganAccountsVO
* @desc 根据限额比例计算统筹费用和个人支付并保存信息
**/
public OrganAccountsVO computeCostAndSave(String organId,List<OrganAccountsVO> organAccountList, double limitCost, double overallPercent, double personalPercent) {
OrganAccountsVO organAccountsVO = new OrganAccountsVO();
if (CollectionUtil.isEmpty(organAccountList)) {
BigDecimal zero = BigDecimal.valueOf(0);
organAccountsVO.setAllCost(zero);
organAccountsVO.setOverallCost(zero);
organAccountsVO.setPersonalCost(zero);
return organAccountsVO;
}
int size = organAccountList.size();
BigDecimal count = BigDecimal.valueOf(size);
BigDecimal limit = BigDecimal.valueOf(limitCost);
BigDecimal overallCostPercent = BigDecimal.valueOf(overallPercent);
BigDecimal personalCostPercent = BigDecimal.valueOf(personalPercent);
BigDecimal allCost = count.multiply(limit);
BigDecimal overallCost = allCost.multiply(overallCostPercent);
BigDecimal personalCost = allCost.multiply(personalCostPercent);
organAccountsVO.setAllCost(allCost);
organAccountsVO.setOverallCost(overallCost);
organAccountsVO.setPersonalCost(personalCost);
String srvModeName = organAccountList.get(0).getSrvModeName();
if(!"医疗".equals(srvModeName)) {
Long accountsId = saveOrganAccount(organId, organAccountList, allCost, overallCost, personalCost);
saveorganAccountDetail(organAccountList, limit, overallCostPercent, personalCostPercent,accountsId);
}
return organAccountsVO;
}
/**
* @param limit 限额
* @param overallPercent 统筹支付百分比
* @param personalPercent 个人支付百分比
* @param accountsId 机构结算id
* @return void
* @desc 保存机构结算明细
**/
public void saveorganAccountDetail(List<OrganAccountsVO> organAccountList ,BigDecimal limit, BigDecimal overallPercent,BigDecimal personalPercent,Long accountsId){
if(CollectionUtil.isEmpty(organAccountList)){
return;
}
for (OrganAccountsVO accountsVO : organAccountList) {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId());
chDisabDetailAccounts.setAccountsAllCost(limit);
chDisabDetailAccounts.setAccountsOverallCost(limit.multiply(overallPercent));
chDisabDetailAccounts.setAccountsPersonalCost(limit.multiply(personalPercent));
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(DateUtils.getlastMonth(lastMonth));
chDisabDetailAccounts.setAccountsStartTime(DateUtils.strToTime(accountsVO.getSrvStartTime()));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.strToTime(accountsVO.getSrvEndTime()));
chDisabDetailAccounts.setAccountsId(accountsId);
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setDisabInfoId(accountsVO.getDisabInfoId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
}
}
/**
*@desc 保存机构结算信息
*@param organId
* @param organAccountList
* @param allCost
* @param overallCost
* @param personalCost
*@return void
**/
private Long saveOrganAccount(String organId, List<OrganAccountsVO> organAccountList, BigDecimal allCost, BigDecimal overallCost, BigDecimal personalCost) {
if(CollectionUtil.isEmpty(organAccountList)){
return null;
}
ChDisabAccounts chDisabAccounts = new ChDisabAccounts();
chDisabAccounts.setAllCost(allCost.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
chDisabAccounts.setOverallCost(overallCost.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
chDisabAccounts.setPersonalCost(personalCost.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
Date date = DateUtils.getlastMonth(lastMonth);
chDisabAccounts.setAccountsTime(date);
chDisabAccounts.setAccountsStatus((short) 1);
chDisabAccounts.setCreationTime(new Date());
chDisabAccounts.setSrvOrganId(Long.valueOf(organId));
chDisabAccounts.setModeName(organAccountList.get(0).getSrvModeName());
chDisabAccounts.setSvrStartTime(getFirstDayOfMonth(date));
chDisabAccounts.setSvrEndTime(getLastDayOfMonth(date));
disabAccountsMapper.insert(chDisabAccounts);
Long accountsId = chDisabAccounts.getAccountsId();
return accountsId;
}
@Override
public void getAssessAccount() {
String lastMonth = DateUtils.getlastMonth();
List<AssessAccountsVO> assessList = chAssessAccountsMapper.getAssessAccountsList();
Map<String, List<AssessAccountsVO>> assessAccountMap = assessList.stream().collect(Collectors.groupingBy(AssessAccountsVO::getAprOrganId));
for (List<AssessAccountsVO> assessAccountsList : assessAccountMap.values()) {
List<AssessAccountsVO> accountEmpList = assessAccountsList.stream().filter(s -> "评定员".equals(s.getAprempTypeName())).collect(Collectors.toList());
List<AssessAccountsVO> accountExpertList = assessAccountsList.stream().filter(s -> "评估专家".equals(s.getAprempTypeName())).collect(Collectors.toList());
// 评估员上门评估,每人次 100 元
saveAssessAccounts(lastMonth, accountEmpList,BigDecimal.valueOf(100));
// 评估专家上门评估,每人次 150 元
saveAssessAccounts(lastMonth, accountExpertList,BigDecimal.valueOf(150));
}
}
/**
* @desc 保存评估结算信息
* @param lastMonth
* @param accountList
* @param limit
*@return void
**/
private void saveAssessAccounts(String lastMonth, List<AssessAccountsVO> accountList, BigDecimal limit) {
if (CollectionUtil.isEmpty(accountList)) {
return;
}
BigDecimal accountCost = BigDecimal.valueOf(accountList.size()).multiply(limit);
ChAssessAccounts chAssessAccounts = new ChAssessAccounts();
chAssessAccounts.setAccountsStatus((short) 1);
String allCost = accountCost.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
chAssessAccounts.setAssessAllCost(accountCost.setScale(2, BigDecimal.ROUND_HALF_UP).toString());
Date date = DateUtils.getlastMonth(lastMonth);
chAssessAccounts.setAccountsTime(DateUtils.getlastMonth(lastMonth));
chAssessAccounts.setAprOrganId(Long.valueOf(accountList.get(0).getAprOrganId()));
chAssessAccounts.setAssessStartTime(getFirstDayOfMonth(date));
chAssessAccounts.setAssessEndTime(getLastDayOfMonth(date));
chAssessAccounts.setChooseSettle((short) 1);
chAssessAccounts.setCreationTime(new Date());
chAssessAccountsMapper.insert(chAssessAccounts);
Long assessAccountsId = chAssessAccounts.getAssessAccountsId();
for (AssessAccountsVO assessAccountsVO : accountList) {
ChAssessDetailAccounts chAssessDetailAccounts = new ChAssessDetailAccounts();
chAssessDetailAccounts.setAssessAccountsId(assessAccountsId);
chAssessDetailAccounts.setSrvOrganId(assessAccountsVO.getAprOrganId());
chAssessDetailAccounts.setCreationTime(new Date());
chAssessDetailAccounts.setDisabInfoId(assessAccountsVO.getDisabInfoId());
chAssessDetailAccounts.setAssessAllCost(allCost);
chAssessDetailAccounts.setAccountsStartTime(assessAccountsVO.getAcceptTime());
chAssessDetailAccounts.setAccountsEndTime(assessAccountsVO.getFinishTime());
chAssessDetailAccounts.setAccountsTime(DateUtils.getlastMonth(lastMonth));
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts);
}
}
@Override @Override
public Workbook srvOrganAccountExport(String accountsId) { public Workbook srvOrganAccountExport(String accountsId) {
List<AccountExportDetailListResp> srvOrganAccountExportList = chOrganAccountsMapper.searchSrvOrganAccountDetailExport(accountsId); List<AccountExportDetailListResp> srvOrganAccountExportList = chDisabAccountsDetailMapper.searchSrvOrganAccountDetailExport(accountsId);
ExportParams exportParams = new ExportParams(); ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF); //对应xlsx exportParams.setType(ExcelType.XSSF); //对应xlsx
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, AccountExportDetailListResp.class, srvOrganAccountExportList); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, AccountExportDetailListResp.class, srvOrganAccountExportList);
...@@ -649,20 +452,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -649,20 +452,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override @Override
public Workbook assessAccountExport(String assessAccountsId) {
List<AssessAccountsExportResp> assessAccountExportList = chAssessAccountsMapper.assessAccountDetailExport(assessAccountsId);
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF); //对应xlsx
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, AssessAccountsExportResp.class, assessAccountExportList);
return workbook;
}
@Override
public List<ChAssessDetailAccountsResp> queryAssessAccountsDetail(String assessAccountsId) {
return chAssessDetailAccountsMapper.queryAssessAccountsDetail(assessAccountsId);
}
@Override
public List<ChDisabDetailAccountsResp> queryOrganAccountsDetail(String id) { public List<ChDisabDetailAccountsResp> queryOrganAccountsDetail(String id) {
return chDisabDetailAccountsMapper.queryOrganAccountsDetail(id); return chDisabDetailAccountsMapper.queryOrganAccountsDetail(id);
} }
...@@ -678,65 +467,107 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -678,65 +467,107 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
} }
@Override
@Transactional(rollbackFor=Exception.class)
public int updateChAssessAccounts(int id) {
ChAssessAccounts ca = new ChAssessAccounts();
ca.setAssessAccountsId(Long.valueOf(id));
ca.setAccountsStatus((short) 2);
return chAssessAccountsMapper.updateById(ca);
}
@Override @Override
public Page<AssessAccountsListResp> searchAssessAccountsList(SrvOrganListReq srvOrganListReq) { public Page<SrvTaskRespVO> getSrvTaskList(SrvTaskReqVO srvTaskReqVO){
List<Long> organIds = baseAccountService.getOrganIds(srvOrganListReq.getOrganId(), srvOrganListReq.getIsInvolveChild()); Page<SrvTaskRespVO> srvTaskList = taskDetailMapper.getSrvTaskList(new Page<>(srvTaskReqVO.getPageNum(), srvTaskReqVO.getPageSize()), srvTaskReqVO);
return chAssessAccountsMapper.searchAssessAccountList(new Page<>(srvOrganListReq.getPageNum(), srvOrganListReq.getPageSize()), organIds, srvOrganListReq); return srvTaskList;
} }
@Override @Override
public void organAccountTaskExecute(List<String> taskDetailIds) { public void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS) {
List<OrganAccountsVO> accountsList = chOrganAccountsMapper.getOrganAccountsList22(taskDetailIds); for (AccountTaskExecuteReqVO accountTaskExecuteReqVO : accountTaskExecuteReqVOS) {
// 根据护理机构分组 ChSrvTaskFinishItem chSrvTaskFinishItem = new ChSrvTaskFinishItem();
Map<String, List<OrganAccountsVO>> organAccountMap = accountsList.stream().collect(Collectors.groupingBy(OrganAccountsVO::getSrvOrganId)); chSrvTaskFinishItem.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId()));
for(Map.Entry<String, List<OrganAccountsVO>> entry:organAccountMap.entrySet()){ chSrvTaskFinishItem.setItemId(Long.valueOf(accountTaskExecuteReqVO.getItemId()));
String organId = entry.getKey(); chSrvTaskFinishItemMapper.insert(chSrvTaskFinishItem);
List<OrganAccountsVO> organAccountsList = entry.getValue();
if (CollectionUtil.isNotEmpty(organAccountsList)) { ChSrvTaskDetail ca = new ChSrvTaskDetail();
List<OrganAccountsVO> growOldOrganAccountList = organAccountsList.stream().filter(s -> "养老".equals(s.getSrvModeName())).collect(Collectors.toList()); ca.setStatus((short)4);
// 养老机构护理,其限额为 50 元/人/天 由长期护理保险基金支付 70% 个人支付 30% ca.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId()));
computeCostAndSave(organId,growOldOrganAccountList, 50, 0.7, 0.3); chSrvTaskDetailMapper.updateById(ca);
}
// 医疗机构护理,原则上收治医疗护理需求为主的重度失能人员一级及以下医疗机构其限额为 80 元/人/天,由长期护理保险基金支付 70%,个人支付 30%; List<String> taskDetailIds = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).collect(Collectors.toList());
List<OrganAccountsVO> oneLevelList = organAccountsList.stream() // 查询任务已经完成的记录 插入结算详情,一个任务下只要有一条服务完成就产生结算,多个服务完成算一条服务的结算(实际上结算详情有一条记录就产生结算费用)
.filter(s -> "医疗".equals(s.getSrvModeName()) && "1".equals(s.getLevelCode()) && s.getDisableLevelName().contains("重度")) // 根据机构,服务方式和时间查找结算表是否有数据,有数据进行累加
.collect(Collectors.toList()); List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOrganAccountsList(taskDetailIds,"4");
OrganAccountsVO organAccountsVO1 = computeCostAndSave(organId,oneLevelList, 80, 0.7, 0.3); // 根据机构,服务方式和时间查找结算表是否有数据,有数据进行累加
List<ChDisabDetailAccounts> chDisabDetailList = chDisabAccountsDetailMapper.queryAccountByCondition(taskDetailIds,DateUtils.dateToStrYm(new Date()));
// 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%; // 详情表还没有对应的任务数据说明还未发生过结算,进行插入详情表和结算表
List<OrganAccountsVO> aboveLevel2List = organAccountsList.stream() if(CollectionUtil.isEmpty(chDisabDetailList)){
.filter(s -> "医疗".equals(s.getSrvModeName()) && (!"1".equals(s.getLevelCode())) && s.getDisableLevelName().contains("重度")) for (OrganAccountsVO accountsVO : accountsList) {
.collect(Collectors.toList()); ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId());
OrganAccountsVO organAccountsVO2 = computeCostAndSave(organId,aboveLevel2List, 100, 0.7, 0.3); //要判断是养老还是医疗,因为费用不一样
BigDecimal limit = BigDecimal.valueOf(0);
BigDecimal allCost = organAccountsVO1.getAllCost().add(organAccountsVO2.getAllCost()); BigDecimal overallPercent = BigDecimal.valueOf(0.7);
BigDecimal overallCost = organAccountsVO1.getOverallCost().add(organAccountsVO2.getOverallCost()); BigDecimal personalPercent = BigDecimal.valueOf(0.3);
BigDecimal personalCost = organAccountsVO1.getPersonalCost().add(organAccountsVO2.getPersonalCost()); // 养老机构护理,其限额为 50 元/人/天 由长期护理保险基金支付 70% 个人支付 30%
Long accountsId = saveOrganAccount(organId, aboveLevel2List, allCost, overallCost, personalCost); if ("养老".equals(accountsVO.getSrvModeName())) {
saveorganAccountDetail(oneLevelList, BigDecimal.valueOf(80), organAccountsVO1.getOverallCost(), organAccountsVO1.getPersonalCost(),accountsId); limit = BigDecimal.valueOf(50);
saveorganAccountDetail(aboveLevel2List, BigDecimal.valueOf(100), organAccountsVO2.getOverallCost(), organAccountsVO2.getPersonalCost(),accountsId); // 医疗机构护理,原则上收治医疗护理需求为主的重度失能人员一级及以下医疗机构其限额为 80 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
for (String taskDetailId : taskDetailIds) { }else if("医疗".equals(accountsVO.getSrvModeName())&& "1".equals(accountsVO.getLevelCode()) && accountsVO.getDisableLevelName().contains("重度")){
ChSrvTaskDetail ca = new ChSrvTaskDetail(); limit = BigDecimal.valueOf(80);
ca.setStatus((short)4); // 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
ca.setTaskDetailId(Long.valueOf(taskDetailId)); }else if("医疗".equals(accountsVO.getSrvModeName())&& (!"1".equals(accountsVO.getLevelCode())) && accountsVO.getDisableLevelName().contains("重度")){
chSrvTaskDetailMapper.updateById(ca); limit = BigDecimal.valueOf(100);
} }
chDisabDetailAccounts.setAccountsAllCost(limit);
BigDecimal overallCost = limit.multiply(overallPercent);
chDisabDetailAccounts.setAccountsOverallCost(overallCost);
BigDecimal personalCost = limit.multiply(personalPercent);
chDisabDetailAccounts.setAccountsPersonalCost(personalCost);
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(new Date());
chDisabDetailAccounts.setAccountsStartTime(DateUtils.strToTime(accountsVO.getSrvStartTime()));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.strToTime(accountsVO.getSrvEndTime()));
chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setItemIds(accountsVO.getItemId());
chDisabDetailAccounts.setDisabInfoId(accountsVO.getDisabInfoId());
ChDisabAccounts chDisabAccounts = getChDisabAccounts(accountsVO, limit, overallCost, personalCost);
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
} }
}else {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
Long accountsDetailId = chDisabDetailList.get(0).getAccountsDetailId();
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
String itemIds = chDisabDetailAccounts.getItemIds();
chDisabDetailAccounts.setItemIds(itemIds+","+accountTaskExecuteReqVOS.get(0).getItemId());
chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
}
}
private ChDisabAccounts getChDisabAccounts(OrganAccountsVO accountsVO, BigDecimal limit, BigDecimal overallCost, BigDecimal personalCost) {
// 结算表 根据机构和结算时间 服务方式
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(new Date()), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId());
if(chDisabAccounts == null) {
chDisabAccounts = new ChDisabAccounts();
chDisabAccounts.setModeName(accountsVO.getSrvModeName());
chDisabAccounts.setAccountsTime(new Date());
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));
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;
} }
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.ChOrganAccountsMapper"> <mapper namespace="com.hungraim.ltc.account.dao.ChDisabAccountsDetailMapper">
<!--查询机构失能人员信息 -->
<select id="getOrganAccountsList" resultType="com.hungraim.ltc.pojo.vo.account.OrganAccountsVO"> <select id="getOrganAccountsList" resultType="com.hungraim.ltc.pojo.vo.account.OrganAccountsVO">
select select
--失能人员姓名 detail.TASK_DETAIL_ID taskDetailId,
disable.real_name realName, --失能人员姓名
disable.DISAB_INFO_ID disabInfoId, disable.real_name realName,
--身份证号 disable.DISAB_INFO_ID disabInfoId,
disable.CERTI_CODE certiCode, --身份证号
--所在省市 disable.CERTI_CODE certiCode,
apply.MEDICAL_AREA medicalArea, --所在省市
mode1.MODE_ID modeId, apply.MEDICAL_AREA medicalArea,
--服务方式 mode1.MODE_ID modeId,
mode1.mode_name srvModeName, --服务方式
--护理机构名称 mode1.mode_name srvModeName,
organ.srv_organ_id srvOrganId, --护理机构名称
--护理机构名称 organ.srv_organ_id srvOrganId,
organ.srv_organ_name srvOrganName, --护理机构名称
--护理服务人员 organ.srv_organ_name srvOrganName,
emp.emp_name empName, --护理服务人员
--任务时间 emp.emp_name empName,
detail.SRV_DATE srvDate, --任务时间
detail.SRV_START_TIME srvStartTime, detail.SRV_DATE srvDate,
detail.SRV_END_TIME srvEndTime, detail.SRV_START_TIME srvStartTime,
--机构等级 detail.SRV_END_TIME srvEndTime,
organ.LEVEL_CODE levelCode, -- 机构等级
--失能等级 organ.LEVEL_CODE levelCode,
level1.DISABLE_LEVEL_NAME disableLevelName -- 失能等级
from ch_srv_task_detail detail--服务计划 level1.DISABLE_LEVEL_NAME disableLevelName,
left join ch_srv_task task on task.srv_task_id = detail.srv_task_id--服务计划详情 d.service_type_detailed_name itemName
left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员 ,d.PARA_ID,
left join CH_DEV.CH_DISABLE_APPLY apply on apply.apply_id = disable.apply_id CSOP.ITEM_TIMES,
left join ch_apr_task aprtask on disable.last_task_id = aprtask.task_id--评定任务 CSOP.ITEM_TIMES_TYPE,
left join ch_apr_report report on aprtask.task_id = report.task_id--评定报告 CSTFI.ITEM_ID itemId
left join ch_srv_program program on task.program_id = program.program_id--服务方案 from ch_srv_task_detail detail--服务计划
left join ch_srv_organ organ on program.srv_organ_id = organ.srv_organ_id--服务机构 left join ch_srv_task task on task.srv_task_id = detail.srv_task_id--服务计划详情
left join ch_cfg_srv_mode mode1 on program.srv_mode_id = mode1.mode_id--服务方式 left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员
left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_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_cfg_srv_disable_level level1 on report.disable_level_id = level1.disable_level_id left join ch_apr_report report on aprtask.task_id = report.task_id--评定报告
where detail.STATUS=4 and organ.LEVEL_CODE is not null 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
LEFT JOIN CH_SRV_TASK_FINISH_ITEM CSTFI ON detail.TASK_DETAIL_ID = CSTFI.TASK_DETAIL_ID
LEFT JOIN CH_SRV_ORGAN_PROJECT CSOP ON CSOP.PROJECT_ID = CSTFI.ITEM_ID
LEFT JOIN CH_SERVICE_TYPE_detailed d on d.service_type_detailed_id = CSOP.item_name
<where>
<if test="status != null and status != ''">
AND detail.STATUS = #{status}
</if>
<if test="taskDetailIds != null and taskDetailIds.size() > 0">
AND detail.TASK_DETAIL_ID IN
<foreach collection="taskDetailIds" separator="," open="(" close=")" item="taskDetailId">
#{taskDetailId}
</foreach>
</if>
</where>
</select> </select>
<select id="queryAccountByCondition" resultType="com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts">
<select id="getOrganAccountsList22" resultType="com.hungraim.ltc.pojo.vo.account.OrganAccountsVO"> select * from CH_DISAB_ACCOUNTS_DETAIL t where t.MODE_NAME in ('养老','医疗')
select and to_char(t.ACCOUNTS_TIME,'yyyy-MM') = #{accountsTime}
--失能人员姓名
disable.real_name realName,
disable.DISAB_INFO_ID disabInfoId,
--身份证号
disable.CERTI_CODE certiCode,
--所在省市
apply.MEDICAL_AREA medicalArea,
mode1.MODE_ID modeId,
--服务方式
mode1.mode_name srvModeName,
--护理机构名称
organ.srv_organ_id srvOrganId,
--护理机构名称
organ.srv_organ_name srvOrganName,
--护理服务人员
emp.emp_name empName,
--任务时间
detail.SRV_DATE srvDate,
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 detail.STATUS = '0'
<if test="taskDetailIds != null and taskDetailIds.size() > 0"> <if test="taskDetailIds != null and taskDetailIds.size() > 0">
AND detail.TASK_DETAIL_ID IN AND t.TASK_DETAIL_ID IN
<foreach collection="taskDetailIds" separator="," open="(" close=")" item="taskDetailId"> <foreach collection="taskDetailIds" separator="," open="(" close=")" item="taskDetailId">
#{taskDetailId} #{taskDetailId}
</foreach> </foreach>
</if> </if>
</select> </select>
<!--查询评估信息--> <!--查询评估信息-->
......
...@@ -15,4 +15,22 @@ ...@@ -15,4 +15,22 @@
ACCOUNTS_ID, SRV_ORGAN_ID, TOTAL_ALLOCATED_EXPENSES, CREATION_TIME, ACCOUNTS_TIME, ACCOUNTS_ID, SRV_ORGAN_ID, TOTAL_ALLOCATED_EXPENSES, CREATION_TIME, ACCOUNTS_TIME,
TOTAL_EXPENSES_PAYABLE, CHOOSE_SETTLE, ACCOUNTS_STATUS TOTAL_EXPENSES_PAYABLE, CHOOSE_SETTLE, ACCOUNTS_STATUS
</sql> </sql>
<select id="queryAccountByCondition" resultType="com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts">
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}
</select>
<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}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -21,35 +21,38 @@ ...@@ -21,35 +21,38 @@
--护理服务人员 --护理服务人员
emp.emp_name empName, emp.emp_name empName,
--任务时间 --任务时间
detail.SRV_DATE srvDate, to_char( detail.SRV_DATE,'yyyy-MM-dd') srvDate,
detail.SRV_START_TIME srvStartTime, detail.TASK_DETAIL_ID taskDetailId,
detail.SRV_END_TIME srvEndTime, d.SERVICE_TYPE_DETAILED_NAME itemName,
--机构等级 CSTFI.ITEM_ID itemId
organ.LEVEL_CODE levelCode, from ch_srv_task_detail detail --服务计划
--失能等级
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_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_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_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_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_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_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_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
--失能等级 <if test='req.status != null and req.status == "0"'>
left join ch_cfg_srv_disable_level level1 on report.disable_level_id = level1.disable_level_id left join CH_SRV_PROGRAM_SET CSTFI on CSTFI.PROGRAM_ID = task.program_id
LEFT JOIN CH_SRV_ORGAN_PROJECT CSOP ON CSOP.PROJECT_ID = CSTFI.ITEM_ID
</if>
<if test='req.status != null and req.status == "4"'>
left join CH_SRV_TASK_FINISH_ITEM CSTFI on CSTFI.TASK_DETAIL_ID = detail.TASK_DETAIL_ID
LEFT JOIN CH_SRV_ORGAN_PROJECT CSOP ON CSOP.PROJECT_ID = CSTFI.ITEM_ID
</if>
LEFT JOIN CH_SERVICE_TYPE_detailed d on d.service_type_detailed_id = CSOP.item_name
<where> <where>
srvModeName in ('医疗','养老') mode1.mode_name in ('医疗','养老')
<if test="req.realName != null and req.realName != ''"> <if test="req.realName != null and req.realName != ''">
and disable.real_name LIKE CONCAT(CONCAT('%',#{req.realName}),'%') and disable.real_name LIKE CONCAT(CONCAT('%',#{req.realName}),'%')
</if> </if>
<if test="req.status != null and req.status != ''"> <if test='req.status != null and req.status != "" and req.status != "0"'>
and detail.status = #{req.status} and detail.status = #{req.status}
</if> </if>
</where> </where>
order by detail.SRV_DATE desc
</select> </select>
......
...@@ -8,6 +8,7 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach; ...@@ -8,6 +8,7 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.assessment.*; import com.hungraim.ltc.pojo.entity.assessment.*;
import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel; import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel;
import com.hungraim.ltc.pojo.vo.ReportUpdateVO; import com.hungraim.ltc.pojo.vo.ReportUpdateVO;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp;
import com.hungraim.ltc.pojo.vo.assessment.*; import com.hungraim.ltc.pojo.vo.assessment.*;
import com.hungraim.ltc.service.TaskService; import com.hungraim.ltc.service.TaskService;
import com.hungraim.ltc.service.TppesApiException; import com.hungraim.ltc.service.TppesApiException;
...@@ -22,7 +23,6 @@ import org.springframework.web.bind.annotation.*; ...@@ -22,7 +23,6 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -182,6 +182,8 @@ public class TaskController { ...@@ -182,6 +182,8 @@ public class TaskController {
//失败 //失败
return Result.failed(objectResult.getMsg()); return Result.failed(objectResult.getMsg());
} }
// 评估结算
taskService.assessAccount(reportDetailVo);
return Result.success(); return Result.success();
} }
...@@ -678,4 +680,57 @@ public class TaskController { ...@@ -678,4 +680,57 @@ public class TaskController {
String fileName = "aprEmp.xlsx"; String fileName = "aprEmp.xlsx";
FileUtils.exportResponse(workbook,fileName,response); FileUtils.exportResponse(workbook,fileName,response);
} }
/**
* 查询评估结算列表
*
* @param srvOrganListReq 请求参数对象
* @return 返回
*/
@GetMapping("/searchAssessAccountsList")
public Result<Page<AssessAccountsListResp>> searchAssessAccountsList(SrvOrganListReq srvOrganListReq) {
return Result.success(taskService.searchAssessAccountsList(srvOrganListReq));
}
/**
* 评估结算导出明细
*
*/
@GetMapping("/assessAccountExport")
public void assessAccountExport(String assessAccountsId,HttpServletResponse response){
Workbook workbook = taskService.assessAccountExport(assessAccountsId);
// 命名表格
String fileName = "assessAccount.xlsx";
FileUtils.exportResponse(workbook,fileName,response);
}
/**
* 评估人员结算列表明细
*
* @param assessAccountsId 评估结算id
* @return 返回
*/
@GetMapping("/queryAssessAccountsDetail")
public Result<List<ChAssessDetailAccountsResp>> queryAssessAccountsDetail(String assessAccountsId) {
List<ChAssessDetailAccountsResp> chAssessDetailAccounts = taskService.queryAssessAccountsDetail(assessAccountsId);
return Result.success(chAssessDetailAccounts);
}
/**
* 评估人员结算提交复核
*
* @param id 结算id
* @return 返回雷彪
*/
@PostMapping("/updateChAssessAccounts")
public Result updateChAssessAccounts(int id) {
int bl = taskService.updateChAssessAccounts(id);
if(bl>0){
return Result.success();
}else{
return Result.failed();
}
}
} }
package com.hungraim.ltc.account.dao; package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.account.ChAssessDetailAccounts; import com.hungraim.ltc.pojo.entity.assessment.ChAssessDetailAccounts;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
......
package com.hungraim.ltc.account.dao; package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.account.ChAssessAccounts; import com.hungraim.ltc.pojo.entity.assessment.ChAssessAccounts;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp; import com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp; import com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsVO; import com.hungraim.ltc.pojo.vo.assessment.AssessIdAndCostVO;
import com.hungraim.ltc.pojo.vo.account.SrvOrganListReq; import com.hungraim.ltc.pojo.vo.assessment.SrvOrganListReq;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -16,7 +16,8 @@ import java.util.List; ...@@ -16,7 +16,8 @@ import java.util.List;
@Repository @Repository
public interface ChAssessAccountsMapper extends BaseMapper<ChAssessAccounts> { public interface ChAssessAccountsMapper extends BaseMapper<ChAssessAccounts> {
List<AssessAccountsVO> getAssessAccountsList(); AssessIdAndCostVO queryAssessByOrganIdAndTime(String aprOrganId, String accountsTime);
Page<AssessAccountsListResp> searchAssessAccountList(Page page, List<Long> organIds, SrvOrganListReq req); Page<AssessAccountsListResp> searchAssessAccountList(Page page, List<Long> organIds, SrvOrganListReq req);
......
package com.hungraim.ltc.account.dao; package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.account.ChAssessDetailAccounts; import com.hungraim.ltc.pojo.entity.assessment.ChAssessDetailAccounts;
import com.hungraim.ltc.pojo.entity.account.ChAssessDetailAccountsResp; import com.hungraim.ltc.pojo.entity.assessment.ChAssessDetailAccountsResp;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
*/ */
@Mapper @Mapper
@Repository @Repository
public interface ChAssessDetailAccountsMapper extends BaseMapper<ChAssessDetailAccounts> { public interface ChAssessDetailAccountsMapper extends BaseMapper<ChAssessDetailAccounts> {
List<ChAssessDetailAccountsResp> queryAssessAccountsDetail(String assessAccountsId); List<ChAssessDetailAccountsResp> queryAssessAccountsDetail(String assessAccountsId);
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach; import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.assessment.*; import com.hungraim.ltc.pojo.entity.assessment.*;
import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel; import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp;
import com.hungraim.ltc.pojo.vo.assessment.*; import com.hungraim.ltc.pojo.vo.assessment.*;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
...@@ -87,4 +88,19 @@ public interface TaskService { ...@@ -87,4 +88,19 @@ public interface TaskService {
Map taskReportFractionDtlQueryList(); Map taskReportFractionDtlQueryList();
Workbook aprEmpExport(String provincial, String city, String area, String organName, String name, String tel, String groupLeader); Workbook aprEmpExport(String provincial, String city, String area, String organName, String name, String tel, String groupLeader);
void assessAccount(ReportDetailVO reportDetailVo);
Page<AssessAccountsListResp> searchAssessAccountsList(SrvOrganListReq srvOrganListReq);
Workbook assessAccountExport(String assessAccountsId);
/**
* 列表明细
* @param assessAccountsId
* @return
*/
List<ChAssessDetailAccountsResp> queryAssessAccountsDetail(String assessAccountsId);
int updateChAssessAccounts(int id);
} }
...@@ -9,23 +9,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -9,23 +9,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hungraim.ltc.api.AttachFeignService; import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.*; import com.hungraim.ltc.dao.*;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach; import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.assessment.*; import com.hungraim.ltc.pojo.entity.assessment.*;
import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel; import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo; import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp;
import com.hungraim.ltc.pojo.vo.assessment.*; import com.hungraim.ltc.pojo.vo.assessment.*;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpExportVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo; import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.service.ChAprReportFractionService; import com.hungraim.ltc.service.ChAprReportFractionService;
import com.hungraim.ltc.service.TaskService; import com.hungraim.ltc.service.TaskService;
import com.hungraim.ltc.service.TppesApiException; import com.hungraim.ltc.service.TppesApiException;
import com.hungraim.ltc.util.AttachType; import com.hungraim.ltc.util.*;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.SerialNumberUtils;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -34,9 +31,8 @@ import org.springframework.beans.BeanUtils; ...@@ -34,9 +31,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.awt.*; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -64,6 +60,14 @@ public class TaskServiceImpl implements TaskService { ...@@ -64,6 +60,14 @@ public class TaskServiceImpl implements TaskService {
private final ChTaskReportFractionDtlMapper chTaskReportFractionDtlMapper; private final ChTaskReportFractionDtlMapper chTaskReportFractionDtlMapper;
private final ChAssessAccountsDetailMapper chAssessAccountsDetailMapper;
private final ChAssessAccountsMapper chAssessAccountsMapper;
private final ChAssessDetailAccountsMapper chAssessDetailAccountsMapper;
/** /**
* 评定任务分配列表 * 评定任务分配列表
* *
...@@ -200,6 +204,92 @@ public class TaskServiceImpl implements TaskService { ...@@ -200,6 +204,92 @@ public class TaskServiceImpl implements TaskService {
} }
@Override @Override
public void assessAccount(ReportDetailVO reportDetailVo){
Integer person1 = reportDetailVo.getPerson1();
Integer person2 = reportDetailVo.getPerson2();
Integer person3 = reportDetailVo.getPerson3();
String evaluateTime = reportDetailVo.getEvaluateTime();
// 根据评定机构id和评估结算时间查找表里有没有数据,有数据直接累加费用
// 评定人员结算表插入
if (person1 != null) {
ChAssessDetailAccounts chAssessDetailAccounts = new ChAssessDetailAccounts();
chAssessDetailAccounts.setEmpId(String.valueOf(person1));
ChAprEmp chAprEmp = aprEmpMapper.selectById(person1);
Integer aprOrganId = chAprEmp.getAprOrganId();
chAssessDetailAccounts.setAprOrganId(String.valueOf(aprOrganId));
chAssessDetailAccounts.setApplyId(reportDetailVo.getApplyId());
chAssessDetailAccounts.setCreationTime(new Date());
chAssessDetailAccounts.setAccountsTime(new Date());
chAssessDetailAccounts.setAssessTime(DateUtils.strToDate(evaluateTime));
Integer aprempTypeIdS = chAprEmp.getAprempTypeIdS();
// 1 评估员上门评估,每人次 100 元
// 5 评估专家上门评估,每人次 150 元
String assessCost = aprempTypeIdS==1? "100":"150";
chAssessDetailAccounts.setAssessCost(assessCost);
Long assessAccountsId;
AssessIdAndCostVO assessIdAndCostVO = chAssessAccountsMapper.queryAssessByOrganIdAndTime(String.valueOf(aprOrganId), DateUtils.dateToStrYm(new Date()));
if (assessIdAndCostVO == null) {
ChAssessAccounts chAssessAccounts = new ChAssessAccounts();
chAssessAccounts.setAccountsTime(new Date());
chAssessAccounts.setAprOrganId(Long.valueOf(aprOrganId));
chAssessAccounts.setCreationTime(new Date());
chAssessAccounts.setAccountsStatus((short)1);
chAssessAccounts.setAssessAllCost(new BigDecimal(assessCost));
chAssessAccountsMapper.insert(chAssessAccounts);
assessAccountsId = chAssessAccounts.getAssessAccountsId();
}else{
assessAccountsId = assessIdAndCostVO.getAssessAccountsId();
BigDecimal assessAllCost = assessIdAndCostVO.getAssessAllCost();
ChAssessAccounts chAssessAccounts = new ChAssessAccounts();
chAssessAccounts.setAssessAccountsId(assessAccountsId);
chAssessAccounts.setAssessAllCost(assessAllCost.add(new BigDecimal(assessCost)));
chAssessAccountsMapper.updateById(chAssessAccounts);
}
chAssessDetailAccounts.setAssessAccountsId(assessAccountsId);
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts);
}
if (person2 != null) {
ChAssessDetailAccounts chAssessDetailAccounts = new ChAssessDetailAccounts();
chAssessDetailAccounts.setEmpId(String.valueOf(person2));
ChAprEmp chAprEmp = aprEmpMapper.selectById(person2);
Integer aprOrganId = chAprEmp.getAprOrganId();
chAssessDetailAccounts.setAprOrganId(String.valueOf(aprOrganId));
chAssessDetailAccounts.setApplyId(reportDetailVo.getApplyId());
chAssessDetailAccounts.setCreationTime(new Date());
chAssessDetailAccounts.setAccountsTime(new Date());
chAssessDetailAccounts.setAssessTime(DateUtils.strToDate(evaluateTime));
Integer aprempTypeIdS = chAprEmp.getAprempTypeIdS();
// 1 评估员上门评估,每人次 100 元
// 5 评估专家上门评估,每人次 150 元
String assessCost = aprempTypeIdS==1? "100":"150";
chAssessDetailAccounts.setAssessCost(assessCost);
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts);
}
if (person3 != null) {
ChAssessDetailAccounts chAssessDetailAccounts = new ChAssessDetailAccounts();
chAssessDetailAccounts.setEmpId(String.valueOf(person3));
ChAprEmp chAprEmp = aprEmpMapper.selectById(person3);
Integer aprOrganId = chAprEmp.getAprOrganId();
chAssessDetailAccounts.setAprOrganId(String.valueOf(aprOrganId));
chAssessDetailAccounts.setApplyId(reportDetailVo.getApplyId());
chAssessDetailAccounts.setCreationTime(new Date());
chAssessDetailAccounts.setAccountsTime(new Date());
chAssessDetailAccounts.setAssessTime(DateUtils.strToDate(evaluateTime));
Integer aprempTypeIdS = chAprEmp.getAprempTypeIdS();
// 1 评估员上门评估,每人次 100 元
// 5 评估专家上门评估,每人次 150 元
String assessCost = aprempTypeIdS==1? "100":"150";
chAssessDetailAccounts.setAssessCost(assessCost);
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts);
}
}
@Override
public TaskReportVO getReportById(String reportId) { public TaskReportVO getReportById(String reportId) {
TaskReportVO reportById = taskMapper.getReportById(reportId); TaskReportVO reportById = taskMapper.getReportById(reportId);
List<ChAprReportFraction> chAprReportFractions = chAprReportFractionMapper.selectList(new LambdaQueryWrapper<ChAprReportFraction>().eq(ChAprReportFraction::getReportId, reportId)); List<ChAprReportFraction> chAprReportFractions = chAprReportFractionMapper.selectList(new LambdaQueryWrapper<ChAprReportFraction>().eq(ChAprReportFraction::getReportId, reportId));
...@@ -736,4 +826,38 @@ public class TaskServiceImpl implements TaskService { ...@@ -736,4 +826,38 @@ public class TaskServiceImpl implements TaskService {
return workbook; return workbook;
} }
@Override
public Workbook assessAccountExport(String assessAccountsId) {
List<AssessAccountsExportResp> assessAccountExportList = chAssessAccountsMapper.assessAccountDetailExport(assessAccountsId);
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF); //对应xlsx
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, AssessAccountsExportResp.class, assessAccountExportList);
return workbook;
}
@Override
public List<ChAssessDetailAccountsResp> queryAssessAccountsDetail(String assessAccountsId) {
return chAssessDetailAccountsMapper.queryAssessAccountsDetail(assessAccountsId);
}
@Override
@Transactional(rollbackFor=Exception.class)
public int updateChAssessAccounts(int id) {
ChAssessAccounts ca = new ChAssessAccounts();
ca.setAssessAccountsId(Long.valueOf(id));
ca.setAccountsStatus((short) 2);
return chAssessAccountsMapper.updateById(ca);
}
@Override
public Page<AssessAccountsListResp> searchAssessAccountsList(SrvOrganListReq srvOrganListReq) {
// List<Long> organIds = baseAccountService.getOrganIds(srvOrganListReq.getOrganId(), srvOrganListReq.getIsInvolveChild());
return chAssessAccountsMapper.searchAssessAccountList(new Page<>(srvOrganListReq.getPageNum(), srvOrganListReq.getPageSize()), null, srvOrganListReq);
}
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.ChAssessAccountsMapper"> <mapper namespace="com.hungraim.ltc.dao.ChAssessAccountsMapper">
<!--查询评估信息-->
<select id="getAssessAccountsList" resultType="com.hungraim.ltc.pojo.vo.account.AssessAccountsVO">
select
DISTINCT task.task_id taskId,
fndOrgan.ORGAN_NAME organName,
task.ORGAN_ID aprOrganId,
disable.DISAB_INFO_ID disabInfoId,
task.ACCEPT_TIME acceptTime,
task.finish_time finishTime,
emp.APREMP_TYPE_NAME_F aprempTypeName
from CH_APR_TASK task
left join ch_apr_organ aprOrgan on task.apr_organ_id = aprOrgan.apr_organ_id
left join ch_disable_info disable on task.disable_info_id = disable.disab_info_id
left join ch_apr_emp emp on task.apr_emp_id = emp.emp_id and emp.IS_LOCK = 0
left join ch_apr_report report on report.TASK_ID = task.TASK_ID
left join CH_FND_ORGAN fndOrgan on task.ORGAN_ID = fndOrgan.ORGAN_ID
where task.task_status = 2 and emp.APREMP_TYPE_NAME_F is not null
<select id="queryAssessByOrganIdAndTime" resultType="com.hungraim.ltc.pojo.vo.assessment.AssessIdAndCostVO">
select a.ASSESS_ACCOUNTS_ID assessAccountsId,a.ASSESS_ALL_COST assessAllCost from
CH_ASSESS_ACCOUNTS a where a.APR_ORGAN_ID = #{aprOrganId}
and to_char(a.ACCOUNTS_TIME,'yyyy-MM') = #{accountsTime}
</select> </select>
<select id="searchAssessAccountList" resultType="com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp"> <select id="searchAssessAccountList" resultType="com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp">
SELECT SELECT
t1.ASSESS_ACCOUNTS_ID, t1.ASSESS_ACCOUNTS_ID,
...@@ -105,5 +88,12 @@ ...@@ -105,5 +88,12 @@
where t1.ASSESS_ACCOUNTS_ID = #{assessAccountsId} where t1.ASSESS_ACCOUNTS_ID = #{assessAccountsId}
</select> </select>
<select id="getAssessAccountsList" resultType="com.hungraim.ltc.pojo.vo.account.AssessAccountsVO">
select * from CH_ASSESS_ACCOUNTS t1 where
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.ChAssessDetailAccountsMapper"> <mapper namespace="com.hungraim.ltc.dao.ChAssessDetailAccountsMapper">
<select id="queryAssessAccountsDetail" resultType="com.hungraim.ltc.pojo.entity.account.ChAssessDetailAccountsResp"> <select id="queryAssessAccountsDetail" resultType="com.hungraim.ltc.pojo.entity.assessment.ChAssessDetailAccountsResp">
select select
d.ASSESS_ALL_COST assessAllCost, d.ASSESS_ALL_COST assessAllCost,
to_char(d.ACCOUNTS_TIME,'yyyy-MM') accountsTime, to_char(d.ACCOUNTS_TIME,'yyyy-MM') accountsTime,
......
...@@ -69,8 +69,12 @@ public class ChDisabDetailAccounts implements Serializable { ...@@ -69,8 +69,12 @@ public class ChDisabDetailAccounts implements Serializable {
*/ */
private Date accountsEndTime; private Date accountsEndTime;
private String taskDetailId;
private String medicalArea; private String medicalArea;
private String itemIds;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
package com.hungraim.ltc.pojo.entity.account; package com.hungraim.ltc.pojo.entity.assessment;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
...@@ -9,6 +9,7 @@ import lombok.Data; ...@@ -9,6 +9,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
...@@ -26,7 +27,7 @@ public class ChAssessAccounts implements Serializable { ...@@ -26,7 +27,7 @@ public class ChAssessAccounts implements Serializable {
private Long assessAccountsId; private Long assessAccountsId;
/** /**
* 机构id * 评定机构id
*/ */
private Long aprOrganId; private Long aprOrganId;
...@@ -46,10 +47,6 @@ public class ChAssessAccounts implements Serializable { ...@@ -46,10 +47,6 @@ public class ChAssessAccounts implements Serializable {
private Date accountsTime; private Date accountsTime;
/**
* 是否结算(0未结算,1已结算)
*/
private Short chooseSettle;
/** /**
* 状态(0-待提交;1-待审核;2-已审核;3-已失效;) * 状态(0-待提交;1-待审核;2-已审核;3-已失效;)
...@@ -67,20 +64,10 @@ public class ChAssessAccounts implements Serializable { ...@@ -67,20 +64,10 @@ public class ChAssessAccounts implements Serializable {
private String checkRemark; private String checkRemark;
/**
* 费用开始日期
*/
private Date assessStartTime;
/**
* 费用结束日期
*/
private Date assessEndTime;
/** /**
* 总费用合计 * 总费用合计
*/ */
private String assessAllCost; private BigDecimal assessAllCost;
......
package com.hungraim.ltc.pojo.entity.account; package com.hungraim.ltc.pojo.entity.assessment;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
...@@ -9,7 +9,6 @@ import lombok.Data; ...@@ -9,7 +9,6 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
...@@ -26,13 +25,18 @@ public class ChAssessDetailAccounts implements Serializable { ...@@ -26,13 +25,18 @@ public class ChAssessDetailAccounts implements Serializable {
private Long assessAccountsDetailId; private Long assessAccountsDetailId;
private Long assessAccountsId; private Long assessAccountsId;
private String disabInfoId;
private String applyId;
private String empId;
/** /**
* 护理机构id * 评定机构id
*/ */
private String srvOrganId; private String aprOrganId;
/** /**
* 创建时间 * 创建时间
...@@ -44,28 +48,11 @@ public class ChAssessDetailAccounts implements Serializable { ...@@ -44,28 +48,11 @@ public class ChAssessDetailAccounts implements Serializable {
/** /**
* 结算月份 * 结算月份
*/ */
@DateTimeFormat(pattern = "yyyy-MM")
@JsonFormat(pattern = "yyyy-MM",timezone = "GMT+8")
private Date accountsTime; private Date accountsTime;
private Date assessTime;
private String assessAllCost; private String assessCost;
private String assessOverallCost;
private String assessPersonalCost;
/**
* 费用开始日期
*/
private String accountsStartTime;
/**
* 费用结束日期
*/
private String accountsEndTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.hungraim.ltc.pojo.entity.account; package com.hungraim.ltc.pojo.entity.assessment;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
@Data @Data
......
package com.hungraim.ltc.pojo.vo.account;
import lombok.Data;
@Data
public class AccountTaskExecuteReqVO {
private String taskDetailId;
private String itemId;
}
package com.hungraim.ltc.pojo.vo.account;
import lombok.Data;
import java.util.List;
@Data
public class AccountTaskReqVO {
private List<AccountTaskExecuteReqVO> accountTaskList;
}
...@@ -10,6 +10,10 @@ import java.math.BigDecimal; ...@@ -10,6 +10,10 @@ import java.math.BigDecimal;
@Data @Data
public class OrganAccountsVO { public class OrganAccountsVO {
private String taskDetailId;
private String itemId;
private String disabInfoId; private String disabInfoId;
/** /**
* 失能人员姓名 * 失能人员姓名
...@@ -83,4 +87,6 @@ public class OrganAccountsVO { ...@@ -83,4 +87,6 @@ public class OrganAccountsVO {
*/ */
private BigDecimal personalCost; private BigDecimal personalCost;
private String itemName;
} }
...@@ -66,12 +66,12 @@ public class SrvOrganAccountListResp { ...@@ -66,12 +66,12 @@ public class SrvOrganAccountListResp {
/** /**
* 费用开始时间 * 费用开始时间
*/ */
private String svrStartTime; private Date svrStartTime;
/** /**
* 费用结束时间 * 费用结束时间
*/ */
private String svrEndTime; private Date svrEndTime;
......
...@@ -9,7 +9,7 @@ import lombok.Data; ...@@ -9,7 +9,7 @@ import lombok.Data;
@Data @Data
public class SrvTaskRespVO { public class SrvTaskRespVO {
// 任务id // 任务id
private String taskDetailId; private Long taskDetailId;
// 失能人员姓名 // 失能人员姓名
private String realName; private String realName;
...@@ -23,6 +23,12 @@ public class SrvTaskRespVO { ...@@ -23,6 +23,12 @@ public class SrvTaskRespVO {
// 任务时间 // 任务时间
private String srvDate; private String srvDate;
// 任务名称
private String itemName;
// 任务名称
private Long itemId;
} }
package com.hungraim.ltc.pojo.vo.assessment;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class AssessIdAndCostVO {
private Long assessAccountsId;
private BigDecimal assessAllCost;
}
...@@ -15,6 +15,7 @@ public class ReportDetailVO { ...@@ -15,6 +15,7 @@ public class ReportDetailVO {
Integer person3; Integer person3;
String evaluateTime; String evaluateTime;
Integer disableLevelId; Integer disableLevelId;
String applyId;
String polNo; String polNo;
String remark; String remark;
List<ChFndAttach> fileDataList; List<ChFndAttach> fileDataList;
......
package com.hungraim.ltc.pojo.vo.assessment;
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 SrvOrganListReq extends BaseReq {
/**
* 适用机构id
*/
private Long organId;
/**
* 是否包含下级机构
*/
private Boolean isInvolveChild;
/**
* 护理机构id
*/
private Long srvOrganId;
/**
* 结算月份
*/
@DateTimeFormat(pattern = "yyyy-MM")
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
private Date accountsTime;
}
...@@ -33,7 +33,7 @@ public class DateUtils { ...@@ -33,7 +33,7 @@ public class DateUtils {
*/ */
public static final String DATE_PATTERN_yyyy_MM_dd = "yyyy-MM-dd"; public static final String DATE_PATTERN_yyyy_MM_dd = "yyyy-MM-dd";
public static final String DATE_PATTERN_yyyy_MM = "yyyy-MM-dd"; public static final String DATE_PATTERN_yyyy_MM = "yyyy-MM";
/** /**
* MM-dd 12月25日 * MM-dd 12月25日
...@@ -229,6 +229,22 @@ public class DateUtils { ...@@ -229,6 +229,22 @@ public class DateUtils {
} }
/** /**
* 将短时间格式时间转换为字符串 yyyy-MM
*
* @param dateDate
* @param
* @return
*/
public static String dateToStrYm(Date dateDate) {
if (dateDate == null) {
return "";
}
SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN_yyyy_MM);
String dateString = formatter.format(dateDate);
return dateString;
}
/**
* 将短时间格式时间转换为字符串 yyyyMMdd * 将短时间格式时间转换为字符串 yyyyMMdd
* *
* @param dateDate * @param dateDate
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
SELECT SELECT
PROJECT_ID, PROJECT_ID,
SRV_ORGAN_ID, SRV_ORGAN_ID,
ITEM_NAME, -- ITEM_NAME,
d.service_type_detailed_name ITEM_NAME,
CATEGORY_TYPE, CATEGORY_TYPE,
CH_SRV_ORGAN_PROJECT.ITEM_TIMES, CH_SRV_ORGAN_PROJECT.ITEM_TIMES,
ITEM_TIMES_TYPE, ITEM_TIMES_TYPE,
...@@ -64,7 +65,8 @@ ...@@ -64,7 +65,8 @@
<if test="programId != null"> <if test="programId != null">
LEFT JOIN CH_SRV_PROGRAM_SET ON ITEM_ID = PROJECT_ID AND PROGRAM_ID = #{programId} LEFT JOIN CH_SRV_PROGRAM_SET ON ITEM_ID = PROJECT_ID AND PROGRAM_ID = #{programId}
</if> </if>
WHERE SRV_ORGAN_ID = #{srvOrganId} AND STATUS = 0 left join CH_SERVICE_TYPE_detailed d on d.service_type_detailed_id = CH_SRV_ORGAN_PROJECT.item_name
WHERE SRV_ORGAN_ID = #{srvOrganId} and STATUS = 0
</select> </select>
<select id="organProjectList" resultType="com.hungraim.ltc.pojo.vo.governance.OrganProjectVO"> <select id="organProjectList" resultType="com.hungraim.ltc.pojo.vo.governance.OrganProjectVO">
......
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