Browse Source

修改bug

csx 4 years ago
parent
commit
b926989745
2 changed files with 17 additions and 16 deletions
  1. 2 2
      service/admin_service.go
  2. 15 14
      service/function_service.go

+ 2 - 2
service/admin_service.go View File

717
 	db := readUserDb
717
 	db := readUserDb
718
 	if len(keyword) > 0 {
718
 	if len(keyword) > 0 {
719
 		likeKey := "%" + keyword + "%"
719
 		likeKey := "%" + keyword + "%"
720
-		err = db.Raw("Select id, org_name From  sgj_user_org  Where NOT EXISTS (Select id, org_name FROM sgj_org_follow Where sgj_org_follow.org_id = sgj_user_org.id AND sgj_org_follow.admin_user_id = ? AND sgj_org_follow.status = 1 AND (sgj_user_org.org_name Like ? OR sgj_user_org.org_short_name Like ?)) AND import <> 1", id, likeKey, likeKey).Count(&total).Offset(offset).Limit(limit).Scan(&orgViewModel).Error
721
-		readUserDb.Raw("Select count(id) as count From  sgj_user_org  Where NOT EXISTS (Select id, org_name FROM sgj_org_follow Where sgj_org_follow.org_id = sgj_user_org.id AND sgj_org_follow.admin_user_id = ? AND sgj_org_follow.status = 1 (sgj_user_org.org_name Like ? OR sgj_user_org.org_short_name Like ?))  AND import <> 1  ", id, likeKey, likeKey).Scan(&totals)
720
+		err = db.Raw("Select id, org_name From  sgj_user_org  Where NOT EXISTS (Select id, org_name FROM sgj_org_follow Where sgj_org_follow.org_id = sgj_user_org.id AND sgj_org_follow.admin_user_id = ? AND sgj_org_follow.status = 1 ) AND import <> 1 AND (sgj_user_org.org_name Like ? OR sgj_user_org.org_short_name Like ?)", id, likeKey, likeKey).Offset(offset).Limit(limit).Scan(&orgViewModel).Error
721
+		readUserDb.Raw("Select count(id) as count From  sgj_user_org  Where NOT EXISTS (Select id, org_name FROM sgj_org_follow Where sgj_org_follow.org_id = sgj_user_org.id AND sgj_org_follow.admin_user_id = ? AND sgj_org_follow.status = 1)  AND import <> 1 AND (sgj_user_org.org_name Like ? OR sgj_user_org.org_short_name Like ?)", id, likeKey, likeKey).Scan(&totals)
722
 
722
 
723
 	} else {
723
 	} else {
724
 		db = db.Raw("Select id, org_name From  sgj_user_org  Where NOT EXISTS (Select id, org_name FROM sgj_org_follow Where sgj_org_follow.org_id = sgj_user_org.id AND sgj_org_follow.admin_user_id = ? AND sgj_org_follow.status = 1)  AND import <> 1", id)
724
 		db = db.Raw("Select id, org_name From  sgj_user_org  Where NOT EXISTS (Select id, org_name FROM sgj_org_follow Where sgj_org_follow.org_id = sgj_user_org.id AND sgj_org_follow.admin_user_id = ? AND sgj_org_follow.status = 1)  AND import <> 1", id)

+ 15 - 14
service/function_service.go View File

9
 func GetTodayInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
9
 func GetTodayInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
10
 
10
 
11
 	offset := (page - 1) * limit
11
 	offset := (page - 1) * limit
12
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_patients as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
12
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id left join sgj_xt.xt_patients as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
13
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_patients as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
13
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_patients as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
14
 	fmt.Println("rows是什么", rows)
14
 	fmt.Println("rows是什么", rows)
15
 	if rows.Next() {
15
 	if rows.Next() {
23
 func GetTodayDialysisPatientsInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
23
 func GetTodayDialysisPatientsInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
24
 
24
 
25
 	offset := (page - 1) * limit
25
 	offset := (page - 1) * limit
26
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_dialysis_prescription as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
26
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id left join sgj_xt.xt_dialysis_prescription as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
27
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_prescription as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
27
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_prescription as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
28
 	if rows.Next() {
28
 	if rows.Next() {
29
 		rows.Scan(&total)
29
 		rows.Scan(&total)
36
 func GetTodayReceivePatientsInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
36
 func GetTodayReceivePatientsInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
37
 
37
 
38
 	offset := (page - 1) * limit
38
 	offset := (page - 1) * limit
39
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u  join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_receive_treatment_asses as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
39
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u  left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id left join sgj_xt.xt_receive_treatment_asses as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
40
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_receive_treatment_asses as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
40
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_receive_treatment_asses as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
41
 	if rows.Next() {
41
 	if rows.Next() {
42
 		rows.Scan(&total)
42
 		rows.Scan(&total)
48
 // 透前评估
48
 // 透前评估
49
 func GetTodayBeforDislysisInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
49
 func GetTodayBeforDislysisInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
50
 	offset := (page - 1) * limit
50
 	offset := (page - 1) * limit
51
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_assessment_before_dislysis as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
51
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id left join sgj_xt.xt_assessment_before_dislysis as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
52
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_assessment_before_dislysis as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
52
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_assessment_before_dislysis as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
53
 	if rows.Next() {
53
 	if rows.Next() {
54
 		rows.Scan(&total)
54
 		rows.Scan(&total)
61
 func GetTodayDoctorsOrderInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
61
 func GetTodayDoctorsOrderInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
62
 
62
 
63
 	offset := (page - 1) * limit
63
 	offset := (page - 1) * limit
64
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_doctor_advice as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
64
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_doctor_advice as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
65
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_doctor_advice as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
65
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_doctor_advice as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
66
 	if rows.Next() {
66
 	if rows.Next() {
67
 		rows.Scan(&total)
67
 		rows.Scan(&total)
74
 func GetTodayDoubleCheckInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
74
 func GetTodayDoubleCheckInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
75
 
75
 
76
 	offset := (page - 1) * limit
76
 	offset := (page - 1) * limit
77
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_double_check as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
77
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_double_check as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
78
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_double_check as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
78
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_double_check as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
79
 	if rows.Next() {
79
 	if rows.Next() {
80
 		rows.Scan(&total)
80
 		rows.Scan(&total)
87
 func GetTodayDialysisMachinek(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
87
 func GetTodayDialysisMachinek(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
88
 
88
 
89
 	offset := (page - 1) * limit
89
 	offset := (page - 1) * limit
90
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
90
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id left join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
91
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
91
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
92
 	if rows.Next() {
92
 	if rows.Next() {
93
 		rows.Scan(&total)
93
 		rows.Scan(&total)
100
 func GetTodayDialysisExamination(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
100
 func GetTodayDialysisExamination(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
101
 
101
 
102
 	offset := (page - 1) * limit
102
 	offset := (page - 1) * limit
103
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_monitoring_record as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
103
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_monitoring_record as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
104
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_monitoring_record as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
104
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_monitoring_record as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
105
 	if rows.Next() {
105
 	if rows.Next() {
106
 		rows.Scan(&total)
106
 		rows.Scan(&total)
113
 func GetTodayBeforOrpenetration(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
113
 func GetTodayBeforOrpenetration(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
114
 
114
 
115
 	offset := (page - 1) * limit
115
 	offset := (page - 1) * limit
116
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
116
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
117
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
117
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
118
 	if rows.Next() {
118
 	if rows.Next() {
119
 		rows.Scan(&total)
119
 		rows.Scan(&total)
125
 //透后评估
125
 //透后评估
126
 func GetTodayPostAssessment(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
126
 func GetTodayPostAssessment(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
127
 	offset := (page - 1) * limit
127
 	offset := (page - 1) * limit
128
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_assessment_after_dislysis as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
128
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id left JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_assessment_after_dislysis as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
129
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_assessment_after_dislysis as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
129
 	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_assessment_after_dislysis as x on x.user_org_id = u.id  where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
130
 	if rows.Next() {
130
 	if rows.Next() {
131
 		rows.Scan(&total)
131
 		rows.Scan(&total)
136
 
136
 
137
 func GetTodayEntrylist(to int64, ctime int64, limit int64, page int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
137
 func GetTodayEntrylist(to int64, ctime int64, limit int64, page int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
138
 	offset := (page - 1) * limit
138
 	offset := (page - 1) * limit
139
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u  join sgj_xt.xt_warehouse_info as x on x.org_id = u.id  LEFT JOIN  sgj_users.sgj_org_follow as f ON f.org_id = u.id  LEFT JOIN   sgj_users.sgj_admin as a on a.id = f.admin_user_id  where x.ctime >= ? AND x.ctime<= ? GROUP BY x.org_id", to, ctime).Scan(&patientinfo).Error
140
-	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_warehouse_info as x on x.org_id = u.id where x.ctime >= ? AND x.ctime <= ?", to, ctime).Rows()
139
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u  join sgj_xt.xt_warehouse as x on x.org_id = u.id  LEFT JOIN  sgj_users.sgj_org_follow as f ON f.org_id = u.id  LEFT JOIN   sgj_users.sgj_admin as a on a.id = f.admin_user_id  where x.ctime >= ? AND x.ctime<= ? GROUP BY x.org_id", to, ctime).Scan(&patientinfo).Error
140
+	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_warehouse as x on x.org_id = u.id where x.ctime >= ? AND x.ctime <= ?", to, ctime).Rows()
141
 	if rows.Next() {
141
 	if rows.Next() {
142
 		rows.Scan(&total)
142
 		rows.Scan(&total)
143
 	}
143
 	}
147
 
147
 
148
 func GetTodayExitlist(to int64, ctime int64, limit int64, page int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
148
 func GetTodayExitlist(to int64, ctime int64, limit int64, page int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
149
 	offset := (page - 1) * limit
149
 	offset := (page - 1) * limit
150
-	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u   join sgj_xt.xt_warehouse_out as x on x.org_id = u.id  where x.warehouse_out_time >= ? AND x.warehouse_out_time<= ? GROUP BY x.org_id", to, ctime).Scan(&patientinfo).Error
151
-	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_warehouse_out as x on x.org_id = u.id where x.warehouse_out_time >= ? AND x.warehouse_out_time <= ?", to, ctime).Rows()
150
+	err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u  join sgj_xt.xt_warehouse_out as x on x.org_id = u.id  LEFT JOIN  sgj_users.sgj_org_follow as f ON f.org_id = u.id  LEFT JOIN   sgj_users.sgj_admin as a on a.id = f.admin_user_id  where x.ctime >= ? AND x.ctime<= ? GROUP BY x.org_id", to, ctime).Scan(&patientinfo).Error
151
+	rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_warehouse_out as x on x.org_id = u.id where x.ctime >= ? AND x.ctime <= ?", to, ctime).Rows()
152
 	if rows.Next() {
152
 	if rows.Next() {
153
 		rows.Scan(&total)
153
 		rows.Scan(&total)
154
 	}
154
 	}
155
+
155
 	return patientinfo, total, err
156
 	return patientinfo, total, err
156
 }
157
 }