diff --git a/liswork/src/main/resources/mapper/QcStatMapper.xml b/liswork/src/main/resources/mapper/QcStatMapper.xml index 5c38d7d..4efdaa7 100644 --- a/liswork/src/main/resources/mapper/QcStatMapper.xml +++ b/liswork/src/main/resources/mapper/QcStatMapper.xml @@ -37,7 +37,7 @@ 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 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) - 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 x.ksrq<=convert(datetime,convert(char(8),#{zkrq},120)+'01')) 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 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_val.yq=#{yq} and qc_val.zkph=#{zkph} group by qc_val.yq,qc_val.zkph,qc_val.xmdh