Commit 14af107b authored by zhangwanglin's avatar zhangwanglin

Merge branch 'dev_nursing_records_20230214' into dev_ch_master

# Conflicts: # apply/apply-service/src/main/java/com/hungraim/ltc/controller/SrvOrganController.java # apply/apply-service/src/main/java/com/hungraim/ltc/service/SrvOrganEmpService.java # apply/apply-service/src/main/java/com/hungraim/ltc/service/impl/SrvOrganEmpServiceImpl.java
parents 6f86a9af 329526b9
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.account.service.AccountService;
import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO;
import com.hungraim.ltc.util.FileUtils;
......@@ -224,6 +225,8 @@ public class AccountController {
if(srvOrganId !=0) {
srvOrganListReq.setSrvOrganId(srvOrganId);
}
// 不展示异地
srvOrganListReq.setFlag("1");
Page<ChDisabDetailAccountsResp> chAssessDetailAccounts = accountService.queryOrganAccountsDetail(pageNum,pageSize,srvOrganListReq);
return Result.success(chAssessDetailAccounts);
}
......@@ -378,18 +381,22 @@ public class AccountController {
@RequestMapping("/placeOtherApply")
public Result placeOtherApply(Integer disabInfoId, String otherApplyTime) {
Result result = accountService.placeOtherApply(disabInfoId, otherApplyTime);
return result;
int result = accountService.placeOtherApply(disabInfoId, otherApplyTime);
if (result > 0) {
return Result.success();
}else {
return Result.failed("申请失败");
}
@RequestMapping("/accountReturn")
public Result accountReturn(SrvTaskRespVO srvTaskRespVO) {
Result result = accountService.accountReturn(srvTaskRespVO);
return result;
}
}
......@@ -3,10 +3,7 @@ package com.hungraim.ltc.account.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.vo.account.AccountExportDetailListResp;
import com.hungraim.ltc.pojo.vo.account.AccountTaskExecuteReqVO;
import com.hungraim.ltc.pojo.vo.account.OrganAccountsVO;
import com.hungraim.ltc.pojo.vo.account.SrvOrganListReq;
import com.hungraim.ltc.pojo.vo.account.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -38,10 +35,15 @@ public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAcc
List<OrganAccountsVO> queryPlanInfoByDetailId(String taskDetailId);
int queryPlanByTaskDetailId(String taskDetailId);
int updateByPlanId(String planId);
int selectByCondition(AccountTaskExecuteReqVO accountTaskExecuteReqVO);
TaskDetailDisableVO queryTaskDisId(String taskDetailId);
int queryTaskDetailDisable(TaskDetailDisableVO taskDetailDisableVO);
}
\ No newline at end of file
package com.hungraim.ltc.account.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@Mapper
public interface ChSrvPlanMapper extends BaseMapper<ChSrvPlan> {
}
......@@ -27,4 +27,7 @@ public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> {
Page<PlaceOtherVO> placeOtherQuery(Page page, String name, String certiCode);
List<PlaceOtherVO> placeOtherTaskQuery();
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.vo.account.*;
import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO;
......@@ -62,8 +63,12 @@ public interface AccountService extends IService<ChDisabAccounts> {
Page<ChDisabDetailAccountsResp> queryOrganAccountsDetail(Integer pageNum, Integer pageSize,SrvOrganListReq srvOrganListReq);
int placeOtherApply(Integer disabInfoId, String otherApplyTime);
Result placeOtherApply(Integer disabInfoId, String otherApplyTime);
Page<PlaceOtherVO> placeOtherQuery(Page page, String name, String certiCode);
void placeOtherTaskQuery();
//退回
Result accountReturn(SrvTaskRespVO srvTaskRespVO);
}
......@@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hungraim.ltc.account.dao.*;
......@@ -16,6 +17,7 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCareService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgCostStandard;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.account.*;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskFinishItem;
import com.hungraim.ltc.pojo.vo.account.*;
......@@ -25,6 +27,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -52,6 +55,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
private final ChCfgCostStandardMapper chCfgCostStandardMapper;
private final ChDisabAccountsDetailMapper chDisabAccountsDetailMapper;
private final ChDisabFreeRdInfoMapper chDisabFreeRdInfoMapper;
private final ChSrvPlanMapper chSrvPlanMapper;
......@@ -70,6 +74,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccounts.setReviewRemark(accountOperVo.getReviewRemark());
Short accountsStatus = accountOperVo.getAccountsStatus();
String accountsId = String.valueOf(accountOperVo.getAccountsId());
String modeName = accountOperVo.getModeName();
// 驳回
if(accountsStatus == 0) {
chDisabAccountsDetailMapper.updateByAccountsId(accountsId,0);
......@@ -80,7 +85,9 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccounts.setDeductionAmountTotal(BigDecimal.valueOf(0));
HashMap map = new HashMap();
map.put("ACCOUNTS_ID",accountsId);
// 删除对应扣减历史数据
chDisabFreeRdInfoMapper.deleteByMap(map);
}
// 已结算
if(accountsStatus == 4) {
......@@ -611,6 +618,16 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.queryPlanInfoByDetailId(taskDetailId);
if (CollectionUtil.isNotEmpty(accountsList)) {
return;
}else {
// 不同的护理人员同一天对同一个失能人员服务项目只计一条费用
TaskDetailDisableVO taskDetailDisableVO = chDisabAccountsDetailMapper.queryTaskDisId(taskDetailId);
if (Objects.nonNull(taskDetailDisableVO)) {
int count = chDisabAccountsDetailMapper.queryTaskDetailDisable(taskDetailDisableVO);
if(count>0){
log.info("该失能人员当天已经有护理人员护理过,不在产生费用");
return;
}
}
}
ChSrvTaskDetail ca = new ChSrvTaskDetail();
ca.setStatus((short) 4);
......@@ -647,7 +664,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
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())));
......@@ -697,31 +713,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
public void otherPlaceHandler(String programId){
/* List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOtherPlaceList(programId);
for (OrganAccountsVO accountsVO : accountsList) {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId());
// 异地
BigDecimal limit = BigDecimal.valueOf(20);
BigDecimal zero = BigDecimal.valueOf(0);
chDisabDetailAccounts.setAccountsAllCost(limit);
chDisabDetailAccounts.setAccountsPersonalCost(zero);
chDisabDetailAccounts.setAccountsOverallCost(zero);
chDisabDetailAccounts.setReissueAmount(zero);
chDisabDetailAccounts.setDeductionAmount(zero);
chDisabDetailAccounts.setStatus((short)0);
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(DateUtils.strToDate(accountsVO.getSrvDate()));
chDisabDetailAccounts.setAccountsStartTime(DateUtils.getFirstDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.getlastDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setDisabInfoId(accountsVO.getDisabInfoId());
ChDisabAccounts chDisabAccounts = getChDisabAccounts1(accountsVO);
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
}*/
}
@Override
......@@ -899,32 +890,50 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
}
@Override
public int placeOtherApply(Integer disabInfoId, String otherApplyTime) {
int result = taskDetailMapper.placeOtherApply(disabInfoId,otherApplyTime);
public Result placeOtherApply(Integer disabInfoId, String otherApplyTime) {
Result result1 =Result.success();
Date date = DateUtils.strToDate(otherApplyTime);
boolean now = DateUtils.isNow(date);
if (now) {
result1 = placeFreeHandler(disabInfoId, otherApplyTime);
}
if(result1.equals(Result.success())) {
int result = taskDetailMapper.placeOtherApply(disabInfoId, otherApplyTime);
if (result > 0) {
return result1;
} else {
return Result.failed("申请失败");
}
}
return result1;
}
private Result placeFreeHandler(Integer disabInfoId, String otherApplyTime) {
BigDecimal limit = BigDecimal.valueOf(20);
BigDecimal zero = BigDecimal.valueOf(0);
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.queryDisabDetailAccounts("471", otherApplyTime, String.valueOf(disabInfoId), "异地");
if(Objects.isNull(chDisabDetailAccountsDTO)) {
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.queryDisabDetailAccounts("1361", otherApplyTime, String.valueOf(disabInfoId), "异地");
if (Objects.isNull(chDisabDetailAccountsDTO)) {
// 异地
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setAccountsAllCost(limit);
chDisabDetailAccounts.setAccountsOverallCost(limit);
chDisabDetailAccounts.setAccountsPersonalCost(zero);
chDisabDetailAccounts.setModeName("异地");
chDisabDetailAccounts.setSrvOrganId("471");
chDisabDetailAccounts.setSrvOrganId("1361");
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(DateUtils.strToDate(otherApplyTime));
// chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setDisabInfoId(String.valueOf(disabInfoId));
chDisabDetailAccounts.setStatus((short) 1);
chDisabDetailAccounts.setReissueAmount(BigDecimal.valueOf(0));
chDisabDetailAccounts.setDeductionAmount(BigDecimal.valueOf(0));
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(otherApplyTime)), "异地", "471", null);
ChDisabAccounts chDisabAccounts = disabAccountsMapper.queryAccountByCondition(DateUtils.dateToStrYm(DateUtils.strToDate(otherApplyTime)), "异地", "1361", null);
if (chDisabAccounts == null) {
chDisabAccounts = new ChDisabAccounts();
chDisabAccounts.setModeName("异地");
chDisabAccounts.setAccountsTime(DateUtils.strToDateMd(otherApplyTime));
chDisabAccounts.setSrvOrganId(Long.valueOf(471));
chDisabAccounts.setSrvOrganId(Long.valueOf(1361));
chDisabAccounts.setCreationTime(new Date());
chDisabAccounts.setAccountsStatus((short) 1);
chDisabAccounts.setAllCost(limit);
......@@ -933,10 +942,26 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccounts.setReissueAmountTotal(zero);
chDisabAccounts.setDeductionAmountTotal(zero);
disabAccountsMapper.insert(chDisabAccounts);
}else {
Short accountsStatus = chDisabAccounts.getAccountsStatus();
if(accountsStatus > 1){
log.info("{},已完成审核",chDisabAccounts.getAccountsId());
return Result.failed("提交月份已完成审核,请联系管理员");
}
BigDecimal allCost1 = chDisabAccounts.getAllCost();
BigDecimal overallCost1 = chDisabAccounts.getOverallCost();
allCost1 = allCost1.add(limit);
overallCost1 = overallCost1.add(limit);
ChDisabAccounts chDisabAccount = new ChDisabAccounts();
chDisabAccount.setAllCost(allCost1);
chDisabAccount.setOverallCost(overallCost1);
Long accountsId = chDisabAccounts.getAccountsId();
chDisabAccount.setAccountsId(accountsId);
disabAccountsMapper.updateById(chDisabAccount);
}
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
}else {
} else {
BigDecimal accountsAllCost = chDisabDetailAccountsDTO.getAccountsAllCost();
BigDecimal accountsOverallCost = chDisabDetailAccountsDTO.getAccountsOverallCost();
chDisabDetailAccountsDTO.setAccountsAllCost(accountsAllCost.add(limit));
......@@ -944,7 +969,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccountsDTO.setAccountsPersonalCost(zero);
chDisabAccountsDetailMapper.updateById(chDisabDetailAccountsDTO);
}
return result;
return Result.success();
}
@Override
......@@ -953,4 +978,78 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
return placeOtherVOPage;
}
@Override
public void placeOtherTaskQuery(){
List<PlaceOtherVO> placeOtherVOS = taskDetailMapper.placeOtherTaskQuery();
for (PlaceOtherVO placeOtherVO : placeOtherVOS) {
Integer disabInfoId = placeOtherVO.getDisabInfoId();
String otherApplyTime = placeOtherVO.getOtherApplyTime();
placeFreeHandler(disabInfoId,otherApplyTime);
}
}
//退回
@Override
public Result accountReturn(SrvTaskRespVO srvTaskRespVO){
Long taskDetailId = srvTaskRespVO.getTaskDetailId();
String disabInfoId = srvTaskRespVO.getDisabInfoId();
String srvModeName = srvTaskRespVO.getSrvModeName();
String srvPlanTime = srvTaskRespVO.getSrvDate();
Date date = DateUtils.strToDate(srvPlanTime);
String srvOrganId = srvTaskRespVO.getSrvOrganId();
ChDisabDetailAccounts chDisabDetailAccounts = chDisabAccountsDetailMapper.queryDisabDetailAccounts(String.valueOf(srvOrganId), DateUtils.dateToStrYm(date), disabInfoId, srvModeName);
Short status = chDisabDetailAccounts.getStatus();
if(status != 0){
return Result.failed("此任务已提交申报,不可再操作,请联系管理员");
}
LambdaQueryWrapper<ChSrvPlan> queryWrapper= new LambdaQueryWrapper<>();
queryWrapper.eq(ChSrvPlan::getTaskDetailId,taskDetailId);
queryWrapper.eq(ChSrvPlan::getIsStatus, (short) 4);
List<ChSrvPlan> srvPlanList = chSrvPlanMapper.selectList(queryWrapper);
int size = srvPlanList.size();
// 大于1说明还有已完成的任务,不退回,只更新状态 等于1结算退回费用
try {
ChSrvPlan chSrvPlan = new ChSrvPlan();
chSrvPlan.setIsStatus(0L);
chSrvPlan.setPlanID(srvTaskRespVO.getPlanId());
chSrvPlanMapper.updateById(chSrvPlan);
if(size == 1){
BigDecimal accountsAllCost = chDisabDetailAccounts.getAccountsAllCost();
BigDecimal accountsOverallCost = chDisabDetailAccounts.getAccountsOverallCost();
BigDecimal accountsPersonalCost = chDisabDetailAccounts.getAccountsPersonalCost();
BigDecimal allCost = new BigDecimal(0);
BigDecimal overCost= new BigDecimal(0);
BigDecimal personCost = new BigDecimal(0);
if ("养老".equals(srvModeName)) {
allCost = BigDecimal.valueOf(50);
overCost = BigDecimal.valueOf(35);
personCost = BigDecimal.valueOf(15);
// 医疗机构护理,原则上收治医疗护理需求为主的重度失能人员一级及以下医疗机构其限额为 80 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
} else if ("医疗".equals(srvModeName) && "1".equals(srvTaskRespVO.getLevelCode())) {
allCost = BigDecimal.valueOf(80);
overCost = BigDecimal.valueOf(56);
personCost = BigDecimal.valueOf(24);
// 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
} else if ("医疗".equals(srvModeName) && (!"1".equals(srvTaskRespVO.getLevelCode()))) {
allCost = BigDecimal.valueOf(100);
overCost = BigDecimal.valueOf(70);
personCost = BigDecimal.valueOf(30);
}
BigDecimal allCostSubtract = accountsAllCost.subtract(allCost);
BigDecimal overCostSubtract = accountsOverallCost.subtract(overCost);
BigDecimal personCostSubtract = accountsPersonalCost.subtract(personCost);
chDisabDetailAccounts.setAccountsAllCost(allCostSubtract);
chDisabDetailAccounts.setAccountsOverallCost(overCostSubtract);
chDisabDetailAccounts.setAccountsPersonalCost(personCostSubtract);
chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
}
} catch (Exception e) {
log.error("==============accountReturn error:{}",e);
return Result.failed("服务器异常");
}
return Result.success();
}
}
......@@ -7,7 +7,6 @@
to_char(d.ACCOUNTS_START_TIME,'yyyy-MM-dd') accountsStartTime,
to_char(d.ACCOUNTS_END_TIME,'yyyy-MM-dd') accountsEndTime,
to_char(d.ACCOUNTS_TIME,'yyyy-MM') accountsTime,
emp.EMP_NAME empName,
d.ACCOUNTS_ALL_COST accountsAllCost,
d.ACCOUNTS_OVERALL_COST accountsOverallCost,
d.ACCOUNTS_PERSONAL_COST accountsPersonalCost,
......@@ -25,9 +24,11 @@
left join CH_DISABLE_INFO info on d.DISAB_INFO_ID = info.DISAB_INFO_ID
left join CH_DISABLE_APPLY apply on info.APPLY_ID=apply.APPLY_ID
left join CH_SRV_ORGAN o on d.SRV_ORGAN_ID = o.SRV_ORGAN_ID
left join ch_srv_organ_emp emp on d.emp_id = emp.emp_id
<where>
1=1
<if test="req.flag != null and req.flag != ''">
and d.mode_name <![CDATA[ <>]]> '异地'
</if>
<if test="req.accountsId != null and req.accountsId != ''">
and d.ACCOUNTS_ID = #{req.accountsId}
</if>
......@@ -38,7 +39,7 @@
and d.status = #{req.accountsStatus}
</if>
<if test="req.realName != null and req.realName != ''">
and info.real_name = #{req.realName}
AND info.real_name LIKE CONCAT('%',CONCAT(#{req.realName},'%'))
</if>
<if test="req.srvOrganId != null and req.srvOrganId != '' and req.srvOrganId!=0">
and d.SRV_ORGAN_ID = #{req.srvOrganId}
......@@ -62,12 +63,17 @@
to_char(plan.SRV_PLAN_TIME,'yyyy-MM-dd') srvPlanTime,
DECODE(plan.MODE_ID, '1','医疗','2', '养老','3','上门') modeName,
to_char(plan.CREATION_TIME,'yyyy-MM-dd HH24:mi:ss') executionTime,
plan.item_name itemName
plan.item_name itemName,
emp.EMP_NAME empName,
info.REAL_NAME realName
from CH_SRV_PLAN plan
left join CH_SRV_ORGAN organ on organ.SRV_ORGAN_ID = plan.SRV_ORGAN_ID
left join ch_srv_organ_emp emp on plan.emp_id = emp.emp_id
left join CH_DISABLE_INFO info on info.DISAB_INFO_ID = plan.DISAB_INFO_ID
where plan.DISAB_INFO_ID = #{req.disabInfoId}
and plan.SRV_ORGAN_ID = #{req.srvOrganId}
and plan.MODE_ID = #{req.modeId}
and to_char(plan.SRV_PLAN_TIME,'yyyy-MM') = #{req.accountsTime}
and plan.IS_STATUS ='4'
order by plan.SRV_PLAN_TIME desc
</select>
......@@ -80,10 +86,13 @@
to_char(item.FCD,'yyyy-MM-dd HH24:mi:ss') executionTime,
service.SERVICE_TYPE_DETAILED_NAME itemName,
to_char(detail.SRV_START_TIME,'yyyy-MM-dd HH24:mi:ss') srvStartTime,
to_char(detail.SRV_END_TIME,'yyyy-MM-dd HH24:mi:ss') srvEndTime
to_char(detail.SRV_END_TIME,'yyyy-MM-dd HH24:mi:ss') srvEndTime,
m.EMP_NAME empName,
info.REAL_NAME realName
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_DISABLE_INFO info on info.DISAB_INFO_ID = task.DISAB_INFO_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
......@@ -165,6 +174,24 @@ and organ.SRV_ORGAN_ID = #{req.srvOrganId} order by detail.SRV_DATE desc
where deatil.STATUS = '4' and plan.TASK_DETAIL_ID = #{taskDetailId}
</select>
<select id="queryPlanByTaskDetailId" resultType="java.lang.Integer">
select count(1) from CH_SRV_PLAN p left join CH_SRV_TASK_DETAIL d on p.TASK_DETAIL_ID = d.TASK_DETAIL_ID
where p.DISAB_INFO_ID in (select DISAB_INFO_ID from CH_SRV_PLAN where TASK_DETAIL_ID = #{taskDetailId}) and d.STATUS = '4'
</select>
<select id="queryTaskDisId" resultType="com.hungraim.ltc.pojo.vo.account.TaskDetailDisableVO">
select task.DISAB_INFO_ID disabInfoId,to_char(detail.SRV_DATE,'yyyy-MM-dd') srvDate,
detail.TASK_DETAIL_ID taskDetailId from CH_SRV_TASK_DETAIL detail
left join CH_SRV_TASK task on detail.SRV_TASK_ID = task.SRV_TASK_ID
where detail.TASK_DETAIL_ID = #{taskDetailId} and ROWNUM = 1
</select>
<select id="queryTaskDetailDisable" parameterType="com.hungraim.ltc.pojo.vo.account.TaskDetailDisableVO" resultType="java.lang.Integer">
select count(1) from CH_SRV_PLAN plan where plan.DISAB_INFO_ID = #{disabInfoId}
and plan.is_STATUS = 4 and to_char(plan.SRV_PLAN_TIME,'yyyy-MM-dd') = #{srvDate}
and plan.TASK_DETAIL_ID <![CDATA[ <>]]> #{taskDetailId}
</select>
<!--查询评估信息-->
......
......@@ -22,6 +22,7 @@
left join ch_disable_info info on plan.DISAB_INFO_ID = info.DISAB_INFO_ID
left join CH_DISABLE_APPLY apply on apply.APPLY_ID = info.APPLY_ID
left join ch_srv_organ_emp emp on plan.emp_id = emp.emp_id
left join CH_SRV_TASK_DETAIL detail on detail.TASK_DETAIL_ID = plan.TASK_DETAIL_ID
left join CH_SRV_ORGAN organ on organ.SRV_ORGAN_ID = plan.SRV_ORGAN_ID
<where>
<if test="req.status != null and req.status != ''">
......@@ -40,7 +41,7 @@
AND organ.SRV_ORGAN_ID = #{req.srvOrganId}
</if>
</where>
order by plan.SRV_PLAN_TIME desc
order by plan.PLAN_ID desc
</select>
......@@ -70,6 +71,7 @@
left join ch_apr_organ aprOrgan on task.apr_organ_id = aprOrgan.apr_organ_id
LEFT JOIN CH_CFG_SRV_DISABLE_LEVEL lev ON report.DISABLE_LEVEL_ID = lev.DISABLE_LEVEL_ID
where info.SRV_MODE_ID ='4' and sysdate <![CDATA[ > ]]> report.PUBLICITY_END_TIME
and report.DISABLE_LEVEL_ID in (3,4,5)
<if test="name != null and name != ''">
and info.REAL_NAME like CONCAT(CONCAT('%',#{name}) ,'%')
</if>
......@@ -78,6 +80,34 @@
</if>
</select>
<select id="placeOtherTaskQuery" resultType="com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO">
SELECT distinct info.DISAB_INFO_ID disabInfoId,
report.evaluate_time evaluateTime,
task.ORGAN_ID organId,
report.disable_level_id disableLevelId,
info.REAL_NAME realName,
info.CERTI_CODE certiCode,
(SELECT DISE_TYPE_CODE FROM CH_FND_DISEASE_TYPE WHERE info.DISE_TYPE_S = DISE_TYPE_ID) diseTypeS,
info.disease_desc diseaseDesc,
lev.DISABLE_LEVEL_NAME riskLevel,
report.PUBLICITY_START_TIME publicityStartTime,
report.PUBLICITY_END_TIME publicityEndTime,
report.PUBLICITY_TIME publicityTime,
to_char(info.OTHER_APPLY_TIME,'yyyy-MM-dd') otherApplyTime
FROM CH_DISABLE_INFO info
LEFT JOIN CH_APR_TASK task ON info.DISAB_INFO_ID = task.DISABLE_INFO_ID
LEFT JOIN ch_apr_report report ON report.TASK_ID = task.TASK_ID
left join ch_apr_organ aprOrgan on task.apr_organ_id = aprOrgan.apr_organ_id
LEFT JOIN CH_CFG_SRV_DISABLE_LEVEL lev ON report.DISABLE_LEVEL_ID = lev.DISABLE_LEVEL_ID
where info.SRV_MODE_ID ='4' and sysdate <![CDATA[ > ]]> report.PUBLICITY_END_TIME
and info.OTHER_APPLY_TIME is not null
and info.OTHER_APPLY_TIME = to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd')
</select>
<update id="placeOtherApply">
update CH_DISABLE_INFO set OTHER_APPLY_TIME = TO_DATE ( #{otherApplyTime}, 'yyyy-MM-dd') where DISAB_INFO_ID = #{disabInfoId}
......
......@@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
......@@ -16,6 +17,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableDiscoveryClient
@EnableTransactionManagement
@EnableFeignClients
@EnableScheduling
public class ApplyApplication {
public static void main(String[] args) {
SpringApplication.run(ApplyApplication.class, args);
......
......@@ -394,6 +394,7 @@ public class DisableController {
if (chDisableApply.getMedicalType() == null) {
return Result.failed("医保类型不能为空!");
}
chDisableApply.setRealName(chDisableApply.getRealName().trim());
return disableService.addDisable(chDisableApply);
}
......@@ -526,11 +527,11 @@ public class DisableController {
* 失能人员退出
*/
@RequestMapping("/disableInfoExit")
public Result disableInfoExit(Integer disableInfoId,Integer exitReasonId,Integer applyId, Integer srvOrganId,Integer programId,String exitTime) {
if (disableInfoId == null|| exitReasonId == null||applyId == null) {
public Result disableInfoExit(DisableExitVO disableExitVO) {
if (disableExitVO.getDisableInfoId() == null|| disableExitVO.getExitReasonId() == null||disableExitVO.getApplyId() == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
int i = disableService.disableInfoExit(disableInfoId,exitReasonId,applyId,srvOrganId,programId,exitTime);
int i = disableService.disableInfoExit(disableExitVO);
if (i > 0) {
return Result.success();
} else {
......@@ -569,4 +570,27 @@ public class DisableController {
return Result.success(1);
}
@GetMapping("/disableExitTask")
public Result disableExitTask(){
disableService.disableExitTask();
return Result.success();
}
@GetMapping("/selectDisableInfoByEmp")
public Result selectDisableInfoByEmp(String srvEmpId){
if (StringUtils.isEmpty(srvEmpId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return disableService.selectDisableInfoByEmp(srvEmpId);
}
@GetMapping("/selectProgram")
public Result selectProgram(String disabInfoId,String srvOrganId){
if (StringUtils.isEmpty(disabInfoId) || StringUtils.isEmpty(srvOrganId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return disableService.selectProgram(disabInfoId,srvOrganId);
}
}
package com.hungraim.ltc.controller;
import com.hungraim.ltc.redis.RedisLock;
import com.hungraim.ltc.service.DisableService;
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 DisableSch
* @description
* @date 2023/3/31 15:22
**/
@Component
@EnableAsync
@Slf4j
public class DisableScheduledController {
@Autowired
private RedisLock redisLock;
@Autowired
private DisableService disableService;
public static final String JOB_KEY = "redis.job.task:exitTask";
@Scheduled(cron = "0 12 00 * * ?")
public void disableExitTask() {
boolean flag = redisLock.tryLock(JOB_KEY, 1000*30);
if(flag){
log.info("disableExitTask========start:{}");
disableService.disableExitTask();
log.info("disableExitTask========end:{}");
}
}
}
......@@ -19,6 +19,7 @@ import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.*;
......@@ -294,8 +295,8 @@ public class SrvOrganController {
|| null == srvOrganEmpVo.getEduId()) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
srvOrganEmpService.saveOrUpdateSrvOrganEmp(srvOrganEmpVo);
return Result.success();
int result= srvOrganEmpService.saveOrUpdateSrvOrganEmp(srvOrganEmpVo);
return result>0?Result.failed("该护理人员已存在于系统,请勿重复录入"):Result.success();
}
......@@ -346,14 +347,20 @@ public class SrvOrganController {
*/
@PostMapping("/chSrvTaskDetailDelete")
public Result chSrvTaskDetailDelete(Long taskDetailId,String userName){
int srv = srvOrganEmpService.chSrvTaskDetailDelete(taskDetailId,userName);
if(srv>0){
return Result.success();
}else {
return Result.failed("删除失败");
return srvOrganEmpService.chSrvTaskDetailDelete(taskDetailId,userName);
}
@GetMapping("/selectEmpBySrvOrganId")
public Result selectEmpBySrvOrganId(String srvOrganId){
if (StringUtils.isEmpty(srvOrganId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return srvOrganEmpService.selectEmpBySrvOrganId(srvOrganId);
}
}
package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetail2Vo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.math.BigDecimal;
/**
* @author mq
......@@ -22,6 +26,15 @@ public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> {
*/
Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page, Long empId);
int deleteFinshItem(long taskDetailId);
String selectBySrvTaskId(String srvTaskId);
int updateByTaskDetailId(String taskDetailId);
ChDisabDetailAccounts selectAccountsDetail(String disabInfoId, String srvDateStr);
void updateChDisabDetailAccounts(Long accountsId, BigDecimal accountsAllCostsub, BigDecimal accountsOverallCostsub, BigDecimal accountsPersonalCostsub);
}
......@@ -6,7 +6,8 @@ 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.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.disable.DisableInfoRespDTO;
import com.hungraim.ltc.pojo.vo.disable.ProgramRespDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -31,7 +32,11 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
*/
Page<DisableInfoListVo> getDisableInfoList(Page<DisableInfoListVo> page, @Param("srvOrganId") Long srvOrganId,String certiCode,String realName,String svrModelId);
int deleteSrvSend(Integer disableInfoId,String exitTime);
List<DisableInfoListVo> getDisableExitList();
List<ProgramRespDTO> selectProgram(String disabInfoId, String srvOrganId);
int updateSrvProgramById(ChSrvProgram chSrvProgram);
......@@ -39,6 +44,7 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
int updateSrvSendById(ChSrvSend chSrvSend);
int insertSrvSend(Integer disableInfoId);
List<DisableInfoRespDTO> selectDisableInfoByEmp(String srvEmpId);
}
......@@ -9,6 +9,7 @@ import com.hungraim.ltc.util.Result;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
......@@ -59,6 +60,8 @@ public interface DisableService {
*/
List<SrvModeVo> cfgSrvModeList();
Result selectProgram(String disabInfoId, String srvOrganId);
/**
* 查询机构下所有护理机构
*
......@@ -182,9 +185,15 @@ public interface DisableService {
Integer applyMethod);
int disableInfoExit(Integer disableInfoId,Integer exitReasonId,Integer applyId,Integer srvOrganId,Integer programId,String exitTime);
int disableInfoExit(DisableExitVO disableExitVO);
void disableExitHanlder(Integer exitReasonId, Integer srvOrganId, Integer disableInfoId, Date date);
List<ChDisableExit> getDisableExitHis(Integer disableInfoId);
Integer selectByCertiCode(String certiCode);
void disableExitTask();
Result selectDisableInfoByEmp(String srvEmpId);
}
......@@ -6,6 +6,7 @@ import com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetail2Vo;
import com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetailVo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpListVo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpVo;
import com.hungraim.ltc.util.Result;
import org.apache.poi.ss.usermodel.Workbook;
import java.util.List;
......@@ -64,14 +65,16 @@ public interface SrvOrganEmpService {
* eduId: "", // 文化水平
* fileDataList: [], // 对应数据库中的文件数据列表
*/
void saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo);
int saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo);
Workbook srvOrganExport(Long organId,Long srvOrganId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
Short isLock, Short empType);
Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page, Long empId);
int chSrvTaskDetailDelete(long taskDetailId,String userName);
Result chSrvTaskDetailDelete(long taskDetailId, String userName);
Result selectEmpBySrvOrganId(String srvOrganId);
void auditSrvOrganEmp(Integer userId,Long empId,Integer auditStatus);
......
......@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -16,13 +17,10 @@ import com.hungraim.ltc.pojo.entity.assessment.ChAprTask;
import com.hungraim.ltc.pojo.entity.assessment.ChDisableInfoHis;
import com.hungraim.ltc.pojo.entity.disable.*;
import com.hungraim.ltc.pojo.entity.riskLevel.ChDisableRiskLevel;
import com.hungraim.ltc.pojo.entity.riskLevel.ChSrvorganRiskLevel;
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.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.service.DisableService;
import com.hungraim.ltc.service.OrganService;
......@@ -33,13 +31,14 @@ import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.record.common.FeatSmartTag;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.awt.print.Book;
import java.util.*;
@Service
......@@ -365,6 +364,7 @@ public class DisableServiceImpl implements DisableService {
return srvModeMapper.selectAll();
}
@Override
public List<ChSrvOrgan> srvOrganList(String organId,Long srvOrganId, Boolean isInvolveChild) {
// zhangch 2021-11-04 修改查询条件 new QueryWrapper<ChSrvOrgan>().eq("organ_id", organId).eq("STATUS", (short) 0)
......@@ -618,7 +618,12 @@ public class DisableServiceImpl implements DisableService {
@Override
@Transactional(rollbackFor = Exception.class)
public int disableInfoExit(Integer disableInfoId, Integer exitReasonId,Integer applyId,Integer srvOrganId,Integer programId,String exitTime) {
public int disableInfoExit(DisableExitVO disableExitVO) {
String exitTime = disableExitVO.getExitTime();
Integer applyId = disableExitVO.getApplyId();
Integer exitReasonId = disableExitVO.getExitReasonId();
Integer srvOrganId = disableExitVO.getSrvOrganId();
Integer disableInfoId = disableExitVO.getDisableInfoId();
ChDisableApply chDisableApply = new ChDisableApply();
Date date = DateUtils.strToDate(exitTime);
chDisableApply.setApplyId(Long.valueOf(applyId));
......@@ -638,8 +643,24 @@ public class DisableServiceImpl implements DisableService {
int result = disableInfoMapper.updateById(chDisableInfo);
boolean now = DateUtils.isNow(date);
if (now) {
disableExitHanlder(exitReasonId, srvOrganId, disableInfoId, date);
}
return result;
}
/**
* 失能人员退出处理
*@param exitReasonId 失能退出原因
* @param srvOrganId 失能退出前所在护理机构
* @param disableInfoId 失能人员
* @param date 退出时间
*@return void
**/
@Override
public void disableExitHanlder(Integer exitReasonId, Integer srvOrganId, Integer disableInfoId, Date date) {
// 更新方案为已终止
ChSrvProgram chSrvProgram = new ChSrvProgram();
chSrvProgram.setProgramId(chSrvProgram.getProgramId());
chSrvProgram.setDisabInfoId(Long.valueOf(disableInfoId));
chSrvProgram.setProgStatus(2);
chSrvProgram.setEndReason("失能人员退出,终止方案");
......@@ -648,33 +669,33 @@ public class DisableServiceImpl implements DisableService {
ChSrvSend chSrvSend = new ChSrvSend();
chSrvSend.setDisabInfoId(Long.valueOf(disableInfoId));
chSrvSend.setEndTime(date);
// 4, 转入医保 5, 异地
//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);
}
}
// 解除护理机构分配
// delete from CH_SRV_SEND where DISAB_INFO_ID = '327'
// disableInfoMapper.deleteSrvSend(disableInfoId,exitTime);
// }
// 插入一条未分配的记录
ChSrvSend chSrvSend1 = new ChSrvSend();
chSrvSend1.setDisabInfoId(Long.valueOf(disableInfoId));
chSrvSend1.setFcd(new Date());
chSrvSend1.setStatus((short)0);
chSrvSendInfoMapper.insert(chSrvSend1);
}
// 插入历史记录
ChDisableExit chDisableExit = new ChDisableExit();
chDisableExit.setDisabInfoId(disableInfoId);
chDisableExit.setExitReasonId(exitReasonId);
chDisableExit.setExitTime(date);
chDisableExit.setSrvOrganId(srvOrganId);
disableExitMapper.insert(chDisableExit);
return result;
}
@Override
......@@ -692,6 +713,42 @@ public class DisableServiceImpl implements DisableService {
}
/**
* @desc 定时执行失能退出退出时间不是当天的
* @return void
**/
@Override
public void disableExitTask(){
List<DisableInfoListVo> disableExitList = disableInfoMapper.getDisableExitList();
for (DisableInfoListVo disableInfoListVo : disableExitList) {
Integer exitReasonId = disableInfoListVo.getExitReasonId();
Long srvOrganId = disableInfoListVo.getSrvOrganId();
Long disabInfoId = disableInfoListVo.getDisabInfoId();
String exitTime = disableInfoListVo.getExitTime();
Date date = DateUtils.strToDate(exitTime);
disableExitHanlder(exitReasonId,srvOrganId.intValue(),disabInfoId.intValue(),date);
}
}
@Override
public Result selectDisableInfoByEmp(String srvEmpId) {
List<DisableInfoRespDTO> disableInfoRespDTOS = disableInfoMapper.selectDisableInfoByEmp(srvEmpId);
if (CollectionUtils.isEmpty(disableInfoRespDTOS)) {
return Result.failed("没有找到相应的服务计划,请检查");
}
return Result.success(disableInfoRespDTOS);
}
@Override
public Result selectProgram(String disabInfoId, String srvOrganId) {
List<ProgramRespDTO> programRespDTOS = disableInfoMapper.selectProgram(disabInfoId, srvOrganId);
if (CollectionUtil.isEmpty(programRespDTOS)) {
return Result.success("没有找到相应的服务方案,请检查");
}
ProgramRespDTO programRespDTO = programRespDTOS.get(0);
return Result.success(programRespDTO);
}
}
......@@ -5,10 +5,13 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.*;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvEmpType;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrganApply;
......@@ -17,11 +20,15 @@ import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganEmp;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganEmpApply;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetailDelete;
import com.hungraim.ltc.pojo.vo.disable.*;
import com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetail2Vo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpExportVo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpListVo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.service.OrganService;
import com.hungraim.ltc.service.SrvOrganEmpService;
import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.DateUtils;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
......@@ -31,8 +38,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
......@@ -71,6 +79,8 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
return chSrvOrganEmpApplyMapper.getSrvOrganApplyEmpListVo(page, organIds, empName, srvOrganName, certifNum, isLock, empType,srvOrganId);
}
@Override
public void updateSrvEmpStatus(Long empId, Short isLock) {
ChSrvOrganEmp chSrvOrganEmp = new ChSrvOrganEmp();
......@@ -113,11 +123,19 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo) {
public int saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo) {
Long empId = srvOrganEmpVo.getEmpId();
ChSrvOrganEmpApply chSrvOrganEmpApply = new ChSrvOrganEmpApply();
BeanUtils.copyProperties(srvOrganEmpVo, chSrvOrganEmpApply);
int queryResult = 0;
if (null == empId) {
QueryWrapper<ChSrvOrganEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CERTIF_NUM", chSrvOrganEmp.getCertifNum());
queryWrapper.eq("IS_LOCK",0);
queryResult = chSrvOrganEmpMapper.selectCount(queryWrapper);
if(queryResult>0){
return queryResult;
}
// 新增
chSrvOrganEmpApply.setEffTime(new Date());
chSrvOrganEmpApply.setIsLock((short) 0);
......@@ -130,12 +148,12 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
chSrvempRiskLevel.setStatus(0);
chSrvempRiskLevel.setFcd(new Date());
chSrvempRiskLevelMapper.insert(chSrvempRiskLevel);
} else {
// 修改
chSrvOrganEmpApplyMapper.updateById(chSrvOrganEmpApply);
updateAttachs(srvOrganEmpVo, empId);
}
return queryResult;
}
// 抽取方法
......@@ -177,15 +195,116 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
@Transactional(rollbackFor = Exception.class)
@Override
public int chSrvTaskDetailDelete(long taskDetailId,String userName) {
public Result chSrvTaskDetailDelete(long taskDetailId,String userName) {
ChSrvTaskDetail chSrvTaskDetail = chSrvTaskDetailMapper.selectById(taskDetailId);
ChSrvTaskDetailDelete chSrvTaskDetailDelete = new ChSrvTaskDetailDelete();
BeanUtils.copyProperties(chSrvTaskDetail,chSrvTaskDetailDelete);
chSrvTaskDetailDelete.setDeleteDate(new Date());
chSrvTaskDetailDelete.setDeleteName(userName);
chSrvTaskDetailDeleteMapper.insert(chSrvTaskDetailDelete);
return chSrvTaskDetailMapper.deleteById(taskDetailId);
if( 4 == chSrvTaskDetail.getStatus()) {
// 开始时间
Date srvStartTime = chSrvTaskDetail.getSrvStartTime();
String srvStartTimeStr = DateUtils.dateTimeToStr(srvStartTime);
// 结束时间
Date srvEndTime = chSrvTaskDetail.getSrvEndTime();
String srvEndTimeStr = DateUtils.dateTimeToStr(srvEndTime);
Long min = dateDiff(srvStartTimeStr, srvEndTimeStr, "yyyy-MM-dd HH:mm:ss", "min");
if(min>=90){
Date srvDate = chSrvTaskDetail.getSrvDate();
String srvDateStr = DateUtils.dateToStrYm(srvDate);
Long srvTaskId = chSrvTaskDetail.getSrvTaskId();
String disabInfoId = chSrvTaskDetailMapper.selectBySrvTaskId(String.valueOf(srvTaskId));
ChDisabDetailAccounts chDisabDetailAccounts = chSrvTaskDetailMapper.selectAccountsDetail(disabInfoId, srvDateStr);
Short status = chDisabDetailAccounts.getStatus();
if(status != 0){
// 已申报不能进行删除
return Result.failed("已申报不能进行删除");
}
BigDecimal accountsAllCost = chDisabDetailAccounts.getAccountsAllCost();
BigDecimal accountsPersonalCost = chDisabDetailAccounts.getAccountsPersonalCost();
BigDecimal accountsOverallCost = chDisabDetailAccounts.getAccountsOverallCost();
BigDecimal accountsAllCostsub = accountsAllCost.subtract(new BigDecimal(75));
BigDecimal accountsOverallCostsub = accountsOverallCost.subtract(new BigDecimal(60));
BigDecimal accountsPersonalCostsub = accountsPersonalCost.subtract(new BigDecimal(15));
Long accountsId = chDisabDetailAccounts.getAccountsId();
chSrvTaskDetailMapper.updateChDisabDetailAccounts(accountsId,accountsAllCostsub,accountsOverallCostsub,accountsPersonalCostsub);
}
}
chSrvTaskDetailMapper.deleteFinshItem(taskDetailId);
int srv = chSrvTaskDetailMapper.updateByTaskDetailId(String.valueOf(chSrvTaskDetail.getTaskDetailId()));
if(srv>0){
return Result.success();
}else {
return Result.failed("删除失败");
}
}
/**
* 计算2个时间相差的天数、小时、分钟、秒
* @param startTime 开始时间
* @param endTime 截止时间
* @param format 时间格式 yyyy-MM-dd HH:mm:ss
* @param str 返回的数据为:day-天、hour-小时、min-分钟、second-秒
* @return
*/
public static Long dateDiff(String startTime, String endTime, String format, String str) {
// 按照传入的格式生成一个simpledateformate对象
SimpleDateFormat sd = new SimpleDateFormat(format);
long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
long nh = 1000 * 60 * 60;// 一小时的毫秒数
long nm = 1000 * 60;// 一分钟的毫秒数
long ns = 1000;// 一秒钟的毫秒数
long diff;
long day = 0;
long hour = 0;
long min = 0;
long second = 0;
// 获得两个时间的毫秒时间差异
try {
diff = sd.parse(endTime).getTime() - sd.parse(startTime).getTime();
// 计算差多少天
day = diff / nd;
// 计算差多少小时
hour = diff / nh ;
// 计算差多少分钟
min = diff / nm ;
// 计算差多少秒
second = diff / ns;
// 输出结果
System.out.println("时间相差:" + day + "天" +
(hour - day * 24) + "小时"
+ (min - day * 24 * 60) + "分钟" +
second + "秒。");
/*System.out.println("hour=" + hour + ",min=" + min);*/
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (str.equalsIgnoreCase("day")) {
return day;
} else if(str.equalsIgnoreCase("hour")) {
return hour;
} else if(str.equalsIgnoreCase("min")) {
return min;
} else {
return second;
}
}
@Override
public Result selectEmpBySrvOrganId(String srvOrganId){
LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<ChSrvOrganEmp>()
.eq(ChSrvOrganEmp::getSrvOrganId,Long.valueOf(srvOrganId))
.eq(ChSrvOrganEmp::getIsLock,(short)0);
List<ChSrvOrganEmp> list = chSrvOrganEmpMapper.selectList(lambdaQueryWrapper);
return Result.success(list);
}
@Override
public void auditSrvOrganEmp(Integer userId, Long empId, Integer auditStatus) {
......
......@@ -66,12 +66,42 @@
--t.STATUS status,
decode( t.STATUS, '0', '未执行', '1', '执行中', '2', '已执行', '4', '已完成' ) AS status,
t.SRV_START_TIME sevStarTime,
t.SRV_END_TIME sevEndTime
t.SRV_END_TIME sevEndTime,
info.REAL_NAME realName
FROM
CH_SRV_TASK_DETAIL t
LEFT JOIN CH_SRV_TASK k ON t.SRV_TASK_ID = k.SRV_TASK_ID
left join CH_DISABLE_INFO info on info.DISAB_INFO_ID = k.DISAB_INFO_ID
LEFT JOIN CH_SRV_ORGAN_EMP m ON m.EMP_ID = k.SRV_EMP_ID
LEFT JOIN CH_SRV_ORGAN T5 ON T5.SRV_ORGAN_ID = m.SRV_ORGAN_ID
WHERE m.EMP_ID = #{empId}
order by t.TASK_DETAIL_ID desc
</select>
<update id="updateByTaskDetailId">
UPDATE CH_SRV_TASK_DETAIL SET SRV_START_TIME=null,SRV_END_TIME=null,SRV_START_PIC=null,SRV_END_PIC=null,
SRV_START_PIC2=null,STATUS=0
WHERE TASK_DETAIL_ID = #{taskDetailId}
</update>
<update id = "updateChDisabDetailAccounts">
UPDATE CH_DISAB_ACCOUNTS_DETAIL d SET d.ACCOUNTS_ALL_COST = #{accountsAllCostsub}, d.ACCOUNTS_OVERALL_COST = #{accountsOverallCostsub},
d.ACCOUNTS_PERSONAL_COST = #{accountsPersonalCostsub}
WHERE d.ACCOUNTS_ID = #{accountsId}
</update>
<select id="selectBySrvTaskId" resultType="java.lang.String">
select DISAB_INFO_ID from CH_SRV_TASK where SRV_TASK_ID = #{srvTaskId} and rownum = 1
</select>
<select id="selectAccountsDetail" resultType="com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts">
select * from CH_DISAB_ACCOUNTS_DETAIL d where d.DISAB_INFO_ID = #{disabInfoId} and to_char(d.ACCOUNTS_TIME,'yyyy-MM') = #{srvDateStr}
</select>
<delete id="deleteFinshItem">
delete from CH_SRV_TASK_FINISH_ITEM where TASK_DETAIL_ID = #{taskDetailId}
</delete>
</mapper>
\ No newline at end of file
......@@ -4,7 +4,7 @@
<select id="getDisableInfoList" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo">
SELECT distinct T2.DISAB_INFO_ID disabInfoId,
T1.PROGRAM_ID programId,
T6.SRV_ORGAN_ID srvOrganId,
T1.SRV_ORGAN_ID srvOrganId,
T5.DISTRICT_PROVINCIAL districtProvincial,
T5.DISTRICT_CITY districtCity,
T2.REAL_NAME realName,
......@@ -16,7 +16,8 @@
T2.ACPT_AREA acptArea,
T2.ACPT_STREET acptStreet,
T2.ACPT_ADDRESS acptAddress,
T7.MODE_NAME svrModelName,
-- T7.MODE_NAME svrModelName,
DECODE(T1.SRV_MODE_ID, '1','医疗','2', '养老','3','上门', '4', '异地') srvModeName,
T5.SRV_ORGAN_NAME svrOrganName,
T1.PROG_STATUS progStatus,
T1.EFF_TIME effTime,
......@@ -30,14 +31,14 @@
T2.EXIT_FLAG exitFlag,
T2.EXIT_REASON_ID exitReasonId
FROM CH_DISABLE_INFO T2
inner join (select * from CH_SRV_SEND where STATUS in(1,3)) T6 on T6.DISAB_INFO_ID = T2.DISAB_INFO_ID
-- inner join (select * from CH_SRV_SEND where STATUS in(1,3)) T6 on T6.DISAB_INFO_ID = T2.DISAB_INFO_ID
LEFT 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_SRV_ORGAN T5 ON T6.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
-- LEFT JOIN CH_CFG_SRV_MODE T7 ON T2.SRV_MODE_ID = T7.MODE_ID
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
<where>
1=1
<if test="srvOrganId != null and srvOrganId != '' and srvOrganId!=0">
and T5.SRV_ORGAN_ID = #{srvOrganId}
and T1.SRV_ORGAN_ID = #{srvOrganId}
</if>
<if test="certiCode != null and certiCode != ''">
and T2.CERTI_CODE = #{certiCode}
......@@ -46,21 +47,52 @@
and T2.real_name like CONCAT(CONCAT('%',#{realName}) ,'%')
</if>
<if test="svrModelId != null and svrModelId != ''">
and T7.MODE_ID = #{svrModelId}
and T1.SRV_MODE_ID = #{svrModelId}
</if>
</where>
</select>
<select id="getDisableExitList" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo">
SELECT distinct T2.DISAB_INFO_ID disabInfoId,
T1.PROGRAM_ID programId,
T6.SRV_ORGAN_ID srvOrganId,
T5.DISTRICT_PROVINCIAL districtProvincial,
T5.DISTRICT_CITY districtCity,
T2.REAL_NAME realName,
T7.MODE_NAME svrModelName,
T5.SRV_ORGAN_NAME svrOrganName,
T1.PROG_STATUS progStatus,
T1.EFF_TIME effTime,
T2.CERTI_CODE certiCode,
T2.APPLY_ID applyId,
to_char(T2.EXIT_TIME,'yyyy-MM-dd') exitTime,
--服务方案起始日
--服务方案终止日
to_char(T1.PROGRAM_DATE,'yyyy-MM-dd HH24:mi:ss') programDate,
to_char(T1.PROGRAM_EDN_DATE,'yyyy-MM-dd HH24:mi:ss') programEdnDate,
T2.EXIT_FLAG exitFlag,
T2.EXIT_REASON_ID exitReasonId
FROM CH_DISABLE_INFO T2
inner join (select * from CH_SRV_SEND where STATUS in(1,3)) T6 on T6.DISAB_INFO_ID = T2.DISAB_INFO_ID
LEFT 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_SRV_ORGAN T5 ON T6.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
where T2.EXIT_TIME is not null
and T2.EXIT_TIME = to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd')
</select>
<update id="updateChSrvProgram">
update CH_SRV_PROGRAM t set t.PROG_STATUS ='2' ,t.END_TIME =sysdate
where t.PROGRAM_ID =#{programId}
</update>
<delete id="deleteSrvSend">
delete from CH_SRV_SEND where DISAB_INFO_ID = #{disableInfoId}
</delete>
<update id="updateSrvProgramById" parameterType="com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram">
......@@ -73,12 +105,15 @@
s.DISAB_INFO_ID = #{disabInfoId}
</update>
<select id="selectDisableInfoByEmp" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoRespDTO">
select i.REAL_NAME realName,i.DISAB_INFO_ID disabInfoId,i.SRV_MODE_ID srvModeId,t.SRV_TASK_ID srvTaskId from CH_DISABLE_INFO i left join ch_srv_task t
on i.DISAB_INFO_ID = t.DISAB_INFO_ID where t.SRV_EMP_ID = #{srvEmpId} and <![CDATA[ t.STATUS<> 2 ]]>
</select>
<select id="selectProgram" resultType="com.hungraim.ltc.pojo.vo.disable.ProgramRespDTO">
select * from CH_SRV_PROGRAM t where t.DISAB_INFO_ID = #{disabInfoId} and t.srv_organ_id = #{srvOrganId} and
<![CDATA[ t.PROG_STATUS<> 2 ]]> order by t.FCD desc
</select>
<insert id="insertSrvSend">
<selectKey resultType="java.lang.Integer" order="BEFORE" keyProperty="id">
SELECT seq_ch_srv_send.NEXTVAL as id FROM DUAL
</selectKey>
insert INTO ch_srv_send(SRV_SEND_ID,DISAB_INFO_ID,FCD,STATUS) values
(#{id},#{disableInfoId},SYSDATE,0)
</insert>
</mapper>
\ No newline at end of file
package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author jiaguokai
*
*/
@Mapper
@Repository
public interface SrvSendMapper extends BaseMapper<ChSrvSend> {
}
......@@ -77,7 +77,6 @@ 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);
int insertSrvSend(Integer disableInfoId);
ChDisableInfo selectDisableBycertiCode(@Param("certiCode") String certiCode);
......
......@@ -15,6 +15,7 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.assessment.*;
import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvDisableLevel;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.vo.ReportUpdateVO;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsExportResp;
import com.hungraim.ltc.pojo.vo.account.AssessAccountsListResp;
......@@ -68,6 +69,9 @@ public class TaskServiceImpl implements TaskService {
private final ChAssessAccountsDetailMapper chAssessDetailAccountsMapper;
private final SrvSendMapper srvSendMapper;
......@@ -216,7 +220,11 @@ public class TaskServiceImpl implements TaskService {
if(2 == reportDetailVO.getEvaluateType()){
ChAprTask chAprTask = taskMapper.selectById(reportDetailVO.getTaskId());
Integer disableInfoId = chAprTask.getDisableInfoId();
taskMapper.insertSrvSend(disableInfoId);
ChSrvSend chSrvSend = new ChSrvSend();
chSrvSend.setStatus((short) 0);
chSrvSend.setDisabInfoId(Long.valueOf(disableInfoId));
chSrvSend.setFcd(new Date());
srvSendMapper.insert(chSrvSend);
}
return Result.success();
}
......@@ -384,7 +392,11 @@ public class TaskServiceImpl implements TaskService {
if(2 == vo.getEvaluateType()){
ChAprTask chAprTask = taskMapper.selectById(chAprReport.getTaskId());
Integer disableInfoId = chAprTask.getDisableInfoId();
taskMapper.insertSrvSend(disableInfoId);
ChSrvSend chSrvSend = new ChSrvSend();
chSrvSend.setStatus((short) 0);
chSrvSend.setDisabInfoId(Long.valueOf(disableInfoId));
chSrvSend.setFcd(new Date());
srvSendMapper.insert(chSrvSend);
}
//附件上传
......
......@@ -24,7 +24,7 @@
(select DISTRICT_NAME from CH_FND_DISTRICT dis where task.DISTRICT_CITY = dis.DISTRICT_CODE) districPity,
(select DISTRICT_NAME from CH_FND_DISTRICT dis where task.DISTRICT_AREA = dis.DISTRICT_CODE) districtArea,
disable.real_name realName,
task.fcd fcd,
to_char(apply.APPLY_TIME,'yyyy-MM-dd') fcd,
disable.certi_code certiCode,
disable.disease_desc diseaseDesc,
disable.adress_detail operAddress,
......@@ -65,6 +65,7 @@
left join ch_apr_organ aprOrgan on task.apr_organ_id = aprOrgan.apr_organ_id
-- left join ch_srv_organ organ on aprOrgan.organ_id = organ.organ_id
left join ch_disable_info disable on task.disable_info_id = disable.disab_info_id
left join CH_DISABLE_APPLY apply on apply.apply_id = disable.apply_id
left join ch_apr_emp emp on task.apr_emp_id = emp.emp_id and emp.IS_LOCK = 0
left join ch_apr_task_push push on task.task_id = push.task_id
left join ch_apr_task_emp cate on task.task_id = cate.task_id
......@@ -493,10 +494,6 @@
<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">
......
......@@ -84,10 +84,7 @@ public class ChDisabDetailAccounts implements Serializable {
*/
private String taskDetailId;
/**
* 护理人员id
*/
private Long empId;
/**
* 统筹区
......
......@@ -37,5 +37,9 @@ public class NursingRecordsRespVO {
private String srvEndTime;
private String empName;
private String realName;
}
......@@ -239,5 +239,16 @@ public class ChSrvTaskDetail implements Serializable {
*/
private Short taskDetailType;
/**
* 服务时长项目开始图片路径
*/
private String srvStartPic2;
private Short isClock;
private String clockReason;
private String clockOperator;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -15,6 +15,11 @@ public class AccountOperVo extends ChDisabAccounts {
private String organId;
/**
* 服务方式
**/
private String modeName;
/**
* 文件列表数据对象
*/
private List<ChFndAttach> fileDataList;
......
......@@ -44,5 +44,7 @@ public class SrvOrganListReq extends BaseReq {
private String realName;
private List<String> accountsStatusList;
// 是否展示异地 1 不展示
private String flag;
}
package com.hungraim.ltc.pojo.vo.account;
import lombok.Data;
/**
* @author zwl
* @ClassName TaskDetailDisableVO
* @description
* @date 2023/3/30 23:03
**/
@Data
public class TaskDetailDisableVO {
private String disabInfoId;
private String srvDate;
private String taskDetailId;
}
......@@ -22,8 +22,9 @@ public class TaskDistributionVO {
//失能人员姓名
private String realName;
//申请日期
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date fcd;
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
// private Date fcd;
private String fcd;
//失能人员身份证号码
private String certiCode;
//保单号
......
......@@ -24,4 +24,6 @@ public class ChSrvTaskDetail2Vo extends BaseReq {
private String sevStarTime;
private String sevEndTime;
private String realName;
}
package com.hungraim.ltc.pojo.vo.disable;
import lombok.Data;
/**
* @author zwl
* @ClassName DisableExitVO
* @description
* @date 2023/3/29 10:06
**/
@Data
public class DisableExitVO {
private Integer disableInfoId;
private Integer exitReasonId;
private Integer applyId;
private Integer srvOrganId;
private Integer programId;
private String exitTime;
}
package com.hungraim.ltc.pojo.vo.disable;
import lombok.Data;
/**
* @author zwl
* @ClassName DisableInfoRespDTO
* @description
* @date 2023/4/12 16:42
**/
@Data
public class DisableInfoRespDTO {
private Long disabInfoId;
private String realName;
private String srvModeId;
private String srvTaskId;
}
package com.hungraim.ltc.pojo.vo.disable;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author zwl
* @ClassName ProgramRespDTO
* @description
* @date 2023/4/12 16:49
**/
@Data
public class ProgramRespDTO {
/**
* 方案生效时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date programDate;
/**
* 方案终止时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date programEdnDate;
}
package com.hungraim.ltc.pojo.vo.governance;
import lombok.Data;
/**
* @author zwl
* @ClassName ItemDTO
* @description
* @date 2023/4/13 10:52
**/
@Data
public class ItemDTO {
private String itemId;
private String itemName;
}
package com.hungraim.ltc.pojo.vo.governance;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author zwl
* @ClassName SrvPlanInputVO
* @description
* @date 2023/4/12 11:08
**/
@Data
public class SrvPlanInputVO {
private Long srvOrganId;
private Long disabInfoId;
private Long modeId;
private Long empId;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date srvPlanTime;
/**
* 服务项目ids
*/
private String[] itemIds;
/**
* 操作人
*/
private String admin;
/**
* 补卡原因
*/
private String clockReason;
private Long srvTaskId;
}
......@@ -63,4 +63,6 @@ public class SrvSendVO extends PageInfo implements Serializable {
private String applyStatus;
//分配状态
private String status;
private String exitReasonId;
}
......@@ -2,6 +2,8 @@ package com.hungraim.ltc.governance.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.dao.ChSrvSendMapper;
......@@ -81,18 +83,18 @@ public class BuildBedController {
//家庭住址
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (buildBedDetailVo.getNursingDemandLevel() == null || buildBedDetailVo.getNursingDemandLevel() < 1 || buildBedDetailVo.getNursingDemandLevel() > 5) {
/*if (buildBedDetailVo.getNursingDemandLevel() == null || buildBedDetailVo.getNursingDemandLevel() < 1 || buildBedDetailVo.getNursingDemandLevel() > 5) {
//护理需求等级
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(buildBedDetailVo.getChanghuNo())) {
}*/
/* if (StringUtils.isBlank(buildBedDetailVo.getChanghuNo())) {
//长护号
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (buildBedDetailVo.getGuaranteeMode() == null || buildBedDetailVo.getGuaranteeMode() < 1 || buildBedDetailVo.getGuaranteeMode() > 3) {
}*/
/*if (buildBedDetailVo.getGuaranteeMode() == null || buildBedDetailVo.getGuaranteeMode() < 1 || buildBedDetailVo.getGuaranteeMode() > 3) {
//保障方式
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
}*/
buildBedService.saveOrUpdateBuildBed(buildBedDetailVo);
return Result.success();
}
......@@ -182,6 +184,13 @@ public class BuildBedController {
if (StrUtil.isBlankIfStr(disableInfoId)) {
return Result.failed("失能人员ID 为空!");
}
ChDisableInfo chDisableInfo = disableInfoServie.querySrvModeId(Long.valueOf(disableInfoId));
Integer exitReasonId = chDisableInfo.getExitReasonId();
if(exitReasonId != null && 1 == exitReasonId){
return Result.failed("该失能人员已死亡退出,不能进行操作");
}
DisableInfoTaskVO disableInfoTaskVO = sendService.selectTaskById(disableInfoId, srvOrganId);
List<DisableInfoTaskVO> disableInfoTaskVO1 = sendService.selectBydisableInfoId(disableInfoId);
Map map = new HashMap<>();
......@@ -242,17 +251,17 @@ public class BuildBedController {
}
ChDisableInfo chDisableInfo = disableInfoServie.querySrvModeId(disabInfoId);
Integer srvModeId = chDisableInfo.getSrvModeId();
Integer exitReasonId = chDisableInfo.getExitReasonId();
/* Integer exitReasonId = chDisableInfo.getExitReasonId();
if(exitReasonId!= null && 1 == exitReasonId){
return Result.failed("该失能人员已死亡退出,不能进行操作");
}
*/
List<ChSrvSend> chSrvSendsList = chSrvSendMapper.selectList(new LambdaQueryWrapper<ChSrvSend>()
.eq(ChSrvSend::getDisabInfoId, disabInfoId)
.eq(ChSrvSend::getStatus, (short) 1));
if (chSrvSendsList.size() > 0) {
/* if (chSrvSendsList.size() > 0) {
return Result.failed("已分配护理机构,请先终止或退出再操作");
}
}*/
Long srvModeId1 = chSrvSend.getSrvModeId();
if(srvModeId != srvModeId1.intValue()){
......@@ -270,15 +279,10 @@ public class BuildBedController {
chSrvSend.setAllotTime(new Date());
chSrvSend.setStatus(Short.valueOf("1"));
if (chrSrvVo.getSrvSendId() == null) {
// Long id = sendService.selectMaxId();
// if (id == null) {
// id = 0L;
// }
// chSrvSend.setSrvSendId(++id);
sendService.insertSrvSend(chSrvSend);
}else {
chSrvSend.setSrvSendId(chrSrvVo.getSrvSendId());
sendService.updateById(chSrvSend);
chSrvSendMapper.updateSrvSendById(chSrvSend);
}
}
......@@ -343,8 +347,8 @@ public class BuildBedController {
* @return
*/
@GetMapping("/chPunchDetailsQuery")
public Result chPunchDetailsQuery(Long taskDetailId,String sevStarTime,String sevEndTime){
ChPunchDetailsVO chPunchDetailsVO = buildBedService.chPunchDetailsQuery(taskDetailId,sevStarTime,sevEndTime);
public Result chPunchDetailsQuery(Long taskDetailId,String certiCode,String sevStarTime,String sevEndTime){
ChPunchDetailsVO chPunchDetailsVO = buildBedService.chPunchDetailsQuery(taskDetailId,certiCode,sevStarTime,sevEndTime);
return Result.success(chPunchDetailsVO);
}
......@@ -368,4 +372,3 @@ public class BuildBedController {
}
\ No newline at end of file
......@@ -170,12 +170,12 @@ public class SrvProgramController {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
// 添加的话,需要校验其它服务方案是否已终止
if (programDetailVo.getProgramId() == null) {
/* if (programDetailVo.getProgramId() == null) {
List<ChSrvProgram> srvPrograms = srvProgramService.getProgramSetCountByProgStatus(programDetailVo.getDisabInfoId(), programDetailVo.getSrvOrganId(), "2");
if (srvPrograms.size() > 0) {
return Result.failed(ResultCode.REQUEST_PROGRAM_ADD_ERROR);
}
}
}*/
// 进行添加或者修改操作
srvProgramService.addProgramAndProgramSetList(programDetailVo);
return Result.success();
......
......@@ -154,4 +154,27 @@ public class SrvTaskController {
return Result.success();
}
/**
* 补卡
**/
@PostMapping("/saveApplyCard")
public Result saveApplyCard(SrvPlanInputVO srvPlanInputVO){
if (srvPlanInputVO.getDisabInfoId() == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return srvTaskService.saveApplyCard(srvPlanInputVO);
}
/**
* 根据护理机构查询项目
**/
@GetMapping("/queryItem")
public Result queryItem(Long srvOrganId){
if (srvOrganId == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
return srvTaskService.queryItemBySrvOrganId(srvOrganId);
}
}
......@@ -32,7 +32,7 @@ public class SrvTaskScheduledController {
@Scheduled(cron = "0 35 23 * * ?")
@Scheduled(cron = "0 20 23 * * ?")
public void timeAllocationSrvTask() {
boolean flag = redisLock.tryLock(JOB_KEY, 1000*30);
if(flag){
......@@ -44,4 +44,6 @@ public class SrvTaskScheduledController {
}
}
......@@ -40,7 +40,9 @@ public interface BuildBedMapper extends BaseMapper<ChSrvBuildBed> {
ChPunchDetailsVO getsrvOrgan(Long taskDetailId);
List<ChServiceTypeDetailedVO> getServiceTypeDetailed(@Param("taskDetailId")Long taskDetailId,@Param("sevStarTime")String sevStarTime,@Param("sevEndTime")String sevEndTime);
List<ChServiceTypeDetailedVO> getServiceTypeDetailed(@Param("taskDetailId")Long taskDetailId,@Param("certiCode")String certiCode,@Param("sevStarTime")String sevStarTime,@Param("sevEndTime")String sevEndTime,@Param("modeType")String modeType);
List<ChServiceTypeVO> selectServiceTypeDetailed();
String selectModeTypeById(@Param("pId")Long pId);
}
......@@ -3,6 +3,7 @@ package com.hungraim.ltc.governance.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.governance.ChSrvPlan;
import com.hungraim.ltc.pojo.vo.governance.ItemDTO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
......@@ -13,4 +14,6 @@ import java.util.List;
public interface ChSrvPlanMapper extends BaseMapper<ChSrvPlan> {
List<ChSrvPlan> queryPlan(String programId,String srvPlanTime);
List<ItemDTO> queryItem(Long srvOrganId);
}
......@@ -23,5 +23,7 @@ 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);
int updateSrvSendInfo(Long disabInfoId);
int updateSrvSendInfo(Long disabInfoId,String programEdnDateStr);
int updateSrvSendById(ChSrvSend chSrvSend);
}
\ No newline at end of file
......@@ -53,5 +53,5 @@ public interface IBuildBedService extends IService<ChSrvBuildBed> {
* 打卡详情
* @param taskDetailId
*/
ChPunchDetailsVO chPunchDetailsQuery(Long taskDetailId,String sevStarTime,String sevEndTime);
ChPunchDetailsVO chPunchDetailsQuery(Long taskDetailId,String certiCode,String sevStarTime,String sevEndTime);
}
package com.hungraim.ltc.governance.service;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.util.Result;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
......@@ -35,4 +38,8 @@ public interface SrvTaskService {
void timeAllocationSrvTask(String dateStr);
// 补卡
Result saveApplyCard(SrvPlanInputVO srvPlanInputVO);
Result queryItemBySrvOrganId(Long srvOrganId);
}
......@@ -122,7 +122,7 @@ public class BuildBedServiceImpl extends ServiceImpl<BuildBedMapper, ChSrvBuildB
* @param taskDetailId
*/
@Override
public ChPunchDetailsVO chPunchDetailsQuery(Long taskDetailId, String sevStarTime,String sevEndTime) {
public ChPunchDetailsVO chPunchDetailsQuery(Long taskDetailId,String certiCode, String sevStarTime,String sevEndTime) {
List<ChPunchDetailVO> chPunchDetailVOS = new ArrayList<>();
//获取项目信息
List<ChServiceTypeVO> chServiceTypeDetaileds = buildBedMapper.selectServiceTypeDetailed();
......@@ -144,7 +144,8 @@ public class BuildBedServiceImpl extends ServiceImpl<BuildBedMapper, ChSrvBuildB
}
log.info("chPunchDetailsQuery获取服务机构和服务类型:"+chPunchDetailsVO);
//打卡详情
List<ChServiceTypeDetailedVO> serviceTypeDetailed1s = buildBedMapper.getServiceTypeDetailed(taskDetailId,sevStarTime, sevEndTime);
String modeType = buildBedMapper.selectModeTypeById(taskDetailId);
List<ChServiceTypeDetailedVO> serviceTypeDetailed1s = buildBedMapper.getServiceTypeDetailed(taskDetailId,certiCode,sevStarTime, sevEndTime,modeType);
log.info("chPunchDetailsQuery打卡详情:"+serviceTypeDetailed1s);
chPunchDetailsVO.setRecordData(chPunchDetailVOS);
chPunchDetailsVO.setChPunchDetailVOS(serviceTypeDetailed1s);
......
......@@ -3,6 +3,7 @@ package com.hungraim.ltc.governance.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -14,13 +15,13 @@ import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
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.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.DateUtils;
import com.hungraim.ltc.util.Result;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -145,7 +146,13 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvTask.setSrvEmpId(Long.parseLong(srvTaskInfoVO.getSrvEmpId()));//服务人员id
chSrvTask.setStatus((short) 1);//状态 未分配:0;已分配:1;已终止2
chSrvTask.setSrvDate(DateUtils.strToDate(taskDetails.get(0)));
chSrvTask.setFcd(new Date());
srvTaskMapper.insert(chSrvTask);
// 服务计划制定方案修改为已生效
ChSrvProgram chSrvProgram = new ChSrvProgram();
chSrvProgram.setProgramId(Long.valueOf(programId));
chSrvProgram.setProgStatus(1);
chSrvProgramMapper.updateById(chSrvProgram);
//添加服务计划详情
Long newSrvTaskId = chSrvTask.getSrvTaskId();
this.insertTaskDetail(newSrvTaskId, taskDetails);
......@@ -154,8 +161,14 @@ public class SrvTaskServiceImpl implements SrvTaskService {
// this.updateAttachs(srvTaskInfoVO.getListAttach(), chSrvTask.getSrvTaskId());
} else {
// 修改服务计划
chSrvTaskDetailMapper.delete(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", Long.parseLong(srvTaskId)));//删除原来的计划详情
this.insertTaskDetail(Long.parseLong(srvTaskId), taskDetails);
// chSrvTaskDetailMapper.delete(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", Long.parseLong(srvTaskId)));//删除原来的计划详情
if("2".equals(srvTaskInfoVO.getTaskStatus())){
UpdateWrapper updateWrapper1 = new UpdateWrapper();
updateWrapper1.eq("SRV_TASK_ID",srvTaskId);
updateWrapper1.set("STATUS",3);
chSrvTaskDetailMapper.update(null,updateWrapper1);
}
// this.insertTaskDetail(Long.parseLong(srvTaskId), taskDetails);
//修改服务计划
ChSrvTask chSrvTask = new ChSrvTask();
UpdateWrapper updateWrapper = new UpdateWrapper();
......@@ -198,6 +211,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvTaskDetail.setSrvTaskId(srvTaskId);//taskId
chSrvTaskDetail.setSrvDate(DateUtils.strToDate(taskDetail));//服务开始时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetail.setFcd(new Date());
chSrvTaskDetailMapper.insert(chSrvTaskDetail);
}
}
......@@ -218,11 +232,12 @@ public class SrvTaskServiceImpl implements SrvTaskService {
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);
Date programEdnDate = chSrvProgram.getProgramEdnDate();
String programEdnDateStr = DateUtils.dateToStr(programEdnDate);
int i = chSrvSendMapper.updateSrvSendInfo(disabInfoId, programEdnDateStr);
if(i >0 ){
log.info("服务分配{}终止成功",disabInfoId);
}
}
}
// 查询需要执行的计划
......@@ -236,13 +251,14 @@ public class SrvTaskServiceImpl implements SrvTaskService {
int chSrvTaskDetailCount = chSrvTaskDetailMapper
.getSrvTaskDetail(String.valueOf(srvTaskId), dateStr);
if (chSrvTaskDetailCount > 0) {
log.info("{},已经有计划任务了",dateStr);
log.info("{},已经有计划任务了",srvTaskId);
continue;
}
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
chSrvTaskDetail.setSrvTaskId(srvTaskId);//taskId
chSrvTaskDetail.setSrvDate(DateUtils.strToDate(dateStr));//服务开始时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetail.setFcd(new Date());
chSrvTaskDetailMapper.insert(chSrvTaskDetail);
// ch_srv_plan
String programId = chSrvTask.getProgramId();
......@@ -250,4 +266,83 @@ public class SrvTaskServiceImpl implements SrvTaskService {
}
}
// 补卡
@Transactional(rollbackFor = Exception.class)
@Override
public Result saveApplyCard(SrvPlanInputVO srvPlanInputVO){
Long taskDetailId = null;
// 先查询是否有计划,有计划了不再生成计划
List<ChSrvTaskDetail> chSrvTaskDetailList = chSrvTaskDetailMapper.selectList(new LambdaQueryWrapper<ChSrvTaskDetail>()
.eq(ChSrvTaskDetail::getSrvTaskId, srvPlanInputVO.getSrvTaskId())
.eq(ChSrvTaskDetail::getSrvDate, srvPlanInputVO.getSrvPlanTime()));
if (CollectionUtil.isNotEmpty(chSrvTaskDetailList)) {
ChSrvTaskDetail chSrvTaskDetail = chSrvTaskDetailList.get(0);
taskDetailId = chSrvTaskDetail.getTaskDetailId();
List<ChSrvPlan> srvPlanList = chSrvPlanMapper.selectList(new LambdaQueryWrapper<ChSrvPlan>()
.eq(ChSrvPlan::getDisabInfoId, srvPlanInputVO.getDisabInfoId())
.eq(ChSrvPlan::getSrvPlanTime, srvPlanInputVO.getSrvPlanTime())
.eq(ChSrvPlan::getModeId, srvPlanInputVO.getModeId()));
if(CollectionUtil.isNotEmpty(srvPlanList)){
return Result.failed("任务列表已有计划,不可重复生成");
}
}else {
// 插入计划表
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
// taskId
chSrvTaskDetail.setSrvTaskId(srvPlanInputVO.getSrvTaskId());
// 服务开始时间
chSrvTaskDetail.setSrvDate(srvPlanInputVO.getSrvPlanTime());
// 状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetail.setStatus((short) 0);
// 补卡标识
chSrvTaskDetail.setIsClock((short) 1);
chSrvTaskDetail.setClockReason(srvPlanInputVO.getClockReason());
chSrvTaskDetail.setClockOperator("admin");
chSrvTaskDetail.setFcd(new Date());
int insert = chSrvTaskDetailMapper.insert(chSrvTaskDetail);
if(insert == 0){
return Result.failed("补卡失败,请重新提交");
}
taskDetailId = chSrvTaskDetail.getTaskDetailId();
}
try {
log.info("=======SrvTaskServiceImpl.saveApplyCard.taskDetailId:{}",taskDetailId);
String[] itemIds = srvPlanInputVO.getItemIds();
List<ItemDTO> itemDTOS = chSrvPlanMapper.queryItem(srvPlanInputVO.getSrvOrganId());
for (String r : itemIds) {
ChSrvPlan chSrvPlan = new ChSrvPlan();
chSrvPlan.setItemId(Long.valueOf(r));
if (CollectionUtil.isNotEmpty(itemDTOS)) {
String itemName = itemDTOS.stream().filter(s -> s.getItemId().equals(r)).map(ItemDTO::getItemName).findFirst().orElse(null);
chSrvPlan.setItemName(itemName);
}
chSrvPlan.setSrvOrganId(srvPlanInputVO.getSrvOrganId());
chSrvPlan.setModeId(srvPlanInputVO.getModeId());
chSrvPlan.setCreationTime(new Date());
chSrvPlan.setDisabInfoId(srvPlanInputVO.getDisabInfoId());
chSrvPlan.setEmpId(srvPlanInputVO.getEmpId());
chSrvPlan.setSrvPlanTime(srvPlanInputVO.getSrvPlanTime());
chSrvPlan.setTaskDetailId(taskDetailId);
chSrvPlan.setIsStatus(Long.valueOf(0));
int insert1 = chSrvPlanMapper.insert(chSrvPlan);
if(insert1==0){
return Result.failed("补卡失败,请重新提交");
}
}
} catch (Exception e) {
log.error("=======SrvTaskServiceImpl error {}",e);
return Result.failed("补卡失败");
}
return Result.success();
}
@Override
public Result queryItemBySrvOrganId(Long srvOrganId){
List<ItemDTO> itemDTOS = chSrvPlanMapper.queryItem(srvOrganId);
return Result.success(itemDTOS);
}
}
......@@ -27,22 +27,21 @@
<select id="chSrvTaskDetailQuery" parameterType="com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetailVo"
resultType="com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetailVo">
SELECT
t.TASK_DETAIL_ID taskDetailId,
mode1.MODE_NAME modeName,----服务方式
select A.* from (
select row_number()over(partition by info.CERTI_CODE order by program.PROGRAM_ID) rn,
program.PROGRAM_ID taskDetailId,
mode1.MODE_NAME modeName,
organ.SRV_ORGAN_NAME srvOrganName,--护理机构名称
info.REAL_NAME realName,--失能人员名字
info.CERTI_CODE certiCode,--失能人员身份证件号码
t.SRV_START_TIME sevStarTime,--服务开始时间
t.SRV_END_TIME sevEndTime,--服务结束时间
TO_DATE( '', 'yyyy-MM-dd' ) declarationTime
FROM
CH_SRV_TASK_DETAIL t --服务明细表
LEFT JOIN ch_srv_task task ON task.srv_task_id = t.srv_task_id --服务计划详情
LEFT JOIN CH_DISABLE_INFO info ON task.DISAB_INFO_ID = info.DISAB_INFO_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 --服务机构
program.PROGRAM_DATE sevStarTime,--服务开始时间
program.PROGRAM_EDN_DATE sevEndTime--服务结束时间
from ch_srv_program program
LEFT JOIN ch_cfg_srv_mode mode1 ON program.srv_mode_id = mode1.mode_id --服务方式
LEFT JOIN ch_srv_organ organ ON program.srv_organ_id = organ.srv_organ_id --服务机构
LEFT JOIN ch_srv_task task ON task.PROGRAM_ID = program.PROGRAM_ID --服务计划详情
LEFT JOIN CH_DISABLE_INFO info ON task.DISAB_INFO_ID = info.DISAB_INFO_ID --失能人员信息表
where 1=1
<if test="vo.srvOrganName != null and vo.srvOrganName != ''">
AND organ.SRV_ORGAN_NAME LIKE '%' || #{vo.srvOrganName} || '%'
......@@ -57,44 +56,13 @@
AND info.CERTI_CODE =#{vo.certiCode}
</if>
<if test="vo.sevStarTime != null and vo.sevStarTime != ''">
AND t.SRV_START_TIME &gt;= TO_DATE (#{vo.sevStarTime}, 'yyyy-mm-dd')
AND program.PROGRAM_DATE &gt;= TO_DATE (#{vo.sevStarTime}, 'yyyy-mm-dd')
</if>
<if test="vo.sevEndTime != null and vo.sevEndTime != ''">
AND t.SRV_END_TIME &lt;= TO_DATE (#{vo.sevEndTime}, 'yyyy-mm-dd')
</if>
UNION
SELECT
d.TASK_DETAIL_ID taskDetailId,
d.MODE_NAME modeName,----服务方式
o.SRV_ORGAN_NAME srvOrganName,--护理机构名称
info.REAL_NAME realName,--失能人员名字
info.CERTI_CODE certiCode,--失能人员身份证件号码
TO_DATE( '', 'yyyy-MM-dd' ) sevStarTime,--服务开始时间
TO_DATE( '', 'yyyy-MM-dd' ) sevEndTime,--服务结束时间
d.DECLARATION_TIME declarationTime--申报日期
FROM
CH_DISAB_ACCOUNTS_DETAIL d --账户信息表
LEFT JOIN CH_DISABLE_INFO info ON d.DISAB_INFO_ID = info.DISAB_INFO_ID --失能人员信息表
LEFT JOIN CH_SRV_ORGAN o ON d.SRV_ORGAN_ID = o.SRV_ORGAN_ID --护理机构表
where 1=1
<if test="vo.srvOrganName != null and vo.srvOrganName != ''">
AND o.SRV_ORGAN_NAME LIKE '%' || #{vo.srvOrganName} || '%'
</if>
<if test="vo.modeName != null and vo.modeName != ''">
AND d.MODE_NAME = #{vo.modeName}
</if>
<if test="vo.realName != null and vo.realName != ''">
AND info.REAL_NAME LIKE '%' || #{vo.realName} || '%'
</if>
<if test="vo.certiCode != null and vo.certiCode != ''">
AND info.CERTI_CODE =#{vo.certiCode}
</if>
<if test="vo.sevStarTime != null and vo.sevStarTime != ''">
AND d.DECLARATION_TIME &gt;= TO_DATE (#{vo.sevStarTime}, 'yyyy-mm-dd')
</if>
<if test="vo.sevEndTime != null and vo.sevEndTime != ''">
AND d.DECLARATION_TIME &lt;= TO_DATE (#{vo.sevEndTime}, 'yyyy-mm-dd')
AND program.PROGRAM_EDN_DATE &lt;= TO_DATE (#{vo.sevEndTime}, 'yyyy-mm-dd')
</if>
)A
where A.rn =1
</select>
<select id="getsrvOrgan" resultType="com.hungraim.ltc.pojo.entity.account.ChPunchDetailsVO">
SELECT
......@@ -103,50 +71,49 @@
FROM
CH_SRV_ORGAN n
LEFT JOIN CH_CFG_SRV_ORGAN_TYPE e ON n.ORGAN_ID = e.ORGAN_TYPE_ID
LEFT JOIN CH_DISAB_ACCOUNTS_DETAIL detail ON n.SRV_ORGAN_ID = detail.SRV_ORGAN_ID
WHERE detail.TASK_DETAIL_ID = #{taskDetailId}
LEFT JOIN ch_srv_program program ON n.SRV_ORGAN_ID = program.SRV_ORGAN_ID
WHERE program.PROGRAM_ID = #{taskDetailId}
</select>
<select id="selectModeTypeById" resultType="String">
select mode1.MODE_NAME from ch_srv_program program
inner JOIN ch_cfg_srv_mode mode1 ON program.srv_mode_id = mode1.mode_id
where program.PROGRAM_ID = #{pId}
</select>
<select id="getServiceTypeDetailed" parameterType="Long" resultType="com.hungraim.ltc.pojo.entity.account.ChServiceTypeDetailedVO">
SELECT
to_char( detail.DECLARATION_TIME, 'dd' ) executionTime,
service.SERVICE_TYPE_DETAILED_NAME itemName,
service.SERVICE_TYPE_DETAILED_ID serviceTypeDetailedId
FROM
CH_DISAB_ACCOUNTS_DETAIL detail
LEFT JOIN CH_SRV_TASK_FINISH_ITEM item ON detail.TASK_DETAIL_ID = item.TASK_DETAIL_ID
LEFT JOIN CH_SRV_ORGAN_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 1=1
<if test="taskDetailId != null and taskDetailId != ''">
and detail.TASK_DETAIL_ID = #{taskDetailId}
</if>
<if test="sevStarTime != null and sevStarTime != ''">
AND detail.DECLARATION_TIME &gt;= TO_DATE (substr(#{sevStarTime} ,1,10), 'yyyy-mm-dd')
</if>
<if test="sevEndTime != null and sevEndTime != ''">
AND detail.DECLARATION_TIME &lt;= TO_DATE (substr(#{sevEndTime},1,10), 'yyyy-mm-dd')
</if>
UNION
SELECT
to_char( detail.SRV_START_TIME, 'dd' ) executionTime,
case when mode1.MODE_NAME='上门' then to_char(detail.SRV_START_TIME, 'dd' )
else to_char(item.FCD, 'dd' ) end executionTime,
service.SERVICE_TYPE_DETAILED_NAME itemName,
service.SERVICE_TYPE_DETAILED_ID serviceTypeDetailedId
FROM
CH_SRV_TASK_DETAIL detail
LEFT JOIN CH_SRV_TASK_FINISH_ITEM item ON detail.TASK_DETAIL_ID = item.TASK_DETAIL_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
inner JOIN ch_srv_task task ON task.srv_task_id = detail.srv_task_id
inner JOIN ch_srv_program program on program.PROGRAM_ID=task.PROGRAM_ID
inner JOIN ch_cfg_srv_mode mode1 ON program.srv_mode_id = mode1.mode_id
inner JOIN CH_SRV_TASK_FINISH_ITEM item ON detail.TASK_DETAIL_ID = item.TASK_DETAIL_ID
inner JOIN CH_SRV_ORGAN_PROJECT CSOP ON CSOP.PROJECT_ID = item.ITEM_ID
inner join CH_SERVICE_TYPE_DETAILED service on service.SERVICE_TYPE_DETAILED_ID = CSOP.ITEM_NAME
WHERE 1=1
<if test="taskDetailId != null and taskDetailId != ''">
and detail.TASK_DETAIL_ID = #{taskDetailId}
<if test="certiCode != null and certiCode != ''">
and task.DISAB_INFO_ID = (select DISAB_INFO_ID from CH_DISABLE_INFO where CERTI_CODE =#{certiCode})
</if>
<choose>
<when test="modeType == '上门'">
<if test="sevStarTime != null and sevStarTime != ''">
AND detail.SRV_START_TIME &gt;= TO_DATE (substr(#{sevStarTime},1,10), 'yyyy-mm-dd')
</if>
<if test="sevEndTime != null and sevEndTime != ''">
AND detail.SRV_END_TIME &lt;= TO_DATE (substr(#{sevEndTime},1,10), 'yyyy-mm-dd')
</if>
</when>
<otherwise>
AND item.FCD >= TO_DATE (substr(#{sevStarTime},1,10), 'yyyy-mm-dd')
</otherwise>
</choose>
</select>
<select id="selectServiceTypeDetailed" resultType="com.hungraim.ltc.pojo.entity.account.ChServiceTypeVO">
......@@ -162,5 +129,4 @@
</mapper>
\ No newline at end of file
......@@ -27,7 +27,7 @@
LEFT JOIN CH_SRV_ORGAN_PROJECT CSOP ON CSOP.PROJECT_ID = CSTFI.ITEM_ID
LEFT JOIN CH_SERVICE_TYPE_detailed d on d.service_type_detailed_id = CSOP.item_name
<where>
disable.SRV_MODE_ID in ('1','2') and program.program_id =#{programId}
disable.SRV_MODE_ID in ('1','2') and detail.STATUS <![CDATA[<>]]> 3 and program.program_id =#{programId}
<if test="srvPlanTime != null">
and to_char(detail.SRV_DATE,'yyyy-MM-dd') = #{srvPlanTime}
</if>
......@@ -36,6 +36,13 @@
</select>
<select id="queryItem" resultType="com.hungraim.ltc.pojo.vo.governance.ItemDTO">
select CSOP.PROJECT_ID itemId,service.SERVICE_TYPE_DETAILED_NAME itemName from CH_SRV_ORGAN_PROJECT CSOP
left join CH_SERVICE_TYPE_DETAILED service on service.SERVICE_TYPE_DETAILED_ID = CSOP.ITEM_NAME
where SRV_ORGAN_ID = #{srvOrganId}
</select>
</mapper>
......@@ -71,7 +71,7 @@
WHERE T1.PROGRAM_ID = #{programId} and rownum =1
</select>
<select id="getProgramDetailWithAdd" resultMap="ProgramSetDetailVoMap">
SELECT NULL PROGRAM_ID,
select * from ( SELECT NULL PROGRAM_ID,
T1.SRV_ORGAN_ID,
T1.DISAB_INFO_ID,
T1.SRV_MODE_ID,
......@@ -106,7 +106,8 @@
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
WHERE T1.DISAB_INFO_ID = #{disabInfoId}
AND T1.SRV_ORGAN_ID = #{srvOrganId}
AND ROWNUM = 1
order by T1.FCD desc )
where ROWNUM = 1
</select>
<select id="getProgramList" resultType="com.hungraim.ltc.pojo.vo.governance.ProgramListVo">
......@@ -128,9 +129,7 @@
T4.FINISH_TIME assessDate,
T7.MODE_NAME svrModelName,
T5.SRV_ORGAN_NAME svrOrganName,
<if test="programStatus != null and programStatus != ''">
#{programStatus} progStatus,
</if>
T1.PROG_STATUS progStatus,
T1.EFF_TIME effTime
FROM CH_SRV_PROGRAM T1
INNER JOIN CH_DISABLE_INFO T2 ON T1.DISAB_INFO_ID = T2.DISAB_INFO_ID
......
......@@ -52,9 +52,11 @@
FROM CH_SRV_SEND T1
INNER JOIN CH_SRV_ORGAN T2 ON T1.SRV_ORGAN_ID = T2.SRV_ORGAN_ID
INNER JOIN CH_DISABLE_INFO T3 ON T1.DISAB_INFO_ID = T3.DISAB_INFO_ID
INNER JOIN CH_SRV_BUILD_BED T4 ON T1.DISAB_INFO_ID = T4.DISAB_INFO_ID
<where>
T4.STATUS = 0
<if test="srvOrganId != null and srvOrganId != 0">
T1.SRV_ORGAN_ID = #{srvOrganId}
AND T1.SRV_ORGAN_ID = #{srvOrganId}
</if>
<if test="realName != null and realName != ''">
AND T3.REAL_NAME LIKE CONCAT(CONCAT('%',#{realName}),'%')
......@@ -72,6 +74,15 @@
<update id="updateSrvSendInfo">
update CH_SRV_SEND p set p.status = '2',p.end_time = sysdate where
p.DISAB_INFO_ID = #{disabInfoId}
p.DISAB_INFO_ID = #{disabInfoId} and to_char(p.STOP_TIME,'yyyy-MM-dd') = #{programEdnDateStr}
</update>
<update id="updateSrvSendById" parameterType="com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend">
update CH_SRV_SEND p set p.status = '1',p.SRV_MODE_ID = #{srvModeId},p.ALLOT_TIME =#{allotTime},
p.STOP_TIME =#{stopTime},p.SRV_ORGAN_ID = #{srvOrganId}, p.fcd = sysdate where
p.SRV_SEND_ID = #{srvSendId} and p.DISAB_INFO_ID =#{disabInfoId}
</update>
</mapper>
\ No newline at end of file
......@@ -17,6 +17,7 @@
<result column="birthday" jdbcType="DATE" property="birthday"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="stop_time" jdbcType="VARCHAR" property="stopTime"/>
<result column="exit_reason_id" jdbcType="VARCHAR" property="exitReasonId"/>
</resultMap>
<!--查询服务分配信息列表-->
......@@ -36,7 +37,8 @@
i.tel,
s.stop_time,
i.birthday,
s.status
s.status,
i.exit_reason_id
FROM
ch_disable_info i
LEFT JOIN ch_srv_send s ON s.disab_info_id = i.disab_info_id
......
......@@ -219,15 +219,20 @@
</where>
</select>
<select id="getAllocationSrvTask" resultType="com.hungraim.ltc.pojo.vo.governance.AllocationSrvTaskVO">
select t.SRV_TASK_ID,t.SRV_DATE,info.EXIT_TIME,info.EXIT_FLAG,info.EXIT_REASON_ID,t.program_id programId from CH_SRV_TASK t
select max(t.SRV_TASK_ID) srvTaskId,max(program.PROGRAM_ID) programId,info.REAL_NAME,t.SRV_EMP_ID from CH_SRV_TASK t
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_report report on aprtask.task_id = report.task_id--评定报告
left join CH_SRV_PROGRAM program on program.DISAB_INFO_ID = info.DISAB_INFO_ID
where <![CDATA[ t.SRV_DATE < sysdate and
(info.EXIT_TIME > sysdate or info.EXIT_TIME is null)
left join CH_SRV_PROGRAM program on program.program_id = t.program_id
where <![CDATA[ t.SRV_DATE < sysdate
-- and (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' ]]>
and program.PROG_STATUS <>'2' and t.STATUS <>'2'
group by info.REAL_NAME,t.SRV_EMP_ID ]]>
</select>
</mapper>
\ No newline at end of file
......@@ -62,7 +62,9 @@ public class SystemInterfaceServiceImpl extends ServiceImpl<SystemInterfaceMappe
List<String> systemResourceinterfaces = new ArrayList<>();
resourceinterfaceList.stream().forEach(resourceinterface->{
List<SystemInterface> collect = systemInterfaces.stream().filter(role2 -> role2.getInterfaceId().equals(resourceinterface.getInterfaceId())).collect(Collectors.toList());
if(collect.size()>0) {
systemResourceinterfaces.add(collect.get(0).getInterfaceUrl());
}
});
//资源和接口
stringStringHashMap.put(roleResource.getResourceId().toString(),systemResourceinterfaces);
......
spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
devtools:
restart:
enabled: true
......@@ -31,7 +34,6 @@ server:
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
file:
upload:
path: E:/workspace/upload
......
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