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.
 
 

29 lines
1.5 KiB

<?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.StepTaskDao">
<select id="getBindCarTaskId" resultType="com.ccsens.wisdomcar.bean.vo.ProjectVo$BindCar" parameterType="java.lang.Long">
select c.id, c.task_sub_id as taskSubId, c.patient_id as patientId, c.car_id as carId, c.start_time as startTime, c.end_time as endTime FROM
(select patient_id, batch from t_step_task where task_sub_id = #{taskSubId} and rec_status = 0) batch,
(select id from t_step where code = 1 and step_type = 0 and rec_status = 0) step,
t_step_task st,
t_patient_wisdom_car c
where batch.batch = st.batch and batch.patient_id = st.patient_id and step.id = st.step_id and st.task_sub_id = c.task_sub_id and st.rec_status = 0 and c.rec_status = 0 order by c.start_time desc limit 1
</select>
<select id="getByCarAndStep" resultMap="com.ccsens.wisdomcar.persist.mapper.StepTaskMapper.BaseResultMap">
SELECT
st2.*
FROM
t_patient_wisdom_car pc,
t_step_task st,
t_step_task st2
WHERE
pc.task_sub_id = st.task_sub_id
AND pc.patient_id = st2.patient_id
AND st.batch = st2.batch
AND st2.step_id = #{stepId}
AND pc.car_id = #{carId}
AND pc.start_time &lt;= #{time} AND pc.end_time = 0 AND pc.start_time + 2 * 60 * 60 * 1000 > #{time}
order by pc.created_at desc limit 1
</select>
</mapper>