Commit 089f0e4d authored by zhangwanglin's avatar zhangwanglin

结算及修复系统问题

parent 548a79c3
......@@ -38,9 +38,9 @@ public class AccountController {
*/
@PostMapping("/addOrUpdateAccount")
public Result addOrUpdateAccount(AccountOperVo accountOperVo) {
if (null == accountOperVo.getSrvOrganId() || null == accountOperVo.getAccountsTime() || StringUtils.isBlank(accountOperVo.getTotalExpensesPayable()) || null == accountOperVo.getAccountsStatus()) {
/* if (null == accountOperVo.getSrvOrganId() || null == accountOperVo.getAccountsTime() || StringUtils.isBlank(accountOperVo.getTotalExpensesPayable()) || null == accountOperVo.getAccountsStatus()) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
}*/
Long accountsId = accountOperVo.getAccountsId();
Date accountsTime = accountOperVo.getAccountsTime();
Long srvOrganId = accountOperVo.getSrvOrganId();
......@@ -110,7 +110,7 @@ public class AccountController {
@GetMapping("/getOtherPlace")
public Result organAccountTaskExecute(String programId){
public Result otherPlaceHandler(String programId){
accountService.otherPlaceHandler(programId);
return Result.success();
}
......
......@@ -24,7 +24,7 @@ public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAcc
List<AccountExportDetailListResp> searchSrvOrganAccountDetailExport(String accountsId);
List<ChDisabDetailAccounts> queryAccountByCondition(@Param("taskDetailIds") List<String> taskDetailIds,String accountsTime);
List<ChDisabDetailAccounts> queryAccountByCondition(@Param("taskDetailIds") List<String> taskDetailIds);
List<OrganAccountsVO> getOtherPlaceList(String programId);
......
......@@ -475,10 +475,12 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
public void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS) {
List<String> collect = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).collect(Collectors.toList());
List<String> taskDetailIdList = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).collect(Collectors.toList());
// 已完成
List<ChSrvTaskFinishItem> chSrvTaskFinishItems = chSrvTaskFinishItemMapper.selectList(new LambdaQueryWrapper<ChSrvTaskFinishItem>()
.in(ChSrvTaskFinishItem::getTaskDetailId, collect));
.in(ChSrvTaskFinishItem::getTaskDetailId, taskDetailIdList));
for (AccountTaskExecuteReqVO accountTaskExecuteReqVO : accountTaskExecuteReqVOS) {
// 一个任务下只要有一条服务完成就产生结算,多个服务完成算一条服务的结算(实际上结算详情有一条记录就产生结算费用)
List<ChSrvTaskFinishItem> chSrvTaskFinishItemStream = chSrvTaskFinishItems.stream().filter(s -> s.getItemId().equals(Long.valueOf(accountTaskExecuteReqVO.getItemId()))).collect(Collectors.toList());
String planId = accountTaskExecuteReqVO.getPlanId();
Integer integer = chSrvTaskDetailMapper.updateSrvPlanById(planId);
......@@ -495,11 +497,9 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chSrvTaskDetailMapper.updateById(ca);
}
List<String> taskDetailIds = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).collect(Collectors.toList());
// 查询任务已经完成的记录 插入结算详情,一个任务下只要有一条服务完成就产生结算,多个服务完成算一条服务的结算(实际上结算详情有一条记录就产生结算费用)
// 根据机构,服务方式和时间查找结算表是否有数据,有数据进行累加
List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOrganAccountsList(taskDetailIds,"4");
// 根据机构,服务方式和时间查找结算表是否有数据,有数据进行累加
List<ChDisabDetailAccounts> chDisabDetailList = chDisabAccountsDetailMapper.queryAccountByCondition(taskDetailIds,DateUtils.dateToStrYm(new Date()));
List<ChDisabDetailAccounts> chDisabDetailList = chDisabAccountsDetailMapper.queryAccountByCondition(taskDetailIds);
// 详情表还没有对应的任务数据说明还未发生过结算,进行插入详情表和结算表
if(CollectionUtil.isEmpty(chDisabDetailList)){
for (OrganAccountsVO accountsVO : accountsList) {
......@@ -528,7 +528,8 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsPersonalCost(personalCost);
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(new Date());
//结算时间为任务时间
chDisabDetailAccounts.setAccountsTime(DateUtils.strToTime(accountsVO.getSrvDate()));
chDisabDetailAccounts.setAccountsStartTime(DateUtils.strToTime(accountsVO.getSrvStartTime()));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.strToTime(accountsVO.getSrvEndTime()));
chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
......@@ -551,11 +552,11 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private ChDisabAccounts getChDisabAccounts(OrganAccountsVO accountsVO, BigDecimal limit, BigDecimal overallCost, BigDecimal personalCost) {
// 结算表 根据机构和结算时间 服务方式
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(new Date()), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId());
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(accountsVO.getSrvDate())), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId());
if(chDisabAccounts == null) {
chDisabAccounts = new ChDisabAccounts();
chDisabAccounts.setModeName(accountsVO.getSrvModeName());
chDisabAccounts.setAccountsTime(new Date());
chDisabAccounts.setAccountsTime(DateUtils.strToTime(accountsVO.getSrvDate()));
chDisabAccounts.setSrvOrganId(Long.valueOf(accountsVO.getSrvOrganId()));
chDisabAccounts.setCreationTime(new Date());
chDisabAccounts.setAccountsStatus((short) 1);
......
......@@ -65,7 +65,6 @@
<select id="queryAccountByCondition" resultType="com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts">
select * from CH_DISAB_ACCOUNTS_DETAIL t where t.MODE_NAME in ('养老','医疗')
and to_char(t.ACCOUNTS_TIME,'yyyy-MM') = #{accountsTime}
<if test="taskDetailIds != null and taskDetailIds.size() > 0">
AND t.TASK_DETAIL_ID IN
<foreach collection="taskDetailIds" separator="," open="(" close=")" item="taskDetailId">
......@@ -118,8 +117,10 @@
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
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
......
......@@ -16,7 +16,7 @@ import java.util.List;
@Repository
public interface ChAssessAccountsMapper extends BaseMapper<ChAssessAccounts> {
AssessIdAndCostVO queryAssessByOrganIdAndTime(String aprOrganId, String accountsTime);
AssessIdAndCostVO queryAssessByOrganIdAndTime(String aprOrganId, String accountsTime, String modeId);
Page<AssessAccountsListResp> searchAssessAccountList(Page page, List<Long> organIds, SrvOrganListReq req);
......
......@@ -15,6 +15,7 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.assessment.*;
import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp;
import com.hungraim.ltc.pojo.vo.assessment.*;
......@@ -205,50 +206,35 @@ public class TaskServiceImpl implements TaskService {
@Override
public void assessAccount(ReportDetailVO reportDetailVo){
Integer disableLevelId = reportDetailVo.getDisableLevelId();
if(disableLevelId==1||disableLevelId ==2 ){
return;
}
Integer person1 = reportDetailVo.getPerson1();
Integer person2 = reportDetailVo.getPerson2();
Integer person3 = reportDetailVo.getPerson3();
String evaluateTime = reportDetailVo.getEvaluateTime();
Date evaluateDate = DateUtils.strToDate(evaluateTime);
List<ChDisableInfo> chDisableInfos = disableInfoMapper.selectList(new LambdaQueryWrapper<ChDisableInfo>().eq(ChDisableInfo::getApplyId, reportDetailVo.getApplyId()));
Integer srvModeId = chDisableInfos.get(0).getSrvModeId();
// 根据评定机构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));
chAssessDetailAccounts.setAccountsTime(evaluateDate);
chAssessDetailAccounts.setAssessTime(evaluateDate);
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);
}
Long assessAccountsId = saveAssess(aprOrganId, assessCost,srvModeId,evaluateDate);
chAssessDetailAccounts.setAssessAccountsId(assessAccountsId);
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts);
}
......@@ -260,33 +246,43 @@ public class TaskServiceImpl implements TaskService {
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));
chAssessDetailAccounts.setAccountsTime(evaluateDate);
chAssessDetailAccounts.setAssessTime(evaluateDate);
Integer aprempTypeIdS = chAprEmp.getAprempTypeIdS();
// 1 评估员上门评估,每人次 100 元
// 5 评估专家上门评估,每人次 150 元
String assessCost = aprempTypeIdS==1? "100":"150";
chAssessDetailAccounts.setAssessCost(assessCost);
Long assessAccountsId = saveAssess(aprOrganId, assessCost,srvModeId,evaluateDate);
chAssessDetailAccounts.setAssessAccountsId(assessAccountsId);
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts);
}
}
private Long saveAssess(Integer aprOrganId, String assessCost,Integer modeId,Date evaluateDate) {
Long assessAccountsId;
AssessIdAndCostVO assessIdAndCostVO = chAssessAccountsMapper.queryAssessByOrganIdAndTime(String.valueOf(aprOrganId), DateUtils.dateToStrYm(evaluateDate),String.valueOf(modeId));
if (assessIdAndCostVO == null) {
ChAssessAccounts chAssessAccounts = new ChAssessAccounts();
chAssessAccounts.setAccountsTime(evaluateDate);
chAssessAccounts.setAprOrganId(Long.valueOf(aprOrganId));
chAssessAccounts.setCreationTime(new Date());
chAssessAccounts.setAccountsStatus((short)1);
chAssessAccounts.setModeId(modeId);
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);
}
return assessAccountsId;
}
@Override
......
......@@ -6,6 +6,7 @@
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}
and a.MODE_ID = #{modeId}
</select>
......@@ -13,6 +14,8 @@
SELECT
t1.ASSESS_ACCOUNTS_ID,
t2.ORGAN_ID,
t1.MODE_ID,
mode1.mode_name modeName,
t2.ORGAN_NAME,
t1.ACCOUNTS_TIME,
t1.ACCOUNTS_STATUS,
......@@ -21,6 +24,7 @@
CH_ASSESS_ACCOUNTS t1
LEFT JOIN CH_APR_ORGAN t2 ON t1.APR_ORGAN_ID = t2.APR_ORGAN_ID
LEFT JOIN CH_FND_ORGAN t3 ON t2.ORGAN_ID = t3.ORGAN_ID
left join ch_cfg_srv_mode mode1 on t1.mode_id = mode1.mode_id
<where>
<if test='req.accountsTime != null'>
AND t1.ACCOUNTS_TIME = #{req.accountsTime}
......
......@@ -70,7 +70,7 @@ public class ChAssessAccounts implements Serializable {
private BigDecimal assessAllCost;
private Integer modeId;
private static final long serialVersionUID = 1L;
......
......@@ -12,4 +12,6 @@ public class AccountTaskExecuteReqVO {
private String itemId;
private String srvDate;
}
......@@ -25,7 +25,9 @@ public class AssessAccountsListResp {
private String organName;
private String modeName;
private String modeId;
/**
* 结算月份
......
......@@ -15,6 +15,9 @@ public class SrvOrganAccountListResp {
*/
private Long accountsId;
private String modeName;
/**
* 适用机构id
*/
......@@ -73,7 +76,10 @@ public class SrvOrganAccountListResp {
*/
private String svrEndTime;
/**
* 实拨总费用
*/
private String totalAllocatedExpenses;
}
......@@ -134,6 +134,7 @@ public class SrvTaskController {
e.printStackTrace();
return Result.failed(e.getMessage());
}
srvTaskService.otherPlaceHandler(param.getProgramId());
return Result.success();
}
......
......@@ -143,9 +143,6 @@ public class SrvTaskServiceImpl implements SrvTaskService {
Long newSrvTaskId = chSrvTask.getSrvTaskId();
this.insertTaskDetail(newSrvTaskId, taskDetails);
saveSrvPlan(programId);
// 异地结算
otherPlaceHandler(programId);
//添加附件
// this.updateAttachs(srvTaskInfoVO.getListAttach(), chSrvTask.getSrvTaskId());
} else {
......@@ -168,10 +165,8 @@ public class SrvTaskServiceImpl implements SrvTaskService {
// mode_id 4
@Override
public void otherPlaceHandler(String programId){
public void otherPlaceHandler(String programId){
accountFeignService.getOtherPlace(programId);
}
/**
......
......@@ -42,8 +42,9 @@
LEFT JOIN ch_srv_send s ON s.disab_info_id = i.disab_info_id
LEFT JOIN ch_fnd_organ o ON i.organ_id = o.organ_id
LEFT JOIN CH_APR_TASK t ON i.disab_info_id = t.DISABLE_INFO_ID
left join ch_apr_report report on t.task_id = report.task_id
<where>
t.TASK_STATUS = 3
t.TASK_STATUS = 3 and report.DISABLE_LEVEL_ID in ('3','4','5')
<if test="chSrvOrgan.organId != null and chSrvOrgan.organId != ''">
AND o.organ_id = #{chSrvOrgan.organId}
</if>
......
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