|
@@ -1159,19 +1159,23 @@ func GetPatientBloodPressureChartData(user_org_id int64, patient_id int64, start
|
1159
|
1159
|
//透析血压统计
|
1160
|
1160
|
|
1161
|
1161
|
//工作量统计
|
1162
|
|
-func GetDoctorWorkloadChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int) (datas []*VMUserAdminRole, err error) {
|
|
1162
|
+func GetDoctorWorkloadChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int, admin_user_id int64) (datas []*VMUserAdminRole, err error) {
|
1163
|
1163
|
userDb := service.UserReadDB()
|
1164
|
1164
|
db := service.XTReadDB()
|
1165
|
|
- userDb.Raw("select admin_user_id, user_name,org_id from sgj_user_admin_role Where status = 1 AND org_id = ? AND user_type = 2 ", user_org_id).Scan(&datas)
|
|
1165
|
+ if admin_user_id == 0 {
|
|
1166
|
+ userDb.Raw("select admin_user_id, user_name,org_id from sgj_user_admin_role Where status = 1 AND org_id = ? AND user_type = 2 ", user_org_id).Scan(&datas)
|
|
1167
|
+ } else {
|
|
1168
|
+ userDb.Raw("select admin_user_id, user_name,org_id from sgj_user_admin_role Where status = 1 AND org_id = ? AND user_type = 2 AND admin_user_id = ?", user_org_id, admin_user_id).Scan(&datas)
|
|
1169
|
+ }
|
1166
|
1170
|
|
1167
|
1171
|
switch statistics_type {
|
1168
|
1172
|
case 1:
|
1169
|
1173
|
var Total int64
|
1170
|
|
- db.Table("xt_dialysis_prescription as p").Where("user_org_id = ? AND status = 1 AND record_date >= ? AND record_date <= ? AND prescription_doctor <> 0 ", user_org_id, start_time, end_time).Count(&Total)
|
|
1174
|
+ db.Table("xt_dialysis_prescription as p").Where("user_org_id = ? AND status = 1 AND record_date >= ? AND record_date <= ? AND creater <> 0 ", user_org_id, start_time, end_time).Count(&Total)
|
1171
|
1175
|
|
1172
|
1176
|
for _, item := range datas {
|
1173
|
1177
|
var total int64
|
1174
|
|
- db.Table("xt_dialysis_prescription as p").Where("user_org_id = ? AND status = 1 AND prescription_doctor = ? AND record_date >= ? AND record_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&total)
|
|
1178
|
+ db.Table("xt_dialysis_prescription as p").Where("user_org_id = ? AND status = 1 AND creater = ? AND record_date >= ? AND record_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&total)
|
1175
|
1179
|
item.PCount = total
|
1176
|
1180
|
|
1177
|
1181
|
if math.IsNaN(float64(item.PCount) / float64(Total)) {
|
|
@@ -1242,7 +1246,7 @@ func GetDoctorWorkloadTableData(user_org_id int64, start_time int64, end_time in
|
1242
|
1246
|
var Total int64
|
1243
|
1247
|
var TotalOne int64
|
1244
|
1248
|
var TotalTwo int64
|
1245
|
|
- db.Table("xt_dialysis_prescription as p").Where("user_org_id = ? AND status = 1 AND prescription_doctor = ? AND record_date >= ? AND record_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
|
|
1249
|
+ db.Table("xt_dialysis_prescription as p").Where("user_org_id = ? AND status = 1 AND creater = ? AND record_date >= ? AND record_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
|
1246
|
1250
|
db.Table("xt_patient_course_of_disease as course").Where("org_id = ? AND status = 1 AND recorder = ? AND record_time >= ? AND record_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
|
1247
|
1251
|
db.Table("xt_patient_rescue_record as rescue").Where("org_id = ? AND status = 1 AND recorder = ? AND record_time >= ? AND record_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalTwo)
|
1248
|
1252
|
item.PCount = Total
|
|
@@ -1255,21 +1259,20 @@ func GetDoctorWorkloadTableData(user_org_id int64, start_time int64, end_time in
|
1255
|
1259
|
return datas, nil
|
1256
|
1260
|
|
1257
|
1261
|
}
|
1258
|
|
-func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int) (datas []*VMUserAdminRole, err error) {
|
|
1262
|
+func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int64, statistics_type int, admin_user_id int64) (datas []*VMUserAdminRole, err error) {
|
1259
|
1263
|
userDb := service.UserReadDB()
|
1260
|
1264
|
db := service.XTReadDB()
|
1261
|
|
- userDb.Raw("select admin_user_id, user_name,org_id from sgj_user_admin_role Where status = 1 AND org_id = ? AND user_type = 3 ", user_org_id).Scan(&datas)
|
|
1265
|
+
|
|
1266
|
+ if admin_user_id == 0 {
|
|
1267
|
+ userDb.Raw("select admin_user_id, user_name,org_id from sgj_user_admin_role Where status = 1 AND org_id = ? AND user_type = 3 ", user_org_id).Scan(&datas)
|
|
1268
|
+ } else {
|
|
1269
|
+ userDb.Raw("select admin_user_id, user_name,org_id from sgj_user_admin_role Where status = 1 AND org_id = ? AND user_type = 3 AND admin_user_id = ?", user_org_id, admin_user_id).Scan(&datas)
|
|
1270
|
+ }
|
1262
|
1271
|
|
1263
|
1272
|
var NewTotalOne int64
|
1264
|
1273
|
var NewTotalThree int64
|
1265
|
1274
|
var NewTotalFour int64
|
1266
|
1275
|
|
1267
|
|
- //var tempConfig models.Dataconfig
|
1268
|
|
- //db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
|
1269
|
|
-
|
1270
|
|
- //db.Raw("select count(*) as total from xt_dialysis_order where status = 1 AND dialysis_date >= ? AND dialysis_date <= ? AND user_org_id = ?",start_time,end_time,user_org_id).Count(&NewTotalOne)
|
1271
|
|
- //db.Raw("select count(*) as total_one from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0 Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ? Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, start_time, end_time).Count(&NewTotalTwo)
|
1272
|
|
-
|
1273
|
1276
|
db.Table("xt_dialysis_order ").Where("user_org_id = ? AND status = 1 AND dialysis_date >= ? AND dialysis_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalOne)
|
1274
|
1277
|
db.Table("xt_monitoring_record ").Where("user_org_id = ? AND status = 1 AND operate_time >= ? AND operate_time <= ?", user_org_id, start_time, end_time).Count(&NewTotalThree)
|
1275
|
1278
|
db.Table("xt_treatment_summary").Where("user_org_id = ? AND status = 1 AND assessment_date >= ? AND assessment_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalFour)
|