package new_mobile_api_controllers

import (
	"Xcx_New/controllers/mobile_api_controllers"
	"Xcx_New/enums"
	"Xcx_New/service"
	"Xcx_New/utils"
	"encoding/json"
	"fmt"
	"strconv"
	"time"
)

type NewCommonApiController struct {
	mobile_api_controllers.MobileBaseAPIAuthController
}

func (this *NewCommonApiController) GetTotalDialysis() {
	timeLayout := "2006-01-02"
	loc, _ := time.LoadLocation("Local")
	startime := this.GetString("startime")

	endtime := this.GetString("endtime")

	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
	startimes := startTimes.Unix()

	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
	endtimeData := endtimes.Unix()

	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id

	lapsetotype, _ := this.GetInt64("lapsetotype")
	sourcetype, _ := this.GetInt64("sourcetype")

	//统计透析总量
	total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid, lapsetotype, sourcetype)

	modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid, lapsetotype, sourcetype)

	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"total":    total,
		"modetype": modeType,
	})
}

func (this *NewCommonApiController) GetMobileTotalLapseCount() {
	startime, _ := this.GetInt64("startime")

	endtime, _ := this.GetInt64("endtime")

	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	lapsetotype, _ := this.GetInt64("lapsetotype")
	sourcetype, _ := this.GetInt64("sourcetype")
	//统计转出的病人
	patient, err := service.GetTotalRollOutPatients(orgid, startime, endtime, lapsetotype, sourcetype)

	patienttwo, err := service.GetTotalRollOutPatientsTwo(orgid, startime, endtime, lapsetotype, sourcetype)
	count := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
	//统计当前机构转出的人数
	rollout, err := service.GetCountRollout(orgid, startime, endtime, lapsetotype, sourcetype)
	fmt.Println("roullout", rollout)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"patient":    patient,
		"count":      count,
		"patienttwo": patienttwo,
		"rollout":    rollout,
	})
}

func (this *NewCommonApiController) GetMobileTotalSexCount() {
	//startime, _ := this.GetInt64("startime")
	//fmt.Println("startime", startime)
	//endtime, _ := this.GetInt64("endtime")
	//fmt.Println("endtime", endtime)
	lapsetotype, _ := this.GetInt64("lapsetotype")
	sourcetype, _ := this.GetInt64("sourcetype")
	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
	_, totalSex, err := service.GetManPatientTotal(orgid, lapsetotype, sourcetype)
	_, totalWoman, err := service.GetWoManPatientTotal(orgid, lapsetotype, sourcetype)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"total":      total,
		"totalSex":   totalSex,
		"totalWoman": totalWoman,
	})
}

func (this *NewCommonApiController) GetMobileTotalInfectiousCout() {
	startime, _ := this.GetInt64("startime")

	endtime, _ := this.GetInt64("endtime")

	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	lapsetotype, _ := this.GetInt64("lapsetotype")
	sourcetype, _ := this.GetInt64("sourcetype")

	//统计透析总人数
	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
	//统计透析人数传染病所占比例
	count, err := service.GetPatientInfectiousCount(orgid, startime, endtime, lapsetotype, sourcetype)
	//统计其他
	_, otherTotal, err := service.GetPatientOtherInfectious(orgid)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"total":      total,
		"count":      count,
		"otherTotal": otherTotal,
	})
}

func (this *NewCommonApiController) GetMobileTotalAgeCount() {
	//startime, _ := this.GetInt64("startime")
	//
	//endtime, _ := this.GetInt64("endtime")
	lapsetotype, _ := this.GetInt64("lapsetotype")
	sourcetype, _ := this.GetInt64("sourcetype")
	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
	agecount, err := service.GetTotalAgeCount(orgid, lapsetotype, sourcetype)
	//two, err := service.GetTotalAgeCountTwo(orgid, startime, endtime)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"total":    total,
		"ageCount": agecount,
	})
}

func (this *NewCommonApiController) GetMobileTotalDialysisCount() {
	//startime, _ := this.GetInt64("startime")
	//
	//endtime, _ := this.GetInt64("endtime")

	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	recordDateStr := time.Now().Format("2006-01-02")
	recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
	fmt.Println(parseDateErr)
	nowtime := recordDate.Unix()
	lapsetotype, _ := this.GetInt64("lapsetotype")
	sourcetype, _ := this.GetInt64("sourcetype")
	//统计透析总人数
	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
	//获取该机构下的所有病人数据
	ageData, err := service.GetDialysisAgeData(orgid, lapsetotype, sourcetype)

	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"total":   total,
		"ageData": ageData,
		"nowtime": nowtime,
	})
}

func (this *NewCommonApiController) GetMobilePatientList() {
	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	patients, err := service.GetCurentOrgPatients(orgid)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"patients": patients,
	})
}

func (this *NewCommonApiController) GetPrescriptionlist() {

	startime := this.GetString("startime")

	endtime := this.GetString("endtime")

	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	//endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
	//
	//entime := endDate.Unix()
	endtimeStr := endtime + " 23:59:59"
	endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
	entime := endtimeStrs.Unix()

	page, _ := this.GetInt64("page")

	limit, _ := this.GetInt64("limit")

	adminInfo := this.GetMobileAdminUserInfo()
	orgId := adminInfo.Org.Id
	count, _ := service.TotalDialysisCount(statime, entime, orgId)
	prescriptionList, _ := service.GetAllDialysisList(statime, entime, orgId)
	list, totallist, err := service.GetDialysisPatientList(statime, entime, page, limit, orgId)
	modeIdCount, parseDateErr := service.GetModeIdCount(statime, entime, orgId, page, 1000)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"list":             list,
		"totallist":        totallist,
		"prescriptionList": prescriptionList,
		"count":            count,
		"modeIdCount":      modeIdCount,
	})
}

func (this *NewCommonApiController) GetMobilePatientDetail() {
	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	id, _ := this.GetInt64("id")

	startime := this.GetString("startime")

	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)

	entime := endDate.Unix()

	fmt.Println(endtime)
	limit, _ := this.GetInt64("limit")

	page, _ := this.GetInt64("page")

	patients, total, err := service.GetDialysisDetailById(id, orgId, statime, entime, limit, page)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"patients": patients,
		"total":    total,
	})
}

func (this *NewCommonApiController) ToSearchPatient() {
	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	//keyword := this.GetString("keyword")
	patientid, _ := this.GetInt64("patientid")
	startime := this.GetString("startime")

	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)

	entime := endDate.Unix()

	limit, _ := this.GetInt64("limit")

	page, _ := this.GetInt64("page")

	patient, total, err := service.GetPrescritionByName(orgId, patientid, statime, entime, limit, page)

	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"patient": patient,
		"total":   total,
	})
}

func (this *NewCommonApiController) GetAllPatientsMode() {
	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	startime := this.GetString("startime")

	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
	entime := endDate.Unix()

	value, _ := this.GetInt64("value")

	limit, _ := this.GetInt64("limit")

	page, _ := this.GetInt64("page")

	modeId, _ := this.GetInt64("mode_id")

	treatinfo, total, err := service.GetTreateInfo(orgId, statime, entime, value, limit, page)
	statistics, ttd, err := service.GetStatistics(orgId, statime, entime, modeId)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"statistics": statistics,
		"ttd":        ttd,
		"total":      total,
		"treatinfo":  treatinfo,
	})
}

