package admin_api_controllers

import (
	"XT_Admin_Api/service"
)

type OrgAPIController struct {
	AdminBaseAPIAuthController
}

func (this *OrgAPIController) GetOrgList() {
	//active_status,_ := this.GetInt64("active_status")
	//depth_active_status,_ := this.GetInt64("depth_active_status")
	//start_time := this.GetString("start_time")
	//end_time := this.GetString("end_time")
	//province,_ := this.GetInt64("province")
	//city,_ := this.GetInt64("city")
	//district,_ := this.GetInt64("district")
	//follow,_ := this.GetInt64("follow")
	//keyword := this.GetString("keyword")
	//page, _ := this.GetInt64("page", 0)
	//limit, _ := this.GetInt64("limit", 0)
	//
	//if page <= 0 {
	//	page = 1
	//}
	//if limit <= 0 {
	//	limit = 10
	//}
	//adminInfo := this.GetAdminInfo()
	//if adminInfo.Admin.IsSuperAdmin == 1 {
	//	list, err, total := service.GetAllOrgList(active_status,depth_active_status,start_time,end_time,province,city,district,follow,keyword,page,limit)
	//	if err != nil {
	//
	//	} else {
	//		this.ServeSuccessJSON(map[string]interface{}{
	//			"list": list,
	//			"total":total,
	//		})
	//
	//	}
	//} else {
	//
	//
	//
	//}

}


func (this *OrgAPIController) GetOrgDetail() {
	org_id, _:=this.GetInt64("org_id",0)
	info, err := service.GetOrgDetailInfo(org_id)
	if err != nil {

	} else {
		this.ServeSuccessJSON(map[string]interface{}{
			"info": info,
		})
	}
}



func (this *OrgAPIController) GetOrgDialysisOrderStatistics() {
	//org_id, _:=this.GetInt64("org_id",0)
	//range_data := this.GetString("range_data")
	//range_type, _ := this.GetInt64("range_type")
	//statistics_type, _ := this.GetInt64("type")
	//
	//
	//var rangeDate *time.Time
	//var parseDateErr error
	//var rangeTimeStamp int64
	//
	//if len(range_data) > 0 {
	//	rangeDate, parseDateErr = utils.ParseTimeStringToTime("2006-01-02", range_data)
	//	if parseDateErr != nil {
	//		this.ErrorLog("日期(%v)解析错误：%v", range_data, parseDateErr)
	//		return
	//	}
	//	rangeTimeStamp = rangeDate.Unix()
	//} else {
	//	rangeTimeStamp = 0
	//}
	//now := time.Now().Unix()
	//
	//info, err := service.GetOrgNewPatientInfo(org_id)
	//if err != nil {
	//
	//} else {
	//	this.ServeSuccessJSON(map[string]interface{}{
	//		"info": info,
	//	})
	//}
}

func (c *OrgAPIController) GetDistrictsByUpid() {
	id, _ := c.GetInt64("id", 0)
	citys, _ := service.GetDistrictsByUpid(id)

	c.ServeSuccessJSON(map[string]interface{}{
		"citys": citys,
	})
	return
}


func (this *OrgAPIController)GetInitData(){
	provinces, _ := service.GetDistrictsByUpid(0)
	this.ServeSuccessJSON(map[string]interface{}{
		"provinces": provinces,
	})
}
