|
|
@ -145,9 +145,9 @@ |
|
|
|
t_qcp_first_aid_record r2 |
|
|
|
WHERE |
|
|
|
a.id = r1.first_aid_id |
|
|
|
AND r1.question_code = '发病时间' |
|
|
|
AND r1.question_code = 'JBXX-FBSJ' |
|
|
|
AND a.id = r2.first_aid_id |
|
|
|
AND r1.question_code = '到院时间' |
|
|
|
AND r2.question_code = 'JBXX-DYSJ' |
|
|
|
AND r2.answer + 0 >= #{startTime} |
|
|
|
AND r2.answer + 0 <= #{endTime} |
|
|
|
AND a.hospital_id IN |
|
|
@ -190,4 +190,288 @@ |
|
|
|
GROUP BY |
|
|
|
FROM_UNIXTIME( r2.answer / 1000, #{type}) |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="gdThrombosisRate" resultType="com.ccsens.carbasics.bean.vo.StatisticalVo$Item"> |
|
|
|
SELECT |
|
|
|
t.id, |
|
|
|
t.shortName AS name, |
|
|
|
round(t.part / t.total, 2) AS value |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
city.id, |
|
|
|
city.short_name AS shortName, |
|
|
|
sum(t2.part * 100) AS part, |
|
|
|
sum(t1.total) AS total |
|
|
|
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 = 'SXSZK' |
|
|
|
AND o.rec_status = 0 |
|
|
|
AND p.rec_status = 0 |
|
|
|
AND city.rec_status = 0 |
|
|
|
) city |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
o.id, |
|
|
|
p.parent_id |
|
|
|
FROM |
|
|
|
t_organization o, |
|
|
|
t_organization_parent p |
|
|
|
WHERE |
|
|
|
o.id = p.organization_id |
|
|
|
AND o.organization_type = 3 |
|
|
|
AND o.rec_status = 0 |
|
|
|
AND p.rec_status = 0 |
|
|
|
) hospital ON city.id = hospital.parent_id |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
a.hospital_id, |
|
|
|
count(*) AS total |
|
|
|
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 a.id = r2.first_aid_id |
|
|
|
AND r1.question_code = 'JBXX-FBSJ' |
|
|
|
AND a.id = r2.first_aid_id |
|
|
|
AND r2.question_code = 'JBXX-DYSJ' |
|
|
|
AND r2.answer + 0 >= #{startTime} |
|
|
|
AND r2.answer + 0 <= #{endTime} |
|
|
|
AND a.hospital_id IN |
|
|
|
<foreach collection="hospitalIds" item="id" separator="," open="(" close=")"> |
|
|
|
#{id} |
|
|
|
</foreach> |
|
|
|
AND r2.answer - r1.answer < 6 * 60 * 60 * 1000 |
|
|
|
AND a.rec_status = 0 |
|
|
|
AND r1.rec_status = 0 |
|
|
|
AND r2.rec_status = 0 |
|
|
|
GROUP BY |
|
|
|
a.hospital_id |
|
|
|
) t1 ON hospital.id = t1.hospital_id |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
a.hospital_id, |
|
|
|
count(a.id) AS part |
|
|
|
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 a.id = r2.first_aid_id |
|
|
|
AND r1.question_code = #{questionCode} |
|
|
|
AND r1.answer = #{answer} |
|
|
|
AND r2.question_code = #{timeGist} |
|
|
|
AND r2.answer + 0 >= #{startTime} |
|
|
|
AND r2.answer + 0 <= #{endTime} |
|
|
|
AND a.hospital_id IN |
|
|
|
<foreach collection="hospitalIds" item="id" separator="," open="(" close=")"> |
|
|
|
#{id} |
|
|
|
</foreach> |
|
|
|
AND a.rec_status = 0 |
|
|
|
AND r1.rec_status = 0 |
|
|
|
GROUP BY |
|
|
|
a.hospital_id |
|
|
|
) t2 ON hospital.id = t2.hospital_id |
|
|
|
GROUP BY |
|
|
|
city.id |
|
|
|
) t |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="gdCountSpecifyAnswer" resultType="com.ccsens.carbasics.bean.vo.StatisticalVo$Item"> |
|
|
|
SELECT |
|
|
|
city.id, |
|
|
|
city.short_name AS shortName AS name, |
|
|
|
sum(t.total) AS value |
|
|
|
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 = 'SXSZK' |
|
|
|
AND o.rec_status = 0 |
|
|
|
AND p.rec_status = 0 |
|
|
|
AND city.rec_status = 0 |
|
|
|
) city |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
o.id, |
|
|
|
p.parent_id |
|
|
|
FROM |
|
|
|
t_organization o, |
|
|
|
t_organization_parent p |
|
|
|
WHERE |
|
|
|
o.id = p.organization_id |
|
|
|
AND o.organization_type = 3 |
|
|
|
AND o.rec_status = 0 |
|
|
|
AND p.rec_status = 0 |
|
|
|
) hospital ON city.id = hospital.parent_id |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
a.hospital_id, |
|
|
|
count(*) AS total |
|
|
|
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 a.id = r2.first_aid_id |
|
|
|
AND r1.question_code = #{param.questionCode} |
|
|
|
AND r1.answer = #param.answer |
|
|
|
AND r2.question_code = #{param.accordCode} |
|
|
|
AND r2.answer + 0 >= #{param.startTime} |
|
|
|
AND r2.answer + 0 <= #{param.endTime} |
|
|
|
AND a.hospital_id IN |
|
|
|
<foreach collection="hospitalIds" item="id" separator="," open="(" close=")"> |
|
|
|
#{id} |
|
|
|
</foreach> |
|
|
|
AND a.rec_status = 0 |
|
|
|
AND r1.rec_status = 0 |
|
|
|
GROUP BY |
|
|
|
a.hospital_id |
|
|
|
) t ON hospital.id = t.hospital_id |
|
|
|
GROUP BY |
|
|
|
city.id |
|
|
|
</select> |
|
|
|
<select id="placeTimeWindows" resultType="com.ccsens.carbasics.bean.vo.StatisticalVo$Item"> |
|
|
|
SELECT |
|
|
|
city.id, |
|
|
|
city.short_name AS name, |
|
|
|
sum( t.total ) as value |
|
|
|
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 = 'SXSZK' |
|
|
|
AND o.rec_status = 0 |
|
|
|
AND p.rec_status = 0 |
|
|
|
AND city.rec_status = 0 |
|
|
|
) city |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
o.id, |
|
|
|
p.parent_id |
|
|
|
FROM |
|
|
|
t_organization o, |
|
|
|
t_organization_parent p |
|
|
|
WHERE |
|
|
|
o.id = p.organization_id |
|
|
|
AND o.organization_type = 3 |
|
|
|
AND o.rec_status = 0 |
|
|
|
AND p.rec_status = 0 |
|
|
|
) hospital ON city.id = hospital.parent_id |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
a.hospital_id, |
|
|
|
count(*) AS total |
|
|
|
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 = 'JBXX-FBSJ' |
|
|
|
AND a.id = r2.first_aid_id |
|
|
|
AND r1.question_code = 'JBXX-DYSJ' |
|
|
|
AND r2.answer + 0 >= #{startTime} |
|
|
|
AND r2.answer + 0 <= #{endTime} |
|
|
|
AND a.hospital_id IN |
|
|
|
<foreach collection="hospitalIds" item="id" separator="," open="(" close=")"> |
|
|
|
#{id} |
|
|
|
</foreach> |
|
|
|
AND r2.answer - r1.answer < 6 * 60 * 60 * 1000 |
|
|
|
AND a.rec_status = 0 |
|
|
|
AND r1.rec_status = 0 |
|
|
|
AND r2.rec_status = 0 |
|
|
|
GROUP BY |
|
|
|
a.hospital_id |
|
|
|
) t ON hospital.id = t.hospital_id |
|
|
|
GROUP BY |
|
|
|
city.id |
|
|
|
</select> |
|
|
|
|
|
|
|
<resultMap id="provinceCityStatistical" type="com.ccsens.carbasics.bean.vo.StatisticalVo$ProvinceCity"> |
|
|
|
<id column="id" property="id"/> |
|
|
|
<result column="code" property="code"/> |
|
|
|
<result column="shortName" property="shortName"/> |
|
|
|
<result column="projectId" property="projectId"/> |
|
|
|
<result column="parentId" property="parentId"/> |
|
|
|
<collection property="children" ofType="com.ccsens.carbasics.bean.vo.StatisticalVo$ProvinceCity"> |
|
|
|
<id column="parentId" property="parentId"/> |
|
|
|
<result column="id" property="id"/> |
|
|
|
<result column="code" property="code"/> |
|
|
|
<result column="shortName" property="shortName"/> |
|
|
|
<result column="projectId" property="projectId"/> |
|
|
|
</collection> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<select id="provinceCityStatistical" resultMap="provinceCityStatistical"> |
|
|
|
SELECT |
|
|
|
o.id, |
|
|
|
o.CODE, |
|
|
|
o.short_name AS shortName, |
|
|
|
NULL AS parentId, |
|
|
|
p.project_id as projectId |
|
|
|
FROM |
|
|
|
t_organization o, |
|
|
|
t_organization_project p |
|
|
|
WHERE |
|
|
|
o.id = p.organization_id |
|
|
|
and o.rec_status = 0 |
|
|
|
and o.organization_type = 1 |
|
|
|
<if test="code!=null and code!=''"> |
|
|
|
AND o.CODE LIKE concat('%',#{code},'%') |
|
|
|
</if> |
|
|
|
UNION |
|
|
|
SELECT |
|
|
|
o.id, |
|
|
|
o.CODE, |
|
|
|
o.short_name, |
|
|
|
p.parent_id AS parentId, |
|
|
|
pr.project_id as projectId |
|
|
|
FROM |
|
|
|
t_organization op, |
|
|
|
t_organization_parent p, |
|
|
|
t_organization o, |
|
|
|
t_organization_project pr |
|
|
|
WHERE |
|
|
|
op.id = p.parent_id |
|
|
|
and o.id = pr.organization_id |
|
|
|
AND p.organization_id = o.id |
|
|
|
<if test="code!=null and code!=''"> |
|
|
|
AND op.CODE LIKE concat('%',#{code},'%') |
|
|
|
</if> |
|
|
|
AND o.organization_type = 2 |
|
|
|
AND op.rec_status = 0 |
|
|
|
AND p.rec_status = 0 |
|
|
|
AND o.rec_status = 0 |
|
|
|
</select> |
|
|
|
</mapper> |
|
|
|