func (this *NewCommonApiController) GetMobileInspectionList() {
	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	startime := this.GetString("startime")

	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	secondQuarterEndStr := endtime + " 23:59:59"
	secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
	entime := secondQuarterEnds.Unix()

	patientid, _ := this.GetInt64("patientid")
	references, err := service.GetInspectionTotalCount(orgid)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}

	counts, err := service.GetInspectionProjectCount(orgid, statime, entime, patientid)

	this.ServeSuccessJSON(map[string]interface{}{
		"Inspection": references,
		"counts":     counts,
	})
}

func (this *NewCommonApiController) GetPatientInspectionDetail() {
	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	id, _ := this.GetInt64("id")

	startime := this.GetString("startime")
	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	//endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
	//entime := endDate.Unix()
	//fmt.Println("结束日期", entime)
	secondQuarterEndStr := endtime + " 23:59:59"
	secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
	entime := secondQuarterEnds.Unix()
	patientdetail, err := service.GetInspectionDetailById(id, orgId, statime, entime)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"patientdetail": patientdetail,
	})
}

func (this *NewCommonApiController) GetSeachPatientDetail() {
	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	//keyword := this.GetString("keyword")
	//fmt.Println("keyword", keyword)
	patientid, _ := this.GetInt64("patientid")
	startime := this.GetString("startime")
	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	//endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
	//entime := endDate.Unix()
	//fmt.Println("结束日期", entime)
	secondQuarterEndStr := endtime + " 23:59:59"
	secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
	entime := secondQuarterEnds.Unix()
	PatientsInfo, err := service.GetSearchPatientInfo(orgId, patientid, statime, entime)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"PatientsInfo": PatientsInfo,
	})
}

func (this *NewCommonApiController) GetMobileNormdata() {

	adminInfo := this.GetMobileAdminUserInfo()
	orgid := adminInfo.Org.Id
	//获取系统数据
	normdata, err := service.GetNormDataByOrgId(orgid)
	bloodPressure, err := service.GetDefaultBloodPressure(orgid)
	//if len(normdata) == 0 {
	//	normdata, err := service.GetNormData(0)
	//	if err != nil {
	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
	//		return
	//	}
	//	this.ServeSuccessJSON(map[string]interface{}{
	//		"normdata": normdata,
	//	})
	//}
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"normdata":      normdata,
		"bloodPressure": bloodPressure,
	})
}

func (this *NewCommonApiController) GetMobileProjectlsit() {

	adminInfo := this.GetMobileAdminUserInfo()
	orgid := adminInfo.Org.Id
	fmt.Println("orgid", orgid)
	lapseto, _ := this.GetInt64("lapseto")
	fmt.Println("专柜", lapseto)
	itemtype, _ := this.GetInt64("itemtype")
	fmt.Println("itemtype", itemtype)
	modetype, _ := this.GetInt64("modeltype")
	fmt.Println(modetype)

	firstQuarterStart := this.GetString("first_quarter_start")
	firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
	firstQuarterStartUnix := firstQuarterStartStr.Unix()

	fisrtQuarterEnd := this.GetString("first_qurter_end")
	fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
	fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
	fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()

	secondeQuarterStart := this.GetString("second_qurter_start")
	secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
	secondeQuarterStartUnix := secondeQuarterStartStr.Unix()

	secondQuarterEnd := this.GetString("second_qurter_end")
	secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
	secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
	secondQuarterEndStrUnix := secondQuarterEnds.Unix()

	threeQuarterStart := this.GetString("three_qurter_start")
	threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
	threeQuarterStartUnix := threeQuarterStartStr.Unix()

	threeQuarterEnd := this.GetString("three_qurter_end")
	threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
	threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
	threeQuarterEndStrUnix := threeQuarterEnds.Unix()

	fourQuarterStart := this.GetString("four_qurter_start")
	fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
	fourQuarterStartUnix := fourQuarterStartStr.Unix()

	fourQuarterEnd := this.GetString("four_qurter_end")
	fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
	//fmt.Println("第四季度结束时间", fourQuarterEndStrUnix)
	rangetype, _ := this.GetInt64("range_type")
	//按季度统计
	if rangetype == 1 {
		//统计总共
		list, err := service.GetProjectList(orgid, lapseto, modetype, firstQuarterStartUnix, fourQuarterEndStrUnix, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
		//统计达标个数
		standList, err := service.GetProjectStandList(orgid, lapseto, modetype, firstQuarterStartUnix, fourQuarterEndStrUnix, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}

		this.ServeSuccessJSON(map[string]interface{}{
			"list":      list,
			"standList": standList,
		})
		return
	}

	if rangetype == 2 {
		list, err := service.GetProjectListOne(orgid, lapseto, modetype, firstQuarterStartUnix, fourQuarterEndStrUnix, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
		//统计达标个数
		standList, err := service.GetProjectStandListOne(orgid, lapseto, modetype, firstQuarterStartUnix, fourQuarterEndStrUnix, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}

		this.ServeSuccessJSON(map[string]interface{}{
			"list":      list,
			"standList": standList,
		})
		return
	}
}

func (this *NewCommonApiController) GetMobileFirstQuarter() {

	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	lapseto, _ := this.GetInt64("lapseto")
	fmt.Println("转归", lapseto)
	startime := this.GetString("startime")

	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	endtime := this.GetString("endtime")

	endTimeYMDHmsStr := endtime + " 23:59:59"
	endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
	entime := endDate.Unix()

	count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto)
	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
	//获取收缩压数据
	systolic, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
	//统计收缩压合格的数据
	//systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)

	//获取舒张压数据
	diastolic, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
	//获取合格舒张压数据
	//diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
	normData, _ := service.GetNormDataByOrgId(orgid)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"count":         count,
		"countwo":       countwo,
		"systolic":      systolic,
		"systolicTotal": systolicTotal,
		"diastolic":     diastolic,
		"diastotal":     diastotal,
		"normData":      normData,
	})
}

