|
@@ -153,6 +153,19 @@ func CreateCheckConfiguration(configuration *models.XtCheckConfiguration) error
|
153
|
153
|
return err
|
154
|
154
|
}
|
155
|
155
|
|
|
156
|
+func GetAllChekcListTwo(orgid int64, page int64, limit int64) (check []*models.CheckConfiguration, total int64, err error) {
|
|
157
|
+ db := XTReadDB().Table("xt_check_configuration as x").Where("x.status =1")
|
|
158
|
+ table := XTReadDB().Table("xt_inspection_reference as r")
|
|
159
|
+ fmt.Println(table)
|
|
160
|
+ if orgid > 0 {
|
|
161
|
+ db = db.Where("x.user_org_id = ?", orgid)
|
|
162
|
+ }
|
|
163
|
+ offset := (page - 1) * limit
|
|
164
|
+ err = db.Group("x.id").Order("x.sort asc,x.created_time desc").Select("x.id,x.inspection_major,x.inspection_frequency,x.sort,x.user_org_id,r.project_name").Count(&total).
|
|
165
|
+ Joins("left join xt_inspection_reference as r on r.project_id = x.inspection_major").Offset(offset).Limit(limit).Scan(&check).Error
|
|
166
|
+ return check, total, err
|
|
167
|
+}
|
|
168
|
+
|
156
|
169
|
func GetAllCheckList(orgid int64, page int64, limit int64) (check []*models.CheckConfiguration, total int64, err error) {
|
157
|
170
|
|
158
|
171
|
db := XTReadDB().Table("xt_check_configuration as x").Where("x.status =1")
|
|
@@ -163,7 +176,7 @@ func GetAllCheckList(orgid int64, page int64, limit int64) (check []*models.Chec
|
163
|
176
|
}
|
164
|
177
|
offset := (page - 1) * limit
|
165
|
178
|
err = db.Group("x.id").Order("x.sort asc,x.created_time desc").Select("x.id,x.inspection_major,x.inspection_frequency,x.sort,x.user_org_id,r.project_name").Count(&total).
|
166
|
|
- Joins("left join xt_inspection_reference as r on r.project_id = x.inspection_major").Offset(offset).Limit(limit).Scan(&check).Error
|
|
179
|
+ Joins("left join xt_inspection_reference as r on r.project_id = x.inspection_major").Where("r.org_id = ? and r.status = 1", orgid).Offset(offset).Limit(limit).Scan(&check).Error
|
167
|
180
|
return check, total, err
|
168
|
181
|
}
|
169
|
182
|
|
|
@@ -2354,7 +2367,7 @@ func GetPatientsControl(orgid int64, lapstor int64, startime int64, endtime int6
|
2354
|
2367
|
fmt.Println(d)
|
2355
|
2368
|
|
2356
|
2369
|
if orgid > 0 {
|
2357
|
|
- db = db.Where("x.org_id = ?", orgid)
|
|
2370
|
+ db = db.Where("x.org_id = ? and x.inspect_value <> ''", orgid)
|
2358
|
2371
|
}
|
2359
|
2372
|
if lapstor == 0 {
|
2360
|
2373
|
table = table.Where("s.lapseto = 1 or s.lapseto = 2")
|
|
@@ -2372,11 +2385,43 @@ func GetPatientsControl(orgid int64, lapstor int64, startime int64, endtime int6
|
2372
|
2385
|
db = db.Where("x.inspect_date <=?", endtime)
|
2373
|
2386
|
}
|
2374
|
2387
|
offset := (page - 1) * limit
|
2375
|
|
- err = db.Select("x.id,x.patient_id,s.name,s.dialysis_no,x.inspect_date").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_inspection_reference as r on r.item_id = x.item_id AND r.org_id > 0 OR ( x.item_id = r.id AND r.org_id = 0 )").Group("x.inspect_date").Count(&total).Offset(offset).Limit(limit).Scan(&inspection).Error
|
|
2388
|
+ err = db.Select("x.id,x.patient_id,s.name,s.dialysis_no,x.inspect_date").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_quality_control_standard as r on x.item_id = r.inspection_minor ").Where("r.user_org_id = ? and r.status = 1", orgid).Group("x.inspect_date").Count(&total).Offset(offset).Limit(limit).Scan(&inspection).Error
|
2376
|
2389
|
|
2377
|
2390
|
return inspection, total, err
|
2378
|
2391
|
}
|
2379
|
2392
|
|
|
2393
|
+
|
|
2394
|
+
|
|
2395
|
+
|
|
2396
|
+
|
|
2397
|
+
|
|
2398
|
+
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
|
|
2403
|
+
|
|
2404
|
+
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
|
|
2412
|
+
|
|
2413
|
+
|
|
2414
|
+
|
|
2415
|
+
|
|
2416
|
+
|
|
2417
|
+
|
|
2418
|
+
|
|
2419
|
+
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
|
|
2423
|
+
|
|
2424
|
+
|
2380
|
2425
|
func GetLastPatientsControl(orgid int64, lapstor int64, startime int64, endtime int64) (inspection []*models.PatientInspectionCount, err error) {
|
2381
|
2426
|
|
2382
|
2427
|
db := readDb.Table("xt_inspection as x").Where("x.status =1")
|