Commit 497e10d1 by lijingjing

大屏接口月份跨年修改;

parent eddc4c47
...@@ -63,7 +63,8 @@ public class DateKit { ...@@ -63,7 +63,8 @@ public class DateKit {
} }
List<String> monthList = new ArrayList<>(); List<String> monthList = new ArrayList<>();
Period diff = Period.between(start, end); Period diff = Period.between(start, end);
for (int i = 0; i < diff.getMonths(); i++) { int months = diff.getYears() * 12 + diff.getMonths();
for (int i = 0; i < months; i++) {
monthList.add(getYearMonth(start.plusMonths(i))); monthList.add(getYearMonth(start.plusMonths(i)));
} }
return monthList; return monthList;
......
...@@ -123,8 +123,8 @@ public class StatisticsController extends ServiceController { ...@@ -123,8 +123,8 @@ public class StatisticsController extends ServiceController {
@ApiOperation("获取外检完成量数据") @ApiOperation("获取外检完成量数据")
@Login(action = Action.Skip) @Login(action = Action.Skip)
@PostMapping("/out_test_finish_quantity") @PostMapping("/out_test_finish_quantity")
public RestResult<Statistics> getOutTestFinishQuantity(QueryDTO queryDTO) { public RestResult<Statistics> getOutTestItemFinishQuantity(QueryDTO queryDTO) {
return success(statsService.getOutTestFinishQuantity(queryDTO)); return success(statsService.getOutTestItemFinishQuantity(queryDTO));
} }
@ApiOperation("外检项目数量统计") @ApiOperation("外检项目数量统计")
...@@ -141,6 +141,13 @@ public class StatisticsController extends ServiceController { ...@@ -141,6 +141,13 @@ public class StatisticsController extends ServiceController {
return success(statsService.getWorkloadQuantity(queryDTO)); return success(statsService.getWorkloadQuantity(queryDTO));
} }
@ApiOperation("验收工作量统计")
@Login(action = Action.Skip)
@PostMapping("/accept_workload_quantity")
public RestResult<Statistics> getAcceptWorkloadQuantity(RangeStatsQueryDTO queryDTO) {
return success(statsService.getAcceptWorkloadQuantity(queryDTO));
}
@ApiOperation("本周验收合格情况") @ApiOperation("本周验收合格情况")
@Login(action = Action.Skip) @Login(action = Action.Skip)
@PostMapping("/cur_week_acceptance_qualified") @PostMapping("/cur_week_acceptance_qualified")
......
...@@ -21,13 +21,13 @@ public interface StatisticsMapper extends BatchMapper<Statistics> { ...@@ -21,13 +21,13 @@ public interface StatisticsMapper extends BatchMapper<Statistics> {
Integer selectAlBrandLowFeStats(@Param("vo") QueryDTO dto); Integer selectAlBrandLowFeStats(@Param("vo") QueryDTO dto);
@SqlParser(filter = true) @SqlParser(filter = true)
Statistics selectOutTestFinishQuantity(@Param("vo") QueryDTO queryDTO); Statistics selectOutTestItemFinishQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
List<Statistics> selectCurWeekCarbonBlocks(@Param("vo") QueryDTO queryDTO); List<Statistics> selectCurWeekCarbonBlocks(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
List<Statistics> selectAcceptanceQualifiedByDate (@Param("vo") QueryDTO queryDTO); List<Statistics> selectAcceptanceQualifiedByDate(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
Statistics selectAcceptanceQualifiedByTimeFrame(@Param("vo") QueryDTO queryDTO); Statistics selectAcceptanceQualifiedByTimeFrame(@Param("vo") QueryDTO queryDTO);
...@@ -105,8 +105,11 @@ public interface StatisticsMapper extends BatchMapper<Statistics> { ...@@ -105,8 +105,11 @@ public interface StatisticsMapper extends BatchMapper<Statistics> {
List<Map<String, Object>> selectDetectedTasksQuantity(@Param("vo") QueryDTO queryDTO); List<Map<String, Object>> selectDetectedTasksQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
Map<String,Object> selectRawMaterialStageQuantity(@Param("vo") QueryDTO queryDTO); Map<String, Object> selectRawMaterialStageQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true) @SqlParser(filter = true)
Map<String, Object> selectProcessSampleStageQuantity(@Param("vo") QueryDTO queryDTO); Map<String, Object> selectProcessSampleStageQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true)
Statistics selectAcceptWorkloadQuantity(@Param("vo") RangeStatsQueryDTO queryDTO);
} }
...@@ -41,7 +41,7 @@ public interface IStatisticsService extends IBaseService<Statistics> { ...@@ -41,7 +41,7 @@ public interface IStatisticsService extends IBaseService<Statistics> {
Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO); Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO);
Statistics getOutTestFinishQuantity(QueryDTO queryDTO); Statistics getOutTestItemFinishQuantity(QueryDTO queryDTO);
List<Statistics> getOutTestItemQuantity(QueryDTO queryDTO); List<Statistics> getOutTestItemQuantity(QueryDTO queryDTO);
...@@ -80,4 +80,6 @@ public interface IStatisticsService extends IBaseService<Statistics> { ...@@ -80,4 +80,6 @@ public interface IStatisticsService extends IBaseService<Statistics> {
List<Map<String, Object>> getAssayMaterialQuantity(QueryDTO queryDTO); List<Map<String, Object>> getAssayMaterialQuantity(QueryDTO queryDTO);
Map<String, Object> getProcessSampleStageQuantity(QueryDTO queryDTO); Map<String, Object> getProcessSampleStageQuantity(QueryDTO queryDTO);
Statistics getAcceptWorkloadQuantity(RangeStatsQueryDTO queryDTO);
} }
...@@ -51,6 +51,11 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -51,6 +51,11 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
private List<Statistics> handleMonthData(QueryDTO queryDTO, List<Statistics> statistics) { private List<Statistics> handleMonthData(QueryDTO queryDTO, List<Statistics> statistics) {
List<String> months = DateKit.monthStrBetweenTwoDates(DateKit.date2Local(queryDTO.getTimeS()), DateKit.date2Local(queryDTO.getTimeE())); List<String> months = DateKit.monthStrBetweenTwoDates(DateKit.date2Local(queryDTO.getTimeS()), DateKit.date2Local(queryDTO.getTimeE()));
String lastYearMonth = com.patzn.cloud.commons.toolkit.DateUtils.toStrByFormatStr(queryDTO.getTimeE(), "yyyy-MM");
// 处理最后月份
if (CollectionUtils.isNotEmpty(months) && !months.contains(lastYearMonth)) {
months.add(lastYearMonth);
}
List<Statistics> statsList = new ArrayList<>(); List<Statistics> statsList = new ArrayList<>();
if (CollectionUtils.isEmpty(statistics)) { if (CollectionUtils.isEmpty(statistics)) {
statistics = months.stream().map(t -> new Statistics().setOccurDate(t).setDoneNum(0)).collect(Collectors.toList()); statistics = months.stream().map(t -> new Statistics().setOccurDate(t).setDoneNum(0)).collect(Collectors.toList());
...@@ -182,7 +187,7 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -182,7 +187,7 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
@Override @Override
public List<Statistics> getSamplingQuantity(RangeStatsQueryDTO queryDTO) { public List<Statistics> getSamplingQuantity(RangeStatsQueryDTO queryDTO) {
handleQueryTimeRange(queryDTO); handleSamesChainTimeRange(queryDTO);
return baseMapper.selectSamplingQuantity(queryDTO); return baseMapper.selectSamplingQuantity(queryDTO);
} }
...@@ -239,6 +244,11 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -239,6 +244,11 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
} }
@Override @Override
public Statistics getAcceptWorkloadQuantity(RangeStatsQueryDTO queryDTO) {
return baseMapper.selectAcceptWorkloadQuantity(queryDTO);
}
@Override
public Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO) { public Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO) {
handleSamesChainTimeRange(queryDTO); handleSamesChainTimeRange(queryDTO);
return baseMapper.selectItemSamesChainQuantity(queryDTO); return baseMapper.selectItemSamesChainQuantity(queryDTO);
...@@ -246,10 +256,8 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -246,10 +256,8 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
private void handleSamesChainTimeRange(RangeStatsQueryDTO queryDTO) { private void handleSamesChainTimeRange(RangeStatsQueryDTO queryDTO) {
RestAssert.fail(Objects.isNull(queryDTO.getQueryDate()), "查询日期不能为空!"); RestAssert.fail(Objects.isNull(queryDTO.getQueryDate()), "查询日期不能为空!");
String queryDateStr = com.patzn.cloud.commons.toolkit.DateUtils.toYearMonthDay(queryDTO.getQueryDate()); queryDTO.setLastYearTime(DateUtils.addYears(queryDTO.getQueryDate(), -1));
queryDTO.setTimeS(com.patzn.cloud.commons.toolkit.DateUtils.getYearMonthStart(queryDateStr)); queryDTO.setPrevTime(DateUtils.addMonths(queryDTO.getQueryDate(), -1));
queryDTO.setTimeE(com.patzn.cloud.commons.toolkit.DateUtils.getYearMonthEnd(queryDateStr));
handleTimeRange(queryDTO);
} }
/** /**
...@@ -260,15 +268,14 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta ...@@ -260,15 +268,14 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
private void handleTimeRange(RangeStatsQueryDTO queryDTO) { private void handleTimeRange(RangeStatsQueryDTO queryDTO) {
queryDTO.setLastYearTimeS(DateUtils.addYears(queryDTO.getTimeS(), -1)); queryDTO.setLastYearTimeS(DateUtils.addYears(queryDTO.getTimeS(), -1));
queryDTO.setLastYearTimeE(DateUtils.addYears(queryDTO.getTimeE(), -1)); queryDTO.setLastYearTimeE(DateUtils.addYears(queryDTO.getTimeE(), -1));
Integer days = DateKit.daysBetweenTwoDates(queryDTO.getTimeS(), queryDTO.getTimeE()) + 2; queryDTO.setPrevTimeS(DateUtils.addMonths(queryDTO.getTimeS(), -1));
queryDTO.setPrevTimeS(DateUtils.addDays(queryDTO.getTimeS(), -days)); queryDTO.setPrevTimeE(DateUtils.addMonths(queryDTO.getTimeE(), -1));
queryDTO.setPrevTimeE(queryDTO.getTimeS());
} }
@Override @Override
public Statistics getOutTestFinishQuantity(QueryDTO queryDTO) { public Statistics getOutTestItemFinishQuantity(QueryDTO queryDTO) {
handleQueryTime(queryDTO); handleQueryTime(queryDTO);
return baseMapper.selectOutTestFinishQuantity(queryDTO); return baseMapper.selectOutTestItemFinishQuantity(queryDTO);
} }
@Override @Override
......
...@@ -47,12 +47,13 @@ ...@@ -47,12 +47,13 @@
</select> </select>
<!--外委完成量统计(获取外检完成量数据): 获取LIMS平台某段时间的外检数据总数量和已检测数量--> <!--外委完成量统计(获取外检完成量数据): 获取LIMS平台某段时间的外检数据总数量和已检测数量-->
<select id="selectOutTestFinishQuantity" resultType="com.patzn.cloud.service.hmhj.entity.Statistics"> <select id="selectOutTestItemFinishQuantity" resultType="com.patzn.cloud.service.hmhj.entity.Statistics">
SELECT count(distinct c.id) "total", SELECT count(distinct i.id) "total",
sum(case when s.status = 70 and s.judge_status = 2 then 1 else 0 end) "done_num" count(distinct (case when s.status = 70 and s.judge_status = 2 then i.id else null end)) "done_num"
FROM contract_sample c FROM contract_sample c
JOIN entrust_sample s on c.id = s.contract_sample_id JOIN entrust_sample s on c.id = s.contract_sample_id
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0 JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
JOIN entrust_sample_item i on i.entrust_sample_id = s.id and i.deleted = 0
WHERE c.deleted = 0 and c.type = 1 AND s.type = 0 WHERE c.deleted = 0 and c.type = 1 AND s.type = 0
<if test="null != vo.timeS"> <if test="null != vo.timeS">
AND e.entrust_time >= #{vo.timeS} AND e.entrust_time >= #{vo.timeS}
...@@ -208,7 +209,12 @@ ...@@ -208,7 +209,12 @@
AND s.status = 70 AND s.status = 70
AND s.judge_status = 2 AND s.judge_status = 2
AND s.type = 0 AND s.type = 0
AND s.judge_time between #{vo.timeS} and #{vo.timeE} <if test="null != vo.timeS">
AND s.judge_time >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND s.judge_time &lt;= #{vo.timeE}
</if>
) a, ) a,
(SELECT count(r.id) "total" (SELECT count(r.id) "total"
FROM entrust_sample s FROM entrust_sample s
...@@ -218,7 +224,12 @@ ...@@ -218,7 +224,12 @@
AND s.status = 70 AND s.status = 70
AND s.judge_status = 2 AND s.judge_status = 2
AND s.type = 0 AND s.type = 0
AND s.judge_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE} <if test="null != vo.lastYearTimeS">
AND s.judge_time >= #{vo.lastYearTimeS}
</if>
<if test="null != vo.lastYearTimeE">
AND s.judge_time &lt;= #{vo.lastYearTimeE}
</if>
) b, ) b,
(SELECT count(r.id) "total" (SELECT count(r.id) "total"
FROM entrust_sample s FROM entrust_sample s
...@@ -228,25 +239,52 @@ ...@@ -228,25 +239,52 @@
AND s.status = 70 AND s.status = 70
AND s.judge_status = 2 AND s.judge_status = 2
AND s.type = 0 AND s.type = 0
AND s.judge_time between #{vo.prevTimeS} and #{vo.prevTimeE} <if test="null != vo.prevTimeS">
AND s.judge_time >= #{vo.prevTimeS}
</if>
<if test="null != vo.prevTimeE">
AND s.judge_time &lt;= #{vo.prevTimeE}
</if>
) c ) c
</select> </select>
<!--验收工作量统计-->
<select id="selectAcceptWorkloadQuantity" resultType="com.patzn.cloud.service.hmhj.entity.Statistics">
SELECT count(r.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
join entrust_report r on r.entrust_id = e.id and r.deleted = 0
WHERE s.deleted = 0
AND s.status = 70
AND s.judge_status = 2
AND s.type = 0
<if test="null != vo.timeS">
AND s.judge_time >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND s.judge_time &lt;= #{vo.timeE}
</if>
</select>
<!--外委检测数量统计--> <!--外委检测数量统计-->
<select id="selectOutTestItemQuantity" resultType="com.patzn.cloud.service.hmhj.entity.Statistics"> <select id="selectOutTestItemQuantity" resultType="com.patzn.cloud.service.hmhj.entity.Statistics">
SELECT SELECT
to_char(i.ctime,'yyyy-MM') "occur_date", to_char(i.ctime,'yyyy-MM') "occur_date",
count(i.id) "done_num" count(distinct i.id) "total",
count(distinct (case when s.status = 70 and s.judge_status = 2 then i.id else null end)) "done_num"
FROM FROM
entrust_sample_item i entrust_sample_item i
join entrust_sample s on s.id = i.entrust_sample_id join entrust_sample s on s.id = i.entrust_sample_id and s.deleted = 0
join contract_sample c on c.id = s.contract_sample_id join contract_sample c on c.id = s.contract_sample_id and c.deleted = 0
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE WHERE
i.deleted = 0 and s.deleted = 0 and c.deleted = 0 i.deleted = 0 and c.type = 1 AND s.type = 0
and c.type = 1 AND s.type = 0 <if test="null != vo.timeS">
<if test="null != vo.timeS and null != vo.timeE"> AND e.entrust_time >= #{vo.timeS}
AND i.ctime between #{vo.timeS} and #{vo.timeE} </if>
<if test="null != vo.timeE">
AND e.entrust_time &lt;= #{vo.timeE}
</if> </if>
GROUP BY GROUP BY
to_char(i.ctime,'yyyy-MM') to_char(i.ctime,'yyyy-MM')
...@@ -268,21 +306,21 @@ ...@@ -268,21 +306,21 @@
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0 JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 WHERE s.deleted = 0
AND s.type = 0 AND s.type = 0
AND e.entrust_time between #{vo.timeS} and #{vo.timeE} AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM')
) a, ) a,
(SELECT count(s.id) "total" (SELECT count(s.id) "total"
FROM entrust_sample s FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0 join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 WHERE s.deleted = 0
AND s.type = 0 AND s.type = 0
AND e.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE} AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.lastYearTime}::timestamp, 'yyyy-MM')
) b, ) b,
(SELECT count(s.id) "total" (SELECT count(s.id) "total"
FROM entrust_sample s FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0 join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 WHERE s.deleted = 0
AND s.type = 0 AND s.type = 0
AND e.entrust_time between #{vo.prevTimeS} and #{vo.prevTimeE} AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.prevTime}::timestamp, 'yyyy-MM')
) c ) c
</select> </select>
...@@ -328,22 +366,23 @@ ...@@ -328,22 +366,23 @@
from (SELECT count(s.id) "total" from (SELECT count(s.id) "total"
FROM entrust_sample s FROM entrust_sample s
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0 JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 AND s.type = 0 WHERE s.deleted = 0
AND e.entrust_time between #{vo.timeS} and #{vo.timeE} AND s.type = 0
AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM')
) a, ) a,
(SELECT count(s.id) "total" (SELECT count(s.id) "total"
FROM entrust_sample s FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0 join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 WHERE s.deleted = 0
AND s.type = 0 AND s.type = 0
AND e.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE} AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.lastYearTime}::timestamp, 'yyyy-MM')
) b, ) b,
(SELECT count(s.id) "total" (SELECT count(s.id) "total"
FROM entrust_sample s FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0 join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 WHERE s.deleted = 0
AND s.type = 0 AND s.type = 0
AND e.entrust_time between #{vo.prevTimeS} and #{vo.prevTimeE} AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.prevTime}::timestamp, 'yyyy-MM')
) c ) c
</select> </select>
...@@ -362,7 +401,7 @@ ...@@ -362,7 +401,7 @@
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0 JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0 WHERE i.deleted = 0
AND s.type = 0 AND s.type = 0
AND e.entrust_time between #{vo.timeS} and #{vo.timeE} AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM')
) a, ) a,
(SELECT count(i.id) "total" (SELECT count(i.id) "total"
FROM entrust_sample_item i FROM entrust_sample_item i
...@@ -370,7 +409,7 @@ ...@@ -370,7 +409,7 @@
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0 JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0 WHERE i.deleted = 0
AND s.type = 0 AND s.type = 0
AND e.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE} AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.lastYearTime}::timestamp, 'yyyy-MM')
) b, ) b,
(SELECT count(i.id) "total" (SELECT count(i.id) "total"
FROM entrust_sample_item i FROM entrust_sample_item i
...@@ -378,7 +417,7 @@ ...@@ -378,7 +417,7 @@
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0 JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0 WHERE i.deleted = 0
AND s.type = 0 AND s.type = 0
AND e.entrust_time between #{vo.prevTimeS} and #{vo.prevTimeE} AND to_char(e.entrust_time, 'yyyy-MM') = to_char(#{vo.prevTime}::timestamp, 'yyyy-MM')
) c ) c
</select> </select>
...@@ -392,8 +431,11 @@ ...@@ -392,8 +431,11 @@
join entrust_sample s on s.id = i.entrust_sample_id join entrust_sample s on s.id = i.entrust_sample_id
WHERE WHERE
i.deleted = 0 and s.deleted = 0 AND s.type = 0 i.deleted = 0 and s.deleted = 0 AND s.type = 0
<if test="null != vo.timeS and null != vo.timeE"> <if test="null != vo.timeS">
AND i.ctime between #{vo.timeS} and #{vo.timeE} AND i.ctime >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND i.ctime &lt;= #{vo.timeE}
</if> </if>
GROUP BY GROUP BY
to_char(i.ctime,'yyyy-MM') to_char(i.ctime,'yyyy-MM')
...@@ -414,8 +456,11 @@ ...@@ -414,8 +456,11 @@
entrust e entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0 join entrust_report r on r.entrust_id = e.id and r.deleted = 0
where e.deleted = 0 and r.status = 50 where e.deleted = 0 and r.status = 50
<if test="null != vo.timeS and null != vo.timeE"> <if test="null != vo.timeS">
AND (r.report_check_time between #{vo.timeS} and #{vo.timeE}) AND r.report_check_time >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND r.report_check_time &lt;= #{vo.timeE}
</if> </if>
) t ) t
group by group by
...@@ -436,19 +481,19 @@ ...@@ -436,19 +481,19 @@
FROM entrust e FROM entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0 join entrust_report r on r.entrust_id = e.id and r.deleted = 0
WHERE e.deleted = 0 WHERE e.deleted = 0
AND r.report_check_time between #{vo.timeS} and #{vo.timeE} AND to_char(r.report_check_time, 'yyyy-MM') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM')
) a, ) a,
(SELECT count(r.id) "total" (SELECT count(r.id) "total"
FROM entrust e FROM entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0 join entrust_report r on r.entrust_id = e.id and r.deleted = 0
WHERE e.deleted = 0 WHERE e.deleted = 0
AND r.report_check_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE} AND to_char(r.report_check_time, 'yyyy-MM') = to_char(#{vo.vo.lastYearTime}::timestamp, 'yyyy-MM')
) b, ) b,
(SELECT count(r.id) "total" (SELECT count(r.id) "total"
FROM entrust e FROM entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0 join entrust_report r on r.entrust_id = e.id and r.deleted = 0
WHERE e.deleted = 0 WHERE e.deleted = 0
AND r.report_check_time between #{vo.prevTimeS} and #{vo.prevTimeE} AND to_char(r.report_check_time, 'yyyy-MM') = to_char(#{vo.prevTime}::timestamp, 'yyyy-MM')
) c ) c
</select> </select>
<!--报告发放量统计C--> <!--报告发放量统计C-->
...@@ -459,8 +504,11 @@ ...@@ -459,8 +504,11 @@
entrust e entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0 join entrust_report r on r.entrust_id = e.id and r.deleted = 0
where e.deleted = 0 and r.status = 50 where e.deleted = 0 and r.status = 50
<if test="null != vo.timeS and null != vo.timeE"> <if test="null != vo.timeS">
AND (r.report_check_time between #{vo.timeS} and #{vo.timeE}) AND r.report_check_time >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND r.report_check_time &lt;= #{vo.timeE}
</if> </if>
</select> </select>
...@@ -763,7 +811,8 @@ ...@@ -763,7 +811,8 @@
from material m from material m
left join material_item mi on m.id = mi.material_id and mi.deleted = 0 left join material_item mi on m.id = mi.material_id and mi.deleted = 0
where m.deleted = 0 where m.deleted = 0
group by m.name order by m.name group by m.name
order by m.name
</select> </select>
<!--获取化验检测完毕任务数量统计数据:获取LIMS平台某段时间内各类物料的化验检测完毕任务数量数据--> <!--获取化验检测完毕任务数量统计数据:获取LIMS平台某段时间内各类物料的化验检测完毕任务数量数据-->
...@@ -795,8 +844,9 @@ ...@@ -795,8 +844,9 @@
left join entrust_sample es on cs.id = es.contract_sample_id and es.deleted = 0 left join entrust_sample es on cs.id = es.contract_sample_id and es.deleted = 0
left join entrust e on e.id = es.entrust_id and e.deleted = 0 left join entrust e on e.id = es.entrust_id and e.deleted = 0
left join entrust_report r on e.id = r.entrust_id and r.deleted = 0 left join entrust_report r on e.id = r.entrust_id and r.deleted = 0
where cs.deleted = 0 and es.contract_sample_id is not null where cs.deleted = 0
and to_char(cs.ctime,'yy-MM-dd') = to_char(#{vo.queryDate}::timestamp,'yyyy-MM-dd') and es.contract_sample_id is not null
and to_char(cs.ctime, 'yy-MM-dd') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM-dd')
</select> </select>
<select id="selectProcessSampleStageQuantity" resultType="map"> <select id="selectProcessSampleStageQuantity" resultType="map">
...@@ -809,7 +859,8 @@ ...@@ -809,7 +859,8 @@
left join entrust_sample s on e.id = s.entrust_id and s.deleted = 0 left join entrust_sample s on e.id = s.entrust_id and s.deleted = 0
left join entrust_report r on e.id = r.entrust_id and r.deleted = 0 left join entrust_report r on e.id = r.entrust_id and r.deleted = 0
where e.deleted = 0 where e.deleted = 0
and s.contract_sample_id is null and s.type = 0 and s.contract_sample_id is null
and to_char(e.entrust_time,'yy-MM-dd') = to_char(#{vo.queryDate}::timestamp,'yyyy-MM-dd') and s.type = 0
and to_char(e.entrust_time, 'yy-MM-dd') = to_char(#{vo.queryDate}::timestamp, 'yyyy-MM-dd')
</select> </select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment