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

master
gongzhenkun 2 years ago
parent 08dfd6fff9
commit c94dd28400

@ -201,4 +201,25 @@ public class TRecordResultReq
{
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 +
'}';
}
}

@ -102,33 +102,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectHomePatientList" parameterType="TRecordResultReq" resultType="TRecordResp">
SELECT
t.id,
t.patientId,
t.doctorId,
t.hospitalId,
t. STATUS,
t.aiResult2,
t.updateResult2,
t.createTime,
t.updateTime,
t.uploadTime,
t.waitingTime,
t.aiResultReturnTime,
t.aiResultModifyTime,
t.responseTime,
t.doctorName,
t.identifier,
t.patientName,
t.sex,
t.age,
t.disease,
t.firstTime,
max(t.trCreateTime),
t.trCreateTime,
t.tpCreateTime
FROM
(
SELECT
tr.create_time AS trCreateTime,
tp.create_time AS tpCreateTime,
@ -155,6 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tp.create_time AS firstTime
FROM
t_record tr
<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>
<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>
LEFT JOIN t_doctor td ON tr.doctor_id = td.id
LEFT JOIN t_patient tp ON tr.patient_id = tp.id
<where>
@ -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 != null "> and tr.create_time between #{startTime} and #{endTime}</if>
</where>
) t
GROUP BY
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>
<if test="doctorOder !=null and doctorOder !=''" >order by trCreateTime ${doctorOder}</if>
<if test="firstVisitOder!=null and firstVisitOder !=''" >order by tpCreateTime ${firstVisitOder}</if>
</select>
<!--====================工作台相关接口=====================-->

Loading…
Cancel
Save