|
|
@ -155,21 +155,23 @@ |
|
|
|
WHERE |
|
|
|
a.id = r1.first_aid_id |
|
|
|
and a.id = r2.first_aid_id |
|
|
|
AND r2.question_code = #{param.accordCode} |
|
|
|
AND r1.question_code = #{param.questionCode} |
|
|
|
AND r2.question_code = #{param.accordCode} |
|
|
|
AND a.hospital_id IN |
|
|
|
<foreach collection="hospitalIds" open="(" close=")" separator="," item="hospitalId"> |
|
|
|
#{hospitalId} |
|
|
|
</foreach> |
|
|
|
AND a.value_type = 0 and a.data_status in (1, 3, 5, 6) |
|
|
|
AND a.rec_status = 0 |
|
|
|
AND r1.rec_status = 0 |
|
|
|
<if test="param.startTime!=null and param.startTime!=0"> |
|
|
|
AND r2.answer + 0 >= #{param.startTime} |
|
|
|
</if> |
|
|
|
<if test="param.endTime!=null and param.endTime!=0"> |
|
|
|
AND r2.answer + 0 <= #{param.endTime} |
|
|
|
</if> |
|
|
|
AND r1.answer != '' |
|
|
|
AND a.rec_status = 0 |
|
|
|
AND r1.rec_status = 0 |
|
|
|
AND r2.rec_status = 0 |
|
|
|
GROUP BY |
|
|
|
r1.answer |
|
|
|
</select> |
|
|
@ -215,7 +217,7 @@ |
|
|
|
<otherwise>FROM_UNIXTIME(r1.answer/1000,'%Y-%m-%d') as date,</otherwise> |
|
|
|
</choose> |
|
|
|
ROUND((r1.answer - r2.answer)/60000, 2) as val |
|
|
|
from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2 |
|
|
|
from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2, (select @rk := 0, @team := '') t |
|
|
|
where a.id = r1.first_aid_id and r1.question_code = #{minuendCode} |
|
|
|
and a.id = r2.first_aid_id and r2.question_code = #{subtractionCode} |
|
|
|
and r1.answer + 0 >= #{startTime} and r1.answer + 0 <= #{endTime} |
|
|
@ -224,9 +226,9 @@ |
|
|
|
</foreach> |
|
|
|
AND a.value_type = 0 and a.data_status in (1, 3, 5, 6) |
|
|
|
and a.rec_status = 0 and r1.rec_status = 0 and r2.rec_status = 0 |
|
|
|
) d, |
|
|
|
(select @rk := 0, @team := '') t |
|
|
|
order by date, val) t1 |
|
|
|
order by r1.answer/1000, r1.answer/1000 |
|
|
|
) d |
|
|
|
) t1 |
|
|
|
left join ( |
|
|
|
select |
|
|
|
<choose> |
|
|
@ -259,11 +261,11 @@ |
|
|
|
<select id="countAreaMedian" resultType="com.ccsens.carbasics.bean.vo.StatisticalVo$Item"> |
|
|
|
select b.id,b.shortName as name, avg(b.val) as value from |
|
|
|
(select id,shortName,val,@team, |
|
|
|
case @team when id then @rk := @rk + 1 else @rk := 1 end rk, |
|
|
|
if(val is null, 0, CASE @team WHEN id THEN @rk := @rk + 1 ELSE @rk := 1 END) rk, |
|
|
|
@team := id |
|
|
|
from ( |
|
|
|
select city.id, city.short_name as shortName, aid.val from |
|
|
|
(select city.id, city.short_name from t_organization o, t_organization_parent p, t_organization city |
|
|
|
(select city.id, city.short_name from t_organization o, t_organization_parent p, t_organization city,(select @rk := 0, @team := '') a |
|
|
|
where o.id = p.parent_id and p.organization_id = city.id AND city.organization_type = 2 |
|
|
|
and o.code = #{param.code} and o.rec_status = 0 and p.rec_status = 0 and city.rec_status = 0) city |
|
|
|
left join |
|
|
@ -272,6 +274,7 @@ |
|
|
|
( |
|
|
|
select |
|
|
|
a.hospital_id, |
|
|
|
r1.id as recordId, |
|
|
|
ROUND((r1.answer - r2.answer)/60000, 2) as val |
|
|
|
from t_qcp_first_aid a, t_qcp_first_aid_record r1 , t_qcp_first_aid_record r2 |
|
|
|
where a.id = r1.first_aid_id and r1.question_code = #{param.minuendCode} |
|
|
@ -280,10 +283,12 @@ |
|
|
|
AND a.value_type = 0 and a.data_status in (1, 3, 5, 6) |
|
|
|
and a.rec_status = 0 and r1.rec_status = 0 and r2.rec_status = 0 |
|
|
|
) aid on hospital.id = aid.hospital_id |
|
|
|
) t1, (select @rk := 0, @team := '') a order by id,val) b |
|
|
|
group by city.id,aid.recordId |
|
|
|
order by city.id,aid.val |
|
|
|
) t1) b |
|
|
|
left join |
|
|
|
( |
|
|
|
select city.id, city.short_name as shortName, count(aid.id) as cnt from |
|
|
|
select city.id, city.short_name as shortName, count(aid.id)/2 as cnt from |
|
|
|
(select city.id, city.short_name from t_organization o, t_organization_parent p, t_organization city |
|
|
|
where o.id = p.parent_id and p.organization_id = city.id |
|
|
|
and o.code = #{param.code} and o.rec_status = 0 and p.rec_status = 0 and city.rec_status = 0) city |
|
|
|