test_user 1 年間 前
コミット
84e976260f
共有1 個のファイルを変更した11 個の追加5 個の削除を含む
  1. 11 5
      service/his_service.go

+ 11 - 5
service/his_service.go ファイルの表示

@@ -981,13 +981,19 @@ func GetHisOrderList(user_org_id int64, page int64, limit int64, start_time_time
981 981
 		db = db.Joins("join xt_patients as patient on patient.id = his_order.patient_id  AND patient.name like ? AND patient.user_org_id = ?", keywords, user_org_id)
982 982
 
983 983
 	}
984
-
985
-	if sch_type > 0 {
986
-		db = db.Joins("join xt_schedule sch on sch.schedule_date = his_order.settle_accounts_date AND sch.patient_id = his_order.patient_id AND sch.schedule_type = ? AND sch.schedule_date >= ? AND sch.schedule_date <= ?", sch_type, start_time_timestamp, end_time_timestamp)
984
+	if sch_type > 0 && zone_type > 0 {
985
+		db = db.Joins("join xt_schedule sch on sch.schedule_date = his_order.settle_accounts_date AND sch.patient_id = his_order.patient_id AND sch.schedule_type = ? AND sch.schedule_date >= ? AND sch.schedule_date <= ? AND sch.partition_id = ? AND sch.status  = 1", sch_type, start_time_timestamp, end_time_timestamp, zone_type)
987 986
 	}
988
-	if zone_type > 0 {
989
-		db = db.Joins("join xt_schedule sch on sch.schedule_date = his_order.settle_accounts_date AND sch.patient_id = his_order.patient_id AND sch.partition_id = ?", zone_type)
987
+	if sch_type > 0 && zone_type == 0 {
988
+		db = db.Joins("join xt_schedule sch on sch.schedule_date = his_order.settle_accounts_date AND sch.patient_id = his_order.patient_id AND sch.schedule_type = ? AND sch.schedule_date >= ? AND sch.schedule_date <= ? AND sch.status = 1", sch_type, start_time_timestamp, end_time_timestamp)
990 989
 	}
990
+	if sch_type == 0 && zone_type > 0 {
991
+		db = db.Joins("join xt_schedule sch on sch.schedule_date = his_order.settle_accounts_date AND sch.patient_id = his_order.patient_id  AND sch.schedule_date >= ? AND sch.schedule_date <= ? AND sch.partition_id = ? AND sch.status = 1", start_time_timestamp, end_time_timestamp, zone_type)
992
+	}
993
+
994
+	//if zone_type > 0 {
995
+	//	db = db.Joins("join xt_schedule sch_two on sch_two.schedule_date = his_order.settle_accounts_date AND sch_two.patient_id = his_order.patient_id AND sch_two.partition_id = ?", zone_type)
996
+	//}
991 997
 
992 998
 	if sort_type == 1 {
993 999
 		if start_time_timestamp != 0 {