Procházet zdrojové kódy

Merge branch 'xt_statistics_branch' of http://git.shengws.com/csx/XT_New into xt_statistics_branch

csx před 4 roky
rodič
revize
787d9d7a9e

+ 1 - 1
controllers/data_api_controller.go Zobrazit soubor

@@ -228,7 +228,7 @@ func (c *DataApiController) UpdateChildConfig() {
228 228
 	//	dataconfig.Order = 0
229 229
 	//}
230 230
 	configOrgId := int64(dataBody["org_id"].(float64))
231
-
231
+	fmt.Println("configOrgId=========================", configOrgId)
232 232
 	// 验证关键字段的值是否重复
233 233
 	// configId := int64(dataBody["id"].(float64))
234 234
 	// thisConfig,_:=service.FindConfigByNameForUpdate(dataconfig.Module, dataconfig.Name,dataconfig.ParentId,dataconfig.OrgId,configId)

+ 51 - 13
controllers/new_mobile_api_controllers/common_api_controller.go Zobrazit soubor

@@ -215,6 +215,10 @@ func (this *CommonApiController) UpdateConfiguration() {
215 215
 		Sort:            sort,
216 216
 		RangeValue:      rangvalue,
217 217
 		RangeType:       rangtype,
218
+		Status:          1,
219
+		UserOrgId:       orgId,
220
+		CreatedTime:     time.Now().Unix(),
221
+		UpdatedTime:     time.Now().Unix(),
218 222
 	}
219 223
 	err = service.UpdarteConfiguration(&standard, id)
220 224
 	if err != nil {
@@ -224,6 +228,7 @@ func (this *CommonApiController) UpdateConfiguration() {
224 228
 	this.ServeSuccessJSON(map[string]interface{}{
225 229
 		"standard": standard,
226 230
 	})
231
+
227 232
 }
228 233
 
229 234
 func (this *CommonApiController) DeleteConfiguration() {
@@ -950,7 +955,7 @@ func (this *CommonApiController) GetFirstQuarter() {
950 955
 	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
951 956
 	fmt.Println("parseDateErr", parseDateErr)
952 957
 	statime := startDate.Unix()
953
-	fmt.Println("开始时间=====================================", statime)
958
+	fmt.Println("开始时间", statime)
954 959
 	endtime := this.GetString("endtime")
955 960
 	fmt.Println("endtime", endtime)
956 961
 	endTimeYMDHmsStr := endtime + " 23:59:59"
@@ -1054,6 +1059,20 @@ func (this *CommonApiController) GetProjectList() {
1054 1059
 		})
1055 1060
 	}
1056 1061
 
1062
+	if rangetype == 2 {
1063
+		list, err := service.GetProjectListOne(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
1064
+		//统计达标个数
1065
+		standList, err := service.GetProjectStandListOne(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
1066
+		if err != nil {
1067
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1068
+			return
1069
+		}
1070
+
1071
+		this.ServeSuccessJSON(map[string]interface{}{
1072
+			"list":      list,
1073
+			"standList": standList,
1074
+		})
1075
+	}
1057 1076
 }
1058 1077
 
1059 1078
 func (this *CommonApiController) GetMonthProjectList() {
@@ -1210,20 +1229,39 @@ func (this *CommonApiController) GetMonthProjectList() {
1210 1229
 	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
1211 1230
 	decEndStrsUnix := decEndStrs.Unix()
1212 1231
 	fmt.Println("12月末", decEndStrsUnix)
1213
-	//统计总共
1214
-	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)
1215
-	//统计不合格
1216
-	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)
1217
-	fmt.Println("monthnolist=====", monthNolist)
1218
-	if err != nil {
1219
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1220
-		return
1232
+	rangetype, _ := this.GetInt64("range_type")
1233
+	fmt.Println("range_type", rangetype)
1234
+	if rangetype == 1 {
1235
+		//统计总共
1236
+		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)
1237
+		//统计不合格
1238
+		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)
1239
+		fmt.Println("monthnolist", monthNolist)
1240
+		if err != nil {
1241
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1242
+			return
1243
+		}
1244
+
1245
+		this.ServeSuccessJSON(map[string]interface{}{
1246
+			"monthlist":   monthlist,
1247
+			"monthNolist": monthNolist,
1248
+		})
1249
+	}
1250
+
1251
+	if rangetype == 2 {
1252
+		monthlist, err := service.GetMonthProjectListOne(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)
1253
+		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)
1254
+		if err != nil {
1255
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1256
+			return
1257
+		}
1258
+
1259
+		this.ServeSuccessJSON(map[string]interface{}{
1260
+			"monthlist":   monthlist,
1261
+			"monthNolist": monthNolist,
1262
+		})
1221 1263
 	}
1222 1264
 
1223
-	this.ServeSuccessJSON(map[string]interface{}{
1224
-		"monthlist":   monthlist,
1225
-		"monthNolist": monthNolist,
1226
-	})
1227 1265
 }
1228 1266
 
1229 1267
 func (this *CommonApiController) GetPatientscontrol() {

+ 52 - 16
controllers/new_mobile_api_controllers/new_common_api_controller.go Zobrazit soubor

@@ -193,6 +193,7 @@ func (this *NewCommonApiController) GetPrescriptionlist() {
193 193
 	fmt.Println("limit", limit)
194 194
 	adminInfo := this.GetMobileAdminUserInfo()
195 195
 	orgId := adminInfo.Org.Id
196
+	count, _ := service.TotalDialysisCount(statime, entime, orgId)
196 197
 	prescriptionList, _ := service.GetAllDialysisList(statime, entime, orgId)
197 198
 	list, totallist, err := service.GetDialysisPatientList(statime, entime, page, limit, orgId)
198 199
 	if err != nil {
@@ -203,6 +204,7 @@ func (this *NewCommonApiController) GetPrescriptionlist() {
203 204
 		"list":             list,
204 205
 		"totallist":        totallist,
205 206
 		"prescriptionList": prescriptionList,
207
+		"count":            count,
206 208
 	})
207 209
 }
208 210
 
@@ -469,9 +471,9 @@ func (this *NewCommonApiController) GetMobileProjectlsit() {
469 471
 	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
470 472
 	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
471 473
 	//fmt.Println("第四季度结束时间", fourQuarterEndStrUnix)
472
-
474
+	rangetype, _ := this.GetInt64("range_type")
473 475
 	//按季度统计
474
-	if itemtype == 1 {
476
+	if rangetype == 1 {
475 477
 		//统计总共
476 478
 		list, err := service.GetProjectList(orgid, lapseto, modetype, firstQuarterStartUnix, fourQuarterEndStrUnix, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
477 479
 		//统计达标个数
@@ -486,6 +488,21 @@ func (this *NewCommonApiController) GetMobileProjectlsit() {
486 488
 			"standList": standList,
487 489
 		})
488 490
 	}
491
+
492
+	if rangetype == 2 {
493
+		list, err := service.GetProjectListOne(orgid, lapseto, modetype, firstQuarterStartUnix, fourQuarterEndStrUnix, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
494
+		//统计达标个数
495
+		standList, err := service.GetProjectStandListOne(orgid, lapseto, modetype, firstQuarterStartUnix, fourQuarterEndStrUnix, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
496
+		if err != nil {
497
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
498
+			return
499
+		}
500
+
501
+		this.ServeSuccessJSON(map[string]interface{}{
502
+			"list":      list,
503
+			"standList": standList,
504
+		})
505
+	}
489 506
 }
490 507
 
491 508
 func (this *NewCommonApiController) GetMobileFirstQuarter() {
@@ -506,15 +523,15 @@ func (this *NewCommonApiController) GetMobileFirstQuarter() {
506 523
 	endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
507 524
 	entime := endDate.Unix()
508 525
 	fmt.Println("结束日期", entime)
509
-	//group, parseDateErr := service.GetItemNameGroup(orgid, statime, entime)
510
-	//quarter, err := service.GetFirstQuarter(orgid, statime, entime)
511 526
 	count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto)
527
+	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
512 528
 	if err != nil {
513 529
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
514 530
 		return
515 531
 	}
516 532
 	this.ServeSuccessJSON(map[string]interface{}{
517
-		"count": count,
533
+		"count":   count,
534
+		"countwo": countwo,
518 535
 	})
519 536
 }
520 537
 
@@ -670,19 +687,38 @@ func (this *NewCommonApiController) GetMobileMonthProjectList() {
670 687
 	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
671 688
 	decEndStrsUnix := decEndStrs.Unix()
672 689
 	fmt.Println("12月末", decEndStrsUnix)
673
-	//统计总共
674
-	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)
675
-	//统计不合格
676
-	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)
677
-	if err != nil {
678
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
679
-		return
690
+	range_type, _ := this.GetInt64("range_type")
691
+	if range_type == 1 {
692
+		//统计总共
693
+		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)
694
+		//统计不合格
695
+		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)
696
+		if err != nil {
697
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
698
+			return
699
+		}
700
+
701
+		this.ServeSuccessJSON(map[string]interface{}{
702
+			"monthlist":   monthlist,
703
+			"monthNolist": monthNolist,
704
+		})
705
+	}
706
+	if range_type == 2 {
707
+		//统计总共
708
+		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)
709
+		//统计不合格
710
+		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)
711
+		if err != nil {
712
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
713
+			return
714
+		}
715
+
716
+		this.ServeSuccessJSON(map[string]interface{}{
717
+			"monthlist":   monthlist,
718
+			"monthNolist": monthNolist,
719
+		})
680 720
 	}
