质控图

This commit is contained in:
tangw 2026-01-27 18:01:21 +08:00
parent b72bc57fc0
commit b124e1d4d3
7 changed files with 150 additions and 31 deletions

View File

@ -1,19 +1,32 @@
package com.czlis.liswork.controller.qc; package com.czlis.liswork.controller.qc;
import com.czlis.common.core.controller.BaseController; import com.czlis.common.core.controller.BaseController;
import com.czlis.liswork.service.QcBatchnoService; import com.czlis.common.core.domain.Result;
import com.czlis.liswork.pojo.DTO.QcGraphParamDTO;
import com.czlis.liswork.service.QcGraphService; import com.czlis.liswork.service.QcGraphService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/qc") @RequestMapping("/qcgraph")
@Slf4j @Slf4j
@Api(tags = "质控批号设置") @Api(tags = "质控批号设置")
public class QcGraphController extends BaseController { public class QcGraphController extends BaseController {
@Autowired @Autowired
private QcGraphService qcGraphService; private QcGraphService qcGraphService;
@ApiOperation("查询质控参数列表")
@GetMapping("/querysample")
public Result querysample(QcGraphParamDTO qcGraphParamDTO) {
return qcGraphService.querysample(qcGraphParamDTO);
}
@ApiOperation("查询质控数据")
@GetMapping("/query")
public Result query(QcGraphParamDTO qcGraphParamDTO) {
return qcGraphService.query(qcGraphParamDTO);
}
} }

View File

@ -12,7 +12,10 @@ import java.util.List;
public interface QcGraphMapper { public interface QcGraphMapper {
List<QcSample> querysample(QcGraphParamDTO qcGraphParamDTO); List<QcSample> querysample(QcGraphParamDTO qcGraphParamDTO);
List<QcMonthstDTO> queryhead(QcGraphParamDTO qcGraphParamDTO); List<QcMonthstDTO> queryhead(QcGraphParamDTO qcGraphParamDTO);
List<QcMonthstDTO> queryhead1(QcGraphParamDTO qcGraphParamDTO); List<QcMonthstDTO> queryhead3(QcGraphParamDTO qcGraphParamDTO);
List<QcValDTO> query(QcGraphParamDTO qcGraphParamDTO); List<QcValDTO> query(QcGraphParamDTO qcGraphParamDTO);
List<QcValDTO> query8(QcGraphParamDTO qcGraphParamDTO);
List<QcValDTO> query9(QcGraphParamDTO qcGraphParamDTO);
List<QcValDTO> query0(QcGraphParamDTO qcGraphParamDTO);
} }

View File

@ -1,4 +1,10 @@
package com.czlis.liswork.service; package com.czlis.liswork.service;
import com.czlis.common.core.domain.Result;
import com.czlis.liswork.pojo.DTO.QcGraphParamDTO;
public interface QcGraphService { public interface QcGraphService {
Result querysample(QcGraphParamDTO qcGraphParamDTO);
Result query(QcGraphParamDTO qcGraphParamDTO);
Result queryhead(QcGraphParamDTO qcGraphParamDTO);
} }

View File

@ -2,21 +2,32 @@ package com.czlis.liswork.service.impl.qc;
import com.czlis.common.core.domain.Result; import com.czlis.common.core.domain.Result;
import com.czlis.common.core.domain.entity.lis.QcSample; import com.czlis.common.core.domain.entity.lis.QcSample;
import com.czlis.common.core.domain.entity.lis.QcVal; import com.czlis.liswork.mapper.QcGraphMapper;
import com.czlis.common.utils.SecurityUtils; import com.czlis.liswork.pojo.DTO.QcGraphParamDTO;
import com.czlis.liswork.mapper.QcSampleMapper;
import com.czlis.liswork.mapper.QcStatMapper;
import com.czlis.liswork.pojo.DTO.QcMonthstDTO; import com.czlis.liswork.pojo.DTO.QcMonthstDTO;
import com.czlis.liswork.pojo.DTO.QcValDTO;
import com.czlis.liswork.service.QcGraphService; import com.czlis.liswork.service.QcGraphService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional;
@Service @Service
public class QcGraphServiceImpl implements QcGraphService { public class QcGraphServiceImpl implements QcGraphService {
@Autowired
private QcGraphMapper qcGraphMapper;
@Override
public Result querysample(QcGraphParamDTO qcGraphParamDTO){
List<QcSample> QcSamplelist=qcGraphMapper.querysample(qcGraphParamDTO);
return new Result("0","成功",QcSamplelist);
}
@Override
public Result query(QcGraphParamDTO qcGraphParamDTO){
List<QcValDTO> QcValDTOList=qcGraphMapper.query(qcGraphParamDTO);
return new Result("0","成功",QcValDTOList);
}
@Override
public Result queryhead(QcGraphParamDTO qcGraphParamDTO){
List<QcMonthstDTO> QcSamplelist=qcGraphMapper.queryhead(qcGraphParamDTO);
return new Result("0","成功",QcSamplelist);
}
} }

