Commit e0e16b16 authored by zhangwanglin's avatar zhangwanglin

Merge remote-tracking branch 'origin/uat_ch_master' into uat_ch_master

# Conflicts: # apply/apply-service/src/main/resources/mapper/ChSrvTaskDetailMapper.xml
parents 43df3e40 c906c8b3
......@@ -6,7 +6,6 @@ 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.*;
......@@ -27,7 +26,6 @@ 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;
......@@ -653,6 +651,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
// 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
} else if ("医疗".equals(srvModeName) && (!"1".equals(accountsVO.getLevelCode()))) {
limit = BigDecimal.valueOf(100);
} else if ("上门".equals(srvModeName)) {
overallPercent = BigDecimal.valueOf(0.8);
personalPercent = BigDecimal.valueOf(0.2);
limit = BigDecimal.valueOf(75);
}
// 根据护理机构、结算月份、失能人员id和服务方式查询表里是否有值
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.queryDisabDetailAccounts(srvOrganId, DateUtils.dateToStrYm(accountsTime), disabInfoId, srvModeName);
......@@ -992,6 +994,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
//退回
@Override
@Transactional(rollbackFor = Exception.class)
public Result accountReturn(SrvTaskRespVO srvTaskRespVO){
Long taskDetailId = srvTaskRespVO.getTaskDetailId();
String disabInfoId = srvTaskRespVO.getDisabInfoId();
......@@ -999,11 +1002,17 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
String srvPlanTime = srvTaskRespVO.getSrvDate();
Date date = DateUtils.strToDate(srvPlanTime);
String srvOrganId = srvTaskRespVO.getSrvOrganId();
Long itemId = srvTaskRespVO.getItemId();
ChDisabDetailAccounts chDisabDetailAccounts = chDisabAccountsDetailMapper.queryDisabDetailAccounts(String.valueOf(srvOrganId), DateUtils.dateToStrYm(date), disabInfoId, srvModeName);
Short status = chDisabDetailAccounts.getStatus();
if(status != 0){
return Result.failed("此任务已提交申报,不可再操作,请联系管理员");
}
// 删除 chSrvTaskFinishItemStream
LambdaQueryWrapper<ChSrvTaskFinishItem> chSrvTaskFinishItem = new LambdaQueryWrapper<ChSrvTaskFinishItem>()
.eq(ChSrvTaskFinishItem::getTaskDetailId, taskDetailId)
.eq(ChSrvTaskFinishItem::getItemId, itemId);
int delete = chSrvTaskFinishItemMapper.delete(chSrvTaskFinishItem);
LambdaQueryWrapper<ChSrvPlan> queryWrapper= new LambdaQueryWrapper<>();
queryWrapper.eq(ChSrvPlan::getTaskDetailId,taskDetailId);
queryWrapper.eq(ChSrvPlan::getIsStatus, (short) 4);
......@@ -1015,8 +1024,15 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chSrvPlan.setIsStatus(0L);
chSrvPlan.setPlanID(srvTaskRespVO.getPlanId());
chSrvPlanMapper.updateById(chSrvPlan);
ChSrvTaskDetail ca = new ChSrvTaskDetail();
ca.setStatus((short) 0);
ca.setTaskDetailId(Long.valueOf(taskDetailId));
chSrvTaskDetailMapper.updateById(ca);
if(size == 1){
BigDecimal accountsAllCost = chDisabDetailAccounts.getAccountsAllCost();
if (accountsAllCost.compareTo(BigDecimal.ZERO) == 0) {
return Result.success("当前费用为0,不再进行费用退回");
}
BigDecimal accountsOverallCost = chDisabDetailAccounts.getAccountsOverallCost();
BigDecimal accountsPersonalCost = chDisabDetailAccounts.getAccountsPersonalCost();
BigDecimal allCost = new BigDecimal(0);
......@@ -1036,6 +1052,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
allCost = BigDecimal.valueOf(100);
overCost = BigDecimal.valueOf(70);
personCost = BigDecimal.valueOf(30);
} else if ("上门".equals(srvModeName)) {
allCost = BigDecimal.valueOf(75);
overCost = BigDecimal.valueOf(60);
personCost = BigDecimal.valueOf(15);
}
BigDecimal allCostSubtract = accountsAllCost.subtract(allCost);
BigDecimal overCostSubtract = accountsOverallCost.subtract(overCost);
......@@ -1044,6 +1064,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsOverallCost(overCostSubtract);
chDisabDetailAccounts.setAccountsPersonalCost(personCostSubtract);
chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
}
} catch (Exception e) {
log.error("==============accountReturn error:{}",e);
......
......@@ -39,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}
......
......@@ -394,6 +394,7 @@ public class DisableController {
if (chDisableApply.getMedicalType() == null) {
return Result.failed("医保类型不能为空!");
}
chDisableApply.setRealName(chDisableApply.getRealName().trim());
return disableService.addDisable(chDisableApply);
}
......@@ -575,4 +576,21 @@ public class DisableController {
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);
}
}
......@@ -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.*;
......@@ -195,17 +196,16 @@ public class SrvOrganController {
* @return 返回操作状态
*/
@PutMapping("/status")
public Result updateSrvEmpStatus(Long empId, Short isLock) {
public Result<String> updateSrvEmpStatus(Long empId, Short isLock,String certifNum) {
if (null == empId || null == isLock) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
srvOrganEmpService.updateSrvEmpStatus(empId, isLock);
return Result.success();
int result = srvOrganEmpService.updateSrvEmpStatus(empId, isLock,certifNum);
return Result.success(result>0?"":"修改状态失败,请检查是否已存在有效数据");
}
/**
* 获取护理人员类别信息
*
* @return 返回护理人员类别列表
*/
@GetMapping("/srvEmpCateList")
......@@ -288,15 +288,24 @@ public class SrvOrganController {
FileUtils.exportResponse(workbook,fileName,response);
}
@GetMapping("/chSrvTaskDetailExport")
public void chSrvTaskDetailExport(Long empId, String empName,String status,String sevrTime,HttpServletResponse response){
Workbook workbook = srvOrganEmpService.chSrvTaskDetailExport(empId,empName,status,sevrTime);
// 命名表格
String fileName = "护理人员打卡记录导出.xlsx";
FileUtils.exportResponse(workbook,fileName,response);
}
/**
* 打卡查询
* @param empId
* @param status 0未执行 1执行中 2已执行 3已失效 4已完成
* @return
*/
@GetMapping("/chSrvTaskDetailQuery")
public Result chSrvTaskDetailQuery(Integer pageNum, Integer pageSize,Long empId){
public Result chSrvTaskDetailQuery(Integer pageNum, Integer pageSize,Long empId, String empName,String status,String sevrTime){
Page<ChSrvTaskDetail2Vo> page = new Page<>(pageNum, pageSize);
page = srvOrganEmpService.chSrvTaskDetailQuery(page,empId);
page = srvOrganEmpService.chSrvTaskDetailQuery(page,empId,empName,status,sevrTime);
if(page.getSize()>0){
return Result.success(page);
}else {
......@@ -313,7 +322,16 @@ public class SrvOrganController {
@PostMapping("/chSrvTaskDetailDelete")
public Result chSrvTaskDetailDelete(Long taskDetailId,String userName){
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);
}
}
......@@ -6,10 +6,12 @@ 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 com.hungraim.ltc.pojo.vo.disable.SrvOrganEmpExportVo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -24,7 +26,8 @@ public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> {
* @param empId
* @return
*/
Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page, Long empId);
Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page, Long empId, String empName,String status,String sevrTime);
int deleteFinshItem(long taskDetailId);
......@@ -35,6 +38,10 @@ public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> {
ChDisabDetailAccounts selectAccountsDetail(String disabInfoId, String srvDateStr);
void updateChDisabDetailAccounts(Long accountsId, BigDecimal accountsAllCostsub, BigDecimal accountsOverallCostsub, BigDecimal accountsPersonalCostsub);
List<ChSrvTaskDetail2Vo> chSrvTaskDetailExportList(Long empId, String empName,String status,String sevrTime);
}
......@@ -6,6 +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.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;
......@@ -33,6 +35,8 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
List<DisableInfoListVo> getDisableExitList();
List<ProgramRespDTO> selectProgram(String disabInfoId, String srvOrganId);
int updateSrvProgramById(ChSrvProgram chSrvProgram);
......@@ -40,5 +44,7 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
int updateSrvSendById(ChSrvSend chSrvSend);
List<DisableInfoRespDTO> selectDisableInfoByEmp(String srvEmpId);
}
......@@ -60,6 +60,8 @@ public interface DisableService {
*/
List<SrvModeVo> cfgSrvModeList();
Result selectProgram(String disabInfoId, String srvOrganId);
/**
* 查询机构下所有护理机构
*
......@@ -192,4 +194,6 @@ public interface DisableService {
Integer selectByCertiCode(String certiCode);
void disableExitTask();
Result selectDisableInfoByEmp(String srvEmpId);
}
......@@ -35,7 +35,7 @@ public interface SrvOrganEmpService {
* @param isLock 状态 0-有效;1-失效;
* @return 返回操作状态
*/
void updateSrvEmpStatus(Long empId, Short isLock);
int updateSrvEmpStatus(Long empId, Short isLock,String certifNum);
/**
* 获取护理人员相关信息
......@@ -70,7 +70,11 @@ public interface SrvOrganEmpService {
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);
Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page,Long empId, String empName,String status,String sevrTime);
Result chSrvTaskDetailDelete(long taskDetailId, String userName);
Result selectEmpBySrvOrganId(String srvOrganId);
Workbook chSrvTaskDetailExport(Long empId, String empName,String status,String sevrTime);
}
......@@ -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;
......@@ -30,11 +31,13 @@ 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.util.*;
......@@ -361,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)
......@@ -728,4 +732,23 @@ public class DisableServiceImpl implements DisableService {
@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);
}
}
......@@ -3,8 +3,8 @@ package com.hungraim.ltc.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.*;
......@@ -72,12 +72,26 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
return chSrvOrganEmpMapper.getSrvOrganEmpListVo(page, organIds, empName, srvOrganName, certifNum, isLock, empType,srvOrganId);
}
@Override
public void updateSrvEmpStatus(Long empId, Short isLock) {
public int updateSrvEmpStatus(Long empId, Short isLock,String certifNum) {
int queryResult = 0;
//修改成有效状态前检查是否存在有效数据。存在则不允许修改
if(isLock==0){
QueryWrapper<ChSrvOrganEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CERTIF_NUM", certifNum);
queryWrapper.eq("IS_LOCK",0);
queryResult = chSrvOrganEmpMapper.selectCount(queryWrapper);
if(queryResult>0){
return 0;
}
}
ChSrvOrganEmp chSrvOrganEmp = new ChSrvOrganEmp();
chSrvOrganEmp.setEmpId(empId);
chSrvOrganEmp.setIsLock(isLock);
chSrvOrganEmpMapper.updateById(chSrvOrganEmp);
queryResult = chSrvOrganEmpMapper.updateById(chSrvOrganEmp);
return queryResult;
}
@Override
......@@ -126,6 +140,7 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
// 新增
chSrvOrganEmp.setEffTime(new Date());
chSrvOrganEmp.setIsLock((short) 0);
chSrvOrganEmp.setEmpPwd("ch123456");
chSrvOrganEmpMapper.insert(chSrvOrganEmp);
updateAttachs(srvOrganEmpVo, chSrvOrganEmp.getEmpId());
......@@ -161,13 +176,12 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF); // 对应xlsx
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SrvOrganEmpExportVo.class, srvOrganEmpExportList);
return workbook;
}
@Override
public Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page, Long empId) {
Page<ChSrvTaskDetail2Vo> chSrvTaskDetailVoPage = chSrvTaskDetailMapper.chSrvTaskDetailQuery(page, empId);
public Page<ChSrvTaskDetail2Vo> chSrvTaskDetailQuery(Page<ChSrvTaskDetail2Vo> page, Long empId, String empName,String status,String sevrTime) {
Page<ChSrvTaskDetail2Vo> chSrvTaskDetailVoPage = chSrvTaskDetailMapper.chSrvTaskDetailQuery(page, empId,empName,status,sevrTime);
chSrvTaskDetailVoPage.getRecords().stream().filter(chSrvTaskDetail -> {
if (null != chSrvTaskDetail.getSevStarTime()){
chSrvTaskDetail.setSevStarTime(chSrvTaskDetail.getSevStarTime().substring(0,19));
......@@ -227,6 +241,15 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
}
}
@Override
public Workbook chSrvTaskDetailExport(Long empId, String empName, String status, String sevrTime) {
List<ChSrvTaskDetail2Vo> chSrvTaskDetailExportList = chSrvTaskDetailMapper.chSrvTaskDetailExportList(empId,empName,status,sevrTime);
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF); // 对应xlsx
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ChSrvTaskDetail2Vo.class, chSrvTaskDetailExportList);
return workbook;
}
/**
* 计算2个时间相差的天数、小时、分钟、秒
* @param startTime 开始时间
......@@ -279,4 +302,18 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
}
}
@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);
}
}
......@@ -67,6 +67,7 @@
decode( t.STATUS, '0', '未执行', '1', '执行中', '2', '已执行', '4', '已完成' ) AS status,
t.SRV_START_TIME sevStarTime,
t.SRV_END_TIME sevEndTime,
TO_char(t.SRV_DATE,'yyyy-MM-dd') sevrTime,
info.REAL_NAME realName
FROM
CH_SRV_TASK_DETAIL t
......@@ -75,6 +76,44 @@
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} and t.is_clock <![CDATA[<>]]> 1
<if test="empName != null and empName != ''">
and info.REAL_NAME like CONCAT(CONCAT('%',#{empName}) ,'%')
</if>
<if test="status != null and status != ''">
and t.STATUS = #{status}
</if>
<if test="sevrTime != null and sevrTime != ''">
and TO_char(t.SRV_DATE,'yyyy-MM-dd') = #{sevrTime}
</if>
order by t.TASK_DETAIL_ID desc
</select>
<select id="chSrvTaskDetailExportList" resultType="com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetail2Vo">
SELECT
T5.SRV_ORGAN_NAME srvOrganName,
m.EMP_NAME empName,
info.REAL_NAME realName,
t.SRV_START_TIME sevStarTime,
t.SRV_END_TIME sevEndTime,
TO_char(t.SRV_DATE,'yyyy-MM-dd') sevrTime,
decode( t.STATUS, '0', '未执行', '1', '执行中', '2', '已执行', '4', '已完成' ) AS status
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}
<if test="empName != null and empName != ''">
and info.REAL_NAME like CONCAT(CONCAT('%',#{empName}) ,'%')
</if>
<if test="status != null and status != ''">
and t.STATUS = #{status}
</if>
<if test="sevrTime != null and sevrTime != ''">
and TO_char(t.SRV_DATE,'yyyy-MM-dd') = #{sevrTime}
</if>
order by t.TASK_DETAIL_ID desc
</select>
......
......@@ -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,7 +47,7 @@
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>
......@@ -104,6 +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>
</mapper>
\ No newline at end of file
......@@ -173,5 +173,11 @@ public class ChSrvOrganEmp implements Serializable {
*/
private Short whiteList;
/**
* 员工密码
*/
private String empPwd;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -244,5 +244,11 @@ public class ChSrvTaskDetail implements Serializable {
*/
private String srvStartPic2;
private Short isClock;
private String clockReason;
private String clockOperator;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.hungraim.ltc.pojo.vo.disable;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.hungraim.ltc.pojo.vo.BaseReq;
import lombok.Data;
......@@ -11,19 +12,24 @@ public class ChSrvTaskDetail2Vo extends BaseReq {
private Long taskDetailId;
@Excel(name = "护理人员姓名",width = 20)
private String empName;
private Integer orgamId;
private String srvOrganId;
@Excel(name = "护理机构名称",width = 20)
private String srvOrganName;
@Excel(name = "状态",width = 20)
private String status;
@Excel(name = "服务开始时间",width = 40)
private String sevStarTime;
@Excel(name = "服务结束时间",width = 40)
private String sevEndTime;
@Excel(name = "失能人员姓名",width = 20)
private String realName;
@Excel(name = "服务日期",width = 40)
private String sevrTime;
}
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;
}
......@@ -5,6 +5,7 @@ import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -154,4 +155,29 @@ public class SrvTaskController {
return Result.success();
}
/**
* 补卡
**/
@PostMapping("/saveApplyCard")
public Result saveApplyCard(@RequestHeader("Authorization") String token,SrvPlanInputVO srvPlanInputVO){
if (srvPlanInputVO.getDisabInfoId() == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
Integer userId = TokenParsingUtil.TokenParsing(token, "userId");
srvPlanInputVO.setAdmin(String.valueOf(userId));
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);
}
}
......@@ -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);
}
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);
}
......@@ -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;
......@@ -265,4 +266,90 @@ 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()));
Long modeId = srvPlanInputVO.getModeId();
if (CollectionUtil.isNotEmpty(chSrvTaskDetailList)) {
if(modeId == 3){
int status = chSrvTaskDetailList.stream().map(ChSrvTaskDetail::getStatus).findFirst().orElse((short)0);
if(status == 1 || status == 4) {
return Result.failed("手机app已有任务,不可重复生成");
}
}
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(srvPlanInputVO.getAdmin());
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);
}
}
......@@ -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>
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