Browse Source

耗材参数

XMLWAN 4 years ago
parent
commit
fe7aedd4c7

+ 61 - 2
controllers/new_mobile_api_controllers/common_api_controller.go View File

@@ -544,11 +544,10 @@ func (this *CommonApiController) GetTotalLapseCount() {
544 544
 	startime := this.GetString("startime")
545 545
 	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
546 546
 	startnunix := startTimes.Unix()
547
-	fmt.Println("开始时间---------------", startnunix)
548 547
 	endtime := this.GetString("endtime")
549 548
 	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
550 549
 	endunix := endtimes.Unix()
551
-	fmt.Println("endunix==========", endunix)
550
+
552 551
 	//统计该机构的转出人数
553 552
 	patients, err := service.GetTotalRollOutPatients(orgid, startnunix, endunix)
554 553
 	//统计该机构转出病人
@@ -558,10 +557,14 @@ func (this *CommonApiController) GetTotalLapseCount() {
558 557
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
559 558
 		return
560 559
 	}
560
+
561
+	//统计当前机构转出的人数
562
+	rollout, err := service.GetCountRollout(orgid, startnunix, endunix)
561 563
 	this.ServeSuccessJSON(map[string]interface{}{
562 564
 		"patients":   patients,
563 565
 		"count":      count,
564 566
 		"patienttwo": patienttwo,
567
+		"rollout":    rollout,
565 568
 	})
566 569
 }
567 570
 
@@ -2059,3 +2062,59 @@ func (this *CommonApiController) GetIdsListTwo() {
2059 2062
 	})
2060 2063
 
2061 2064
 }
2065
+
2066
+func (this *CommonApiController) GetTreatModeList() {
2067
+
2068
+	start_time, _ := this.GetInt64("start_time")
2069
+	end_time, _ := this.GetInt64("end_time")
2070
+	adminUserInfo := this.GetAdminUserInfo()
2071
+	orgId := adminUserInfo.CurrentOrgId
2072
+	list, err := service.GetTreatModeList(start_time, end_time, orgId)
2073
+	if err != nil {
2074
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2075
+		return
2076
+	}
2077
+	this.ServeSuccessJSON(map[string]interface{}{
2078
+		"list": list,
2079
+	})
2080
+}
2081
+
2082
+func (this *CommonApiController) GetCountModeId() {
2083
+
2084
+	start_time, _ := this.GetInt64("start_time")
2085
+	end_time, _ := this.GetInt64("end_time")
2086
+	mode_id, _ := this.GetInt64("mode_id")
2087
+	adminUserInfo := this.GetAdminUserInfo()
2088
+	orgId := adminUserInfo.CurrentOrgId
2089
+	fmt.Println("start_time", start_time)
2090
+	fmt.Println("end_time", end_time)
2091
+	fmt.Println("mode_id", mode_id)
2092
+
2093
+	modeCount, err := service.GetCountModeId(start_time, end_time, mode_id, orgId)
2094
+	if err != nil {
2095
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2096
+		return
2097
+	}
2098
+	this.ServeSuccessJSON(map[string]interface{}{
2099
+		"modeCount": modeCount,
2100
+	})
2101
+}
2102
+
2103
+func (this *CommonApiController) GetRolloutCount() {
2104
+
2105
+	start_time, _ := this.GetInt64("start_time")
2106
+	end_time, _ := this.GetInt64("end_time")
2107
+	adminUserInfo := this.GetAdminUserInfo()
2108
+	orgId := adminUserInfo.CurrentOrgId
2109
+
2110
+	//统计当前机构转出的人数
2111
+	rollout, err := service.GetCountRollout(orgId, start_time, end_time)
2112
+
2113
+	if err != nil {
2114
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2115
+		return
2116
+	}
2117
+	this.ServeSuccessJSON(map[string]interface{}{
2118
+		"rollout": rollout,
2119
+	})
2120
+}

+ 3 - 0
controllers/new_mobile_api_controllers/common_api_router.go View File

@@ -56,4 +56,7 @@ func CommonApiControllersRegisterRouters() {
56 56
 	beego.Router("/com/api/getbloodpressurelist", &CommonApiController{}, "Get:GetBloodPressureList")
57 57
 	beego.Router("/com/api/getmonthbloodlist", &CommonApiController{}, "Get:GetMonthBloodList")
58 58
 	beego.Router("/com/api/getidslist", &CommonApiController{}, "Post:GetIdsListTwo")
59
+	beego.Router("/com/api/getreatmodelist", &CommonApiController{}, "Get:GetTreatModeList")
60
+	beego.Router("/com/api/getcountmodeid", &CommonApiController{}, "Get:GetCountModeId")
61
+	beego.Router("/com/api/getrolloutcount", &CommonApiController{}, "Get:GetRolloutCount")
59 62
 }

