修复【就诊时间】排序错乱问题

master
gongzhenkun 2 years ago
parent 08dfd6fff9
commit c94dd28400

@ -201,4 +201,25 @@ public class TRecordResultReq
{ {
this.delFlag = delFlag; this.delFlag = delFlag;
} }
@Override
public String toString() {
return "TRecordResultReq{" +
"name='" + name + '\'' +
", sex='" + sex + '\'' +
", age='" + age + '\'' +
", identifier='" + identifier + '\'' +
", doctorId=" + doctorId +
", doctorName='" + doctorName + '\'' +
", hospitalId=" + hospitalId +
", createTime='" + createTime + '\'' +
", doctorOder='" + doctorOder + '\'' +
", firstVisitOder='" + firstVisitOder + '\'' +
", status='" + status + '\'' +
", startTime='" + startTime + '\'' +
", endTime='" + endTime + '\'' +
", delFlag='" + delFlag + '\'' +
", patientAge=" + patientAge +
'}';
}
} }

@ -103,60 +103,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHomePatientList" parameterType="TRecordResultReq" resultType="TRecordResp"> <select id="selectHomePatientList" parameterType="TRecordResultReq" resultType="TRecordResp">
SELECT SELECT
t.id, tr.create_time AS trCreateTime,
t.patientId, tp.create_time AS tpCreateTime,
t.doctorId, tr.id,
t.hospitalId, tr.patient_id AS patientId,
t. STATUS, tr.doctor_id AS doctorId,
t.aiResult2, tr.hospital_id AS hospitalId,
t.updateResult2, tr. STATUS,
t.createTime, tr.ai_result2 AS aiResult2,
t.updateTime, tr.update_result2 AS updateResult2,
t.uploadTime, tr.create_time AS createTime,
t.waitingTime, tr.update_time AS updateTime,
t.aiResultReturnTime, tr.upload_time AS uploadTime,
t.aiResultModifyTime, tr.create_time AS waitingTime,
t.responseTime, tr.ai_result_return_time AS aiResultReturnTime,
t.doctorName, tr.ai_result_modify_time AS aiResultModifyTime,
t.identifier, tr.response_time AS responseTime,
t.patientName, td. NAME AS doctorName,
t.sex, tp.identifier,
t.age, tp. NAME AS patientName,
t.disease, tp.sex,
t.firstTime, tp.age,
max(t.trCreateTime), tp.disease,
t.trCreateTime, tp.create_time AS firstTime
t.tpCreateTime
FROM FROM
( t_record tr
SELECT <if test="doctorOder !=null and doctorOder !=''">INNER JOIN ( SELECT SUBSTRING_INDEX( GROUP_CONCAT( id ORDER BY create_time DESC ), ',', 1 ) id FROM t_record r GROUP BY r.patient_id ) i ON tr.id = i.id</if>
tr.create_time AS trCreateTime, <if test="firstVisitOder!=null and firstVisitOder !=''">INNER JOIN ( SELECT SUBSTRING_INDEX( GROUP_CONCAT( id ORDER BY create_time ASC ), ',', 1 ) id FROM t_record r GROUP BY r.patient_id ) i ON tr.id = i.id</if>
tp.create_time AS tpCreateTime, LEFT JOIN t_doctor td ON tr.doctor_id = td.id
tr.id, LEFT JOIN t_patient tp ON tr.patient_id = tp.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.create_time AS createTime,
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,
tr.response_time AS responseTime,
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
<where> <where>
<if test="name != null and name != ''"> and tp.name like concat('%', #{name}, '%')</if> <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="doctorId != null "> and tr.doctor_id = #{doctorId}</if>
@ -181,11 +156,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="startTime == null and endTime != '' and endTime != null "> and tr.create_time &lt;= #{endTime}</if> <if test="startTime == null and endTime != '' and endTime != null "> and tr.create_time &lt;= #{endTime}</if>
<if test="startTime != null and endTime != null "> and tr.create_time between #{startTime} and #{endTime}</if> <if test="startTime != null and endTime != null "> and tr.create_time between #{startTime} and #{endTime}</if>
</where> </where>
) t <if test="doctorOder !=null and doctorOder !=''" >order by trCreateTime ${doctorOder}</if>
GROUP BY <if test="firstVisitOder!=null and firstVisitOder !=''" >order by tpCreateTime ${firstVisitOder}</if>
t.patientId
<if test="doctorOder !=null and doctorOder !=''" >order by t.trCreateTime ${doctorOder}</if>
<if test="firstVisitOder!=null and firstVisitOder !=''" >order by t.tpCreateTime ${firstVisitOder}</if>
</select> </select>
<!--====================工作台相关接口=====================--> <!--====================工作台相关接口=====================-->

Loading…
Cancel
Save