任务管理删除
This commit is contained in:
parent
e1f6509c22
commit
3fc17aec6e
@ -185,7 +185,7 @@ public class SignPatientManageRouteController extends BaseController {
|
||||
}
|
||||
|
||||
@ApiOperation("任务管理")
|
||||
@GetMapping("taskManagement")
|
||||
@GetMapping("/taskManagement")
|
||||
public TableDataInfo taskManagement(ManualFollowUpDTO manualFollowUpDTO) {
|
||||
startPage();
|
||||
List<ManualFollowUpVO> list = signPatientManageRouteService.taskManagement(manualFollowUpDTO);
|
||||
@ -193,8 +193,8 @@ public class SignPatientManageRouteController extends BaseController {
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除未执行任务")
|
||||
@PostMapping("batchDeleteTask")
|
||||
public AjaxResult batchDeleteTask(Long[] ids){
|
||||
return signPatientManageRouteService.batchDeleteTask(ids);
|
||||
@PostMapping("/batchDeleteTask")
|
||||
public AjaxResult batchDeleteTask(@RequestBody Long[] ids) {
|
||||
return signPatientManageRouteService.batchDeleteTask(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,15 @@ public interface SignPatientManageRouteMapper {
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSignPatientManageRouteByIds(Long[] ids);
|
||||
int deleteSignPatientManageRouteByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除签约患者管理任务路径
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteSignPatientManageRouteByIdList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询人工随访代办列表
|
||||
@ -132,4 +140,12 @@ public interface SignPatientManageRouteMapper {
|
||||
* @return SignPatientManageRoute
|
||||
*/
|
||||
List<SignPatientManageRoute> selectParentRouteIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询上级ids
|
||||
*
|
||||
* @param ids 子路径ids
|
||||
* @return SignPatientManageRoute
|
||||
*/
|
||||
List<Long> selectParentRouteIdByRouteId(List<Long> ids);
|
||||
}
|
||||
|
||||
@ -734,10 +734,14 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult batchDeleteTask(Long[] ids) {
|
||||
if (ids.length == 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
int deleteNodeCount = signPatientManageRouteNodeMapper.deleteSignPatientManageRouteNodeByIds(ids);
|
||||
if (deleteNodeCount < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
}
|
||||
//根据节点ids查询同路径的节点ids
|
||||
List<SignPatientManageRouteNode> signPatientManageRouteNodes = signPatientManageRouteNodeMapper.selectSameManageRouteNodeIdByNodeIds(ids);
|
||||
//无同级节点id
|
||||
List<Long> noSameLevelNodeIds = new ArrayList<>();
|
||||
@ -770,35 +774,39 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
if (CollectionUtils.isNotEmpty(manageRouteIds)) {
|
||||
manageRouteIds = manageRouteIds.stream().distinct().collect(Collectors.toList());
|
||||
List<SignPatientManageRoute> parentRoutes = signPatientManageRouteMapper.selectRouteByParentRouteIds(manageRouteIds);
|
||||
//集合无子路径删除,有子路径筛选无子路径的路径delete
|
||||
if (CollectionUtils.isEmpty(parentRoutes) || parentRoutes.size() == 0) {
|
||||
int updateRouteCount = signPatientManageRouteMapper.updateSignPatientManageRouteByIds(manageRouteIds);
|
||||
int updateRouteCount = signPatientManageRouteMapper.deleteSignPatientManageRouteByIdList(manageRouteIds);
|
||||
if (updateRouteCount < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
}
|
||||
}
|
||||
//有子路径不删,无子路径删除 delete无子路径id集合
|
||||
List<Long> delete = new ArrayList<>();
|
||||
for (Long manageRouteId : manageRouteIds) {
|
||||
List<SignPatientManageRoute> equalsCollect = parentRoutes.stream().filter(Objects::nonNull).filter(item -> item.getParentRouteId().equals(manageRouteId)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(equalsCollect) || equalsCollect.size() == 0) {
|
||||
delete.add(manageRouteId);
|
||||
} else {
|
||||
//有子路径不删,无子路径删除 delete无子路径id集合
|
||||
List<Long> delete = new ArrayList<>();
|
||||
//筛选无子路径的路径delete
|
||||
for (Long manageRouteId : manageRouteIds) {
|
||||
List<SignPatientManageRoute> equalsCollect = parentRoutes.stream().filter(Objects::nonNull).filter(item -> item.getParentRouteId().equals(manageRouteId)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(equalsCollect) || equalsCollect.size() == 0) {
|
||||
delete.add(manageRouteId);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(delete) || delete.size() == 0) {
|
||||
int updateRouteCount = signPatientManageRouteMapper.updateSignPatientManageRouteByIds(delete);
|
||||
if (updateRouteCount < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
if (CollectionUtils.isEmpty(delete) || delete.size() == 0) {
|
||||
int updateRouteCount = signPatientManageRouteMapper.deleteSignPatientManageRouteByIdList(delete);
|
||||
if (updateRouteCount < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//上级为子路径查询除自己以外的同级,无同级,查询上级是否有其他节点,有同级,过
|
||||
if (CollectionUtils.isNotEmpty(patientManageRouteIds)) {
|
||||
int updateRouteCount = signPatientManageRouteMapper.updateSignPatientManageRouteByIds(patientManageRouteIds);
|
||||
int updateRouteCount = signPatientManageRouteMapper.deleteSignPatientManageRouteByIdList(patientManageRouteIds);
|
||||
if (updateRouteCount < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
}
|
||||
//子路径无同级mainRouteIds
|
||||
List<Long> mainRouteIds = new ArrayList<>();
|
||||
//查询上级为子路径查询除自己以外的同级
|
||||
//查询上级为子路径的除自己以外的同级
|
||||
List<SignPatientManageRoute> patientSignPatientManageRoutes = signPatientManageRouteMapper.selectParentRouteIds(patientManageRouteIds);
|
||||
if (CollectionUtils.isNotEmpty(patientSignPatientManageRoutes) || patientSignPatientManageRoutes.size() != 0) {
|
||||
for (Long patientManageRouteId : patientManageRouteIds) {
|
||||
@ -807,26 +815,32 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
mainRouteIds.add(patientManageRouteId);
|
||||
}
|
||||
}
|
||||
//无同级,查询上级是否有其他节点
|
||||
List<SignPatientManageRouteNode> mainSignPatientManageRouteNodes = signPatientManageRouteNodeMapper.selectSameManageRouteNodeIdByRouteIds(mainRouteIds);
|
||||
if (CollectionUtils.isEmpty(mainSignPatientManageRouteNodes) || mainSignPatientManageRouteNodes.size() == 0) {
|
||||
int updateMainRouteCount = signPatientManageRouteMapper.updateSignPatientManageRouteByIds(mainRouteIds);
|
||||
if (updateMainRouteCount < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
}
|
||||
}
|
||||
//无其他节点删除
|
||||
List<Long> delete = new ArrayList<>();
|
||||
for (Long mainRouteId : mainRouteIds) {
|
||||
List<SignPatientManageRouteNode> collect = mainSignPatientManageRouteNodes.stream().filter(Objects::nonNull).filter(item -> item.getManageRouteId().equals(mainRouteId)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(collect) || collect.size() == 0) {
|
||||
delete.add(mainRouteId);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(delete) || delete.size() == 0) {
|
||||
int count = signPatientManageRouteMapper.updateSignPatientManageRouteByIds(delete);
|
||||
if (count < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
//无同级,查询上级
|
||||
List<Long> list = signPatientManageRouteMapper.selectParentRouteIdByRouteId(mainRouteIds);
|
||||
if (CollectionUtils.isNotEmpty(list) || list.size() == 0) {
|
||||
list = list.stream().distinct().collect(Collectors.toList());
|
||||
//查询上级是否有其他节点
|
||||
List<SignPatientManageRouteNode> mainSignPatientManageRouteNodes = signPatientManageRouteNodeMapper.selectSameManageRouteNodeIdByRouteIds(list);
|
||||
if (CollectionUtils.isEmpty(mainSignPatientManageRouteNodes) || mainSignPatientManageRouteNodes.size() == 0) {
|
||||
int updateMainRouteCount = signPatientManageRouteMapper.updateSignPatientManageRouteByIds(list);
|
||||
if (updateMainRouteCount < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
}
|
||||
} else {
|
||||
//无其他节点删除
|
||||
List<Long> delete = new ArrayList<>();
|
||||
for (Long mainRouteId : list) {
|
||||
List<SignPatientManageRouteNode> collect = mainSignPatientManageRouteNodes.stream().filter(Objects::nonNull).filter(item -> item.getManageRouteId().equals(mainRouteId)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(collect) || collect.size() == 0) {
|
||||
delete.add(mainRouteId);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(delete) || delete.size() == 0) {
|
||||
int count = signPatientManageRouteMapper.deleteSignPatientManageRouteByIdList(delete);
|
||||
if (count < 0) {
|
||||
return AjaxResult.error("删除失败,请联系管理员!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -659,6 +659,13 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSignPatientManageRouteByIdList">
|
||||
delete from sign_patient_manage_route where id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectSignPatientManageRouteNode"
|
||||
resultType="com.xinelu.manage.vo.signpatientmanageroute.PhonePush">
|
||||
select pi.id patientId,
|
||||
@ -701,7 +708,7 @@
|
||||
<select id="selectRouteByNodeIds"
|
||||
resultType="com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute">
|
||||
<include refid="selectSignPatientManageRouteVo"/>
|
||||
where id in (select manage_route_id form sign_patient_manage_route_node where id in
|
||||
where id in (select manage_route_id from sign_patient_manage_route_node where id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>)
|
||||
@ -726,9 +733,16 @@
|
||||
<select id="selectParentRouteIds"
|
||||
resultType="com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute">
|
||||
<include refid="selectSignPatientManageRouteVo"/>
|
||||
where parent_route_id in (select parent_route_id form sign_patient_manage_route where id in
|
||||
where parent_route_id in (select parent_route_id from sign_patient_manage_route where id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>)
|
||||
</select>
|
||||
|
||||
<select id="selectParentRouteIdByRouteId" resultType="java.lang.Long">
|
||||
select parent_route_id from sign_patient_manage_route where id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user