+ 75 - 0
controllers/new_mobile_api_controllers/new_common_api_controller.go View File

@@ -2059,3 +2059,78 @@ func (this *NewCommonApiController) GetSystolicBloodNoStand() {
2059 2059
 		"recoredtwo":    recoredtwo,
2060 2060
 	})
2061 2061
 }
2062
+
2063
+func (this *NewCommonApiController) GetMobileTreatModeList() {
2064
+
2065
+	timeLayout := "2006-01-02"
2066
+	loc, _ := time.LoadLocation("Local")
2067
+	startime := this.GetString("start_time")
2068
+	endtime := this.GetString("end_time")
2069
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
2070
+	startimes := startTimes.Unix()
2071
+
2072
+	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
2073
+	endtimeData := endtimes.Unix()
2074
+	adminUserInfo := this.GetMobileAdminUserInfo()
2075
+	orgid := adminUserInfo.Org.Id
2076
+	list, err := service.GetTreatModeList(startimes, endtimeData, orgid)
2077
+	if err != nil {
2078
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2079
+		return
2080
+	}
2081
+	this.ServeSuccessJSON(map[string]interface{}{
2082
+		"list": list,
2083
+	})
2084
+}
2085
+
2086
+func (this *NewCommonApiController) GetMobileCountModeId() {
2087
+
2088
+	timeLayout := "2006-01-02"
2089
+	loc, _ := time.LoadLocation("Local")
2090
+	startime := this.GetString("start_time")
2091
+	endtime := this.GetString("end_time")
2092
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
2093
+	startimes := startTimes.Unix()
2094
+
2095
+	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
2096
+	endtimeData := endtimes.Unix()
2097
+	mode_id, _ := this.GetInt64("mode_id")
2098
+
2099
+	adminUserInfo := this.GetMobileAdminUserInfo()
2100
+	orgId := adminUserInfo.Org.Id
2101
+
2102
+	modeCount, err := service.GetCountModeId(startimes, endtimeData, mode_id, orgId)
2103
+	if err != nil {
2104
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2105
+		return
2106
+	}
2107
+	this.ServeSuccessJSON(map[string]interface{}{
2108
+		"modeCount": modeCount,
2109
+	})
2110
+}
2111
+
2112
+func (this *NewCommonApiController) GetMobileRolloutCount() {
2113
+
2114
+	timeLayout := "2006-01-02"
2115
+	loc, _ := time.LoadLocation("Local")
2116
+	startime := this.GetString("start_time")
2117
+	endtime := this.GetString("end_time")
2118
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
2119
+	startimes := startTimes.Unix()
2120
+
2121
+	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
2122
+	endtimeData := endtimes.Unix()
2123
+
2124
+	adminUserInfo := this.GetMobileAdminUserInfo()
2125
+	orgId := adminUserInfo.Org.Id
2126
+	//统计当前机构转出的人数
2127
+	rollout, err := service.GetCountRollout(orgId, startimes, endtimeData)
2128
+	fmt.Println("rollout============", rollout)
2129
+	if err != nil {
2130
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2131
+		return
2132
+	}
2133
+	this.ServeSuccessJSON(map[string]interface{}{
2134
+		"rollout": rollout,
2135
+	})
2136
+}

+ 3 - 0
controllers/new_mobile_api_controllers/new_common_api_router.go View File

@@ -42,4 +42,7 @@ func NewCommonApiControllersRegisterRouters() {
42 42
 	beego.Router("/m/api/getsystolicbloodstand", &NewCommonApiController{}, "Get:GetSystolicBloodStand")
43 43
 	beego.Router("/m/api/getmobileidslist", &NewCommonApiController{}, "post:GetMobileIdsList")
44 44
 	beego.Router("/m/api/getsystolicbloodnostand", &NewCommonApiController{}, "Get:GetSystolicBloodNoStand")
45
+	beego.Router("/m/api/getmobiletreatmodelist", &NewCommonApiController{}, "Get:GetMobileTreatModeList")
46
+	beego.Router("/m/api/getmobileCountModeId", &NewCommonApiController{}, "Get:GetMobileCountModeId")
47
+	beego.Router("/m/api/getmobilerolloutcount", &NewCommonApiController{}, "Get:GetMobileRolloutCount")
45 48
 }

