You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.1 KiB

5 years ago
<?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">
5 years ago
<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
5 years ago
(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>
5 years ago
5 years ago
5 years ago
<select id="getPointTimeCurrent" parameterType="java.util.Map" resultType="Long">
5 years ago
select tfar.begin_time/1000 as time
5 years ago
from
5 years ago
t_step ts LEFT JOIN t_first_aid_record tfar on ts.id = tfar.step_id ,
(select id from t_first_aid tfa where tfa.hospital_id =#{id} and tfa.rec_status=0 ORDER BY tfa.begin_time) t
where tfar.rec_status=0 and t.id = tfar.first_aid_id and ts.rec_status = 0 and ts.step_type = 1
ORDER BY ts.sequence asc
5 years ago
</select>
5 years ago
<select id="getPointTimeHospital" parameterType="java.util.Map" resultType="Long">
5 years ago
select
5 years ago
MIN(tfas.duration)/1000 as time
5 years ago
from
t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id
5 years ago
where tfas.hospital_id=#{id} and tfas.type=1 and tfas.rec_status = 0 and ts.rec_status=0
5 years ago
GROUP BY tfas.step_id;
</select>
5 years ago
<select id="getPointTimeInternation" parameterType="java.util.Map" resultType="Long">
5 years ago
select
5 years ago
MIN(tfas.duration)/1000 as time
5 years ago
from
t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id
5 years ago
where tfas.hospital_id=#{id} and tfas.type=0 and tfas.rec_status = 0 and ts.rec_status=0
5 years ago
GROUP BY tfas.step_id;
</select>
5 years ago
</mapper>