| | |
| | | String required = rawInsProduct.getRequired();//标准值 |
| | | String internal = rawInsProduct.getInternal();//内控值 |
| | | rawInsProduct.setTestValue(testValue); |
| | | if (testValue.equals("过")){ |
| | | rawInsProduct.setTestState(1); |
| | | }else if (testValue.equals("不过")){ |
| | | rawInsProduct.setTestState(0); |
| | | }else { |
| | | List<Integer> list = Arrays.stream(testValue.split(",")).map(s -> { |
| | | int values = checkValues(required, internal, s); |
| | | return values; |
| | |
| | | rawInsProduct.setTestState(0); |
| | | } else { |
| | | rawInsProduct.setTestState(1); |
| | | } |
| | | } |
| | | /*更新原材料检验项目表*/ |
| | | rawInsProductMapper.updateById(rawInsProduct); |
| | |
| | | |
| | | /*判断检测值是否满足标准值和内控值的要求,如果不满足则检验结论为不合格*/ |
| | | private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | | boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | | double standVar = Double.parseDouble(standardValueStr); |
| | | double controlVar = Double.parseDouble(controlValueStr); |
| | | double detecVar = Double.parseDouble(detectionValueStr); |
| | | double a = standVar + controlVar; |
| | | double b = standVar - controlVar; |
| | | if (detecVar>=b && detecVar<=a){ |
| | | return 1; |
| | | } |
| | | return 0; |
| | | /*boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | | boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr); |
| | | |
| | | if (isStandardValueSatisfied && isControlValueSatisfied) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | }*/ |
| | | } |
| | | |
| | | private boolean isValueSatisfied(String valueStr, String detectionValueStr) { |