| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ltkj.common.core.redis.RedisCache; |
| | | import com.ltkj.common.utils.IdUtils; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | |
| | | private ITbTransitionService tbTransitionService; |
| | | @Autowired |
| | | private LisApiMethod lisApiMethod; |
| | | @Autowired |
| | | private IdUtils idUtils; |
| | | |
| | | /** |
| | | * 查询体检采样管理列表 |
| | |
| | | |
| | | /** |
| | | * 获取采样客户列表 |
| | | * |
| | | * @param isSignFor |
| | | * @param tjNum |
| | | * @param name |
| | |
| | | @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum, |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @ApiParam(value = "开始时间") @RequestParam(required = false) String beginTime, |
| | | @ApiParam(value = "结束时间") @RequestParam(required = false) String endTime){ |
| | | @ApiParam(value = "结束时间") @RequestParam(required = false) String endTime) { |
| | | Page<TjSampling> samplingPage = new Page<>(pageNum, pageSize); |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjSampling::getIsSignFor,isSignFor); |
| | | wrapper.eq(TjSampling::getIsSignFor, isSignFor); |
| | | if (null != tjNum && StrUtil.isNotBlank(tjNum)) |
| | | wrapper.eq(TjSampling::getTjNum,tjNum); |
| | | wrapper.eq(TjSampling::getTjNum, tjNum); |
| | | if (null != name && StrUtil.isNotBlank(name)) |
| | | wrapper.eq(TjSampling::getCusName,name); |
| | | wrapper.eq(TjSampling::getCusName, name); |
| | | if (null != beginTime && null != endTime && StrUtil.isNotBlank(beginTime) && StrUtil.isNotBlank(endTime)) |
| | | wrapper.between(TjSampling::getApplicationTime, beginTime, endTime); |
| | | wrapper.groupBy(TjSampling::getCusId); |
| | |
| | | tjCustomers.add(customer); |
| | | } |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("list",tjCustomers); |
| | | hashMap.put("total",page.getTotal()); |
| | | hashMap.put("list", tjCustomers); |
| | | hashMap.put("total", page.getTotal()); |
| | | return AjaxResult.success(hashMap); |
| | | } |
| | | |
| | | /** |
| | | * 根据客户获取采样列表 |
| | | * |
| | | * @param cusId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getCusCyList") |
| | | @ApiOperation(value = "根据客户获取采样列表") |
| | | public AjaxResult getCusCyList(@RequestParam @ApiParam(value = "客户id") String cusId){ |
| | | public AjaxResult getCusCyList(@RequestParam @ApiParam(value = "客户id") String cusId) { |
| | | if (cusId == null || StrUtil.isBlank(cusId)) |
| | | return AjaxResult.error("参数错误"); |
| | | return AjaxResult.error("参数错误,未传参数"); |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjSampling::getCusId,cusId); |
| | | wrapper.isNull(TjSampling::getParentId); |
| | | wrapper.eq(TjSampling::getCusId, cusId); |
| | | wrapper.isNull(TjSampling::getParentId).or().eq(TjSampling::getIsMerge,1); |
| | | wrapper.orderByDesc(TjSampling::getIsMerge); |
| | | List<TjSampling> list = tjSamplingService.list(wrapper); |
| | | if (list.isEmpty()) |
| | | return AjaxResult.error("参数错误"); |
| | | if (list.isEmpty()){ |
| | | logger.info("cusId参数传的是:"+cusId); |
| | | return AjaxResult.error("参数错误,未查询到数据"); |
| | | } |
| | | for (TjSampling sampling : list) { |
| | | sampling.setCusName(MatchUtils.hideCusName(sampling.getCusName())); |
| | | // sampling.setCusName(MatchUtils.hideCusName(sampling.getCusName())); |
| | | sampling.setCusName(sampling.getCusName()); |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @GetMapping("/mergeCaiYang") |
| | | @PostMapping("/mergeCaiYang") |
| | | @ApiOperation(value = "采样登记合并项目接口") |
| | | public AjaxResult mergeCaiYang(@RequestParam List<String> ids){ |
| | | if(null !=ids && !ids.isEmpty()){ |
| | | @Transactional |
| | | public AjaxResult mergeCaiYang(@RequestBody List<String> ids) { |
| | | if (null != ids && !ids.isEmpty()) { |
| | | if(ids.size()==1)return AjaxResult.error("请选择至少两条项目进行合并!"); |
| | | int i = tjSamplingService.panduanshifoukeyihebing(ids); |
| | | if(i>1){ |
| | | if (i > 1) { |
| | | return AjaxResult.error("标本类型不一致,不可合并"); |
| | | } |
| | | |
| | | TjSampling tjSampling = tjSamplingService.getById(ids.get(0)); |
| | | |
| | | |
| | | //todo 加一条判断是否存在合并项目的查询sql |
| | | //todo 判断传入的项目是否存在合并项目 不存在走原逻辑 存在走else |
| | | |
| | | |
| | | Map<String,Object> map= tjSamplingService.hebingCaiYangInFo(ids); |
| | | TjSampling sampling=new TjSampling(); |
| | | String proId = map.get("proId").toString(); |
| | | String proName = map.get("proName").toString(); |
| | | BeanUtil.copyProperties(tjSampling,sampling,new String[]{"id"}); |
| | | sampling.setProId(proId); |
| | | sampling.setProName(proName); |
| | | sampling.setIsMerge(1); |
| | | if (tjSamplingService.save(sampling)) { |
| | | for (String id : ids) { |
| | | TjSampling service = tjSamplingService.getById(id); |
| | | service.setParentId(sampling.getId()); |
| | | service.setIsMerge(1); |
| | | tjSamplingService.updateById(service); |
| | | int pdsfczhbxm = tjSamplingService.pdsfczhbxm(ids); |
| | | if (pdsfczhbxm == ids.size()) return AjaxResult.error("多个合并项目不可再继续合并!"); |
| | | if (pdsfczhbxm > 1) return AjaxResult.error("最多允许选择一个合并过的项目!"); |
| | | if (pdsfczhbxm == 0) { |
| | | TjSampling tjSampling = tjSamplingService.getById(ids.get(0)); |
| | | Map<String, Object> map = tjSamplingService.hebingCaiYangInFo(ids); |
| | | TjSampling sampling = new TjSampling(); |
| | | String proId = map.get("proId").toString(); |
| | | String proName = map.get("proName").toString(); |
| | | BeanUtil.copyProperties(tjSampling, sampling, new String[]{"id"}); |
| | | sampling.setProId(proId); |
| | | sampling.setProName(proName); |
| | | sampling.setIsMerge(1); |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | if (tjSamplingService.save(sampling)) { |
| | | if (tjSamplingService.updateHeBingXm(ids, sampling.getId())) { |
| | | return AjaxResult.success("合并项目成功!"); |
| | | } |
| | | } |
| | | return AjaxResult.success("合并项目成功!"); |
| | | return AjaxResult.error("操作失败!"); |
| | | } else { |
| | | TjSampling tjSampling = tjSamplingService.getTjSamplingByHb(ids); |
| | | List<TjSampling> samplingList = tjSamplingService.getTjSamplingListByHb(ids); |
| | | if (null != tjSampling && null != samplingList && !samplingList.isEmpty()) { |
| | | List<String> stringList = samplingList.stream().map(TjSampling::getId).collect(Collectors.toList()); |
| | | Map<String, Object> map = tjSamplingService.hebingCaiYangInFo(stringList); |
| | | String proId = map.get("proId").toString(); |
| | | String proName = map.get("proName").toString(); |
| | | tjSampling.setProId(proId); |
| | | tjSampling.setProName(proName); |
| | | if (tjSamplingService.updateById(tjSampling)) { |
| | | if (tjSamplingService.updateHeBingXm(stringList, tjSampling.getParentId())) { |
| | | return AjaxResult.success("合并项目成功!"); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.error("操作失败!"); |
| | | } |
| | | } |
| | | return AjaxResult.error("请选择你要合并的项目!!!"); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/chexiaoCaiYang") |
| | | @ApiOperation(value = "撤销采样登记合并项目接口") |
| | | @Transactional |
| | | public AjaxResult chexiaoCaiYang(@RequestBody List<String> ids) { |
| | | if (null != ids && !ids.isEmpty()) { |
| | | int pdsfczhbxm = tjSamplingService.pdsfczhbxm(ids); |
| | | if (pdsfczhbxm != ids.size()) return AjaxResult.error("存在未合并的项目不可撤销!!!"); |
| | | tjSamplingService.deletedTjSamplingListByHb(ids); |
| | | tjSamplingService.updateHeBingXm(ids); |
| | | return AjaxResult.success("撤销成功!!!"); |
| | | } |
| | | return AjaxResult.error("请选择你要撤销的项目!!!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出体检采样管理列表 |
| | | */ |