cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java
@@ -30,8 +30,6 @@ @RestController @RequestMapping("/deviceScope") public class DeviceController { @Resource private DeviceService deviceService; cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
@@ -48,11 +48,11 @@ @ApiModelProperty(value = "单价(元)") private BigDecimal price; @ApiModelProperty(value = "实验室") @ApiModelProperty(value = "场所") private String laboratory; @ValueTableShow(4) @ApiModelProperty(value = "子实验室") @ApiModelProperty(value = "试验室") private String sonLaboratory; @ValueTableShow(5) inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java
@@ -51,7 +51,7 @@ return Result.success(standardMethodListService.selectsStandardMethodByFLSSM(tree)); } @ValueClassify("标准库") @ApiOperation(value = "修改标准库中的要求值") @ApiOperation(value = "修改标准库中的内容") @PostMapping("/upStandardProductList") public Result upStandardProductList(@RequestBody StandardProductList list){ return Result.success(standardProductListService.upStandardProductList(list)); inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
@@ -31,6 +31,8 @@ List<StandardProductList> selectStandardProductListByTree2(String tree, String sample, String model, String trees); List<StandardProductList> selectStandardProductListByTree3(String tree, String sample, String model, String trees); List<SampleTypeDto> getStandardTree2(); } inspect-server/src/main/java/com/yuanchu/mom/pojo/InsSample.java
@@ -1,15 +1,12 @@ package com.yuanchu.mom.pojo; import com.baomidou.mybatisplus.annotation.*; import java.io.Serializable; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; /** * 检验样品 @@ -111,4 +108,5 @@ @TableField(fill = FieldFill.INSERT_UPDATE) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime updateTime; } inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardProductList.java
@@ -6,7 +6,6 @@ import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; /** @@ -59,13 +58,13 @@ * 单价(元) */ @ApiModelProperty("单价") private BigDecimal price; private String price; /** * 工时(H) */ @ApiModelProperty("工时") private Double manHour; private String manHour; /** * 工时分组 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -187,7 +188,7 @@ JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue"))); if (resValue.get("v") != null) { Object o = JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v"); insProduct.setLastValue(o==null?null:(o + "")); insProduct.setLastValue(o.equals("")?null:(o + "")); } }catch (Exception e){} if (jo.get("equipValue") != null) { @@ -245,9 +246,27 @@ }).thenAccept(res -> { if(res!=null){ int pId = Integer.parseInt(res.replaceAll("\\D+", "")); // TODO: 2024/5/4 【前置】需要通过pid获取检验单当前试验室所有项目是否有检验结果后进行判断检验单是否更改成“已检”状态;前置完成后可能会导致复核接口判断是否产生报告的逻辑错误 // InsProduct insProduct = insProductMapper.selectById(pId); // insSampleMapper.selectList(Wrappers.<>) InsProduct insProduct = insProductMapper.selectById(pId); // 通过pId 获取当前样本id int sampleId = insProductMapper.selectById(pId).getInsSampleId(); // 通过样本id获取订单id int orderId = insSampleMapper.selectById(sampleId).getInsOrderId(); // 通过订单id查找所有样本id List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList()); // 通过检查每一个样本id查到属于检验项结论 is null的数量 Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory())); // is null的数量为0是将订单状态表的状态改为已检验 List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory())); insProducts.forEach(insProduct1 -> { System.out.println(insProduct1.getInsResult()); System.out.println(insProduct1.getId()); }); if (count == 0) { insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate() .eq(InsOrderState::getInsOrderId, orderId) .eq(InsOrderState::getLaboratory, insProduct.getSonLaboratory()) .set(InsOrderState::getInsState, 2)); } } }).exceptionally(e -> { e.printStackTrace(); @@ -272,7 +291,6 @@ insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, now).set(InsOrderState::getInsState, num).set(InsOrderState::getVerifyTell, tell).set(InsOrderState::getVerifyUser, getLook.selectPowerByMethodAndUserId(null).get("userId"))); List<InsOrderState> insOrderStates = insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery().eq(InsOrderState::getInsOrderId, orderId)); long count = insOrderStates.stream().filter(a -> a.getInsState() == 5).count(); // TODO: 2024/5/5 【后置】报告是否生成的判断可能会因为前置操作导致永远判断不通过 if (count == insOrderStates.size() && num == 5) { InsOrder insOrder = insOrderMapper.selectById(orderId); Map<String, String> user = insProductMapper.selectUserById(insOrder.getUserId()); inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -1,5 +1,6 @@ package com.yuanchu.mom.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -17,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; /** @@ -47,29 +49,47 @@ @Override public List<StandardProductList> selectStandardProductList(InsSample insSample) { List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, insSample.getModel())); String[] models = insSample.getModel().split("-"); List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0])); list = list.stream().filter(a -> { try { if (a.getSection() != null && !Objects.equals(a.getSection(), "")) { if (a.getSection().contains("~")) { String[] split = a.getSection().split("~"); return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(split[0])) > -1 && new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(split[1])) < 1; } else if (a.getSection().contains("≥") || a.getSection().contains(">=")) { String param = a.getSection().replace("≥", "").replace(">=", ""); return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) > -1; } else if (a.getSection().contains("≤") || a.getSection().contains("<=")) { String param = a.getSection().replace("≤", "").replace("<=", ""); return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) < 1; } else if (a.getSection().contains(">")) { String param = a.getSection().replace(">", ""); return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) > 0; } else if (a.getSection().contains("<")) { String param = a.getSection().replace("<", ""); return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) < 0; } else if (a.getSection().contains("=")) { String param = a.getSection().replace("=", ""); return new BigDecimal(insSample.getModel()).compareTo(new BigDecimal(param)) == 0; List<String> sections = JSON.parseArray(a.getSection(), String.class); List<String> asks = JSON.parseArray(a.getAsk(), String.class); List<String> tells = JSON.parseArray(a.getTell(), String.class); List<String> manHours = JSON.parseArray(a.getManHour(), String.class); List<String> prices = JSON.parseArray(a.getPrice(), String.class); boolean isIf = false; for (int i = 0;i<sections.size();i++){ if (sections.get(i).contains("&")) { String[] split = sections.get(i).split("&"); isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(split[0])) > -1 && new BigDecimal(models[1]).compareTo(new BigDecimal(split[1])) < 1; } else if (sections.get(i).contains("≥") || sections.get(i).contains(">=")) { String param = sections.get(i).replace("≥", "").replace(">=", ""); isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) > -1; } else if (sections.get(i).contains("≤") || sections.get(i).contains("<=")) { String param = sections.get(i).replace("≤", "").replace("<=", ""); isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) < 1; } else if (sections.get(i).contains(">")) { String param = sections.get(i).replace(">", ""); isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) > 0; } else if (sections.get(i).contains("<")) { String param = sections.get(i).replace("<", ""); isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) < 0; } else if (sections.get(i).contains("=")) { String param = sections.get(i).replace("=", ""); isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) == 0; } if(isIf) { a.setSection(sections.get(i)); a.setAsk(asks.get(i)); a.setTell(tells.get(i)); a.setPrice(prices.get(i)); a.setManHour(manHours.get(i)); return true; } } return false; } } catch (Exception ignored) { return false; @@ -87,7 +107,7 @@ List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2])); for (StandardTree standardTree : treeList) { String str = tree+" - "+standardTree.getSample()+" - "+standardTree.getModel(); list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str)); list.addAll(standardTreeMapper.selectStandardProductListByTree3("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str)); } } else if (trees.length == 4){ List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3])); @@ -129,7 +149,7 @@ } } Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); // CompletableFuture.supplyAsync(() -> { CompletableFuture.supplyAsync(() -> { standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree)); saveBatch(list.stream().map(a->{ a.setFactory(trees[0]); @@ -140,12 +160,12 @@ a.setStandardMethodListId(id); return a; }).collect(Collectors.toList())); /*return null; return null; }).thenAccept(res -> { }).exceptionally(e -> { e.printStackTrace(); return null; });*/ }); return list; } } inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -51,13 +51,15 @@ l.laboratory_name laboratory, sto.specimen_name sample_type, p.name sample, st.model st.model, sto.code from laboratory l left join structure_test_object sto on sto.laboratory_id = l.id left join product p on p.object_id = sto.id left join standard_tree st on st.laboratory = l.laboratory_name and st.sample_type = sto.specimen_name and st.sample = p.name order by l.id,CAST(sto.code AS DECIMAL),st.id </select> <select id="selectStandardProductById" resultType="com.yuanchu.mom.pojo.StandardProductList"> @@ -205,4 +207,39 @@ left join standard_tree st on st.sample_type = sto.specimen_name and st.sample = p.name </select> <select id="selectStandardProductListByTree3" resultType="com.yuanchu.mom.pojo.StandardProductList"> select sample sample2, inspection_item, inspection_item_en, inspection_item_subclass, inspection_item_subclass_en, method, son_laboratory, unit, ask_tell tell, ask, price, man_hour, man_hour_group, man_day, inspection_item_type, inspection_value_type, bsm, template_id, laboratory, checkout_number, section, dic, 0 state, #{model} model, #{sample} sample, #{trees} tree from structure_item_parameter where ( sample is NULL OR sample = '' or sample = '[]' OR sample LIKE CONCAT('%', #{tree}, '%') ) </select> </mapper>