func (this *NewCommonApiController) GetMobileMonthProjectList() {
	adminInfo := this.GetMobileAdminUserInfo()
	orgid := adminInfo.Org.Id
	lapseto, _ := this.GetInt64("lapseto")

	itemtype, _ := this.GetInt64("itemtype")
	fmt.Println("itemtype", itemtype)
	modetype, _ := this.GetInt64("modeltype")

	januaryStart := this.GetString("januaryStart")

	januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
	januaryStartStrUnix := januaryStartStr.Unix()

	januaryEnd := this.GetString("januaryEnd")

	januaryEndStr := januaryEnd + " 23:59:59"
	januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
	januaryEndStrUnix := januaryEndStrs.Unix()

	febStart := this.GetString("febStart")

	febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
	febStartStrStrUnix := febStartStr.Unix()

	febEnd := this.GetString("febEnd")

	febEndStr := febEnd + " 23:59:59"
	febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
	febEndStrUnix := febEndStrs.Unix()

	marchStart := this.GetString("marchStart")

	marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
	marchStartStrUnix := marchStartStr.Unix()

	marchEnd := this.GetString("marchEnd")

	marchEndStr := marchEnd + " 23:59:59"
	marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
	marchEndStrUnix := marchEndStrs.Unix()

	aprStart := this.GetString("aprStart")

	aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
	aprStartStrUnix := aprStartStr.Unix()

	aprEnd := this.GetString("aprEnd")

	aprEndStr := aprEnd + " 23:59:59"
	aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
	aprEndStrsUnix := aprEndStrs.Unix()

	mayStart := this.GetString("mayStart")

	mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
	mayStartStrUnix := mayStartStr.Unix()

	mayEnd := this.GetString("mayEnd")

	mayEndStr := mayEnd + " 23:59:59"
	mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
	mayEndStrsUnix := mayEndStrs.Unix()

	junStart := this.GetString("junStart")

	junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
	junStartStrUnix := junStartStr.Unix()

	junEnd := this.GetString("junEnd")

	junEndStr := junEnd + " 23:59:59"
	junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
	junEndStrsUnix := junEndStrs.Unix()

	julStart := this.GetString("julStart")

	julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
	julStartStrUnix := julStartStr.Unix()

	julEnd := this.GetString("julEnd")

	julEndStr := julEnd + " 23:59:59"
	julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
	julEndStrsUnix := julEndStrs.Unix()

	augStart := this.GetString("augStart")

	augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
	augStartStrUnix := augStartStr.Unix()

	augEnd := this.GetString("augEnd")

	augEndStr := augEnd + " 23:59:59"
	augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
	augEndStrsUnix := augEndStrs.Unix()

	sepStart := this.GetString("sepStart")

	sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
	sepStartStrUnix := sepStartStr.Unix()
	fmt.Println("九月使", sepStartStrUnix)
	sepEnd := this.GetString("sepEnd")

	sepEndStr := sepEnd + " 23:59:59"
	sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
	sepEndStrsUnix := sepEndStrs.Unix()

	octStart := this.GetString("octStart")

	octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
	octStartStrUnix := octStartStr.Unix()

	octEnd := this.GetString("octEnd")

	octEndStr := octEnd + " 23:59:59"
	octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
	octEndStrsUnix := octEndStrs.Unix()

	novStart := this.GetString("novStart")
	//fmt.Println("11月始", novStart)
	novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
	novStartStrUnix := novStartStr.Unix()

	novEnd := this.GetString("novEnd")

	novEndStr := novEnd + " 23:59:59"
	novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
	novEndStrsUnix := novEndStrs.Unix()

	decStart := this.GetString("decStart")

	decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
	decStartStrUnix := decStartStr.Unix()

	decEnd := this.GetString("decEnd")

	decEndStr := decEnd + " 23:59:59"
	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
	decEndStrsUnix := decEndStrs.Unix()

	range_type, _ := this.GetInt64("range_type")
	if range_type == 1 {
		//统计总共
		monthlist, err := service.GetMonthProjectList(orgid, lapseto, modetype, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
		//统计不合格
		monthNolist, err := service.GetMonthProjectListTwo(orgid, lapseto, modetype, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}

		this.ServeSuccessJSON(map[string]interface{}{
			"monthlist":   monthlist,
			"monthNolist": monthNolist,
		})
	}
	if range_type == 2 {
		//统计总共
		monthlist, err := service.GetMonthProjectList(orgid, lapseto, modetype, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
		//统计不合格
		monthNolist, err := service.GetMonthProjectListThree(orgid, lapseto, modetype, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}

		this.ServeSuccessJSON(map[string]interface{}{
			"monthlist":   monthlist,
			"monthNolist": monthNolist,
		})
	}

}

func (this *NewCommonApiController) GetAllMobileMajorInspection() {
	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	inspection, err := service.GetMajorInspectionByOrgid(orgid)
	if len(inspection) == 0 {
		inspect, err := service.GetDefaultByOrgId(0)
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}
		this.ServeSuccessJSON(map[string]interface{}{
			"inspection": inspect,
		})
	} else {
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}
		this.ServeSuccessJSON(map[string]interface{}{
			"inspection": inspection,
		})
	}
}

func (this *NewCommonApiController) GetMobilePatient() {
	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	startime := this.GetString("startime")
	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()
	//fmt.Println("开始时间", statime)
	//endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
	//entime := endDate.Unix()
	//fmt.Println("结束日期", entime)
	decEndStr := endtime + " 23:59:59"
	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
	entime := decEndStrs.Unix()
	limit, _ := this.GetInt64("limit")
	//fmt.Println("limit", limit)
	page, _ := this.GetInt64("page")
	//fmt.Println("page", page)
	patientInfo, total, err := service.GetPatientListData(orgid, statime, entime, limit, page)
	info, _ := service.GetPatientListInfo(orgid, statime, entime, limit, page)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"patientInfo": patientInfo,
		"total":       total,
		"list":        info,
	})
}

func (this *NewCommonApiController) GetMobilePatientDetailCheck() {

	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id
	id, _ := this.GetInt64("id")
	startime := this.GetString("startime")
	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()
	//fmt.Println("开始时间", statime)
	//endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
	//entime := endDate.Unix()
	//fmt.Println("结束日期", entime)
	secondQuarterEndStr := endtime + " 23:59:59"
	secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
	entime := secondQuarterEnds.Unix()
	checkDetail, err := service.GetPatientDetailCheck(id, orgid, statime, entime)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"checkDetail": checkDetail,
	})
}

func (this *NewCommonApiController) GetMobilePatientControl() {
	adminInfo := this.GetMobileAdminUserInfo()
	orgid := adminInfo.Org.Id
	lapstor, _ := this.GetInt64("lapstor")
	//fmt.Println("lapstor", lapstor)
	startime := this.GetString("startime")

	startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
	startimeStrUnix := startimeStr.Unix()

	endtime := this.GetString("endtime")

	endtimeStr := endtime + " 23:59:59"
	endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
	endtimeStrsUnix := endtimeStrs.Unix()

	page, _ := this.GetInt64("page")

	limit, _ := this.GetInt64("limit")

	patients, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)

	control, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
	//获取最后一次数据
	//统计传染病类型
	infectiousControl, err := service.GetInfectiousControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}

	this.ServeSuccessJSON(map[string]interface{}{
		"patients":          patients,
		"total":             total,
		"control":           control,
		"infectiousControl": infectiousControl,
	})
}

func (this *NewCommonApiController) GetMobileCartogramlist() {
	adminInfo := this.GetMobileAdminUserInfo()
	orgid := adminInfo.Org.Id
	//lapstor, _ := this.GetInt64("lapstor")
	//fmt.Println("lapstor", lapstor)
	startime := this.GetString("startime")

	startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
	startimeStrUnix := startimeStr.Unix()

	endtime := this.GetString("endtime")

	endtimeStr := endtime + " 23:59:59"
	endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
	endtimeStrsUnix := endtimeStrs.Unix()
	fmt.Println("结束时间搓", endtimeStrsUnix)
	//统计总共
	_, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)

	_, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)

	_, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)

	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}

	this.ServeSuccessJSON(map[string]interface{}{
		"total":         total,
		"standtotal":    standtotal,
		"standtotalOne": standtotalOne,
	})
}