681 721
 
682
-	this.ServeSuccessJSON(map[string]interface{}{
683
-		"monthlist":   monthlist,
684
-		"monthNolist": monthNolist,
685
-	})
686 722
 }
687 723
 
688 724
 func (this *NewCommonApiController) GetAllMobileMajorInspection() {

+ 3 - 5
models/common_models.go Zobrazit soubor

@@ -388,11 +388,9 @@ type PatientInspectionProjectCount struct {
388 388
 }
389 389
 
390 390
 type ProjectCountOne struct {
391
-	Total      string
392
-	Count      int64
393
-	NoCount    int64
394
-	MinRange   string `gorm:"column:min_range" json:"min_range" form:"min_range"`
395
-	LargeRange string `gorm:"column:large_range" json:"large_range" form:"large_range"`
391
+	Total   string
392
+	Count   int64
393
+	NoCount int64
396 394
 }
397 395
 
398 396
 type ProjectCount struct {

+ 746 - 73
service/common_service.go Zobrazit soubor

@@ -1026,20 +1026,20 @@ func GetProjectStandList(orgid int64, lapseto int64, modetype int64, startime in
1026 1026
 	if lapseto == 0 {
1027 1027
 		d := XTReadDB().Table("xt_patients as s")
1028 1028
 		fmt.Println("d", d)
1029
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1029
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_value<> ''")
1030 1030
 		table := XTReadDB().Table("xt_inspection_reference as r")
1031
-		//q := XTReadDB().Table("xt_quality_control_standard as q")
1032
-		//fmt.Println("q",q)
1031
+		q := XTReadDB().Table("xt_quality_control_standard as r")
1032
+		fmt.Println("q", q)
1033 1033
 		fmt.Println(table)
1034 1034
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1035 1035
 			"SELECT " +
1036 1036
 			"CASE " +
1037
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '第一季度'" +
1038
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <=  r.range_max+0 THEN '第二季度'" +
1039
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0 THEN '第三季度'" +
1040
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0 THEN '第四季度'" +
1037
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.min_range+0 and x.inspect_value +0 <= r.large_range+0  THEN '第一季度'" +
1038
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.min_range+0 and x.inspect_value +0 <=  r.large_range+0 THEN '第二季度'" +
1039
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.min_range+0 and x.inspect_value +0 <= r.large_range+0 THEN '第三季度'" +
1040
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.min_range+0 and x.inspect_value +0 <= r.large_range+0 THEN '第四季度'" +
1041 1041
 			" ELSE '其他'" +
1042
-			"END AS nnd FROM xt_inspection as x  left join xt_inspection_reference as  r on (r.item_id = x.item_id AND r.org_id > 0) OR ( x.item_id = r.id AND r.org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2) and (x.inspect_value + 0 >= r.range_min + 0 AND x.inspect_value + 0 <= range_max+0)"
1042
+			"END AS nnd FROM xt_inspection as x  left join xt_quality_control_standard as  r on (r.inspection_minor = x.item_id AND r.user_org_id > 0) OR ( x.item_id = r.inspection_minor AND r.user_org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2) and (x.inspect_value + 0 >= r.min_range + 0 AND x.inspect_value + 0 <= r.large_range+0)"
1043 1043
 		countParams := make([]interface{}, 0)
1044 1044
 		countParams = append(countParams, firststart)
1045 1045
 		countParams = append(countParams, firstend)
@@ -1054,6 +1054,12 @@ func GetProjectStandList(orgid int64, lapseto int64, modetype int64, startime in
1054 1054
 			countSQL += " AND x.org_id=?"
1055 1055
 			countParams = append(countParams, orgid)
1056 1056
 
1057
+		}
1058
+		if orgid > 0 {
1059
+			db = db.Where("r.user_org_id=?", orgid)
1060
+			countSQL += " AND r.user_org_id=?"
1061
+			countParams = append(countParams, orgid)
1062
+
1057 1063
 		}
1058 1064
 		if modetype > 0 {
1059 1065
 			db = db.Where("x.item_id = ?", modetype)
@@ -1078,18 +1084,20 @@ func GetProjectStandList(orgid int64, lapseto int64, modetype int64, startime in
1078 1084
 	if lapseto == 1 {
1079 1085
 		d := XTReadDB().Table("xt_patients as s")
1080 1086
 		fmt.Println("d", d)
1081
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1087
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_value<> ''")
1082 1088
 		table := XTReadDB().Table("xt_inspection_reference as r")
1089
+		q := XTReadDB().Table("xt_quality_control_standard as r")
1090
+		fmt.Println("q", q)
1083 1091
 		fmt.Println(table)
1084 1092
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1085 1093
 			"SELECT " +
1086 1094
 			"CASE " +
1087
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '第一季度'" +
1088
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0 THEN '第二季度'" +
1089
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0 THEN '第三季度'" +
1090
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0 THEN '第四季度'" +
1095
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.min_range+0 and x.inspect_value +0 <= r.large_range+0  THEN '第一季度'" +
1096
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.min_range+0 and x.inspect_value +0 <=  r.large_range+0 THEN '第二季度'" +
1097
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.min_range+0 and x.inspect_value +0 <= r.large_range+0 THEN '第三季度'" +
1098
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.min_range+0 and x.inspect_value +0 <= r.large_range+0 THEN '第四季度'" +
1091 1099
 			" ELSE '其他'" +
1092
-			"END AS nnd FROM xt_inspection as x left join xt_inspection_reference as  r on r.id = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1) and (x.inspect_value + 0 >= r.range_min + 0 AND x.inspect_value + 0 <= r.range_max + 0)"
1100
+			"END AS nnd FROM xt_inspection as x  left join xt_quality_control_standard as  r on (r.inspection_minor = x.item_id AND r.user_org_id > 0) OR ( x.item_id = r.inspection_minor AND r.user_org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2) and (x.inspect_value + 0 >= r.min_range + 0 AND x.inspect_value + 0 <= r.large_range+0)"
1093 1101
 		countParams := make([]interface{}, 0)
1094 1102
 		countParams = append(countParams, firststart)
1095 1103
 		countParams = append(countParams, firstend)
@@ -1104,6 +1112,12 @@ func GetProjectStandList(orgid int64, lapseto int64, modetype int64, startime in
1104 1112
 			countSQL += " AND x.org_id=?"
1105 1113
 			countParams = append(countParams, orgid)
1106 1114
 
1115
+		}
1116
+		if orgid > 0 {
1117
+			db = db.Where("r.user_org_id=?", orgid)
1118
+			countSQL += " AND r.user_org_id=?"
1119
+			countParams = append(countParams, orgid)
1120
+
1107 1121
 		}
1108 1122
 		if modetype > 0 {
1109 1123
 			db = db.Where("x.item_id = ?", modetype)
@@ -1124,22 +1138,86 @@ func GetProjectStandList(orgid int64, lapseto int64, modetype int64, startime in
1124 1138
 		countSQL += ")a GROUP BY nnd"
1125 1139
 		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
1126 1140
 	}
1141
+	return
1142
+}
1127 1143
 
1128
-	if lapseto == 2 {
1144
+func GetProjectStandListOne(orgid int64, lapseto int64, modetype int64, startime int64, endtime int64, firststart int64, firstend int64, sencondstart int64, sencondend int64, threestart int64, threeend int64, fourstart int64, fourend int64) (inspection []*models.ProjectCount, err error) {
1145
+
1146
+	if lapseto == 0 {
1129 1147
 		d := XTReadDB().Table("xt_patients as s")
1130 1148
 		fmt.Println("d", d)
1131
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1149
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 x.inspect_type = 2")
1150
+		table := XTReadDB().Table("xt_inspection_reference as r")
1151
+		q := XTReadDB().Table("xt_quality_control_standard as r")
1152
+		fmt.Println("q", q)
1153
+		fmt.Println(table)
1154
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1155
+			"SELECT " +
1156
+			"CASE " +
1157
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第一季度'" +
1158
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第二季度'" +
1159
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第三季度'" +
1160
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第四季度'" +
1161
+			" ELSE '其他'" +
1162
+			"END AS nnd FROM xt_inspection as x  left join xt_quality_control_standard as  r on (r.inspection_minor = x.item_id AND r.user_org_id > 0) OR ( x.item_id = r.inspection_minor AND r.user_org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2) and (x.inspect_value = r.range_value)"
1163
+		countParams := make([]interface{}, 0)
1164
+		countParams = append(countParams, firststart)
1165
+		countParams = append(countParams, firstend)
1166
+		countParams = append(countParams, sencondstart)
1167
+		countParams = append(countParams, sencondend)
1168
+		countParams = append(countParams, threestart)
1169
+		countParams = append(countParams, threeend)
1170
+		countParams = append(countParams, fourstart)
1171
+		countParams = append(countParams, fourend)
1172
+		if orgid > 0 {
1173
+			db = db.Where("x.org_id=?", orgid)
1174
+			countSQL += " AND x.org_id=?"
1175
+			countParams = append(countParams, orgid)
1176
+
1177
+		}
1178
+		if orgid > 0 {
1179
+			db = db.Where("r.user_org_id=?", orgid)
1180
+			countSQL += " AND r.user_org_id=?"
1181
+			countParams = append(countParams, orgid)
1182
+
1183
+		}
1184
+		if modetype > 0 {
1185
+			db = db.Where("x.item_id = ?", modetype)
1186
+			countSQL += " AND x.item_id=?"
1187
+			countParams = append(countParams, modetype)
1188
+		}
1189
+		if startime > 0 {
1190
+			db = db.Where("x.inspect_date >= ? ", startime)
1191
+			countSQL += " AND x.inspect_date >=?"
1192
+			countParams = append(countParams, startime)
1193
+		}
1194
+		if endtime > 0 {
1195
+			db = db.Where("x.inspect_date <= ?", endtime)
1196
+			countSQL += " AND x.inspect_date <=?"
1197
+			countParams = append(countParams, endtime)
1198
+		}
1199
+
1200
+		countSQL += ")a GROUP BY nnd"
1201
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
1202
+	}
1203
+
1204
+	if lapseto == 1 {
1205
+		d := XTReadDB().Table("xt_patients as s")
1206
+		fmt.Println("d", d)
1207
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 x.inspect_type = 2")
1132 1208
 		table := XTReadDB().Table("xt_inspection_reference as r")
1209
+		q := XTReadDB().Table("xt_quality_control_standard as r")
1210
+		fmt.Println("q", q)
1133 1211
 		fmt.Println(table)
1134 1212
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1135 1213
 			"SELECT " +
1136 1214
 			"CASE " +
1137
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '第一季度'" +
1138
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0 THEN '第二季度'" +
1139
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0 THEN '第三季度'" +
1140
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0 THEN '第四季度'" +
1215
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第一季度'" +
1216
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第二季度'" +
1217
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第三季度'" +
1218
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第四季度'" +
1141 1219
 			" ELSE '其他'" +
1142
-			"END AS nnd FROM xt_inspection as x left join xt_inspection_reference as  r on r.id = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2) and (x.inspect_value + 0 >= r.range_min + 0 AND x.inspect_value + 0 <= r.range_max + 0)"
1220
+			"END AS nnd FROM xt_inspection as x  left join xt_quality_control_standard as  r on (r.inspection_minor = x.item_id AND r.user_org_id > 0) OR ( x.item_id = r.inspection_minor AND r.user_org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2) and (x.inspect_value = r.range_value)"
1143 1221
 		countParams := make([]interface{}, 0)
1144 1222
 		countParams = append(countParams, firststart)
1145 1223
 		countParams = append(countParams, firstend)
@@ -1154,6 +1232,12 @@ func GetProjectStandList(orgid int64, lapseto int64, modetype int64, startime in
1154 1232
 			countSQL += " AND x.org_id=?"
1155 1233
 			countParams = append(countParams, orgid)
1156 1234
 
1235
+		}
1236
+		if orgid > 0 {
1237
+			db = db.Where("r.user_org_id=?", orgid)
1238
+			countSQL += " AND r.user_org_id=?"
1239
+			countParams = append(countParams, orgid)
1240
+
1157 1241
 		}
1158 1242
 		if modetype > 0 {
1159 1243
 			db = db.Where("x.item_id = ?", modetype)
@@ -1183,7 +1267,7 @@ func GetMonthProjectList(orgid int64, lapseto int64, modetype int64, januaryStar
1183 1267
 
1184 1268
 		d := XTReadDB().Table("xt_patients as s")
1185 1269
 		fmt.Println("d", d)
1186
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1270
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_value <> 0 and x.inspect_type = 1")
1187 1271
 
1188 1272
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1189 1273
 			"SELECT " +
@@ -1255,7 +1339,7 @@ func GetMonthProjectList(orgid int64, lapseto int64, modetype int64, januaryStar
1255 1339
 
1256 1340
 		d := XTReadDB().Table("xt_patients as s")
1257 1341
 		fmt.Println("d", d)
1258
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1342
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_value <> 0 and x.inspect_type = 1 ")
1259 1343
 
1260 1344
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1261 1345
 			"SELECT " +
@@ -1326,7 +1410,7 @@ func GetMonthProjectList(orgid int64, lapseto int64, modetype int64, januaryStar
1326 1410
 	if lapseto == 2 {
1327 1411
 		d := XTReadDB().Table("xt_patients as s")
1328 1412
 		fmt.Println("d", d)
1329
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1413
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 x.inspect_value <> 0 and x.inspect_type = 1")
1330 1414
 
1331 1415
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1332 1416
 			"SELECT " +
@@ -1396,31 +1480,31 @@ func GetMonthProjectList(orgid int64, lapseto int64, modetype int64, januaryStar
1396 1480
 	return
1397 1481
 }
1398 1482
 
1399
-func GetMonthProjectListTwo(orgid int64, lapseto int64, modetype int64, januaryStartStrUnix int64, januaryEndStrUnix int64, febStartStrStrUnix int64, febEndStrUnix int64, marchStartStrUnix int64, marchEndStrUnix int64, aprStartStrUnix int64, aprEndStrsUnix int64, mayStartStrUnix int64, mayEndStrsUnix int64, junStartStrUnix int64, junEndStrsUnix int64, julStartStrUnix int64, julEndStrsUnix int64, augStartStrUnix int64, augEndStrsUnix int64, sepStartStrUnix int64, sepEndStrsUnix int64, octStartStrUnix int64, octEndStrsUnix int64, novStartStrUnix int64, novEndStrsUnix int64, decStartStrUnix int64, decEndStrsUnix int64) (inspection []*models.ProjectCount, err error) {
1400
-	fmt.Println("lapseto=======", lapseto)
1483
+func GetMonthProjectListOne(orgid int64, lapseto int64, modetype int64, januaryStartStrUnix int64, januaryEndStrUnix int64, febStartStrStrUnix int64, febEndStrUnix int64, marchStartStrUnix int64, marchEndStrUnix int64, aprStartStrUnix int64, aprEndStrsUnix int64, mayStartStrUnix int64, mayEndStrsUnix int64, junStartStrUnix int64, junEndStrsUnix int64, julStartStrUnix int64, julEndStrsUnix int64, augStartStrUnix int64, augEndStrsUnix int64, sepStartStrUnix int64, sepEndStrsUnix int64, octStartStrUnix int64, octEndStrsUnix int64, novStartStrUnix int64, novEndStrsUnix int64, decStartStrUnix int64, decEndStrsUnix int64) (inspection []*models.ProjectCountOne, err error) {
1484
+
1401 1485
 	if lapseto == 0 {
1486
+
1402 1487
 		d := XTReadDB().Table("xt_patients as s")
1403 1488
 		fmt.Println("d", d)
1404
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1405
-		table := XTReadDB().Table("xt_inspection_reference as r")
1406
-		fmt.Println(table)
1489
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
1490
+
1407 1491
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1408 1492
 			"SELECT " +
1409 1493
 			"CASE " +
1410
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '一月'" +
1411
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '二月'" +
1412
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '三月'" +
1413
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '四月'" +
1414
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '五月'" +
1415
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '六月'" +
1416
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '七月'" +
1417
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '八月'" +
1418
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '九月'" +
1419
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十月'" +
1420
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十一月'" +
1421
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十二月'" +
1494
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '一月'" +
1495
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '二月'" +
1496
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '三月'" +
1497
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '四月'" +
1498
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '五月'" +
1499
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '六月'" +
1500
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '七月'" +
1501
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '八月'" +
1502
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '九月'" +
1503
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十月'" +
1504
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十一月'" +
1505
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十二月'" +
1422 1506
 			" ELSE '其他'" +
1423
-			"END AS nnd FROM xt_inspection as x left join xt_inspection_reference as  r on r.id = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2) and (x.inspect_value + 0 >= r.range_min + 0 AND x.inspect_value + 0 <= r.range_max + 0)"
1507
+			"END AS nnd FROM xt_inspection as x left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2)"
1424 1508
 		countParams := make([]interface{}, 0)
1425 1509
 		countParams = append(countParams, januaryStartStrUnix)
1426 1510
 		countParams = append(countParams, januaryEndStrUnix)
@@ -1474,26 +1558,25 @@ func GetMonthProjectListTwo(orgid int64, lapseto int64, modetype int64, januaryS
1474 1558
 
1475 1559
 		d := XTReadDB().Table("xt_patients as s")
1476 1560
 		fmt.Println("d", d)
1477
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1478
-		table := XTReadDB().Table("xt_inspection_reference as r")
1479
-		fmt.Println(table)
1561
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1  and and x.inspect_type = 2")
1562
+
1480 1563
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1481 1564
 			"SELECT " +
1482 1565
 			"CASE " +
1483
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '一月'" +
1484
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '二月'" +
1485
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '三月'" +
1486
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '四月'" +
1487
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '五月'" +
1488
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '六月'" +
1489
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '七月'" +
1490
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '八月'" +
1491
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '九月'" +
1492
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十月'" +
1493
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十一月'" +
1494
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十二月'" +
1566
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '一月'" +
1567
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '二月'" +
1568
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '三月'" +
1569
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '四月'" +
1570
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '五月'" +
1571
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '六月'" +
1572
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '七月'" +
1573
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '八月'" +
1574
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '九月'" +
1575
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十月'" +
1576
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十一月'" +
1577
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十二月'" +
1495 1578
 			" ELSE '其他'" +
1496
-			"END AS nnd FROM xt_inspection as x left join xt_inspection_reference as  r on r.id = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1) and (x.inspect_value + 0 >= r.range_min + 0 AND x.inspect_value + 0 <= r.range_max + 0)"
1579
+			"END AS nnd FROM xt_inspection as x left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1)"
1497 1580
 		countParams := make([]interface{}, 0)
1498 1581
 		countParams = append(countParams, januaryStartStrUnix)
1499 1582
 		countParams = append(countParams, januaryEndStrUnix)
@@ -1546,26 +1629,616 @@ func GetMonthProjectListTwo(orgid int64, lapseto int64, modetype int64, januaryS
1546 1629
 	if lapseto == 2 {
1547 1630
 		d := XTReadDB().Table("xt_patients as s")
1548 1631
 		fmt.Println("d", d)
1549
-		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1550
-		table := XTReadDB().Table("xt_inspection_reference as r")
1632
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
1633
+
1634
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1635
+			"SELECT " +
1636
+			"CASE " +
1637
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '一月'" +
1638
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '二月'" +
1639
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '三月'" +
1640
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '四月'" +
1641
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '五月'" +
1642
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '六月'" +
1643
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '七月'" +
1644
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '八月'" +
1645
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '九月'" +
1646
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十月'" +
1647
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十一月'" +
1648
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '十二月'" +
1649
+			" ELSE '其他'" +
1650
+			"END AS nnd FROM xt_inspection as x left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2)"
1651
+		countParams := make([]interface{}, 0)
1652
+		countParams = append(countParams, januaryStartStrUnix)
1653
+		countParams = append(countParams, januaryEndStrUnix)
1654
+		countParams = append(countParams, febStartStrStrUnix)
1655
+		countParams = append(countParams, febEndStrUnix)
1656
+		countParams = append(countParams, marchStartStrUnix)
1657
+		countParams = append(countParams, marchEndStrUnix)
1658
+		countParams = append(countParams, aprStartStrUnix)
1659
+		countParams = append(countParams, aprEndStrsUnix)
1660
+		countParams = append(countParams, mayStartStrUnix)
1661
+		countParams = append(countParams, mayEndStrsUnix)
1662
+		countParams = append(countParams, junStartStrUnix)
1663
+		countParams = append(countParams, junEndStrsUnix)
1664
+		countParams = append(countParams, julStartStrUnix)
1665
+		countParams = append(countParams, julEndStrsUnix)
1666
+		countParams = append(countParams, augStartStrUnix)
1667
+		countParams = append(countParams, augEndStrsUnix)
1668
+		countParams = append(countParams, sepStartStrUnix)
1669
+		countParams = append(countParams, sepEndStrsUnix)
1670
+		countParams = append(countParams, octStartStrUnix)
1671
+		countParams = append(countParams, octEndStrsUnix)
1672
+		countParams = append(countParams, novStartStrUnix)
1673
+		countParams = append(countParams, novEndStrsUnix)
1674
+		countParams = append(countParams, decStartStrUnix)
1675
+		countParams = append(countParams, decEndStrsUnix)
1676
+		if orgid > 0 {
1677
+			db = db.Where("x.org_id=?", orgid)
1678
+			countSQL += " AND x.org_id=?"
1679
+			countParams = append(countParams, orgid)
1680
+		}
1681
+		if modetype > 0 {
1682
+			db = db.Where("x.item_id = ?", modetype)
1683
+			countSQL += " AND x.item_id=?"
1684
+			countParams = append(countParams, modetype)
1685
+		}
1686
+		if januaryStartStrUnix > 0 {
1687
+			db = db.Where("x.inspect_date >= ?", januaryStartStrUnix)
1688
+			countSQL += " AND x.inspect_date >=?"
1689
+			countParams = append(countParams, januaryStartStrUnix)
1690
+		}
1691
+		if decEndStrsUnix > 0 {
1692
+			db = db.Where("x.inspect_date <= ?", decEndStrsUnix)
1693
+			countSQL += " AND x.inspect_date <=?"
1694
+			countParams = append(countParams, decEndStrsUnix)
1695
+		}
1696
+		countSQL += ")a GROUP BY nnd"
1697
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
1698
+	}
1699
+	return
1700
+}
1701
+
1702
+func GetProjectListOne(orgid int64, lapseto int64, modetype int64, startime int64, endtime int64, firststart int64, firstend int64, sencondstart int64, sencondend int64, threestart int64, threeend int64, fourstart int64, fourend int64) (inspection []*models.ProjectCountOne, err error) {
1703
+
1704
+	if lapseto == 0 {
1705
+		d := XTReadDB().Table("xt_patients as s")
1706
+		fmt.Println("d", d)
1707
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
1708
+
1709
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1710
+			"SELECT " +
1711
+			"CASE " +
1712
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第一季度'" +
1713
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第二季度'" +
1714
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第三季度'" +
1715
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第四季度'" +
1716
+			" ELSE '其他'" +
1717
+			"END AS nnd FROM xt_inspection as x  left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2)"
1718
+		countParams := make([]interface{}, 0)
1719
+		countParams = append(countParams, firststart)
1720
+		countParams = append(countParams, firstend)
1721
+		countParams = append(countParams, sencondstart)
1722
+		countParams = append(countParams, sencondend)
1723
+		countParams = append(countParams, threestart)
1724
+		countParams = append(countParams, threeend)
1725
+		countParams = append(countParams, fourstart)
1726
+		countParams = append(countParams, fourend)
1727
+		if orgid > 0 {
1728
+			db = db.Where("x.org_id=?", orgid)
1729
+			countSQL += " AND x.org_id=?"
1730
+			countParams = append(countParams, orgid)
1731
+
1732
+		}
1733
+		if modetype > 0 {
1734
+			db = db.Where("x.item_id = ?", modetype)
1735
+			countSQL += " AND x.item_id=?"
1736
+			countParams = append(countParams, modetype)
1737
+		}
1738
+		if startime > 0 {
1739
+			db = db.Where("x.inspect_date >= ?", startime)
1740
+			countSQL += " AND x.inspect_date >=?"
1741
+			countParams = append(countParams, startime)
1742
+		}
1743
+		if endtime > 0 {
1744
+			db = db.Where("x.inspect_date <= ?", endtime)
1745
+			countSQL += " AND x.inspect_date <=?"
1746
+			countParams = append(countParams, endtime)
1747
+		}
1748
+		countSQL += ")a GROUP BY nnd"
1749
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
1750
+	}
1751
+
1752
+	if lapseto == 1 {
1753
+		d := XTReadDB().Table("xt_patients as s")
1754
+		fmt.Println("d", d)
1755
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
1756
+
1757
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1758
+			"SELECT " +
1759
+			"CASE " +
1760
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第一季度'" +
1761
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第二季度'" +
1762
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第三季度'" +
1763
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第四季度'" +
1764
+			" ELSE '其他'" +
1765
+			"END AS nnd FROM xt_inspection as x  left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2)"
1766
+		countParams := make([]interface{}, 0)
1767
+		countParams = append(countParams, firststart)
1768
+		countParams = append(countParams, firstend)
1769
+		countParams = append(countParams, sencondstart)
1770
+		countParams = append(countParams, sencondend)
1771
+		countParams = append(countParams, threestart)
1772
+		countParams = append(countParams, threeend)
1773
+		countParams = append(countParams, fourstart)
1774
+		countParams = append(countParams, fourend)
1775
+		if orgid > 0 {
1776
+			db = db.Where("x.org_id=?", orgid)
1777
+			countSQL += " AND x.org_id=?"
1778
+			countParams = append(countParams, orgid)
1779
+
1780
+		}
1781
+		if modetype > 0 {
1782
+			db = db.Where("x.item_id = ?", modetype)
1783
+			countSQL += " AND x.item_id=?"
1784
+			countParams = append(countParams, modetype)
1785
+		}
1786
+		if startime > 0 {
1787
+			db = db.Where("x.inspect_date >= ?", startime)
1788
+			countSQL += " AND x.inspect_date >=?"
1789
+			countParams = append(countParams, startime)
1790
+		}
1791
+		if endtime > 0 {
1792
+			db = db.Where("x.inspect_date <= ?", endtime)
1793
+			countSQL += " AND x.inspect_date <=?"
1794
+			countParams = append(countParams, endtime)
1795
+		}
1796
+		countSQL += ")a GROUP BY nnd"
1797
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
1798
+	}
1799
+
1800
+	if lapseto == 2 {
1801
+		d := XTReadDB().Table("xt_patients as s")
1802
+		fmt.Println("d", d)
1803
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1")
1804
+
1805
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1806
+			"SELECT " +
1807
+			"CASE " +
1808
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第一季度'" +
1809
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第二季度'" +
1810
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第三季度'" +
1811
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? THEN '第四季度'" +
1812
+			" ELSE '其他'" +
1813
+			"END AS nnd FROM xt_inspection as x left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2)"
1814
+		countParams := make([]interface{}, 0)
1815
+		countParams = append(countParams, firststart)
1816
+		countParams = append(countParams, firstend)
1817
+		countParams = append(countParams, sencondstart)
1818
+		countParams = append(countParams, sencondend)
1819
+		countParams = append(countParams, threestart)
1820
+		countParams = append(countParams, threeend)
1821
+		countParams = append(countParams, fourstart)
1822
+		countParams = append(countParams, fourend)
1823
+		if orgid > 0 {
1824
+			db = db.Where("x.org_id=?", orgid)
1825
+			countSQL += " AND x.org_id=?"
1826
+			countParams = append(countParams, orgid)
1827
+
1828
+		}
1829
+		if modetype > 0 {
1830
+			db = db.Where("x.item_id = ?", modetype)
1831
+			countSQL += " AND x.item_id=?"
1832
+			countParams = append(countParams, modetype)
1833
+		}
1834
+
1835
+		if startime > 0 {
1836
+			db = db.Where("x.inspect_date >= ?", startime)
1837
+			countSQL += " AND x.inspect_date >=?"
1838
+			countParams = append(countParams, startime)
1839
+		}
1840
+		if endtime > 0 {
1841
+			db = db.Where("x.inspect_date <= ?", endtime)
1842
+			countSQL += " AND x.inspect_date <=?"
1843
+			countParams = append(countParams, endtime)
1844
+		}
1845
+
1846
+		countSQL += ")a GROUP BY nnd"
1847
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
1848
+
1849
+	}
1850
+	return
1851
+}
1852
+
1853
+func GetMonthProjectListTwo(orgid int64, lapseto int64, modetype int64, januaryStartStrUnix int64, januaryEndStrUnix int64, febStartStrStrUnix int64, febEndStrUnix int64, marchStartStrUnix int64, marchEndStrUnix int64, aprStartStrUnix int64, aprEndStrsUnix int64, mayStartStrUnix int64, mayEndStrsUnix int64, junStartStrUnix int64, junEndStrsUnix int64, julStartStrUnix int64, julEndStrsUnix int64, augStartStrUnix int64, augEndStrsUnix int64, sepStartStrUnix int64, sepEndStrsUnix int64, octStartStrUnix int64, octEndStrsUnix int64, novStartStrUnix int64, novEndStrsUnix int64, decStartStrUnix int64, decEndStrsUnix int64) (inspection []*models.ProjectCount, err error) {
1854
+	if lapseto == 0 {
1855
+		d := XTReadDB().Table("xt_patients as s")
1856
+		fmt.Println("d", d)
1857
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
1858
+		table := XTReadDB().Table("xt_quality_control_standard as r")
1859
+		fmt.Println(table)
1860
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1861
+			"SELECT " +
1862
+			"CASE " +
1863
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '一月'" +
1864
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '二月'" +
1865
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '三月'" +
1866
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '四月'" +
1867
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '五月'" +
1868
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '六月'" +
1869
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '七月'" +
1870
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '八月'" +
1871
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '九月'" +
1872
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十月'" +
1873
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十一月'" +
1874
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十二月'" +
1875
+			" ELSE '其他'" +
1876
+			"END AS nnd FROM xt_inspection as x LEFT JOIN xt_quality_control_standard AS r ON r.inspection_minor = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2) and (x.inspect_value <> r.range_value)"
1877
+		countParams := make([]interface{}, 0)
1878
+		countParams = append(countParams, januaryStartStrUnix)
1879
+		countParams = append(countParams, januaryEndStrUnix)
1880
+		countParams = append(countParams, febStartStrStrUnix)
1881
+		countParams = append(countParams, febEndStrUnix)
1882
+		countParams = append(countParams, marchStartStrUnix)
1883
+		countParams = append(countParams, marchEndStrUnix)
1884
+		countParams = append(countParams, aprStartStrUnix)
1885
+		countParams = append(countParams, aprEndStrsUnix)
1886
+		countParams = append(countParams, mayStartStrUnix)
1887
+		countParams = append(countParams, mayEndStrsUnix)
1888
+		countParams = append(countParams, junStartStrUnix)
1889
+		countParams = append(countParams, junEndStrsUnix)
1890
+		countParams = append(countParams, julStartStrUnix)
1891
+		countParams = append(countParams, julEndStrsUnix)
1892
+		countParams = append(countParams, augStartStrUnix)
1893
+		countParams = append(countParams, augEndStrsUnix)
1894
+		countParams = append(countParams, sepStartStrUnix)
1895
+		countParams = append(countParams, sepEndStrsUnix)
1896
+		countParams = append(countParams, octStartStrUnix)
1897
+		countParams = append(countParams, octEndStrsUnix)
1898
+		countParams = append(countParams, novStartStrUnix)
1899
+		countParams = append(countParams, novEndStrsUnix)
1900
+		countParams = append(countParams, decStartStrUnix)
1901
+		countParams = append(countParams, decEndStrsUnix)
1902
+		if orgid > 0 {
1903
+			db = db.Where("x.org_id=?", orgid)
1904
+			countSQL += " AND x.org_id=?"
1905
+			countParams = append(countParams, orgid)
1906
+		}
1907
+		if modetype > 0 {
1908
+			db = db.Where("x.item_id = ?", modetype)
1909
+			countSQL += " AND x.item_id=?"
1910
+			countParams = append(countParams, modetype)
1911
+		}
1912
+		if januaryStartStrUnix > 0 {
1913
+			db = db.Where("x.inspect_date >= ?", januaryStartStrUnix)
1914
+			countSQL += " AND x.inspect_date >=?"
1915
+			countParams = append(countParams, januaryStartStrUnix)
1916
+		}
1917
+		if decEndStrsUnix > 0 {
1918
+			db = db.Where("x.inspect_date <= ?", decEndStrsUnix)
1919
+			countSQL += " AND x.inspect_date <=?"
1920
+			countParams = append(countParams, decEndStrsUnix)
1921
+		}
1922
+		countSQL += ")a GROUP BY nnd"
1923
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
1924
+	}
1925
+
1926
+	if lapseto == 1 {
1927
+
1928
+		d := XTReadDB().Table("xt_patients as s")
1929
+		fmt.Println("d", d)
1930
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
1931
+		table := XTReadDB().Table("xt_quality_control_standard as r")
1932
+		fmt.Println(table)
1933
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1934
+			"SELECT " +
1935
+			"CASE " +
1936
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '一月'" +
1937
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '二月'" +
1938
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '三月'" +
1939
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '四月'" +
1940
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '五月'" +
1941
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '六月'" +
1942
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '七月'" +
1943
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '八月'" +
1944
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '九月'" +
1945
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十月'" +
1946
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十一月'" +
1947
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十二月'" +
1948
+			" ELSE '其他'" +
1949
+			"END AS nnd FROM xt_inspection as x LEFT JOIN xt_quality_control_standard AS r ON r.inspection_minor = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1) and (x.inspect_value <> r.range_value)"
1950
+		countParams := make([]interface{}, 0)
1951
+		countParams = append(countParams, januaryStartStrUnix)
1952
+		countParams = append(countParams, januaryEndStrUnix)
1953
+		countParams = append(countParams, febStartStrStrUnix)
1954
+		countParams = append(countParams, febEndStrUnix)
1955
+		countParams = append(countParams, marchStartStrUnix)
1956
+		countParams = append(countParams, marchEndStrUnix)
1957
+		countParams = append(countParams, aprStartStrUnix)
1958
+		countParams = append(countParams, aprEndStrsUnix)
1959
+		countParams = append(countParams, mayStartStrUnix)
1960
+		countParams = append(countParams, mayEndStrsUnix)
1961
+		countParams = append(countParams, junStartStrUnix)
1962
+		countParams = append(countParams, junEndStrsUnix)
1963
+		countParams = append(countParams, julStartStrUnix)
1964
+		countParams = append(countParams, julEndStrsUnix)
1965
+		countParams = append(countParams, augStartStrUnix)
1966
+		countParams = append(countParams, augEndStrsUnix)
1967
+		countParams = append(countParams, sepStartStrUnix)
1968
+		countParams = append(countParams, sepEndStrsUnix)
1969
+		countParams = append(countParams, octStartStrUnix)
1970
+		countParams = append(countParams, octEndStrsUnix)
1971
+		countParams = append(countParams, novStartStrUnix)
1972
+		countParams = append(countParams, novEndStrsUnix)
1973
+		countParams = append(countParams, decStartStrUnix)
1974
+		countParams = append(countParams, decEndStrsUnix)
1975
+		if orgid > 0 {
1976
+			db = db.Where("x.org_id=?", orgid)
1977
+			countSQL += " AND x.org_id=?"
1978
+			countParams = append(countParams, orgid)
1979
+		}
1980
+		if modetype > 0 {
1981
+			db = db.Where("x.item_id = ?", modetype)
1982
+			countSQL += " AND x.item_id=?"
1983
+			countParams = append(countParams, modetype)
1984
+		}
1985
+		if januaryStartStrUnix > 0 {
1986
+			db = db.Where("x.inspect_date >= ?", januaryStartStrUnix)
1987
+			countSQL += " AND x.inspect_date >=?"
1988
+			countParams = append(countParams, januaryStartStrUnix)
1989
+		}
1990
+		if decEndStrsUnix > 0 {
1991
+			db = db.Where("x.inspect_date <= ?", decEndStrsUnix)
1992
+			countSQL += " AND x.inspect_date <=?"
1993
+			countParams = append(countParams, decEndStrsUnix)
1994
+		}
1995
+		countSQL += ")a GROUP BY nnd"
1996
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
1997
+	}
1998
+
1999
+	if lapseto == 2 {
2000
+		d := XTReadDB().Table("xt_patients as s")
2001
+		fmt.Println("d", d)
2002
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
2003
+		table := XTReadDB().Table("xt_quality_control_standard as r")
2004
+		fmt.Println(table)
2005
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
2006
+			"SELECT " +
2007
+			"CASE " +
2008
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '一月'" +
2009
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '二月'" +
2010
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '三月'" +
2011
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '四月'" +
2012
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '五月'" +
2013
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '六月'" +
2014
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '七月'" +
2015
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '八月'" +
2016
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '九月'" +
2017
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十月'" +
2018
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十一月'" +
2019
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十二月'" +
2020
+			" ELSE '其他'" +
2021
+			"END AS nnd FROM xt_inspection as x LEFT JOIN xt_quality_control_standard AS r ON r.inspection_minor = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2) and (x.inspect_value <> r.range_value)"
2022
+		countParams := make([]interface{}, 0)
2023
+		countParams = append(countParams, januaryStartStrUnix)
2024
+		countParams = append(countParams, januaryEndStrUnix)
2025
+		countParams = append(countParams, febStartStrStrUnix)
2026
+		countParams = append(countParams, febEndStrUnix)
2027
+		countParams = append(countParams, marchStartStrUnix)
2028
+		countParams = append(countParams, marchEndStrUnix)
2029
+		countParams = append(countParams, aprStartStrUnix)
2030
+		countParams = append(countParams, aprEndStrsUnix)
2031
+		countParams = append(countParams, mayStartStrUnix)
2032
+		countParams = append(countParams, mayEndStrsUnix)
2033
+		countParams = append(countParams, junStartStrUnix)
2034
+		countParams = append(countParams, junEndStrsUnix)
2035
+		countParams = append(countParams, julStartStrUnix)
2036
+		countParams = append(countParams, julEndStrsUnix)
2037
+		countParams = append(countParams, augStartStrUnix)
2038
+		countParams = append(countParams, augEndStrsUnix)
2039
+		countParams = append(countParams, sepStartStrUnix)
2040
+		countParams = append(countParams, sepEndStrsUnix)
2041
+		countParams = append(countParams, octStartStrUnix)
2042
+		countParams = append(countParams, octEndStrsUnix)
2043
+		countParams = append(countParams, novStartStrUnix)
2044
+		countParams = append(countParams, novEndStrsUnix)
2045
+		countParams = append(countParams, decStartStrUnix)
2046
+		countParams = append(countParams, decEndStrsUnix)
2047
+		if orgid > 0 {
2048
+			db = db.Where("x.org_id=?", orgid)
2049
+			countSQL += " AND x.org_id=?"
2050
+			countParams = append(countParams, orgid)
2051
+		}
2052
+		if modetype > 0 {
2053
+			db = db.Where("x.item_id = ?", modetype)
2054
+			countSQL += " AND x.item_id=?"
2055
+			countParams = append(countParams, modetype)
2056
+		}
2057
+		if januaryStartStrUnix > 0 {
2058
+			db = db.Where("x.inspect_date >= ?", januaryStartStrUnix)
2059
+			countSQL += " AND x.inspect_date >=?"
2060
+			countParams = append(countParams, januaryStartStrUnix)
2061
+		}
2062
+		if decEndStrsUnix > 0 {
2063
+			db = db.Where("x.inspect_date <= ?", decEndStrsUnix)
2064
+			countSQL += " AND x.inspect_date <=?"
2065
+			countParams = append(countParams, decEndStrsUnix)
2066
+		}
2067
+		countSQL += ")a GROUP BY nnd"
2068
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
2069
+	}
2070
+	return
2071
+}
2072
+
2073
+func GetMonthProjectListThree(orgid int64, lapseto int64, modetype int64, januaryStartStrUnix int64, januaryEndStrUnix int64, febStartStrStrUnix int64, febEndStrUnix int64, marchStartStrUnix int64, marchEndStrUnix int64, aprStartStrUnix int64, aprEndStrsUnix int64, mayStartStrUnix int64, mayEndStrsUnix int64, junStartStrUnix int64, junEndStrsUnix int64, julStartStrUnix int64, julEndStrsUnix int64, augStartStrUnix int64, augEndStrsUnix int64, sepStartStrUnix int64, sepEndStrsUnix int64, octStartStrUnix int64, octEndStrsUnix int64, novStartStrUnix int64, novEndStrsUnix int64, decStartStrUnix int64, decEndStrsUnix int64) (inspection []*models.ProjectCount, err error) {
2074
+	if lapseto == 0 {
2075
+		d := XTReadDB().Table("xt_patients as s")
2076
+		fmt.Println("d", d)
2077
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
2078
+		table := XTReadDB().Table("xt_quality_control_standard as r")
2079
+		fmt.Println(table)
2080
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
2081
+			"SELECT " +
2082
+			"CASE " +
2083
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '一月'" +
2084
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '二月'" +
2085
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '三月'" +
2086
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '四月'" +
2087
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '五月'" +
2088
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '六月'" +
2089
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '七月'" +
2090
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '八月'" +
2091
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '九月'" +
2092
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十月'" +
2093
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十一月'" +
2094
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十二月'" +
2095
+			" ELSE '其他'" +
2096
+			"END AS nnd FROM xt_inspection as x LEFT JOIN xt_quality_control_standard AS r ON r.inspection_minor = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2) and (x.inspect_value <> r.range_value)"
2097
+		countParams := make([]interface{}, 0)
2098
+		countParams = append(countParams, januaryStartStrUnix)
2099
+		countParams = append(countParams, januaryEndStrUnix)
2100
+		countParams = append(countParams, febStartStrStrUnix)
2101
+		countParams = append(countParams, febEndStrUnix)
2102
+		countParams = append(countParams, marchStartStrUnix)
2103
+		countParams = append(countParams, marchEndStrUnix)
2104
+		countParams = append(countParams, aprStartStrUnix)
2105
+		countParams = append(countParams, aprEndStrsUnix)
2106
+		countParams = append(countParams, mayStartStrUnix)
2107
+		countParams = append(countParams, mayEndStrsUnix)
2108
+		countParams = append(countParams, junStartStrUnix)
2109
+		countParams = append(countParams, junEndStrsUnix)
2110
+		countParams = append(countParams, julStartStrUnix)
2111
+		countParams = append(countParams, julEndStrsUnix)
2112
+		countParams = append(countParams, augStartStrUnix)
2113
+		countParams = append(countParams, augEndStrsUnix)
2114
+		countParams = append(countParams, sepStartStrUnix)
2115
+		countParams = append(countParams, sepEndStrsUnix)
2116
+		countParams = append(countParams, octStartStrUnix)
2117
+		countParams = append(countParams, octEndStrsUnix)
2118
+		countParams = append(countParams, novStartStrUnix)
2119
+		countParams = append(countParams, novEndStrsUnix)
2120
+		countParams = append(countParams, decStartStrUnix)
2121
+		countParams = append(countParams, decEndStrsUnix)
2122
+		if orgid > 0 {
2123
+			db = db.Where("x.org_id=?", orgid)
2124
+			countSQL += " AND x.org_id=?"
2125
+			countParams = append(countParams, orgid)
2126
+		}
2127
+		if modetype > 0 {
2128
+			db = db.Where("x.item_id = ?", modetype)
2129
+			countSQL += " AND x.item_id=?"
2130
+			countParams = append(countParams, modetype)
2131
+		}
2132
+		if januaryStartStrUnix > 0 {
2133
+			db = db.Where("x.inspect_date >= ?", januaryStartStrUnix)
2134
+			countSQL += " AND x.inspect_date >=?"
2135
+			countParams = append(countParams, januaryStartStrUnix)
2136
+		}
2137
+		if decEndStrsUnix > 0 {
2138
+			db = db.Where("x.inspect_date <= ?", decEndStrsUnix)
2139
+			countSQL += " AND x.inspect_date <=?"
2140
+			countParams = append(countParams, decEndStrsUnix)
2141
+		}
2142
+		countSQL += ")a GROUP BY nnd"
2143
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
2144
+	}
2145
+
2146
+	if lapseto == 1 {
2147
+
2148
+		d := XTReadDB().Table("xt_patients as s")
2149
+		fmt.Println("d", d)
2150
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
2151
+		table := XTReadDB().Table("xt_quality_control_standard as r")
2152
+		fmt.Println(table)
2153
+		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
2154
+			"SELECT " +
2155
+			"CASE " +
2156
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '一月'" +
2157
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '二月'" +
2158
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '三月'" +
2159
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '四月'" +
2160
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '五月'" +
2161
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '六月'" +
2162
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '七月'" +
2163
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '八月'" +
2164
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '九月'" +
2165
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十月'" +
2166
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十一月'" +
2167
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十二月'" +
2168
+			" ELSE '其他'" +
2169
+			"END AS nnd FROM xt_inspection as x LEFT JOIN xt_quality_control_standard AS r ON r.inspection_minor = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1) and (x.inspect_value <> r.range_value)"
2170
+		countParams := make([]interface{}, 0)
2171
+		countParams = append(countParams, januaryStartStrUnix)
2172
+		countParams = append(countParams, januaryEndStrUnix)
2173
+		countParams = append(countParams, febStartStrStrUnix)
2174
+		countParams = append(countParams, febEndStrUnix)
2175
+		countParams = append(countParams, marchStartStrUnix)
2176
+		countParams = append(countParams, marchEndStrUnix)
2177
+		countParams = append(countParams, aprStartStrUnix)
2178
+		countParams = append(countParams, aprEndStrsUnix)
2179
+		countParams = append(countParams, mayStartStrUnix)
2180
+		countParams = append(countParams, mayEndStrsUnix)
2181
+		countParams = append(countParams, junStartStrUnix)
2182
+		countParams = append(countParams, junEndStrsUnix)
2183
+		countParams = append(countParams, julStartStrUnix)
2184
+		countParams = append(countParams, julEndStrsUnix)
2185
+		countParams = append(countParams, augStartStrUnix)
2186
+		countParams = append(countParams, augEndStrsUnix)
2187
+		countParams = append(countParams, sepStartStrUnix)
2188
+		countParams = append(countParams, sepEndStrsUnix)
2189
+		countParams = append(countParams, octStartStrUnix)
2190
+		countParams = append(countParams, octEndStrsUnix)
2191
+		countParams = append(countParams, novStartStrUnix)
2192
+		countParams = append(countParams, novEndStrsUnix)
2193
+		countParams = append(countParams, decStartStrUnix)
2194
+		countParams = append(countParams, decEndStrsUnix)
2195
+		if orgid > 0 {
2196
+			db = db.Where("x.org_id=?", orgid)
2197
+			countSQL += " AND x.org_id=?"
2198
+			countParams = append(countParams, orgid)
2199
+		}
2200
+		if modetype > 0 {
2201
+			db = db.Where("x.item_id = ?", modetype)
2202
+			countSQL += " AND x.item_id=?"
2203
+			countParams = append(countParams, modetype)
2204
+		}
2205
+		if januaryStartStrUnix > 0 {
2206
+			db = db.Where("x.inspect_date >= ?", januaryStartStrUnix)
2207
+			countSQL += " AND x.inspect_date >=?"
2208
+			countParams = append(countParams, januaryStartStrUnix)
2209
+		}
2210
+		if decEndStrsUnix > 0 {
2211
+			db = db.Where("x.inspect_date <= ?", decEndStrsUnix)
2212
+			countSQL += " AND x.inspect_date <=?"
2213
+			countParams = append(countParams, decEndStrsUnix)
2214
+		}
2215
+		countSQL += ")a GROUP BY nnd"
2216
+		err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
2217
+	}
2218
+
2219
+	if lapseto == 2 {
2220
+		d := XTReadDB().Table("xt_patients as s")
2221
+		fmt.Println("d", d)
2222
+		db := readDb.Table("xt_inspection as x ").Where("x.status=1 and x.inspect_type = 2")
2223
+		table := XTReadDB().Table("xt_quality_control_standard as r")
1551 2224
 		fmt.Println(table)
1552 2225
 		countSQL := "SELECT nnd AS 'total',COUNT(*) AS 'count' FROM(" +
1553 2226
 			"SELECT " +
1554 2227
 			"CASE " +
1555
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '一月'" +
1556
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '二月'" +
1557
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '三月'" +
1558
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '四月'" +
1559
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '五月'" +
1560
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '六月'" +
1561
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '七月'" +
1562
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '八月'" +
1563
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '九月'" +
1564
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十月'" +
1565
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十一月'" +
1566
-			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value+0>=r.range_min+0 and x.inspect_value +0 <= r.range_max+0  THEN '十二月'" +
2228
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '一月'" +
2229
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '二月'" +
2230
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '三月'" +
2231
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '四月'" +
2232
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '五月'" +
2233
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '六月'" +
2234
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '七月'" +
2235
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '八月'" +
2236
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '九月'" +
2237
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十月'" +
2238
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十一月'" +
2239
+			" WHEN x.inspect_date>=? AND  x.inspect_date<=? and x.inspect_value <> r.range_value  THEN '十二月'" +
1567 2240
 			" ELSE '其他'" +
1568
-			"END AS nnd FROM xt_inspection as x left join xt_inspection_reference as  r on r.id = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2) and (x.inspect_value + 0 >= r.range_min + 0 AND x.inspect_value + 0 <= r.range_max + 0)"
2241
+			"END AS nnd FROM xt_inspection as x LEFT JOIN xt_quality_control_standard AS r ON r.inspection_minor = x.item_id left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2) and (x.inspect_value <> r.range_value)"
1569 2242
 		countParams := make([]interface{}, 0)
1570 2243
 		countParams = append(countParams, januaryStartStrUnix)
1571 2244
 		countParams = append(countParams, januaryEndStrUnix)

+ 1 - 1
service/data.go Zobrazit soubor

@@ -190,7 +190,7 @@ func BatchInsertFiledConfig(org_id int64) (err error) {
190 190
 
191 191
 func BatchInsertQualityControl(org_id int64) (err error) {
192 192
 
193
-	err = readDb.Exec("INSERT INTO xt_quality_control_standard(user_org_id,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status) SELECT ?,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status FROM xt_quality_control_standard where user_org_id = 0", org_id).Error
193
+	err = readDb.Exec("INSERT INTO xt_quality_control_standard(user_org_id,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value) SELECT ?,inspection_major,inspection_minor,min_range,large_range,sort,created_time,status,range_type,range_value FROM xt_quality_control_standard where user_org_id = 0", org_id).Error
194 194
 	return
195 195
 }
196 196