| | |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletSecurityElement; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.swing.plaf.basic.BasicScrollPaneUI; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | 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.TbTransition; |
| | | import com.ltkj.hosp.domain.TjCustomer; |
| | | import com.ltkj.hosp.domain.TjProject; |
| | | import com.ltkj.hosp.service.ITjCustomerService; |
| | | import com.ltkj.hosp.service.ITjProjectService; |
| | | import com.ltkj.hosp.service.TjAsyncService; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.web.controller.lis.LisApiMethod; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.weaver.AjAttribute; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ltkj.common.annotation.Log; |
| | | import com.ltkj.common.core.controller.BaseController; |
| | | import com.ltkj.common.core.domain.AjaxResult; |
| | | import com.ltkj.common.enums.BusinessType; |
| | | import com.ltkj.hosp.domain.TjSampling; |
| | | import com.ltkj.hosp.service.ITjSamplingService; |
| | | import com.ltkj.common.utils.poi.ExcelUtil; |
| | | import com.ltkj.common.core.page.TableDataInfo; |
| | | |
| | |
| | | * @author ltkj_赵佳豪&李格 |
| | | * @date 2023-04-11 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/sampling/sampling") |
| | | @Api(tags = "体检采样管理") |
| | | @Api(tags = "PC端 体检采样管理") |
| | | public class TjSamplingController extends BaseController { |
| | | @Resource |
| | | private ITjSamplingService tjSamplingService; |
| | |
| | | private TjAsyncService asyncService; |
| | | @Resource |
| | | private RedisCache redisCache; |
| | | @Autowired |
| | | private ITjOrderService orderService; |
| | | @Autowired |
| | | private ITbTransitionService tbTransitionService; |
| | | @Autowired |
| | | private LisApiMethod lisApiMethod; |
| | | @Autowired |
| | | private IdUtils idUtils; |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * 查询体检采样管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('sampling:sampling:list')") |
| | | //@PreAuthorize("@ss.hasPermi('sampling:sampling:list')") |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询体检采样管理列表(自带默认)") |
| | | public TableDataInfo list(TjSampling tjSampling) { |
| | | startPage(); |
| | | List<TjSampling> list = tjSamplingService.selectTjSamplingList(tjSampling); |
| | | if(null !=list && list.size()>0 ){ |
| | | if (null != list && list.size() > 0) { |
| | | for (TjSampling sampling : list) { |
| | | TjCustomer customer = customerService.getById(sampling.getCusId()); |
| | | if(null !=customer){ |
| | | if (null != customer) { |
| | | sampling.setCustomer(customer); |
| | | } |
| | | } |
| | |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @ApiParam(value = "开始时间") @RequestParam(required = false) String beginTime, |
| | | @ApiParam(value = "结束时间") @RequestParam(required = false) String endTime) { |
| | | LambdaQueryWrapper<TjSampling>wq=new LambdaQueryWrapper<>(); |
| | | List<Map<String,Object>> arrayList=new ArrayList<>(); |
| | | LambdaQueryWrapper<TjSampling> wq = new LambdaQueryWrapper<>(); |
| | | List<Map<String, Object>> arrayList = new ArrayList<>(); |
| | | wq.orderByDesc(TjSampling::getApplicationTime); |
| | | if(null !=beginTime && !"".equals(beginTime) && null !=endTime && !"".equals(endTime)) wq.between(TjSampling::getApplicationTime,beginTime,endTime); |
| | | if(null !=tjNum){ |
| | | wq.eq(TjSampling::getTjNum,tjNum); |
| | | if (null != beginTime && !"".equals(beginTime) && null != endTime && !"".equals(endTime)) |
| | | wq.between(TjSampling::getApplicationTime, beginTime, endTime); |
| | | if (null != tjNum) { |
| | | wq.eq(TjSampling::getTjNum, tjNum); |
| | | wq.eq(TjSampling::getIsSignFor, isSignFor); |
| | | List<TjSampling> list = tjSamplingService.list(wq); |
| | | List<Map<String, Object>> extracted = extracted(arrayList, list,pageNum,pageSize); |
| | | return AjaxResult.success(extracted); |
| | | List<Map<String, Object>> extracted = extracted(arrayList, list, pageNum, pageSize); |
| | | |
| | | //________________________解决搜索数据不对 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", extracted); |
| | | map.put("total", arrayList.size()); |
| | | return AjaxResult.success(map); |
| | | //________________________解决搜索数据不对 |
| | | } |
| | | if(null !=name){ |
| | | wq.like(TjSampling::getCusName,name); |
| | | if (null != name) { |
| | | wq.like(TjSampling::getCusName, name); |
| | | wq.eq(TjSampling::getIsSignFor, isSignFor); |
| | | List<TjSampling> list = tjSamplingService.list(wq); |
| | | List<Map<String, Object>> extracted = extracted(arrayList, list,pageNum,pageSize); |
| | | return AjaxResult.success(extracted); |
| | | List<Map<String, Object>> extracted = extracted(arrayList, list, pageNum, pageSize); |
| | | |
| | | //________________________解决搜索数据不对 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", extracted); |
| | | map.put("total", arrayList.size()); |
| | | return AjaxResult.success(map); |
| | | //________________________解决搜索数据不对 |
| | | } |
| | | List<Map<String, Object>> cacheMapValue =null; |
| | | if(isSignFor==0) { |
| | | List<Map<String, Object>> cacheMapValue = null; |
| | | if (isSignFor == 0) { |
| | | cacheMapValue = redisCache.getCacheMapValue("sampling", "yqs"); |
| | | } |
| | | if(isSignFor==1) { |
| | | cacheMapValue = redisCache.getCacheMapValue("sampling", "wqs"); |
| | | if (isSignFor == 1) { |
| | | cacheMapValue = redisCache.getCacheMapValue("sampling", "wqs"); |
| | | } |
| | | asyncService.saveSampling(); |
| | | List<Map<String,Object>> collect =new ArrayList<>(); |
| | | Map<String,Object>map=new HashMap<>(); |
| | | if(null ==cacheMapValue || cacheMapValue.size()==0){ |
| | | wq.eq(TjSampling::getIsSignFor,isSignFor); |
| | | List<Map<String, Object>> collect = null; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (null == cacheMapValue || cacheMapValue.size() == 0) { |
| | | wq.eq(TjSampling::getIsSignFor, isSignFor); |
| | | List<TjSampling> list = tjSamplingService.list(wq); |
| | | collect = extracted(arrayList, list,pageNum,pageSize); |
| | | map.put("total",arrayList.size()); |
| | | }else { |
| | | collect = extracted(arrayList, list, pageNum, pageSize); |
| | | map.put("total", arrayList.size()); |
| | | } else { |
| | | collect = cacheMapValue.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | map.put("total",cacheMapValue.size()); |
| | | map.put("total", cacheMapValue.size()); |
| | | } |
| | | if (collect!=null){ |
| | | map.put("list",collect); |
| | | }else { |
| | | map.put("list",new ArrayList<Map<String,Object>>()); |
| | | } |
| | | map.put("list", collect); |
| | | |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | private List<Map<String,Object>> extracted(List<Map<String, Object>> arrayList, List<TjSampling> list,Integer pageNum,Integer pageSize) { |
| | | if(null != list && list.size()>0 ){ |
| | | private List<Map<String, Object>> extracted(List<Map<String, Object>> arrayList, List<TjSampling> list, Integer pageNum, Integer pageSize) { |
| | | if (null != list && list.size() > 0) { |
| | | Map<String, List<TjSampling>> stringListMap = list.stream().collect(Collectors.groupingBy(TjSampling::getCusId)); |
| | | for (Map.Entry<String, List<TjSampling>> entry : stringListMap.entrySet()) { |
| | | Map<String,Object>map=new HashMap<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | TjCustomer customer = customerService.getById(entry.getKey()); |
| | | if (customer==null){ |
| | | if (customer == null) { |
| | | continue; |
| | | } |
| | | customer.setCusName(MatchUtils.hideCusName(customer.getCusName())); |
| | |
| | | customer.setTjNumber(entry.getValue().get(0).getTjNum()); |
| | | customer.setApplicationTime(entry.getValue().get(0).getApplicationTime()); |
| | | List<TjSampling> samplings = entry.getValue(); |
| | | if(null !=samplings && samplings.size()>0){ |
| | | List<TjSampling> projectList=new ArrayList<>(); |
| | | if (null != samplings && samplings.size() > 0) { |
| | | List<TjSampling> projectList = new ArrayList<>(); |
| | | for (TjSampling sampling : samplings) { |
| | | sampling.setCusName(MatchUtils.hideCusName(sampling.getCusName())); |
| | | TjProject project = projectService.getById(sampling.getProId()); |
| | | if(null !=project && project.getProParentId()==0){ |
| | | if (null != project && project.getProParentId() == 0) { |
| | | projectList.add(sampling); |
| | | } |
| | | } |
| | | map.put("list",projectList); |
| | | map.put("list", projectList); |
| | | } |
| | | map.put("customer",customer); |
| | | map.put("customer", customer); |
| | | arrayList.add(map); |
| | | } |
| | | } |
| | | List<Map<String, Object>> collect =null; |
| | | if(null !=arrayList && arrayList.size()>0){ |
| | | collect = arrayList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | List<Map<String, Object>> collect = null; |
| | | if (null != arrayList && arrayList.size() > 0) { |
| | | collect = arrayList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | return collect; |
| | | } |
| | | |
| | | /** |
| | | * 获取采样客户列表 |
| | | * |
| | | * @param isSignFor |
| | | * @param tjNum |
| | | * @param name |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | @GetMapping("/getCusList") |
| | | @ApiOperation(value = "获取采样客户列表") |
| | | public AjaxResult getCusList(@RequestParam(defaultValue = "1") @ApiParam(value = "0是1否") Integer isSignFor, |
| | | @RequestParam(required = false) @ApiParam(value = "体检号") String tjNum, |
| | | @RequestParam(required = false) @ApiParam(value = "客户姓名") String 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) { |
| | | Page<TjSampling> samplingPage = new Page<>(pageNum, pageSize); |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjSampling::getIsSignFor, isSignFor); |
| | | if (null != tjNum && StrUtil.isNotBlank(tjNum)) |
| | | wrapper.eq(TjSampling::getTjNum, tjNum); |
| | | if (null != name && StrUtil.isNotBlank(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); |
| | | // wrapper.last("LIMIT " + (pageNum - 1) * pageSize + "," + pageSize); |
| | | Page<TjSampling> page = tjSamplingService.page(samplingPage, wrapper); |
| | | List<TjSampling> list = page.getRecords(); |
| | | ArrayList<TjCustomer> tjCustomers = new ArrayList<>(); |
| | | for (TjSampling tjSampling : list) { |
| | | TjCustomer customer = customerService.getById(tjSampling.getCusId()); |
| | | customer.setCusName(MatchUtils.hideCusName(customer.getCusName())); |
| | | customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone())); |
| | | customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard())); |
| | | customer.setTjNumber(tjSampling.getTjNum()); |
| | | customer.setApplicationTime(tjSampling.getApplicationTime()); |
| | | tjCustomers.add(customer); |
| | | } |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | 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, |
| | | @RequestParam(defaultValue = "1") @ApiParam(value = "0是1否") Integer isSignFor) { |
| | | if (cusId == null || StrUtil.isBlank(cusId)) |
| | | return AjaxResult.error("参数错误,未传参数"); |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjSampling::getCusId, cusId); |
| | | wrapper.eq(TjSampling::getIsSignFor,isSignFor); |
| | | wrapper.and(i -> i.isNull(TjSampling::getParentId).or().eq(TjSampling::getIsMerge,1)); |
| | | // wrapper.isNull(TjSampling::getParentId).or().eq(TjSampling::getIsMerge,1); |
| | | wrapper.orderByDesc(TjSampling::getIsMerge); |
| | | List<TjSampling> list = tjSamplingService.list(wrapper); |
| | | if (list.isEmpty()){ |
| | | logger.info("cusId参数传的是:"+cusId); |
| | | return AjaxResult.error("参数错误,未查询到数据"); |
| | | } |
| | | for (TjSampling sampling : list) { |
| | | // sampling.setCusName(MatchUtils.hideCusName(sampling.getCusName())); |
| | | sampling.setCusName(sampling.getCusName()); |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @PostMapping("/mergeCaiYang") |
| | | @ApiOperation(value = "采样登记合并项目接口") |
| | | @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) { |
| | | return AjaxResult.error("标本类型不一致,不可合并"); |
| | | } |
| | | int pdsfczhbxm = tjSamplingService.pdsfczhbxm(ids); |
| | | if (pdsfczhbxm == ids.size()) return AjaxResult.error("多个合并项目不可再继续合并!"); |
| | | if (pdsfczhbxm > 1) return AjaxResult.error("最多允许选择一个合并过的项目!"); |
| | | String string = tjSamplingService.getBuKeHebingProName(ids); |
| | | if(null !=string){ |
| | | return AjaxResult.error(string+"这几个项目不可合并!"); |
| | | } |
| | | 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.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("请选择你要撤销的项目!!!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出体检采样管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('sampling:sampling:export')") |
| | | //@PreAuthorize("@ss.hasPermi('sampling:sampling:export')") |
| | | @Log(title = "体检采样管理", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation(value = "导出体检采样管理列表") |
| | |
| | | /** |
| | | * 获取体检采样管理详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('sampling:sampling:query')") |
| | | //@PreAuthorize("@ss.hasPermi('sampling:sampling:query')") |
| | | @GetMapping(value = "/{id}") |
| | | @ApiOperation(value = "获取体检采样管理详细信息") |
| | | public AjaxResult getInfo(@PathVariable("id") String id) { |
| | |
| | | /** |
| | | * 新增体检采样管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('sampling:sampling:add')") |
| | | //@PreAuthorize("@ss.hasPermi('sampling:sampling:add')") |
| | | @Log(title = "体检采样管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @ApiOperation(value = "新增体检采样管理") |
| | |
| | | /** |
| | | * 修改体检采样管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('sampling:sampling:edit')") |
| | | //@PreAuthorize("@ss.hasPermi('sampling:sampling:edit')") |
| | | @Log(title = "体检采样管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | @ApiOperation(value = "修改体检采样管理") |
| | |
| | | /** |
| | | * 删除体检采样管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('sampling:sampling:remove')") |
| | | //@PreAuthorize("@ss.hasPermi('sampling:sampling:remove')") |
| | | @Log(title = "体检采样管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | @ApiOperation(value = "删除体检采样管理") |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 确认采样接口 |
| | | */ |
| | | @PostMapping("/confirmSampling") |
| | | @ApiOperation(value = "确认采样接口") |
| | | @Transactional |
| | | public AjaxResult confirmSampling(@RequestBody List<String> ids) { |
| | | if(null==ids || ids.size()==0){ |
| | | if (null == ids || ids.isEmpty()) { |
| | | return AjaxResult.error("请选择要确认项"); |
| | | } |
| | | for (String id : ids) { |
| | | TjSampling sampling = tjSamplingService.getById(id); |
| | | if(null !=sampling){ |
| | | sampling.setIsSignFor("0"); |
| | | LambdaQueryWrapper<TjProject>wq=new LambdaQueryWrapper<>(); |
| | | wq.eq(TjProject::getProParentId,sampling.getProId()); |
| | | List<TjProject> projectList = projectService.list(wq); |
| | | List<String> collect = new ArrayList<>(); |
| | | for (TjProject project : projectList) { |
| | | Long proId = project.getProId(); |
| | | collect.add(String.valueOf(proId)); |
| | | } |
| | | LambdaQueryWrapper<TjSampling>wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjSampling::getTjNum,sampling.getTjNum()); |
| | | wq1.in(TjSampling::getProId,collect); |
| | | List<TjSampling> samplingList = tjSamplingService.list(wq1); |
| | | if(null !=samplingList && samplingList.size()>0){ |
| | | for (TjSampling tjSampling : samplingList) { |
| | | tjSampling.setIsSignFor("0"); |
| | | tjSamplingService.updateById(tjSampling); |
| | | } |
| | | } |
| | | List<TjSampling> tjSamplings = tjSamplingService.listByIds(ids); |
| | | if (tjSamplings.isEmpty()) |
| | | return AjaxResult.error("请选择要确认项"); |
| | | for (TjSampling sampling : tjSamplings) { |
| | | sampling.setIsSignFor("0"); |
| | | // LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjProject::getProParentId, sampling.getProId()); |
| | | // List<TjProject> projectList = projectService.list(wq); |
| | | // List<String> collect = new ArrayList<>(); |
| | | // for (TjProject project : projectList) { |
| | | // Long proId = project.getProId(); |
| | | // collect.add(String.valueOf(proId)); |
| | | // } |
| | | // LambdaQueryWrapper<TjSampling> wq1 = new LambdaQueryWrapper<>(); |
| | | // wq1.eq(TjSampling::getTjNum, sampling.getTjNum()); |
| | | // wq1.in(TjSampling::getProId, collect); |
| | | // List<TjSampling> samplingList = tjSamplingService.list(wq1); |
| | | // if (null != samplingList && samplingList.size() > 0) { |
| | | // for (TjSampling tjSampling : samplingList) { |
| | | // tjSampling.setIsSignFor("0"); |
| | | // tjSamplingService.updateById(tjSampling); |
| | | // } |
| | | // } |
| | | TjOrder tjOrder = orderService.getOrderByTjNum(sampling.getTjNum()); |
| | | if(null==tjOrder)return AjaxResult.error("体检记录不存在"); |
| | | TjCustomer tjCustomer = customerService.getById(tjOrder.getUserId()); |
| | | boolean updChild; |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | Boolean save; |
| | | if (null != config && config.equals("Y")) { |
| | | save = lisApiMethod.save(sampling, tjOrder, tjCustomer); |
| | | }else { |
| | | save = true; |
| | | } |
| | | tjSamplingService.updateById(sampling); |
| | | if (save) { |
| | | if (sampling.getIsMerge() == 1) { |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjSampling::getParentId, sampling.getId()); |
| | | List<TjSampling> list = tjSamplingService.list(wrapper); |
| | | for (TjSampling tjSampling : list) { |
| | | tjSampling.setIsSignFor("0"); |
| | | } |
| | | updChild = tjSamplingService.updateBatchById(list); |
| | | } else { |
| | | updChild = true; |
| | | } |
| | | if (!tjSamplingService.updateById(sampling) && !updChild) { |
| | | // lisApiMethod.cancel(sampling.getJyxh(), tjOrder.getCardId(), PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "")); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("操作失败请重试"); |
| | | } |
| | | } else { |
| | | return AjaxResult.error("操作失败请重试"); |
| | | } |
| | | } |
| | | return AjaxResult.success("操作成功"); |
| | | } |