func (this *NewCommonApiController) GetMobileQualityControl() {
	adminInfo := this.GetMobileAdminUserInfo()
	orgid := adminInfo.Org.Id

	patientid, _ := this.GetInt64("patientid")

	startime, _ := this.GetInt64("startime")

	endtime, _ := this.GetInt64("endtime")

	itemid, _ := this.GetInt64("itemid")

	inspectdate, _ := this.GetInt64("inspectdate")
	list, err := service.GetQualityControlById(orgid, patientid, startime, endtime, itemid, inspectdate)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}

	this.ServeSuccessJSON(map[string]interface{}{

		"list": list,
	})
}

func (this *NewCommonApiController) GetSeachPatientsControl() {
	adminUser := this.GetMobileAdminUserInfo()
	orgid := adminUser.Org.Id

	id, _ := this.GetInt64("id")

	startime := this.GetString("startime")

	startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
	startimeStrUnix := startimeStr.Unix()

	endtime := this.GetString("endtime")

	endtimeStr := endtime + " 23:59:59"
	endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
	endtimeStrsUnix := endtimeStrs.Unix()

	control, err := service.GetLastPatientsControlTwo(orgid, id, startimeStrUnix, endtimeStrsUnix)

	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}

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

func (this *NewCommonApiController) GetMobileTreatlist() {
	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	startime := this.GetString("startime")

	endtime := this.GetString("endtime")
	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
	fmt.Println("parseDateErr", parseDateErr)
	statime := startDate.Unix()

	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
	entime := endDate.Unix()

	value, _ := this.GetInt64("value")

	list, err := service.GetTreatList(orgId, statime, entime, value)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}

	this.ServeSuccessJSON(map[string]interface{}{

		"list": list,
	})
}

func (this *NewCommonApiController) GetPatientComplianceDetail() {
	adminInfo := this.GetMobileAdminUserInfo()
	orgid := adminInfo.Org.Id

	patientid, _ := this.GetInt64("patientid")

	startime, _ := this.GetInt64("startime")

	endtime, _ := this.GetInt64("endtime")

	itemid, _ := this.GetInt64("itemid")

	list, err := service.GetPatientComplianceDetail(orgid, patientid, startime, endtime, itemid)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}

	this.ServeSuccessJSON(map[string]interface{}{

		"list": list,
	})
}

func (this *NewCommonApiController) GetMoblieBloodList() {
	adminInfo := this.GetMobileAdminUserInfo()
	orgId := adminInfo.Org.Id
	bloodType, _ := this.GetInt64("bloodType")
	fmt.Println(bloodType)
	firstQuarterStart := this.GetString("first_quarter_start")
	firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
	firstQuarterStartUnix := firstQuarterStartStr.Unix()
	fmt.Println("第一季度", firstQuarterStartUnix)
	fisrtQuarterEnd := this.GetString("first_qurter_end")
	fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
	fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
	fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
	fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
	secondeQuarterStart := this.GetString("second_qurter_start")
	secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
	secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
	fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
	secondQuarterEnd := this.GetString("second_qurter_end")
	secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
	secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
	secondQuarterEndStrUnix := secondQuarterEnds.Unix()
	fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)

	threeQuarterStart := this.GetString("three_qurter_start")
	threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
	threeQuarterStartUnix := threeQuarterStartStr.Unix()
	fmt.Println("第三季度", threeQuarterStartUnix)
	threeQuarterEnd := this.GetString("three_qurter_end")
	threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
	threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
	threeQuarterEndStrUnix := threeQuarterEnds.Unix()
	fmt.Println("第三季度", threeQuarterEndStrUnix)
	fourQuarterStart := this.GetString("four_qurter_start")
	fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
	fourQuarterStartUnix := fourQuarterStartStr.Unix()
	fmt.Println("第四季度", fourQuarterStartUnix)
	fourQuarterEnd := this.GetString("four_qurter_end")
	fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
	fmt.Println("第四季度", fourQuarterEndStrUnix)
	if bloodType == -1 {
		//统计收缩压第一季度的总数
		firstlist, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
		//统计收缩压第一季合格的总数
		//_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
		//统计第二季收缩压总数
		secondelist, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
		//第二季度合格总数
		//_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
		//统计第三季收缩压总数
		threelist, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
		//第三季度合格数
		//_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
		//第四季度总数
		fourlist, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
		//第四季度合格总数
		//_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}

		this.ServeSuccessJSON(map[string]interface{}{
			"firstTotal":   firstTotal,
			"firstlist":    firstlist,
			"secondeTotal": secondeTotal,
			"secondelist":  secondelist,
			"threeTotal":   threeTotal,
			"threelist":    threelist,
			"fourTotal":    fourTotal,
			"fourlist":     fourlist,
		})
	}
	if bloodType == -2 {
		//统计舒张压第一季度的总数
		firstlist, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
		//_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
		secondelist, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
		//_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
		threelist, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
		//_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
		fourlist, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
		//_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)

		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}

		this.ServeSuccessJSON(map[string]interface{}{
			"firstTotal":   firstTotal,
			"firstlist":    firstlist,
			"secondeTotal": secondeTotal,
			"secondelist":  secondelist,
			"threeTotal":   threeTotal,
			"threelist":    threelist,
			"fourTotal":    fourTotal,
			"fourlist":     fourlist,
		})
	}
}

