Kaynağa Gözat

统计详情

csx 4 yıl önce
ebeveyn
işleme
8d979dfc22

+ 1 - 1
conf/app.conf Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9550
3
-runmode = prod
3
+runmode = dev
4 4
 
5 5
 copyrequestbody = true
6 6
 sessionon = true

+ 3 - 2
controllers/admin_api_controllers/admin_api_router_register.go Dosyayı Görüntüle

@@ -48,7 +48,8 @@ func AdminAPIControllersRegisterRouters() {
48 48
 	beego.Router("/admin/api/org/list", &OrgAPIController{}, "get:GetOrgListOther")
49 49
 
50 50
 	beego.Router("/admin/api/activeorg/list", &OrgAPIController{}, "get:GetActiveOrgList")
51
-
52
-	//beego.Router("/admin/api/unfolloworg/list", &SystemApiController{}, "get:GetAllFollowOrg")
51
+	beego.Router("/admin/api/newcreateorg/list", &OrgAPIController{}, "get:GetNewCreateOrgList")
52
+	beego.Router("/admin/api/newdoctornurse/list", &OrgAPIController{}, "get:GetNewDoctorNurseList")
53
+	beego.Router("/admin/api/newpatient/list", &OrgAPIController{}, "get:GetNewPatientList")
53 54
 
54 55
 }

+ 82 - 0
controllers/admin_api_controllers/org_api_controller.go Dosyayı Görüntüle

@@ -362,3 +362,85 @@ func (this *OrgAPIController) GetActiveOrgList() {
362 362
 	}
363 363
 
364 364
 }
365
+
366
+func (this *OrgAPIController) GetNewCreateOrgList() {
367
+	range_data := this.GetString("range_data")
368
+	var rangeDate *time.Time
369
+	var parseDateErr error
370
+	var rangeTimeStamp int64
371
+
372
+	if len(range_data) > 0 {
373
+		rangeDate, parseDateErr = utils.ParseTimeStringToTime("2006-01-02", range_data)
374
+		if parseDateErr != nil {
375
+			this.ErrorLog("日期(%v)解析错误:%v", range_data, parseDateErr)
376
+			return
377
+		}
378
+		rangeTimeStamp = rangeDate.Unix()
379
+	} else {
380
+		rangeTimeStamp = 0
381
+	}
382
+	now := time.Now().Unix()
383
+	list, err := service.GetNewCreateOrgList(rangeTimeStamp, now)
384
+	if err != nil {
385
+
386
+	} else {
387
+		this.ServeSuccessJSON(map[string]interface{}{
388
+			"list": list,
389
+		})
390
+	}
391
+
392
+}
393
+
394
+func (this *OrgAPIController) GetNewDoctorNurseList() {
395
+	range_data := this.GetString("range_data")
396
+	var rangeDate *time.Time
397
+	var parseDateErr error
398
+	var rangeTimeStamp int64
399
+
400
+	if len(range_data) > 0 {
401
+		rangeDate, parseDateErr = utils.ParseTimeStringToTime("2006-01-02", range_data)
402
+		if parseDateErr != nil {
403
+			this.ErrorLog("日期(%v)解析错误:%v", range_data, parseDateErr)
404
+			return
405
+		}
406
+		rangeTimeStamp = rangeDate.Unix()
407
+	} else {
408
+		rangeTimeStamp = 0
409
+	}
410
+	now := time.Now().Unix()
411
+	list, err := service.GetNewDoctorNurseList(rangeTimeStamp, now)
412
+	if err != nil {
413
+	} else {
414
+		this.ServeSuccessJSON(map[string]interface{}{
415
+			"list": list,
416
+		})
417
+	}
418
+
419
+}
420
+
421
+func (this *OrgAPIController) GetNewPatientList() {
422
+	range_data := this.GetString("range_data")
423
+	var rangeDate *time.Time
424
+	var parseDateErr error
425
+	var rangeTimeStamp int64
426
+
427
+	if len(range_data) > 0 {
428
+		rangeDate, parseDateErr = utils.ParseTimeStringToTime("2006-01-02", range_data)
429
+		if parseDateErr != nil {
430
+			this.ErrorLog("日期(%v)解析错误:%v", range_data, parseDateErr)
431
+			return
432
+		}
433
+		rangeTimeStamp = rangeDate.Unix()
434
+	} else {
435
+		rangeTimeStamp = 0
436
+	}
437
+	now := time.Now().Unix()
438
+	list, err := service.GetNewPatientList(rangeTimeStamp, now)
439
+	if err != nil {
440
+	} else {
441
+		this.ServeSuccessJSON(map[string]interface{}{
442
+			"list": list,
443
+		})
444
+	}
445
+
446
+}

+ 23 - 0
service/org_service.go Dosyayı Görüntüle

@@ -708,7 +708,30 @@ type ActiveOrg struct {
708 708
 
709 709
 func GetActiveOrgList(from int64, to int64) (list []*ActiveOrg, err error) {
710 710
 	err = readUserDb.Raw("Select a.org_id as org_id, org.org_name as org_name from (Select org_id  from sgj_user_admin_login_log log  JOIN  (Select d.user_org_id from (Select new_role.user_org_id from  (Select count(*) as count,org_id as user_org_id from sgj_users.sgj_user_admin_role role  where  role.`user_type` = 2 OR role.`user_type` = 3 Group by role.org_id) new_role where new_role.count > 2) d  JOIN (Select user_org_id from (Select count(*) as count,user_org_id from sgj_xt.xt_patients  where  status = 1  Group by user_org_id) new_patient where new_patient.count > 3) c On d.user_org_id = c.user_org_id) new_user_org ON new_user_org.user_org_id = log.org_id where ctime >= ? AND ctime <= ?  Group by log.org_id) a JOIN sgj_users.sgj_user_org org On a.org_id = org.id", from, to).Scan(&list).Error
711
+	return
712
+}
711 713
 
714
+func GetNewCreateOrgList(from int64, to int64) (list []*ActiveOrg, err error) {
715
+	err = readUserDb.Raw("select org.id as org_id, org.org_name as org_name  from sgj_user_org org  where   org.status = 1 AND org.import <> 1 AND org.ctime >= ? AND org.ctime <= ?", from, to).Scan(&list).Error
712 716
 	return
717
+}
713 718
 
719
+type DoctorNurse struct {
720
+	Date   string `gorm:"date" json:"date"`
721
+	Mobile string `gorm:"mobile" json:"mobile"`
722
+}
723
+
724
+func GetNewDoctorNurseList(from int64, to int64) (list []*DoctorNurse, err error) {
725
+	err = readUserDb.Raw("select from_unixtime(log.`ctime`, '%Y-%m-%d %H:%m:%s') as date, admin.mobile as mobile from sgj_user_admin_login_log  log Join  `sgj_user_admin` admin on log.`admin_user_id` = admin.`id` Where log.`operate_type` = 1 and log.`app_type` = 3 and log.ctime >= ? and log.ctime <= ?", from, to).Scan(&list).Error
726
+	return
727
+}
728
+
729
+type Patient struct {
730
+	CreatedTime string `gorm:"created_time" json:"created_time"`
731
+	Name        string `gorm:"name" json:"name"`
732
+}
733
+
734
+func GetNewPatientList(from int64, to int64) (list []*Patient, err error) {
735
+	err = readDb.Raw("select name, from_unixtime(created_time, '%Y-%m-%d %H:%m:%s') as created_time from xt_patients where created_time >= ? AND created_time <= ? AND status = 1", from, to).Scan(&list).Error
736
+	return
714 737
 }