判定结果上报

This commit is contained in:
2025-10-15 16:41:18 +08:00
parent 7603f8c6c3
commit 09fd13af72
45 changed files with 1052 additions and 158 deletions

View File

@@ -32,6 +32,9 @@ public interface QmsCommonConstant {
/** 正常 **/
String NORMAL = "normal";
/** 超差 **/
String EXCEEDS_TOLERANCE = "exceeds_tolerance";
/** 隔离 **/
String ISOLATION = "isolation";
@@ -74,6 +77,15 @@ public interface QmsCommonConstant {
/** 已完成 **/
String COMPLETED = "completed";
/** 固定字段 **/
String FIELD_FIXED = "field_fixed";
/** 动态字段 **/
String FIELD_DYNAMIC = "field_dynamic";
/** 计算字段 **/
String FIELD_CALCULATED = "field_calculated";
/** 委托登记 **/
String ENTRUST_REGISTRATION = "entrust_registration";

View File

@@ -1,10 +1,12 @@
package com.zt.plat.module.qms.business.bus.controller.admin;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson2.JSONObject;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.qms.business.bus.service.SampleAnalysisAuditService;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -33,4 +35,45 @@ public class SampleAnalysisAuditController {
sampleAnalysisAuditService.crossAuditByByTaskId(businessAssayTaskId, auditStatus);
return success("成功");
}
@GetMapping("/getSampleResultAssessmentList")
public CommonResult<JSONObject> getSampleResultAssessmentList(Long configAssayMethodId) {
JSONObject result = sampleAnalysisAuditService.getSampleResultAssessmentList(configAssayMethodId);
return success(result);
}
@GetMapping("/getResultAssessment")
public CommonResult<?> getResultAssessment(String assayType, Long sampleId, Long configAssayMethodId) {
JSONObject result = null;
if ("平行".equals(assayType)) {
result = sampleAnalysisAuditService.getParallelResultAssessment(sampleId, configAssayMethodId);
} else if ("双杯".equals(assayType)) {
result = sampleAnalysisAuditService.getDoubleCupResultAssessment(sampleId, configAssayMethodId);
}
return success(result);
}
//平行分析结果判定
@GetMapping("/getParallelResultAssessment")
public CommonResult<?> getParallelResultAssessment(Long businessSubSampleId, Long configAssayMethodId) {
JSONObject result = sampleAnalysisAuditService.getParallelResultAssessment(businessSubSampleId, configAssayMethodId);
return success(result);
}
//双杯分析结果判定
@GetMapping("/getDoubleCupResultAssessment")
public CommonResult<?> getDoubleCupResultAssessment(Long businessSubParentSampleId, Long configAssayMethodId) {
JSONObject result = sampleAnalysisAuditService.getDoubleCupResultAssessment(businessSubParentSampleId, configAssayMethodId);
return success(result);
}
//判定数据上报
@PostMapping("/assessmentDataReporting")
public CommonResult<?> assessmentDataReporting(Long businessSubSampleId, Long configAssayMethodId) {
sampleAnalysisAuditService.assessmentDataReporting(businessSubSampleId, configAssayMethodId);
return success("成功");
}
}

View File

@@ -62,4 +62,7 @@ public class BatchSampleAnalysisColumnRespVO implements Serializable {
@Schema(description = "单位")
private String unit;
@Schema(description = "填写方式")
private String fillingWay;
}

View File

@@ -58,4 +58,6 @@ public class BusinessAssayProjectAndParameterRespVO implements Serializable {
@Schema(description = "类型project元素2参数")
private String type;
@Schema(description = "填写方式")
private String fillingWay;
}

View File

@@ -0,0 +1,35 @@
package com.zt.plat.module.qms.business.bus.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class BusinessAssayProjectDataExtendRespVO extends BusinessAssayProjectDataRespVO {
@Schema(description = "样品名称", example = "张三")
private String sampleName;
@Schema(description = "样品编号")
private String sampleCode;
@Schema(description = "分析编号")
private String sampleAssayCode;
@Schema(description = "归库编号")
private String sampleReturnCode;
@Schema(description = "分析人员")
private String assayOperator;
@Schema(description = "检测项目key")
private String dictionaryProjectKey;
@Schema(description = "检测项目缩写")
private String simpleName;
@Schema(description = "显示名称")
private String showName;
@Schema(description = "单位")
private String dictionaryProjectUnit;
}

View File

@@ -13,6 +13,12 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@Data
public class BusinessAssayProjectDataReqVO {
@Schema(description = "分样子样ID", example = "20464")
private Long businessSubSampleId;
@Schema(description = "检测方法配置ID", example = "9130")
private Long configAssayMethodId;
@Schema(description = "检测任务ID", example = "16505")
private Long businessAssayTaskDataId;

View File

@@ -1,11 +1,19 @@
package com.zt.plat.module.qms.business.bus.controller.vo;
import java.time.LocalDateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class BusinessAssayTaskDataExtendRespVO extends BusinessAssayTaskDataRespVO {
@Schema(description = "收样人")
private String sampleReceiver;
@Schema(description = "收样时间")
private LocalDateTime sampleReceiveTime;
/** 分析方法名称 **/
@Schema(description = "分析方法名称")
private String configAssayMethodName;

View File

@@ -0,0 +1,17 @@
package com.zt.plat.module.qms.business.bus.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class BusinessSubSampleAssessmentExtendRespVO extends BusinessSubSampleAssessmentRespVO {
@Schema(description = "检测项目key")
private String dictionaryProjectKey;
@Schema(description = "检测项目缩写")
private String simpleName;
@Schema(description = "显示名称")
private String showName;
}

View File

@@ -0,0 +1,31 @@
package com.zt.plat.module.qms.business.bus.controller.vo;
import java.io.Serializable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ReportFieldValueData implements Serializable {
private static final long serialVersionUID = 4301653225442965919L;
@Schema(description = "字段名称")
private String fieldName;
@Schema(description = "")
private String fieldValue;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】string-字符串int-整数decimal-小数,date-日期datetime-时间", example = "1")
private String dataType;
@Schema(description = "小数位")
private Integer decimalPosition;
@Schema(description = "单位")
private String unit;
@Schema(description = "符号")
private String mathSymbol;
}

View File

@@ -0,0 +1,37 @@
package com.zt.plat.module.qms.business.bus.controller.vo;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 样品分析结果判定
*/
@Data
public class SampleAssayResultAssessmentRespVO implements Serializable {
private static final long serialVersionUID = 5216179630941802338L;
@Schema(description = "样品名称")
private String sampleName;
@Schema(description = "样品编号")
private String sampleCode;
@Schema(description = "分析编号")
private String sampleAssayCode;
@Schema(description = "收样人")
private String sampleReceiver;
@Schema(description = "收样时间")
private LocalDateTime sampleReceiveTime;
@Schema(description = "分析人")
private String assayOperator;
@Schema(description = "上报时间")
private LocalDateTime reportTime;
}

View File

@@ -32,6 +32,7 @@ public interface BusinessAssayParameterDataMapper extends BaseMapperX<BusinessAs
.selectAs(DictionaryParameterDO::getKey, BusinessAssayProjectAndParameterRespVO::getDicKey)
.selectAs(DictionaryParameterDO::getName, BusinessAssayProjectAndParameterRespVO::getName)
.selectAs(DictionaryParameterDO::getName, BusinessAssayProjectAndParameterRespVO::getShowName)
.selectAs(DictionaryParameterDO::getFillingWay, BusinessAssayProjectAndParameterRespVO::getFillingWay)
.selectAs(BusinessAssayParameterDataDO::getDataType, BusinessAssayProjectAndParameterRespVO::getDataType)
.selectAs(BusinessAssayParameterDataDO::getDecimalPosition, BusinessAssayProjectAndParameterRespVO::getDecimalPosition)
.selectAs(BusinessAssayParameterDataDO::getValue, BusinessAssayProjectAndParameterRespVO::getValue)

View File

@@ -10,6 +10,8 @@ import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayProjectAnd
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayProjectDataPageReqVO;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayProjectDataReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO;
import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
@@ -73,4 +75,34 @@ public interface BusinessAssayProjectDataMapper extends BaseMapperX<BusinessAssa
.orderByDesc(BusinessAssayProjectDataDO::getId));
}
default List<BusinessAssayProjectDataExtendRespVO> selectByBusinessAssayTaskDataId(Long businessAssayTaskDataId) {
return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>()
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId)
.selectAll(BusinessAssayProjectDataDO.class)
.selectAs(DictionaryProjectDO::getKey, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectKey)
.selectAs(DictionaryProjectDO::getSimpleName, BusinessAssayProjectDataExtendRespVO::getSimpleName)
.selectAs(DictionaryProjectDO::getShowName, BusinessAssayProjectDataExtendRespVO::getShowName)
.eq(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataId));
}
default List<BusinessAssayProjectDataExtendRespVO> selectAnalysisBy(BusinessAssayProjectDataReqVO reqVO) {
return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>()
.leftJoin(BusinessAssayTaskDataDO.class, BusinessAssayTaskDataDO::getId, BusinessAssayProjectDataDO::getBusinessAssayTaskDataId)
.leftJoin(ConfigAssayMethodProjectDO.class, ConfigAssayMethodProjectDO::getId, BusinessAssayProjectDataDO::getConfigAssayMethodProjectId)
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId)
.leftJoin(BusinessSubSampleDO.class, BusinessSubSampleDO::getId, BusinessAssayTaskDataDO::getBusinessSubSampleId)
.selectAll(BusinessAssayProjectDataDO.class)
.selectAs(ConfigAssayMethodProjectDO::getDictionaryProjectUnit, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectUnit)
.selectAs(DictionaryProjectDO::getKey, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectKey)
.selectAs(DictionaryProjectDO::getSimpleName, BusinessAssayProjectDataExtendRespVO::getSimpleName)
.selectAs(DictionaryProjectDO::getShowName, BusinessAssayProjectDataExtendRespVO::getShowName)
.selectAs(BusinessAssayTaskDataDO::getAssayOperator, BusinessAssayProjectDataExtendRespVO::getAssayOperator)
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayProjectDataExtendRespVO::getSampleName)
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayProjectDataExtendRespVO::getSampleCode)
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayProjectDataExtendRespVO::getSampleAssayCode)
.selectAs(BusinessSubSampleDO::getSampleReturnCode, BusinessAssayProjectDataExtendRespVO::getSampleReturnCode)
.eqIfPresent(BusinessAssayTaskDataDO::getBusinessSubSampleId, reqVO.getBusinessSubSampleId())
.eqIfPresent(BusinessAssayTaskDataDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId()));
}
}