func (this *NewCommonApiController) GetBloodMonthList() {
	bloodtype, _ := this.GetInt64("bloodType")
	fmt.Println(bloodtype)
	januaryStart := this.GetString("januaryStart")

	januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
	januaryStartStrUnix := januaryStartStr.Unix()
	fmt.Println(januaryStartStrUnix)
	januaryEnd := this.GetString("januaryEnd")

	januaryEndStr := januaryEnd + " 23:59:59"
	januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
	januaryEndStrUnix := januaryEndStrs.Unix()
	fmt.Println(januaryEndStrUnix)
	febStart := this.GetString("febStart")

	febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
	febStartStrStrUnix := febStartStr.Unix()
	fmt.Println(febStartStrStrUnix)
	febEnd := this.GetString("febEnd")

	febEndStr := febEnd + " 23:59:59"
	febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
	febEndStrUnix := febEndStrs.Unix()
	fmt.Println(febEndStrUnix)
	marchStart := this.GetString("marchStart")

	marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
	marchStartStrUnix := marchStartStr.Unix()
	fmt.Println(marchStartStrUnix)
	marchEnd := this.GetString("marchEnd")

	marchEndStr := marchEnd + " 23:59:59"
	marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
	marchEndStrUnix := marchEndStrs.Unix()
	fmt.Println(marchEndStrUnix)
	aprStart := this.GetString("aprStart")

	aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
	aprStartStrUnix := aprStartStr.Unix()
	fmt.Println(aprStartStrUnix)
	aprEnd := this.GetString("aprEnd")

	aprEndStr := aprEnd + " 23:59:59"
	aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
	aprEndStrsUnix := aprEndStrs.Unix()
	fmt.Println(aprEndStrsUnix)
	mayStart := this.GetString("mayStart")

	mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
	mayStartStrUnix := mayStartStr.Unix()
	fmt.Println(mayStartStrUnix)
	mayEnd := this.GetString("mayEnd")

	mayEndStr := mayEnd + " 23:59:59"
	mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
	mayEndStrsUnix := mayEndStrs.Unix()
	fmt.Println(mayEndStrsUnix)
	junStart := this.GetString("junStart")

	junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
	junStartStrUnix := junStartStr.Unix()
	fmt.Println(junStartStrUnix)
	junEnd := this.GetString("junEnd")

	junEndStr := junEnd + " 23:59:59"
	junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
	junEndStrsUnix := junEndStrs.Unix()
	fmt.Println(junEndStrsUnix)
	julStart := this.GetString("julStart")

	julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
	julStartStrUnix := julStartStr.Unix()
	fmt.Println(julStartStrUnix)
	julEnd := this.GetString("julEnd")

	julEndStr := julEnd + " 23:59:59"
	julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
	julEndStrsUnix := julEndStrs.Unix()
	fmt.Println(julEndStrsUnix)
	augStart := this.GetString("augStart")

	augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
	augStartStrUnix := augStartStr.Unix()
	fmt.Print(augStartStrUnix)
	augEnd := this.GetString("augEnd")

	augEndStr := augEnd + " 23:59:59"
	augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
	augEndStrsUnix := augEndStrs.Unix()
	fmt.Println(augEndStrsUnix)
	sepStart := this.GetString("sepStart")

	sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
	sepStartStrUnix := sepStartStr.Unix()
	fmt.Println(sepStartStrUnix)
	sepEnd := this.GetString("sepEnd")

	sepEndStr := sepEnd + " 23:59:59"
	sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
	sepEndStrsUnix := sepEndStrs.Unix()
	fmt.Println(sepEndStrsUnix)
	octStart := this.GetString("octStart")

	octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
	octStartStrUnix := octStartStr.Unix()
	fmt.Println(octStartStrUnix)
	octEnd := this.GetString("octEnd")

	octEndStr := octEnd + " 23:59:59"
	octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
	octEndStrsUnix := octEndStrs.Unix()
	fmt.Println(octEndStrsUnix)
	novStart := this.GetString("novStart")

	novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
	novStartStrUnix := novStartStr.Unix()
	fmt.Println(novStartStrUnix)
	novEnd := this.GetString("novEnd")

	novEndStr := novEnd + " 23:59:59"
	novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
	novEndStrsUnix := novEndStrs.Unix()
	fmt.Println(novEndStrsUnix)
	decStart := this.GetString("decStart")

	decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
	decStartStrUnix := decStartStr.Unix()
	fmt.Println("12月使", decStartStrUnix)
	decEnd := this.GetString("decEnd")

	decEndStr := decEnd + " 23:59:59"
	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
	decEndStrsUnix := decEndStrs.Unix()
	fmt.Println(decEndStrsUnix)

	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id

	//统计收缩压
	if bloodtype == -1 {
		//统计收缩压一月总数
		januarylist, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
		//_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)

		//二月
		feblist, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
		//_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)

		//三月
		marlist, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
		//_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)

		//四月
		aprlist, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
		//_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)

		//五月
		maylist, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
		//_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)

		//六月
		junlist, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
		//_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
		//7月
		jullist, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
		//_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)

		//8月
		auglist, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
		//_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)

		//9月
		seplist, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
		//_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
		//10月
		octlist, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
		//_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
		//11月
		novlist, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
		//_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
		//12月
		declist, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
		//_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}

		this.ServeSuccessJSON(map[string]interface{}{
			"januaryTotal": januaryTotal,
			"januarylist":  januarylist,
			"febTotal":     febTotal,
			"feblist":      feblist,
			"marchTotal":   marchTotal,
			"marlist":      marlist,
			"aprTotal":     aprTotal,
			"aprlist":      aprlist,
			"mayTotal":     mayTotal,
			"maylist":      maylist,
			"junTotal":     junTotal,
			"junlist":      junlist,
			"julTotal":     julTotal,
			"jullist":      jullist,
			"augTotal":     augTotal,
			"auglist":      auglist,
			"sepTotal":     sepTotal,
			"seplist":      seplist,
			"octTotal":     octTotal,
			"octlist":      octlist,
			"novTotal":     novTotal,
			"novlist":      novlist,
			"decTotal":     decTotal,
			"declist":      declist,
		})
	}

	//统计舒张压
	if bloodtype == -2 {
		//统计收缩压一月总数
		januarylist, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
		//_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)

		//二月
		feblist, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
		//_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)

		//三月
		marlist, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
		//_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)

		//四月
		aprlist, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
		//_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)

		//五月
		maylist, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
		//_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)

		//六月
		junlist, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
		//_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
		//7月
		jullist, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
		//_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)

		//8月
		auglist, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
		//_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)

		//9月
		seplist, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
		//_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
		//10月
		octlist, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
		//_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
		//11月
		novlist, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
		//_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
		//12月
		declist, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
		//_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
		if err != nil {
			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
			return
		}

		this.ServeSuccessJSON(map[string]interface{}{
			"januaryTotal": januaryTotal,
			"januarylist":  januarylist,
			"febTotal":     febTotal,
			"feblist":      feblist,
			"marchTotal":   marchTotal,
			"marlist":      marlist,
			"aprTotal":     aprTotal,
			"aprlist":      aprlist,
			"mayTotal":     mayTotal,
			"maylist":      maylist,
			"junTotal":     junTotal,
			"junlist":      junlist,
			"julTotal":     julTotal,
			"jullist":      jullist,
			"augTotal":     augTotal,
			"auglist":      auglist,
			"sepTotal":     sepTotal,
			"seplist":      seplist,
			"octTotal":     octTotal,
			"octlist":      octlist,
			"novTotal":     novTotal,
			"novlist":      novlist,
			"decTotal":     decTotal,
			"declist":      declist,
		})
	}
}

