|
@@ -28,7 +28,7 @@ func GetAdminAccount(account string, password string) (*admin_models.AdminAccoun
|
28
|
28
|
// 获取总机构数
|
29
|
29
|
func GetTotalOrgCount() (int, error) {
|
30
|
30
|
var count int
|
31
|
|
- err := readUserDb.Model(&models.Org{}).Where("status <> 0").Count(&count).Error
|
|
31
|
+ err := readUserDb.Model(&models.Org{}).Where("status <> 0 AND import <> 1").Count(&count).Error
|
32
|
32
|
if err != nil {
|
33
|
33
|
return 0, err
|
34
|
34
|
}
|
|
@@ -413,7 +413,7 @@ func GetAdminUserTotalCount() (int64, error) {
|
413
|
413
|
func GetRegistedOrgCount(from int64, to int64) (int64, error) {
|
414
|
414
|
|
415
|
415
|
var count int64
|
416
|
|
- err := readUserDb.Model(&models.Org{}).Where("status <> 0 AND ctime >= ? AND ctime <= ?", from, to).Count(&count).Error
|
|
416
|
+ err := readUserDb.Model(&models.Org{}).Where("status <> 0 AND ctime >= ? AND ctime <= ? AND AND import <> 1", from, to).Count(&count).Error
|
417
|
417
|
if err != nil {
|
418
|
418
|
return 0, err
|
419
|
419
|
}
|
|
@@ -446,9 +446,34 @@ func GetActiveOrgTotalCount() (int64, error) {
|
446
|
446
|
return count, nil
|
447
|
447
|
}
|
448
|
448
|
|
|
449
|
+//获取昨天的注册机构总量
|
|
450
|
+func GetYesterDayRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
|
|
451
|
+ err = readUserDb.Raw("select count(id) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times from sgj_user_org where DATE_SUB(CURDATE(), INTERVAL 1 DAY) = date(from_unixtime(sgj_user_org.ctime)) AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
|
|
452
|
+ return
|
|
453
|
+}
|
|
454
|
+
|
|
455
|
+//获取近昨天的的机构活跃总量
|
|
456
|
+func GetYesterDayActiveOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
|
|
457
|
+ db := readDb.Raw("select count(DISTINCT(user_org_id)) as count, DATE_FORMAT(date(from_unixtime(created_time)) ,'%Y-%m-%d') as times from xt_dialysis_order where DATE_SUB(CURDATE(), INTERVAL 1 DAY) = date(from_unixtime(created_time)) AND status = 1 GROUP BY date(from_unixtime(created_time));")
|
|
458
|
+ err = db.Scan(&weekStatistics).Error
|
|
459
|
+ return
|
|
460
|
+}
|
|
461
|
+
|
|
462
|
+//获取昨天的的机构活跃账号总量
|
|
463
|
+func GetYesterDayActiveAdminUserCount() (weekStatistics []*admin_models.Statistics, err error) {
|
|
464
|
+ err = readUserDb.Raw("select count(DISTINCT(admin_user_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times from sgj_user_admin_login_log where DATE_SUB(CURDATE(), INTERVAL 1 DAY) = date(from_unixtime(sgj_user_admin_login_log.ctime)) AND operate_type = 1 AND app_type = 3 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
|
|
465
|
+ return
|
|
466
|
+}
|
|
467
|
+
|
|
468
|
+//获取昨天的的机构新增病人总量
|
|
469
|
+func GetYesterDayNewPatientCount() (weekStatistics []*admin_models.Statistics, err error) {
|
|
470
|
+ err = readDb.Raw("select count(DISTINCT(id_card_no)) as count, DATE_FORMAT(date(from_unixtime(created_time)) ,'%Y-%m-%d') as times from xt_patients where DATE_SUB(CURDATE(), INTERVAL 1 DAY) = date(from_unixtime(created_time)) GROUP BY date(from_unixtime(created_time));").Scan(&weekStatistics).Error
|
|
471
|
+ return
|
|
472
|
+}
|
|
473
|
+
|
449
|
474
|
//获取近七天每天的注册机构总量
|
450
|
475
|
func GetWeekRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
|
451
|
|
- err = readUserDb.Raw("select count(id) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times from sgj_user_org where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(sgj_user_org.ctime)) GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
|
|
476
|
+ err = readUserDb.Raw("select count(id) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times from sgj_user_org where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(sgj_user_org.ctime)) AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
|
452
|
477
|
return
|
453
|
478
|
}
|
454
|
479
|
|
|
@@ -476,35 +501,9 @@ func GetWeekNewPatientCount() (weekStatistics []*admin_models.Statistics, err er
|
476
|
501
|
return
|
477
|
502
|
}
|
478
|
503
|
|
479
|
|
-//获取近七天每天的注册机构总量
|
480
|
|
-func GetWeekRegistedOrgTotalCount() (int64, error) {
|
481
|
|
- var result admin_models.Count
|
482
|
|
- var err error
|
483
|
|
- err = readUserDb.Raw("select count(id) as count from sgj_user_org where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(sgj_user_org.ctime))").Scan(&result).Error
|
484
|
|
- return result.Count, err
|
485
|
|
-}
|
486
|
|
-
|
487
|
|
-//获取近七天每天的机构活跃账号总量
|
488
|
|
-func GetWeekActiveAdminUserTotalCount() (int64, error) {
|
489
|
|
- var result admin_models.Count
|
490
|
|
- var err error
|
491
|
|
- err = readUserDb.Raw("select count(DISTINCT(admin_user_id)) as count from sgj_user_admin_login_log where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(sgj_user_admin_login_log.ctime)) AND operate_type = 1 ").Scan(&result).Error
|
492
|
|
- return result.Count, err
|
493
|
|
-
|
494
|
|
-}
|
495
|
|
-
|
496
|
|
-//获取近七天新增病人总量
|
497
|
|
-func GetWeekPatientTotalCount() (int64, error) {
|
498
|
|
- var result admin_models.Count
|
499
|
|
- var err error
|
500
|
|
- err = readDb.Raw("select count(DISTINCT(id_card_no)) as count from xt_patients where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(created_time))").Scan(&result).Error
|
501
|
|
- return result.Count, err
|
502
|
|
-
|
503
|
|
-}
|
504
|
|
-
|
505
|
504
|
//获取近30天每天的注册机构总量
|
506
|
505
|
func GetMonthRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
|
507
|
|
- err = readUserDb.Raw("select count(id) as count,DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times from sgj_user_org where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(sgj_user_org.ctime)) GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
|
|
506
|
+ err = readUserDb.Raw("select count(id) as count,DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times from sgj_user_org where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(sgj_user_org.ctime)) AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
|
508
|
507
|
return
|
509
|
508
|
}
|
510
|
509
|
|
|
@@ -526,33 +525,9 @@ func GetMonthNewPatientCount() (weekStatistics []*admin_models.Statistics, err e
|
526
|
525
|
return
|
527
|
526
|
}
|
528
|
527
|
|
529
|
|
-//获取近30天每天的注册机构总量
|
530
|
|
-func GetMonthRegistedOrgTotalCount() (int64, error) {
|
531
|
|
- var result admin_models.Count
|
532
|
|
- var err error
|
533
|
|
- err = readUserDb.Raw("select count(id) as count from sgj_user_org where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(sgj_user_org.ctime))").Scan(&result).Error
|
534
|
|
- return result.Count, err
|
535
|
|
-}
|
536
|
|
-
|
537
|
|
-//获取近30天每天的机构活跃账号总量
|
538
|
|
-func GetMonthActiveAdminUserTotalCount() (int64, error) {
|
539
|
|
- var result admin_models.Count
|
540
|
|
- var err error
|
541
|
|
- err = readUserDb.Raw("select count(DISTINCT(admin_user_id)) as count from sgj_user_admin_login_log where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(sgj_user_admin_login_log.ctime)) AND operate_type = 1 ").Scan(&result).Error
|
542
|
|
- return result.Count, err
|
543
|
|
-}
|
544
|
|
-
|
545
|
|
-//获取近30天每天的机构新增病人总量
|
546
|
|
-func GetMonthNewPatientTotalCount() (int64, error) {
|
547
|
|
- var result admin_models.Count
|
548
|
|
- var err error
|
549
|
|
- err = readDb.Raw("select count(DISTINCT(id_card_no)) as count from xt_patients where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(created_time)) ").Scan(&result).Error
|
550
|
|
- return result.Count, err
|
551
|
|
-}
|
552
|
|
-
|
553
|
528
|
//获取近3个月每个月的注册机构总量
|
554
|
529
|
func GetThreeMonthRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
|
555
|
|
- err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') group by times").Scan(&weekStatistics).Error
|
|
530
|
+ err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 group by times").Scan(&weekStatistics).Error
|
556
|
531
|
return
|
557
|
532
|
}
|
558
|
533
|
|
|
@@ -574,36 +549,9 @@ func GetThreeMonthNewPatientCount() (weekStatistics []*admin_models.Statistics,
|
574
|
549
|
return
|
575
|
550
|
}
|
576
|
551
|
|
577
|
|
-//获取近3个月每个月的注册机构总量
|
578
|
|
-func GetThreeMonthRegistedOrgTotalCount() (int64, error) {
|
579
|
|
- var result admin_models.Count
|
580
|
|
- var err error
|
581
|
|
- err = readUserDb.Raw("select count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m')").Scan(&result).Error
|
582
|
|
- return result.Count, err
|
583
|
|
-
|
584
|
|
-}
|
585
|
|
-
|
586
|
|
-//获取近3个月每个月的机构活跃账号总量
|
587
|
|
-func GetThreeMonthActiveAdminUserTotalCount() (int64, error) {
|
588
|
|
- var result admin_models.Count
|
589
|
|
- var err error
|
590
|
|
- err = readUserDb.Raw("select count(DISTINCT(admin_user_id)) as count from sgj_user_admin_login_log where DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') AND operate_type = 1 ").Scan(&result).Error
|
591
|
|
- return result.Count, err
|
592
|
|
-
|
593
|
|
-}
|
594
|
|
-
|
595
|
|
-//获取近3个月每个月机构新增病人总量
|
596
|
|
-func GetThreeMonthNewPatientTotalCount() (int64, error) {
|
597
|
|
- var result admin_models.Count
|
598
|
|
- var err error
|
599
|
|
- err = readDb.Raw("select count(DISTINCT(id_card_no)) as count from xt_patients where DATE_FORMAT(date(from_unixtime(xt_patients.created_time)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m')").Scan(&result).Error
|
600
|
|
- return result.Count, err
|
601
|
|
-
|
602
|
|
-}
|
603
|
|
-
|
604
|
552
|
//获取近半年每个月的注册机构总量
|
605
|
553
|
func GetSixMonthRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
|
606
|
|
- err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') group by times").Scan(&weekStatistics).Error
|
|
554
|
+ err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 group by times").Scan(&weekStatistics).Error
|
607
|
555
|
return
|
608
|
556
|
}
|
609
|
557
|
|
|
@@ -625,35 +573,9 @@ func GetSixMonthNewPatientCount() (weekStatistics []*admin_models.Statistics, er
|
625
|
573
|
return
|
626
|
574
|
}
|
627
|
575
|
|
628
|
|
-//获取近半年每个月的注册机构总量
|
629
|
|
-func GetSixMonthRegistedOrgTotalCount() (int64, error) {
|
630
|
|
- var result admin_models.Count
|
631
|
|
- var err error
|
632
|
|
- err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m')").Scan(&result).Error
|
633
|
|
- return result.Count, err
|
634
|
|
-}
|
635
|
|
-
|
636
|
|
-//获取近半年每个月的机构活跃账号总量
|
637
|
|
-func GetSixMonthActiveAdminUserTotalCount() (int64, error) {
|
638
|
|
- var result admin_models.Count
|
639
|
|
- var err error
|
640
|
|
- err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)) ,'%Y-%m') as times,count(DISTINCT(admin_user_id)) as count from sgj_user_admin_login_log where DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m')").Scan(&result).Error
|
641
|
|
- return result.Count, err
|
642
|
|
-
|
643
|
|
-}
|
644
|
|
-
|
645
|
|
-//获取近半年每个月机构新增病人总量
|
646
|
|
-func GetSixMonthNewPatientTotalCount() (int64, error) {
|
647
|
|
- var result admin_models.Count
|
648
|
|
- var err error
|
649
|
|
- err = readDb.Raw("select DATE_FORMAT(date(from_unixtime(xt_patients.created_time)) ,'%Y-%m') as times,count(DISTINCT(id_card_no)) as count from xt_patients where DATE_FORMAT(date(from_unixtime(xt_patients.created_time)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m')").Scan(&result).Error
|
650
|
|
- return result.Count, err
|
651
|
|
-
|
652
|
|
-}
|
653
|
|
-
|
654
|
576
|
//获取近1年每个月的注册机构总量
|
655
|
577
|
func GetYearRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
|
656
|
|
- err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') group by times").Scan(&weekStatistics).Error
|
|
578
|
+ err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 group by times").Scan(&weekStatistics).Error
|
657
|
579
|
return
|
658
|
580
|
}
|
659
|
581
|
|
|
@@ -675,32 +597,6 @@ func GetYearNewPatientCount() (weekStatistics []*admin_models.Statistics, err er
|
675
|
597
|
return
|
676
|
598
|
}
|
677
|
599
|
|
678
|
|
-//获取近1年每个月的注册机构总量
|
679
|
|
-func GetYearRegistedOrgTotalCount() (int64, error) {
|
680
|
|
- var result admin_models.Count
|
681
|
|
- var err error
|
682
|
|
- err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m')").Scan(&result).Error
|
683
|
|
- return result.Count, err
|
684
|
|
-
|
685
|
|
-}
|
686
|
|
-
|
687
|
|
-//获取近1年每个月的机构活跃账号总量
|
688
|
|
-func GetYearActiveAdminUserTotalCount() (int64, error) {
|
689
|
|
- var result admin_models.Count
|
690
|
|
- var err error
|
691
|
|
- err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)) ,'%Y-%m') as times,count(DISTINCT(admin_user_id)) as count from sgj_user_admin_login_log where DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m')").Scan(&result).Error
|
692
|
|
- return result.Count, err
|
693
|
|
-}
|
694
|
|
-
|
695
|
|
-//获取近1年每个月机构新增病人总量
|
696
|
|
-func GetYearNewPatientTotalCount() (int64, error) {
|
697
|
|
- var result admin_models.Count
|
698
|
|
- var err error
|
699
|
|
- err = readDb.Raw("select count(DISTINCT(id_card_no)) as count from xt_patients where DATE_FORMAT(date(from_unixtime(xt_patients.created_time)),'%Y-%m')>DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') AND status > 0").Scan(&result).Error
|
700
|
|
- return result.Count, err
|
701
|
|
-
|
702
|
|
-}
|
703
|
|
-
|
704
|
600
|
func GetAllAdmin() (admin []*admin_models.AdminAccount, err error) {
|
705
|
601
|
err = readUserDb.Model(&admin_models.AdminAccount{}).Where("is_super_admin <> 1 AND (status = 1 OR status = 2)").Find(&admin).Error
|
706
|
602
|
return
|
|
@@ -821,13 +717,13 @@ func GetAllWaitFollowOrgList(keyword string, page int64, limit int64, id int64)
|
821
|
717
|
db := readUserDb
|
822
|
718
|
if len(keyword) > 0 {
|
823
|
719
|
likeKey := "%" + keyword + "%"
|
824
|
|
- 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 ?))", id, likeKey, likeKey).Count(&total).Offset(offset).Limit(limit).Scan(&orgViewModel).Error
|
825
|
|
- 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 ?)) ", 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 (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)
|
826
|
722
|
|
827
|
723
|
} else {
|
828
|
|
- 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)", 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)
|
829
|
725
|
err = db.Offset(offset).Limit(limit).Scan(&orgViewModel).Error
|
830
|
|
- 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)", id).Scan(&totals)
|
|
726
|
+ 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", id).Scan(&totals)
|
831
|
727
|
|
832
|
728
|
}
|
833
|
729
|
|
|
@@ -847,8 +743,8 @@ func FindAllFollowOrg(keyword string, page int64, limit int64, admin_id int64) (
|
847
|
743
|
var rows *sql.Rows
|
848
|
744
|
var errs error
|
849
|
745
|
likeKey := "%" + keyword + "%"
|
850
|
|
- rows, errs = readUserDb.Raw("SELECT follow.*, org.org_name as org_name FROM sgj_org_follow as follow join sgj_user_org as org on org.id = follow.org_id AND (org.org_name Like ? OR org.org_short_name Like ?) WHERE (follow.admin_user_id = ? AND follow.status = 1)", likeKey, likeKey, admin_id).Offset(offset).Limit(limit).Rows()
|
851
|
|
- readUserDb.Raw("SELECT count(follow.id) as count FROM sgj_org_follow as follow join sgj_user_org as org on org.id = follow.org_id AND (org.org_name Like ? OR org.org_short_name Like ?) WHERE follow.admin_user_id = ? AND follow.status = 1", likeKey, likeKey, admin_id).Scan(&totals)
|
|
746
|
+ rows, errs = readUserDb.Raw("SELECT follow.*, org.org_name as org_name FROM sgj_org_follow as follow join sgj_user_org as org on org.id = follow.org_id AND (org.org_name Like ? OR org.org_short_name Like ?) AND org.import <> 1 WHERE (follow.admin_user_id = ? AND follow.status = 1)", likeKey, likeKey, admin_id).Offset(offset).Limit(limit).Rows()
|
|
747
|
+ readUserDb.Raw("SELECT count(follow.id) as count FROM sgj_org_follow as follow join sgj_user_org as org on org.id = follow.org_id AND (org.org_name Like ? OR org.org_short_name Like ?) AND org.import <> 1 WHERE follow.admin_user_id = ? AND follow.status = 1", likeKey, likeKey, admin_id).Scan(&totals)
|
852
|
748
|
|
853
|
749
|
defer rows.Close()
|
854
|
750
|
if errs != nil {
|
|
@@ -865,8 +761,8 @@ func FindAllFollowOrg(keyword string, page int64, limit int64, admin_id int64) (
|
865
|
761
|
var vms []*FollowViewModel = make([]*FollowViewModel, 0)
|
866
|
762
|
var rows *sql.Rows
|
867
|
763
|
var errs error
|
868
|
|
- rows, errs = readUserDb.Raw("SELECT follow.*, org.org_name as org_name FROM sgj_org_follow as follow join sgj_user_org as org on org.id = follow.org_id WHERE follow.admin_user_id = ? AND follow.status = 1", admin_id).Offset(offset).Limit(limit).Rows()
|
869
|
|
- readUserDb.Raw("SELECT count(follow.id) as count FROM sgj_org_follow as follow join sgj_user_org as org on org.id = follow.org_id WHERE follow.admin_user_id = ? AND follow.status = 1", admin_id).Scan(&totals)
|
|
764
|
+ rows, errs = readUserDb.Raw("SELECT follow.*, org.org_name as org_name FROM sgj_org_follow as follow join sgj_user_org as org on org.id = follow.org_id AND org.import <> 1 WHERE follow.admin_user_id = ? AND follow.status = 1", admin_id).Offset(offset).Limit(limit).Rows()
|
|
765
|
+ readUserDb.Raw("SELECT count(follow.id) as count FROM sgj_org_follow as follow join sgj_user_org as org on org.id = follow.org_id AND org.import <> 1 WHERE follow.admin_user_id = ? AND follow.status = 1", admin_id).Scan(&totals)
|
870
|
766
|
|
871
|
767
|
defer rows.Close()
|
872
|
768
|
if errs != nil {
|