| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ltkj.common.core.domain.entity.SysUser; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.hosp.domain.TjOrderDetail; |
| | | import com.ltkj.hosp.service.ITjOrderDetailService; |
| | | import com.ltkj.hosp.service.ITjProjectService; |
| | | import com.ltkj.hosp.service.TjAsyncService; |
| | | import com.ltkj.system.domain.SysPost; |
| | | import com.ltkj.system.domain.SysUserPost; |
| | | import com.ltkj.system.service.ISysPostService; |
| | | import com.ltkj.system.service.ISysUserPostService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | @Autowired |
| | | private ITjBigPositiveService tjBigPositiveService; |
| | | |
| | | @Resource |
| | | private ITjOrderDetailService detailService; |
| | | @Resource |
| | | private ISysUserService userService; |
| | | @Resource |
| | | private ITjProjectService projectService; |
| | | |
| | | @Resource |
| | | private ISysUserPostService userPostService; |
| | | @Resource |
| | | private ISysPostService postService; |
| | | @Resource |
| | | private TjAsyncService asyncService; |
| | | /** |
| | | * 查询重大阳性记录列表 |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 导出重大阳性记录列表 |
| | | * 新增/移除 重大阳性记录 判断flag |
| | | */ |
| | | @Log(title = "重大阳性记录", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, TjBigPositive tjBigPositive) { |
| | | List<TjBigPositive> list = tjBigPositiveService.selectTjBigPositiveList(tjBigPositive); |
| | | ExcelUtil<TjBigPositive> util = new ExcelUtil<TjBigPositive>(TjBigPositive.class); |
| | | util.exportExcel(response, list, "重大阳性记录数据"); |
| | | } |
| | | |
| | | /** |
| | | * 获取重大阳性记录详细信息 |
| | | */ |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(tjBigPositiveService.selectTjBigPositiveById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 新增重大阳性记录 |
| | | */ |
| | | @Log(title = "重大阳性记录", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody TjBigPositive tjBigPositive) { |
| | | return toAjax(tjBigPositiveService.insertTjBigPositive(tjBigPositive)); |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Integer ksId = null; |
| | | if (null != sysUser) { |
| | | ksId = Math.toIntExact(sysUser.getDeptId()); |
| | | } |
| | | |
| | | if (ksId == null) { |
| | | return AjaxResult.error("请输入科室id"); |
| | | } |
| | | //根据当前登陆的人的科室id,获取该科室下的所有项目 |
| | | List<Long> postIds = sysUser.getPostIds(); |
| | | List<Long> ksproList = null; |
| | | if (postIds != null) { |
| | | for (Long postId : postIds) { |
| | | LambdaQueryWrapper<SysUserPost> wq111 = new LambdaQueryWrapper<>(); |
| | | wq111.eq(SysUserPost::getPostId, postId); |
| | | SysUserPost one = userPostService.getOne(wq111); |
| | | if (one != null) { |
| | | SysPost byId = postService.getById(one.getPostId()); |
| | | if (byId.getPostName().equals("录入员")) { |
| | | ksproList = projectService.getKsTjProjectIdListBydeptId(String.valueOf(ksId)); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | ksproList = projectService.getKsTjProjectIdList(); |
| | | } |
| | | |
| | | if (ksproList == null || ksproList.size() == 0) { |
| | | return AjaxResult.error("请完善科室项目信息"); |
| | | } |
| | | if ("1".equals(tjBigPositive.getFlag())){ |
| | | LambdaQueryWrapper<TjBigPositive> wq=new LambdaQueryWrapper<>(); |
| | | wq.eq(TjBigPositive::getTjNumber,tjBigPositive.getTjNumber()); |
| | | wq.eq(TjBigPositive::getProParentId,tjBigPositive.getProParentId()); |
| | | wq.eq(TjBigPositive::getProId,tjBigPositive.getProId()); |
| | | final List<TjBigPositive> list = tjBigPositiveService.list(wq); |
| | | LambdaQueryWrapper<TjOrderDetail> wqq=new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrderDetail::getProId,tjBigPositive.getProId()); |
| | | wqq.eq(TjOrderDetail::getOrderId,tjBigPositive.getOrderId()); |
| | | wqq.last("limit 1"); |
| | | TjOrderDetail tjOrderDetails = detailService.getOne(wqq); |
| | | if (list==null||list.size()==0){ |
| | | tjBigPositiveService.save(tjBigPositive); |
| | | //更改detail表状态 |
| | | if (tjOrderDetails!=null){ |
| | | tjOrderDetails.setIsPositive(1L); |
| | | detailService.updateById(tjOrderDetails); |
| | | //更新缓存 |
| | | asyncService.updateOrdeltile2(tjOrderDetails, sysUser); |
| | | asyncService.dockerSetCustomerLisByRedis(ksproList, String.valueOf(ksId)); |
| | | return AjaxResult.success("添加成功"); |
| | | } |
| | | return AjaxResult.error("出错了,请联系工作人员"); |
| | | }else { |
| | | tjBigPositiveService.updateById(tjBigPositive); |
| | | //更新缓存 |
| | | // asyncService.dockerSetCustomerLisByRedis(ksproList, String.valueOf(ksId)); |
| | | if (tjOrderDetails!=null){ |
| | | asyncService.updateOrdeltile2(tjOrderDetails, sysUser); |
| | | asyncService.dockerSetCustomerLisByRedis(ksproList, String.valueOf(ksId)); |
| | | } |
| | | return AjaxResult.success("添加成功"); |
| | | } |
| | | }else if ("0".equals(tjBigPositive.getFlag())){ |
| | | LambdaQueryWrapper<TjBigPositive> wq11=new LambdaQueryWrapper<>(); |
| | | wq11.eq(TjBigPositive::getTjNumber,tjBigPositive.getTjNumber()); |
| | | wq11.eq(TjBigPositive::getProParentId,tjBigPositive.getProParentId()); |
| | | wq11.eq(TjBigPositive::getProId,tjBigPositive.getProId()); |
| | | tjBigPositiveService.remove(wq11); |
| | | //更改detail表状态 |
| | | LambdaQueryWrapper<TjOrderDetail> wqq=new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrderDetail::getProId,tjBigPositive.getProId()); |
| | | wqq.eq(TjOrderDetail::getOrderId,tjBigPositive.getOrderId()); |
| | | wqq.last("limit 1"); |
| | | TjOrderDetail tjOrderDetails = detailService.getOne(wqq); |
| | | if (tjOrderDetails!=null){ |
| | | tjOrderDetails.setIsPositive(Long.valueOf(0)); |
| | | detailService.updateById(tjOrderDetails); |
| | | //更新缓存 |
| | | asyncService.updateOrdeltile2(tjOrderDetails, sysUser); |
| | | asyncService.dockerSetCustomerLisByRedis(ksproList, String.valueOf(ksId)); |
| | | return AjaxResult.success("删除成功"); |
| | | } |
| | | return AjaxResult.error("出错了,请联系工作人员"); |
| | | |
| | | } |
| | | return AjaxResult.error("出错了,请联系工作人员"); |
| | | } |
| | | |
| | | /** |
| | | * 修改重大阳性记录 |
| | | */ |
| | | @Log(title = "重大阳性记录", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody TjBigPositive tjBigPositive) { |
| | | return toAjax(tjBigPositiveService.updateTjBigPositive(tjBigPositive)); |
| | | } |
| | | |
| | | /** |
| | | * 删除重大阳性记录 |
| | | */ |
| | | @Log(title = "重大阳性记录", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(tjBigPositiveService.deleteTjBigPositiveByIds(ids)); |
| | | } |
| | | } |