|
@@ -37,4 +37,32 @@
|
|
WHERE a.is_deleted = 'N'
|
|
WHERE a.is_deleted = 'N'
|
|
AND a.`code` = #{patientCode} AND b.`code` = #{hospitalCode}
|
|
AND a.`code` = #{patientCode} AND b.`code` = #{hospitalCode}
|
|
</select>
|
|
</select>
|
|
|
|
+
|
|
|
|
+ <select id="getTopPatientInfo" parameterType="com.diagbot.vo.GetTopPatientInfoVO" resultType="com.diagbot.dto.GetTopPatientInfoDTO">
|
|
|
|
+ SELECT
|
|
|
|
+ a.id as hospitalId,
|
|
|
|
+ a.`code` as hospitalCode,
|
|
|
|
+ a.`name` as hospitalName,
|
|
|
|
+ b.id as hospitalDeptId,
|
|
|
|
+ b.`code` as hospitalDeptCode,
|
|
|
|
+ b.`name` as hospitalDeptName,
|
|
|
|
+ c.id as doctorId,
|
|
|
|
+ c.`code` as doctorCode,
|
|
|
|
+ c.`name` as doctorName,
|
|
|
|
+ d.id as patientId,
|
|
|
|
+ d.`code` as patientCode,
|
|
|
|
+ d.`name` as patientName,
|
|
|
|
+ d.sex as patientSex,
|
|
|
|
+ d.id_no as patientIdNo,
|
|
|
|
+ ROUND(DATEDIFF(CURDATE(), d.birthday)/365.2422) as patientAge
|
|
|
|
+ FROM tran_hospital_info a JOIN tran_hospital_dept b
|
|
|
|
+ ON a.`code`=b.hospital_code
|
|
|
|
+ JOIN tran_doctor_info c ON b.id=c.hospital_dept_id
|
|
|
|
+ JOIN tran_patient_info d ON c.hospital_id=d.hospital_id
|
|
|
|
+ WHERE a.is_deleted='N' AND b.is_deleted='N'
|
|
|
|
+ AND c.is_deleted='N' AND d.is_deleted='N'
|
|
|
|
+ AND a.`status`=1 AND b.`status`=1
|
|
|
|
+ AND a.`code`=#{hospitalCode} AND b.`code`=#{hospitalDeptCode}
|
|
|
|
+ AND c.`code`=#{doctorCode} AND d.`code`=#{patientCode}
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|