View File

@@ -6,6 +6,9 @@ import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayReportDataPageReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayReportDataDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -32,4 +35,9 @@ public interface BusinessAssayReportDataMapper extends BaseMapperX<BusinessAssay
.orderByDesc(BusinessAssayReportDataDO::getId));
}
default List<BusinessAssayReportDataDO> selectBytBusinessBaseSampleId(Long businessBaseSampleId) {
return selectList(new LambdaQueryWrapperX<BusinessAssayReportDataDO>()
.eqIfPresent(BusinessAssayReportDataDO::getBusinessBaseSampleId, businessBaseSampleId));
}
}

View File

@@ -2,6 +2,9 @@ package com.zt.plat.module.qms.business.bus.dal.mapper;
import java.util.*;
import com.alibaba.druid.sql.ast.statement.SQLForeignKeyImpl.On;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
@@ -11,9 +14,13 @@ import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataGr
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataPageReqVO;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAnalysisGroupDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -98,6 +105,47 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
.orderByDesc(BusinessAssayTaskDataDO::getId));
}
default List<BusinessAssayTaskDataExtendRespVO> selectResultAssessmentList(BusinessAssayTaskDataReqVO reqVO) {
return selectJoinList(BusinessAssayTaskDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayTaskDataDO>()
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDataDO::getConfigAssayMethodId)
.leftJoin(BusinessSubSampleDO.class, BusinessSubSampleDO::getId, BusinessAssayTaskDataDO::getBusinessSubSampleId)
// .leftJoin(BusinessSubSampleAnalysisGroupDO.class, on -> on
// .eq(BusinessSubSampleAnalysisGroupDO::getBusinessSubSampleId, BusinessAssayTaskDataDO::getBusinessSubSampleId).eq(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, 103))
.selectAll(BusinessAssayTaskDataDO.class)
.selectAs(ConfigAssayMethodDO::getName, BusinessAssayTaskDataExtendRespVO::getConfigAssayMethodName)
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode)
// .selectAs(BusinessSubSampleAnalysisGroupDO::getSampleReceiver, BusinessAssayTaskDataExtendRespVO::getSampleReceiver)
// .selectAs(BusinessSubSampleAnalysisGroupDO::getSampleReceiveTime, BusinessAssayTaskDataExtendRespVO::getSampleReceiveTime)
.eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
.eqIfPresent(BusinessAssayTaskDataDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId())
.eqIfPresent(BusinessAssayTaskDataDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId())
.eqIfPresent(BusinessAssayTaskDataDO::getBusinessSubSampleId, reqVO.getBusinessSubSampleId())
.eqIfPresent(BusinessAssayTaskDataDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
.eqIfPresent(BusinessAssayTaskDataDO::getBusinessAssayTaskId, reqVO.getBusinessAssayTaskId())
.eqIfPresent(BusinessAssayTaskDataDO::getTaskType, reqVO.getTaskType())
.eqIfPresent(BusinessAssayTaskDataDO::getAssayType, reqVO.getAssayType())
.eqIfPresent(BusinessAssayTaskDataDO::getAssayProject, reqVO.getAssayProject())
.eqIfPresent(BusinessAssayTaskDataDO::getAssayDepartmentId, reqVO.getAssayDepartmentId())
.likeIfPresent(BusinessAssayTaskDataDO::getAssayDepartmentName, reqVO.getAssayDepartmentName())
.eqIfPresent(BusinessAssayTaskDataDO::getAssayOperator, reqVO.getAssayOperator())
.betweenIfPresent(BusinessAssayTaskDataDO::getAssignTaskTime, reqVO.getAssignTaskTime())
.eqIfPresent(BusinessAssayTaskDataDO::getIsAssignTasked, reqVO.getIsAssignTasked())
.eqIfPresent(BusinessAssayTaskDataDO::getIsReported, reqVO.getIsReported())
.eqIfPresent(BusinessAssayTaskDataDO::getReporter, reqVO.getReporter())
.betweenIfPresent(BusinessAssayTaskDataDO::getReportTime, reqVO.getReportTime())
.eqIfPresent(BusinessAssayTaskDataDO::getConfigSampleFlowId, reqVO.getConfigSampleFlowId())
.eqIfPresent(BusinessAssayTaskDataDO::getSampleFlowNodeKey, reqVO.getSampleFlowNodeKey())
.betweenIfPresent(BusinessAssayTaskDataDO::getSampleFlowNodeTime, reqVO.getSampleFlowNodeTime())
.eqIfPresent(BusinessAssayTaskDataDO::getAnalysisCount, reqVO.getAnalysisCount())
.eqIfPresent(BusinessAssayTaskDataDO::getUpdateCount, reqVO.getUpdateCount())
.eqIfPresent(BusinessAssayTaskDataDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(BusinessAssayTaskDataDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(BusinessAssayTaskDataDO::getRemark, reqVO.getRemark())
.orderByDesc(BusinessAssayTaskDataDO::getId));
}
/**
* 查询未指派的分析任务分组
* @param reqVO
@@ -131,11 +179,14 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
* @return
*/
default List<BusinessAssayTaskDataDO> selectIsReportedList(List<Long> excludeIds, Long businessSubSampleId, Long configAssayMethodId, Integer isReported) {
return selectList(new LambdaQueryWrapperX<BusinessAssayTaskDataDO>()
.notIn(BusinessAssayTaskDataDO::getId, excludeIds)
.eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId)
LambdaQueryWrapper<BusinessAssayTaskDataDO> queryWrapper = new LambdaQueryWrapperX<BusinessAssayTaskDataDO>();
if (CollUtil.isNotEmpty(excludeIds)) {
queryWrapper.notIn(BusinessAssayTaskDataDO::getId, excludeIds);
}
queryWrapper.eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId)
.eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId)
.eq(BusinessAssayTaskDataDO::getIsReported, isReported));
.eq(BusinessAssayTaskDataDO::getIsReported, isReported);
return selectList(queryWrapper);
}
}

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.qms.business.bus.dal.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessHandoverRecordSubExtendRespVO;
@@ -8,6 +9,9 @@ import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessHandoverRecord
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
import com.zt.plat.module.qms.common.dic.dal.dataobject.DictionaryBusinessDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -46,4 +50,16 @@ public interface BusinessHandoverRecordSubMapper extends BaseMapperX<BusinessHan
.orderByDesc(BusinessHandoverRecordSubDO::getCreateTime));
}
default List<BusinessHandoverRecordSubDO> selectByBusinessSubSampleId(Long businessSubSampleId) {
return selectList(new LambdaQueryWrapper<BusinessHandoverRecordSubDO>()
.eq(BusinessHandoverRecordSubDO::getBusinessSubSampleId, businessSubSampleId)
.orderByDesc(BusinessHandoverRecordSubDO::getCreateTime));
}
default List<BusinessHandoverRecordSubDO> selectByBusinessSubSampleIds(List<Long> businessSubSampleIds) {
return selectList(new LambdaQueryWrapper<BusinessHandoverRecordSubDO>()
.in(BusinessHandoverRecordSubDO::getBusinessSubSampleId, businessSubSampleIds)
.orderByDesc(BusinessHandoverRecordSubDO::getCreateTime));
}
}

View File

