Commit 7a705b27 authored by zhangwanglin's avatar zhangwanglin

Merge branch 'dev_nursing_records_20230214' into dev_ch_master

parents 4bcf4c27 0b8de90a
......@@ -202,7 +202,8 @@ public class AccountController {
*/
@GetMapping("/queryAccountsDeclareList")
public Result<Page<ChDisabDetailAccountsResp>> queryAccountsDeclareList(Integer pageNum, Integer pageSize,SrvOrganListReq srvOrganListReq) {
srvOrganListReq.setAccountsStatus("0");
List<String> accountsStatusList = Arrays.asList("0", "1");
srvOrganListReq.setAccountsStatusList(accountsStatusList);
Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,srvOrganListReq);
return Result.success(chAssessDetailAccounts);
}
......@@ -298,11 +299,11 @@ public class AccountController {
* @param accountsDetailId 结算详情id
*/
@DeleteMapping("/deleteAccountsDetail")
public Result deleteAccountsDetail(Long accountsDetailId) {
public Result deleteAccountsDetail(Long accountsDetailId,Long freeRdId) {
if (null == accountsDetailId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
int result = accountService.deleteAccountsDetail(accountsDetailId);
int result = accountService.deleteAccountsDetail(accountsDetailId,freeRdId);
if(result > 0){
return Result.success();
}else{
......@@ -312,7 +313,8 @@ public class AccountController {
@GetMapping("/queryOverallCostList")
public Result<Page<OverallCostListRespVO>> queryOverallCostList(OverallCostReqVO req) {
Page<OverallCostListRespVO> overallCostRecords = accountService.queryOverallCostList(req);
// Page<OverallCostListRespVO> overallCostRecords = accountService.queryOverallCostList(req);
Page<OverallCostListRespVO> overallCostRecords = accountService.queryFreeRdInfo(req);
return Result.success(overallCostRecords);
}
......
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.ChDisabFreeRdInfo;
import com.hungraim.ltc.pojo.entity.account.OverallCostListRespVO;
import com.hungraim.ltc.pojo.entity.account.OverallCostReqVO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author zwl
* @ClassName ChDisabFreeRdInfoMapper
* @description
* @date 2023/2/27 20:59
**/
@Repository
@Mapper
public interface ChDisabFreeRdInfoMapper extends BaseMapper<ChDisabFreeRdInfo> {
Page<OverallCostListRespVO> queryFreeRdInfo(Page page, OverallCostReqVO req);
}
......@@ -39,6 +39,8 @@ public interface AccountService extends IService<ChDisabAccounts> {
Page<OverallCostListRespVO> queryOverallCostList(OverallCostReqVO req);
Page<OverallCostListRespVO> queryFreeRdInfo(OverallCostReqVO req);
int overallCostSubmit(OverallCostSubmitReqVO req);
int updateChDisabAccounts(int id);
......@@ -48,7 +50,7 @@ public interface AccountService extends IService<ChDisabAccounts> {
void otherPlaceHandler(String programId);
int deleteAccountsDetail(Long accountsDetailId);
int deleteAccountsDetail(Long accountsDetailId,Long freeRdId);
int accountsFreeCommit(Long accountsDetailId);
......
......@@ -50,6 +50,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private final ChCfgCareServiceMapper chCfgCareServiceMapper;
private final ChCfgCostStandardMapper chCfgCostStandardMapper;
private final ChDisabAccountsDetailMapper chDisabAccountsDetailMapper;
private final ChDisabFreeRdInfoMapper chDisabFreeRdInfoMapper;
......@@ -75,6 +76,9 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccounts.setPersonalCost(BigDecimal.valueOf(0));
chDisabAccounts.setReissueAmountTotal(BigDecimal.valueOf(0));
chDisabAccounts.setDeductionAmountTotal(BigDecimal.valueOf(0));
HashMap map = new HashMap();
map.put("ACCOUNTS_ID",accountsId);
chDisabFreeRdInfoMapper.deleteByMap(map);
}
//待审核
if(accountsStatus == 1) {
......@@ -492,12 +496,23 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
}
@Override
public Page<OverallCostListRespVO> queryFreeRdInfo(OverallCostReqVO req) {
req.setDealType((null == req.getDealType() || 0 == req.getDealType()) ? null : req.getDealType());
Page<OverallCostListRespVO> overallCostListRespVOPage = chDisabFreeRdInfoMapper.queryFreeRdInfo(new Page<>(req.getPageNum(), req.getPageSize()), req);
return overallCostListRespVOPage;
}
@Override
public int overallCostSubmit(OverallCostSubmitReqVO req){
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
int dealType = req.getDealType();
chDisabDetailAccounts.setAccountsDetailId(req.getAccountsDetailId());
Long accountsDetailId = req.getAccountsDetailId();
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
Long accountsId = req.getAccountsId();
ChDisabAccounts chDisabAccounts = disabAccountsMapper.selectById(accountsId);
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.selectById(accountsDetailId);
BigDecimal deductionAmount = chDisabDetailAccountsDTO.getDeductionAmount();
BigDecimal reissueAmount = chDisabDetailAccountsDTO.getReissueAmount();
BigDecimal deductionAmountTotal = chDisabAccounts.getDeductionAmountTotal();
BigDecimal reissueAmountTotal = chDisabAccounts.getReissueAmountTotal();
chDisabDetailAccounts.setDealType(dealType);
......@@ -505,11 +520,11 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
BigDecimal amountOfMoney = new BigDecimal(amountOfMoneyStr);
if(dealType == 1){
// 补发
chDisabDetailAccounts.setReissueAmount(amountOfMoney);
chDisabDetailAccounts.setReissueAmount(reissueAmount.add(amountOfMoney));
reissueAmountTotal = reissueAmountTotal.add(amountOfMoney);
}else if(dealType == 2){
// 扣减
chDisabDetailAccounts.setDeductionAmount(amountOfMoney);
chDisabDetailAccounts.setDeductionAmount(deductionAmount.add(amountOfMoney));
deductionAmountTotal = deductionAmountTotal.add(amountOfMoney);
}
chDisabDetailAccounts.setRemarks(req.getRemarks());
......@@ -517,6 +532,13 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccounts.setReissueAmountTotal(reissueAmountTotal);
chDisabAccounts.setDeductionAmountTotal(deductionAmountTotal);
disabAccountsMapper.updateById(chDisabAccounts);
ChDisabFreeRdInfo chDisabFreeRdInfo = new ChDisabFreeRdInfo();
chDisabFreeRdInfo.setDealType(dealType);
chDisabFreeRdInfo.setAmountOfMoney(amountOfMoney);
chDisabFreeRdInfo.setAccountsDetailId(accountsDetailId);
chDisabFreeRdInfo.setAccountsId(accountsId);
chDisabFreeRdInfo.setCreationTime(new Date());
chDisabFreeRdInfoMapper.insert(chDisabFreeRdInfo);
return result;
}
......@@ -682,13 +704,33 @@ 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);
public int deleteAccountsDetail(Long accountsDetailId,Long freeRdId){
ChDisabFreeRdInfo chDisabFreeRdInfo = chDisabFreeRdInfoMapper.selectById(freeRdId);
BigDecimal amountOfMoney = chDisabFreeRdInfo.getAmountOfMoney();
int freeDealType = chDisabFreeRdInfo.getDealType();
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.selectById(accountsDetailId);
BigDecimal deductionAmount = chDisabDetailAccountsDTO.getDeductionAmount();
BigDecimal reissueAmount = chDisabDetailAccountsDTO.getReissueAmount();
Long accountsId = chDisabDetailAccountsDTO.getAccountsId();
ChDisabAccounts chDisabAccountDTO = disabAccountsMapper.selectById(accountsId);
BigDecimal reissueAmountTotal = chDisabAccountDTO.getReissueAmountTotal();
BigDecimal deductionAmountTotal = chDisabAccountDTO.getDeductionAmountTotal();
if (freeDealType == 1) {
// 删除减掉补发
BigDecimal reissueAmountSubtract = reissueAmountTotal.subtract(amountOfMoney);
chDisabAccountDTO.setReissueAmountTotal(reissueAmountSubtract);
BigDecimal subtract = reissueAmount.subtract(amountOfMoney);
chDisabDetailAccountsDTO.setReissueAmount(subtract);
} else if (freeDealType == 2) {
// 删除减掉扣减
BigDecimal deductionAmountSubtract = deductionAmountTotal.subtract(amountOfMoney);
chDisabAccountDTO.setDeductionAmountTotal(deductionAmountSubtract);
BigDecimal subtract = deductionAmount.subtract(amountOfMoney);
chDisabDetailAccountsDTO.setDeductionAmount(subtract);
}
disabAccountsMapper.updateById(chDisabAccountDTO);
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccountsDTO);
chDisabFreeRdInfoMapper.deleteById(freeRdId);
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.ChDisabFreeRdInfoMapper">
<select id="queryFreeRdInfo" resultType="com.hungraim.ltc.pojo.entity.account.OverallCostListRespVO">
select
info.REAL_NAME realName,
info.CERTI_CODE certiCode,
(select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea,
detail.ACCOUNTS_DETAIL_ID accountsDetailId,
detail.ACCOUNTS_START_TIME svrStartTime,
detail.ACCOUNTS_END_TIME svrEndTime,
rd.DEAL_TYPE dealType,
organ.SRV_ORGAN_NAME srvOrganName,
rd.AMOUNT_OF_MONEY amountOfMoney,
rd.FREE_RD_ID freeRdId,
d.ACCOUNTS_STATUS accountsStatus
from CH_DISAB_FREE_RD_INFO rd left join
CH_DISAB_ACCOUNTS_DETAIL detail on
rd.ACCOUNTS_DETAIL_ID = detail.ACCOUNTS_DETAIL_ID
left join CH_DISAB_ACCOUNTS d on d.ACCOUNTS_ID = detail.ACCOUNTS_ID
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 rd.DEAL_TYPE = #{req.dealType}
</if>
</where>
order by rd.CREATION_TIME desc
</select>
</mapper>
\ No newline at end of file
......@@ -493,7 +493,7 @@ public class DisableController {
}
/**
* 失能人员信息列表
* 失能人员信息退出列表
*
* @param pageNum 当前页
......@@ -513,6 +513,10 @@ public class DisableController {
return Result.success(page);
}
/**
* 失能人员退出
*/
@RequestMapping("/disableInfoExit")
public Result disableInfoExit(Integer disableInfoId,Integer exitReasonId,Integer applyId, Integer srvOrganId,Integer programId,String exitTime) {
if (disableInfoId == null|| exitReasonId == null||applyId == null) {
......
package com.hungraim.ltc.pojo.entity.account;
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 lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author zwl
* @ClassName ChDisabFreeRdInfo
* @description
* @date 2023/2/28 8:43
**/
@Data
@TableName("CH_DISAB_FREE_RD_INFO")
@KeySequence("SEQ_CH_DISAB_FREE_RD_INFO")
public class ChDisabFreeRdInfo implements Serializable {
@TableId(value = "FREE_RD_ID", type = IdType.INPUT)
private Long freeRdId;
private Long accountsDetailId;
private Long accountsId;
private Date creationTime;
private int dealType;
private BigDecimal amountOfMoney;
private String remarks;
}
......@@ -17,6 +17,8 @@ public class OverallCostListRespVO {
*/
private String realName;
private Long freeRdId;
/**
*身份证号
......@@ -61,4 +63,6 @@ public class OverallCostListRespVO {
private String accountsOverallCost;
private String srvOrganName;
private String accountsStatus;
}
......@@ -8,6 +8,7 @@ import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class DateUtils {
......@@ -916,4 +917,17 @@ public class DateUtils {
return false;
}
public static String getNextDay(){
Date date=new Date();//取时间
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
// 1表示明天,-1表示昨天
calendar.add(Calendar.DATE,1);
date=calendar.getTime();
// 这个时间就是明天
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(date);
return dateString;
}
}
package com.hungraim.ltc.api;
import com.hungraim.ltc.util.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @author zwl
* @ClassName SrvTaskFeignService
* @description
* @date 2023/2/27 15:11
**/
@FeignClient("LTC-GOVERNANCE-SERVICE")
public interface SrvTaskFeignService {
@GetMapping("/api.governance/srvTask/timeAllocationSrvTask")
Result timeAllocationSrvTask();
}
......@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
......
package com.hungraim.ltc.governance.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -17,7 +15,6 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskFinishItem;
import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.util.AttachType;
......@@ -144,6 +141,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvTask.setDisabInfoId(Long.parseLong(disabInfoId)); // 失能人员id
chSrvTask.setSrvEmpId(Long.parseLong(srvTaskInfoVO.getSrvEmpId()));//服务人员id
chSrvTask.setStatus((short) 1);//状态 未分配:0;已分配:1;已终止2
chSrvTask.setSrvDate(DateUtils.strToDate(taskDetails.get(0)));
srvTaskMapper.insert(chSrvTask);
//添加服务计划详情
Long newSrvTaskId = chSrvTask.getSrvTaskId();
......@@ -212,15 +210,16 @@ public class SrvTaskServiceImpl implements SrvTaskService {
// 生成计划任务 CH_SRV_TASK_DETAIL
for (AllocationSrvTaskVO chSrvTask : chSrvTasks) {
Long srvTaskId = chSrvTask.getSrvTaskId();
// 根据任务id和服务时间查询是否已经生成过计划,已经生成了就不需要再生成了
List<ChSrvTaskDetail> chSrvTaskDetailList = chSrvTaskDetailMapper.selectList(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", srvTaskId));
if(CollectionUtil.isNotEmpty(chSrvTaskDetailList)){
String nextDay = DateUtils.getNextDay();
// 根据任务id和服务时间查询是否已经生成过计划,已经生成了就不需要再生成了,已退出
int chSrvTaskDetailCount = chSrvTaskDetailMapper
.getSrvTaskDetail(String.valueOf(srvTaskId), nextDay);
if (chSrvTaskDetailCount > 0) {
return;
}
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
chSrvTaskDetail.setSrvTaskId(srvTaskId);//taskId
chSrvTaskDetail.setSrvDate(new Date());//服务开始时间
chSrvTaskDetail.setSrvDate(DateUtils.strToDate(nextDay));//服务开始时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetailMapper.insert(chSrvTaskDetail);
}
......
......@@ -57,7 +57,8 @@
ILLEGALRE_NAME, ILLEGALRE_TIME, ACCOUNT_SIGN, TASK_DETAIL_TYPE
</sql>
<select id="getSrvTaskDetail">
select count(*) from CH_SRV_TASK_DETAIL t where t.SRV_TASK_ID = #{srvTaskId} and to_char(t.SRV_DATE) = #{srvDate}
<select id="getSrvTaskDetail" resultType="java.lang.Integer">
select count(0) from CH_SRV_TASK_DETAIL t where t.SRV_TASK_ID = #{srvTaskId}
and to_char(t.SRV_DATE,'yyyy-MM-dd') = #{srvDate}
</select>
</mapper>
\ No newline at end of file
......@@ -214,9 +214,10 @@
</where>
</select>
<select id="getAllocationSrvTask" resultType="com.hungraim.ltc.pojo.vo.governance.AllocationSrvTaskVO">
select t.SRV_TASK_ID,t.SRV_DATE,sysdate,info.EXIT_TIME,info.EXIT_FLAG,info.EXIT_REASON_ID from CH_SRV_TASK t
select t.SRV_TASK_ID,t.SRV_DATE,info.EXIT_TIME,info.EXIT_FLAG,info.EXIT_REASON_ID from CH_SRV_TASK t
left join CH_DISABLE_INFO info on t.DISAB_INFO_ID = info.DISAB_INFO_ID
where t.STATUS =1 and info.DISAB_INFO_ID = '327' and sysdate > t.SRV_DATE
where t.SRV_DATE <![CDATA[ < ]]> sysdate and
(info.EXIT_TIME <![CDATA[ > ]]> sysdate or info.EXIT_TIME is null)
</select>
</mapper>
\ No newline at end of file
......@@ -65,6 +65,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.hungraim.ltc</groupId>
<artifactId>governance</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
......
package com.hungraim.ltc.system.Scheduled;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.api.SrvTaskFeignService;
import com.hungraim.ltc.util.Result;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* @author zwl
* @ClassName SrvTaskScheduledController
* @description
* @date 2023/2/27 15:23
**/
@Component
@AllArgsConstructor
public class SrvTaskScheduledController {
private final SrvTaskFeignService srvTaskFeignService;
// 表示每天3点5分执行
@Scheduled(cron = "30 32 19 * * ?")
public void timeAllocationSrvTask() {
Result result = srvTaskFeignService.timeAllocationSrvTask();
System.out.println();
}
}
spring:
main:
#允许存在多个Feign调用相同Service的接口
allow-bean-definition-overriding: true
devtools:
restart:
enabled: true
......
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