|
@@ -58,9 +58,11 @@ public interface SiPatInfoMapper {
|
|
|
*/
|
|
|
@Select({
|
|
|
"SELECT DISTINCT t.pat_no as patientId, t.times, t.psn_no as psnNo, t.psn_name as psnName, ",
|
|
|
- "t.visit_datetime as visitDateTime, v.visit_dept_code as deptName, v.doctor_code as doctorName, v.icd_text as diagnose ",
|
|
|
+ "t.visit_datetime as visitDateTime, ISNULL(d.name, v.visit_dept_code) as deptName, ISNULL(e.name, v.doctor_code) as doctorName, v.icd_text as diagnose ",
|
|
|
"FROM t_si_pat_info t ",
|
|
|
"LEFT JOIN mz_visit_table v ON t.pat_no = v.patient_id AND t.times = v.times ",
|
|
|
+ "LEFT JOIN zd_unit_code d ON v.visit_dept_code = d.code ",
|
|
|
+ "LEFT JOIN a_employee_mi e ON v.doctor_code = e.code ",
|
|
|
"WHERE t.psn_no = #{psnNo} ",
|
|
|
"ORDER BY t.times DESC"
|
|
|
})
|
|
@@ -74,11 +76,13 @@ public interface SiPatInfoMapper {
|
|
|
*/
|
|
|
@Select({
|
|
|
"SELECT DISTINCT c.order_no as orderNo, c.charge_date as orderTime, c.receipt_no as receiptNo, c.real_no as realNo, ",
|
|
|
- "c.name as doctorName, c.exec_dept as deptName, ",
|
|
|
+ "ISNULL(e.name, c.doctor_code) as doctorName, ISNULL(d.name, c.exec_dept) as deptName, ",
|
|
|
"ISNULL(c.order_type, '') as orderType, ISNULL(SUM(c.unit_price * c.quantity), 0) as totalAmount, ISNULL(c.confirm_flag, 0) as confirmFlag ",
|
|
|
"FROM mz_charge_detail c ",
|
|
|
+ "LEFT JOIN a_employee_mi e ON c.doctor_code = e.code ",
|
|
|
+ "LEFT JOIN zd_unit_code d ON c.exec_dept = d.code ",
|
|
|
"WHERE c.patient_id = #{patientId} AND c.times = #{times} ",
|
|
|
- "GROUP BY c.order_no, c.charge_date, c.receipt_no, c.real_no, c.name, c.exec_dept, c.order_type, c.confirm_flag ",
|
|
|
+ "GROUP BY c.order_no, c.charge_date, c.receipt_no, c.real_no, c.doctor_code, e.name, c.exec_dept, d.name, c.order_type, c.confirm_flag ",
|
|
|
"ORDER BY c.charge_date DESC"
|
|
|
})
|
|
|
List<PrescriptionVo> selectPrescriptionsByVisit(@Param("patientId") String patientId, @Param("times") Integer times);
|