@@ -2,10 +2,15 @@ package com.zt.plat.module.qms.business.bus.dal.mapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSubSampleAssessmentPageReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO;
import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -39,4 +44,16 @@ public interface BusinessSubSampleAssessmentMapper extends BaseMapperX<BusinessS
.orderByDesc(BusinessSubSampleAssessmentDO::getId));
}
default List<BusinessSubSampleAssessmentExtendRespVO> selectByBusinessSubSampleIdAndConfigAssayMethodId(Long businessSubSampleId, Long configAssayMethodId) {
return selectJoinList(BusinessSubSampleAssessmentExtendRespVO.class, new MPJLambdaWrapperX<BusinessSubSampleAssessmentDO>()
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessSubSampleAssessmentDO::getDictionaryProjectId)
.selectAll(BusinessSubSampleAssessmentDO.class)
.selectAs(DictionaryProjectDO::getKey, BusinessSubSampleAssessmentExtendRespVO::getDictionaryProjectKey)
.selectAs(DictionaryProjectDO::getSimpleName, BusinessSubSampleAssessmentExtendRespVO::getSimpleName)
.selectAs(DictionaryProjectDO::getShowName, BusinessSubSampleAssessmentExtendRespVO::getShowName)
.eq(BusinessSubSampleAssessmentDO::getBusinessSubSampleId, businessSubSampleId)
.eq(BusinessSubSampleAssessmentDO::getConfigAssayMethodId, configAssayMethodId)
);
}
}

View File

