Commit ae1da1de authored by zengxiaoli@yeah.net's avatar zengxiaoli@yeah.net

Merge remote-tracking branch 'origin/uat_ch_master' into dev_20230322_护理机构人员审核_zxl

parents 821ce0f6 afc08e18
...@@ -8,6 +8,7 @@ import com.hungraim.ltc.pojo.vo.account.*; ...@@ -8,6 +8,7 @@ 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;
import com.hungraim.ltc.util.ResultCode; import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
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;
...@@ -129,7 +130,11 @@ public class AccountController { ...@@ -129,7 +130,11 @@ public class AccountController {
* @return 返回 * @return 返回
*/ */
@GetMapping("/getSrvTaskList") @GetMapping("/getSrvTaskList")
public Result<Page<SrvTaskRespVO>> getSrvTaskList(SrvTaskReqVO srvTaskReqVO) { public Result<Page<SrvTaskRespVO>> getSrvTaskList(@RequestHeader("Authorization") String token,SrvTaskReqVO srvTaskReqVO) {
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if(srvOrganId != 0) {
srvTaskReqVO.setSrvOrganId(srvOrganId);
}
return Result.success(accountService.getSrvTaskList(srvTaskReqVO)); return Result.success(accountService.getSrvTaskList(srvTaskReqVO));
} }
...@@ -141,9 +146,13 @@ public class AccountController { ...@@ -141,9 +146,13 @@ public class AccountController {
* @return 返回 * @return 返回
*/ */
@GetMapping("/searchSrvOrganAccountList") @GetMapping("/searchSrvOrganAccountList")
public Result<Page<SrvOrganAccountListResp>> searchSrvOrganAccountList(SrvOrganListReq srvOrganListReq) { public Result<Page<SrvOrganAccountListResp>> searchSrvOrganAccountList(@RequestHeader("Authorization") String token, SrvOrganListReq srvOrganListReq) {
List<String> list = Arrays.asList("1"); List<String> list = Arrays.asList("1");
srvOrganListReq.setAccountsStatusList(list); srvOrganListReq.setAccountsStatusList(list);
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if(srvOrganId != 0) {
srvOrganListReq.setSrvOrganId(srvOrganId);
}
return Result.success(accountService.searchSrvOrganAccountList(srvOrganListReq)); return Result.success(accountService.searchSrvOrganAccountList(srvOrganListReq));
} }
...@@ -154,9 +163,13 @@ public class AccountController { ...@@ -154,9 +163,13 @@ public class AccountController {
* @return 返回 * @return 返回
*/ */
@GetMapping("/searchSrvOrganReviewList") @GetMapping("/searchSrvOrganReviewList")
public Result<Page<SrvOrganAccountListResp>> searchSrvOrganReviewList(SrvOrganListReq srvOrganListReq) { public Result<Page<SrvOrganAccountListResp>> searchSrvOrganReviewList(@RequestHeader("Authorization") String token, SrvOrganListReq srvOrganListReq) {
List<String> list = Arrays.asList("2", "3","4"); List<String> list = Arrays.asList("2", "3","4");
srvOrganListReq.setAccountsStatusList(list); srvOrganListReq.setAccountsStatusList(list);
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if(srvOrganId != 0) {
srvOrganListReq.setSrvOrganId(srvOrganId);
}
return Result.success(accountService.searchSrvOrganAccountList(srvOrganListReq)); return Result.success(accountService.searchSrvOrganAccountList(srvOrganListReq));
} }
...@@ -203,9 +216,13 @@ public class AccountController { ...@@ -203,9 +216,13 @@ public class AccountController {
* @return * @return
*/ */
@GetMapping("/queryAccountsDeclareList") @GetMapping("/queryAccountsDeclareList")
public Result<Page<ChDisabDetailAccountsResp>> queryAccountsDeclareList(Integer pageNum, Integer pageSize,SrvOrganListReq srvOrganListReq) { public Result<Page<ChDisabDetailAccountsResp>> queryAccountsDeclareList(@RequestHeader("Authorization") String token,Integer pageNum, Integer pageSize,SrvOrganListReq srvOrganListReq) {
List<String> accountsStatusList = Arrays.asList("0", "1"); List<String> accountsStatusList = Arrays.asList("0", "1");
srvOrganListReq.setAccountsStatusList(accountsStatusList); srvOrganListReq.setAccountsStatusList(accountsStatusList);
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if(srvOrganId !=0) {
srvOrganListReq.setSrvOrganId(srvOrganId);
}
Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,srvOrganListReq); Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,srvOrganListReq);
return Result.success(chAssessDetailAccounts); return Result.success(chAssessDetailAccounts);
} }
...@@ -216,9 +233,13 @@ public class AccountController { ...@@ -216,9 +233,13 @@ public class AccountController {
* @return * @return
*/ */
@GetMapping("/queryDelayAccountList") @GetMapping("/queryDelayAccountList")
public Result<Page<ChDisabDetailAccountsResp>> queryDelayAccountList(Integer pageNum, Integer pageSize,SrvOrganListReq srvOrganListReq) { public Result<Page<ChDisabDetailAccountsResp>> queryDelayAccountList(@RequestHeader("Authorization") String token,Integer pageNum, Integer pageSize,SrvOrganListReq srvOrganListReq) {
List<String> list = Arrays.asList("1", "2"); List<String> list = Arrays.asList("1", "2");
srvOrganListReq.setAccountsStatusList(list); srvOrganListReq.setAccountsStatusList(list);
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if(srvOrganId != 0) {
srvOrganListReq.setSrvOrganId(srvOrganId);
}
Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,srvOrganListReq); Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,srvOrganListReq);
return Result.success(chAssessDetailAccounts); return Result.success(chAssessDetailAccounts);
} }
...@@ -320,7 +341,11 @@ public class AccountController { ...@@ -320,7 +341,11 @@ public class AccountController {
} }
@GetMapping("/queryOverallCostList") @GetMapping("/queryOverallCostList")
public Result<Page<OverallCostListRespVO>> queryOverallCostList(OverallCostReqVO req) { public Result<Page<OverallCostListRespVO>> queryOverallCostList(@RequestHeader("Authorization") String token,OverallCostReqVO req) {
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if(srvOrganId != 0) {
req.setSrvOrganId(srvOrganId);
}
Page<OverallCostListRespVO> overallCostRecords = accountService.queryFreeRdInfo(req); Page<OverallCostListRespVO> overallCostRecords = accountService.queryFreeRdInfo(req);
return Result.success(overallCostRecords); return Result.success(overallCostRecords);
} }
......
...@@ -17,12 +17,8 @@ import java.util.List; ...@@ -17,12 +17,8 @@ import java.util.List;
@Repository @Repository
public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAccounts> { public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAccounts> {
List<OrganAccountsVO> getOrganAccountsList(String taskDetailId);
List<AccountExportDetailListResp> searchSrvOrganAccountDetailExport(SrvOrganListReq req); List<AccountExportDetailListResp> searchSrvOrganAccountDetailExport(SrvOrganListReq req);
List<ChDisabDetailAccounts> queryAccountByCondition(@Param("taskDetailIds") List<String> taskDetailIds);
List<OrganAccountsVO> getOtherPlaceList(String programId); List<OrganAccountsVO> getOtherPlaceList(String programId);
...@@ -30,6 +26,8 @@ public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAcc ...@@ -30,6 +26,8 @@ public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAcc
Page<NursingRecordsRespVO> queryNursingRecords(Page page, NursingReqVO req); Page<NursingRecordsRespVO> queryNursingRecords(Page page, NursingReqVO req);
Page<NursingRecordsRespVO> queryNursingRecordsGoDoor(Page page, NursingReqVO req);
OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req); OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req);
......
...@@ -47,7 +47,6 @@ public interface AccountService extends IService<ChDisabAccounts> { ...@@ -47,7 +47,6 @@ public interface AccountService extends IService<ChDisabAccounts> {
int updateChDisabAccounts(int id); int updateChDisabAccounts(int id);
Result organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS);
Result accountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS); Result accountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS);
......
...@@ -17,7 +17,6 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCostStandard; ...@@ -17,7 +17,6 @@ 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.*;
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;
...@@ -476,18 +475,14 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -476,18 +475,14 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override @Override
public Page<NursingRecordsRespVO> queryNursingRecords(NursingReqVO nursingReqVO) { public Page<NursingRecordsRespVO> queryNursingRecords(NursingReqVO nursingReqVO) {
String modeName = nursingReqVO.getModeName(); String modeName = nursingReqVO.getModeName();
String modeId = ""; Page<NursingRecordsRespVO> nursingRecordsRespVOPage = null;
if("医疗".equals(modeName)){ if("上门".equals(modeName)){
modeId = "1"; nursingRecordsRespVOPage = chDisabAccountsDetailMapper.queryNursingRecordsGoDoor(new Page<>(nursingReqVO.getPageNum(), nursingReqVO.getPageSize()), nursingReqVO);
}else if("养老".equals(modeName)) { }else {
modeId = "2"; nursingReqVO.setModeId("医疗".equals(modeName) ? "1" : "2");
}else if ("上门".equals(modeName)){ nursingRecordsRespVOPage = chDisabAccountsDetailMapper.queryNursingRecords(new Page<>(nursingReqVO.getPageNum(), nursingReqVO.getPageSize()), nursingReqVO);
modeId = "3";
}else if ("异地".equals(modeName)){
modeId = "4";
} }
nursingReqVO.setModeId(modeId); return nursingRecordsRespVOPage;
return chDisabAccountsDetailMapper.queryNursingRecords(new Page<>(nursingReqVO.getPageNum(), nursingReqVO.getPageSize()),nursingReqVO);
} }
@Override @Override
...@@ -528,7 +523,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -528,7 +523,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setDeductionAmount(deductionAmount.add(amountOfMoney)); chDisabDetailAccounts.setDeductionAmount(deductionAmount.add(amountOfMoney));
deductionAmountTotal = deductionAmountTotal.add(amountOfMoney); deductionAmountTotal = deductionAmountTotal.add(amountOfMoney);
} }
chDisabDetailAccounts.setRemarks(req.getRemarks());
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts); int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
chDisabAccounts.setReissueAmountTotal(reissueAmountTotal); chDisabAccounts.setReissueAmountTotal(reissueAmountTotal);
chDisabAccounts.setDeductionAmountTotal(deductionAmountTotal); chDisabAccounts.setDeductionAmountTotal(deductionAmountTotal);
...@@ -539,6 +533,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -539,6 +533,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabFreeRdInfo.setAccountsDetailId(accountsDetailId); chDisabFreeRdInfo.setAccountsDetailId(accountsDetailId);
chDisabFreeRdInfo.setAccountsId(accountsId); chDisabFreeRdInfo.setAccountsId(accountsId);
chDisabFreeRdInfo.setCreationTime(new Date()); chDisabFreeRdInfo.setCreationTime(new Date());
chDisabFreeRdInfo.setRemarks(req.getRemarks());
chDisabFreeRdInfoMapper.insert(chDisabFreeRdInfo); chDisabFreeRdInfoMapper.insert(chDisabFreeRdInfo);
return result; return result;
} }
...@@ -660,8 +655,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -660,8 +655,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
String planId = accountsVO.getPlanId(); String planId = accountsVO.getPlanId();
// 更新 // 更新
chDisabAccountsDetailMapper.updateByPlanId(planId); chDisabAccountsDetailMapper.updateByPlanId(planId);
}else { }else {
BigDecimal accountsAllCost = chDisabDetailAccountsDTO.getAccountsAllCost(); BigDecimal accountsAllCost = chDisabDetailAccountsDTO.getAccountsAllCost();
BigDecimal accountsOverallCost = chDisabDetailAccountsDTO.getAccountsOverallCost(); BigDecimal accountsOverallCost = chDisabDetailAccountsDTO.getAccountsOverallCost();
...@@ -675,119 +668,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -675,119 +668,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
} }
@Override
@Transactional(rollbackFor = Exception.class)
public Result organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS) {
log.info("organAccountTaskExecute.accountTaskExecuteReqVOS:{}",accountTaskExecuteReqVOS);
if (CollectionUtil.isEmpty(accountTaskExecuteReqVOS)) {
return Result.failed("参数不能为空");
}
List<String> taskDetailIds = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).distinct().collect(Collectors.toList());
// 根据任务id查找结算详情,还没有对应的任务数据说明还未发生过结算,进行插入详情表和结算表
List<ChDisabDetailAccounts> chDisabDetailList = chDisabAccountsDetailMapper.queryAccountByCondition(taskDetailIds);
// 根据任务id分组,一个任务下会有多个项目,任务id相同
Map<String, List<AccountTaskExecuteReqVO>> accountTaskMap = accountTaskExecuteReqVOS.stream().collect(Collectors.groupingBy(AccountTaskExecuteReqVO::getTaskDetailId));
for(Map.Entry<String, List<AccountTaskExecuteReqVO>> entry:accountTaskMap.entrySet()) {
String taskDetailId = entry.getKey();
// 已完成的任务,一个任务下有服务完成就产生结算,多个服务完成算一条服务的结算(实际上结算详情有一条记录就产生结算费用)
List<ChSrvTaskFinishItem> chSrvTaskFinishItems = chSrvTaskFinishItemMapper.selectList(new LambdaQueryWrapper<ChSrvTaskFinishItem>()
.eq(ChSrvTaskFinishItem::getTaskDetailId, taskDetailId));
List<AccountTaskExecuteReqVO> accountTaskList = entry.getValue();
// 处理具体的服务项目
try {
for (AccountTaskExecuteReqVO accountTaskExecuteReqVO : accountTaskList) {
// 已完成的任务更新ch_srv_plan状态
String planId = accountTaskExecuteReqVO.getPlanId();
Integer integer = chSrvTaskDetailMapper.updateSrvPlanById(planId);
if(integer == 0){
log.info("更新任务计划表失败");
}
if (CollectionUtil.isNotEmpty(chSrvTaskFinishItems)) {
List<ChSrvTaskFinishItem> chSrvTaskFinishItemStream = chSrvTaskFinishItems.stream()
.filter(s -> s.getItemId().equals(Long.valueOf(accountTaskExecuteReqVO.getItemId()))).collect(Collectors.toList());
// 如果存在就不插入了
if (CollectionUtil.isNotEmpty(chSrvTaskFinishItemStream)) {
log.info("chSrvTaskFinishItemStream is totEmpty:{}",chSrvTaskFinishItemStream);
return Result.success();
}
}
ChSrvTaskFinishItem chSrvTaskFinishItem = new ChSrvTaskFinishItem();
chSrvTaskFinishItem.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId()));
chSrvTaskFinishItem.setItemId(Long.valueOf(accountTaskExecuteReqVO.getItemId()));
chSrvTaskFinishItemMapper.insert(chSrvTaskFinishItem);
ChSrvTaskDetail ca = new ChSrvTaskDetail();
ca.setStatus((short) 4);
ca.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId()));
chSrvTaskDetailMapper.updateById(ca);
}
accountSave(taskDetailId, chDisabDetailList);
} catch (Exception e) {
log.info("=====accountSave error:{}",e);
return Result.failed("服务异常");
}
}
return Result.success();
}
private void accountSave(String taskDetailId, List<ChDisabDetailAccounts> chDisabDetailList) {
if (CollectionUtil.isEmpty(chDisabDetailList)) {
List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOrganAccountsList(taskDetailId);
for (OrganAccountsVO accountsVO : accountsList) {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
String srvOrganId = accountsVO.getSrvOrganId();
// 结算时间为任务时间
Date accountsTime = DateUtils.strToDate(accountsVO.getSrvDate());
String disabInfoId = accountsVO.getDisabInfoId();
//要判断是养老还是医疗,因为费用不一样
BigDecimal limit = BigDecimal.valueOf(0);
BigDecimal overallPercent = BigDecimal.valueOf(0.7);
BigDecimal personalPercent = BigDecimal.valueOf(0.3);
String srvModeName = accountsVO.getSrvModeName();
// 养老机构护理,其限额为 50 元/人/天 由长期护理保险基金支付 70% 个人支付 30%
if ("养老".equals(srvModeName)) {
limit = BigDecimal.valueOf(50);
// 医疗机构护理,原则上收治医疗护理需求为主的重度失能人员一级及以下医疗机构其限额为 80 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
} else if ("医疗".equals(srvModeName) && "1".equals(accountsVO.getLevelCode())) {
limit = BigDecimal.valueOf(80);
// 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
} else if ("医疗".equals(srvModeName) && (!"1".equals(accountsVO.getLevelCode()))) {
limit = BigDecimal.valueOf(100);
} else {
break;
}
// 根据护理机构、结算月份、失能人员id和服务方式查询表里是否有值
// ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.queryDisabDetailAccounts(srvOrganId, DateUtils.dateToStrYm(accountsTime), disabInfoId, srvModeName);
chDisabDetailAccounts.setAccountsAllCost(limit);
BigDecimal overallCost = limit.multiply(overallPercent);
chDisabDetailAccounts.setAccountsOverallCost(overallCost);
BigDecimal personalCost = limit.multiply(personalPercent);
chDisabDetailAccounts.setAccountsPersonalCost(personalCost);
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setSrvOrganId(srvOrganId);
chDisabDetailAccounts.setEmpId(accountsVO.getEmpId());
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(accountsTime);
chDisabDetailAccounts.setAccountsStartTime(DateUtils.getFirstDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.getlastDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
// chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setDisabInfoId(disabInfoId);
chDisabDetailAccounts.setStatus((short)0);
chDisabDetailAccounts.setReissueAmount(BigDecimal.valueOf(0));
chDisabDetailAccounts.setDeductionAmount(BigDecimal.valueOf(0));
ChDisabAccounts chDisabAccounts = getChDisabAccounts(accountsVO, limit, overallCost, personalCost);
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
}
}
}
private ChDisabAccounts getChDisabAccounts1(AccountTaskExecuteReqVO accountsVO) { private ChDisabAccounts getChDisabAccounts1(AccountTaskExecuteReqVO accountsVO) {
// 结算表 根据机构和结算时间 服务方式 // 结算表 根据机构和结算时间 服务方式
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(accountsVO.getSrvDate())), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId(),null); ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(accountsVO.getSrvDate())), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId(),null);
...@@ -810,30 +690,9 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -810,30 +690,9 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
} }
private ChDisabAccounts getChDisabAccounts(OrganAccountsVO accountsVO, BigDecimal limit, BigDecimal overallCost, BigDecimal personalCost) {
// 结算表 根据机构和结算时间 服务方式
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(accountsVO.getSrvDate())), accountsVO.getSrvModeName(), accountsVO.getSrvOrganId(),null);
if(chDisabAccounts == null) {
chDisabAccounts = new ChDisabAccounts();
chDisabAccounts.setModeName(accountsVO.getSrvModeName());
chDisabAccounts.setAccountsTime(DateUtils.strToTime(accountsVO.getSrvDate()));
chDisabAccounts.setSrvOrganId(Long.valueOf(accountsVO.getSrvOrganId()));
chDisabAccounts.setCreationTime(new Date());
chDisabAccounts.setAccountsStatus((short) 0);
BigDecimal zero = BigDecimal.valueOf(0);
chDisabAccounts.setAllCost(zero);
chDisabAccounts.setOverallCost(zero);
chDisabAccounts.setPersonalCost(zero);
chDisabAccounts.setReissueAmountTotal(zero);
chDisabAccounts.setDeductionAmountTotal(zero);
disabAccountsMapper.insert(chDisabAccounts);
}
return chDisabAccounts;
}
@Override @Override
public void otherPlaceHandler(String programId){ public void otherPlaceHandler(String programId){
List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOtherPlaceList(programId); /* List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOtherPlaceList(programId);
for (OrganAccountsVO accountsVO : accountsList) { for (OrganAccountsVO accountsVO : accountsList) {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts(); ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId()); chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId());
...@@ -854,10 +713,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -854,10 +713,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId()); chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea()); chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setDisabInfoId(accountsVO.getDisabInfoId()); chDisabDetailAccounts.setDisabInfoId(accountsVO.getDisabInfoId());
ChDisabAccounts chDisabAccounts = getChDisabAccounts(accountsVO, limit, zero, zero); ChDisabAccounts chDisabAccounts = getChDisabAccounts1(accountsVO);
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId()); chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts); chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
} }*/
} }
@Override @Override
...@@ -934,10 +793,14 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -934,10 +793,14 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
BigDecimal accountsAllCost = chDisabDetailAccountDTO.getAccountsAllCost(); BigDecimal accountsAllCost = chDisabDetailAccountDTO.getAccountsAllCost();
BigDecimal accountsOverallCost = chDisabDetailAccountDTO.getAccountsOverallCost(); BigDecimal accountsOverallCost = chDisabDetailAccountDTO.getAccountsOverallCost();
BigDecimal accountsPersonalCost = chDisabDetailAccountDTO.getAccountsPersonalCost(); BigDecimal accountsPersonalCost = chDisabDetailAccountDTO.getAccountsPersonalCost();
BigDecimal deductionAmount = chDisabDetailAccountDTO.getDeductionAmount();
BigDecimal reissueAmount = chDisabDetailAccountDTO.getReissueAmount();
ChDisabAccounts chDisabAccountDTO = disabAccountsMapper.selectById(accountsId); ChDisabAccounts chDisabAccountDTO = disabAccountsMapper.selectById(accountsId);
BigDecimal allCost = chDisabAccountDTO.getAllCost(); BigDecimal allCost = chDisabAccountDTO.getAllCost();
BigDecimal overallCost = chDisabAccountDTO.getOverallCost(); BigDecimal overallCost = chDisabAccountDTO.getOverallCost();
BigDecimal personalCost = chDisabAccountDTO.getPersonalCost(); BigDecimal personalCost = chDisabAccountDTO.getPersonalCost();
BigDecimal deductionAmountTotal = chDisabAccountDTO.getDeductionAmountTotal();
BigDecimal reissueAmountTotal = chDisabAccountDTO.getReissueAmountTotal();
Short accountsStatus = chDisabAccountDTO.getAccountsStatus(); Short accountsStatus = chDisabAccountDTO.getAccountsStatus();
if (accountsStatus > 1) { if (accountsStatus > 1) {
log.info("{},已完成审核",accountsDetailId); log.info("{},已完成审核",accountsDetailId);
...@@ -948,11 +811,15 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -948,11 +811,15 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
allCost = allCost.subtract(accountsAllCost); allCost = allCost.subtract(accountsAllCost);
overallCost = overallCost.subtract(accountsOverallCost); overallCost = overallCost.subtract(accountsOverallCost);
personalCost = personalCost.subtract(accountsPersonalCost); personalCost = personalCost.subtract(accountsPersonalCost);
BigDecimal deductionAmountTotalSub = deductionAmountTotal.subtract(deductionAmount);
BigDecimal reissueAmountTotalSub = reissueAmountTotal.subtract(reissueAmount);
ChDisabAccounts chDisabAccount = new ChDisabAccounts(); ChDisabAccounts chDisabAccount = new ChDisabAccounts();
chDisabAccount.setAllCost(allCost); chDisabAccount.setAllCost(allCost);
chDisabAccount.setOverallCost(overallCost); chDisabAccount.setOverallCost(overallCost);
chDisabAccount.setPersonalCost(personalCost); chDisabAccount.setPersonalCost(personalCost);
chDisabAccount.setAccountsId(accountsId); chDisabAccount.setAccountsId(accountsId);
chDisabAccount.setDeductionAmountTotal(deductionAmountTotalSub);
chDisabAccount.setReissueAmountTotal(reissueAmountTotalSub);
disabAccountsMapper.updateById(chDisabAccount); disabAccountsMapper.updateById(chDisabAccount);
// 恢复 // 恢复
}else if(status == 1){ }else if(status == 1){
...@@ -960,18 +827,23 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -960,18 +827,23 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
//结算记录 //结算记录
Date accountsTime = chDisabDetailAccountDTO.getAccountsTime(); Date accountsTime = chDisabDetailAccountDTO.getAccountsTime();
Boolean aBoolean = DateUtils.inCurrentMonth(accountsTime); Boolean aBoolean = DateUtils.inCurrentMonth(accountsTime);
// 同一个月
if(aBoolean){ if(aBoolean){
allCost = allCost.add(accountsAllCost); allCost = allCost.add(accountsAllCost);
overallCost = overallCost.add(accountsOverallCost); overallCost = overallCost.add(accountsOverallCost);
personalCost = personalCost.add(accountsPersonalCost); personalCost = personalCost.add(accountsPersonalCost);
BigDecimal reissueAmountAdd = reissueAmountTotal.add(reissueAmount);
BigDecimal deductionAmountAdd = deductionAmountTotal.add(deductionAmount);
ChDisabAccounts chDisabAccount = new ChDisabAccounts(); ChDisabAccounts chDisabAccount = new ChDisabAccounts();
chDisabAccount.setAllCost(allCost); chDisabAccount.setAllCost(allCost);
chDisabAccount.setOverallCost(overallCost); chDisabAccount.setOverallCost(overallCost);
chDisabAccount.setPersonalCost(personalCost); chDisabAccount.setPersonalCost(personalCost);
chDisabAccount.setAccountsId(accountsId); chDisabAccount.setAccountsId(accountsId);
chDisabAccount.setReissueAmountTotal(reissueAmountAdd);
chDisabAccount.setDeductionAmountTotal(deductionAmountAdd);
disabAccountsMapper.updateById(chDisabAccount); disabAccountsMapper.updateById(chDisabAccount);
}else { }else {
// 结算表加一个是否暂缓字段 1 暂缓 // 结算到其他月份 结算表加一个是否暂缓字段 2 暂缓
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(new Date()), chDisabDetailAccountDTO.getModeName(), chDisabDetailAccountDTO.getSrvOrganId(),2); ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(new Date()), chDisabDetailAccountDTO.getModeName(), chDisabDetailAccountDTO.getSrvOrganId(),2);
if (chDisabAccounts == null) { if (chDisabAccounts == null) {
chDisabAccounts = new ChDisabAccounts(); chDisabAccounts = new ChDisabAccounts();
...@@ -995,6 +867,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -995,6 +867,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
BigDecimal allCost1 = chDisabAccounts.getAllCost(); BigDecimal allCost1 = chDisabAccounts.getAllCost();
BigDecimal overallCost1 = chDisabAccounts.getOverallCost(); BigDecimal overallCost1 = chDisabAccounts.getOverallCost();
BigDecimal personalCost1 = chDisabAccounts.getPersonalCost(); BigDecimal personalCost1 = chDisabAccounts.getPersonalCost();
BigDecimal deductionAmountTotal1 = chDisabAccounts.getDeductionAmountTotal();
BigDecimal reissueAmountTotal1 = chDisabAccounts.getReissueAmountTotal();
BigDecimal deduction = deductionAmountTotal1.add(deductionAmount);
BigDecimal reissue = reissueAmountTotal1.add(reissueAmount);
allCost1 = allCost1.add(accountsAllCost); allCost1 = allCost1.add(accountsAllCost);
overallCost1 = overallCost1.add(accountsOverallCost); overallCost1 = overallCost1.add(accountsOverallCost);
personalCost1 = personalCost1.add(accountsPersonalCost); personalCost1 = personalCost1.add(accountsPersonalCost);
...@@ -1003,6 +879,8 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -1003,6 +879,8 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccount.setOverallCost(overallCost1); chDisabAccount.setOverallCost(overallCost1);
chDisabAccount.setPersonalCost(personalCost1); chDisabAccount.setPersonalCost(personalCost1);
chDisabAccount.setAccountsId(accountsId); chDisabAccount.setAccountsId(accountsId);
chDisabAccount.setReissueAmountTotal(reissue);
chDisabAccount.setDeductionAmountTotal(deduction);
disabAccountsMapper.updateById(chDisabAccount); disabAccountsMapper.updateById(chDisabAccount);
} }
} }
......
...@@ -31,10 +31,13 @@ ...@@ -31,10 +31,13 @@
<if test="req.accountsId != null and req.accountsId != ''"> <if test="req.accountsId != null and req.accountsId != ''">
and d.ACCOUNTS_ID = #{req.accountsId} and d.ACCOUNTS_ID = #{req.accountsId}
</if> </if>
<if test="req.modeId != null and req.modeId != ''">
and DECODE(d.mode_name, '医疗','1','养老', '2','上门','3', '异地', '4') = #{req.modeId}
</if>
<if test="req.accountsStatus != null and req.accountsStatus != ''"> <if test="req.accountsStatus != null and req.accountsStatus != ''">
and d.status = #{req.accountsStatus} and d.status = #{req.accountsStatus}
</if> </if>
<if test="req.srvOrganId != null and req.srvOrganId != ''"> <if test="req.srvOrganId != null and req.srvOrganId != '' and req.srvOrganId!=0">
and d.SRV_ORGAN_ID = #{req.srvOrganId} and d.SRV_ORGAN_ID = #{req.srvOrganId}
</if> </if>
...@@ -54,7 +57,7 @@ ...@@ -54,7 +57,7 @@
<select id="queryNursingRecords" resultType="com.hungraim.ltc.pojo.entity.account.NursingRecordsRespVO"> <select id="queryNursingRecords" resultType="com.hungraim.ltc.pojo.entity.account.NursingRecordsRespVO">
select organ.SRV_ORGAN_NAME srvOrganName, select organ.SRV_ORGAN_NAME srvOrganName,
to_char(plan.SRV_PLAN_TIME,'yyyy-MM-dd') srvPlanTime, to_char(plan.SRV_PLAN_TIME,'yyyy-MM-dd') srvPlanTime,
DECODE(plan.MODE_ID, '1','医疗','2', '养老','3','上门', '4', '异地') modeName, DECODE(plan.MODE_ID, '1','医疗','2', '养老','3','上门') modeName,
to_char(plan.CREATION_TIME,'yyyy-MM-dd HH24:mi:ss') executionTime, to_char(plan.CREATION_TIME,'yyyy-MM-dd HH24:mi:ss') executionTime,
plan.item_name itemName plan.item_name itemName
from CH_SRV_PLAN plan from CH_SRV_PLAN plan
...@@ -65,6 +68,24 @@ ...@@ -65,6 +68,24 @@
and plan.IS_STATUS ='4' and plan.IS_STATUS ='4'
</select> </select>
<select id="queryNursingRecordsGoDoor" resultType="com.hungraim.ltc.pojo.entity.account.NursingRecordsRespVO">
select
organ.SRV_ORGAN_NAME srvOrganName,
to_char(detail.SRV_DATE,'yyyy-MM-dd') srvPlanTime,
'上门' modeName,
to_char(item.FCD,'yyyy-MM-dd HH24:mi:ss') executionTime,
service.SERVICE_TYPE_DETAILED_NAME itemName
from CH_SRV_TASK_FINISH_ITEM item
left join CH_SRV_TASK_DETAIL detail on detail.TASK_DETAIL_ID = item.TASK_DETAIL_ID
left join CH_SRV_TASK task on task.SRV_TASK_ID = detail.SRV_TASK_ID
LEFT JOIN CH_SRV_ORGAN_EMP m ON m.EMP_ID = task.SRV_EMP_ID
LEFT JOIN CH_SRV_ORGAN organ ON organ.SRV_ORGAN_ID = m.SRV_ORGAN_ID
LEFT JOIN CH_SRV_ORGAN_PROJECT CSOP ON CSOP.PROJECT_ID = item.ITEM_ID
left join CH_SERVICE_TYPE_DETAILED service on service.SERVICE_TYPE_DETAILED_ID = CSOP.ITEM_NAME
where to_char(detail.SRV_DATE, 'yyyy-MM') = #{req.accountsTime} and task.DISAB_INFO_ID = #{req.disabInfoId} and organ.SRV_ORGAN_ID = #{req.srvOrganId}
</select>
...@@ -104,44 +125,7 @@ ...@@ -104,44 +125,7 @@
</where> </where>
</select> </select>
<select id="getOrganAccountsList" resultType="com.hungraim.ltc.pojo.vo.account.OrganAccountsVO">
select
detail.TASK_DETAIL_ID taskDetailId,
--失能人员姓名
disable.real_name realName,
disable.DISAB_INFO_ID disabInfoId,
--身份证号
disable.CERTI_CODE certiCode,
--所在省市
(select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea,
program.SRV_MODE_ID modeId,
--服务方式
DECODE(program.SRV_MODE_ID, '1','医疗','2', '养老','3','上门', '4', '异地') srvModeName,
--护理机构名称
organ.srv_organ_id srvOrganId,
--护理机构名称
organ.srv_organ_name srvOrganName,
--护理服务人员 Id
emp.EMP_ID empId,
--任务时间
detail.SRV_DATE srvDate,
-- 机构等级
organ.LEVEL_CODE levelCode
from ch_srv_task_detail detail--服务计划
left join ch_srv_task task on task.srv_task_id = detail.srv_task_id--服务计划详情
left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员
left join CH_DISABLE_APPLY apply on apply.apply_id = disable.apply_id
left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
left join ch_srv_program program on task.program_id = program.program_id--服务方案
left join ch_srv_organ organ on program.srv_organ_id = organ.srv_organ_id--服务机构
LEFT JOIN CH_SRV_TASK_FINISH_ITEM CSTFI ON detail.TASK_DETAIL_ID = CSTFI.TASK_DETAIL_ID
<where>
detail.STATUS = '4'
<if test="taskDetailId != null and taskDetailId != ''">
AND detail.TASK_DETAIL_ID = #{taskDetailId}
</if>
</where>
</select>
<select id="queryPlanInfoByDetailId" resultType="com.hungraim.ltc.pojo.vo.account.OrganAccountsVO"> <select id="queryPlanInfoByDetailId" resultType="com.hungraim.ltc.pojo.vo.account.OrganAccountsVO">
select select
...@@ -173,16 +157,7 @@ ...@@ -173,16 +157,7 @@
where plan.IS_STATUS = '4' and plan.IS_BILL = 1 and plan.TASK_DETAIL_ID = #{taskDetailId} where plan.IS_STATUS = '4' and plan.IS_BILL = 1 and plan.TASK_DETAIL_ID = #{taskDetailId}
</select> </select>
<select id="queryAccountByCondition" resultType="com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts">
select * from CH_DISAB_ACCOUNTS_DETAIL t where t.MODE_NAME in ('养老','医疗')
<if test="taskDetailIds != null and taskDetailIds.size() > 0">
AND t.TASK_DETAIL_ID IN
<foreach collection="taskDetailIds" separator="," open="(" close=")" item="taskDetailId">
#{taskDetailId}
</foreach>
</if>
</select>
<!--查询评估信息--> <!--查询评估信息-->
<select id="getAssessAccountsList" resultType="com.hungraim.ltc.pojo.vo.account.AssessAccountsVO"> <select id="getAssessAccountsList" resultType="com.hungraim.ltc.pojo.vo.account.AssessAccountsVO">
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#{organId} #{organId}
</foreach> </foreach>
</if> </if>
<if test='req.srvOrganId != null'> <if test="req.srvOrganId != null and req.srvOrganId != '' and req.srvOrganId!=0">
AND t2.SRV_ORGAN_ID = #{req.srvOrganId} AND t2.SRV_ORGAN_ID = #{req.srvOrganId}
</if> </if>
<if test="req.accountsTime != null and req.accountsTime != ''"> <if test="req.accountsTime != null and req.accountsTime != ''">
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
organ.SRV_ORGAN_NAME srvOrganName, organ.SRV_ORGAN_NAME srvOrganName,
rd.AMOUNT_OF_MONEY amountOfMoney, rd.AMOUNT_OF_MONEY amountOfMoney,
rd.FREE_RD_ID freeRdId, rd.FREE_RD_ID freeRdId,
rd.REMARKS remarks,
d.ACCOUNTS_STATUS accountsStatus d.ACCOUNTS_STATUS accountsStatus
from CH_DISAB_FREE_RD_INFO rd left join from CH_DISAB_FREE_RD_INFO rd left join
CH_DISAB_ACCOUNTS_DETAIL detail on CH_DISAB_ACCOUNTS_DETAIL detail on
...@@ -32,6 +33,9 @@ ...@@ -32,6 +33,9 @@
<if test="req.srvOrganName != null and req.srvOrganName != ''"> <if test="req.srvOrganName != null and req.srvOrganName != ''">
and organ.SRV_ORGAN_NAME = #{req.srvOrganName} and organ.SRV_ORGAN_NAME = #{req.srvOrganName}
</if> </if>
<if test="req.srvOrganId != null and req.srvOrganId != '' and req.srvOrganId!=0">
AND organ.SRV_ORGAN_ID = #{req.srvOrganId}
</if>
<if test="req.certiCode != null and req.certiCode != ''"> <if test="req.certiCode != null and req.certiCode != ''">
and info.certi_Code = #{req.certiCode} and info.certi_Code = #{req.certiCode}
</if> </if>
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
<if test="req.srvDate != null and req.srvDate != ''"> <if test="req.srvDate != null and req.srvDate != ''">
AND to_char(plan.SRV_PLAN_TIME,'yyyy-MM-dd') = #{req.srvDate} AND to_char(plan.SRV_PLAN_TIME,'yyyy-MM-dd') = #{req.srvDate}
</if> </if>
<if test="req.srvOrganId != null and req.srvOrganId != '' and req.srvOrganId!=0">
AND organ.SRV_ORGAN_ID = #{req.srvOrganId}
</if>
</where> </where>
</select> </select>
......
...@@ -500,19 +500,22 @@ public class DisableController { ...@@ -500,19 +500,22 @@ public class DisableController {
/** /**
* 失能人员信息退出列表 * 失能人员信息退出列表
* *
* @param pageNum 当前页 * @param pageNum 当前页
* @param pageSize 每页几条数据 * @param pageSize 每页几条数据
* @return 失能人员信息列表 * @return 失能人员信息列表
*/ */
@RequestMapping("/disableInfoList") @RequestMapping("/disableInfoList")
public Result<Page<DisableInfoListVo>> disableInfoList(Integer pageNum, Integer pageSize, Long srvOrganId,String certiCode,String realName,String svrModelId) { public Result<Page<DisableInfoListVo>> disableInfoList(@RequestHeader("Authorization") String token,Integer pageNum, Integer pageSize, Long srvOrganId,String certiCode,String realName,String svrModelId) {
if (pageNum == null || pageNum < 1 || srvOrganId == null || srvOrganId == 0) { if (pageNum == null || pageNum < 1) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
if (pageSize == null || pageSize < 1) { if (pageSize == null || pageSize < 1) {
pageSize = 10; pageSize = 10;
} }
long srvOrganIdL = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if(srvOrganIdL != 0) {
srvOrganId = new Long(srvOrganIdL);
}
Page<DisableInfoListVo> page = new Page<>(pageNum, pageSize); Page<DisableInfoListVo> page = new Page<>(pageNum, pageSize);
page = disableService.getDisableInfoList(page, srvOrganId,certiCode,realName,svrModelId); page = disableService.getDisableInfoList(page, srvOrganId,certiCode,realName,svrModelId);
return Result.success(page); return Result.success(page);
...@@ -538,4 +541,19 @@ public class DisableController { ...@@ -538,4 +541,19 @@ public class DisableController {
} }
/**
* 失能人员信息退出历史列表
*
* @param disableInfoId
* @return 失能人员信息退出历史列表
*/
@RequestMapping("/getDisableExitHis")
public Result<List<ChDisableExit>> getDisableExitHis(Integer disableInfoId) {
if (disableInfoId == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
List<ChDisableExit> disableExitHis = disableService.getDisableExitHis(disableInfoId);
return Result.success(disableExitHis);
}
} }
...@@ -91,7 +91,8 @@ public class SrvOrganController { ...@@ -91,7 +91,8 @@ public class SrvOrganController {
@PostMapping("/srvOrgan") @PostMapping("/srvOrgan")
public Result saveSrvOrgan(SrvOrganVo srvOrganVo) { public Result saveSrvOrgan(SrvOrganVo srvOrganVo) {
//null == srvOrganVo.getLevelCode() || null == srvOrganVo.getBunk() || || StrUtil.isBlank(srvOrganVo.getPermitId()) //null == srvOrganVo.getLevelCode() || null == srvOrganVo.getBunk() || || StrUtil.isBlank(srvOrganVo.getPermitId())
if (StrUtil.isBlank(srvOrganVo.getOrganId()) || StrUtil.isBlank(srvOrganVo.getDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getDistrictCity()) || StrUtil.isBlank(srvOrganVo.getDistrictArea()) || StrUtil.isBlank(srvOrganVo.getAcptProvincial()) || StrUtil.isBlank(srvOrganVo.getAcptCity()) || StrUtil.isBlank(srvOrganVo.getAcptArea()) || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getBankDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getBankDistrictCity()) || StrUtil.isBlank(srvOrganVo.getSrvOrganName()) || null == srvOrganVo.getOrganTypeId() || StrUtil.isBlank(srvOrganVo.getLinkName()) || StrUtil.isBlank(srvOrganVo.getLinkTel()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getUnifiedSocialCreditCode()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getAccName()) || StrUtil.isBlank(srvOrganVo.getBankAccCode()) || StrUtil.isBlank(srvOrganVo.getBankAccName()) || StrUtil.isBlank(srvOrganVo.getBankNo()) || StrUtil.isBlank(srvOrganVo.getBankDistrictWebsite()) || null == srvOrganVo.getCardType() || null == srvOrganVo.getFileDataList() || srvOrganVo.getFileDataList().size() < 3) { // || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getAcptStreet())
if (StrUtil.isBlank(srvOrganVo.getOrganId()) || StrUtil.isBlank(srvOrganVo.getDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getDistrictCity()) || StrUtil.isBlank(srvOrganVo.getDistrictArea()) || StrUtil.isBlank(srvOrganVo.getAcptProvincial()) || StrUtil.isBlank(srvOrganVo.getAcptCity()) || StrUtil.isBlank(srvOrganVo.getAcptArea()) || StrUtil.isBlank(srvOrganVo.getBankDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getBankDistrictCity()) || StrUtil.isBlank(srvOrganVo.getSrvOrganName()) || null == srvOrganVo.getOrganTypeId() || StrUtil.isBlank(srvOrganVo.getLinkName()) || StrUtil.isBlank(srvOrganVo.getLinkTel()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getUnifiedSocialCreditCode()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getAccName()) || StrUtil.isBlank(srvOrganVo.getBankAccCode()) || StrUtil.isBlank(srvOrganVo.getBankAccName()) || StrUtil.isBlank(srvOrganVo.getBankNo()) || StrUtil.isBlank(srvOrganVo.getBankDistrictWebsite()) || null == srvOrganVo.getCardType() || null == srvOrganVo.getFileDataList() || srvOrganVo.getFileDataList().size() < 3) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
// 参数校验通过,调用service添加护理机构 // 参数校验通过,调用service添加护理机构
...@@ -112,7 +113,8 @@ public class SrvOrganController { ...@@ -112,7 +113,8 @@ public class SrvOrganController {
@PostMapping("/updateSrvOrgan") @PostMapping("/updateSrvOrgan")
public Result updateSrvOrgan(SrvOrganVo srvOrganVo) { public Result updateSrvOrgan(SrvOrganVo srvOrganVo) {
//StrUtil.isBlank(srvOrganVo.getPermitId()) || null == srvOrganVo.getLevelCode() || null == srvOrganVo.getBunk() || //StrUtil.isBlank(srvOrganVo.getPermitId()) || null == srvOrganVo.getLevelCode() || null == srvOrganVo.getBunk() ||
if (null == srvOrganVo.getSrvOrganId() || StrUtil.isBlank(srvOrganVo.getOrganId()) || StrUtil.isBlank(srvOrganVo.getDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getDistrictCity()) || StrUtil.isBlank(srvOrganVo.getDistrictArea()) || StrUtil.isBlank(srvOrganVo.getAcptProvincial()) || StrUtil.isBlank(srvOrganVo.getAcptCity()) || StrUtil.isBlank(srvOrganVo.getAcptArea()) || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getBankDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getBankDistrictCity()) || StrUtil.isBlank(srvOrganVo.getSrvOrganName()) || null == srvOrganVo.getOrganTypeId() || StrUtil.isBlank(srvOrganVo.getLinkName()) || StrUtil.isBlank(srvOrganVo.getLinkTel()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getUnifiedSocialCreditCode()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getAccName()) || StrUtil.isBlank(srvOrganVo.getBankAccCode()) || StrUtil.isBlank(srvOrganVo.getBankAccName()) || StrUtil.isBlank(srvOrganVo.getBankNo()) || StrUtil.isBlank(srvOrganVo.getBankDistrictWebsite()) || null == srvOrganVo.getCardType() || null == srvOrganVo.getFileDataList() || srvOrganVo.getFileDataList().size() < 3) { // || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getAcptStreet())
if (null == srvOrganVo.getSrvOrganId() || StrUtil.isBlank(srvOrganVo.getOrganId()) || StrUtil.isBlank(srvOrganVo.getDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getDistrictCity()) || StrUtil.isBlank(srvOrganVo.getDistrictArea()) || StrUtil.isBlank(srvOrganVo.getAcptProvincial()) || StrUtil.isBlank(srvOrganVo.getAcptCity()) || StrUtil.isBlank(srvOrganVo.getAcptArea()) || StrUtil.isBlank(srvOrganVo.getBankDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getBankDistrictCity()) || StrUtil.isBlank(srvOrganVo.getSrvOrganName()) || null == srvOrganVo.getOrganTypeId() || StrUtil.isBlank(srvOrganVo.getLinkName()) || StrUtil.isBlank(srvOrganVo.getLinkTel()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getUnifiedSocialCreditCode()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getAccName()) || StrUtil.isBlank(srvOrganVo.getBankAccCode()) || StrUtil.isBlank(srvOrganVo.getBankAccName()) || StrUtil.isBlank(srvOrganVo.getBankNo()) || StrUtil.isBlank(srvOrganVo.getBankDistrictWebsite()) || null == srvOrganVo.getCardType() || null == srvOrganVo.getFileDataList() || srvOrganVo.getFileDataList().size() < 3) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
// 参数校验通过,调用service修改护理机构 // 参数校验通过,调用service修改护理机构
......
package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetailDelete;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author zwl
* @ClassName ChSrvSendMapper
* @description
* @date 2023/3/13 18:40
**/
@Mapper
@Repository
public interface ChSrvSendInfoMapper extends BaseMapper<ChSrvSend> {
}
package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.disable.ChDisableExit;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* 失能人员退出Mapper
*
* @author
*/
@Mapper
@Repository
public interface DisableExitMapper extends BaseMapper<ChDisableExit> {
}
...@@ -3,12 +3,16 @@ package com.hungraim.ltc.dao; ...@@ -3,12 +3,16 @@ 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.disable.ChDisableInfo; import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo; import com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo; import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* 失能人员信息Mapper * 失能人员信息Mapper
* *
...@@ -29,4 +33,12 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> { ...@@ -29,4 +33,12 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
int deleteSrvSend(Integer disableInfoId,String exitTime); int deleteSrvSend(Integer disableInfoId,String exitTime);
int updateSrvProgramById(ChSrvProgram chSrvProgram);
int updateSrvSendById(ChSrvSend chSrvSend);
int insertSrvSend(Integer disableInfoId);
} }
...@@ -184,4 +184,6 @@ public interface DisableService { ...@@ -184,4 +184,6 @@ public interface DisableService {
int disableInfoExit(Integer disableInfoId,Integer exitReasonId,Integer applyId,Integer srvOrganId,Integer programId,String exitTime); int disableInfoExit(Integer disableInfoId,Integer exitReasonId,Integer applyId,Integer srvOrganId,Integer programId,String exitTime);
List<ChDisableExit> getDisableExitHis(Integer disableInfoId);
} }
...@@ -18,6 +18,9 @@ import com.hungraim.ltc.pojo.entity.disable.*; ...@@ -18,6 +18,9 @@ import com.hungraim.ltc.pojo.entity.disable.*;
import com.hungraim.ltc.pojo.entity.riskLevel.ChDisableRiskLevel; import com.hungraim.ltc.pojo.entity.riskLevel.ChDisableRiskLevel;
import com.hungraim.ltc.pojo.entity.riskLevel.ChSrvorganRiskLevel; import com.hungraim.ltc.pojo.entity.riskLevel.ChSrvorganRiskLevel;
import com.hungraim.ltc.pojo.entity.serviceManage.ChCfgPara; import com.hungraim.ltc.pojo.entity.serviceManage.ChCfgPara;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.disable.*; import com.hungraim.ltc.pojo.vo.disable.*;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo; import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo; import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
...@@ -58,11 +61,16 @@ public class DisableServiceImpl implements DisableService { ...@@ -58,11 +61,16 @@ public class DisableServiceImpl implements DisableService {
private final AttachFeignService attachFeignService; private final AttachFeignService attachFeignService;
private final ChDisableInfoChangeMapper chDisableInfoChangeMapper; private final ChDisableInfoChangeMapper chDisableInfoChangeMapper;
private final DisableInfoHisMapper disableInfoHisMapper; private final DisableInfoHisMapper disableInfoHisMapper;
private final DisableExitMapper disableExitMapper;
private final OrganService organService; private final OrganService organService;
private final ChSrvSendInfoMapper chSrvSendInfoMapper;
@Autowired @Autowired
private ChDisableRiskLevelMapper chDisableRiskLevelMapper; private ChDisableRiskLevelMapper chDisableRiskLevelMapper;
/** /**
* 获取机构ids * 获取机构ids
* *
...@@ -593,16 +601,55 @@ public class DisableServiceImpl implements DisableService { ...@@ -593,16 +601,55 @@ public class DisableServiceImpl implements DisableService {
chDisableInfo.setExitSrvOrganId(srvOrganId); chDisableInfo.setExitSrvOrganId(srvOrganId);
int result = disableInfoMapper.updateById(chDisableInfo); int result = disableInfoMapper.updateById(chDisableInfo);
boolean now = DateUtils.isNow(date);
if (now) {
ChSrvProgram chSrvProgram = new ChSrvProgram();
chSrvProgram.setProgramId(chSrvProgram.getProgramId());
chSrvProgram.setDisabInfoId(Long.valueOf(disableInfoId));
chSrvProgram.setProgStatus(2);
chSrvProgram.setEndReason("失能人员退出,终止方案");
disableInfoMapper.updateSrvProgramById(chSrvProgram);
ChSrvSend chSrvSend = new ChSrvSend();
chSrvSend.setDisabInfoId(Long.valueOf(disableInfoId));
chSrvSend.setEndTime(date);
// 4, 转入医保 5, 异地
if (exitReasonId == 4||exitReasonId==5){
// chSrvSend.setStatus((short)3);
// disableInfoMapper.updateSrvSendById(chSrvSend);
// 1, 死亡
}else if (exitReasonId == 1){
chSrvSend.setStatus((short)3);
disableInfoMapper.updateSrvSendById(chSrvSend);
}else {
chSrvSend.setStatus((short)3);
disableInfoMapper.updateSrvSendById(chSrvSend);
disableInfoMapper.insertSrvSend(disableInfoId);
}
if(exitReasonId == 3 || exitReasonId == 4 || exitReasonId == 5 || exitReasonId == 6 || exitReasonId == 7){ }
// 解除护理机构分配 // 解除护理机构分配
// delete from CH_SRV_SEND where DISAB_INFO_ID = '327' // delete from CH_SRV_SEND where DISAB_INFO_ID = '327'
disableInfoMapper.deleteSrvSend(disableInfoId,exitTime); // disableInfoMapper.deleteSrvSend(disableInfoId,exitTime);
} // }
ChDisableExit chDisableExit = new ChDisableExit();
chDisableExit.setDisabInfoId(disableInfoId);
chDisableExit.setExitReasonId(exitReasonId);
chDisableExit.setExitTime(date);
chDisableExit.setSrvOrganId(srvOrganId);
disableExitMapper.insert(chDisableExit);
return result; return result;
} }
@Override
public List<ChDisableExit> getDisableExitHis(Integer disableInfoId) {
List<ChDisableExit> chDisableExits = disableExitMapper.selectList(new LambdaQueryWrapper<ChDisableExit>().eq(ChDisableExit::getDisabInfoId, disableInfoId));
return chDisableExits;
}
} }
...@@ -153,20 +153,20 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService { ...@@ -153,20 +153,20 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
List<Long> organIds = organService.getOrganIds(organId, isInvolveChild); List<Long> organIds = organService.getOrganIds(organId, isInvolveChild);
List<SrvOrganEmpExportVo> srvOrganEmpExportList = chSrvOrganEmpApplyMapper.getSrvOrganEmpApplyExportList(organIds,srvOrganId, empName, srvOrganName, certifNum, isLock, empType); List<SrvOrganEmpExportVo> srvOrganEmpExportList = chSrvOrganEmpApplyMapper.getSrvOrganEmpApplyExportList(organIds,srvOrganId, empName, srvOrganName, certifNum, isLock, empType);
for (SrvOrganEmpExportVo record : srvOrganEmpExportList) { // for (SrvOrganEmpExportVo record : srvOrganEmpExportList) {
StringBuilder stringBuilder = new StringBuilder(); // StringBuilder stringBuilder = new StringBuilder();
if(record == null){ // if(record == null){
break; // break;
} // }
if(StringUtils.isEmpty(record.getProvincial())){ // if(StringUtils.isEmpty(record.getProvincial())){
stringBuilder.append("--"); // stringBuilder.append("--");
}else if( record.getProvincial().equals(record.getCity())){ // }else if( record.getProvincial().equals(record.getCity())){
stringBuilder.append(record.getProvincial()); // stringBuilder.append(record.getProvincial());
}else { // }else {
stringBuilder.append(record.getProvincial()).append(record.getCity()); // stringBuilder.append(record.getProvincial()).append(record.getCity());
} // }
record.setProvinCialcityArea(stringBuilder.toString()); // record.setProvinCialcityArea(stringBuilder.toString());
} // }
ExportParams exportParams = new ExportParams(); ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF); // 对应xlsx exportParams.setType(ExcelType.XSSF); // 对应xlsx
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SrvOrganEmpExportVo.class, srvOrganEmpExportList); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SrvOrganEmpExportVo.class, srvOrganEmpExportList);
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
T5.ORGAN_NAME organName, T5.ORGAN_NAME organName,
T4.UNIFIED_SOCIAL_CREDIT_CODE unifiedSocialCreditCode, T4.UNIFIED_SOCIAL_CREDIT_CODE unifiedSocialCreditCode,
T1.EMP_NAME empName, T1.EMP_NAME empName,
T1.GENDER gender, DECODE(T1.gender, 'M','男','F', '女','N', '不确定') gender,
T1.AGE age, T1.AGE age,
T1.CERTIF_TYPE certifType, T1.CERTIF_TYPE certifType,
T1.CERTIF_NUM certifNum, T1.CERTIF_NUM certifNum,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!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.dao.DisableInfoMapper"> <mapper namespace="com.hungraim.ltc.dao.DisableInfoMapper">
<select id="getDisableInfoList" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo"> <select id="getDisableInfoList" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo">
SELECT T1.PROGRAM_ID programId, SELECT distinct T1.PROGRAM_ID programId,
T1.SRV_ORGAN_ID srvOrganId, T1.SRV_ORGAN_ID srvOrganId,
T1.DISAB_INFO_ID disabInfoId, T1.DISAB_INFO_ID disabInfoId,
T5.DISTRICT_PROVINCIAL districtProvincial, T5.DISTRICT_PROVINCIAL districtProvincial,
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
T2.ACPT_AREA acptArea, T2.ACPT_AREA acptArea,
T2.ACPT_STREET acptStreet, T2.ACPT_STREET acptStreet,
T2.ACPT_ADDRESS acptAddress, T2.ACPT_ADDRESS acptAddress,
T6.DISABLE_LEVEL_NAME realLevel,
T4.FINISH_TIME assessDate,
T7.MODE_NAME svrModelName, T7.MODE_NAME svrModelName,
T5.SRV_ORGAN_NAME svrOrganName, T5.SRV_ORGAN_NAME svrOrganName,
T1.PROG_STATUS progStatus, T1.PROG_STATUS progStatus,
...@@ -34,21 +32,22 @@ ...@@ -34,21 +32,22 @@
FROM CH_DISABLE_INFO T2 FROM CH_DISABLE_INFO T2
INNER JOIN CH_SRV_PROGRAM T1 ON T1.DISAB_INFO_ID = T2.DISAB_INFO_ID INNER JOIN CH_SRV_PROGRAM T1 ON T1.DISAB_INFO_ID = T2.DISAB_INFO_ID
LEFT JOIN CH_CFG_SRV_MODE T7 ON T2.SRV_MODE_ID = T7.MODE_ID LEFT JOIN CH_CFG_SRV_MODE T7 ON T2.SRV_MODE_ID = T7.MODE_ID
LEFT JOIN CH_APR_REPORT T3 ON T2.LAST_TASK_ID = T3.TASK_ID
LEFT JOIN CH_CFG_SRV_DISABLE_LEVEL T6 ON T3.DISABLE_LEVEL_ID = T6.DISABLE_LEVEL_ID
LEFT JOIN CH_APR_TASK T4 ON T3.TASK_ID = T4.TASK_ID
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
WHERE <where>
T1.SRV_ORGAN_ID = #{srvOrganId} 1=1
<if test="srvOrganId != null and srvOrganId != '' and srvOrganId!=0">
and T1.SRV_ORGAN_ID = #{srvOrganId}
</if>
<if test="certiCode != null and certiCode != ''"> <if test="certiCode != null and certiCode != ''">
and T2.CERTI_CODE = #{certiCode} and T2.CERTI_CODE = #{certiCode}
</if> </if>
<if test="realName != null and realName != ''"> <if test="realName != null and realName != ''">
and T2.real_name = #{realName} and T2.real_name like CONCAT(CONCAT('%',#{realName}) ,'%')
</if> </if>
<if test="svrModelId != null and svrModelId != ''"> <if test="svrModelId != null and svrModelId != ''">
and T7.MODE_ID = #{svrModelId} and T7.MODE_ID = #{svrModelId}
</if> </if>
</where>
</select> </select>
<update id="updateChSrvProgram"> <update id="updateChSrvProgram">
...@@ -60,4 +59,21 @@ ...@@ -60,4 +59,21 @@
<delete id="deleteSrvSend"> <delete id="deleteSrvSend">
delete from CH_SRV_SEND where DISAB_INFO_ID = #{disableInfoId} delete from CH_SRV_SEND where DISAB_INFO_ID = #{disableInfoId}
</delete> </delete>
<update id="updateSrvProgramById" parameterType="com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram">
update CH_SRV_PROGRAM g set g.PROG_STATUS ='2',g.END_REASON = #{endReason} where
g.DISAB_INFO_ID =#{disabInfoId} and g.PROGRAM_DATE <![CDATA[ < ]]> sysdate
</update>
<update id="updateSrvSendById" parameterType="com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend">
update CH_SRV_SEND s set s.STATUS ='3',s.end_time = #{endTime} where
s.DISAB_INFO_ID = #{disabInfoId}
</update>
<insert id="insertSrvSend">
insert INTO ch_srv_send(SRV_SEND_ID,DISAB_INFO_ID,FCD,STATUS) values
((SELECT max(srv_send_id)+1 id from CH_SRV_SEND),#{disableInfoId},SYSDATE,0)
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -692,14 +692,14 @@ public class TaskController { ...@@ -692,14 +692,14 @@ public class TaskController {
* @param city 失能人员所在市 * @param city 失能人员所在市
* @param area 失能人员所在区 * @param area 失能人员所在区
* @param organName 评定机构名称 * @param organName 评定机构名称
* @param name 评定人员姓名 * @param realName 评定人员姓名
* @param tel 评定人员手机号码 * @param tel 评定人员手机号码
* @param groupLeader 是否组长0组长,1非组长 * @param groupLeader 是否组长0组长,1非组长
*/ */
@GetMapping("/aprEmpExport") @GetMapping("/aprEmpExport")
public void aprEmpExport(String provincial, String city, String area, String organName, String name, String tel, String groupLeader,HttpServletResponse response){ public void aprEmpExport(String provincial, String city, String area, String organName, String realName, String tel, String certiCode,String isLock,String empType,String groupLeader,HttpServletResponse response){
Workbook workbook = taskService.aprEmpExport(provincial, city, area, organName, name, Workbook workbook = taskService.aprEmpExport(provincial, city, area, organName, realName,
tel, groupLeader); tel,certiCode,isLock,empType, groupLeader);
// 命名表格 // 命名表格
String fileName = "aprEmp.xlsx"; String fileName = "aprEmp.xlsx";
FileUtils.exportResponse(workbook,fileName,response); FileUtils.exportResponse(workbook,fileName,response);
......
...@@ -13,4 +13,5 @@ import org.springframework.stereotype.Repository; ...@@ -13,4 +13,5 @@ import org.springframework.stereotype.Repository;
@Mapper @Mapper
@Repository @Repository
public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> { public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
} }
...@@ -3,6 +3,7 @@ package com.hungraim.ltc.dao; ...@@ -3,6 +3,7 @@ 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.assessment.ChAprTask; import com.hungraim.ltc.pojo.entity.assessment.ChAprTask;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.vo.assessment.*; import com.hungraim.ltc.pojo.vo.assessment.*;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -75,5 +76,9 @@ public interface TaskMapper extends BaseMapper<ChAprTask> { ...@@ -75,5 +76,9 @@ public interface TaskMapper extends BaseMapper<ChAprTask> {
Page<TaskGroupInfoByPageVO> taskGroupInfoListByPage(String aprEmpId, String appointStartTime, String appointEndTime, String queryBeginDate, String queryEndDate, String groupNo, Integer pageNo, Integer pageSize); Page<TaskGroupInfoByPageVO> taskGroupInfoListByPage(String aprEmpId, String appointStartTime, String appointEndTime, String queryBeginDate, String queryEndDate, String groupNo, Integer pageNo, Integer pageSize);
List<AprEmpExportVO> aprEmpExportList(String provincial, String city, String area, String organName, String name, String tel, String groupLeader); List<AprEmpExportVO> aprEmpExportList(String provincial, String city, String area, String organName, String name, String tel, String certiCode,String isLock,String empType, String groupLeader);
int insertSrvSend(Integer disableInfoId);
ChDisableInfo selectDisableBycertiCode(@Param("certiCode") String certiCode);
} }
...@@ -88,7 +88,7 @@ public interface TaskService { ...@@ -88,7 +88,7 @@ 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 certiCode,String isLock,String empType, String groupLeader);
void assessAccount(ReportDetailVO reportDetailVo); void assessAccount(ReportDetailVO reportDetailVo);
......
...@@ -16,6 +16,7 @@ import com.hungraim.ltc.pojo.entity.assessment.*; ...@@ -16,6 +16,7 @@ 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.ChDisableApply; import com.hungraim.ltc.pojo.entity.disable.ChDisableApply;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo; import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.ReportUpdateVO; import com.hungraim.ltc.pojo.vo.ReportUpdateVO;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp; import com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp;
...@@ -28,6 +29,7 @@ import com.hungraim.ltc.service.TppesApiException; ...@@ -28,6 +29,7 @@ import com.hungraim.ltc.service.TppesApiException;
import com.hungraim.ltc.util.*; import com.hungraim.ltc.util.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.LongValue;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -73,6 +75,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -73,6 +75,7 @@ public class TaskServiceImpl implements TaskService {
/** /**
* 评定任务分配列表 * 评定任务分配列表
* *
...@@ -215,6 +218,11 @@ public class TaskServiceImpl implements TaskService { ...@@ -215,6 +218,11 @@ public class TaskServiceImpl implements TaskService {
task.setFinishTime(new Date()); task.setFinishTime(new Date());
task.setTaskStatus(3); // 已完成 task.setTaskStatus(3); // 已完成
taskMapper.updateById(task); taskMapper.updateById(task);
if(2 == reportDetailVO.getEvaluateType()){
ChAprTask chAprTask = taskMapper.selectById(reportDetailVO.getTaskId());
Integer disableInfoId = chAprTask.getDisableInfoId();
taskMapper.insertSrvSend(disableInfoId);
}
return Result.success(); return Result.success();
} }
...@@ -228,8 +236,9 @@ public class TaskServiceImpl implements TaskService { ...@@ -228,8 +236,9 @@ public class TaskServiceImpl implements TaskService {
Integer person2 = reportDetailVo.getPerson2(); Integer person2 = reportDetailVo.getPerson2();
String evaluateTime = reportDetailVo.getEvaluateTime(); String evaluateTime = reportDetailVo.getEvaluateTime();
Date evaluateDate = DateUtils.strToDate(evaluateTime); Date evaluateDate = DateUtils.strToDate(evaluateTime);
List<ChDisableInfo> chDisableInfos = disableInfoMapper.selectList(new LambdaQueryWrapper<ChDisableInfo>().eq(ChDisableInfo::getApplyId, reportDetailVo.getApplyId())); String certiCode = reportDetailVo.getCertiCode();
Integer srvModeId = chDisableInfos.get(0).getSrvModeId(); ChDisableInfo chDisableInfo = taskMapper.selectDisableBycertiCode(certiCode);
Integer srvModeId = chDisableInfo.getSrvModeId();
// 根据评定机构id和评估结算时间查找表里有没有数据,有数据直接累加费用 // 根据评定机构id和评估结算时间查找表里有没有数据,有数据直接累加费用
// 评定人员结算表插入 // 评定人员结算表插入
if (person1 != null) { if (person1 != null) {
...@@ -239,7 +248,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -239,7 +248,7 @@ public class TaskServiceImpl implements TaskService {
Integer aprOrganId = chAprEmp.getAprOrganId(); Integer aprOrganId = chAprEmp.getAprOrganId();
chAssessDetailAccounts.setAprOrganId(String.valueOf(aprOrganId)); chAssessDetailAccounts.setAprOrganId(String.valueOf(aprOrganId));
chAssessDetailAccounts.setApplyId(reportDetailVo.getApplyId()); chAssessDetailAccounts.setApplyId(String.valueOf(chDisableInfo.getApplyId()));
chAssessDetailAccounts.setCreationTime(new Date()); chAssessDetailAccounts.setCreationTime(new Date());
chAssessDetailAccounts.setAccountsTime(evaluateDate); chAssessDetailAccounts.setAccountsTime(evaluateDate);
chAssessDetailAccounts.setAssessTime(evaluateDate); chAssessDetailAccounts.setAssessTime(evaluateDate);
...@@ -249,8 +258,11 @@ public class TaskServiceImpl implements TaskService { ...@@ -249,8 +258,11 @@ public class TaskServiceImpl implements TaskService {
String assessCost = aprempTypeIdS==1? "100":"150"; String assessCost = aprempTypeIdS==1? "100":"150";
chAssessDetailAccounts.setAssessCost(assessCost); chAssessDetailAccounts.setAssessCost(assessCost);
Long assessAccountsId = saveAssess(aprOrganId, assessCost,srvModeId,evaluateDate); Long assessAccountsId = saveAssess(aprOrganId, assessCost,srvModeId,evaluateDate);
chAssessDetailAccounts.setAssessAccountsId(assessAccountsId); if(assessAccountsId != null){
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts); chAssessDetailAccounts.setAssessAccountsId(assessAccountsId);
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts);
}
} }
if (person2 != null) { if (person2 != null) {
ChAssessDetailAccounts chAssessDetailAccounts = new ChAssessDetailAccounts(); ChAssessDetailAccounts chAssessDetailAccounts = new ChAssessDetailAccounts();
...@@ -258,7 +270,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -258,7 +270,7 @@ public class TaskServiceImpl implements TaskService {
ChAprEmp chAprEmp = aprEmpMapper.selectById(person2); ChAprEmp chAprEmp = aprEmpMapper.selectById(person2);
Integer aprOrganId = chAprEmp.getAprOrganId(); Integer aprOrganId = chAprEmp.getAprOrganId();
chAssessDetailAccounts.setAprOrganId(String.valueOf(aprOrganId)); chAssessDetailAccounts.setAprOrganId(String.valueOf(aprOrganId));
chAssessDetailAccounts.setApplyId(reportDetailVo.getApplyId()); chAssessDetailAccounts.setApplyId(String.valueOf(chDisableInfo.getApplyId()));
chAssessDetailAccounts.setCreationTime(new Date()); chAssessDetailAccounts.setCreationTime(new Date());
chAssessDetailAccounts.setAccountsTime(evaluateDate); chAssessDetailAccounts.setAccountsTime(evaluateDate);
chAssessDetailAccounts.setAssessTime(evaluateDate); chAssessDetailAccounts.setAssessTime(evaluateDate);
...@@ -268,16 +280,22 @@ public class TaskServiceImpl implements TaskService { ...@@ -268,16 +280,22 @@ public class TaskServiceImpl implements TaskService {
String assessCost = aprempTypeIdS==1? "100":"150"; String assessCost = aprempTypeIdS==1? "100":"150";
chAssessDetailAccounts.setAssessCost(assessCost); chAssessDetailAccounts.setAssessCost(assessCost);
Long assessAccountsId = saveAssess(aprOrganId, assessCost,srvModeId,evaluateDate); Long assessAccountsId = saveAssess(aprOrganId, assessCost,srvModeId,evaluateDate);
chAssessDetailAccounts.setAssessAccountsId(assessAccountsId); if(assessAccountsId != null) {
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts); chAssessDetailAccounts.setAssessAccountsId(assessAccountsId);
chAssessAccountsDetailMapper.insert(chAssessDetailAccounts);
}
} }
} }
private Long saveAssess(Integer aprOrganId, String assessCost,Integer modeId,Date evaluateDate) { private Long saveAssess(Integer aprOrganId, String assessCost,Integer modeId,Date evaluateDate) {
Long assessAccountsId; Long assessAccountsId = null;
AssessIdAndCostVO assessIdAndCostVO = chAssessAccountsMapper.queryAssessByOrganIdAndTime(String.valueOf(aprOrganId), DateUtils.dateToStrYm(evaluateDate),String.valueOf(modeId)); AssessIdAndCostVO assessIdAndCostVO = chAssessAccountsMapper.queryAssessByOrganIdAndTime(String.valueOf(aprOrganId), DateUtils.dateToStrYm(evaluateDate),String.valueOf(modeId));
if(assessIdAndCostVO!=null && assessIdAndCostVO.getAccountsStatus()==2){
log.info("{},已完成审核,不再进行评估结算",assessIdAndCostVO.getAssessAccountsId());
return assessAccountsId;
}
if (assessIdAndCostVO == null) { if (assessIdAndCostVO == null) {
ChAssessAccounts chAssessAccounts = new ChAssessAccounts(); ChAssessAccounts chAssessAccounts = new ChAssessAccounts();
chAssessAccounts.setAccountsTime(evaluateDate); chAssessAccounts.setAccountsTime(evaluateDate);
...@@ -348,6 +366,19 @@ public class TaskServiceImpl implements TaskService { ...@@ -348,6 +366,19 @@ public class TaskServiceImpl implements TaskService {
chAprReport.setEvaluateTime(evaluateDate); chAprReport.setEvaluateTime(evaluateDate);
chAprReport.setEvaluateType(vo.getEvaluateType()); chAprReport.setEvaluateType(vo.getEvaluateType());
aprReportMapper.updateById(chAprReport); aprReportMapper.updateById(chAprReport);
// 2023-3-20 新增
// 更新评定任务状态为已完成,并记录完成时间
ChAprTask task = new ChAprTask();
task.setTaskId(chAprReport.getTaskId());
task.setFinishTime(new Date());
task.setTaskStatus(3); // 已完成
taskMapper.updateById(task);
if(2 == vo.getEvaluateType()){
ChAprTask chAprTask = taskMapper.selectById(chAprReport.getTaskId());
Integer disableInfoId = chAprTask.getDisableInfoId();
taskMapper.insertSrvSend(disableInfoId);
}
//附件上传 //附件上传
this.updateAttachs(vo.getFileDataList(), chAprReport.getReportId().longValue()); this.updateAttachs(vo.getFileDataList(), chAprReport.getReportId().longValue());
//修改鉴定报告人员(有就update,没有就insert) //修改鉴定报告人员(有就update,没有就insert)
...@@ -402,7 +433,14 @@ public class TaskServiceImpl implements TaskService { ...@@ -402,7 +433,14 @@ public class TaskServiceImpl implements TaskService {
} }
} }
// 评估结算
ReportDetailVO reportDetailVO = new ReportDetailVO();
reportDetailVO.setCertiCode(vo.getCertiCode());
reportDetailVO.setPerson1(vo.getPerson1());
reportDetailVO.setPerson2(vo.getPerson2());
reportDetailVO.setDisableLevelId(vo.getDisableLevelId());
reportDetailVO.setEvaluateTime(vo.getEvaluateTime());
assessAccount(reportDetailVO);
} }
/** /**
...@@ -447,8 +485,28 @@ public class TaskServiceImpl implements TaskService { ...@@ -447,8 +485,28 @@ public class TaskServiceImpl implements TaskService {
taskMapper.updateById(task); taskMapper.updateById(task);
//更新失能人员信息 //更新失能人员信息
ChDisableInfo chDisableInfo = disableInfoMapper.selectById(task.getDisableInfoId()); ChDisableInfo chDisableInfo = disableInfoMapper.selectById(task.getDisableInfoId());
chDisableInfo.setLastTaskId(task.getTaskId()); if(chDisableInfo!=null){
disableInfoMapper.updateById(chDisableInfo); chDisableInfo.setLastTaskId(task.getTaskId());
disableInfoMapper.updateById(chDisableInfo);
}
//插入评定任报告 2023-03-20
ChAprReport report = new ChAprReport();
report.setTaskId(task.getTaskId());
report.setEffTime(new Date());
report.setFcd(new Date());
report.setStatus(0);
aprReportMapper.insert(report);
ChAprPersonInfo person1Info = new ChAprPersonInfo();
person1Info.setReportId(report.getReportId());
if(StringUtils.isNotEmpty(empId)) {
person1Info.setEmpId(Integer.parseInt(empId));
}
person1Info.setFcd(new Date());
personInfoMapper.insert(person1Info);
//生成组 //生成组
ChAprTaskPush taskPush = new ChAprTaskPush(); ChAprTaskPush taskPush = new ChAprTaskPush();
taskPush.setAssignTime(new Date()); taskPush.setAssignTime(new Date());
...@@ -815,8 +873,8 @@ public class TaskServiceImpl implements TaskService { ...@@ -815,8 +873,8 @@ public class TaskServiceImpl implements TaskService {
} }
@Override @Override
public Workbook aprEmpExport(String provincial, String city, String area, String organName, String name, String tel, String groupLeader) { public Workbook aprEmpExport(String provincial, String city, String area, String organName, String name, String tel, String certiCode,String isLock,String empType, String groupLeader) {
List<AprEmpExportVO> aprEmpExportList = taskMapper.aprEmpExportList(provincial, city, area, organName, name, tel, groupLeader); List<AprEmpExportVO> aprEmpExportList = taskMapper.aprEmpExportList(provincial, city, area, organName, name, tel,certiCode, isLock,empType, groupLeader);
for (AprEmpExportVO record : aprEmpExportList) { for (AprEmpExportVO record : aprEmpExportList) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
if(org.springframework.util.StringUtils.isEmpty(record.getDistrictProvincial())){ if(org.springframework.util.StringUtils.isEmpty(record.getDistrictProvincial())){
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.hungraim.ltc.dao.ChAssessAccountsMapper"> <mapper namespace="com.hungraim.ltc.dao.ChAssessAccountsMapper">
<select id="queryAssessByOrganIdAndTime" resultType="com.hungraim.ltc.pojo.vo.assessment.AssessIdAndCostVO"> <select id="queryAssessByOrganIdAndTime" resultType="com.hungraim.ltc.pojo.vo.assessment.AssessIdAndCostVO">
select a.ASSESS_ACCOUNTS_ID assessAccountsId,a.ASSESS_ALL_COST assessAllCost from select a.ASSESS_ACCOUNTS_ID assessAccountsId,a.ASSESS_ALL_COST assessAllCost,a.ACCOUNTS_STATUS accountsStatus from
CH_ASSESS_ACCOUNTS a where a.APR_ORGAN_ID = #{aprOrganId} CH_ASSESS_ACCOUNTS a where a.APR_ORGAN_ID = #{aprOrganId}
and to_char(a.ACCOUNTS_TIME,'yyyy-MM') = #{accountsTime} and to_char(a.ACCOUNTS_TIME,'yyyy-MM') = #{accountsTime}
and a.MODE_ID = #{modeId} and a.MODE_ID = #{modeId}
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
organ.organ_name assessOrganName, organ.organ_name assessOrganName,
to_char(d.ACCOUNTS_TIME,'yyyy-MM') accountsTime, to_char(d.ACCOUNTS_TIME,'yyyy-MM') accountsTime,
(select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea, (select district_name from ch_fnd_district dis where apply.MEDICAL_AREA = dis.district_code) medicalArea,
(select type.APREMP_NAME from CH_CFG_APREMP_TYPE type where type.APREMP_TYPE_ID = emp.APREMP_TYPE_ID_S) aprempTypeS,
to_char(d.assess_time,'yyyy-MM-dd') assessTime, to_char(d.assess_time,'yyyy-MM-dd') assessTime,
emp.REAL_NAME empName emp.REAL_NAME empName
from CH_ASSESS_ACCOUNTS_DETAIL d from CH_ASSESS_ACCOUNTS_DETAIL d
...@@ -23,12 +24,13 @@ from CH_ASSESS_ACCOUNTS_DETAIL d ...@@ -23,12 +24,13 @@ from CH_ASSESS_ACCOUNTS_DETAIL d
<select id="assessAccountDetailExport" resultType="com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp"> <select id="assessAccountDetailExport" resultType="com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp">
SELECT SELECT
t2.REAL_NAME realName, t2.REAL_NAME realName,
(select type.APREMP_NAME from CH_CFG_APREMP_TYPE type where type.APREMP_TYPE_ID = t4.APREMP_TYPE_ID_S) aprempTypeS,
t3.ORGAN_NAME organName, t3.ORGAN_NAME organName,
to_char(t1.ACCOUNTS_TIME,'yyyy-MM') accountsTime, to_char(t1.ACCOUNTS_TIME,'yyyy-MM') accountsTime,
t1.ASSESS_COST assessCost, t1.ASSESS_COST assessCost,
to_char(t1.assess_time,'yyyy-MM-dd') assessTime, to_char(t1.assess_time,'yyyy-MM-dd') assessTime,
t4.REAL_NAME empName, t4.REAL_NAME empName,
(select district_name from ch_fnd_district dis where t2.MEDICAL_AREA = dis.district_code) medicalArea, (select district_name from ch_fnd_district dis where t2.MEDICAL_AREA = dis.district_code) medicalArea
FROM FROM
CH_ASSESS_ACCOUNTS_DETAIL t1 CH_ASSESS_ACCOUNTS_DETAIL t1
left join CH_DISABLE_APPLY t2 on t1.APPLY_ID = t2.APPLY_ID left join CH_DISABLE_APPLY t2 on t1.APPLY_ID = t2.APPLY_ID
...@@ -36,7 +38,5 @@ FROM ...@@ -36,7 +38,5 @@ FROM
left join CH_APR_EMP t4 on t4.EMP_ID = t1.EMP_ID left join CH_APR_EMP t4 on t4.EMP_ID = t1.EMP_ID
where t1.ASSESS_ACCOUNTS_ID = #{assessAccountsId} where t1.ASSESS_ACCOUNTS_ID = #{assessAccountsId}
</select> </select>
</mapper> </mapper>
...@@ -151,6 +151,7 @@ ...@@ -151,6 +151,7 @@
(SELECT dis.DISTRICT_NAME FROM CH_FND_DISTRICT dis WHERE info.acpt_srv_area = dis.DISTRICT_CODE) acptSrvArea, (SELECT dis.DISTRICT_NAME FROM CH_FND_DISTRICT dis WHERE info.acpt_srv_area = dis.DISTRICT_CODE) acptSrvArea,
info.ACPT_SRV_ADDRESS acptSrvAddress,--接受服务地址详细地址 info.ACPT_SRV_ADDRESS acptSrvAddress,--接受服务地址详细地址
info.ACPT_ADDRESS acptAddress,--接受评定详细地址 info.ACPT_ADDRESS acptAddress,--接受评定详细地址
info.ADRESS_DETAIL operAddress,
lev.DISABLE_LEVEL_NAME riskLevel, lev.DISABLE_LEVEL_NAME riskLevel,
report.EFF_TIME effTime,report.EVALUATE_TYPE report.EFF_TIME effTime,report.EVALUATE_TYPE
FROM ch_apr_report report FROM ch_apr_report report
...@@ -494,7 +495,9 @@ ...@@ -494,7 +495,9 @@
emp.AGE age, emp.AGE age,
emp.certi_code certiCode, emp.certi_code certiCode,
emp.tel tel, emp.tel tel,
DECODE(emp.Group_leader, '0','组长','1', '非组长') groupLeader DECODE(emp.EMP_TYPE, '0','评定人员','1', '管理人员','2','医生','3','护士') empType,
DECODE(emp.Group_leader, '0','组长','1', '非组长') groupLeader,
DECODE(emp.IS_LOCK, '0','有效','1', '失效') isLock
FROM ch_apr_emp emp FROM ch_apr_emp emp
LEFT JOIN ch_apr_organ organ ON emp.apr_organ_id = organ.apr_organ_id LEFT JOIN ch_apr_organ organ ON emp.apr_organ_id = organ.apr_organ_id
LEFT JOIN ch_srv_organ srvOrgan ON organ.organ_id = srvOrgan.srv_organ_id LEFT JOIN ch_srv_organ srvOrgan ON organ.organ_id = srvOrgan.srv_organ_id
...@@ -515,15 +518,31 @@ ...@@ -515,15 +518,31 @@
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and emp.real_name like CONCAT(CONCAT('%',#{name}) ,'%') and emp.real_name like CONCAT(CONCAT('%',#{name}) ,'%')
</if> </if>
<if test="certiCode != null and certiCode != ''">
and emp.certi_code = #{certiCode}
</if>
<if test="tel != null and tel != ''"> <if test="tel != null and tel != ''">
and emp.tel = #{tel} and emp.tel = #{tel}
</if> </if>
<if test="groupLeader != null and groupLeader != ''"> <if test="groupLeader != null and groupLeader != ''">
and emp.group_leader = #{groupLeader} and emp.group_leader = #{groupLeader}
</if> </if>
<if test="empType != null and empType != ''">
and emp.emp_type = #{empType}
</if>
<if test="isLock != null and isLock != ''">
and emp.is_lock = #{isLock}
</if>
</where> </where>
</select> </select>
<insert id="insertSrvSend">
insert INTO ch_srv_send(SRV_SEND_ID,DISAB_INFO_ID,FCD,STATUS) values
((SELECT max(srv_send_id)+1 id from CH_SRV_SEND),#{disableInfoId},SYSDATE,0)
</insert>
<select id="selectDisableBycertiCode" resultType="com.hungraim.ltc.pojo.entity.disable.ChDisableInfo">
select * from CH_DISABLE_INFO info where info.CERTI_CODE = #{certiCode} and rownum = 1 order by info.FCD desc
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -6,6 +6,7 @@ import com.hungraim.ltc.util.Result; ...@@ -6,6 +6,7 @@ import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode; import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.jwt.JwtHelper; import org.springframework.security.jwt.JwtHelper;
import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2AccessToken;
...@@ -30,14 +31,18 @@ public class AuthController { ...@@ -30,14 +31,18 @@ public class AuthController {
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final TokenEndpoint tokenEndpoint; private final TokenEndpoint tokenEndpoint;
@Autowired
private CsoftSecurityUtil csoftSecurityUtil;
@PostMapping("/token") @PostMapping("/token")
@SneakyThrows @SneakyThrows
public Result<OAuth2AccessToken> postAccessToken(Principal principal, @RequestParam Map<String, String> parameters) { public Result<OAuth2AccessToken> postAccessToken(Principal principal, @RequestParam Map<String, String> parameters,String publicKeyString) {
String password = parameters.get("password"); String password = parameters.get("password");
if(FALSE.equals(password)){ if(FALSE.equals(password)){
return Result.failed(ResultCode.USER_LOGIN_ERROR); return Result.failed(ResultCode.USER_LOGIN_ERROR);
} }
String decrypt = CsoftSecurityUtil.decryptRSADefault(password); String decrypt = csoftSecurityUtil.decryptRSADefault(password,publicKeyString);
parameters.put("password", decrypt); parameters.put("password", decrypt);
OAuth2AccessToken oAuth2AccessToken = tokenEndpoint.postAccessToken(principal, parameters).getBody(); OAuth2AccessToken oAuth2AccessToken = tokenEndpoint.postAccessToken(principal, parameters).getBody();
return Result.success(oAuth2AccessToken); return Result.success(oAuth2AccessToken);
...@@ -49,7 +54,7 @@ public class AuthController { ...@@ -49,7 +54,7 @@ public class AuthController {
*/ */
@GetMapping("/genKeyPair") @GetMapping("/genKeyPair")
public Result<String> genKeyPair() { public Result<String> genKeyPair() {
Map keyMap = CsoftSecurityUtil.createKeyPairs(); Map keyMap = csoftSecurityUtil.createKeyPairs();
return Result.success(keyMap.get(0).toString()); return Result.success(keyMap.get(0).toString());
} }
......
...@@ -16,10 +16,11 @@ public class NursingReqVO extends BaseReq { ...@@ -16,10 +16,11 @@ public class NursingReqVO extends BaseReq {
private String disabInfoId; private String disabInfoId;
private String modeId;
private String modeName; private String modeName;
private String modeId;
private String srvOrganId; private String srvOrganId;
......
...@@ -65,4 +65,6 @@ public class OverallCostListRespVO { ...@@ -65,4 +65,6 @@ public class OverallCostListRespVO {
private String srvOrganName; private String srvOrganName;
private String accountsStatus; private String accountsStatus;
private String remarks;
} }
...@@ -32,4 +32,6 @@ public class OverallCostReqVO extends BaseReq { ...@@ -32,4 +32,6 @@ public class OverallCostReqVO extends BaseReq {
private Integer dealType; private Integer dealType;
private Long srvOrganId;
} }
...@@ -37,6 +37,11 @@ public class ChAssessDetailAccountsResp implements Serializable { ...@@ -37,6 +37,11 @@ public class ChAssessDetailAccountsResp implements Serializable {
*/ */
private String medicalArea; private String medicalArea;
/**
* 评定资质
*/
private String aprempTypeS;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -628,11 +628,20 @@ public class ChDisableApply extends PageInfo implements Serializable { ...@@ -628,11 +628,20 @@ public class ChDisableApply extends PageInfo implements Serializable {
private Integer exitFlag; private Integer exitFlag;
/**
* 1, 死亡
* 2, "复评未通过" },//需要重新首次录入-->评估
* 3, 退保
* 4, 转入医保
* 5, 异地
* 6, 更换其他机构
* 7, 其他
**/
private Integer exitReasonId; private Integer exitReasonId;
private Integer exitSrvOrganId; private Integer exitSrvOrganId;
private Date exitTime; private Date exitTime;
@TableField(exist = false) @TableField(exist = false)
private List<ChFndAttach> fileDataList; private List<ChFndAttach> fileDataList;
......
package com.hungraim.ltc.pojo.entity.disable;
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 org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author zwl
* @ClassName ChDisableExit
* @description
* @date 2023/3/10 16:20
**/
@Data
@TableName("CH_DISABLE_EXIT")
@KeySequence(value = "SEQ_CH_DISABLE_EXIT")
public class ChDisableExit {
@TableId(value = "DISAB_EXIT_ID", type = IdType.INPUT)
private Integer disabExitId;
private Integer disabInfoId;
private Integer srvOrganId;
private Integer exitReasonId;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date exitTime;
}
...@@ -130,6 +130,15 @@ public class ChDisableInfo extends PageInfo implements Serializable { ...@@ -130,6 +130,15 @@ public class ChDisableInfo extends PageInfo implements Serializable {
private String tel; private String tel;
private String acptSrvArea; private String acptSrvArea;
private Integer exitFlag; private Integer exitFlag;
/**
* 1, 死亡
* 2, "复评未通过" },//需要重新首次录入-->评估
* 3, 退保
* 4, 转入医保
* 5, 异地
* 6, 更换其他机构
* 7, 其他
**/
private Integer exitReasonId; private Integer exitReasonId;
private Integer exitSrvOrganId; private Integer exitSrvOrganId;
private java.util.Date exitTime; private java.util.Date exitTime;
......
...@@ -93,7 +93,7 @@ public class ChSrvSend implements Serializable { ...@@ -93,7 +93,7 @@ public class ChSrvSend implements Serializable {
private Long lcu; private Long lcu;
/** /**
* 服务分配状态 未分配 0 已分配 1 已终止 2 * 服务分配状态 未分配 0 已分配 1 已终止 2 已退出 3
*/ */
private Short status; private Short status;
......
...@@ -22,6 +22,8 @@ public class ReportUpdateVO { ...@@ -22,6 +22,8 @@ public class ReportUpdateVO {
Integer disableLevelId; Integer disableLevelId;
String polNo; String polNo;
String remark; String remark;
String certiCode;
String applyId;
Integer evaluateType; Integer evaluateType;
List<ChFndAttach> fileDataList; List<ChFndAttach> fileDataList;
List<ChAprReportFraction> chAprReportFractions; List<ChAprReportFraction> chAprReportFractions;
......
...@@ -24,6 +24,9 @@ public class AssessAccountsExportResp { ...@@ -24,6 +24,9 @@ public class AssessAccountsExportResp {
@Excel(name = "评定人员姓名",width = 20) @Excel(name = "评定人员姓名",width = 20)
private String empName; private String empName;
@Excel(name = "评定资质",width = 20)
private String aprempTypeS;
@Excel(name = "评估时间",width = 20) @Excel(name = "评估时间",width = 20)
private String assessTime; private String assessTime;
......
...@@ -24,6 +24,8 @@ public class SrvOrganListReq extends BaseReq { ...@@ -24,6 +24,8 @@ public class SrvOrganListReq extends BaseReq {
*/ */
private Long srvOrganId; private Long srvOrganId;
private String modeId;
/** /**
* 护理机构id * 护理机构id
......
...@@ -18,4 +18,6 @@ public class SrvTaskReqVO extends BaseReq { ...@@ -18,4 +18,6 @@ public class SrvTaskReqVO extends BaseReq {
private String status; private String status;
private String srvOrganName; private String srvOrganName;
private Long srvOrganId;
} }
...@@ -41,9 +41,15 @@ public class AprEmpExportVO { ...@@ -41,9 +41,15 @@ public class AprEmpExportVO {
@Excel(name = "评定人员手机号码",width = 20) @Excel(name = "评定人员手机号码",width = 20)
private String tel; private String tel;
@Excel(name = "人员类型",width = 20)
private String empType;
@Excel(name = "是否组长") @Excel(name = "是否组长")
private String groupLeader; private String groupLeader;
@Excel(name = "状态")
private String isLock;
private String districtCity; private String districtCity;
} }
...@@ -10,4 +10,6 @@ public class AssessIdAndCostVO { ...@@ -10,4 +10,6 @@ public class AssessIdAndCostVO {
private Long assessAccountsId; private Long assessAccountsId;
private BigDecimal assessAllCost; private BigDecimal assessAllCost;
private Integer accountsStatus;
} }
...@@ -15,7 +15,12 @@ public class ReportDetailVO { ...@@ -15,7 +15,12 @@ public class ReportDetailVO {
Integer person3; Integer person3;
String evaluateTime; String evaluateTime;
Integer disableLevelId; Integer disableLevelId;
/**
* 现住址
*/
String operAddress;
String applyId; String applyId;
String certiCode;
String polNo; String polNo;
String remark; String remark;
Integer evaluateType; Integer evaluateType;
......
...@@ -56,6 +56,7 @@ public class TaskReportVO { ...@@ -56,6 +56,7 @@ public class TaskReportVO {
private String adressDistrictProvincial; private String adressDistrictProvincial;
private String adressDistrictCity; private String adressDistrictCity;
private String adressDistrictCode; private String adressDistrictCode;
private String operAddress;
//失能人员接受评定地址 //失能人员接受评定地址
private String acptProvincial; private String acptProvincial;
private String acptCity; private String acptCity;
......
...@@ -15,8 +15,10 @@ public class SrvOrganEmpExportVo { ...@@ -15,8 +15,10 @@ public class SrvOrganEmpExportVo {
@Excel(name = "适用机构名称",width = 20) @Excel(name = "适用机构名称",width = 20)
private String organName; private String organName;
/*
@Excel(name = "机构地址",width = 20) @Excel(name = "机构地址",width = 20)
private String provinCialcityArea; private String provinCialcityArea;
*/
@Excel(name = "护理机构名称",width = 20) @Excel(name = "护理机构名称",width = 20)
private String srvOrganName; private String srvOrganName;
...@@ -24,8 +26,24 @@ public class SrvOrganEmpExportVo { ...@@ -24,8 +26,24 @@ public class SrvOrganEmpExportVo {
@Excel(name = "统一社会信用代码",width = 20) @Excel(name = "统一社会信用代码",width = 20)
private String unifiedSocialCreditCode; private String unifiedSocialCreditCode;
@Excel(name = "联系人姓名",width = 20)
private String linkName; @Excel(name = "护理人员姓名",width = 20)
private String empName;
@Excel(name = "护理人员性别")
private String gender;
@Excel(name = "护理人员年龄")
private String age;
@Excel(name = "护理人员证件号码",width = 20)
private String certifNum;
@Excel(name = "护理人员手机号码" ,width = 20)
private String mobilePhone;
/* @Excel(name = "联系人姓名",width = 20)
private String linkName;*/
@Excel(name = "联系人电话",width = 20) @Excel(name = "联系人电话",width = 20)
......
...@@ -60,7 +60,7 @@ public class ProgramSetAndProjectVo { ...@@ -60,7 +60,7 @@ public class ProgramSetAndProjectVo {
/** /**
* 是否配置 (是:1;否:0) * 是否配置 (是:1;否:0)
*/ */
private Short isConf = 1; private Short isConf;
/** /**
* 计划频次 * 计划频次
......
...@@ -20,7 +20,9 @@ import java.util.HashMap; ...@@ -20,7 +20,9 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.crypto.BadPaddingException; import javax.crypto.BadPaddingException;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException; import javax.crypto.IllegalBlockSizeException;
...@@ -37,6 +39,7 @@ import org.apache.commons.codec.digest.DigestUtils; ...@@ -37,6 +39,7 @@ import org.apache.commons.codec.digest.DigestUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
/** /**
* @Description: 中研通用加密工具 RSA+ASE+SHA256(非对称加密(对称秘钥),对称加密数据,Sha256消息摘要,RSA签名) * @Description: 中研通用加密工具 RSA+ASE+SHA256(非对称加密(对称秘钥),对称加密数据,Sha256消息摘要,RSA签名)
...@@ -44,11 +47,15 @@ import com.alibaba.fastjson.JSONObject; ...@@ -44,11 +47,15 @@ import com.alibaba.fastjson.JSONObject;
* @version 1.0 * @version 1.0
*/ */
@Slf4j @Slf4j
@Component
public class CsoftSecurityUtil { public class CsoftSecurityUtil {
private static Map<Integer, String> keyMap = new HashMap<>(); // 用于封装随机产生的公钥与私钥 private static Map<Integer, String> keyMap = new HashMap<>(); // 用于封装随机产生的公钥与私钥
@Resource
private RedisCache redisCache;
// 加密数据和秘钥的编码方式 // 加密数据和秘钥的编码方式
public static final String UTF_8 = "UTF-8"; public static final String UTF_8 = "UTF-8";
...@@ -304,7 +311,7 @@ public class CsoftSecurityUtil { ...@@ -304,7 +311,7 @@ public class CsoftSecurityUtil {
* 创建RSA的公钥和私钥示例 将生成的公钥和私钥用Base64编码后打印出来 * 创建RSA的公钥和私钥示例 将生成的公钥和私钥用Base64编码后打印出来
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
*/ */
public static Map createKeyPairs() { public Map createKeyPairs() {
try { try {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(2048); keyPairGenerator.initialize(2048);
...@@ -315,6 +322,9 @@ public class CsoftSecurityUtil { ...@@ -315,6 +322,9 @@ public class CsoftSecurityUtil {
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
String publicKeyString = new String(Base64.encodeBase64(publicKey.getEncoded())); String publicKeyString = new String(Base64.encodeBase64(publicKey.getEncoded()));
String privateKeyString = new String(Base64.encodeBase64((privateKey.getEncoded()))); String privateKeyString = new String(Base64.encodeBase64((privateKey.getEncoded())));
log.info("公钥:{}",publicKeyString);
log.info("私钥:{}",privateKeyString);
redisCache.setCacheObject(publicKeyString,privateKeyString,1, TimeUnit.DAYS);
keyMap.put(0, publicKeyString); //0表示公钥 keyMap.put(0, publicKeyString); //0表示公钥
keyMap.put(1, privateKeyString); //1表示私钥 keyMap.put(1, privateKeyString); //1表示私钥
}catch (NoSuchAlgorithmException e){ }catch (NoSuchAlgorithmException e){
...@@ -337,15 +347,15 @@ public class CsoftSecurityUtil { ...@@ -337,15 +347,15 @@ public class CsoftSecurityUtil {
* @throws IllegalBlockSizeException * @throws IllegalBlockSizeException
* @throws BadPaddingException * @throws BadPaddingException
*/ */
public static String decryptRSADefault(String data) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException { public String decryptRSADefault(String data,String publicKeyString) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM_NOPADDING); KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM_NOPADDING);
byte[] privateKeyArray = keyMap.get(1).getBytes(); String privateKeyString =redisCache.getCacheObject(publicKeyString);
byte[] dataArray = data.getBytes(); byte[] privateKeyArray =privateKeyString.getBytes();
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyArray)); byte[] dataArray = data.getBytes();
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyArray));
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM_NOPADDING); Cipher cipher = Cipher.getInstance(RSA_ALGORITHM_NOPADDING);
cipher.init(Cipher.DECRYPT_MODE, privateKey); cipher.init(Cipher.DECRYPT_MODE, privateKey);
return new String(cipher.doFinal(Base64.decodeBase64(dataArray)), UTF_8); return new String(cipher.doFinal(Base64.decodeBase64(dataArray)), UTF_8);
} }
......
...@@ -945,4 +945,25 @@ public class DateUtils { ...@@ -945,4 +945,25 @@ public class DateUtils {
return dateString; return dateString;
} }
/**
* 判断日期是不是今天
* @param date
* @return 是返回true,不是返回false
*/
public static boolean isNow(Date date) {
// 当前时间
Date now = new Date();
SimpleDateFormat sf = new SimpleDateFormat(DATE_PATTERN_yyyy_MM_dd);
//获取今天的日期
String nowDay = sf.format(now);
//对比的时间
String day = sf.format(date);
return day.equals(nowDay);
}
} }
package com.hungraim.ltc.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* @author root
*/
@Component
public class RedisCache {
@Autowired
public RedisTemplate redisTemplate;
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
*/
public <T> void setCacheObject(final String key, final T value)
{
redisTemplate.opsForValue().set(key, value);
}
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
* @param timeout 时间
* @param timeUnit 时间颗粒度
*/
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
{
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @return true=设置成功;false=设置失败
*/
public boolean expire(final String key, final long timeout)
{
return expire(key, timeout, TimeUnit.SECONDS);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @param unit 时间单位
* @return true=设置成功;false=设置失败
*/
public boolean expire(final String key, final long timeout, final TimeUnit unit)
{
return redisTemplate.expire(key, timeout, unit);
}
/**
* 获得缓存的基本对象。
*
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
public <T> T getCacheObject(final String key)
{
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
/**
* 删除单个对象
*
* @param key
*/
public boolean deleteObject(final String key)
{
return redisTemplate.delete(key);
}
/**
* 删除集合对象
*
* @param collection 多个对象
* @return
*/
public long deleteObject(final Collection collection)
{
return redisTemplate.delete(collection);
}
/**
* 缓存List数据
*
* @param key 缓存的键值
* @param dataList 待缓存的List数据
* @return 缓存的对象
*/
public <T> long setCacheList(final String key, final List<T> dataList)
{
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count;
}
/**
* 获得缓存的list对象
*
* @param key 缓存的键值
* @return 缓存键值对应的数据
*/
public <T> List<T> getCacheList(final String key)
{
return redisTemplate.opsForList().range(key, 0, -1);
}
/**
* 缓存Set
*
* @param key 缓存键值
* @param dataSet 缓存的数据
* @return 缓存数据的对象
*/
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
{
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
Iterator<T> it = dataSet.iterator();
while (it.hasNext())
{
setOperation.add(it.next());
}
return setOperation;
}
/**
* 获得缓存的set
*
* @param key
* @return
*/
public <T> Set<T> getCacheSet(final String key)
{
return redisTemplate.opsForSet().members(key);
}
/**
* 缓存Map
*
* @param key
* @param dataMap
*/
public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
{
if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap);
}
}
/**
* 获得缓存的Map
*
* @param key
* @return
*/
public <T> Map<String, T> getCacheMap(final String key)
{
return redisTemplate.opsForHash().entries(key);
}
/**
* 往Hash中存入数据
*
* @param key Redis键
* @param hKey Hash键
* @param value 值
*/
public <T> void setCacheMapValue(final String key, final String hKey, final T value)
{
redisTemplate.opsForHash().put(key, hKey, value);
}
/**
* 获取Hash中的数据
*
* @param key Redis键
* @param hKey Hash键
* @return Hash中的对象
*/
public <T> T getCacheMapValue(final String key, final String hKey)
{
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey);
}
/**
* 删除Hash中的数据
*
* @param key
* @param hkey
*/
public void delCacheMapValue(final String key, final String hkey)
{
HashOperations hashOperations = redisTemplate.opsForHash();
hashOperations.delete(key, hkey);
}
/**
* 获取多个Hash中的数据
*
* @param key Redis键
* @param hKeys Hash键集合
* @return Hash对象集合
*/
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
{
return redisTemplate.opsForHash().multiGet(key, hKeys);
}
/**
* 获得缓存的基本对象列表
*
* @param pattern 字符串前缀
* @return 对象列表
*/
public Collection<String> keys(final String pattern)
{
return redisTemplate.keys(pattern);
}
}
package com.hungraim.ltc.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/**
* @author zwl
* @ClassName RedisLock
* @description
* @date 2023/3/19 22:04
**/
@Component
public class RedisLock {
@Autowired
private RedisTemplate redisTemplate;
/**
* 查询
*
* @param key 键
* @return 值
*/
public Object get(Object key) {
return redisTemplate.opsForValue().get(key);
}
/**
* 保存
*
* @param key 键
* @param value 值
* @param expire 失效时长
* @param unit 失效时长的单位
*/
public void set(Object key, Object value, long expire, TimeUnit unit) {
if (expire > 0) {
redisTemplate.opsForValue().set(key, value, expire, unit);
}
}
/**
* 线程等待
*
* @param millis
*/
private void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
// do nothing
}
}
/**
* 尝试加锁
*
* @param key
* @param expireMilliseconds 锁超时时长,单位:毫秒
* @param retryTimes 重试次数,每秒重试 1 次
* @return
*/
public boolean tryLock(Object key, long expireMilliseconds, long retryTimes) {
for (long i = 1; i <= retryTimes; i++) {
if (tryLock(key, expireMilliseconds)) {
return true;
} else if (i != retryTimes) {
sleep(1000);
}
}
return false;
}
/**
* 尝试加锁
*
* @param key
* @param expireMilliseconds 锁超时时长,单位:毫秒
* @return
*/
public boolean tryLock(Object key, long expireMilliseconds) {
String expireAt = String.valueOf(System.currentTimeMillis() + expireMilliseconds + 1);
Boolean acquire = redisTemplate.opsForValue().setIfAbsent(key, expireAt, expireMilliseconds, TimeUnit.MILLISECONDS);
if (acquire != null) {
return acquire;
} else {
return false;
}
}
/**
* 删除锁
*
* @param key
* @return
*/
public boolean delLock(Object key) {
return redisTemplate.delete(key);
}
/**
* 删除缓存
*
* @param key
* @return
*/
public boolean delete(Object key) {
return redisTemplate.delete(key);
}
}
...@@ -125,7 +125,8 @@ public class AprOrganController { ...@@ -125,7 +125,8 @@ public class AprOrganController {
if (chAprOrgan.getOrganTypeId() == null) {//机构类型id if (chAprOrgan.getOrganTypeId() == null) {//机构类型id
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
if (StringUtils.isBlank(chAprOrgan.getAcptProvincial()) || StringUtils.isBlank(chAprOrgan.getAcptCity()) || StringUtils.isBlank(chAprOrgan.getAcptArea()) || StringUtils.isBlank(chAprOrgan.getAcptAddress()) || StringUtils.isBlank(chAprOrgan.getAcptStreet())) {//机构详细地址 //|| StringUtils.isBlank(chAprOrgan.getAcptStreet())
if (StringUtils.isBlank(chAprOrgan.getAcptProvincial()) || StringUtils.isBlank(chAprOrgan.getAcptCity()) || StringUtils.isBlank(chAprOrgan.getAcptArea()) || StringUtils.isBlank(chAprOrgan.getAcptAddress()) ) {//机构详细地址
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
if (StringUtils.isBlank(chAprOrgan.getLinkName())) {//机构联系人姓名 if (StringUtils.isBlank(chAprOrgan.getLinkName())) {//机构联系人姓名
...@@ -178,7 +179,8 @@ public class AprOrganController { ...@@ -178,7 +179,8 @@ public class AprOrganController {
if (chAprOrgan.getOrganTypeId() == null) {//机构类型id if (chAprOrgan.getOrganTypeId() == null) {//机构类型id
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
if (StringUtils.isBlank(chAprOrgan.getAcptArea()) || StringUtils.isBlank(chAprOrgan.getAcptAddress()) || StringUtils.isBlank(chAprOrgan.getAcptStreet())) {//机构详细地址 //|| StringUtils.isBlank(chAprOrgan.getAcptStreet())
if (StringUtils.isBlank(chAprOrgan.getAcptArea()) || StringUtils.isBlank(chAprOrgan.getAcptAddress()) ) {//机构详细地址
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
if (StringUtils.isBlank(chAprOrgan.getLinkName())) {//机构联系人姓名 if (StringUtils.isBlank(chAprOrgan.getLinkName())) {//机构联系人姓名
......
package com.hungraim.ltc.governance.controller; package com.hungraim.ltc.governance.controller;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.dao.ChSrvSendMapper;
import com.hungraim.ltc.governance.service.*; import com.hungraim.ltc.governance.service.*;
import com.hungraim.ltc.pojo.entity.account.ChPunchDetailsVO; import com.hungraim.ltc.pojo.entity.account.ChPunchDetailsVO;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo; import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
...@@ -45,6 +47,9 @@ public class BuildBedController { ...@@ -45,6 +47,9 @@ public class BuildBedController {
@Autowired @Autowired
private IRemoveBedService removeBedService; private IRemoveBedService removeBedService;
@Autowired
private ChSrvSendMapper chSrvSendMapper;
/** /**
* 建床管理列表 * 建床管理列表
...@@ -209,7 +214,9 @@ public class BuildBedController { ...@@ -209,7 +214,9 @@ public class BuildBedController {
if (StrUtil.isBlankIfStr(disableInfoVo.getDisableInfoId())) { if (StrUtil.isBlankIfStr(disableInfoVo.getDisableInfoId())) {
return Result.failed("失能人员id不能为空"); return Result.failed("失能人员id不能为空");
} }
Page<DisableInfoVo> disableInfoVos = disableInfoServie.querySrvYet(disableInfoVo.getDisableInfoId(), disableInfoVo.getCurrent(), disableInfoVo.getLimit()); Integer status = disableInfoVo.getStatus();
Integer sendId = disableInfoVo.getSrvSendId();
Page<DisableInfoVo> disableInfoVos = disableInfoServie.querySrvYet(disableInfoVo.getDisableInfoId(), disableInfoVo.getCurrent(), disableInfoVo.getLimit(), status,sendId);
long total = disableInfoVos.getTotal(); long total = disableInfoVos.getTotal();
List<DisableInfoVo> records = disableInfoVos.getRecords(); List<DisableInfoVo> records = disableInfoVos.getRecords();
Map map = new HashMap<>(); Map map = new HashMap<>();
...@@ -232,6 +239,13 @@ public class BuildBedController { ...@@ -232,6 +239,13 @@ public class BuildBedController {
if (chSrvSend.getDisabInfoId() == null || chSrvSend.getSrvOrganId() == null || chSrvSend.getSrvModeId() == null) { if (chSrvSend.getDisabInfoId() == null || chSrvSend.getSrvOrganId() == null || chSrvSend.getSrvModeId() == null) {
return Result.failed("参数不全!"); return Result.failed("参数不全!");
} }
List<ChSrvSend> chSrvSendsList = chSrvSendMapper.selectList(new LambdaQueryWrapper<ChSrvSend>()
.eq(ChSrvSend::getDisabInfoId, disabInfoId)
.eq(ChSrvSend::getStatus, (short) 1));
if (chSrvSendsList.size() > 0) {
return Result.failed("已分配护理机构,请先终止或退出再操作");
}
chSrvSend.setAllotTime(new Date()); chSrvSend.setAllotTime(new Date());
chSrvSend.setStatus(Short.valueOf("1")); chSrvSend.setStatus(Short.valueOf("1"));
if (chrSrvVo.getSrvSendId() == null) { if (chrSrvVo.getSrvSendId() == null) {
...@@ -240,6 +254,8 @@ public class BuildBedController { ...@@ -240,6 +254,8 @@ public class BuildBedController {
id = 0L; id = 0L;
} }
chSrvSend.setSrvSendId(++id); chSrvSend.setSrvSendId(++id);
}else {
chSrvSend.setSrvSendId(chrSrvVo.getSrvSendId());
} }
sendService.saveOrUpdate(chSrvSend); sendService.saveOrUpdate(chSrvSend);
} }
...@@ -260,6 +276,7 @@ public class BuildBedController { ...@@ -260,6 +276,7 @@ public class BuildBedController {
return Result.failed("提交失败,服务分配记录不存在"); return Result.failed("提交失败,服务分配记录不存在");
} }
chSrvSend.setStopTime(saveStopTime.getStopTime()); chSrvSend.setStopTime(saveStopTime.getStopTime());
chSrvSend.setStatus((short)2);
sendService.updateById(chSrvSend); sendService.updateById(chSrvSend);
return Result.success(true); return Result.success(true);
} }
......
...@@ -16,7 +16,11 @@ import lombok.extern.slf4j.Slf4j; ...@@ -16,7 +16,11 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/api.governance/srvProgram") @RequestMapping("/api.governance/srvProgram")
...@@ -71,7 +75,7 @@ public class SrvProgramController { ...@@ -71,7 +75,7 @@ public class SrvProgramController {
* @return 返回个人照护方案列表 * @return 返回个人照护方案列表
*/ */
@RequestMapping("/programSetList") @RequestMapping("/programSetList")
public Result getProgramSetList(Integer pageNum, Integer pageSize, Long disabInfoId, Long srvOrganId) { public Result getProgramSetList(Integer pageNum, Integer pageSize, Long disabInfoId, Long srvOrganId,String status) {
if (pageNum == null || pageNum < 1 || disabInfoId == null || disabInfoId == 0 || srvOrganId == null || srvOrganId == 0) { if (pageNum == null || pageNum < 1 || disabInfoId == null || disabInfoId == 0 || srvOrganId == null || srvOrganId == 0) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
...@@ -79,7 +83,11 @@ public class SrvProgramController { ...@@ -79,7 +83,11 @@ public class SrvProgramController {
pageSize = 10; pageSize = 10;
} }
Page<ProgramListVo> page = new Page<>(pageNum, pageSize); Page<ProgramListVo> page = new Page<>(pageNum, pageSize);
page = srvProgramService.getProgramSetList(page, disabInfoId, srvOrganId, null); page = srvProgramService.getProgramSetList(page, disabInfoId, srvOrganId, status);
List<ProgramListVo> records = page.getRecords();
records =records.stream().collect(
Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingLong(ProgramListVo::getProgramId))), ArrayList::new));
page.setRecords(records);
return Result.success(page); return Result.success(page);
} }
...@@ -144,7 +152,7 @@ public class SrvProgramController { ...@@ -144,7 +152,7 @@ public class SrvProgramController {
} else { } else {
List<ProgramSetAndProjectVo> programSetAndProjectVos = programDetailVo.getProgramSetAndProjectVos(); List<ProgramSetAndProjectVo> programSetAndProjectVos = programDetailVo.getProgramSetAndProjectVos();
for (ProgramSetAndProjectVo programSetAndProjectVo : programSetAndProjectVos) { for (ProgramSetAndProjectVo programSetAndProjectVo : programSetAndProjectVos) {
if (programSetAndProjectVo.getIsConf().intValue() == 1 && programSetAndProjectVo.getPlanningFrequency() == null) { if (programSetAndProjectVo.getIsConf().intValue() == 1 && programSetAndProjectVo.getPlanningFrequency() == null&&programSetAndProjectVo.getPlanningFrequencyType()!= 2) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
} }
......
...@@ -2,8 +2,6 @@ package com.hungraim.ltc.governance.controller; ...@@ -2,8 +2,6 @@ package com.hungraim.ltc.governance.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.service.SrvTaskService; import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.vo.account.SrvTaskReqVO;
import com.hungraim.ltc.pojo.vo.account.SrvTaskRespVO;
import com.hungraim.ltc.pojo.vo.governance.*; import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode; import com.hungraim.ltc.util.ResultCode;
...@@ -11,7 +9,6 @@ import lombok.extern.slf4j.Slf4j; ...@@ -11,7 +9,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date; import java.util.Date;
...@@ -149,8 +146,12 @@ public class SrvTaskController { ...@@ -149,8 +146,12 @@ public class SrvTaskController {
* 根据计划开始时间每天执行当天计划 * 根据计划开始时间每天执行当天计划
**/ **/
@GetMapping("timeAllocationSrvTask") @GetMapping("timeAllocationSrvTask")
public void timeAllocationSrvTask() { public Result timeAllocationSrvTask(String dateStr) {
srvTaskService.timeAllocationSrvTask(); if (StringUtils.isEmpty(dateStr)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
srvTaskService.timeAllocationSrvTask(dateStr);
return Result.success();
} }
} }
package com.hungraim.ltc.governance.controller;
import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.redis.RedisLock;
import com.hungraim.ltc.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* @author zwl
* @ClassName SrvTaskScheduledController
* @description
* @date 2023/3/9 21:08
**/
@Component
@EnableAsync
@Slf4j
public class SrvTaskScheduledController {
@Autowired
private SrvTaskService srvTaskService;
@Autowired
private RedisLock redisLock;
public static final String JOB_KEY = "redis.job.task:srvTask";
@Scheduled(cron = "0 35 23 * * ?")
public void timeAllocationSrvTask() {
boolean flag = redisLock.tryLock(JOB_KEY, 1000*30);
if(flag){
String nextDay = DateUtils.getNextDay();
log.info("timeAllocationSrvTask========start:{}",nextDay);
srvTaskService.timeAllocationSrvTask(nextDay);
log.info("timeAllocationSrvTask========end:{}");
}
}
}
...@@ -10,6 +10,8 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -10,6 +10,8 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper @Mapper
@Repository @Repository
public interface ChSrvProgramMapper extends BaseMapper<ChSrvProgram> { public interface ChSrvProgramMapper extends BaseMapper<ChSrvProgram> {
...@@ -42,4 +44,7 @@ public interface ChSrvProgramMapper extends BaseMapper<ChSrvProgram> { ...@@ -42,4 +44,7 @@ public interface ChSrvProgramMapper extends BaseMapper<ChSrvProgram> {
*/ */
ProgramDetailVo getProgramDetailWithAdd(@Param("disabInfoId") Long disabInfoId, @Param("srvOrganId") Long srvOrganId); ProgramDetailVo getProgramDetailWithAdd(@Param("disabInfoId") Long disabInfoId, @Param("srvOrganId") Long srvOrganId);
List<ChSrvProgram> getProgramEndProgram();
} }
\ No newline at end of file
...@@ -23,4 +23,5 @@ public interface ChSrvSendMapper extends BaseMapper<ChSrvSend> { ...@@ -23,4 +23,5 @@ public interface ChSrvSendMapper extends BaseMapper<ChSrvSend> {
*/ */
Page<SvrSendListVo> selectSrvSendList(Page<SvrSendListVo> page, @Param("srvOrganId") Long srvOrganId, @Param("realName") String realName, @Param("realTel") String realTel, @Param("programStatus") String programStatus); Page<SvrSendListVo> selectSrvSendList(Page<SvrSendListVo> page, @Param("srvOrganId") Long srvOrganId, @Param("realName") String realName, @Param("realTel") String realTel, @Param("programStatus") String programStatus);
int updateSrvSendInfo(Long disabInfoId);
} }
\ No newline at end of file
...@@ -12,7 +12,7 @@ import org.apache.ibatis.annotations.Select; ...@@ -12,7 +12,7 @@ import org.apache.ibatis.annotations.Select;
public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> { public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
@Select("select s.real_name," + @Select("<script>select s.real_name," +
"i.SRV_SEND_ID," + "i.SRV_SEND_ID," +
" j.acpt_provincial," + " j.acpt_provincial," +
" j.acpt_city," + " j.acpt_city," +
...@@ -38,6 +38,13 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> { ...@@ -38,6 +38,13 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
" on s.disab_info_id = i.disab_info_id" + " on s.disab_info_id = i.disab_info_id" +
" left join ch_srv_organ j" + " left join ch_srv_organ j" +
" on i.SRV_ORGAN_ID = j.SRV_ORGAN_ID" + " on i.SRV_ORGAN_ID = j.SRV_ORGAN_ID" +
" where i.disab_info_id=#{disableInfoId}") " where i.disab_info_id=#{disableInfoId} " +
Page<DisableInfoVo> querySrvYet(Page page, Integer disableInfoId); " <if test='status!=null and status !=\"\" '>"+
" and i.status =#{status} "+
" </if>"+
" <if test='sendId!=null and sendId !=\"\" '>"+
" and i.srv_send_id =#{sendId} "+
" </if>"+
" </script>")
Page<DisableInfoVo> querySrvYet(Page page, Integer disableInfoId ,Integer status,Integer sendId);
} }
...@@ -31,6 +31,7 @@ public interface SrvSendMapper extends BaseMapper<ChSrvSend> { ...@@ -31,6 +31,7 @@ public interface SrvSendMapper extends BaseMapper<ChSrvSend> {
Page<SrvSendVO> selectSendList(Page<SrvSendVO> page, @Param("disableInfo") ChDisableInfo disableInfo, @Param("chSrvOrgan") ChSrvOrgan chSrvOrgan, @Param("chSrvSend") ChSrvSend chSrvSend); Page<SrvSendVO> selectSendList(Page<SrvSendVO> page, @Param("disableInfo") ChDisableInfo disableInfo, @Param("chSrvOrgan") ChSrvOrgan chSrvOrgan, @Param("chSrvSend") ChSrvSend chSrvSend);
@Select("select permit_id from ch_srv_organ where srv_organ_id=#{organId} ") @Select("select permit_id from ch_srv_organ where srv_organ_id=#{organId} ")
String selectByOrganId(Integer organId); String selectByOrganId(Integer organId);
...@@ -51,8 +52,8 @@ public interface SrvSendMapper extends BaseMapper<ChSrvSend> { ...@@ -51,8 +52,8 @@ public interface SrvSendMapper extends BaseMapper<ChSrvSend> {
" left join ch_apr_report o" + " left join ch_apr_report o" +
" on i.task_id = o.task_id left join CH_CFG_SRV_DISABLE_LEVEL l on l.disable_level_id = o.disable_level_id " + " on i.task_id = o.task_id left join CH_CFG_SRV_DISABLE_LEVEL l on l.disable_level_id = o.disable_level_id " +
" left join ch_disable_apply a on a.apply_id = s.apply_id " + " left join ch_disable_apply a on a.apply_id = s.apply_id " +
" where s.disab_info_id=#{disableInfoId}") " where s.disab_info_id=#{disableInfoId} order by o.fcd desc")
DisableInfoTaskVO selectBydisableInfoId(Integer disableInfoId); List<DisableInfoTaskVO> selectBydisableInfoId(Integer disableInfoId);
@Select("select s.real_name," + @Select("select s.real_name," +
" s.certi_code," + " s.certi_code," +
......
...@@ -10,7 +10,7 @@ import com.hungraim.ltc.pojo.vo.governance.DisableInfoVo; ...@@ -10,7 +10,7 @@ import com.hungraim.ltc.pojo.vo.governance.DisableInfoVo;
public interface DisableInfoServie extends IService<ChDisableInfo> { public interface DisableInfoServie extends IService<ChDisableInfo> {
Page<DisableInfoVo> querySrvYet(Integer disableInfoId, int current, int limit); Page<DisableInfoVo> querySrvYet(Integer disableInfoId, int current, int limit, Integer status, Integer sendId);
......
package com.hungraim.ltc.governance.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
/**
* @author zwl
* @ClassName SrvTaskScheduledServiceImpl
* @description
* @date 2023/3/2 14:37
**/
@Service
@Slf4j
public class SrvTaskScheduledServiceImpl {
@Autowired
private SrvTaskService srvTaskService;
@Scheduled(cron = "30 30 23 * * ?")
public void timeAllocationSrvTask() {
log.info("timeAllocationSrvTask========start");
srvTaskService.timeAllocationSrvTask();
log.info("timeAllocationSrvTask========end:{}");
}
}
...@@ -33,6 +33,6 @@ public interface SrvTaskService { ...@@ -33,6 +33,6 @@ public interface SrvTaskService {
void addOrUpdateSrvTask(SrvTaskInfoListVO param); void addOrUpdateSrvTask(SrvTaskInfoListVO param);
void timeAllocationSrvTask(); void timeAllocationSrvTask(String dateStr);
} }
...@@ -15,8 +15,8 @@ public class DisableInfoServieImpl extends ServiceImpl<DisableInfoMapper, ChDisa ...@@ -15,8 +15,8 @@ public class DisableInfoServieImpl extends ServiceImpl<DisableInfoMapper, ChDisa
@Override @Override
public Page<DisableInfoVo> querySrvYet(Integer disableInfoId, int current, int limit) { public Page<DisableInfoVo> querySrvYet(Integer disableInfoId, int current, int limit, Integer status, Integer sendId) {
Page<SrvSendVO> page = new Page<>(current,limit); Page<SrvSendVO> page = new Page<>(current,limit);
return this.baseMapper.querySrvYet(page,disableInfoId); return this.baseMapper.querySrvYet(page,disableInfoId,status,sendId);
} }
} }
...@@ -41,7 +41,12 @@ public class SrvSendServiceImpl extends ServiceImpl<SrvSendMapper, ChSrvSend> im ...@@ -41,7 +41,12 @@ public class SrvSendServiceImpl extends ServiceImpl<SrvSendMapper, ChSrvSend> im
@Override @Override
public DisableInfoTaskVO selectTaskById(Integer disableInfoId, Integer srvOrganId) { public DisableInfoTaskVO selectTaskById(Integer disableInfoId, Integer srvOrganId) {
DisableInfoTaskVO disableInfoTaskVO = sendMapper.selectBydisableInfoId(disableInfoId); List<DisableInfoTaskVO> disableInfoTaskList = sendMapper.selectBydisableInfoId(disableInfoId);
DisableInfoTaskVO disableInfoTaskVO = null;
if(disableInfoTaskList.size() >0 ){
disableInfoTaskVO = disableInfoTaskList.get(0);
}
if (srvOrganId != null) { if (srvOrganId != null) {
String s = sendMapper.selectByOrganId(srvOrganId); String s = sendMapper.selectByOrganId(srvOrganId);
disableInfoTaskVO.setPermitId(s); disableInfoTaskVO.setPermitId(s);
......
package com.hungraim.ltc.governance.service.impl; package com.hungraim.ltc.governance.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -7,12 +8,13 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; ...@@ -7,12 +8,13 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AccountFeignService; import com.hungraim.ltc.api.AccountFeignService;
import com.hungraim.ltc.api.AttachFeignService; import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.governance.dao.ChSrvPlanMapper; import com.hungraim.ltc.governance.dao.*;
import com.hungraim.ltc.governance.dao.ChSrvTaskDetailMapper; import com.hungraim.ltc.governance.service.SrvSendService;
import com.hungraim.ltc.governance.dao.SrvTaskMapper;
import com.hungraim.ltc.governance.service.SrvTaskService; import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach; import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan; import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.governance.*; import com.hungraim.ltc.pojo.vo.governance.*;
...@@ -40,8 +42,9 @@ public class SrvTaskServiceImpl implements SrvTaskService { ...@@ -40,8 +42,9 @@ public class SrvTaskServiceImpl implements SrvTaskService {
private final AttachFeignService attachFeignService; private final AttachFeignService attachFeignService;
private final ChSrvPlanMapper chSrvPlanMapper; private final ChSrvPlanMapper chSrvPlanMapper;
private final AccountFeignService accountFeignService; private final AccountFeignService accountFeignService;
private final ChSrvProgramMapper chSrvProgramMapper;
private final ChSrvSendMapper chSrvSendMapper;
private final SrvSendService sendService;
/** /**
* 服务计划制定列表 * 服务计划制定列表
...@@ -204,29 +207,46 @@ public class SrvTaskServiceImpl implements SrvTaskService { ...@@ -204,29 +207,46 @@ public class SrvTaskServiceImpl implements SrvTaskService {
return srvTaskMapper.getSrvOrganEmpList(page, organId, name, certiType, certifNum); return srvTaskMapper.getSrvOrganEmpList(page, organId, name, certiType, certifNum);
} }
@Override @Override
public void timeAllocationSrvTask() { public void timeAllocationSrvTask(String dateStr) {
List<ChSrvProgram> programEndProgram = chSrvProgramMapper.getProgramEndProgram();
if (CollectionUtil.isNotEmpty(programEndProgram)) {
for (ChSrvProgram chSrvProgram : programEndProgram) {
chSrvProgram.setProgramId(chSrvProgram.getProgramId());
chSrvProgram.setEndReason("方案时间已到期,自动终止");
chSrvProgram.setProgStatus(2);
chSrvProgramMapper.updateById(chSrvProgram);
Long disabInfoId = chSrvProgram.getDisabInfoId();
ChSrvSend chSrvSend = new ChSrvSend();
// chSrvSend.setStatus((short)2);
// chSrvSend.setEndTime(new Date());
chSrvSend.setDisabInfoId(disabInfoId);
chSrvSendMapper.updateSrvSendInfo(disabInfoId);
}
}
// 查询需要执行的计划 // 查询需要执行的计划
List<AllocationSrvTaskVO> chSrvTasks = srvTaskMapper.getAllocationSrvTask(); List<AllocationSrvTaskVO> chSrvTasks = srvTaskMapper.getAllocationSrvTask();
// 生成计划任务 CH_SRV_TASK_DETAIL // 生成计划任务 CH_SRV_TASK_DETAIL
for (AllocationSrvTaskVO chSrvTask : chSrvTasks) { for (AllocationSrvTaskVO chSrvTask : chSrvTasks) {
Long srvTaskId = chSrvTask.getSrvTaskId(); Long srvTaskId = chSrvTask.getSrvTaskId();
String nextDay = DateUtils.getNextDay();
// 根据任务id和服务时间查询是否已经生成过计划,已经生成了就不需要再生成了,已退出 // 根据任务id和服务时间查询是否已经生成过计划,已经生成了就不需要再生成了,已退出
int chSrvTaskDetailCount = chSrvTaskDetailMapper int chSrvTaskDetailCount = chSrvTaskDetailMapper
.getSrvTaskDetail(String.valueOf(srvTaskId), nextDay); .getSrvTaskDetail(String.valueOf(srvTaskId), dateStr);
if (chSrvTaskDetailCount > 0) { if (chSrvTaskDetailCount > 0) {
log.info("{},已经有计划任务了",nextDay); log.info("{},已经有计划任务了",dateStr);
return; continue;
} }
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail(); ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
chSrvTaskDetail.setSrvTaskId(srvTaskId);//taskId chSrvTaskDetail.setSrvTaskId(srvTaskId);//taskId
chSrvTaskDetail.setSrvDate(DateUtils.strToDate(nextDay));//服务开始时间 chSrvTaskDetail.setSrvDate(DateUtils.strToDate(dateStr));//服务开始时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4 chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetailMapper.insert(chSrvTaskDetail); chSrvTaskDetailMapper.insert(chSrvTaskDetail);
// ch_srv_plan // ch_srv_plan
String programId = chSrvTask.getProgramId(); String programId = chSrvTask.getProgramId();
saveSrvPlan(programId,nextDay); saveSrvPlan(programId,dateStr);
} }
} }
......
...@@ -52,14 +52,18 @@ ...@@ -52,14 +52,18 @@
CATEGORY_TYPE, CATEGORY_TYPE,
CH_SRV_ORGAN_PROJECT.ITEM_TIMES, CH_SRV_ORGAN_PROJECT.ITEM_TIMES,
ITEM_TIMES_TYPE, ITEM_TIMES_TYPE,
CH_SRV_ORGAN_PROJECT.ITEM_PRICE, CH_SRV_ORGAN_PROJECT.ITEM_PRICE
CH_SRV_ORGAN_PROJECT.IS_CONF IS_NEED <if test="programId == null">
,CH_SRV_ORGAN_PROJECT.IS_CONF IS_CONF
</if>
<if test="programId != null"> <if test="programId != null">
, ,
SET_ID, SET_ID,
PLANNING_FREQUENCY, PLANNING_FREQUENCY,
PLANNING_FREQUENCY_TYPE, PLANNING_FREQUENCY_TYPE,
CH_SRV_PROGRAM_SET.REMARK CH_SRV_PROGRAM_SET.REMARK,
NVL(CH_SRV_PROGRAM_SET.IS_CONF, '0') IS_CONF
</if> </if>
FROM CH_SRV_ORGAN_PROJECT FROM CH_SRV_ORGAN_PROJECT
<if test="programId != null"> <if test="programId != null">
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
LEFT JOIN CH_CFG_SRV_DISABLE_LEVEL T6 ON T3.DISABLE_LEVEL_ID = T6.DISABLE_LEVEL_ID LEFT JOIN CH_CFG_SRV_DISABLE_LEVEL T6 ON T3.DISABLE_LEVEL_ID = T6.DISABLE_LEVEL_ID
LEFT JOIN CH_APR_TASK T4 ON T3.TASK_ID = T4.TASK_ID LEFT JOIN CH_APR_TASK T4 ON T3.TASK_ID = T4.TASK_ID
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
WHERE T1.PROGRAM_ID = #{programId} WHERE T1.PROGRAM_ID = #{programId} and rownum =1
</select> </select>
<select id="getProgramDetailWithAdd" resultMap="ProgramSetDetailVoMap"> <select id="getProgramDetailWithAdd" resultMap="ProgramSetDetailVoMap">
SELECT NULL PROGRAM_ID, SELECT NULL PROGRAM_ID,
...@@ -106,6 +106,7 @@ ...@@ -106,6 +106,7 @@
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
WHERE T1.DISAB_INFO_ID = #{disabInfoId} WHERE T1.DISAB_INFO_ID = #{disabInfoId}
AND T1.SRV_ORGAN_ID = #{srvOrganId} AND T1.SRV_ORGAN_ID = #{srvOrganId}
AND ROWNUM = 1
</select> </select>
<select id="getProgramList" resultType="com.hungraim.ltc.pojo.vo.governance.ProgramListVo"> <select id="getProgramList" resultType="com.hungraim.ltc.pojo.vo.governance.ProgramListVo">
...@@ -127,7 +128,9 @@ ...@@ -127,7 +128,9 @@
T4.FINISH_TIME assessDate, T4.FINISH_TIME assessDate,
T7.MODE_NAME svrModelName, T7.MODE_NAME svrModelName,
T5.SRV_ORGAN_NAME svrOrganName, T5.SRV_ORGAN_NAME svrOrganName,
T1.PROG_STATUS progStatus, <if test="programStatus != null and programStatus != ''">
#{programStatus} progStatus,
</if>
T1.EFF_TIME effTime T1.EFF_TIME effTime
FROM CH_SRV_PROGRAM T1 FROM CH_SRV_PROGRAM T1
INNER JOIN CH_DISABLE_INFO T2 ON T1.DISAB_INFO_ID = T2.DISAB_INFO_ID INNER JOIN CH_DISABLE_INFO T2 ON T1.DISAB_INFO_ID = T2.DISAB_INFO_ID
...@@ -138,8 +141,14 @@ ...@@ -138,8 +141,14 @@
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
WHERE T1.DISAB_INFO_ID = #{disabInfoId} WHERE T1.DISAB_INFO_ID = #{disabInfoId}
AND T1.SRV_ORGAN_ID = #{srvOrganId} AND T1.SRV_ORGAN_ID = #{srvOrganId}
<!--
<if test="programStatus != null and programStatus != ''"> <if test="programStatus != null and programStatus != ''">
T1.PROG_STATUS = #{programStatus} AND T1.PROG_STATUS = #{programStatus}
</if> </if>-->
</select> </select>
<select id="getProgramEndProgram" resultType="com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram">
select * from CH_SRV_PROGRAM g where <![CDATA[ sysdate > g.PROGRAM_EDN_DATE and PROG_STATUS <> 2 ]]>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -68,4 +68,10 @@ ...@@ -68,4 +68,10 @@
</where> </where>
ORDER BY T1.EFF_TIME DESC ORDER BY T1.EFF_TIME DESC
</select> </select>
<update id="updateSrvSendInfo">
update CH_SRV_SEND p set p.status = '2',p.end_time = sysdate where
p.DISAB_INFO_ID = #{disabInfoId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<!--查询服务分配信息列表--> <!--查询服务分配信息列表-->
<select id="selectSendList" resultMap="sendresultMap"> <select id="selectSendList" resultMap="sendresultMap">
SELECT SELECT
s.srv_send_id, distinct s.srv_send_id,
i.disab_info_id, i.disab_info_id,
o.organ_id, o.organ_id,
o.ORGAN_NAME, o.ORGAN_NAME,
...@@ -41,15 +41,16 @@ ...@@ -41,15 +41,16 @@
ch_disable_info i ch_disable_info i
LEFT JOIN ch_srv_send s ON s.disab_info_id = i.disab_info_id 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_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 (select * from CH_APR_TASK where APR_TYPE <![CDATA[ <>]]> 2) t ON i.disab_info_id = t.DISABLE_INFO_ID
left join ch_apr_report report on t.task_id = report.task_id --left join ch_apr_report report on t.task_id = report.task_id
<where> <where>
t.TASK_STATUS = 3 and report.DISABLE_LEVEL_ID in ('3','4','5') t.TASK_STATUS = 3 --and report.DISABLE_LEVEL_ID in ('3','4','5')
and sysdate <![CDATA[ > ]]> report.PUBLICITY_END_TIME --and sysdate <![CDATA[ > ]]> report.PUBLICITY_END_TIME
and t.task_id in (select distinct TASK_ID from CH_APR_REPORT report where report.DISABLE_LEVEL_ID in ('3','4','5')
and sysdate <![CDATA[ > ]]> report.PUBLICITY_END_TIME)
<if test="chSrvOrgan.organId != null and chSrvOrgan.organId != ''"> <if test="chSrvOrgan.organId != null and chSrvOrgan.organId != ''">
AND o.organ_id = #{chSrvOrgan.organId} AND o.organ_id = #{chSrvOrgan.organId}
</if> </if>
<if test="disableInfo.realName != null and disableInfo.realName != ''"> <if test="disableInfo.realName != null and disableInfo.realName != ''">
AND i.real_name LIKE CONCAT(CONCAT('%',#{disableInfo.realName}),'%') AND i.real_name LIKE CONCAT(CONCAT('%',#{disableInfo.realName}),'%')
</if> </if>
......
...@@ -220,9 +220,11 @@ ...@@ -220,9 +220,11 @@
left join CH_DISABLE_INFO info on t.DISAB_INFO_ID = info.DISAB_INFO_ID left join CH_DISABLE_INFO info on t.DISAB_INFO_ID = info.DISAB_INFO_ID
left join ch_apr_task aprtask on info.last_task_id = aprtask.task_id--评定任务 left join ch_apr_task aprtask on info.last_task_id = aprtask.task_id--评定任务
left join ch_apr_report report on aprtask.task_id = report.task_id--评定报告 left join ch_apr_report report on aprtask.task_id = report.task_id--评定报告
where t.SRV_DATE <![CDATA[ < ]]> sysdate and left join CH_SRV_PROGRAM program on program.DISAB_INFO_ID = info.DISAB_INFO_ID
(info.EXIT_TIME <![CDATA[ > ]]> sysdate or info.EXIT_TIME is null) where <![CDATA[ t.SRV_DATE < sysdate and
and sysdate <![CDATA[ > ]]> report.PUBLICITY_END_TIME (info.EXIT_TIME > sysdate or info.EXIT_TIME is null)
and sysdate < program.PROGRAM_EDN_DATE
and sysdate > report.PUBLICITY_END_TIME and program.PROG_STATUS <>'2' and t.STATUS <>'2' ]]>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
package com.hungraim.ltc.system.service;
public interface SrvTaskScheduledService {
void timeAllocationSrvTask();
}
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