|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.ccsens.wisdomcar.persist.dao.StatisticsDao">
|
|
|
|
|
|
|
|
|
|
<select id="selResult" resultType="Integer" parameterType="com.ccsens.wisdomcar.bean.dto.StatisticsDto$UseNum">
|
|
|
|
|
select if(tfa.num is NULL,0,tfa.num) as num FROM
|
|
|
|
|
(SELECT
|
|
|
|
|
concat( #{param.year}, `name` ) AS `name`
|
|
|
|
|
FROM
|
|
|
|
|
t_statistics_month ) tsm
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
tfa.da,
|
|
|
|
|
count( tfa.da ) AS num
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
*,
|
|
|
|
|
FROM_UNIXTIME( begin_time / 1000, '%Y-%m' ) AS da
|
|
|
|
|
FROM
|
|
|
|
|
`t_first_aid`
|
|
|
|
|
WHERE
|
|
|
|
|
`t_first_aid`.rec_status = 0
|
|
|
|
|
AND `t_first_aid`.hospital_id =#{param.hospitalId}
|
|
|
|
|
AND FROM_UNIXTIME( begin_time / 1000, '%Y-%m' ) LIKE concat(#{param.year},'-%')
|
|
|
|
|
) tfa
|
|
|
|
|
GROUP BY
|
|
|
|
|
tfa.da
|
|
|
|
|
ORDER BY
|
|
|
|
|
tfa.da
|
|
|
|
|
) tfa on tsm.`name`=tfa.`da`
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getPointTimeCurrent" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime">
|
|
|
|
|
select tfar.begin_time, tfar.type
|
|
|
|
|
from
|
|
|
|
|
t_first_aid_record tfar ,(select id from t_first_aid tfa where tfa.hospital_id=0 and tfa.rec_status=0 ORDER BY tfa.begin_time) t
|
|
|
|
|
where tfar.rec_status=0 and t.id = tfar.first_aid_id
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPointTimeHospital" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime">
|
|
|
|
|
select
|
|
|
|
|
ts.`name`,
|
|
|
|
|
MIN(tfas.duration) as time
|
|
|
|
|
from
|
|
|
|
|
t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id
|
|
|
|
|
where tfas.hospital_id=0 and tfas.type=1 and tfas.rec_status = 0 and ts.rec_status=0
|
|
|
|
|
GROUP BY tfas.step_id;
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPointTimeInternation" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime">
|
|
|
|
|
select
|
|
|
|
|
ts.`name`,
|
|
|
|
|
MIN(tfas.duration) as time
|
|
|
|
|
from
|
|
|
|
|
t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id
|
|
|
|
|
where tfas.hospital_id=0 and tfas.type=0 and tfas.rec_status = 0 and ts.rec_status=0
|
|
|
|
|
GROUP BY tfas.step_id;
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|