View File

@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.DecimalFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -45,6 +46,21 @@ public class QcStatServiceImpl implements QcStatService {
qcMonthstDTO.setSd3(monthsttemp.get().getSd3()); qcMonthstDTO.setSd3(monthsttemp.get().getSd3());
qcMonthstDTO.setCnt3(monthsttemp.get().getCnt3()); qcMonthstDTO.setCnt3(monthsttemp.get().getCnt3());
} }
Integer badcnt=qcMonthstDTO.getBadcnt();
Integer process=qcMonthstDTO.getProcess();
Integer cnt=qcMonthstDTO.getCnt();
if(cnt>0&&cnt!=null) {
if (badcnt > 0 && badcnt != null) {
double percentValue = (double) badcnt / cnt;
DecimalFormat df = new DecimalFormat("#.#%");
qcMonthstDTO.setSkl(df.format(percentValue));
if (process > 0 && process != null) {
double process0 = (double) process / badcnt;
DecimalFormat df0 = new DecimalFormat("#.#%");
qcMonthstDTO.setCll(df0.format(process0));
}
}
}
} }
return new Result("0","成功",monthst); return new Result("0","成功",monthst);
} }

View File

@ -36,6 +36,67 @@
</where> </where>
order by qc_val.zkrq,qc_val.cs order by qc_val.zkrq,qc_val.cs
</select> </select>
<select id="query8" resultType="com.czlis.liswork.pojo.DTO.QcValDTO">
SELECT qc_val.yq,qc_val.xmdh,xm_info.xmmc,xm_info.dyxh,qc_val.zkph,
qc_val.cs,qc_val.zkrq,qc_val.zkjg,isnull((select yhxm from com_usr where com_usr.yhdh=qc_val.yhdh),qc_val.yhdh) as yhdh,
qc_sample.zkbz,qc_sample.sd,qc_sample.cv
FROM qc_val join xm_info on xm_info.yq=qc_val.yq and xm_info.xmdh=qc_val.xmdh
join qc_sample on qc_sample.yq=qc_val.yq and qc_sample.xmdh=qc_val.xmdh and qc_sample.zkph=qc_val.zkph
and qc_sample.ksrq=(select max(ksrq) from qc_sample x
where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_val.zkrq>=x.ksrq)
<where>
<if test="yq != null and yq !=''">and qc_val.yq = #{yq}</if>
<if test="xmdh != null and xmdh !=''">and qc_val.xmdh = #{xmdh}</if>
<if test="zkph != null and zkph !=''">and qc_val.zkph = #{zkph}</if>
<if test="zkpph != null and zkpph !=''">and qc_sample.zkpph = #{zkpph}</if>
<if test="zkrq1 != null">and qc_val.ksrq>= #{zkrq1} </if>
<if test="zkrq2 != null">and #{zkrq2}>= qc_val.ksrq </if>
<if test="cs != null and cs !=10">and qc_val.cs =(select max(cs) from qc_val a where a.yq=qc_val.yq and a.xmdh=qc_val.xmdh and a.zkph=qc_val.zkph and a.zkrq=qc_val.zkrq) </if>
</where>
order by qc_val.zkrq,qc_val.cs
</select>
<select id="query9" resultType="com.czlis.liswork.pojo.DTO.QcValDTO">
SELECT qc_val.yq,qc_val.xmdh,xm_info.xmmc,xm_info.dyxh,qc_val.zkph,
qc_val.cs,qc_val.zkrq,qc_val.zkjg,isnull((select yhxm from com_usr where com_usr.yhdh=qc_val.yhdh),qc_val.yhdh) as yhdh,
qc_sample.zkbz,qc_sample.sd,qc_sample.cv
FROM qc_val join xm_info on xm_info.yq=qc_val.yq and xm_info.xmdh=qc_val.xmdh
join qc_sample on qc_sample.yq=qc_val.yq and qc_sample.xmdh=qc_val.xmdh and qc_sample.zkph=qc_val.zkph
and qc_sample.ksrq=(select max(ksrq) from qc_sample x
where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_val.zkrq>=x.ksrq)
<where>
<if test="yq != null and yq !=''">and qc_val.yq = #{yq}</if>
<if test="xmdh != null and xmdh !=''">and qc_val.xmdh = #{xmdh}</if>
<if test="zkph != null and zkph !=''">and qc_val.zkph = #{zkph}</if>
<if test="zkpph != null and zkpph !=''">and qc_sample.zkpph = #{zkpph}</if>
<if test="zkrq1 != null">and qc_val.ksrq>= #{zkrq1} </if>
<if test="zkrq2 != null">and #{zkrq2}>= qc_val.ksrq </if>
<if test="cs != null and cs !=10">and abs(qc_sample.zkbz - qc_val.zkjg)=(select min(abs(qc_sample.zkbz - a.zkjg)) from qc_val a where a.yq=qc_val.yq and a.xmdh=qc_val.xmdh and a.zkph=qc_val.zkph and a.zkrq=qc_val.zkrq) </if>
</where>
order by qc_val.zkrq,qc_val.cs
</select>
<select id="query0" resultType="com.czlis.liswork.pojo.DTO.QcValDTO">
SELECT qc_val.yq,qc_val.xmdh,xm_info.xmmc,xm_info.dyxh,qc_val.zkph,
0 as cs,qc_val.zkrq,a.zkjg,isnull((select yhxm from com_usr where com_usr.yhdh=qc_val.yhdh),qc_val.yhdh) as yhdh,
qc_sample.zkbz,qc_sample.sd,qc_sample.cv
FROM qc_val join xm_info on xm_info.yq=qc_val.yq and xm_info.xmdh=qc_val.xmdh
join (select qc_val.yq,qc_val.zkph,qc_val.xmdh,qc_val.zkrq,avg(zkjg)as zkjg from qc_val
group by qc_val.yq,qc_val.zkph,qc_val.xmdh,qc_val.zkrq) a
on a.yq=qc_val.yq and a.xmdh=qc_val.xmdh and a.zkph=qc_val.zkph and a.zkrq=qc_val.zkrq
join qc_sample on qc_sample.yq=qc_val.yq and qc_sample.xmdh=qc_val.xmdh and qc_sample.zkph=qc_val.zkph
and qc_sample.ksrq=(select max(ksrq) from qc_sample x
where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_val.zkrq>=x.ksrq)
<where>
<if test="yq != null and yq !=''">and qc_val.yq = #{yq}</if>
<if test="xmdh != null and xmdh !=''">and qc_val.xmdh = #{xmdh}</if>
<if test="zkph != null and zkph !=''">and qc_val.zkph = #{zkph}</if>
<if test="zkpph != null and zkpph !=''">and qc_sample.zkpph = #{zkpph}</if>
<if test="zkrq1 != null">and qc_val.ksrq>= #{zkrq1} </if>
<if test="zkrq2 != null">and #{zkrq2}>= qc_val.ksrq </if>
<if test="cs != null and cs !=10">and qc_val.cs =1</if>
</where>
order by qc_val.zkrq,qc_val.cs
</select>
<select id="queryhead" resultType="com.czlis.liswork.pojo.DTO.QcMonthstDTO"> <select id="queryhead" resultType="com.czlis.liswork.pojo.DTO.QcMonthstDTO">
SELECT qc_val.yq,qc_val.xmdh,xm_info.xmmc,xm_info.dyxh,qc_val.zkph,count(1) cnt, SELECT qc_val.yq,qc_val.xmdh,xm_info.xmmc,xm_info.dyxh,qc_val.zkph,count(1) cnt,
sum((case when qc_val.zkjg>(zkbz + 3*sd) then 1 when (zkbz - 3*sd)>qc_val.zkjg then 1 when isnull(outreason,'')!='' then 1 else 0 end) ) as badcnt, sum((case when qc_val.zkjg>(zkbz + 3*sd) then 1 when (zkbz - 3*sd)>qc_val.zkjg then 1 when isnull(outreason,'')!='' then 1 else 0 end) ) as badcnt,
@ -52,6 +113,7 @@
FROM qc_val join xm_info on xm_info.yq=qc_val.yq and xm_info.xmdh=qc_val.xmdh FROM qc_val join xm_info on xm_info.yq=qc_val.yq and xm_info.xmdh=qc_val.xmdh
join qc_sample on qc_sample.yq=qc_val.yq and qc_sample.xmdh=qc_val.xmdh and qc_sample.zkph=qc_val.zkph join qc_sample on qc_sample.yq=qc_val.yq and qc_sample.xmdh=qc_val.xmdh and qc_sample.zkph=qc_val.zkph
and qc_sample.ksrq=(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_val.zkrq>=x.ksrq) and qc_sample.ksrq=(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_val.zkrq>=x.ksrq)
<where>
<if test="yq != null and yq !=''">and qc_val.yq = #{yq}</if> <if test="yq != null and yq !=''">and qc_val.yq = #{yq}</if>
<if test="xmdh != null and xmdh !=''">and qc_val.xmdh = #{xmdh}</if> <if test="xmdh != null and xmdh !=''">and qc_val.xmdh = #{xmdh}</if>
<if test="zkph != null and zkph !=''">and qc_val.zkph = #{zkph}</if> <if test="zkph != null and zkph !=''">and qc_val.zkph = #{zkph}</if>
@ -59,26 +121,26 @@
<if test="zkrq1 != null">and qc_val.ksrq>= #{zkrq1} </if> <if test="zkrq1 != null">and qc_val.ksrq>= #{zkrq1} </if>
<if test="zkrq2 != null">and #{zkrq2}>= qc_val.ksrq </if> <if test="zkrq2 != null">and #{zkrq2}>= qc_val.ksrq </if>
<if test="cs != null and cs !=10">and qc_val.cs = #{cs}</if> <if test="cs != null and cs !=10">and qc_val.cs = #{cs}</if>
</where>
group by qc_val.yq,qc_val.zkph,qc_val.xmdh,xm_info.xmmc,xm_info.dyxh,qc_sample.zkbz,qc_sample.sd,qc_sample.cv group by qc_val.yq,qc_val.zkph,qc_val.xmdh,xm_info.xmmc,xm_info.dyxh,qc_sample.zkbz,qc_sample.sd,qc_sample.cv
order by xm_info.dyxh order by xm_info.dyxh,qc_val.zkph
</select> </select>
<select id="queryMonthst2" resultType="com.czlis.liswork.pojo.DTO.QcMonthstDTO">
SELECT qc_val.yq,qc_val.xmdh,qc_val.zkph,count(1) cnt,cast(avg(zkjg) as decimal(12, 3)) avg2, <select id="queryhead3" resultType="com.czlis.liswork.pojo.DTO.QcMonthstDTO">
cast(STDEV(zkjg) as decimal(12, 3)) sd2,cast(100*STDEV(zkjg)/avg(zkjg) as decimal(12, 3)) as cv2
FROM qc_val join xm_info on xm_info.yq=qc_val.yq and xm_info.xmdh=qc_val.xmdh
join qc_sample on qc_sample.yq=qc_val.yq and qc_sample.xmdh=qc_val.xmdh and qc_sample.zkph=qc_val.zkph
and qc_sample.ksrq=(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_val.zkrq>=x.ksrq)
where convert(char(8),zkrq,120) = convert(char(8),#{zkrq} ,120)
and (zkbz + 3*sd)>qc_val.zkjg and qc_val.zkjg>(zkbz - 3*sd) and isnull(outreason,'')=''
and qc_val.yq=#{yq} and qc_val.zkph=#{zkph}
group by qc_val.yq,qc_val.zkph,qc_val.xmdh
</select>
<select id="queryMonthst3" resultType="com.czlis.liswork.pojo.DTO.QcMonthstDTO">
SELECT qc_val.yq,qc_val.xmdh,qc_val.zkph,count(1) cnt3,cast(avg(zkjg) as decimal(12, 3)) avg3, SELECT qc_val.yq,qc_val.xmdh,qc_val.zkph,count(1) cnt3,cast(avg(zkjg) as decimal(12, 3)) avg3,
cast(STDEV(zkjg) as decimal(12, 3)) sd3,cast(100*STDEV(zkjg)/avg(zkjg) as decimal(12, 3)) as cv3 cast(STDEV(zkjg) as decimal(12, 3)) sd3,cast(100*STDEV(zkjg)/avg(zkjg) as decimal(12, 3)) as cv3
FROM qc_val where zkrq>=(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and convert(datetime,convert(char(8),#{zkrq},120)+'01') >=x.ksrq) FROM qc_val join qc_sample on qc_sample.yq=qc_val.yq and qc_sample.xmdh=qc_val.xmdh and qc_sample.zkph=qc_val.zkph
and isnull((select min(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and x.ksrq>(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and convert(datetime,convert(char(8),#{zkrq},120)+'01')>=x.ksrq ) and convert(datetime,convert(char(8),DATEADD(month,1,#{zkrq}),120)+'01')>=x.ksrq ),convert(datetime,convert(char(8),DATEADD(month,1,#{zkrq}),120)+'01') )>zkrq and qc_sample.ksrq=(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_val.zkrq>=x.ksrq)
and qc_val.yq=#{yq} and qc_val.zkph=#{zkph} join qc_sample s on s.yq=qc_val.yq and s.xmdh=qc_val.xmdh and s.zkph=qc_val.zkph
and s.ksrq=isnull((select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and #{zkrq1}>=x.ksrq),(select min(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and #{zkrq2}>=x.ksrq and x.ksrq>=#{zkrq1}))
<where>
<if test="yq != null and yq !=''">and qc_val.yq = #{yq}</if>
<if test="xmdh != null and xmdh !=''">and qc_val.xmdh = #{xmdh}</if>
<if test="zkph != null and zkph !=''">and qc_val.zkph = #{zkph}</if>
<if test="zkrq1 != null">and qc_val.ksrq>=(select min(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_sample.zkpph=x.zkpph)</if>
<if test="zkrq2 != null">and #{zkrq2}>= qc_val.ksrq </if>
</where>
and qc_sample.zkpph=s.zkpph
group by qc_val.yq,qc_val.zkph,qc_val.xmdh group by qc_val.yq,qc_val.zkph,qc_val.xmdh
</select> </select>
<select id="queryMonthskzj" resultType="String"> <select id="queryMonthskzj" resultType="String">

View File

@ -37,9 +37,17 @@
<select id="queryMonthst3" resultType="com.czlis.liswork.pojo.DTO.QcMonthstDTO"> <select id="queryMonthst3" resultType="com.czlis.liswork.pojo.DTO.QcMonthstDTO">
SELECT qc_val.yq,qc_val.xmdh,qc_val.zkph,count(1) cnt3,cast(avg(zkjg) as decimal(12, 3)) avg3, SELECT qc_val.yq,qc_val.xmdh,qc_val.zkph,count(1) cnt3,cast(avg(zkjg) as decimal(12, 3)) avg3,
cast(STDEV(zkjg) as decimal(12, 3)) sd3,cast(100*STDEV(zkjg)/avg(zkjg) as decimal(12, 3)) as cv3 cast(STDEV(zkjg) as decimal(12, 3)) sd3,cast(100*STDEV(zkjg)/avg(zkjg) as decimal(12, 3)) as cv3
FROM qc_val where zkrq>=(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and convert(datetime,convert(char(8),#{zkrq},120)+'01') >=x.ksrq) FROM qc_val join qc_sample on qc_sample.yq=qc_val.yq and qc_sample.xmdh=qc_val.xmdh and qc_sample.zkph=qc_val.zkph
and isnull((select min(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and x.ksrq>(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and convert(datetime,convert(char(8),#{zkrq},120)+'01')>=x.ksrq ) and convert(datetime,convert(char(8),DATEADD(month,1,#{zkrq}),120)+'01')>=x.ksrq ),convert(datetime,convert(char(8),DATEADD(month,1,#{zkrq}),120)+'01') )>zkrq and qc_sample.ksrq=(select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_val.zkrq>=x.ksrq)
and qc_val.yq=#{yq} and qc_val.zkph=#{zkph} join qc_sample s on s.yq=qc_val.yq and s.xmdh=qc_val.xmdh and s.zkph=qc_val.zkph
and s.ksrq=isnull((select max(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and convert(datetime,convert(char(8),#{zkrq},120)+'01')>=x.ksrq),(select min(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and convert(datetime,convert(char(8),DATEADD(month,1,#{zkrq}),120)+'01')>=x.ksrq and x.ksrq>=convert(datetime,convert(char(8),#{zkrq},120)+'01')))
<where>
<if test="yq != null and yq !=''">and qc_val.yq = #{yq}</if>
<if test="zkph != null and zkph !=''">and qc_val.zkph = #{zkph}</if>
<if test="zkrq != null">and qc_val.ksrq>=(select min(ksrq) from qc_sample x where x.yq=qc_val.yq and x.xmdh=qc_val.xmdh and x.zkph=qc_val.zkph and qc_sample.zkpph=x.zkpph)</if>
<if test="zkrq != null">and convert(datetime,convert(char(8),DATEADD(month,1,#{zkrq}),120)+'01')>= qc_val.ksrq </if>
</where>
and qc_sample.zkpph=s.zkpph
group by qc_val.yq,qc_val.zkph,qc_val.xmdh group by qc_val.yq,qc_val.zkph,qc_val.xmdh
</select> </select>
<select id="queryMonthskzj" resultType="String"> <select id="queryMonthskzj" resultType="String">