func (this *NewCommonApiController) GetQuarterTargeList() {
	adminInfo := this.GetMobileAdminUserInfo()
	orgId := adminInfo.Org.Id
	fmt.Println(orgId)
	firstQuarterStart := this.GetString("first_quarter_start")
	firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
	firstQuarterStartUnix := firstQuarterStartStr.Unix()
	fmt.Println("第一季度", firstQuarterStartUnix)
	fisrtQuarterEnd := this.GetString("first_qurter_end")
	fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
	fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
	fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
	fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
	secondeQuarterStart := this.GetString("second_qurter_start")
	secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
	secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
	fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
	secondQuarterEnd := this.GetString("second_qurter_end")
	secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
	secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
	secondQuarterEndStrUnix := secondQuarterEnds.Unix()
	fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)

	threeQuarterStart := this.GetString("three_qurter_start")
	threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
	threeQuarterStartUnix := threeQuarterStartStr.Unix()
	fmt.Println("第三季度", threeQuarterStartUnix)
	threeQuarterEnd := this.GetString("three_qurter_end")
	threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
	threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
	threeQuarterEndStrUnix := threeQuarterEnds.Unix()
	fmt.Println("第三季度", threeQuarterEndStrUnix)
	fourQuarterStart := this.GetString("four_qurter_start")
	fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
	fourQuarterStartUnix := fourQuarterStartStr.Unix()
	fmt.Println("第四季度", fourQuarterStartUnix)
	fourQuarterEnd := this.GetString("four_qurter_end")
	fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
	fmt.Println("第四季度", fourQuarterEndStrUnix)

	//统计指标合格的
	stand, err := service.GetQuarterTargeStand(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
	//统计不合格的
	noStand, err := service.GetQuarterTargeNoStand(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}

	//统计阴阳性合格的
	contagionTargeStand, err := service.GetContagionQuarterTargeStand(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
	//统计阴阳性不合格的
	contagionTargeNoStand, err := service.GetContagionTargeNoStand(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)

	this.ServeSuccessJSON(map[string]interface{}{
		"stand":                 stand,
		"noStand":               noStand,
		"contagionTargeStand":   contagionTargeStand,
		"contagionTargeNoStand": contagionTargeNoStand,
	})
}

func (this *NewCommonApiController) GetMonthTarget() {

	adminInfo := this.GetMobileAdminUserInfo()
	orgId := adminInfo.Org.Id
	fmt.Println(orgId)

	januaryStart := this.GetString("januaryStart")
	januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
	januaryStartStrUnix := januaryStartStr.Unix()

	januaryEnd := this.GetString("januaryEnd")
	januaryEndStr := januaryEnd + " 23:59:59"
	januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
	januaryEndStrUnix := januaryEndStrs.Unix()

	febStart := this.GetString("febStart")
	febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
	febStartStrStrUnix := febStartStr.Unix()

	febEnd := this.GetString("febEnd")
	febEndStr := febEnd + " 23:59:59"
	febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
	febEndStrUnix := febEndStrs.Unix()

	marchStart := this.GetString("marchStart")
	marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
	marchStartStrUnix := marchStartStr.Unix()
	marchEnd := this.GetString("marchEnd")

	marchEndStr := marchEnd + " 23:59:59"
	marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
	marchEndStrUnix := marchEndStrs.Unix()

	aprStart := this.GetString("aprStart")
	aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
	aprStartStrUnix := aprStartStr.Unix()

	aprEnd := this.GetString("aprEnd")
	aprEndStr := aprEnd + " 23:59:59"
	aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
	aprEndStrsUnix := aprEndStrs.Unix()

	mayStart := this.GetString("mayStart")

	mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
	mayStartStrUnix := mayStartStr.Unix()

	mayEnd := this.GetString("mayEnd")

	mayEndStr := mayEnd + " 23:59:59"
	mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
	mayEndStrsUnix := mayEndStrs.Unix()

	junStart := this.GetString("junStart")

	junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
	junStartStrUnix := junStartStr.Unix()

	junEnd := this.GetString("junEnd")

	junEndStr := junEnd + " 23:59:59"
	junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
	junEndStrsUnix := junEndStrs.Unix()

	julStart := this.GetString("julStart")

	julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
	julStartStrUnix := julStartStr.Unix()

	julEnd := this.GetString("julEnd")

	julEndStr := julEnd + " 23:59:59"
	julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
	julEndStrsUnix := julEndStrs.Unix()

	augStart := this.GetString("augStart")

	augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
	augStartStrUnix := augStartStr.Unix()

	augEnd := this.GetString("augEnd")

	augEndStr := augEnd + " 23:59:59"
	augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
	augEndStrsUnix := augEndStrs.Unix()

	sepStart := this.GetString("sepStart")

	sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
	sepStartStrUnix := sepStartStr.Unix()
	fmt.Println("九月使", sepStartStrUnix)
	sepEnd := this.GetString("sepEnd")

	sepEndStr := sepEnd + " 23:59:59"
	sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
	sepEndStrsUnix := sepEndStrs.Unix()

	octStart := this.GetString("octStart")

	octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
	octStartStrUnix := octStartStr.Unix()

	octEnd := this.GetString("octEnd")

	octEndStr := octEnd + " 23:59:59"
	octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
	octEndStrsUnix := octEndStrs.Unix()

	novStart := this.GetString("novStart")
	//fmt.Println("11月始", novStart)
	novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
	novStartStrUnix := novStartStr.Unix()

	novEnd := this.GetString("novEnd")

	novEndStr := novEnd + " 23:59:59"
	novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
	novEndStrsUnix := novEndStrs.Unix()

	decStart := this.GetString("decStart")

	decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
	decStartStrUnix := decStartStr.Unix()

	decEnd := this.GetString("decEnd")

	decEndStr := decEnd + " 23:59:59"
	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
	decEndStrsUnix := decEndStrs.Unix()

	//统计指标合格的
	stand, err := service.GetMonthTargetStand(orgId, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
	//统计不合格的指标
	nostand, err := service.GetMonthTargetNoStand(orgId, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)

	//统计传染类型合格的指标
	contagionTargeStand, err := service.GetMonthcontagionTargeStand(orgId, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
	//统计传染类型不合格的指标
	contagionTargeNoStand, err := service.GetMonthcontagionTargeNoStand(orgId, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"stand":                 stand,
		"nostand":               nostand,
		"contagionTargeStand":   contagionTargeStand,
		"contagionTargeNoStand": contagionTargeNoStand,
	})
}

func (this *NewCommonApiController) GetQuarterBloodList() {

	adminInfo := this.GetMobileAdminUserInfo()
	orgId := adminInfo.Org.Id
	fmt.Println(orgId)
	firstQuarterStart := this.GetString("first_quarter_start")
	firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
	firstQuarterStartUnix := firstQuarterStartStr.Unix()
	fmt.Println("第一季度", firstQuarterStartUnix)
	fisrtQuarterEnd := this.GetString("first_qurter_end")
	fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
	fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
	fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
	fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
	secondeQuarterStart := this.GetString("second_qurter_start")
	secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
	secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
	fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
	secondQuarterEnd := this.GetString("second_qurter_end")
	secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
	secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
	secondQuarterEndStrUnix := secondQuarterEnds.Unix()
	fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)

	threeQuarterStart := this.GetString("three_qurter_start")
	threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
	threeQuarterStartUnix := threeQuarterStartStr.Unix()
	fmt.Println("第三季度", threeQuarterStartUnix)
	threeQuarterEnd := this.GetString("three_qurter_end")
	threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
	threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
	threeQuarterEndStrUnix := threeQuarterEnds.Unix()
	fmt.Println("第三季度", threeQuarterEndStrUnix)
	fourQuarterStart := this.GetString("four_qurter_start")
	fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
	fourQuarterStartUnix := fourQuarterStartStr.Unix()
	fmt.Println("第四季度", fourQuarterStartUnix)
	fourQuarterEnd := this.GetString("four_qurter_end")
	fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
	fmt.Println("第四季度", fourQuarterEndStrUnix)

	//获取一季度透析检测数据
	firtstlist, err := service.GetQuarterBloodList(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
	//获取第二季度透析监测数据
	secondlist, err := service.GetQuarterBloodList(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
	//获取第三季度透析监测数据
	threelist, err := service.GetQuarterBloodList(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
	//获取第二季度透析监测数据
	fourlist, err := service.GetQuarterBloodList(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)

	bloodPressure, err := service.GetDefaultBloodPressure(orgId)

	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"firtstlist":    firtstlist,
		"secondlist":    secondlist,
		"threelist":     threelist,
		"fourlist":      fourlist,
		"bloodPressure": bloodPressure,
	})

}

func (this *NewCommonApiController) GetMonthBLoodList() {

	adminInfo := this.GetMobileAdminUserInfo()
	orgId := adminInfo.Org.Id
	fmt.Println(orgId)

	januaryStart := this.GetString("januaryStart")
	januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
	januaryStartStrUnix := januaryStartStr.Unix()

	januaryEnd := this.GetString("januaryEnd")
	januaryEndStr := januaryEnd + " 23:59:59"
	januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
	januaryEndStrUnix := januaryEndStrs.Unix()

	febStart := this.GetString("febStart")
	febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
	febStartStrStrUnix := febStartStr.Unix()

	febEnd := this.GetString("febEnd")
	febEndStr := febEnd + " 23:59:59"
	febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
	febEndStrUnix := febEndStrs.Unix()

	marchStart := this.GetString("marchStart")
	marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
	marchStartStrUnix := marchStartStr.Unix()
	marchEnd := this.GetString("marchEnd")

	marchEndStr := marchEnd + " 23:59:59"
	marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
	marchEndStrUnix := marchEndStrs.Unix()

	aprStart := this.GetString("aprStart")
	aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
	aprStartStrUnix := aprStartStr.Unix()

	aprEnd := this.GetString("aprEnd")
	aprEndStr := aprEnd + " 23:59:59"
	aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
	aprEndStrsUnix := aprEndStrs.Unix()

	mayStart := this.GetString("mayStart")

	mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
	mayStartStrUnix := mayStartStr.Unix()

	mayEnd := this.GetString("mayEnd")

	mayEndStr := mayEnd + " 23:59:59"
	mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
	mayEndStrsUnix := mayEndStrs.Unix()

	junStart := this.GetString("junStart")

	junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
	junStartStrUnix := junStartStr.Unix()

	junEnd := this.GetString("junEnd")

	junEndStr := junEnd + " 23:59:59"
	junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
	junEndStrsUnix := junEndStrs.Unix()

	julStart := this.GetString("julStart")

	julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
	julStartStrUnix := julStartStr.Unix()

	julEnd := this.GetString("julEnd")

	julEndStr := julEnd + " 23:59:59"
	julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
	julEndStrsUnix := julEndStrs.Unix()

	augStart := this.GetString("augStart")

	augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
	augStartStrUnix := augStartStr.Unix()

	augEnd := this.GetString("augEnd")

	augEndStr := augEnd + " 23:59:59"
	augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
	augEndStrsUnix := augEndStrs.Unix()

	sepStart := this.GetString("sepStart")

	sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
	sepStartStrUnix := sepStartStr.Unix()
	fmt.Println("九月使", sepStartStrUnix)
	sepEnd := this.GetString("sepEnd")

	sepEndStr := sepEnd + " 23:59:59"
	sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
	sepEndStrsUnix := sepEndStrs.Unix()

	octStart := this.GetString("octStart")

	octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
	octStartStrUnix := octStartStr.Unix()

	octEnd := this.GetString("octEnd")

	octEndStr := octEnd + " 23:59:59"
	octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
	octEndStrsUnix := octEndStrs.Unix()

	novStart := this.GetString("novStart")
	//fmt.Println("11月始", novStart)
	novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
	novStartStrUnix := novStartStr.Unix()

	novEnd := this.GetString("novEnd")

	novEndStr := novEnd + " 23:59:59"
	novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
	novEndStrsUnix := novEndStrs.Unix()

	decStart := this.GetString("decStart")

	decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
	decStartStrUnix := decStartStr.Unix()

	decEnd := this.GetString("decEnd")

	decEndStr := decEnd + " 23:59:59"
	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
	decEndStrsUnix := decEndStrs.Unix()

	//获取一月透析检测数据
	januaryList, err := service.GetQuarterBloodList(orgId, januaryStartStrUnix, januaryEndStrUnix)

	//获取二月透析监测数据
	febList, err := service.GetQuarterBloodList(orgId, febStartStrStrUnix, febEndStrUnix)
	//获取三月透析监测数据
	marList, err := service.GetQuarterBloodList(orgId, marchStartStrUnix, marchEndStrUnix)
	//4月
	aprList, err := service.GetQuarterBloodList(orgId, aprStartStrUnix, aprEndStrsUnix)
	//5月
	mayList, err := service.GetQuarterBloodList(orgId, mayStartStrUnix, mayEndStrsUnix)
	//6月
	junList, err := service.GetQuarterBloodList(orgId, junStartStrUnix, junEndStrsUnix)
	//7月
	julList, err := service.GetQuarterBloodList(orgId, julStartStrUnix, julEndStrsUnix)
	//8月
	augList, err := service.GetQuarterBloodList(orgId, augStartStrUnix, augEndStrsUnix)
	//9月
	sepList, err := service.GetQuarterBloodList(orgId, sepStartStrUnix, sepEndStrsUnix)
	//10月
	octList, err := service.GetQuarterBloodList(orgId, octStartStrUnix, octEndStrsUnix)
	//11月
	novList, err := service.GetQuarterBloodList(orgId, novStartStrUnix, novEndStrsUnix)
	//12月
	decList, err := service.GetQuarterBloodList(orgId, decStartStrUnix, decEndStrsUnix)

	bloodPressure, err := service.GetDefaultBloodPressure(orgId)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"januaryList":   januaryList,
		"febList":       febList,
		"marList":       marList,
		"aprList":       aprList,
		"mayList":       mayList,
		"junList":       junList,
		"julList":       julList,
		"augList":       augList,
		"sepList":       sepList,
		"octList":       octList,
		"novList":       novList,
		"decList":       decList,
		"bloodPressure": bloodPressure,
	})
}

