浏览代码

修改bug

csx 4 年前
父节点
当前提交
b926989745
共有 2 个文件被更改,包括 17 次插入16 次删除
  1. 2 2
      service/admin_service.go
  2. 15 14
      service/function_service.go

+ 2 - 2
service/admin_service.go 查看文件

@@ -717,8 +717,8 @@ func GetAllWaitFollowOrgList(keyword string, page int64, limit int64, id int64)
717 717
 	db := readUserDb
718 718
 	if len(keyword) > 0 {
719 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 723
 	} else {
724 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 查看文件

@@ -9,7 +9,7 @@ import (
9 9
 func GetTodayInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
10 10
 
11 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 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 14
 	fmt.Println("rows是什么", rows)
15 15
 	if rows.Next() {
@@ -23,7 +23,7 @@ func GetTodayInfo(to int64, ctime int64, page int64, limit int64) (patientinfo [
23 23
 func GetTodayDialysisPatientsInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
24 24
 
25 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 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 28
 	if rows.Next() {
29 29
 		rows.Scan(&total)
@@ -36,7 +36,7 @@ func GetTodayDialysisPatientsInfo(to int64, ctime int64, page int64, limit int64
36 36
 func GetTodayReceivePatientsInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
37 37
 
38 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 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 41
 	if rows.Next() {
42 42
 		rows.Scan(&total)
@@ -48,7 +48,7 @@ func GetTodayReceivePatientsInfo(to int64, ctime int64, page int64, limit int64)
48 48
 // 透前评估
49 49
 func GetTodayBeforDislysisInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
50 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 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 53
 	if rows.Next() {
54 54
 		rows.Scan(&total)
@@ -61,7 +61,7 @@ func GetTodayBeforDislysisInfo(to int64, ctime int64, page int64, limit int64) (
61 61
 func GetTodayDoctorsOrderInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
62 62
 
63 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 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 66
 	if rows.Next() {
67 67
 		rows.Scan(&total)
@@ -74,7 +74,7 @@ func GetTodayDoctorsOrderInfo(to int64, ctime int64, page int64, limit int64) (p
74 74
 func GetTodayDoubleCheckInfo(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
75 75
 
76 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 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 79
 	if rows.Next() {
80 80
 		rows.Scan(&total)
@@ -87,7 +87,7 @@ func GetTodayDoubleCheckInfo(to int64, ctime int64, page int64, limit int64) (pa
87 87
 func GetTodayDialysisMachinek(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
88 88
 
89 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 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 92
 	if rows.Next() {
93 93
 		rows.Scan(&total)
@@ -100,7 +100,7 @@ func GetTodayDialysisMachinek(to int64, ctime int64, page int64, limit int64) (p
100 100
 func GetTodayDialysisExamination(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
101 101
 
102 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 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 105
 	if rows.Next() {
106 106
 		rows.Scan(&total)
@@ -113,7 +113,7 @@ func GetTodayDialysisExamination(to int64, ctime int64, page int64, limit int64)
113 113
 func GetTodayBeforOrpenetration(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
114 114
 
115 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 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 118
 	if rows.Next() {
119 119
 		rows.Scan(&total)
@@ -125,7 +125,7 @@ func GetTodayBeforOrpenetration(to int64, ctime int64, page int64, limit int64)
125 125
 //透后评估
126 126
 func GetTodayPostAssessment(to int64, ctime int64, page int64, limit int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
127 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 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 130
 	if rows.Next() {
131 131
 		rows.Scan(&total)
@@ -136,8 +136,8 @@ func GetTodayPostAssessment(to int64, ctime int64, page int64, limit int64) (pat
136 136
 
137 137
 func GetTodayEntrylist(to int64, ctime int64, limit int64, page int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
138 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 141
 	if rows.Next() {
142 142
 		rows.Scan(&total)
143 143
 	}
@@ -147,10 +147,11 @@ func GetTodayEntrylist(to int64, ctime int64, limit int64, page int64) (patienti
147 147
 
148 148
 func GetTodayExitlist(to int64, ctime int64, limit int64, page int64) (patientinfo []function_models.PatientInfo, total int64, err error) {
149 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 152
 	if rows.Next() {
153 153
 		rows.Scan(&total)
154 154
 	}
155
+
155 156
 	return patientinfo, total, err
156 157
 }