@@ -2,15 +2,22 @@ package com.zt.plat.module.qms.business.bus.liteflow.sample.entrust;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import com.zt.plat.module.qms.business.bus.liteflow.param.SampleFlowParam;
import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleEntrustContext;
import com.zt.plat.module.qms.business.bus.service.SampleFlowService;
import jakarta.annotation.Resource;
@LiteflowComponent(id = "sampleEntrustReceiveDataCmp", name = "中心接收样品委托的样品数据")
public class SampleEntrustReceiveDataCmp extends NodeComponent {
@Resource
private SampleFlowService sampleFlowService;
@Override
public void process() throws Exception {
SampleFlowParam sampleFlowParam = new SampleFlowParam();
sampleFlowService.sampleFlow(sampleFlowParam);
}
@Override

View File

@@ -2,15 +2,22 @@ package com.zt.plat.module.qms.business.bus.liteflow.sample.entrust;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import com.zt.plat.module.qms.business.bus.liteflow.param.SampleFlowParam;
import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleEntrustContext;
import com.zt.plat.module.qms.business.bus.service.SampleFlowService;
import jakarta.annotation.Resource;
@LiteflowComponent(id = "sampleEntrustSendDataCmp", name = "中心送样品委托的样品数据到分析室")
public class SampleEntrustSendDataCmp extends NodeComponent {
@Resource
private SampleFlowService sampleFlowService;
@Override
public void process() throws Exception {
SampleFlowParam sampleFlowParam = new SampleFlowParam();
sampleFlowService.sampleFlow(sampleFlowParam);
}
@Override

View File

@@ -10,9 +10,12 @@ import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessHandoverRecordSubDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessHandoverRecordSubMapper;
import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleFlowContext;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSampleFlowDO;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigRuleMapper;
import com.zt.plat.module.qms.business.config.service.ConfigSampleFlowService;
//import com.zt.plat.module.qms.business.config.service.ConfigSubSampleService;
import com.zt.plat.module.qms.core.sampleflow.SampleFlowDefinition;
@@ -28,9 +31,15 @@ public class SampleSubProcessUpdateCmp extends NodeComponent {
@Resource
private ExpressRunner expressRunner;
@Resource
private ConfigRuleMapper configRuleMapper;
@Resource
private ConfigSampleFlowService configSampleFlowService;
@Resource
private BusinessHandoverRecordSubMapper businessHandoverRecordSubMapper;
@Override
public void process() throws Exception {
SampleFlowContext sampleFlowContext = this.getContextBean(SampleFlowContext.class);
@@ -38,8 +47,11 @@ public class SampleSubProcessUpdateCmp extends NodeComponent {
// LoginUser loginUser = sampleFlowContext.getLoginUser();
// String loginRealname = sampleFlowContext.getLoginRealname();
LocalDateTime currentDateTime = sampleFlowContext.getCurrentDateTime();
List<Long> sampleIdList = sampleFlowContext.getSampleIdList();
List<BusinessSubSampleDO> busSubCsampleList = sampleFlowContext.getBusinessSubSampleList();
List<BusinessAssayTaskDataDO> businessAssayTaskDataList = sampleFlowContext.getBusinessAssayTaskDataList();
//查询历史交接记录
List<BusinessHandoverRecordSubDO> businessHandoverRecordSubDOList = businessHandoverRecordSubMapper.selectByBusinessSubSampleIds(sampleIdList);
for (BusinessSubSampleDO businessSubSample : busSubCsampleList) {
ConfigSampleFlowDO configSampleFlow = configSampleFlowService.getConfigSampleFlow(businessSubSample.getConfigSampleFlowId());
String configSampleFlowContent = configSampleFlow.getContent();

View File

@@ -1,5 +1,7 @@
package com.zt.plat.module.qms.business.bus.service;
import com.alibaba.fastjson2.JSONObject;
/**
* <b>SampleAnalysisAuditService</b>
* <p>
@@ -16,4 +18,12 @@ public interface SampleAnalysisAuditService {
void crossAuditByByTaskId(Long businessAssayTaskId, String auditStatus);
JSONObject getSampleResultAssessmentList(Long configAssayMethodId);
JSONObject getParallelResultAssessment(Long businessSubSampleId, Long configAssayMethodId);
JSONObject getDoubleCupResultAssessment(Long businessSubParentSampleId, Long configAssayMethodId);
void assessmentDataReporting(Long businessSubSampleId, Long configAssayMethodId);
}

View File

@@ -3,27 +3,55 @@ package com.zt.plat.module.qms.business.bus.service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ql.util.express.ExpressRunner;
import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayReportDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessBaseSampleDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessTeamAssessmentDO;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayProjectDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayReportDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDetailMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessBaseSampleMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleAssessmentMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessTeamAssessmentMapper;
import com.zt.plat.module.qms.business.config.controller.vo.*;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectAssessmentDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigReportFieldDO;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectAssessmentMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigProjectMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigReportFieldMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigReportTypeMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSampleReportMapper;
import com.zt.plat.module.qms.core.qlexpress.cmp.AllowanceCalculatorComponent;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import cn.hutool.core.bean.BeanUtil;
import jakarta.annotation.Resource;
/**
@@ -62,9 +90,163 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
@Resource
private ConfigAssayMethodProjectAssessmentMapper configAssayMethodProjectAssessmentMapper;
@Resource
private BusinessTeamAssessmentMapper businessTeamAssessmentMapper;
@Resource
private BusinessSubSampleAssessmentMapper businessSubSampleAssessmentMapper;
@Resource
private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper;
@Override
public JSONObject getSampleResultAssessmentList(Long configAssayMethodId) {
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectDOList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(configAssayMethodId);
List<Map<String, Object>> columnList = new ArrayList<>();
// columnList.add(new HashMap<String, Object>() {{
// put("title", "样品名称");
// put("field", "sampleName");
// put("dataType", "string");
// put("decimalPosition", null);
// put("isEdit", false);
// }});
// columnList.add(new HashMap<String, Object>() {{
// put("title", "样品编号");
// put("field", "sampleAssayCode");
// put("dataType", "string");
// put("decimalPosition", null);
// put("isEdit", false);
// }});
// columnList.add(new HashMap<String, Object>() {{
// put("title", "收样时间");
// put("field", "sampleReceiveTime");
// put("dataType", "string");
// put("decimalPosition", null);
// put("isEdit", false);
// }});
// columnList.add(new HashMap<String, Object>() {{
// put("title", "分析人");
// put("field", "assayOperator");
// put("dataType", "string");
// put("decimalPosition", null);
// put("isEdit", false);
// }});
// columnList.add(new HashMap<String, Object>() {{
// put("title", "上报时间");
// put("field", "reportTime");
// put("dataType", "string");
// put("decimalPosition", null);
// put("isEdit", false);
// }});
for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProject : configAssayMethodProjectDOList) {
columnList.add(new HashMap<String, Object>() {{
put("title", configAssayMethodProject.getShowName() + "(" + configAssayMethodProject.getDictionaryProjectUnit() + ")");
put("field", configAssayMethodProject.getSimpleName());
put("dataType", configAssayMethodProject.getDataType());
put("decimalPosition", configAssayMethodProject.getDecimalPosition());
put("isEdit", true);
}});
}
List<Map<String, Object>> dataList = new ArrayList<>();
BusinessAssayTaskDataReqVO search = new BusinessAssayTaskDataReqVO();
search.setConfigAssayMethodId(configAssayMethodId);
List<BusinessAssayTaskDataExtendRespVO> resultAssessmentList = businessAssayTaskDataMapper.selectResultAssessmentList(search);
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskDataExtendRespVO : resultAssessmentList) {
Map<String,Object> businessAssayTaskDataMap = BeanUtil.beanToMap(businessAssayTaskDataExtendRespVO);
Map<String,Object> businessAssayTaskDataAssessmentMap = BeanUtil.copyProperties(businessAssayTaskDataMap, Map.class);
businessAssayTaskDataAssessmentMap.put("assayOperator", "判定结果");
businessAssayTaskDataAssessmentMap.put("reportTime", null);
boolean isExis = dataList.stream().anyMatch(f ->
Objects.equals(businessAssayTaskDataExtendRespVO.getBusinessSubSampleId(), f.get("businessSubSampleId")) &&
Objects.equals(businessAssayTaskDataExtendRespVO.getConfigAssayMethodId(), f.get("configAssayMethodId")) &&
"判定结果".equals(f.get("assayOperator"))
);
if (!isExis) {
if ("平行".equals(businessAssayTaskDataExtendRespVO.getAssayType())) {
List<BusinessSubSampleAssessmentExtendRespVO> businessSubSampleAssessmentList = businessSubSampleAssessmentMapper.selectByBusinessSubSampleIdAndConfigAssayMethodId(businessAssayTaskDataExtendRespVO.getBusinessSubSampleId(), configAssayMethodId);
for (BusinessSubSampleAssessmentExtendRespVO businessSubSampleAssessment : businessSubSampleAssessmentList) {
businessAssayTaskDataAssessmentMap.put("id", businessSubSampleAssessment.getId());
businessAssayTaskDataAssessmentMap.put(businessSubSampleAssessment.getSimpleName(), businessSubSampleAssessment.getAssessmentValue());
businessAssayTaskDataAssessmentMap.put("assessmentStatus", businessSubSampleAssessment.getAssessmentValue());
}
} else if ("双杯".equals(businessAssayTaskDataExtendRespVO.getAssayType())) {
//businessTeamAssessmentMapper.selectBy
}
dataList.add(businessAssayTaskDataAssessmentMap);
}
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataId(businessAssayTaskDataExtendRespVO.getId());
for (BusinessAssayProjectDataExtendRespVO businessAssayProjectData : businessAssayProjectDataList) {
businessAssayTaskDataMap.put(businessAssayProjectData.getSimpleName(), businessAssayProjectData.getValue());
}
dataList.add(businessAssayTaskDataMap);
}
JSONObject json = new JSONObject();
json.put("columns", columnList);
json.put("datas", dataList);
return json;
}
@Override
public JSONObject getParallelResultAssessment(Long businessSubSampleId, Long configAssayMethodId) {
List<Map<String, Object>> columnList = new ArrayList<>();
List<Map<String, Object>> dataList = new ArrayList<>();
//查询判定值
List<BusinessSubSampleAssessmentExtendRespVO> businessSubSampleAssessmentList = businessSubSampleAssessmentMapper.selectByBusinessSubSampleIdAndConfigAssayMethodId(businessSubSampleId, configAssayMethodId);
for (BusinessSubSampleAssessmentExtendRespVO businessSubSampleAssessment : businessSubSampleAssessmentList) {
Map<String, Object> businessSubSampleAssessmentMap = BeanUtil.beanToMap(businessSubSampleAssessment);
dataList.add(businessSubSampleAssessmentMap);
}
//查询子样平行分析结果
BusinessAssayProjectDataReqVO search = new BusinessAssayProjectDataReqVO();
search.setBusinessSubSampleId(businessSubSampleId);
search.setConfigAssayMethodId(configAssayMethodId);
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectAnalysisBy(search);
// BusinessAssayTaskDataReqVO search = new BusinessAssayTaskDataReqVO();
// search.setBusinessSubSampleId(businessSubSampleId);
// search.setConfigAssayMethodId(configAssayMethodId);
// List<BusinessAssayTaskDataExtendRespVO> resultAssessmentList = businessAssayTaskDataMapper.selectResultAssessmentList(search);
JSONObject json = new JSONObject();
json.put("columns", columnList);
json.put("datas", dataList);
json.put("subDatas", businessAssayProjectDataList);
return json;
}
@Override
public JSONObject getDoubleCupResultAssessment(Long businessSubParentSampleId, Long configAssayMethodId) {
// TODO Auto-generated method stub
return null;
}
@Override
public void crossAuditByByTaskId(Long businessAssayTaskId, String auditStatus) {
//当前登录用户昵称
String nickName = SecurityFrameworkUtils.getLoginUserNickname();
//班组长双杯判定记录
List<BusinessTeamAssessmentDO> businessTeamAssessmentDOList = new ArrayList<>();
//平行样判定记录
List<BusinessSubSampleAssessmentDO> businessSubSampleAssessmentDOList = new ArrayList<>();
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
if (QmsCommonConstant.APPROVE.equals(auditStatus)) {
businessAssayTaskDO.setFinishStatus(QmsCommonConstant.COMPLETED);
@@ -79,7 +261,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
Map<Long, List<BusinessAssayTaskDataDO>> businessAssayTaskDataDOMap = businessAssayTaskDataDOList.stream().collect(Collectors.groupingBy(BusinessAssayTaskDataDO::getBusinessSubSampleId));
for (Map.Entry<Long, List<BusinessAssayTaskDataDO>> businessAssayTaskDataDOMapEntry : businessAssayTaskDataDOMap.entrySet()) {
//Long key = businessAssayTaskDataDOMapEntry.getKey();
Long businessSubSampleId = businessAssayTaskDataDOMapEntry.getKey();
List<BusinessAssayTaskDataDO> businessAssayTaskDataList = businessAssayTaskDataDOMapEntry.getValue();
List<Long> businessAssayTaskDataIdList = businessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
BusinessAssayTaskDataDO businessAssayTaskDataDO = businessAssayTaskDataList.get(0);
@@ -100,12 +282,23 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
//查询分析项目
List<BusinessAssayProjectDataDO> businessAssayProjectDataDOList = businessAssayProjectDataMapper.selectList(new LambdaQueryWrapperX<BusinessAssayProjectDataDO>().in(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataIdList));
Map<Long, List<BusinessAssayProjectDataDO>> businessAssayProjectDataDOMap = businessAssayProjectDataDOList.stream().collect(Collectors.groupingBy(BusinessAssayProjectDataDO::getDictionaryProjectId));
for (Map.Entry<Long, List<BusinessAssayProjectDataDO>> entry1 : businessAssayProjectDataDOMap.entrySet()) {
Long dictionaryProjectId = entry1.getKey();
List<BusinessAssayProjectDataDO> val1 = entry1.getValue();
for (Map.Entry<Long, List<BusinessAssayProjectDataDO>> businessAssayProjectDataDOEntry : businessAssayProjectDataDOMap.entrySet()) {
Long dictionaryProjectId = businessAssayProjectDataDOEntry.getKey();
List<BusinessAssayProjectDataDO> val1 = businessAssayProjectDataDOEntry.getValue();
BusinessAssayProjectDataDO businessAssayProjectDataDO = val1.get(0);
List<ConfigAssayMethodProjectAssessmentDO> configAssayMethodProjectAssessmentDOList = configAssayMethodProjectAssessmentMapper.selectList(new LambdaQueryWrapperX<ConfigAssayMethodProjectAssessmentDO>().eq(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodId, businessAssayTaskDataDO.getConfigAssayMethodId()).eq(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodProjectId, businessAssayProjectDataDO.getConfigAssayMethodProjectId()));
//判定结果数据
BusinessSubSampleAssessmentDO businessSubSampleAssessmentDO = new BusinessSubSampleAssessmentDO();
businessSubSampleAssessmentDO.setBusinessSubSampleId(businessSubSampleId);
businessSubSampleAssessmentDO.setConfigAssayMethodId(businessAssayTaskDataDO.getConfigAssayMethodId());
businessSubSampleAssessmentDO.setConfigAssayMethodProjectId(businessAssayProjectDataDO.getConfigAssayMethodProjectId());
businessSubSampleAssessmentDO.setDictionaryProjectId(dictionaryProjectId);
businessSubSampleAssessmentDO.setDataType(businessAssayProjectDataDO.getDataType());
businessSubSampleAssessmentDO.setDecimalPosition(businessAssayProjectDataDO.getDecimalPosition());
businessSubSampleAssessmentDO.setAssayType(businessAssayTaskDataDO.getAssayType());
businessSubSampleAssessmentDO.setTaskType(businessAssayTaskDataDO.getTaskType());
businessSubSampleAssessmentDO.setAssessmentStatus(QmsCommonConstant.NORMAL);
// 排序并处理 null
List<BigDecimal> sortedValues = val1.stream()
@@ -119,7 +312,10 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
// 获取小数精度
int elementScale = businessAssayProjectDataDO.getDecimalPosition();
// 计算代表值(均值或差值)
BigDecimal representativeValue = calculateRepresentativeValue(sortedValues);
BigDecimal representativeValue = calculateRepresentativeValue(sortedValues, elementScale);
//设置判定值
businessSubSampleAssessmentDO.setAssessmentValue(representativeValue.toPlainString());
// 查找匹配的允差规则
ConfigAssayMethodProjectAssessmentDO matchedRule = findMatchingRule(configAssayMethodProjectAssessmentDOList, representativeValue);
@@ -139,30 +335,12 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
for (int i = 0; i < sortedValues.size() - 1; i++) {
BigDecimal diff = sortedValues.get(i + 1).subtract(sortedValues.get(i)).abs();
if (diff.compareTo(allowValue) > 0) {
businessSubSampleAssessmentDO.setAssessmentStatus(QmsCommonConstant.EXCEEDS_TOLERANCE);
}
}
businessSubSampleAssessmentDOList.add(businessSubSampleAssessmentDO);
}
@@ -179,18 +357,13 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
}
// for (BusinessAssayTaskDataDO businessAssayTaskDataDO : businessAssayTaskDataDOList) {
// if ("平行".equals(businessAssayTaskDataDO.getAssayType())) {
// //判定检查项目是否都已上报
//
//
// }
//
//
//
// }
for (BusinessAssayTaskDataDO businessAssayTaskDataDO : businessAssayTaskDataDOList) {
businessAssayTaskDataDO.setIsReported(1);
businessAssayTaskDataDO.setReportTime(LocalDateTime.now());
businessAssayTaskDataDO.setReporter(nickName);
}
businessAssayTaskDataMapper.updateBatch(businessAssayTaskDataDOList);
@@ -208,6 +381,16 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.NOT_START);
}
businessAssayTaskMapper.updateById(businessAssayTaskDO);
//插入平行判定记录
if (businessSubSampleAssessmentDOList.size() > 0) {
businessSubSampleAssessmentMapper.insertBatch(businessSubSampleAssessmentDOList);
}
//插入双杯判定记录
if (businessTeamAssessmentDOList.size() > 0) {
businessTeamAssessmentMapper.insertBatch(businessTeamAssessmentDOList);
}
}
// 查找匹配的允差区间
@@ -242,14 +425,130 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
}
// 计算代表值1个取本身2个取均值>2取平均
private BigDecimal calculateRepresentativeValue(List<BigDecimal> values) {
private BigDecimal calculateRepresentativeValue(List<BigDecimal> values, int elementScale) {
int size = values.size();
if (size == 0) return BigDecimal.ZERO;
if (size == 1) return values.get(0);
if (size == 1) return values.get(0).setScale(elementScale, RoundingMode.HALF_EVEN);
if (size == 2) {
return values.get(0).add(values.get(1)).divide(BigDecimal.valueOf(2), 6, RoundingMode.HALF_EVEN);
return values.get(0).add(values.get(1)).divide(BigDecimal.valueOf(2), elementScale, RoundingMode.HALF_EVEN);
}
BigDecimal sum = values.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
return sum.divide(BigDecimal.valueOf(size), 6, RoundingMode.HALF_EVEN);
return sum.divide(BigDecimal.valueOf(size), elementScale, RoundingMode.HALF_EVEN);
}
@Resource
private ConfigSampleReportMapper configSampleReportMapper;
@Resource
private ConfigReportFieldMapper configReportFieldMapper;
@Resource
private ConfigReportTypeMapper configReportTypeMapper;
@Resource
private ConfigProjectMapper configProjectMapper;
@Resource
private BusinessAssayReportDataMapper businessAssayReportDataMapper;
@Resource
private BusinessBaseSampleMapper businessBaseSampleMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void assessmentDataReporting(Long businessSubSampleId, Long configAssayMethodId) {
//当前登录用户昵称
String nickName = SecurityFrameworkUtils.getLoginUserNickname();
List<BusinessAssayTaskDataDO> unReportedList = businessAssayTaskDataMapper.selectIsReportedList(null, businessSubSampleId, configAssayMethodId, QmsCommonConstant.NO);
if (unReportedList.size() > 0) {
throw new ServiceException(500, "存在未上报的数据");
}
List<BusinessAssayReportDataDO> saveBusinessAssayReportDataDOList = new ArrayList<>();
List<BusinessAssayReportDataDO> updateBusinessAssayReportDataDOList = new ArrayList<>();
//分析任务已全部上报
List<BusinessAssayTaskDataDO> reportedList = businessAssayTaskDataMapper.selectIsReportedList(null, businessSubSampleId, configAssayMethodId, QmsCommonConstant.YES);
//平行样判定结果
List<BusinessSubSampleAssessmentExtendRespVO> businessSubSampleAssessmentList = businessSubSampleAssessmentMapper.selectByBusinessSubSampleIdAndConfigAssayMethodId(businessSubSampleId, configAssayMethodId);
List<Long> businessSubSampleAssessmentIdList = businessSubSampleAssessmentList.stream().map(m -> m.getId()).collect(Collectors.toList());
BusinessAssayTaskDataDO businessAssayTaskDataDO = reportedList.get(0);
//查询主样
BusinessBaseSampleDO businessBaseSampleDO = businessBaseSampleMapper.selectById(businessAssayTaskDataDO.getBusinessBaseSampleId());
//查询报表
List<BusinessAssayReportDataDO> businessAssayReportDataDOList = businessAssayReportDataMapper.selectBytBusinessBaseSampleId(businessAssayTaskDataDO.getBusinessBaseSampleId());
ConfigSampleReportReqVO configSampleReportSearch = new ConfigSampleReportReqVO();
configSampleReportSearch.setConfigBaseSampleId(businessBaseSampleDO.getConfigBaseSampleId());
List<ConfigSampleReportExtendRespVO> configSampleReportList = configSampleReportMapper.selectList(configSampleReportSearch);
List<Long> configReportTypeIdList = configSampleReportList.stream().map(m -> m.getConfigReportTypeId()).collect(Collectors.toList());
//查询动态和计算的报表字段
List<ConfigReportFieldDO> configReportFieldList = configReportFieldMapper.selectByConfigReportTypeIds(configReportTypeIdList, Arrays.asList(QmsCommonConstant.FIELD_DYNAMIC, QmsCommonConstant.FIELD_CALCULATED));
//动态报表字段
List<ConfigReportFieldDO> configReportFieldDynamicList = configReportFieldList.stream().filter(f -> QmsCommonConstant.FIELD_DYNAMIC.equals(f.getFieldType())).collect(Collectors.toList());
//根据检测方法查询字段配置
List<ConfigProjectExtendRespVO> configProjectList = configProjectMapper.selectByConfigAssayMethodId(configAssayMethodId);
for (ConfigSampleReportExtendRespVO configSampleReport : configSampleReportList) {
BusinessAssayReportDataDO businessAssayReportDataDO = businessAssayReportDataDOList.stream().filter(f -> f.getConfigReportTypeId().equals(configSampleReport.getConfigReportTypeId()) && f.getConfigSampleReportId().equals(configSampleReport.getId())).findFirst().orElse(null);
if (businessAssayReportDataDO == null) {
businessAssayReportDataDO = new BusinessAssayReportDataDO();
businessAssayReportDataDO.setBusinessBaseSampleId(businessAssayTaskDataDO.getBusinessBaseSampleId());
businessAssayReportDataDO.setConfigReportTypeId(configSampleReport.getConfigReportTypeId());
businessAssayReportDataDO.setConfigSampleReportId(configSampleReport.getId());
businessAssayReportDataDO.setSampleCode(businessBaseSampleDO.getSampleCode());
saveBusinessAssayReportDataDOList.add(businessAssayReportDataDO);
} else {
updateBusinessAssayReportDataDOList.add(businessAssayReportDataDO);
}
JSONObject assayDataJson = new JSONObject();
String assayData = businessAssayReportDataDO.getAssayData();
if (StringUtils.isNotBlank(assayData)) {
assayDataJson = JSON.parseObject(assayData);
}
//循环判定值
for (BusinessSubSampleAssessmentExtendRespVO businessSubSampleAssessment : businessSubSampleAssessmentList) {
Long configAssayMethodProjectId = businessSubSampleAssessment.getConfigAssayMethodProjectId();
List<ConfigProjectExtendRespVO> configProjectFeildList = configProjectList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectId)).collect(Collectors.toList());
for (ConfigProjectExtendRespVO configProjectFeild : configProjectFeildList) {
//查询动态报表字段
ConfigReportFieldDO configReportField = configReportFieldDynamicList.stream().filter(f -> f.getConfigReportTypeId().equals(configSampleReport.getConfigReportTypeId()) && f.getField().equals(configProjectFeild.getSaveColumn())).findFirst().orElse(null);
if (configReportField == null) {
continue;
}
ReportFieldValueData reportFieldValueData = new ReportFieldValueData();
reportFieldValueData.setFieldName(configReportField.getFieldName());
reportFieldValueData.setFieldValue(businessSubSampleAssessment.getAssessmentValue());
reportFieldValueData.setDataType(configReportField.getDataType());
reportFieldValueData.setMathSymbol("=");
reportFieldValueData.setUnit(configProjectFeild.getDictionaryProjectUnit());
assayDataJson.put(configReportField.getField(), reportFieldValueData);
}
}
businessAssayReportDataDO.setAssayData(assayDataJson.toJSONString());
}
if (saveBusinessAssayReportDataDOList.size() > 0) {
businessAssayReportDataMapper.insertBatch(saveBusinessAssayReportDataDOList);
}
if (updateBusinessAssayReportDataDOList.size() > 0) {
businessAssayReportDataMapper.updateBatch(updateBusinessAssayReportDataDOList);
}
businessSubSampleAssessmentMapper.update(new LambdaUpdateWrapper<BusinessSubSampleAssessmentDO>()
.set(BusinessSubSampleAssessmentDO::getIsReported, QmsCommonConstant.YES)
.set(BusinessSubSampleAssessmentDO::getReporter, nickName)
.set(BusinessSubSampleAssessmentDO::getReportTime, LocalDateTime.now())
.in(BusinessSubSampleAssessmentDO::getId, businessSubSampleAssessmentIdList));
}
}

View File

@@ -41,6 +41,8 @@ import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodMapper
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectRangeMapper;
import com.zt.plat.module.qms.common.data.dal.dataobject.DataCollectionDO;
import com.zt.plat.module.qms.common.data.service.DataCollectionService;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import jakarta.annotation.Resource;
/**
@@ -104,8 +106,8 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
//处理列
List<BatchSampleAnalysisColumnRespVO> cloumns = new ArrayList<>();
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleCode", "sampleCode", "样品编号", "200px", "200px", "string", null, null, null, null, false, null));
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleName", "sampleName", "样品名称", "200px", "200px", "string", null, null, null, null, false, null));
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleCode", "sampleCode", "样品编号", "200px", "200px", "string", null, null, null, null, false, null, null));
cloumns.add(new BatchSampleAnalysisColumnRespVO("sampleName", "sampleName", "样品名称", "200px", "200px", "string", null, null, null, null, false, null, null));
//cloumns.add(new BatchSampleAnalysisColumnRespVO("cupNumber", "cupNumber", "杯号", "200px", "200px", "string", null, null, null, null, true, null));
@@ -121,7 +123,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
String fieldIndex = "e" + ep.getDicId();
String title = ep.getShowName() + (StringUtils.isBlank(ep.getUnit()) ? "" : "(" + ep.getUnit() + ")");
boolean isEdit = StringUtils.isBlank(ep.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", ep.getDataType(), ep.getDecimalPosition(), null, ep.getFormula(), ep.getParamNo(), isEdit, ep.getUnit()));
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", ep.getDataType(), ep.getDecimalPosition(), null, ep.getFormula(), ep.getParamNo(), isEdit, ep.getUnit(), ep.getFillingWay()));
if (StringUtils.isNotEmpty(ep.getFormula())) {
BusinessAssayParameterDataReqVO parameterDataSearch = new BusinessAssayParameterDataReqVO();
@@ -131,7 +133,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
fieldIndex = "p" + p.getDicId();
title = p.getShowName() + (StringUtils.isBlank(p.getUnit()) ? "" : "(" + p.getUnit() + ")");
isEdit = StringUtils.isBlank(p.getFormula());
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit()));
cloumns.add(new BatchSampleAnalysisColumnRespVO(fieldIndex, fieldIndex + ".value", title, "", "120px", p.getDataType(), p.getDecimalPosition(), null, p.getFormula(), p.getParamNo(), isEdit, p.getUnit(), p.getFillingWay()));
}
}
}
@@ -305,6 +307,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
businessAssayTaskDO.setReportOperator(loginUserNickname);
businessAssayTaskDO.setReportTime(LocalDateTime.now());
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.NOT_START);
businessAssayTaskMapper.updateById(businessAssayTaskDO);
}

View File

@@ -39,7 +39,7 @@ public class ConfigAssayMethodProjectCoefficientPageReqVO extends PageParam {
private BigDecimal coefficient;
@Schema(description = "所属部门")
private String systemDepartmentCustomsDeclaration;
private String systemDepartmentCode;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

View File

@@ -51,7 +51,7 @@ public class ConfigAssayMethodProjectCoefficientRespVO {
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String systemDepartmentCustomsDeclaration;
private String systemDepartmentCode;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")

View File

@@ -42,7 +42,7 @@ public class ConfigAssayMethodProjectCoefficientSaveReqVO {
private BigDecimal coefficient;
@Schema(description = "所属部门")
private String systemDepartmentCustomsDeclaration;
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;

View File

@@ -0,0 +1,17 @@
package com.zt.plat.module.qms.business.config.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ConfigAssayMethodProjectExtendRespVO extends ConfigAssayMethodProjectRespVO {
@Schema(description = "检测项目key")
private String dictionaryProjectKey;
@Schema(description = "检测项目缩写")
private String simpleName;
@Schema(description = "显示名称")
private String showName;
}

View File

@@ -0,0 +1,23 @@
package com.zt.plat.module.qms.business.config.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ConfigProjectExtendRespVO extends ConfigProjectRespVO {
@Schema(description = "检测方法分析项目配置ID")
private Long configAssayMethodProjectId;
@Schema(description = "检测项目key")
private String dictionaryProjectKey;
@Schema(description = "检测项目缩写")
private String dictionaryProjectSimpleName;
@Schema(description = "检测项目显示名称")
private String dictionaryProjectShowName;
@Schema(description = "检测项目单位")
private String dictionaryProjectUnit;
}

View File

@@ -13,30 +13,33 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@Data
public class ConfigReportFieldPageReqVO extends PageParam {
@Schema(description = "报表类型ID", example = "24954")
@Schema(description = "报表类型ID", example = "27695")
private Long configReportTypeId;
@Schema(description = "绑定字段")
private String field;
@Schema(description = "标题名称", example = "赵六")
@Schema(description = "标题名称", example = "王五")
private String fieldName;
@Schema(description = "排序号")
private Integer no;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间", example = "2")
private Integer dataType;
@Schema(description = "小数位")
private Integer decimalPosition;
@Schema(description = "字段类型,固定字段-field_fixed、动态字段-field_dynamic、计算字段-field_calculated", example = "1")
private String fieldType;
@Schema(description = "列宽")
private Integer fieldWidth;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间", example = "1")
private String dataType;
@Schema(description = "小数位")
private Integer decimalPosition;
@Schema(description = "是否分组")
private Integer isGroup;
@Schema(description = "表头分组")
private String titleGroup;
@Schema(description = "是否可修改")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Integer[] isUpdate;
@@ -44,8 +47,8 @@ public class ConfigReportFieldPageReqVO extends PageParam {
@Schema(description = "计算公式")
private String formula;
@Schema(description = "表头分组")
private String titleGroup;
@Schema(description = "排序号")
private Integer no;
@Schema(description = "所属部门")
private String systemDepartmentCode;

View File

@@ -0,0 +1,66 @@
package com.zt.plat.module.qms.business.config.controller.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 报表字段配置分页 Request VO")
@Data
public class ConfigReportFieldReqVO {
@Schema(description = "报表类型ID", example = "27695")
private Long configReportTypeId;
@Schema(description = "绑定字段")
private String field;
@Schema(description = "标题名称", example = "王五")
private String fieldName;
@Schema(description = "字段类型,固定字段-field_fixed、动态字段-field_dynamic、计算字段-field_calculated", example = "1")
private String fieldType;
@Schema(description = "列宽")
private Integer fieldWidth;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间", example = "1")
private String dataType;
@Schema(description = "小数位")
private Integer decimalPosition;
@Schema(description = "是否分组")
private Integer isGroup;
@Schema(description = "表头分组")
private String titleGroup;
@Schema(description = "是否可修改")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Integer[] isUpdate;
@Schema(description = "计算公式")
private String formula;
@Schema(description = "排序号")
private Integer no;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "备注,1-是0-否")
private String remark;
@Schema(description = "版本")
private Integer version;
}

View File

@@ -12,11 +12,11 @@ import com.alibaba.excel.annotation.*;
@ExcelIgnoreUnannotated
public class ConfigReportFieldRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20910")
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4375")
@ExcelProperty("ID")
private Long id;
@Schema(description = "报表类型ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24954")
@Schema(description = "报表类型ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27695")
@ExcelProperty("报表类型ID")
private Long configReportTypeId;
@@ -24,43 +24,47 @@ public class ConfigReportFieldRespVO {
@ExcelProperty("绑定字段")
private String field;
@Schema(description = "标题名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@Schema(description = "标题名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("标题名称")
private String fieldName;
@Schema(description = "排序号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("排序号")
private Integer no;
@Schema(description = "字段类型,固定字段-field_fixed、动态字段-field_dynamic、计算字段-field_calculated", example = "1")
@ExcelProperty("字段类型,固定字段-field_fixed、动态字段-field_dynamic、计算字段-field_calculated")
private String fieldType;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@Schema(description = "列宽")
@ExcelProperty("列宽")
private Integer fieldWidth;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间")
private Integer dataType;
private String dataType;
@Schema(description = "小数位")
@ExcelProperty("小数位")
private Integer decimalPosition;
@Schema(description = "列宽", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("列宽")
private Integer fieldWidth;
@Schema(description = "是否分组", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "是否分组")
@ExcelProperty("是否分组")
private Integer isGroup;
@Schema(description = "是否可修改", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否可修改")
private Integer isUpdate;
@Schema(description = "计算公式", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("计算公式")
private String formula;
@Schema(description = "表头分组", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "表头分组")
@ExcelProperty("表头分组")
private String titleGroup;
@Schema(description = "所属部门", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "是否可修改")
@ExcelProperty("是否可修改")
private Integer isUpdate;
@Schema(description = "计算公式")
@ExcelProperty("计算公式")
private String formula;
@Schema(description = "排序号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("排序号")
private Integer no;
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String systemDepartmentCode;

View File

@@ -9,10 +9,10 @@ import jakarta.validation.constraints.*;
@Data
public class ConfigReportFieldSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20910")
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4375")
private Long id;
@Schema(description = "报表类型ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24954")
@Schema(description = "报表类型ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27695")
@NotNull(message = "报表类型ID不能为空")
private Long configReportTypeId;
@@ -20,42 +20,40 @@ public class ConfigReportFieldSaveReqVO {
@NotEmpty(message = "绑定字段不能为空")
private String field;
@Schema(description = "标题名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@Schema(description = "标题名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "标题名称不能为空")
private String fieldName;
@Schema(description = "字段类型,固定字段-field_fixed、动态字段-field_dynamic、计算字段-field_calculated", example = "1")
private String fieldType;
@Schema(description = "列宽")
private Integer fieldWidth;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间不能为空")
private String dataType;
@Schema(description = "小数位")
private Integer decimalPosition;
@Schema(description = "是否分组")
private Integer isGroup;
@Schema(description = "表头分组")
private String titleGroup;
@Schema(description = "是否可修改")
private Integer isUpdate;
@Schema(description = "计算公式")
private String formula;
@Schema(description = "排序号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "排序号不能为空")
private Integer no;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间不能为空")
private Integer dataType;
@Schema(description = "小数位")
private Integer decimalPosition;
@Schema(description = "列宽", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "列宽不能为空")
private Integer fieldWidth;
@Schema(description = "是否分组", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否分组不能为空")
private Integer isGroup;
@Schema(description = "是否可修改", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否可修改不能为空")
private Integer isUpdate;
@Schema(description = "计算公式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "计算公式不能为空")
private String formula;
@Schema(description = "表头分组", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "表头分组不能为空")
private String titleGroup;
@Schema(description = "所属部门", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注,1-是0-否")

View File

@@ -26,7 +26,7 @@ public class ConfigRulePageReqVO extends PageParam {
private String type;
@Schema(description = "表达式")
private String eXPRESSION;
private String expression;
@Schema(description = "版本")
private Integer version;

View File

@@ -34,7 +34,7 @@ public class ConfigRuleRespVO {
@Schema(description = "表达式", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("表达式")
private String eXPRESSION;
private String expression;
@Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("版本")

View File

@@ -12,14 +12,15 @@ public class ConfigRuleSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21005")
private Long id;
@Schema(description = "编码")
@Schema(description = "编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "编码不能为空")
private String code;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "名称不能为空")
private String name;
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "描述")
@NotEmpty(message = "描述不能为空")
private String description;
@@ -28,10 +29,9 @@ public class ConfigRuleSaveReqVO {
@Schema(description = "表达式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "表达式不能为空")
private String eXPRESSION;
private String expression;
@Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "版本不能为空")
@Schema(description = "版本")
private Integer version;
@Schema(description = "是否最新版本,1-是0-否")

View File

@@ -0,0 +1,17 @@
package com.zt.plat.module.qms.business.config.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ConfigSampleReportExtendRespVO extends ConfigSampleReportRespVO {
@Schema(description = "报表类型ID", example = "15805")
private Long configReportTypeId;
@Schema(description = "报表类型Key", example = "15805")
private String configReportTypeKey;
@Schema(description = "报表类型Name", example = "15805")
private String configReportTypeName;
}

View File

@@ -0,0 +1,39 @@
package com.zt.plat.module.qms.business.config.controller.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 样品报表关系分页 Request VO")
@Data
public class ConfigSampleReportReqVO {
@Schema(description = "报表类型", example = "30219")
private Long configReportTypeId;
@Schema(description = "主样配置ID", example = "29156")
private Long configBaseSampleId;
@Schema(description = "样品名称", example = "张三")
private String sampleName;
@Schema(description = "数据来源")
private String dataSource;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "备注")
private String remark;
@Schema(description = "版本")
private Integer version;
}

View File

@@ -76,7 +76,7 @@ public class ConfigAssayMethodProjectCoefficientDO extends BusinessBaseDO {
* 所属部门
*/
@TableField("SYS_DEPT_CD")
private String systemDepartmentCustomsDeclaration;
private String systemDepartmentCode;
/**
* 备注
*/

View File

@@ -47,31 +47,36 @@ public class ConfigReportFieldDO extends BusinessBaseDO {
@TableField("FLD_NAME")
private String fieldName;
/**
* 排序号
* 字段类型,固定字段-field_fixed、动态字段-field_dynamic、计算字段-field_calculated
*/
@TableField("NO")
private Integer no;
/**
* 数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间
*/
@TableField("DAT_TP")
private Integer dataType;
/**
* 小数位
*/
@TableField("DEC_POS")
private Integer decimalPosition;
@TableField("FLD_TP")
private String fieldType;
/**
* 列宽
*/
@TableField("FLD_WDTH")
private Integer fieldWidth;
/**
* 数据类型,【字典】【jy_sample_data_type】字符串整数小数,日期,时间
*/
@TableField("DAT_TP")
private String dataType;
/**
* 小数位
*/
@TableField("DEC_POS")
private Integer decimalPosition;
/**
* 是否分组
*/
@TableField("IS_GRP")
private Integer isGroup;
/**
* 表头分组
*/
@TableField("TTL_GRP")
private String titleGroup;
/**
* 是否可修改
*/
@TableField("IS_UPD")
@@ -82,10 +87,10 @@ public class ConfigReportFieldDO extends BusinessBaseDO {
@TableField("FMU")
private String formula;
/**
* 表头分组
* 排序号
*/
@TableField("TTL_GRP")
private String titleGroup;
@TableField("NO")
private Integer no;
/**
* 所属部门
*/

View File

@@ -55,7 +55,7 @@ public class ConfigRuleDO extends BusinessBaseDO {
* 表达式
*/
@TableField("EPSSN")
private String eXPRESSION;
private String expression;
/**
* 版本
*/

View File

@@ -27,7 +27,7 @@ public interface ConfigAssayMethodProjectCoefficientMapper extends BaseMapperX<C
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getMinimumValue, reqVO.getMinimumValue())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getMaximumValue, reqVO.getMaximumValue())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getCoefficient, reqVO.getCoefficient())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getSystemDepartmentCustomsDeclaration, reqVO.getSystemDepartmentCustomsDeclaration())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(ConfigAssayMethodProjectCoefficientDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getRemark, reqVO.getRemark())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getVersion, reqVO.getVersion())

View File

@@ -1,11 +1,18 @@
package com.zt.plat.module.qms.business.config.dal.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO;
import com.zt.plat.module.qms.business.config.controller.vo.*;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigAssayMethodProjectPageReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO;
import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -36,4 +43,14 @@ public interface ConfigAssayMethodProjectMapper extends BaseMapperX<ConfigAssayM
.orderByDesc(ConfigAssayMethodProjectDO::getId));
}
default List<ConfigAssayMethodProjectExtendRespVO> selectByConfigAssayMethodId(Long configAssayMethodId) {
return selectJoinList(ConfigAssayMethodProjectExtendRespVO.class, new MPJLambdaWrapperX<ConfigAssayMethodProjectDO>()
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, ConfigAssayMethodProjectDO::getDictionaryProjectId)
.selectAll(ConfigAssayMethodProjectDO.class)
.selectAs(DictionaryProjectDO::getKey, ConfigAssayMethodProjectExtendRespVO::getDictionaryProjectKey)
.selectAs(DictionaryProjectDO::getSimpleName, ConfigAssayMethodProjectExtendRespVO::getSimpleName)
.selectAs(DictionaryProjectDO::getShowName, ConfigAssayMethodProjectExtendRespVO::getShowName)
.eq(ConfigAssayMethodProjectDO::getConfigAssayMethodId, configAssayMethodId));
}
}

