|
|
|
@ -20,11 +20,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<result property="imgSx" column="img_sx" />
|
|
|
|
|
<result property="imgSm" column="img_sm" />
|
|
|
|
|
<result property="responseTime" column="response_time" />
|
|
|
|
|
<result property="aiResultReturnTime" column="ai_result_return_time" />
|
|
|
|
|
<result property="aiResultModifyTime" column="ai_result_modify_time" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectTRecordVo">
|
|
|
|
|
select id, patient_id, doctor_id, hospital_id, status, ai_result, ai_result2, update_result, update_result2, create_time, update_time, upload_time, img_sx, img_sm, response_time from t_record
|
|
|
|
|
</sql>
|
|
|
|
|
<sql id="selectTRecordWithResult">
|
|
|
|
|
SELECT
|
|
|
|
|
tr.id,
|
|
|
|
|
tr.patient_id AS patientId,
|
|
|
|
|
tr.doctor_id AS doctorId,
|
|
|
|
|
tr.hospital_id AS hospitalId,
|
|
|
|
|
tr.STATUS,
|
|
|
|
|
tr.ai_result AS aiResult,
|
|
|
|
|
tr.ai_result2 AS aiResult2,
|
|
|
|
|
tr.update_result AS update_result,
|
|
|
|
|
tr.update_result2 AS updateResult2,
|
|
|
|
|
tr.update_time AS updateTime,
|
|
|
|
|
tr.upload_time AS uploadTime,
|
|
|
|
|
tr.create_time AS waitingTime,
|
|
|
|
|
tr.ai_result_return_time AS aiResultReturnTime,
|
|
|
|
|
tr.ai_result_modify_time AS aiResultModifyTime,
|
|
|
|
|
td.NAME AS doctorName,
|
|
|
|
|
tp.identifier,
|
|
|
|
|
tp.NAME AS patientName,
|
|
|
|
|
tp.sex,
|
|
|
|
|
tp.age,
|
|
|
|
|
tp.disease,
|
|
|
|
|
tp.img_sx AS imgSx,
|
|
|
|
|
tp.img_sm AS imgSm,
|
|
|
|
|
tp.create_time AS firstTime
|
|
|
|
|
FROM
|
|
|
|
|
t_record tr
|
|
|
|
|
LEFT JOIN t_doctor td ON tr.doctor_id = td.id
|
|
|
|
|
LEFT JOIN t_patient tp ON tr.patient_id = tp.id
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<sql id="selectTRecordWithOutResult">
|
|
|
|
|
SELECT
|
|
|
|
|
tr.id,
|
|
|
|
|
tr.patient_id AS patientId,
|
|
|
|
|
tr.doctor_id AS doctorId,
|
|
|
|
|
tr.hospital_id AS hospitalId,
|
|
|
|
|
tr.STATUS,
|
|
|
|
|
tr.ai_result2 AS aiResult2,
|
|
|
|
|
tr.update_result2 AS updateResult2,
|
|
|
|
|
tr.update_time AS updateTime,
|
|
|
|
|
tr.upload_time AS uploadTime,
|
|
|
|
|
tr.create_time AS waitingTime,
|
|
|
|
|
tr.ai_result_return_time AS aiResultReturnTime,
|
|
|
|
|
tr.ai_result_modify_time AS aiResultModifyTime,
|
|
|
|
|
td.NAME AS doctorName,
|
|
|
|
|
tp.identifier,
|
|
|
|
|
tp.NAME AS patientName,
|
|
|
|
|
tp.sex,
|
|
|
|
|
tp.age,
|
|
|
|
|
tp.disease,
|
|
|
|
|
tp.create_time AS firstTime
|
|
|
|
|
FROM
|
|
|
|
|
t_record tr
|
|
|
|
|
LEFT JOIN t_doctor td ON tr.doctor_id = td.id
|
|
|
|
|
LEFT JOIN t_patient tp ON tr.patient_id = tp.id
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<!--====================工作台相关接口=====================-->
|
|
|
|
|
<select id="selectEquCount" resultType="int">
|
|
|
|
|
select count(*) from t_record
|
|
|
|
|
<where>
|
|
|
|
|
1 = 1
|
|
|
|
|
<if test="doctorId != null "> and doctor_id = #{doctorId}</if>
|
|
|
|
|
<if test="hospitalId != null "> and hospital_id = #{hospitalId}</if>
|
|
|
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
|
<if test="month != null ">
|
|
|
|
|
and DATE_FORMAT(create_time,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="week != null ">
|
|
|
|
|
and YEARWEEK(date_format(create_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="day != null ">
|
|
|
|
|
and TO_DAYS(create_time) = TO_DAYS(NOW())
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="dayPlan" resultType="com.ruoyi.system.domain.resp.PlatformDayPlanResp">
|
|
|
|
|
select
|
|
|
|
|
a.create_time as createTime,
|
|
|
|
|
if(a.status = '0','预约','就诊') as status,
|
|
|
|
|
b.name
|
|
|
|
|
from t_record a LEFT JOIN t_patient b on a.patient_id = b.id
|
|
|
|
|
where TO_DAYS(a.create_time) = TO_DAYS(NOW())
|
|
|
|
|
<if test="doctorId != null "> and a.doctor_id = #{doctorId}</if>
|
|
|
|
|
<if test="hospitalId != null "> and a.hospital_id = #{hospitalId}</if>
|
|
|
|
|
ORDER BY a.create_time desc
|
|
|
|
|
limit 5
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="weekMonthPersonCount" resultType="com.ruoyi.system.domain.resp.WeekMonthPersonCountResp">
|
|
|
|
|
select date_format(create_time, '%Y-%m-%d') createTime, count(*) count
|
|
|
|
|
from
|
|
|
|
|
<if test="weekMonth == 1 || weekMonth == null">
|
|
|
|
|
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(create_time)) X
|
|
|
|
|
</if>
|
|
|
|
|
<if test="weekMonth == 2">
|
|
|
|
|
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)) X
|
|
|
|
|
</if>
|
|
|
|
|
where 1 = 1
|
|
|
|
|
<if test="doctorId != null "> and X.doctor_id = #{doctorId}</if>
|
|
|
|
|
<if test="hospitalId != null "> and X.hospital_id = #{hospitalId}</if>
|
|
|
|
|
group by date_format(X.create_time, '%Y-%m-%d');
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="ageCount" resultType="com.ruoyi.system.domain.TPatient">
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<!--====================工作台相关接口=====================-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectTRecordList" parameterType="TRecord" resultMap="TRecordResult">
|
|
|
|
|
<include refid="selectTRecordVo"/>
|
|
|
|
@ -44,6 +157,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectTRecordListWithoutResult" parameterType="TRecordResultReq" resultType="TRecordResp">
|
|
|
|
|
<include refid="selectTRecordWithOutResult"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="name != null and name != ''"> and tp.name like concat('%', #{name}, '%')</if>
|
|
|
|
|
<if test="doctorId != null "> and tr.doctor_id = #{doctorId}</if>
|
|
|
|
|
<if test="hospitalId != null "> and tr.hospital_id = #{hospitalId}</if>
|
|
|
|
|
<if test="status != null and status != ''"> and tr.status = #{status}</if>
|
|
|
|
|
<if test="age !=null">and tp.age = #{age} </if>
|
|
|
|
|
<if test="sex !=null">and tp.sex = #{sex} </if>
|
|
|
|
|
<if test="startTime != null and endTime != null">
|
|
|
|
|
AND tp.create_time between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="doctorOder !=null and firstVisitOder!=null" >order by tr.create_time ${doctorOder}, tp.create_time ${firstVisitOder}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectTRecordById" parameterType="Long" resultMap="TRecordResult">
|
|
|
|
|
<include refid="selectTRecordVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
@ -66,6 +195,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="imgSx != null">img_sx,</if>
|
|
|
|
|
<if test="imgSm != null">img_sm,</if>
|
|
|
|
|
<if test="responseTime != null">response_time,</if>
|
|
|
|
|
<if test="aiResultReturnTime != null">ai_result_return_time,</if>
|
|
|
|
|
<if test="aiResultModifyTime != null">ai_result_modify_time,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="patientId != null">#{patientId},</if>
|
|
|
|
@ -82,6 +213,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="imgSx != null">#{imgSx},</if>
|
|
|
|
|
<if test="imgSm != null">#{imgSm},</if>
|
|
|
|
|
<if test="responseTime != null">#{responseTime},</if>
|
|
|
|
|
<if test="aiResultReturnTime != null">#{aiResultReturnTime},</if>
|
|
|
|
|
<if test="aiResultModifyTime != null">#{aiResultModifyTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@ -102,6 +235,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="imgSx != null">img_sx = #{imgSx},</if>
|
|
|
|
|
<if test="imgSm != null">img_sm = #{imgSm},</if>
|
|
|
|
|
<if test="responseTime != null">response_time = #{responseTime},</if>
|
|
|
|
|
<if test="aiResultReturnTime != null">ai_result_return_time = #{aiResultReturnTime},</if>
|
|
|
|
|
<if test="aiResultModifyTime != null">ai_result_modify_time = #{aiResultModifyTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
@ -116,4 +251,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="selectById" parameterType="Long" resultType="TRecordResp">
|
|
|
|
|
<include refid="selectTRecordWithResult"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="queryRecordListByPHDids" parameterType="TPatientHospitalDoctor" resultMap="TRecordResult">
|
|
|
|
|
<include refid="selectTRecordWithOutResult"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="patientId != null and patientId != ''"> and patient_id = #{patientId}</if>
|
|
|
|
|
<if test="doctorId != null and doctorId != ''"> and doctor_id = #{doctorId}</if>
|
|
|
|
|
<if test="hospitalId != null and hospitalId != ''"> and hospital_id = #{hospitalId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|