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