| | |
| | | @Resource |
| | | InsProductResultMapper insProductResultMapper; |
| | | @Resource |
| | | private WarehouseHistoryMapper warehouseHistoryMapper; |
| | | @Resource |
| | | private InsProductMapper insProductMapper; |
| | | @Resource |
| | | private InsProductService insProductService; |
| | | @Resource |
| | | private InsProductUserMapper insProductUserMapper; |
| | | @Resource |
| | | private GiveCode giveCode; |
| | | @Resource |
| | | private InsSampleUserMapper insSampleUserMapper; |
| | | @Resource |
| | | private InsOrderStateMapper insOrderStateMapper; |
| | | @Resource |
| | | UserMapper userMapper; |
| | | |
| | | @Resource |
| | | InformationNotificationService informationNotificationService; |
| | | @Resource |
| | |
| | | }); |
| | | map.put("body", sampleOrderDtoIPage); |
| | | return map; |
| | | } |
| | | |
| | | //分配站点 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId, String sonLaboratory) { |
| | | InsOrder insOrder = new InsOrder(); |
| | | insOrder.setId(orderId); |
| | | //insOrder.setAppointed(LocalDate.parse(appointed)); |
| | | insOrder.setSendTime(LocalDateTime.now()); |
| | | insOrderMapper.updateById(insOrder); |
| | | //修改成只给当前选择的试验室下发单子 |
| | | InsOrderState insOrderState = new InsOrderState(); |
| | | insOrderState.setInsOrderId(orderId); |
| | | insOrderState.setLaboratory(sonLaboratory); |
| | | insOrderState.setInsState(0); |
| | | insOrderState.setNum(1);//初始是第一次 |
| | | insOrderStateMapper.insert(insOrderState); |
| | | //这里是在给分配的指定的人和试验室下发检验人 |
| | | if (userId != null) { |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setState(0); |
| | | insSampleUser.setUserId(userId); |
| | | insSampleUser.setInsSampleId(orderId); |
| | | insSampleUser.setSonLaboratory(sonLaboratory); |
| | | insSampleUserMapper.insert(insSampleUser); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (insOrder.getOrderType().equals("C")) { |
| | | insOrder.setState(1); |
| | | upInsOrderOfState(insOrder); |
| | | }else if (insOrder.getOrderType().equals("A")){ |
| | | } else if (insOrder.getOrderType().equals("A")) { |
| | | //常规外部单需消息提醒检验中心主任和研发部经理 |
| | | //todo 企业微信推送 |
| | | users1.addAll(users2); |
| | |
| | | map.put("msgtype", "text");//消息类型 text:文本 |
| | | map.put("agentid", 1000517);//应用id |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("content", "您有一条检验订单需要审核,请前往LIMS系统查看。外部订单号是:"+insOrder.getOutEntrustCode()+",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | hashMap.put("content", "您有一条检验订单需要审核,请前往LIMS系统查看。外部订单号是:" + insOrder.getOutEntrustCode() + ",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | map.put("text", hashMap);//消息内容 |
| | | map.put("safe", 0);//是否保密消息.0否 |
| | | map.put("enable_id_trans", 0);//是否开启id转译.0否 |
| | |
| | | info.setCreateUser(userMapper.selectById(userId).getName()); |
| | | info.setMessageType("2"); |
| | | info.setTheme("审核通知"); |
| | | info.setContent("您有一条检验订单待审核消息,订单的外部编号是:"+insOrder.getOutEntrustCode()); |
| | | info.setContent("您有一条检验订单待审核消息,订单的外部编号是:" + insOrder.getOutEntrustCode()); |
| | | info.setSenderId(userId); |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-inspect-order"); |
| | |
| | | notificationArrayList.add(info); |
| | | } |
| | | informationNotificationService.saveBatch(notificationArrayList); |
| | | }else if (insOrder.getOrderType().equals("B")){ |
| | | } else if (insOrder.getOrderType().equals("B")) { |
| | | //非常规外部单需消息提醒检验中心主任,研发部经理和技术负责人 |
| | | //todo 企业微信推送 |
| | | users1.addAll(users2); |
| | |
| | | map.put("msgtype", "text");//消息类型 text:文本 |
| | | map.put("agentid", 1000517);//应用id |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("content", "您有一条检验订单需要审核,请前往LIMS系统查看。外部订单号是:"+insOrder.getOutEntrustCode()+",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | hashMap.put("content", "您有一条检验订单需要审核,请前往LIMS系统查看。外部订单号是:" + insOrder.getOutEntrustCode() + ",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | map.put("text", hashMap);//消息内容 |
| | | map.put("safe", 0);//是否保密消息.0否 |
| | | map.put("enable_id_trans", 0);//是否开启id转译.0否 |
| | |
| | | info.setCreateUser(userMapper.selectById(userId).getName()); |
| | | info.setMessageType("2"); |
| | | info.setTheme("审核通知"); |
| | | info.setContent("您有一条检验订单待审核消息,订单的外部编号是:"+insOrder.getOutEntrustCode()); |
| | | info.setContent("您有一条检验订单待审核消息,订单的外部编号是:" + insOrder.getOutEntrustCode()); |
| | | info.setSenderId(userId); |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-inspect-order"); |
| | |
| | | if (!realpath.exists()) { |
| | | realpath.mkdirs(); |
| | | } |
| | | pathName = UUID.randomUUID() + "_" + file.getOriginalFilename(); |
| | | pathName = UUID.randomUUID() + "_" + file.getOriginalFilename().replace("#", "&"); |
| | | urlString = realpath + "/" + pathName; |
| | | file.transferTo(new File(urlString)); |
| | | insOrderFile.setFileUrl(pathName); |
| | |
| | | map.put("msgtype", "text");//消息类型 text:文本 |
| | | map.put("agentid", 1000517);//应用id |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("content", "您有一条订单需要完成,请前往LIMS系统查看。外部订单号是:"+insOrder.getOutEntrustCode()+",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | hashMap.put("content", "您有一条订单需要完成,请前往LIMS系统查看。外部订单号是:" + insOrder.getOutEntrustCode() + ",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | map.put("text", hashMap);//消息内容 |
| | | map.put("safe", 0);//是否保密消息.0否 |
| | | map.put("enable_id_trans", 0);//是否开启id转译.0否 |
| | |
| | | info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); |
| | | info.setMessageType("1"); |
| | | info.setTheme("样机员通知"); |
| | | info.setContent("您有一条检验订单的样机待完成消息,外部订单号是:"+insOrder.getOutEntrustCode()+",请前往LIMS系统查看。"); |
| | | info.setContent("您有一条检验订单的样机待完成消息,外部订单号是:" + insOrder.getOutEntrustCode() + ",请前往LIMS系统查看。"); |
| | | info.setSenderId(userId); |
| | | info.setConsigneeId(insOrder.getIssueUser()); |
| | | info.setViewStatus(false); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) { |
| | | public Map<String, Object> getInsOrderAndSample(Integer sampleId, String laboratory) { |
| | | InsSample insSample = insSampleMapper.selectById(sampleId); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | InsOrder insOrder = insOrderMapper.selectById2(id); |
| | | List<SampleProductDto> insSamples = insSampleMapper.selectList1(insOrder.getId()); |
| | | List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory); |
| | | InsOrder insOrder = insOrderMapper.selectById2(insSample.getInsOrderId()); |
| | | SampleProductDto sampleProductDto = insSampleMapper.getInsOrderAndSample(sampleId, laboratory); |
| | | //再次试验会出现为空的情况 |
| | | if (list.size() != insSamples.size()) { |
| | | List<Integer> ids = list.stream().map(sampleProductDto -> sampleProductDto.getId()).distinct().collect(Collectors.toList()); |
| | | List<SampleProductDto> samples = insSamples.stream().filter(insSample -> |
| | | !ids.contains(insSample.getId()) |
| | | ).collect(Collectors.toList()); |
| | | for (SampleProductDto insSample : samples) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .eq(InsProduct::getState, 1) |
| | | .eq(InsProduct::getSonLaboratory, laboratory)); |
| | | for (InsProduct insProduct : insProducts) { |
| | | List<InsProductResult2> insProductResult2List = insProductResult2Mapper.selectList(Wrappers.<InsProductResult2>lambdaQuery() |
| | | .eq(InsProductResult2::getInsProductId, insProduct.getId()).isNull(InsProductResult2::getNum)); |
| | | insProduct.setInsProductResult2(insProductResult2List); |
| | | InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId()).isNull(InsProductResult::getNum)); |
| | | insProduct.setInsProductResult(insProductResult); |
| | | } |
| | | insSample.setInsProduct(insProducts); |
| | | list.add(insSample); |
| | | if (ObjectUtils.isEmpty(sampleProductDto)) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .eq(InsProduct::getState, 1) |
| | | .eq(InsProduct::getSonLaboratory, laboratory)); |
| | | for (InsProduct insProduct : insProducts) { |
| | | List<InsProductResult2> insProductResult2List = insProductResult2Mapper.selectList(Wrappers.<InsProductResult2>lambdaQuery() |
| | | .eq(InsProductResult2::getInsProductId, insProduct.getId()).isNull(InsProductResult2::getNum)); |
| | | insProduct.setInsProductResult2(insProductResult2List); |
| | | InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId()).isNull(InsProductResult::getNum)); |
| | | insProduct.setInsProductResult(insProductResult); |
| | | } |
| | | |
| | | BeanUtils.copyProperties(insSample,sampleProductDto); |
| | | sampleProductDto.setInsProduct(insProducts); |
| | | } |
| | | for (SampleProductDto sampleProductDto : list) { |
| | | List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList()); |
| | | List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery() |
| | | .in(InsProductUser::getInsProductId, ids)); |
| | | if (CollectionUtils.isNotEmpty(insProductUsers)) { |
| | | List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList()); |
| | | String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(",")); |
| | | sampleProductDto.setCheckName(collect); |
| | | } |
| | | List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList()); |
| | | List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery() |
| | | .in(InsProductUser::getInsProductId, ids)); |
| | | if (CollectionUtils.isNotEmpty(insProductUsers)) { |
| | | List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList()); |
| | | String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(",")); |
| | | sampleProductDto.setCheckName(collect); |
| | | } |
| | | map.put("insOrder", insOrder); |
| | | map.put("sampleProduct", list); |
| | | map.put("sampleProduct", sampleProductDto); |
| | | //查询所有记录模版去重 |
| | | List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(id, laboratory); |
| | | List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(insSample.getInsOrderId(), laboratory); |
| | | map.put("reportModel", list2); |
| | | return map; |
| | | } |