就诊记录和患者数据不符合问题修改

master
gongzhenkun 2 years ago
parent 1f784e3b51
commit a6c72f23fc

@ -94,6 +94,28 @@ public class TRecord extends BaseEntity
*/ */
private int appDealTime; private int appDealTime;
//医院名称
private String hospitalName;
//医生姓名
private String doctorName;
public void setHospitalName(String hospitalName) {
this.hospitalName = hospitalName;
}
public void setDoctorName(String doctorName) {
this.doctorName = doctorName;
}
public String getHospitalName() {
return hospitalName;
}
public String getDoctorName() {
return doctorName;
}
public int getAppDealTime() { public int getAppDealTime() {
return appDealTime; return appDealTime;
} }

@ -167,4 +167,11 @@ public interface TRecordMapper
int queryDoctorNumberOfDiagnosis(Long doctorId); int queryDoctorNumberOfDiagnosis(Long doctorId);
List<PatientHistoryRecordResp> queryPatientHistoryRecord(TRecord tRecord); List<PatientHistoryRecordResp> queryPatientHistoryRecord(TRecord tRecord);
/**
*
* @param tRecord
* @return
*/
List<TRecord> selectTRecordDoctorHospitalFirst(TRecord tRecord);
} }

@ -112,11 +112,14 @@ public class TPatientServiceImpl implements ITPatientService
List<PcTPatientQueryByPageResp> pcTPatientQueryByPageResps = tPatientMapper.queryByPage(pcTPatintQueryByPageReq); List<PcTPatientQueryByPageResp> pcTPatientQueryByPageResps = tPatientMapper.queryByPage(pcTPatintQueryByPageReq);
pcTPatientQueryByPageResps.stream().forEach(a ->{ pcTPatientQueryByPageResps.stream().forEach(a ->{
record.setPatientId(a.getId()); record.setPatientId(a.getId());
List<TRecord> tRecords = tRecordMapper.selectTRecordDoctorPatientFirst(record); List<TRecord> tRecords = tRecordMapper.selectTRecordDoctorHospitalFirst(record);
//最后一次/初次就诊时间 //最后一次/初次就诊时间
if (!ObjectUtils.isEmpty(tRecords)){ if (!ObjectUtils.isEmpty(tRecords)){
a.setLatestTime(tRecords.get(0).getCreateTime()); a.setLatestTime(tRecords.get(0).getCreateTime());
a.setFirstTime(tRecords.get(tRecords.size()-1).getCreateTime()); a.setFirstTime(tRecords.get(tRecords.size()-1).getCreateTime());
a.setHospitalName(tRecords.get(0).getHospitalName());
a.setHospitalId(tRecords.get(0).getHospitalId());
a.setDoctorName(tRecords.get(0).getDoctorName());
} }
//诊断次数 //诊断次数
a.setCountRecords(tRecords.size()); a.setCountRecords(tRecords.size());

@ -22,6 +22,7 @@
<if test="num != null "> and num = #{num}</if> <if test="num != null "> and num = #{num}</if>
<if test="adminId != null "> and admin_id = #{adminId}</if> <if test="adminId != null "> and admin_id = #{adminId}</if>
</where> </where>
order by num asc
</select> </select>
<select id="selectTHospitalById" parameterType="Long" resultMap="THospitalResult"> <select id="selectTHospitalById" parameterType="Long" resultMap="THospitalResult">

@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="responseTime" column="response_time" /> <result property="responseTime" column="response_time" />
<result property="aiResultReturnTime" column="ai_result_return_time" /> <result property="aiResultReturnTime" column="ai_result_return_time" />
<result property="aiResultModifyTime" column="ai_result_modify_time" /> <result property="aiResultModifyTime" column="ai_result_modify_time" />
<result property="hospitalName" column="hospital_name" />
<result property="doctorName" column="doctor_name"/>
</resultMap> </resultMap>
<sql id="selectTRecordVo"> <sql id="selectTRecordVo">
@ -253,6 +255,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc order by create_time desc
</select> </select>
<select id="selectTRecordDoctorHospitalFirst" parameterType="TRecord" resultMap="TRecordResult">
select
t.id,
t.create_time,
t.doctor_id,
t.hospital_id,
c.`name` as hospital_name,
d.`name` as doctor_name
from t_record t
left join t_hospital c on c.id = t.hospital_id
left join t_doctor d on d.id = t.doctor_id
<where>
<if test="patientId != null "> and t.patient_id = #{patientId}</if>
<if test="doctorId != null "> and t.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and t.hospital_id = #{hospitalId}</if>
<if test="status != null and status != ''"> and t.status = #{status}</if>
</where>
order by t.create_time desc
</select>
<select id="selectTRecordList" parameterType="TRecord" resultMap="TRecordResult"> <select id="selectTRecordList" parameterType="TRecord" resultMap="TRecordResult">
<include refid="selectTRecordVo"/> <include refid="selectTRecordVo"/>
where tr.del_flag = '0' where tr.del_flag = '0'

Loading…
Cancel
Save