View File

@@ -2,9 +2,15 @@ package com.zt.plat.module.qms.business.config.dal.mapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigProjectPageReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigProjectDO;
import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.qms.business.config.controller.vo.*;
@@ -27,4 +33,21 @@ public interface ConfigProjectMapper extends BaseMapperX<ConfigProjectDO> {
.orderByDesc(ConfigProjectDO::getId));
}
/**
* 根据检测方法查询检测项目
* @param configAssayMethodId
* @return
*/
default List<ConfigProjectExtendRespVO> selectByConfigAssayMethodId(Long configAssayMethodId) {
return selectJoinList(ConfigProjectExtendRespVO.class, new MPJLambdaWrapperX<ConfigProjectDO>()
.leftJoin(ConfigAssayMethodProjectDO.class, on -> on.eq(ConfigAssayMethodProjectDO::getConfigAssayMethodId, ConfigProjectDO::getConfigAssayMethodId).eq(ConfigAssayMethodProjectDO::getDictionaryProjectId, ConfigProjectDO::getDictionaryProjectId))
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, ConfigProjectDO::getDictionaryProjectId)
.selectAll(ConfigProjectDO.class)
.selectAs(ConfigAssayMethodProjectDO::getId, ConfigProjectExtendRespVO::getConfigAssayMethodProjectId)
.selectAs(ConfigAssayMethodProjectDO::getDictionaryProjectUnit, ConfigProjectExtendRespVO::getDictionaryProjectUnit)
.selectAs(DictionaryProjectDO::getKey, ConfigProjectExtendRespVO::getDictionaryProjectKey)
.selectAs(DictionaryProjectDO::getSimpleName, ConfigProjectExtendRespVO::getDictionaryProjectSimpleName)
.selectAs(DictionaryProjectDO::getShowName, ConfigProjectExtendRespVO::getDictionaryProjectShowName)
.eq(ConfigProjectDO::getConfigAssayMethodId, configAssayMethodId));
}
}

