| | |
| | | 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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.web.controller.lis.LisApiMethod; |
| | | import com.sun.xml.internal.bind.v2.TODO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | 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; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sampling/sampling") |
| | | @Api(tags = "体检采样管理") |
| | | @Api(tags = "PC端 体检采样管理") |
| | | public class TjSamplingController extends BaseController { |
| | | @Resource |
| | | private ITjSamplingService tjSamplingService; |
| | |
| | | * @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, |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getCusCyList") |
| | | @ApiOperation(value = "根据客户获取采样列表") |
| | | public AjaxResult getCusCyList(@RequestParam @ApiParam(value = "客户id") String cusId){ |
| | | if (cusId == null || StrUtil.isBlank(cusId)) |
| | | return AjaxResult.error("参数错误"); |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjSampling::getCusId,cusId); |
| | | wrapper.isNull(TjSampling::getParentId); |
| | | List<TjSampling> list = tjSamplingService.list(wrapper); |
| | | if (list.isEmpty()) |
| | | return AjaxResult.error("参数错误"); |
| | | List<TjSampling> projectList = new ArrayList<>(); |
| | | for (TjSampling sampling : list) { |
| | | sampling.setCusName(MatchUtils.hideCusName(sampling.getCusName())); |
| | | TjProject project = projectService.getById(sampling.getProId()); |
| | | if (null != project && project.getProParentId() == 0) { |
| | | projectList.add(sampling); |
| | | } |
| | | } |
| | | return AjaxResult.success(projectList); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @PostMapping("/mergeCaiYang") |
| | | public AjaxResult mergeCaiYang(@RequestBody List<String> ids){ |
| | | return AjaxResult.success(); |
| | | @GetMapping("/mergeCaiYang") |
| | | @ApiOperation(value = "采样登记合并项目接口") |
| | | public AjaxResult mergeCaiYang(@RequestParam List<String> ids){ |
| | | if(null !=ids && !ids.isEmpty()){ |
| | | int i = tjSamplingService.panduanshifoukeyihebing(ids); |
| | | 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); |
| | | } |
| | | return AjaxResult.success("合并项目成功!"); |
| | | } |
| | | } |
| | | return AjaxResult.error("请选择你要合并的项目!!!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (null == ids || ids.size() == 0) { |
| | | return AjaxResult.error("请选择要确认项"); |
| | | } |
| | | String tjNumber = ""; |
| | | ArrayList<TjProject> projects = new ArrayList<>(); |
| | | for (String id : ids) { |
| | | TjSampling sampling = tjSamplingService.getById(id); |
| | | if (null != sampling) { |
| | | tjNumber = sampling.getTjNum(); |
| | | sampling.setIsSignFor("0"); |
| | | LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjProject::getProParentId, sampling.getProId()); |
| | |
| | | for (TjProject project : projectList) { |
| | | Long proId = project.getProId(); |
| | | collect.add(String.valueOf(proId)); |
| | | projects.add(project); |
| | | } |
| | | LambdaQueryWrapper<TjSampling> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjSampling::getTjNum, sampling.getTjNum()); |
| | |
| | | if (!tjSamplingService.updateById(sampling)) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("操作失败,请重试"); |
| | | } |
| | | } |
| | | if (StrUtil.isNotBlank(tjNumber)){ |
| | | TjOrder order = orderService.getOrderByTjNum(tjNumber); |
| | | TjCustomer customer = customerService.getById(order.getUserId()); |
| | | List<TbTransition> detailList = tbTransitionService.getTbTransitionListByCusId(String.valueOf(customer.getCusId()),order.getCardId()); |
| | | Boolean save = lisApiMethod.save(order, customer, projects, detailList); |
| | | if (!save){ |
| | | |
| | | } |
| | | } |
| | | |