func (this *NewCommonApiController) GetTargetNoStandDetail() {

	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	fmt.Println("orgID", orgId)
	timeLayout := "2006-01-02"
	loc, _ := time.LoadLocation("Local")
	startime := this.GetString("startime")
	endtime := this.GetString("endtime")
	limit, _ := this.GetInt64("limit")
	fmt.Println("limit", limit)
	page, _ := this.GetInt64("page")
	fmt.Println("page", page)

	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
	startimeUnix := startTimes.Unix()
	fmt.Println(startimeUnix)

	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
	endtimeUnix := endtimes.Unix()
	fmt.Println(endtimeUnix)

	//获取未达标的详情页病人列表
	inspectlist, err := service.GetTaregetNoStandDetail(orgId, startimeUnix, endtimeUnix)
	//获取传染病类型为达标
	configurationlist, err := service.GetConfigurationNoStandDetail(orgId, startimeUnix, endtimeUnix)

	list, err := service.GetInspectNoStandList(orgId, startimeUnix, endtimeUnix, limit, page)
	//分页
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"inspectlist":       inspectlist,
		"configurationlist": configurationlist,
		"list":              list,
	})
}

func (this *NewCommonApiController) GetTargetStandDetail() {

	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	fmt.Println("orgID", orgId)
	timeLayout := "2006-01-02"
	loc, _ := time.LoadLocation("Local")
	startime := this.GetString("startime")
	endtime := this.GetString("endtime")
	limit, _ := this.GetInt64("limit")
	fmt.Println("limit", limit)
	page, _ := this.GetInt64("page")
	fmt.Println("page", page)
	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
	startimeUnix := startTimes.Unix()
	fmt.Println(startimeUnix)

	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
	endtimeUnix := endtimes.Unix()
	fmt.Println(endtimeUnix)
	//获取达标数据
	standlist, err := service.GetTargetStandDetail(orgId, startimeUnix, endtimeUnix)

	//获取达标数据
	confstandlist, err := service.GetConfigurationStandDetail(orgId, startimeUnix, endtimeUnix)

	//分页
	inspectlist, err := service.GetStandList(orgId, startimeUnix, endtimeUnix, limit, page)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"standlist":     standlist,
		"confstandlist": confstandlist,
		"inspectlist":   inspectlist,
	})
}