+ 13 - 0
models/common_models.go View File

@@ -580,3 +580,16 @@ type BloodDialysisModeIdCount struct {
580 580
 	ModeId    int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
581 581
 	Count     int64
582 582
 }
583
+
584
+type BloodTreateModeIdCount struct {
585
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
586
+	Count        int64
587
+	DialysisDate int64 `gorm:"column:dialysis_date" json:"dialysis_date" form:"dialysis_date"`
588
+}
589
+
590
+type BloodLapsetoCount struct {
591
+	ID          int64 `gorm:"column:id" json:"id" form:"id"`
592
+	Count       int64
593
+	LapsetoTime int64 `gorm:"column:lapseto_time" json:"lapseto_time" form:"lapseto_time"`
594
+	LapsetoType int64 `gorm:"column:lapseto_type" json:"lapseto_type" form:"lapseto_type"`
595
+}

+ 53 - 0
service/common_service.go View File

@@ -3336,3 +3336,56 @@ func GetModeIdCount(startime int64, endtime int64, orgid int64, page int64, limi
3336 3336
 	err = db.Group(" s.patient_id,s.mode_id").Select("s.mode_id,	s.patient_id,	count(o.id) as count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1 ").Scan(&order).Error
3337 3337
 	return order, err
3338 3338
 }
3339
+
3340
+func GetTreatModeList(startime int64, endtime int64, orgid int64) (order []*models.BloodDialysisModeIdCount, err error) {
3341
+
3342
+	table := XTReadDB().Table("xt_schedule as s")
3343
+	fmt.Println("table", table)
3344
+	db := XTReadDB().Table("xt_dialysis_order as o")
3345
+	if orgid > 0 {
3346
+		db = db.Where("o.user_org_id = ?", orgid)
3347
+	}
3348
+	if startime > 0 {
3349
+		db = db.Where("o.dialysis_date>=?", startime)
3350
+	}
3351
+	if endtime > 0 {
3352
+		db = db.Where("o.dialysis_date<=?", endtime)
3353
+	}
3354
+	err = db.Group("s.mode_id").Select("s.mode_id,	s.patient_id").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1 ").Scan(&order).Error
3355
+	return order, err
3356
+
3357
+}
3358
+
3359
+func GetCountModeId(startime int64, endtime int64, modeid int64, orgid int64) (order []*models.BloodTreateModeIdCount, err error) {
3360
+
3361
+	table := XTReadDB().Table("xt_schedule as s")
3362
+	fmt.Println("table", table)
3363
+	db := XTReadDB().Table("xt_dialysis_order as o")
3364
+	if orgid > 0 {
3365
+		db = db.Where("o.user_org_id = ?", orgid)
3366
+	}
3367
+	if startime > 0 {
3368
+		db = db.Where("o.dialysis_date>=?", startime)
3369
+	}
3370
+	if endtime > 0 {
3371
+		db = db.Where("o.dialysis_date<=?", endtime)
3372
+	}
3373
+	err = db.Group("o.dialysis_date,s.mode_id").Select("s.mode_id,	count(s.mode_id) as count,o.dialysis_date").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1 and s.mode_id = ? and o.dialysis_date <> ''", modeid).Scan(&order).Error
3374
+	return order, err
3375
+
3376
+}
3377
+
3378
+func GetCountRollout(orgid int64, startime int64, endtime int64) (lapseto []*models.BloodLapsetoCount, err error) {
3379
+
3380
+	table := XTReadDB().Table("xt_patients as s")
3381
+	fmt.Println(table)
3382
+	db := XTReadDB().Table("xt_patient_lapseto as x").Where("x.status = 1")
3383
+	if startime > 0 {
3384
+		db = db.Where("x.lapseto_time >=?", startime)
3385
+	}
3386
+	if endtime > 0 {
3387
+		db = db.Where("x.lapseto_time<=?", endtime)
3388
+	}
3389
+	err = db.Group("x.lapseto_time,x.lapseto_type").Select("count(x.id) as count,x.lapseto_type,x.lapseto_time").Joins("left join xt_patients as s  on s.id = x.patient_id").Where("s.user_org_id = ?", orgid).Scan(&lapseto).Error
3390
+	return lapseto, err
3391
+}