View File

@@ -26,14 +26,15 @@ public interface ConfigReportFieldMapper extends BaseMapperX<ConfigReportFieldDO
.eqIfPresent(ConfigReportFieldDO::getConfigReportTypeId, reqVO.getConfigReportTypeId())
.eqIfPresent(ConfigReportFieldDO::getField, reqVO.getField())
.likeIfPresent(ConfigReportFieldDO::getFieldName, reqVO.getFieldName())
.eqIfPresent(ConfigReportFieldDO::getNo, reqVO.getNo())
.eqIfPresent(ConfigReportFieldDO::getFieldType, reqVO.getFieldType())
.eqIfPresent(ConfigReportFieldDO::getFieldWidth, reqVO.getFieldWidth())
.eqIfPresent(ConfigReportFieldDO::getDataType, reqVO.getDataType())
.eqIfPresent(ConfigReportFieldDO::getDecimalPosition, reqVO.getDecimalPosition())
.eqIfPresent(ConfigReportFieldDO::getFieldWidth, reqVO.getFieldWidth())
.eqIfPresent(ConfigReportFieldDO::getIsGroup, reqVO.getIsGroup())
.eqIfPresent(ConfigReportFieldDO::getTitleGroup, reqVO.getTitleGroup())
.betweenIfPresent(ConfigReportFieldDO::getIsUpdate, reqVO.getIsUpdate())
.eqIfPresent(ConfigReportFieldDO::getFormula, reqVO.getFormula())
.eqIfPresent(ConfigReportFieldDO::getTitleGroup, reqVO.getTitleGroup())
.eqIfPresent(ConfigReportFieldDO::getNo, reqVO.getNo())
.eqIfPresent(ConfigReportFieldDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(ConfigReportFieldDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ConfigReportFieldDO::getRemark, reqVO.getRemark())
@@ -46,14 +47,15 @@ public interface ConfigReportFieldMapper extends BaseMapperX<ConfigReportFieldDO
.eqIfPresent(ConfigReportFieldDO::getConfigReportTypeId, reqVO.getConfigReportTypeId())
.eqIfPresent(ConfigReportFieldDO::getField, reqVO.getField())
.likeIfPresent(ConfigReportFieldDO::getFieldName, reqVO.getFieldName())
.eqIfPresent(ConfigReportFieldDO::getNo, reqVO.getNo())
.eqIfPresent(ConfigReportFieldDO::getFieldType, reqVO.getFieldType())
.eqIfPresent(ConfigReportFieldDO::getFieldWidth, reqVO.getFieldWidth())
.eqIfPresent(ConfigReportFieldDO::getDataType, reqVO.getDataType())
.eqIfPresent(ConfigReportFieldDO::getDecimalPosition, reqVO.getDecimalPosition())
.eqIfPresent(ConfigReportFieldDO::getFieldWidth, reqVO.getFieldWidth())
.eqIfPresent(ConfigReportFieldDO::getIsGroup, reqVO.getIsGroup())
.eqIfPresent(ConfigReportFieldDO::getTitleGroup, reqVO.getTitleGroup())
.betweenIfPresent(ConfigReportFieldDO::getIsUpdate, reqVO.getIsUpdate())
.eqIfPresent(ConfigReportFieldDO::getFormula, reqVO.getFormula())
.eqIfPresent(ConfigReportFieldDO::getTitleGroup, reqVO.getTitleGroup())
.eqIfPresent(ConfigReportFieldDO::getNo, reqVO.getNo())
.eqIfPresent(ConfigReportFieldDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(ConfigReportFieldDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ConfigReportFieldDO::getRemark, reqVO.getRemark())
@@ -61,9 +63,10 @@ public interface ConfigReportFieldMapper extends BaseMapperX<ConfigReportFieldDO
.orderByAsc(ConfigReportFieldDO::getNo));
}
default List<ConfigReportFieldDO> selectByConfigReportTypeIds(List<Long> configReportTypeIds) {
default List<ConfigReportFieldDO> selectByConfigReportTypeIds(List<Long> configReportTypeIds, List<String> fieldTypes) {
return selectList(new LambdaQueryWrapperX<ConfigReportFieldDO>()
.in(ConfigReportFieldDO::getConfigReportTypeId, configReportTypeIds)
.inIfPresent(ConfigReportFieldDO::getConfigReportTypeId, configReportTypeIds)
.inIfPresent(ConfigReportFieldDO::getFieldType, fieldTypes)
.orderByAsc(ConfigReportFieldDO::getNo));
}

View File

@@ -23,7 +23,7 @@ public interface ConfigRuleMapper extends BaseMapperX<ConfigRuleDO> {
.likeIfPresent(ConfigRuleDO::getName, reqVO.getName())
.eqIfPresent(ConfigRuleDO::getDescription, reqVO.getDescription())
.eqIfPresent(ConfigRuleDO::getType, reqVO.getType())
.eqIfPresent(ConfigRuleDO::getEXPRESSION, reqVO.getEXPRESSION())
.eqIfPresent(ConfigRuleDO::getExpression, reqVO.getExpression())
.eqIfPresent(ConfigRuleDO::getVersion, reqVO.getVersion())
.eqIfPresent(ConfigRuleDO::getIsLast, reqVO.getIsLast())
.eqIfPresent(ConfigRuleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())

View File

@@ -2,9 +2,14 @@ package com.zt.plat.module.qms.business.config.dal.mapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSampleReportPageReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigReportTypeDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSampleReportDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.qms.business.config.controller.vo.*;
@@ -29,4 +34,21 @@ public interface ConfigSampleReportMapper extends BaseMapperX<ConfigSampleReport
.orderByDesc(ConfigSampleReportDO::getId));
}
default List<ConfigSampleReportExtendRespVO> selectList(ConfigSampleReportReqVO reqVO) {
return selectJoinList(ConfigSampleReportExtendRespVO.class, new MPJLambdaWrapperX<ConfigSampleReportDO>()
.leftJoin(ConfigReportTypeDO.class, ConfigReportTypeDO::getId, ConfigSampleReportDO::getConfigReportTypeId)
.selectAll(ConfigSampleReportDO.class)
.selectAs(ConfigReportTypeDO::getId, ConfigSampleReportExtendRespVO::getConfigReportTypeId)
.selectAs(ConfigReportTypeDO::getKey, ConfigSampleReportExtendRespVO::getConfigReportTypeKey)
.selectAs(ConfigReportTypeDO::getName, ConfigSampleReportExtendRespVO::getConfigReportTypeName)
.eqIfPresent(ConfigSampleReportDO::getConfigReportTypeId, reqVO.getConfigReportTypeId())
.eqIfPresent(ConfigSampleReportDO::getConfigBaseSampleId, reqVO.getConfigBaseSampleId())
.likeIfPresent(ConfigSampleReportDO::getSampleName, reqVO.getSampleName())
.eqIfPresent(ConfigSampleReportDO::getDataSource, reqVO.getDataSource())
.eqIfPresent(ConfigSampleReportDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(ConfigSampleReportDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ConfigSampleReportDO::getRemark, reqVO.getRemark())
.eqIfPresent(ConfigSampleReportDO::getVersion, reqVO.getVersion())
.orderByDesc(ConfigSampleReportDO::getId));
}
}