func (this *NewCommonApiController) GetSystolicBloodStand() {

	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	fmt.Println("orgID", orgId)
	timeLayout := "2006-01-02"
	loc, _ := time.LoadLocation("Local")
	startime := this.GetString("startime")
	endtime := this.GetString("endtime")
	limit, _ := this.GetInt64("limit")
	fmt.Println("limit", limit)
	page, _ := this.GetInt64("page")
	fmt.Println("page", page)
	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
	startimeUnix := startTimes.Unix()
	fmt.Println(startimeUnix)
	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
	endtimeUnix := endtimes.Unix()
	fmt.Println(endtimeUnix)

	//获取数据
	//recordList, err := service.GetDiastolicStand(orgId, startimeUnix, endtimeUnix,page,limit)
	bloodPressure, err := service.GetDefaultBloodPressure(orgId)
	var sysMin string
	var sysLarge string
	var diaMin string
	var diaLarge string
	for index, value := range bloodPressure {
		fmt.Println("index", index)
		if value.InspectionMajor == 0 && value.InspectionMinor == -1 {
			sysMin = value.MinRange
			sysLarge = value.LargeRange
		}
		if value.InspectionMajor == 0 && value.InspectionMinor == -2 {
			diaMin = value.MinRange
			diaLarge = value.LargeRange
		}
	}
	sysmin, err := strconv.ParseInt(sysMin, 10, 64)
	syslarge, err := strconv.ParseInt(sysLarge, 10, 64)
	diamin, err := strconv.ParseInt(diaMin, 10, 64)
	dialarge, err := strconv.ParseInt(diaLarge, 10, 64)
	recordtwo, err := service.TotalSysStandCountTwo(orgId, startimeUnix, endtimeUnix, sysmin, syslarge, diamin, dialarge)
	record, err := service.TotalSysStandCount(orgId, startimeUnix, endtimeUnix, sysmin, syslarge, diamin, dialarge, page, limit)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"record":        record,
		"bloodPressure": bloodPressure,
		"recordtwo":     recordtwo,
	})
}

func (this *NewCommonApiController) GetMobileIdsList() {
	dataBody := make(map[string]interface{}, 0)
	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
	fmt.Println(err)
	admin := this.GetMobileAdminUserInfo()
	orgId := admin.Org.Id
	patientid, _ := this.GetInt64("patientid")
	idlist := dataBody["ids"].([]interface{})

	var vlist []interface{}
	for _, contagion := range idlist {
		id := int64(contagion.(float64))
		list, _ := service.GetInspectionMoninList(id, orgId, patientid)
		vlist = append(vlist, list)
	}
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"vlist": vlist,
	})
}

func (this *NewCommonApiController) GetSystolicBloodNoStand() {
	adminUser := this.GetMobileAdminUserInfo()
	orgId := adminUser.Org.Id
	fmt.Println("orgID", orgId)
	timeLayout := "2006-01-02"
	loc, _ := time.LoadLocation("Local")
	startime := this.GetString("startime")
	endtime := this.GetString("endtime")
	limit, _ := this.GetInt64("limit")
	fmt.Println("limit", limit)
	page, _ := this.GetInt64("page")
	fmt.Println("page", page)
	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
	startimeUnix := startTimes.Unix()
	fmt.Println(startimeUnix)
	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
	endtimeUnix := endtimes.Unix()
	fmt.Println(endtimeUnix)

	//获取数据
	//recordList, err := service.GetDiastolicStand(orgId, startimeUnix, endtimeUnix,page,limit)
	bloodPressure, err := service.GetDefaultBloodPressure(orgId)
	var sysMin string
	var sysLarge string
	var diaMin string
	var diaLarge string
	for index, value := range bloodPressure {
		fmt.Println("index", index)
		if value.InspectionMajor == 0 && value.InspectionMinor == -1 {
			sysMin = value.MinRange
			sysLarge = value.LargeRange
		}
		if value.InspectionMajor == 0 && value.InspectionMinor == -2 {
			diaMin = value.MinRange
			diaLarge = value.LargeRange
		}
	}
	sysmin, err := strconv.ParseInt(sysMin, 10, 64)
	syslarge, err := strconv.ParseInt(sysLarge, 10, 64)
	diamin, err := strconv.ParseInt(diaMin, 10, 64)
	dialarge, err := strconv.ParseInt(diaLarge, 10, 64)

	recoredtwo, err := service.TotalSysNoStandCountTwo(orgId, startimeUnix, endtimeUnix, sysmin, syslarge, diamin, dialarge)
	record, err := service.TotalSysNoStandCount(orgId, startimeUnix, endtimeUnix, sysmin, syslarge, diamin, dialarge, page, limit)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"record":        record,
		"bloodPressure": bloodPressure,
		"recoredtwo":    recoredtwo,
	})
}

func (this *NewCommonApiController) GetMobileTreatModeList() {

	timeLayout := "2006-01-02"
	loc, _ := time.LoadLocation("Local")
	startime := this.GetString("start_time")
	endtime := this.GetString("end_time")
	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
	startimes := startTimes.Unix()

	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
	endtimeData := endtimes.Unix()
	adminUserInfo := this.GetMobileAdminUserInfo()
	orgid := adminUserInfo.Org.Id
	list, err := service.GetTreatModeList(startimes, endtimeData, orgid)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"list": list,
	})
}

func (this *NewCommonApiController) GetMobileCountModeId() {

	timeLayout := "2006-01-02"
	loc, _ := time.LoadLocation("Local")
	startime := this.GetString("start_time")
	endtime := this.GetString("end_time")
	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
	startimes := startTimes.Unix()

	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
	endtimeData := endtimes.Unix()
	mode_id, _ := this.GetInt64("mode_id")

	adminUserInfo := this.GetMobileAdminUserInfo()
	orgId := adminUserInfo.Org.Id

	modeCount, err := service.GetCountModeId(startimes, endtimeData, mode_id, orgId)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"modeCount": modeCount,
	})
}

func (this *NewCommonApiController) GetMobileRolloutCount() {

	timeLayout := "2006-01-02"
	loc, _ := time.LoadLocation("Local")
	startime := this.GetString("start_time")
	endtime := this.GetString("end_time")
	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
	startimes := startTimes.Unix()

	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
	endtimeData := endtimes.Unix()

	adminUserInfo := this.GetMobileAdminUserInfo()
	orgId := adminUserInfo.Org.Id
	lapsetotype, _ := this.GetInt64("lapsetotype")
	sourcetype, _ := this.GetInt64("sourcetype")
	//统计当前机构转出的人数
	rollout, err := service.GetCountRollout(orgId, startimes, endtimeData, lapsetotype, sourcetype)

	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"rollout": rollout,
	})
}
