XMLWAN 4 лет назад
Родитель
Сommit
1b397ae591

+ 4 - 4
conf/app.conf Просмотреть файл

@@ -149,26 +149,26 @@ readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
149 149
 readmysqlport = 3306
150 150
 readmysqluser = root
151 151
 readmysqlpass = 1Q2W3e4r!@#$
152
-readmysqlname = sgj_xt
152
+readmysqlname = test_xt
153 153
 
154 154
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
155 155
 writemysqlport = 3306
156 156
 writemysqluser = root
157 157
 writemysqlpass = 1Q2W3e4r!@#$
158
-writemysqlname = sgj_xt
158
+writemysqlname = test_xt
159 159
 
160 160
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
161 161
 readuserport = 3306
162 162
 readuseruser = root
163 163
 readuserpass = 1Q2W3e4r!@#$
164
-readusername = sgj_users
164
+readusername = test_users
165 165
 
166 166
 
167 167
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
168 168
 writeuserport = 3306
169 169
 writeuseruser = root
170 170
 writeuserpass = 1Q2W3e4r!@#$
171
-writeusername = sgj_users
171
+writeusername = test_users
172 172
 
173 173
 
174 174
 

+ 32 - 32
controllers/base_api_controller.go Просмотреть файл

@@ -69,36 +69,36 @@ type BaseAuthAPIController struct {
69 69
 func (this *BaseAuthAPIController) Prepare() {
70 70
 	this.BaseAPIController.Prepare()
71 71
 	if this.GetAdminUserInfo() == nil {
72
-		//var userAdmin models.AdminUser
73
-		//userAdmin.Id = 558
74
-		//userAdmin.Mobile = "13535547901"
75
-		//
76
-		////userAdmin.Id = 597
77
-		////userAdmin.Mobile = "19874122664"
78
-		//userAdmin.IsSuperAdmin = false
79
-		//userAdmin.Status = 1
80
-		//userAdmin.CreateTime = 1530786071
81
-		//userAdmin.ModifyTime = 1530786071
82
-		//var subscibe models.ServeSubscibe
83
-		//subscibe.ID = 1
84
-		//subscibe.OrgId = 3877
85
-		//subscibe.PeriodStart = 1538035409
86
-		//subscibe.PeriodEnd = 1569571409
87
-		//subscibe.State = 1
88
-		//subscibe.Status = 1
89
-		//subscibe.CreatedTime = 1538035409
90
-		//subscibe.UpdatedTime = 1538035409
91
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
-		//subscibes[4] = &subscibe
93
-		//var adminUserInfo service.AdminUserInfo
94
-		//adminUserInfo.CurrentOrgId = 3877
95
-		//adminUserInfo.CurrentAppId = 18
96
-		//adminUserInfo.AdminUser = &userAdmin
97
-		//adminUserInfo.Subscibes = subscibes
98
-		//this.SetSession("admin_user_info", &adminUserInfo)
99
-
100
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101
-		this.StopRun()
72
+		var userAdmin models.AdminUser
73
+		userAdmin.Id = 558
74
+		userAdmin.Mobile = "13535547901"
75
+
76
+		//userAdmin.Id = 597
77
+		//userAdmin.Mobile = "19874122664"
78
+		userAdmin.IsSuperAdmin = false
79
+		userAdmin.Status = 1
80
+		userAdmin.CreateTime = 1530786071
81
+		userAdmin.ModifyTime = 1530786071
82
+		var subscibe models.ServeSubscibe
83
+		subscibe.ID = 1
84
+		subscibe.OrgId = 9841
85
+		subscibe.PeriodStart = 1538035409
86
+		subscibe.PeriodEnd = 1569571409
87
+		subscibe.State = 1
88
+		subscibe.Status = 1
89
+		subscibe.CreatedTime = 1538035409
90
+		subscibe.UpdatedTime = 1538035409
91
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
+		subscibes[4] = &subscibe
93
+		var adminUserInfo service.AdminUserInfo
94
+		adminUserInfo.CurrentOrgId = 9841
95
+		adminUserInfo.CurrentAppId = 18
96
+		adminUserInfo.AdminUser = &userAdmin
97
+		adminUserInfo.Subscibes = subscibes
98
+		this.SetSession("admin_user_info", &adminUserInfo)
99
+
100
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101
+		//this.StopRun()
102 102
 
103 103
 	}
104 104
 
@@ -326,7 +326,7 @@ func (this *BaseServeAPIController) Prepare() {
326 326
 		userAdmin.ModifyTime = 1530786071
327 327
 		var subscibe models.ServeSubscibe
328 328
 		subscibe.ID = 1
329
-		subscibe.OrgId = 7957
329
+		subscibe.OrgId = 9841
330 330
 		subscibe.PeriodStart = 1538035409
331 331
 		subscibe.PeriodEnd = 1569571409
332 332
 		subscibe.State = 1
@@ -336,7 +336,7 @@ func (this *BaseServeAPIController) Prepare() {
336 336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337 337
 		subscibes[4] = &subscibe
338 338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 7957
339
+		adminUserInfo.CurrentOrgId = 9841
340 340
 		adminUserInfo.CurrentAppId = 18
341 341
 		adminUserInfo.AdminUser = &userAdmin
342 342
 		adminUserInfo.Subscibes = subscibes

+ 2 - 2
controllers/mobile_api_controllers/login_api_controller.go Просмотреть файл

@@ -32,8 +32,8 @@ func (this *LoginAPIController) LoginByPwd() {
32 32
 	}
33 33
 	ip := utils.GetIP(this.Ctx.Request)
34 34
 
35
-	ssoDomain := beego.AppConfig.String("sso_domain")
36
-	//ssoDomain := "http://localhost:8091"
35
+	//ssoDomain := beego.AppConfig.String("sso_domain")
36
+	ssoDomain := "http://localhost:8091"
37 37
 	api := ssoDomain + "/m/login/pwd"
38 38
 	values := make(url.Values)
39 39
 	values.Set("mobile", mobile)

+ 480 - 4
controllers/new_mobile_api_controllers/common_api_controller.go Просмотреть файл

@@ -124,6 +124,7 @@ func (this *CommonApiController) SaveConfiguration() {
124 124
 				RangeType:       checktype,
125 125
 				RangeValue:      rangvalue,
126 126
 				CreatedTime:     time.Now().Unix(),
127
+				IsStatus:        1,
127 128
 			}
128 129
 			fmt.Println(standard)
129 130
 			err = service.SaveInspection(&standard)
@@ -178,6 +179,7 @@ func (this *CommonApiController) GetConfigurationlist() {
178 179
 	major, _ := service.GetInspectionMajor(orgid)
179 180
 	if len(major) == 0 {
180 181
 		configurationlist, total, err := service.GetConfigurationlist(orgid, limit, page)
182
+		pressure, err := service.GetDefaultBloodPressure(orgid)
181 183
 		if err != nil {
182 184
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
183 185
 			return
@@ -185,9 +187,11 @@ func (this *CommonApiController) GetConfigurationlist() {
185 187
 		this.ServeSuccessJSON(map[string]interface{}{
186 188
 			"configurationlist": configurationlist,
187 189
 			"total":             total,
190
+			"pressure":          pressure,
188 191
 		})
189 192
 	} else {
190 193
 		configurationlist, total, err := service.GetConfigurationListTwo(orgid, limit, page)
194
+		pressure, err := service.GetDefaultBloodPressure(orgid)
191 195
 		if err != nil {
192 196
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
193 197
 			return
@@ -195,6 +199,7 @@ func (this *CommonApiController) GetConfigurationlist() {
195 199
 		this.ServeSuccessJSON(map[string]interface{}{
196 200
 			"configurationlist": configurationlist,
197 201
 			"total":             total,
202
+			"pressure":          pressure,
198 203
 		})
199 204
 	}
200 205
 
@@ -202,7 +207,7 @@ func (this *CommonApiController) GetConfigurationlist() {
202 207
 
203 208
 func (this *CommonApiController) GetConfigurationDetail() {
204 209
 	id, _ := this.GetInt64("id")
205
-	//fmt.Println("id是", id)
210
+	fmt.Println("id是", id)
206 211
 	orgId := this.GetAdminUserInfo().CurrentOrgId
207 212
 	detail, err := service.GetConfigurationDetail(id)
208 213
 	major, err := service.GetInspectionMajor(orgId)
@@ -1041,12 +1046,15 @@ func (this *CommonApiController) GetNormData() {
1041 1046
 	orgid := this.GetAdminUserInfo().CurrentOrgId
1042 1047
 	//获取系统数据
1043 1048
 	normdata, err := service.GetNormDataByOrgId(orgid)
1049
+	//获取血压数据
1050
+	bloodPressure, err := service.GetDefaultBloodPressure(orgid)
1044 1051
 	if err != nil {
1045 1052
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1046 1053
 		return
1047 1054
 	}
1048 1055
 	this.ServeSuccessJSON(map[string]interface{}{
1049
-		"normdata": normdata,
1056
+		"normdata":      normdata,
1057
+		"bloodPressure": bloodPressure,
1050 1058
 	})
1051 1059
 	//if len(normdata) == 0 {
1052 1060
 	//	normdata, err := service.GetNormData(0)
@@ -1090,13 +1098,31 @@ func (this *CommonApiController) GetFirstQuarter() {
1090 1098
 	count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto)
1091 1099
 	//统计rang_type== 2
1092 1100
 	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
1101
+
1102
+	//获取收缩压数据
1103
+	_, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
1104
+	//统计收缩压合格的数据
1105
+	systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
1106
+
1107
+	//获取舒张压数据
1108
+	_, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
1109
+	//获取合格舒张压数据
1110
+	diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
1111
+	normData, _ := service.GetNormData(orgid)
1093 1112
 	if err != nil {
1094 1113
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1095 1114
 		return
1096 1115
 	}
1097 1116
 	this.ServeSuccessJSON(map[string]interface{}{
1098
-		"count":   count,
1099
-		"countwo": countwo,
1117
+		"count":          count,
1118
+		"countwo":        countwo,
1119
+		"systolic":       systolic,
1120
+		"systolicTotal":  systolicTotal,
1121
+		"sysstandTotal":  sysstandTotal,
1122
+		"diastolic":      diastolic,
1123
+		"diastotal":      diastotal,
1124
+		"diasstandtotal": diasstandtotal,
1125
+		"normData":       normData,
1100 1126
 	})
1101 1127
 }
1102 1128
 
@@ -1564,3 +1590,453 @@ func (this *CommonApiController) GetPatientComplianceDetail() {
1564 1590
 		"list": list,
1565 1591
 	})
1566 1592
 }
1593
+
1594
+func (this *CommonApiController) GetBloodPressureDetail() {
1595
+	id, _ := this.GetInt64("id")
1596
+	blooddetail, err := service.GetBloodPressureDetail(id)
1597
+	if err != nil {
1598
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1599
+		return
1600
+	}
1601
+
1602
+	this.ServeSuccessJSON(map[string]interface{}{
1603
+
1604
+		"blooddetail": blooddetail,
1605
+	})
1606
+}
1607
+
1608
+func (this *CommonApiController) UpdateBloodPrussre() {
1609
+	id, _ := this.GetInt64("id")
1610
+	fmt.Println("id", id)
1611
+	dataBody := make(map[string]interface{}, 0)
1612
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1613
+	fmt.Println("err", err)
1614
+	inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
1615
+	fmt.Println("inspectionmajor", inspectionmajor)
1616
+	inspectionminor := int64(dataBody["inspectionMinor"].(float64))
1617
+	fmt.Println("inspectionminor", inspectionminor)
1618
+	largerange := dataBody["large_range"].(string)
1619
+	fmt.Println(largerange)
1620
+	minrange := dataBody["min_range"].(string)
1621
+	fmt.Print(minrange)
1622
+	sort := int64(dataBody["sort"].(float64))
1623
+	fmt.Print("sort", sort)
1624
+	standard := models.XtQualityControlStandard{
1625
+		InspectionMajor: inspectionmajor,
1626
+		InspectionMinor: inspectionminor,
1627
+		MinRange:        minrange,
1628
+		Sort:            sort,
1629
+		LargeRange:      largerange,
1630
+	}
1631
+	err = service.UpdateBloodPressure(&standard, id)
1632
+	if err != nil {
1633
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1634
+		return
1635
+	}
1636
+
1637
+	this.ServeSuccessJSON(map[string]interface{}{
1638
+
1639
+		"standard": standard,
1640
+	})
1641
+}
1642
+
1643
+func (this *CommonApiController) GetBloodPressureList() {
1644
+	adminUser := this.GetAdminUserInfo()
1645
+	orgId := adminUser.CurrentOrgId
1646
+	bloodType, _ := this.GetInt64("bloodType")
1647
+	fmt.Println(bloodType)
1648
+	firstQuarterStart := this.GetString("first_quarter_start")
1649
+	firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
1650
+	firstQuarterStartUnix := firstQuarterStartStr.Unix()
1651
+	fmt.Println("第一季度", firstQuarterStartUnix)
1652
+	fisrtQuarterEnd := this.GetString("first_qurter_end")
1653
+	fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
1654
+	fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
1655
+	fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
1656
+	fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
1657
+	secondeQuarterStart := this.GetString("second_qurter_start")
1658
+	secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
1659
+	secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
1660
+	fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
1661
+	secondQuarterEnd := this.GetString("second_qurter_end")
1662
+	secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
1663
+	secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
1664
+	secondQuarterEndStrUnix := secondQuarterEnds.Unix()
1665
+	fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
1666
+
1667
+	threeQuarterStart := this.GetString("three_qurter_start")
1668
+	threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
1669
+	threeQuarterStartUnix := threeQuarterStartStr.Unix()
1670
+	fmt.Println("第三季度", threeQuarterStartUnix)
1671
+	threeQuarterEnd := this.GetString("three_qurter_end")
1672
+	threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
1673
+	threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
1674
+	threeQuarterEndStrUnix := threeQuarterEnds.Unix()
1675
+	fmt.Println("第三季度", threeQuarterEndStrUnix)
1676
+	fourQuarterStart := this.GetString("four_qurter_start")
1677
+	fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
1678
+	fourQuarterStartUnix := fourQuarterStartStr.Unix()
1679
+	fmt.Println("第四季度", fourQuarterStartUnix)
1680
+	fourQuarterEnd := this.GetString("four_qurter_end")
1681
+	fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
1682
+	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
1683
+	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
1684
+	fmt.Println("第四季度", fourQuarterEndStrUnix)
1685
+	if bloodType == -1 {
1686
+		//统计收缩压第一季度的总数
1687
+		_, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1688
+		//统计收缩压第一季合格的总数
1689
+		_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1690
+		//统计第二季收缩压总数
1691
+		_, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1692
+		//第二季度合格总数
1693
+		_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1694
+		//统计第三季收缩压总数
1695
+		_, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1696
+		//第三季度合格数
1697
+		_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1698
+		//第四季度总数
1699
+		_, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1700
+		//第四季度合格总数
1701
+		_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1702
+		if err != nil {
1703
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1704
+			return
1705
+		}
1706
+
1707
+		this.ServeSuccessJSON(map[string]interface{}{
1708
+			"firstTotal":        firstTotal,
1709
+			"firstStandTotal":   firstStandTotal,
1710
+			"secondeTotal":      secondeTotal,
1711
+			"secondeStandTotal": secondeStandTotal,
1712
+			"threeTotal":        threeTotal,
1713
+			"threeStandTotal":   threeStandTotal,
1714
+			"fourTotal":         fourTotal,
1715
+			"fourStandTotal":    fourStandTotal,
1716
+		})
1717
+	}
1718
+
1719
+	if bloodType == -2 {
1720
+		//统计舒张压第一季度的总数
1721
+		_, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1722
+		_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1723
+		_, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1724
+		_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1725
+		_, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1726
+		_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1727
+		_, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1728
+		_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1729
+
1730
+		if err != nil {
1731
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1732
+			return
1733
+		}
1734
+
1735
+		this.ServeSuccessJSON(map[string]interface{}{
1736
+			"firstTotal":        firstTotal,
1737
+			"firstStandTotal":   firstStandTotal,
1738
+			"secondeTotal":      secondeTotal,
1739
+			"secondeStandTotal": secondeStandTotal,
1740
+			"threeTotal":        threeTotal,
1741
+			"threeStandTotal":   threeStandTotal,
1742
+			"fourTotal":         fourTotal,
1743
+			"fourStandTotal":    fourStandTotal,
1744
+		})
1745
+	}
1746
+}
1747
+
1748
+func (this *CommonApiController) GetMonthBloodList() {
1749
+
1750
+	bloodtype, _ := this.GetInt64("bloodType")
1751
+	fmt.Println(bloodtype)
1752
+	januaryStart := this.GetString("januaryStart")
1753
+
1754
+	januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
1755
+	januaryStartStrUnix := januaryStartStr.Unix()
1756
+	fmt.Println(januaryStartStrUnix)
1757
+	januaryEnd := this.GetString("januaryEnd")
1758
+
1759
+	januaryEndStr := januaryEnd + " 23:59:59"
1760
+	januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
1761
+	januaryEndStrUnix := januaryEndStrs.Unix()
1762
+	fmt.Println(januaryEndStrUnix)
1763
+	febStart := this.GetString("febStart")
1764
+
1765
+	febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
1766
+	febStartStrStrUnix := febStartStr.Unix()
1767
+	fmt.Println(febStartStrStrUnix)
1768
+	febEnd := this.GetString("febEnd")
1769
+
1770
+	febEndStr := febEnd + " 23:59:59"
1771
+	febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
1772
+	febEndStrUnix := febEndStrs.Unix()
1773
+	fmt.Println(febEndStrUnix)
1774
+	marchStart := this.GetString("marchStart")
1775
+
1776
+	marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
1777
+	marchStartStrUnix := marchStartStr.Unix()
1778
+	fmt.Println(marchStartStrUnix)
1779
+	marchEnd := this.GetString("marchEnd")
1780
+
1781
+	marchEndStr := marchEnd + " 23:59:59"
1782
+	marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
1783
+	marchEndStrUnix := marchEndStrs.Unix()
1784
+	fmt.Println(marchEndStrUnix)
1785
+	aprStart := this.GetString("aprStart")
1786
+
1787
+	aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
1788
+	aprStartStrUnix := aprStartStr.Unix()
1789
+	fmt.Println(aprStartStrUnix)
1790
+	aprEnd := this.GetString("aprEnd")
1791
+
1792
+	aprEndStr := aprEnd + " 23:59:59"
1793
+	aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
1794
+	aprEndStrsUnix := aprEndStrs.Unix()
1795
+	fmt.Println(aprEndStrsUnix)
1796
+	mayStart := this.GetString("mayStart")
1797
+
1798
+	mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
1799
+	mayStartStrUnix := mayStartStr.Unix()
1800
+	fmt.Println(mayStartStrUnix)
1801
+	mayEnd := this.GetString("mayEnd")
1802
+
1803
+	mayEndStr := mayEnd + " 23:59:59"
1804
+	mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
1805
+	mayEndStrsUnix := mayEndStrs.Unix()
1806
+	fmt.Println(mayEndStrsUnix)
1807
+	junStart := this.GetString("junStart")
1808
+
1809
+	junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
1810
+	junStartStrUnix := junStartStr.Unix()
1811
+	fmt.Println(junStartStrUnix)
1812
+	junEnd := this.GetString("junEnd")
1813
+
1814
+	junEndStr := junEnd + " 23:59:59"
1815
+	junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
1816
+	junEndStrsUnix := junEndStrs.Unix()
1817
+	fmt.Println(junEndStrsUnix)
1818
+	julStart := this.GetString("julStart")
1819
+
1820
+	julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
1821
+	julStartStrUnix := julStartStr.Unix()
1822
+	fmt.Println(julStartStrUnix)
1823
+	julEnd := this.GetString("julEnd")
1824
+
1825
+	julEndStr := julEnd + " 23:59:59"
1826
+	julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
1827
+	julEndStrsUnix := julEndStrs.Unix()
1828
+	fmt.Println(julEndStrsUnix)
1829
+	augStart := this.GetString("augStart")
1830
+
1831
+	augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
1832
+	augStartStrUnix := augStartStr.Unix()
1833
+	fmt.Print(augStartStrUnix)
1834
+	augEnd := this.GetString("augEnd")
1835
+
1836
+	augEndStr := augEnd + " 23:59:59"
1837
+	augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
1838
+	augEndStrsUnix := augEndStrs.Unix()
1839
+	fmt.Println(augEndStrsUnix)
1840
+	sepStart := this.GetString("sepStart")
1841
+
1842
+	sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
1843
+	sepStartStrUnix := sepStartStr.Unix()
1844
+	fmt.Println(sepStartStrUnix)
1845
+	sepEnd := this.GetString("sepEnd")
1846
+
1847
+	sepEndStr := sepEnd + " 23:59:59"
1848
+	sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
1849
+	sepEndStrsUnix := sepEndStrs.Unix()
1850
+	fmt.Println(sepEndStrsUnix)
1851
+	octStart := this.GetString("octStart")
1852
+
1853
+	octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
1854
+	octStartStrUnix := octStartStr.Unix()
1855
+	fmt.Println(octStartStrUnix)
1856
+	octEnd := this.GetString("octEnd")
1857
+
1858
+	octEndStr := octEnd + " 23:59:59"
1859
+	octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
1860
+	octEndStrsUnix := octEndStrs.Unix()
1861
+	fmt.Println(octEndStrsUnix)
1862
+	novStart := this.GetString("novStart")
1863
+
1864
+	novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
1865
+	novStartStrUnix := novStartStr.Unix()
1866
+	fmt.Println(novStartStrUnix)
1867
+	novEnd := this.GetString("novEnd")
1868
+
1869
+	novEndStr := novEnd + " 23:59:59"
1870
+	novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
1871
+	novEndStrsUnix := novEndStrs.Unix()
1872
+	fmt.Println(novEndStrsUnix)
1873
+	decStart := this.GetString("decStart")
1874
+
1875
+	decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
1876
+	decStartStrUnix := decStartStr.Unix()
1877
+	fmt.Println("12月使", decStartStrUnix)
1878
+	decEnd := this.GetString("decEnd")
1879
+
1880
+	decEndStr := decEnd + " 23:59:59"
1881
+	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
1882
+	decEndStrsUnix := decEndStrs.Unix()
1883
+	fmt.Println(decEndStrsUnix)
1884
+
1885
+	adminUser := this.GetAdminUserInfo()
1886
+	orgId := adminUser.CurrentOrgId
1887
+	//统计收缩压
1888
+	if bloodtype == -1 {
1889
+		//统计收缩压一月总数
1890
+		_, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1891
+		_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1892
+
1893
+		//二月
1894
+		_, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1895
+		_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1896
+
1897
+		//三月
1898
+		_, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1899
+		_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1900
+
1901
+		//四月
1902
+		_, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1903
+		_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1904
+
1905
+		//五月
1906
+		_, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1907
+		_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1908
+
1909
+		//六月
1910
+		_, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1911
+		_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1912
+		//7月
1913
+		_, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1914
+		_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1915
+
1916
+		//8月
1917
+		_, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1918
+		_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1919
+
1920
+		//9月
1921
+		_, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1922
+		_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1923
+		//10月
1924
+		_, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1925
+		_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1926
+		//11月
1927
+		_, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1928
+		_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1929
+		//12月
1930
+		_, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1931
+		_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1932
+		if err != nil {
1933
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1934
+			return
1935
+		}
1936
+
1937
+		this.ServeSuccessJSON(map[string]interface{}{
1938
+			"januaryTotal":      januaryTotal,
1939
+			"januaryStandTotal": januaryStandTotal,
1940
+			"febTotal":          febTotal,
1941
+			"febStandTotal":     febStandTotal,
1942
+			"marchTotal":        marchTotal,
1943
+			"marchStandTotal":   marchStandTotal,
1944
+			"aprTotal":          aprTotal,
1945
+			"aprStandTotal":     aprStandTotal,
1946
+			"mayTotal":          mayTotal,
1947
+			"mayStandTotal":     mayStandTotal,
1948
+			"junTotal":          junTotal,
1949
+			"junStandTotal":     junStandTotal,
1950
+			"julTotal":          julTotal,
1951
+			"julStandTotal":     julStandTotal,
1952
+			"augTotal":          augTotal,
1953
+			"augStandTotal":     augStandTotal,
1954
+			"sepTotal":          sepTotal,
1955
+			"sepStandTotal":     sepStandTotal,
1956
+			"octTotal":          octTotal,
1957
+			"octStandTotal":     octStandTotal,
1958
+			"novTotal":          novTotal,
1959
+			"novStandTotal":     novStandTotal,
1960
+			"decTotal":          decTotal,
1961
+			"decStandTotal":     decStandTotal,
1962
+		})
1963
+	}
1964
+
1965
+	//统计舒张压
1966
+	if bloodtype == -2 {
1967
+		//统计收缩压一月总数
1968
+		_, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1969
+		_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1970
+
1971
+		//二月
1972
+		_, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1973
+		_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1974
+
1975
+		//三月
1976
+		_, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1977
+		_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1978
+
1979
+		//四月
1980
+		_, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1981
+		_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1982
+
1983
+		//五月
1984
+		_, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1985
+		_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1986
+
1987
+		//六月
1988
+		_, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1989
+		_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
1990
+		//7月
1991
+		_, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1992
+		_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
1993
+
1994
+		//8月
1995
+		_, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1996
+		_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
1997
+
1998
+		//9月
1999
+		_, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
2000
+		_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
2001
+		//10月
2002
+		_, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
2003
+		_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
2004
+		//11月
2005
+		_, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
2006
+		_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
2007
+		//12月
2008
+		_, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
2009
+		_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
2010
+		if err != nil {
2011
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2012
+			return
2013
+		}
2014
+
2015
+		this.ServeSuccessJSON(map[string]interface{}{
2016
+			"januaryTotal":      januaryTotal,
2017
+			"januaryStandTotal": januaryStandTotal,
2018
+			"febTotal":          febTotal,
2019
+			"febStandTotal":     febStandTotal,
2020
+			"marchTotal":        marchTotal,
2021
+			"marchStandTotal":   marchStandTotal,
2022
+			"aprTotal":          aprTotal,
2023
+			"aprStandTotal":     aprStandTotal,
2024
+			"mayTotal":          mayTotal,
2025
+			"mayStandTotal":     mayStandTotal,
2026
+			"junTotal":          junTotal,
2027
+			"junStandTotal":     junStandTotal,
2028
+			"julTotal":          julTotal,
2029
+			"julStandTotal":     julStandTotal,
2030
+			"augTotal":          augTotal,
2031
+			"augStandTotal":     augStandTotal,
2032
+			"sepTotal":          sepTotal,
2033
+			"sepStandTotal":     sepStandTotal,
2034
+			"octTotal":          octTotal,
2035
+			"octStandTotal":     octStandTotal,
2036
+			"novTotal":          novTotal,
2037
+			"novStandTotal":     novStandTotal,
2038
+			"decTotal":          decTotal,
2039
+			"decStandTotal":     decStandTotal,
2040
+		})
2041
+	}
2042
+}

+ 4 - 0
controllers/new_mobile_api_controllers/common_api_router.go Просмотреть файл

@@ -51,4 +51,8 @@ func CommonApiControllersRegisterRouters() {
51 51
 	beego.Router("/com/api/getqualitycontrol", &CommonApiController{}, "Get:GetQualityControl")
52 52
 	beego.Router("/com/api/gettreatlist", &CommonApiController{}, "Get:GetTreatlist")
53 53
 	beego.Router("/com/api/getpatientcompliancedetal", &CommonApiController{}, "Get:GetPatientComplianceDetail")
54
+	beego.Router("/com/api/getbloodpressuredetail", &CommonApiController{}, "Get:GetBloodPressureDetail")
55
+	beego.Router("/com/api/updatebloodprussre", &CommonApiController{}, "Post:UpdateBloodPrussre")
56
+	beego.Router("/com/api/getbloodpressurelist", &CommonApiController{}, "Get:GetBloodPressureList")
57
+	beego.Router("/com/api/getmonthbloodlist", &CommonApiController{}, "Get:GetMonthBloodList")
54 58
 }

+ 962 - 3
controllers/new_mobile_api_controllers/new_common_api_controller.go Просмотреть файл

@@ -395,6 +395,7 @@ func (this *NewCommonApiController) GetMobileNormdata() {
395 395
 	orgid := adminInfo.Org.Id
396 396
 	//获取系统数据
397 397
 	normdata, err := service.GetNormDataByOrgId(orgid)
398
+	bloodPressure, err := service.GetDefaultBloodPressure(orgid)
398 399
 	//if len(normdata) == 0 {
399 400
 	//	normdata, err := service.GetNormData(0)
400 401
 	//	if err != nil {
@@ -410,7 +411,8 @@ func (this *NewCommonApiController) GetMobileNormdata() {
410 411
 		return
411 412
 	}
412 413
 	this.ServeSuccessJSON(map[string]interface{}{
413
-		"normdata": normdata,
414
+		"normdata":      normdata,
415
+		"bloodPressure": bloodPressure,
414 416
 	})
415 417
 }
416 418
 
@@ -518,13 +520,30 @@ func (this *NewCommonApiController) GetMobileFirstQuarter() {
518 520
 
519 521
 	count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto)
520 522
 	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
523
+	//获取收缩压数据
524
+	_, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
525
+	//统计收缩压合格的数据
526
+	systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
527
+
528
+	//获取舒张压数据
529
+	_, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
530
+	//获取合格舒张压数据
531
+	diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
532
+	normData, _ := service.GetNormData(orgid)
521 533
 	if err != nil {
522 534
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
523 535
 		return
524 536
 	}
525 537
 	this.ServeSuccessJSON(map[string]interface{}{
526
-		"count":   count,
527
-		"countwo": countwo,
538
+		"count":          count,
539
+		"countwo":        countwo,
540
+		"systolic":       systolic,
541
+		"systolicTotal":  systolicTotal,
542
+		"sysstandTotal":  sysstandTotal,
543
+		"diastolic":      diastolic,
544
+		"diastotal":      diastotal,
545
+		"diasstandtotal": diasstandtotal,
546
+		"normData":       normData,
528 547
 	})
529 548
 }
530 549
 
@@ -964,3 +983,943 @@ func (this *NewCommonApiController) GetPatientComplianceDetail() {
964 983
 		"list": list,
965 984
 	})
966 985
 }
986
+
987
+func (this *NewCommonApiController) GetMoblieBloodList() {
988
+	adminInfo := this.GetMobileAdminUserInfo()
989
+	orgId := adminInfo.Org.Id
990
+	bloodType, _ := this.GetInt64("bloodType")
991
+	fmt.Println(bloodType)
992
+	firstQuarterStart := this.GetString("first_quarter_start")
993
+	firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
994
+	firstQuarterStartUnix := firstQuarterStartStr.Unix()
995
+	fmt.Println("第一季度", firstQuarterStartUnix)
996
+	fisrtQuarterEnd := this.GetString("first_qurter_end")
997
+	fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
998
+	fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
999
+	fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
1000
+	fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
1001
+	secondeQuarterStart := this.GetString("second_qurter_start")
1002
+	secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
1003
+	secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
1004
+	fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
1005
+	secondQuarterEnd := this.GetString("second_qurter_end")
1006
+	secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
1007
+	secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
1008
+	secondQuarterEndStrUnix := secondQuarterEnds.Unix()
1009
+	fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
1010
+
1011
+	threeQuarterStart := this.GetString("three_qurter_start")
1012
+	threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
1013
+	threeQuarterStartUnix := threeQuarterStartStr.Unix()
1014
+	fmt.Println("第三季度", threeQuarterStartUnix)
1015
+	threeQuarterEnd := this.GetString("three_qurter_end")
1016
+	threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
1017
+	threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
1018
+	threeQuarterEndStrUnix := threeQuarterEnds.Unix()
1019
+	fmt.Println("第三季度", threeQuarterEndStrUnix)
1020
+	fourQuarterStart := this.GetString("four_qurter_start")
1021
+	fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
1022
+	fourQuarterStartUnix := fourQuarterStartStr.Unix()
1023
+	fmt.Println("第四季度", fourQuarterStartUnix)
1024
+	fourQuarterEnd := this.GetString("four_qurter_end")
1025
+	fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
1026
+	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
1027
+	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
1028
+	fmt.Println("第四季度", fourQuarterEndStrUnix)
1029
+	if bloodType == -1 {
1030
+		//统计收缩压第一季度的总数
1031
+		_, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1032
+		//统计收缩压第一季合格的总数
1033
+		_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1034
+		//统计第二季收缩压总数
1035
+		_, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1036
+		//第二季度合格总数
1037
+		_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1038
+		//统计第三季收缩压总数
1039
+		_, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1040
+		//第三季度合格数
1041
+		_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1042
+		//第四季度总数
1043
+		_, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1044
+		//第四季度合格总数
1045
+		_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1046
+		if err != nil {
1047
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1048
+			return
1049
+		}
1050
+
1051
+		this.ServeSuccessJSON(map[string]interface{}{
1052
+			"firstTotal":        firstTotal,
1053
+			"firstStandTotal":   firstStandTotal,
1054
+			"secondeTotal":      secondeTotal,
1055
+			"secondeStandTotal": secondeStandTotal,
1056
+			"threeTotal":        threeTotal,
1057
+			"threeStandTotal":   threeStandTotal,
1058
+			"fourTotal":         fourTotal,
1059
+			"fourStandTotal":    fourStandTotal,
1060
+		})
1061
+	}
1062
+	if bloodType == -2 {
1063
+		//统计舒张压第一季度的总数
1064
+		_, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1065
+		_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1066
+		_, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1067
+		_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1068
+		_, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1069
+		_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1070
+		_, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1071
+		_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1072
+
1073
+		if err != nil {
1074
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1075
+			return
1076
+		}
1077
+
1078
+		this.ServeSuccessJSON(map[string]interface{}{
1079
+			"firstTotal":        firstTotal,
1080
+			"firstStandTotal":   firstStandTotal,
1081
+			"secondeTotal":      secondeTotal,
1082
+			"secondeStandTotal": secondeStandTotal,
1083
+			"threeTotal":        threeTotal,
1084
+			"threeStandTotal":   threeStandTotal,
1085
+			"fourTotal":         fourTotal,
1086
+			"fourStandTotal":    fourStandTotal,
1087
+		})
1088
+	}
1089
+}
1090
+
1091
+func (this *NewCommonApiController) GetBloodMonthList() {
1092
+	bloodtype, _ := this.GetInt64("bloodType")
1093
+	fmt.Println(bloodtype)
1094
+	januaryStart := this.GetString("januaryStart")
1095
+
1096
+	januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
1097
+	januaryStartStrUnix := januaryStartStr.Unix()
1098
+	fmt.Println(januaryStartStrUnix)
1099
+	januaryEnd := this.GetString("januaryEnd")
1100
+
1101
+	januaryEndStr := januaryEnd + " 23:59:59"
1102
+	januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
1103
+	januaryEndStrUnix := januaryEndStrs.Unix()
1104
+	fmt.Println(januaryEndStrUnix)
1105
+	febStart := this.GetString("febStart")
1106
+
1107
+	febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
1108
+	febStartStrStrUnix := febStartStr.Unix()
1109
+	fmt.Println(febStartStrStrUnix)
1110
+	febEnd := this.GetString("febEnd")
1111
+
1112
+	febEndStr := febEnd + " 23:59:59"
1113
+	febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
1114
+	febEndStrUnix := febEndStrs.Unix()
1115
+	fmt.Println(febEndStrUnix)
1116
+	marchStart := this.GetString("marchStart")
1117
+
1118
+	marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
1119
+	marchStartStrUnix := marchStartStr.Unix()
1120
+	fmt.Println(marchStartStrUnix)
1121
+	marchEnd := this.GetString("marchEnd")
1122
+
1123
+	marchEndStr := marchEnd + " 23:59:59"
1124
+	marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
1125
+	marchEndStrUnix := marchEndStrs.Unix()
1126
+	fmt.Println(marchEndStrUnix)
1127
+	aprStart := this.GetString("aprStart")
1128
+
1129
+	aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
1130
+	aprStartStrUnix := aprStartStr.Unix()
1131
+	fmt.Println(aprStartStrUnix)
1132
+	aprEnd := this.GetString("aprEnd")
1133
+
1134
+	aprEndStr := aprEnd + " 23:59:59"
1135
+	aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
1136
+	aprEndStrsUnix := aprEndStrs.Unix()
1137
+	fmt.Println(aprEndStrsUnix)
1138
+	mayStart := this.GetString("mayStart")
1139
+
1140
+	mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
1141
+	mayStartStrUnix := mayStartStr.Unix()
1142
+	fmt.Println(mayStartStrUnix)
1143
+	mayEnd := this.GetString("mayEnd")
1144
+
1145
+	mayEndStr := mayEnd + " 23:59:59"
1146
+	mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
1147
+	mayEndStrsUnix := mayEndStrs.Unix()
1148
+	fmt.Println(mayEndStrsUnix)
1149
+	junStart := this.GetString("junStart")
1150
+
1151
+	junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
1152
+	junStartStrUnix := junStartStr.Unix()
1153
+	fmt.Println(junStartStrUnix)
1154
+	junEnd := this.GetString("junEnd")
1155
+
1156
+	junEndStr := junEnd + " 23:59:59"
1157
+	junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
1158
+	junEndStrsUnix := junEndStrs.Unix()
1159
+	fmt.Println(junEndStrsUnix)
1160
+	julStart := this.GetString("julStart")
1161
+
1162
+	julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
1163
+	julStartStrUnix := julStartStr.Unix()
1164
+	fmt.Println(julStartStrUnix)
1165
+	julEnd := this.GetString("julEnd")
1166
+
1167
+	julEndStr := julEnd + " 23:59:59"
1168
+	julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
1169
+	julEndStrsUnix := julEndStrs.Unix()
1170
+	fmt.Println(julEndStrsUnix)
1171
+	augStart := this.GetString("augStart")
1172
+
1173
+	augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
1174
+	augStartStrUnix := augStartStr.Unix()
1175
+	fmt.Print(augStartStrUnix)
1176
+	augEnd := this.GetString("augEnd")
1177
+
1178
+	augEndStr := augEnd + " 23:59:59"
1179
+	augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
1180
+	augEndStrsUnix := augEndStrs.Unix()
1181
+	fmt.Println(augEndStrsUnix)
1182
+	sepStart := this.GetString("sepStart")
1183
+
1184
+	sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
1185
+	sepStartStrUnix := sepStartStr.Unix()
1186
+	fmt.Println(sepStartStrUnix)
1187
+	sepEnd := this.GetString("sepEnd")
1188
+
1189
+	sepEndStr := sepEnd + " 23:59:59"
1190
+	sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
1191
+	sepEndStrsUnix := sepEndStrs.Unix()
1192
+	fmt.Println(sepEndStrsUnix)
1193
+	octStart := this.GetString("octStart")
1194
+
1195
+	octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
1196
+	octStartStrUnix := octStartStr.Unix()
1197
+	fmt.Println(octStartStrUnix)
1198
+	octEnd := this.GetString("octEnd")
1199
+
1200
+	octEndStr := octEnd + " 23:59:59"
1201
+	octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
1202
+	octEndStrsUnix := octEndStrs.Unix()
1203
+	fmt.Println(octEndStrsUnix)
1204
+	novStart := this.GetString("novStart")
1205
+
1206
+	novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
1207
+	novStartStrUnix := novStartStr.Unix()
1208
+	fmt.Println(novStartStrUnix)
1209
+	novEnd := this.GetString("novEnd")
1210
+
1211
+	novEndStr := novEnd + " 23:59:59"
1212
+	novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
1213
+	novEndStrsUnix := novEndStrs.Unix()
1214
+	fmt.Println(novEndStrsUnix)
1215
+	decStart := this.GetString("decStart")
1216
+
1217
+	decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
1218
+	decStartStrUnix := decStartStr.Unix()
1219
+	fmt.Println("12月使", decStartStrUnix)
1220
+	decEnd := this.GetString("decEnd")
1221
+
1222
+	decEndStr := decEnd + " 23:59:59"
1223
+	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
1224
+	decEndStrsUnix := decEndStrs.Unix()
1225
+	fmt.Println(decEndStrsUnix)
1226
+
1227
+	adminUser := this.GetMobileAdminUserInfo()
1228
+	orgId := adminUser.Org.Id
1229
+
1230
+	//统计收缩压
1231
+	if bloodtype == -1 {
1232
+		//统计收缩压一月总数
1233
+		_, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1234
+		_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1235
+
1236
+		//二月
1237
+		_, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1238
+		_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1239
+
1240
+		//三月
1241
+		_, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1242
+		_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1243
+
1244
+		//四月
1245
+		_, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1246
+		_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1247
+
1248
+		//五月
1249
+		_, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1250
+		_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1251
+
1252
+		//六月
1253
+		_, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1254
+		_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1255
+		//7月
1256
+		_, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1257
+		_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1258
+
1259
+		//8月
1260
+		_, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1261
+		_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1262
+
1263
+		//9月
1264
+		_, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1265
+		_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1266
+		//10月
1267
+		_, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1268
+		_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1269
+		//11月
1270
+		_, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1271
+		_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1272
+		//12月
1273
+		_, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1274
+		_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1275
+		if err != nil {
1276
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1277
+			return
1278
+		}
1279
+
1280
+		this.ServeSuccessJSON(map[string]interface{}{
1281
+			"januaryTotal":      januaryTotal,
1282
+			"januaryStandTotal": januaryStandTotal,
1283
+			"febTotal":          febTotal,
1284
+			"febStandTotal":     febStandTotal,
1285
+			"marchTotal":        marchTotal,
1286
+			"marchStandTotal":   marchStandTotal,
1287
+			"aprTotal":          aprTotal,
1288
+			"aprStandTotal":     aprStandTotal,
1289
+			"mayTotal":          mayTotal,
1290
+			"mayStandTotal":     mayStandTotal,
1291
+			"junTotal":          junTotal,
1292
+			"junStandTotal":     junStandTotal,
1293
+			"julTotal":          julTotal,
1294
+			"julStandTotal":     julStandTotal,
1295
+			"augTotal":          augTotal,
1296
+			"augStandTotal":     augStandTotal,
1297
+			"sepTotal":          sepTotal,
1298
+			"sepStandTotal":     sepStandTotal,
1299
+			"octTotal":          octTotal,
1300
+			"octStandTotal":     octStandTotal,
1301
+			"novTotal":          novTotal,
1302
+			"novStandTotal":     novStandTotal,
1303
+			"decTotal":          decTotal,
1304
+			"decStandTotal":     decStandTotal,
1305
+		})
1306
+	}
1307
+
1308
+	//统计舒张压
1309
+	if bloodtype == -2 {
1310
+		//统计收缩压一月总数
1311
+		_, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1312
+		_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
1313
+
1314
+		//二月
1315
+		_, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1316
+		_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
1317
+
1318
+		//三月
1319
+		_, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1320
+		_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
1321
+
1322
+		//四月
1323
+		_, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1324
+		_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
1325
+
1326
+		//五月
1327
+		_, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1328
+		_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
1329
+
1330
+		//六月
1331
+		_, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
1332
+		_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
1333
+		//7月
1334
+		_, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
1335
+		_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
1336
+
1337
+		//8月
1338
+		_, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
1339
+		_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
1340
+
1341
+		//9月
1342
+		_, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1343
+		_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
1344
+		//10月
1345
+		_, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
1346
+		_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
1347
+		//11月
1348
+		_, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
1349
+		_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
1350
+		//12月
1351
+		_, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
1352
+		_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
1353
+		if err != nil {
1354
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1355
+			return
1356
+		}
1357
+
1358
+		this.ServeSuccessJSON(map[string]interface{}{
1359
+			"januaryTotal":      januaryTotal,
1360
+			"januaryStandTotal": januaryStandTotal,
1361
+			"febTotal":          febTotal,
1362
+			"febStandTotal":     febStandTotal,
1363
+			"marchTotal":        marchTotal,
1364
+			"marchStandTotal":   marchStandTotal,
1365
+			"aprTotal":          aprTotal,
1366
+			"aprStandTotal":     aprStandTotal,
1367
+			"mayTotal":          mayTotal,
1368
+			"mayStandTotal":     mayStandTotal,
1369
+			"junTotal":          junTotal,
1370
+			"junStandTotal":     junStandTotal,
1371
+			"julTotal":          julTotal,
1372
+			"julStandTotal":     julStandTotal,
1373
+			"augTotal":          augTotal,
1374
+			"augStandTotal":     augStandTotal,
1375
+			"sepTotal":          sepTotal,
1376
+			"sepStandTotal":     sepStandTotal,
1377
+			"octTotal":          octTotal,
1378
+			"octStandTotal":     octStandTotal,
1379
+			"novTotal":          novTotal,
1380
+			"novStandTotal":     novStandTotal,
1381
+			"decTotal":          decTotal,
1382
+			"decStandTotal":     decStandTotal,
1383
+		})
1384
+	}
1385
+}
1386
+
1387
+func (this *NewCommonApiController) GetQuarterTargeList() {
1388
+	adminInfo := this.GetMobileAdminUserInfo()
1389
+	orgId := adminInfo.Org.Id
1390
+	fmt.Println(orgId)
1391
+	firstQuarterStart := this.GetString("first_quarter_start")
1392
+	firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
1393
+	firstQuarterStartUnix := firstQuarterStartStr.Unix()
1394
+	fmt.Println("第一季度", firstQuarterStartUnix)
1395
+	fisrtQuarterEnd := this.GetString("first_qurter_end")
1396
+	fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
1397
+	fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
1398
+	fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
1399
+	fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
1400
+	secondeQuarterStart := this.GetString("second_qurter_start")
1401
+	secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
1402
+	secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
1403
+	fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
1404
+	secondQuarterEnd := this.GetString("second_qurter_end")
1405
+	secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
1406
+	secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
1407
+	secondQuarterEndStrUnix := secondQuarterEnds.Unix()
1408
+	fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
1409
+
1410
+	threeQuarterStart := this.GetString("three_qurter_start")
1411
+	threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
1412
+	threeQuarterStartUnix := threeQuarterStartStr.Unix()
1413
+	fmt.Println("第三季度", threeQuarterStartUnix)
1414
+	threeQuarterEnd := this.GetString("three_qurter_end")
1415
+	threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
1416
+	threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
1417
+	threeQuarterEndStrUnix := threeQuarterEnds.Unix()
1418
+	fmt.Println("第三季度", threeQuarterEndStrUnix)
1419
+	fourQuarterStart := this.GetString("four_qurter_start")
1420
+	fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
1421
+	fourQuarterStartUnix := fourQuarterStartStr.Unix()
1422
+	fmt.Println("第四季度", fourQuarterStartUnix)
1423
+	fourQuarterEnd := this.GetString("four_qurter_end")
1424
+	fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
1425
+	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
1426
+	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
1427
+	fmt.Println("第四季度", fourQuarterEndStrUnix)
1428
+
1429
+	//统计指标合格的
1430
+	stand, err := service.GetQuarterTargeStand(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
1431
+	//统计不合格的
1432
+	noStand, err := service.GetQuarterTargeNoStand(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
1433
+	if err != nil {
1434
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1435
+		return
1436
+	}
1437
+
1438
+	//统计阴阳性合格的
1439
+	contagionTargeStand, err := service.GetContagionQuarterTargeStand(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
1440
+	//统计阴阳性不合格的
1441
+	contagionTargeNoStand, err := service.GetContagionTargeNoStand(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
1442
+
1443
+	this.ServeSuccessJSON(map[string]interface{}{
1444
+		"stand":                 stand,
1445
+		"noStand":               noStand,
1446
+		"contagionTargeStand":   contagionTargeStand,
1447
+		"contagionTargeNoStand": contagionTargeNoStand,
1448
+	})
1449
+}
1450
+
1451
+func (this *NewCommonApiController) GetMonthTarget() {
1452
+
1453
+	adminInfo := this.GetMobileAdminUserInfo()
1454
+	orgId := adminInfo.Org.Id
1455
+	fmt.Println(orgId)
1456
+
1457
+	januaryStart := this.GetString("januaryStart")
1458
+	januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
1459
+	januaryStartStrUnix := januaryStartStr.Unix()
1460
+
1461
+	januaryEnd := this.GetString("januaryEnd")
1462
+	januaryEndStr := januaryEnd + " 23:59:59"
1463
+	januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
1464
+	januaryEndStrUnix := januaryEndStrs.Unix()
1465
+
1466
+	febStart := this.GetString("febStart")
1467
+	febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
1468
+	febStartStrStrUnix := febStartStr.Unix()
1469
+
1470
+	febEnd := this.GetString("febEnd")
1471
+	febEndStr := febEnd + " 23:59:59"
1472
+	febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
1473
+	febEndStrUnix := febEndStrs.Unix()
1474
+
1475
+	marchStart := this.GetString("marchStart")
1476
+	marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
1477
+	marchStartStrUnix := marchStartStr.Unix()
1478
+	marchEnd := this.GetString("marchEnd")
1479
+
1480
+	marchEndStr := marchEnd + " 23:59:59"
1481
+	marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
1482
+	marchEndStrUnix := marchEndStrs.Unix()
1483
+
1484
+	aprStart := this.GetString("aprStart")
1485
+	aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
1486
+	aprStartStrUnix := aprStartStr.Unix()
1487
+
1488
+	aprEnd := this.GetString("aprEnd")
1489
+	aprEndStr := aprEnd + " 23:59:59"
1490
+	aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
1491
+	aprEndStrsUnix := aprEndStrs.Unix()
1492
+
1493
+	mayStart := this.GetString("mayStart")
1494
+
1495
+	mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
1496
+	mayStartStrUnix := mayStartStr.Unix()
1497
+
1498
+	mayEnd := this.GetString("mayEnd")
1499
+
1500
+	mayEndStr := mayEnd + " 23:59:59"
1501
+	mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
1502
+	mayEndStrsUnix := mayEndStrs.Unix()
1503
+
1504
+	junStart := this.GetString("junStart")
1505
+
1506
+	junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
1507
+	junStartStrUnix := junStartStr.Unix()
1508
+
1509
+	junEnd := this.GetString("junEnd")
1510
+
1511
+	junEndStr := junEnd + " 23:59:59"
1512
+	junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
1513
+	junEndStrsUnix := junEndStrs.Unix()
1514
+
1515
+	julStart := this.GetString("julStart")
1516
+
1517
+	julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
1518
+	julStartStrUnix := julStartStr.Unix()
1519
+
1520
+	julEnd := this.GetString("julEnd")
1521
+
1522
+	julEndStr := julEnd + " 23:59:59"
1523
+	julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
1524
+	julEndStrsUnix := julEndStrs.Unix()
1525
+
1526
+	augStart := this.GetString("augStart")
1527
+
1528
+	augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
1529
+	augStartStrUnix := augStartStr.Unix()
1530
+
1531
+	augEnd := this.GetString("augEnd")
1532
+
1533
+	augEndStr := augEnd + " 23:59:59"
1534
+	augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
1535
+	augEndStrsUnix := augEndStrs.Unix()
1536
+
1537
+	sepStart := this.GetString("sepStart")
1538
+
1539
+	sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
1540
+	sepStartStrUnix := sepStartStr.Unix()
1541
+	fmt.Println("九月使", sepStartStrUnix)
1542
+	sepEnd := this.GetString("sepEnd")
1543
+
1544
+	sepEndStr := sepEnd + " 23:59:59"
1545
+	sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
1546
+	sepEndStrsUnix := sepEndStrs.Unix()
1547
+
1548
+	octStart := this.GetString("octStart")
1549
+
1550
+	octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
1551
+	octStartStrUnix := octStartStr.Unix()
1552
+
1553
+	octEnd := this.GetString("octEnd")
1554
+
1555
+	octEndStr := octEnd + " 23:59:59"
1556
+	octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
1557
+	octEndStrsUnix := octEndStrs.Unix()
1558
+
1559
+	novStart := this.GetString("novStart")
1560
+	//fmt.Println("11月始", novStart)
1561
+	novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
1562
+	novStartStrUnix := novStartStr.Unix()
1563
+
1564
+	novEnd := this.GetString("novEnd")
1565
+
1566
+	novEndStr := novEnd + " 23:59:59"
1567
+	novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
1568
+	novEndStrsUnix := novEndStrs.Unix()
1569
+
1570
+	decStart := this.GetString("decStart")
1571
+
1572
+	decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
1573
+	decStartStrUnix := decStartStr.Unix()
1574
+
1575
+	decEnd := this.GetString("decEnd")
1576
+
1577
+	decEndStr := decEnd + " 23:59:59"
1578
+	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
1579
+	decEndStrsUnix := decEndStrs.Unix()
1580
+
1581
+	//统计指标合格的
1582
+	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)
1583
+	//统计不合格的指标
1584
+	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)
1585
+
1586
+	//统计传染类型合格的指标
1587
+	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)
1588
+	//统计传染类型不合格的指标
1589
+	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)
1590
+	if err != nil {
1591
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1592
+		return
1593
+	}
1594
+	this.ServeSuccessJSON(map[string]interface{}{
1595
+		"stand":                 stand,
1596
+		"nostand":               nostand,
1597
+		"contagionTargeStand":   contagionTargeStand,
1598
+		"contagionTargeNoStand": contagionTargeNoStand,
1599
+	})
1600
+}
1601
+
1602
+func (this *NewCommonApiController) GetQuarterBloodList() {
1603
+
1604
+	adminInfo := this.GetMobileAdminUserInfo()
1605
+	orgId := adminInfo.Org.Id
1606
+	fmt.Println(orgId)
1607
+	firstQuarterStart := this.GetString("first_quarter_start")
1608
+	firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
1609
+	firstQuarterStartUnix := firstQuarterStartStr.Unix()
1610
+	fmt.Println("第一季度", firstQuarterStartUnix)
1611
+	fisrtQuarterEnd := this.GetString("first_qurter_end")
1612
+	fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
1613
+	fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
1614
+	fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
1615
+	fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
1616
+	secondeQuarterStart := this.GetString("second_qurter_start")
1617
+	secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
1618
+	secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
1619
+	fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
1620
+	secondQuarterEnd := this.GetString("second_qurter_end")
1621
+	secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
1622
+	secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
1623
+	secondQuarterEndStrUnix := secondQuarterEnds.Unix()
1624
+	fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
1625
+
1626
+	threeQuarterStart := this.GetString("three_qurter_start")
1627
+	threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
1628
+	threeQuarterStartUnix := threeQuarterStartStr.Unix()
1629
+	fmt.Println("第三季度", threeQuarterStartUnix)
1630
+	threeQuarterEnd := this.GetString("three_qurter_end")
1631
+	threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
1632
+	threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
1633
+	threeQuarterEndStrUnix := threeQuarterEnds.Unix()
1634
+	fmt.Println("第三季度", threeQuarterEndStrUnix)
1635
+	fourQuarterStart := this.GetString("four_qurter_start")
1636
+	fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
1637
+	fourQuarterStartUnix := fourQuarterStartStr.Unix()
1638
+	fmt.Println("第四季度", fourQuarterStartUnix)
1639
+	fourQuarterEnd := this.GetString("four_qurter_end")
1640
+	fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
1641
+	fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
1642
+	fourQuarterEndStrUnix := fourQuarterEnds.Unix()
1643
+	fmt.Println("第四季度", fourQuarterEndStrUnix)
1644
+
1645
+	//获取一季度透析检测数据
1646
+	firtstlist, err := service.GetQuarterBloodList(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1647
+	//获取第二季度透析监测数据
1648
+	secondlist, err := service.GetQuarterBloodList(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1649
+	//获取第三季度透析监测数据
1650
+	threelist, err := service.GetQuarterBloodList(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1651
+	//获取第二季度透析监测数据
1652
+	fourlist, err := service.GetQuarterBloodList(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1653
+
1654
+	bloodPressure, err := service.GetDefaultBloodPressure(orgId)
1655
+
1656
+	if err != nil {
1657
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1658
+		return
1659
+	}
1660
+	this.ServeSuccessJSON(map[string]interface{}{
1661
+		"firtstlist":    firtstlist,
1662
+		"secondlist":    secondlist,
1663
+		"threelist":     threelist,
1664
+		"fourlist":      fourlist,
1665
+		"bloodPressure": bloodPressure,
1666
+	})
1667
+
1668
+}
1669
+
1670
+func (this *NewCommonApiController) GetMonthBLoodList() {
1671
+
1672
+	adminInfo := this.GetMobileAdminUserInfo()
1673
+	orgId := adminInfo.Org.Id
1674
+	fmt.Println(orgId)
1675
+
1676
+	januaryStart := this.GetString("januaryStart")
1677
+	januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
1678
+	januaryStartStrUnix := januaryStartStr.Unix()
1679
+
1680
+	januaryEnd := this.GetString("januaryEnd")
1681
+	januaryEndStr := januaryEnd + " 23:59:59"
1682
+	januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
1683
+	januaryEndStrUnix := januaryEndStrs.Unix()
1684
+
1685
+	febStart := this.GetString("febStart")
1686
+	febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
1687
+	febStartStrStrUnix := febStartStr.Unix()
1688
+
1689
+	febEnd := this.GetString("febEnd")
1690
+	febEndStr := febEnd + " 23:59:59"
1691
+	febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
1692
+	febEndStrUnix := febEndStrs.Unix()
1693
+
1694
+	marchStart := this.GetString("marchStart")
1695
+	marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
1696
+	marchStartStrUnix := marchStartStr.Unix()
1697
+	marchEnd := this.GetString("marchEnd")
1698
+
1699
+	marchEndStr := marchEnd + " 23:59:59"
1700
+	marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
1701
+	marchEndStrUnix := marchEndStrs.Unix()
1702
+
1703
+	aprStart := this.GetString("aprStart")
1704
+	aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
1705
+	aprStartStrUnix := aprStartStr.Unix()
1706
+
1707
+	aprEnd := this.GetString("aprEnd")
1708
+	aprEndStr := aprEnd + " 23:59:59"
1709
+	aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
1710
+	aprEndStrsUnix := aprEndStrs.Unix()
1711
+
1712
+	mayStart := this.GetString("mayStart")
1713
+
1714
+	mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
1715
+	mayStartStrUnix := mayStartStr.Unix()
1716
+
1717
+	mayEnd := this.GetString("mayEnd")
1718
+
1719
+	mayEndStr := mayEnd + " 23:59:59"
1720
+	mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
1721
+	mayEndStrsUnix := mayEndStrs.Unix()
1722
+
1723
+	junStart := this.GetString("junStart")
1724
+
1725
+	junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
1726
+	junStartStrUnix := junStartStr.Unix()
1727
+
1728
+	junEnd := this.GetString("junEnd")
1729
+
1730
+	junEndStr := junEnd + " 23:59:59"
1731
+	junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
1732
+	junEndStrsUnix := junEndStrs.Unix()
1733
+
1734
+	julStart := this.GetString("julStart")
1735
+
1736
+	julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
1737
+	julStartStrUnix := julStartStr.Unix()
1738
+
1739
+	julEnd := this.GetString("julEnd")
1740
+
1741
+	julEndStr := julEnd + " 23:59:59"
1742
+	julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
1743
+	julEndStrsUnix := julEndStrs.Unix()
1744
+
1745
+	augStart := this.GetString("augStart")
1746
+
1747
+	augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
1748
+	augStartStrUnix := augStartStr.Unix()
1749
+
1750
+	augEnd := this.GetString("augEnd")
1751
+
1752
+	augEndStr := augEnd + " 23:59:59"
1753
+	augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
1754
+	augEndStrsUnix := augEndStrs.Unix()
1755
+
1756
+	sepStart := this.GetString("sepStart")
1757
+
1758
+	sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
1759
+	sepStartStrUnix := sepStartStr.Unix()
1760
+	fmt.Println("九月使", sepStartStrUnix)
1761
+	sepEnd := this.GetString("sepEnd")
1762
+
1763
+	sepEndStr := sepEnd + " 23:59:59"
1764
+	sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
1765
+	sepEndStrsUnix := sepEndStrs.Unix()
1766
+
1767
+	octStart := this.GetString("octStart")
1768
+
1769
+	octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
1770
+	octStartStrUnix := octStartStr.Unix()
1771
+
1772
+	octEnd := this.GetString("octEnd")
1773
+
1774
+	octEndStr := octEnd + " 23:59:59"
1775
+	octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
1776
+	octEndStrsUnix := octEndStrs.Unix()
1777
+
1778
+	novStart := this.GetString("novStart")
1779
+	//fmt.Println("11月始", novStart)
1780
+	novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
1781
+	novStartStrUnix := novStartStr.Unix()
1782
+
1783
+	novEnd := this.GetString("novEnd")
1784
+
1785
+	novEndStr := novEnd + " 23:59:59"
1786
+	novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
1787
+	novEndStrsUnix := novEndStrs.Unix()
1788
+
1789
+	decStart := this.GetString("decStart")
1790
+
1791
+	decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
1792
+	decStartStrUnix := decStartStr.Unix()
1793
+
1794
+	decEnd := this.GetString("decEnd")
1795
+
1796
+	decEndStr := decEnd + " 23:59:59"
1797
+	decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
1798
+	decEndStrsUnix := decEndStrs.Unix()
1799
+
1800
+	//获取一月透析检测数据
1801
+	januaryList, err := service.GetQuarterBloodList(orgId, januaryStartStrUnix, januaryEndStrUnix)
1802
+
1803
+	//获取二月透析监测数据
1804
+	febList, err := service.GetQuarterBloodList(orgId, febStartStrStrUnix, febEndStrUnix)
1805
+	//获取三月透析监测数据
1806
+	marList, err := service.GetQuarterBloodList(orgId, marchStartStrUnix, marchEndStrUnix)
1807
+	//4月
1808
+	aprList, err := service.GetQuarterBloodList(orgId, aprStartStrUnix, aprEndStrsUnix)
1809
+	//5月
1810
+	mayList, err := service.GetQuarterBloodList(orgId, mayStartStrUnix, mayEndStrsUnix)
1811
+	//6月
1812
+	junList, err := service.GetQuarterBloodList(orgId, junStartStrUnix, junEndStrsUnix)
1813
+	//7月
1814
+	julList, err := service.GetQuarterBloodList(orgId, julStartStrUnix, julEndStrsUnix)
1815
+	//8月
1816
+	augList, err := service.GetQuarterBloodList(orgId, augStartStrUnix, augEndStrsUnix)
1817
+	//9月
1818
+	sepList, err := service.GetQuarterBloodList(orgId, sepStartStrUnix, sepEndStrsUnix)
1819
+	//10月
1820
+	octList, err := service.GetQuarterBloodList(orgId, octStartStrUnix, octEndStrsUnix)
1821
+	//11月
1822
+	novList, err := service.GetQuarterBloodList(orgId, novStartStrUnix, novEndStrsUnix)
1823
+	//12月
1824
+	decList, err := service.GetQuarterBloodList(orgId, decStartStrUnix, decEndStrsUnix)
1825
+
1826
+	bloodPressure, err := service.GetDefaultBloodPressure(orgId)
1827
+	if err != nil {
1828
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1829
+		return
1830
+	}
1831
+	this.ServeSuccessJSON(map[string]interface{}{
1832
+		"januaryList":   januaryList,
1833
+		"febList":       febList,
1834
+		"marList":       marList,
1835
+		"aprList":       aprList,
1836
+		"mayList":       mayList,
1837
+		"junList":       junList,
1838
+		"julList":       julList,
1839
+		"augList":       augList,
1840
+		"sepList":       sepList,
1841
+		"octList":       octList,
1842
+		"novList":       novList,
1843
+		"decList":       decList,
1844
+		"bloodPressure": bloodPressure,
1845
+	})
1846
+}
1847
+
1848
+func (this *NewCommonApiController) GetTargetNoStandDetail() {
1849
+
1850
+	adminUser := this.GetMobileAdminUserInfo()
1851
+	orgId := adminUser.Org.Id
1852
+	fmt.Println("orgID", orgId)
1853
+	timeLayout := "2006-01-02"
1854
+	loc, _ := time.LoadLocation("Local")
1855
+	startime := this.GetString("startime")
1856
+	endtime := this.GetString("endtime")
1857
+	limit, _ := this.GetInt64("limit")
1858
+	fmt.Println("limit", limit)
1859
+	page, _ := this.GetInt64("page")
1860
+	fmt.Println("page", page)
1861
+
1862
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
1863
+	startimeUnix := startTimes.Unix()
1864
+	fmt.Println(startimeUnix)
1865
+
1866
+	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
1867
+	endtimeUnix := endtimes.Unix()
1868
+	fmt.Println(endtimeUnix)
1869
+
1870
+	//获取未达标的详情页病人列表
1871
+	inspectlist, err := service.GetTaregetNoStandDetail(orgId, startimeUnix, endtimeUnix)
1872
+	//获取传染病类型为达标
1873
+	configurationlist, err := service.GetConfigurationNoStandDetail(orgId, startimeUnix, endtimeUnix)
1874
+
1875
+	list, err := service.GetInspectNoStandList(orgId, startimeUnix, endtimeUnix, limit, page)
1876
+	//分页
1877
+	if err != nil {
1878
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1879
+		return
1880
+	}
1881
+	this.ServeSuccessJSON(map[string]interface{}{
1882
+		"inspectlist":       inspectlist,
1883
+		"configurationlist": configurationlist,
1884
+		"list":              list,
1885
+	})
1886
+}
1887
+
1888
+func (this *NewCommonApiController) GetTargetStandDetail() {
1889
+
1890
+	adminUser := this.GetMobileAdminUserInfo()
1891
+	orgId := adminUser.Org.Id
1892
+	fmt.Println("orgID", orgId)
1893
+	timeLayout := "2006-01-02"
1894
+	loc, _ := time.LoadLocation("Local")
1895
+	startime := this.GetString("startime")
1896
+	endtime := this.GetString("endtime")
1897
+	limit, _ := this.GetInt64("limit")
1898
+	fmt.Println("limit", limit)
1899
+	page, _ := this.GetInt64("page")
1900
+	fmt.Println("page", page)
1901
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
1902
+	startimeUnix := startTimes.Unix()
1903
+	fmt.Println(startimeUnix)
1904
+
1905
+	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
1906
+	endtimeUnix := endtimes.Unix()
1907
+	fmt.Println(endtimeUnix)
1908
+	//获取达标数据
1909
+	standlist, err := service.GetTargetStandDetail(orgId, startimeUnix, endtimeUnix)
1910
+
1911
+	//获取达标数据
1912
+	confstandlist, err := service.GetConfigurationStandDetail(orgId, startimeUnix, endtimeUnix)
1913
+
1914
+	//分页
1915
+	inspectlist, err := service.GetStandList(orgId, startimeUnix, endtimeUnix, limit, page)
1916
+	if err != nil {
1917
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1918
+		return
1919
+	}
1920
+	this.ServeSuccessJSON(map[string]interface{}{
1921
+		"standlist":     standlist,
1922
+		"confstandlist": confstandlist,
1923
+		"inspectlist":   inspectlist,
1924
+	})
1925
+}

+ 8 - 0
controllers/new_mobile_api_controllers/new_common_api_router.go Просмотреть файл

@@ -31,4 +31,12 @@ func NewCommonApiControllersRegisterRouters() {
31 31
 	beego.Router("/m/api/toseachpatientscontrol", &NewCommonApiController{}, "Get:GetSeachPatientsControl")
32 32
 	beego.Router("/m/api/getmobiletreatlist", &NewCommonApiController{}, "Get:GetMobileTreatlist")
33 33
 	beego.Router("/m/api/getlistpatientdetail", &NewCommonApiController{}, "Get:GetPatientComplianceDetail")
34
+	beego.Router("/m/api/getmobilebloodlist", &NewCommonApiController{}, "Get:GetMoblieBloodList")
35
+	beego.Router("/m/api/getbloodmonthlist", &NewCommonApiController{}, "Get:GetBloodMonthList")
36
+	beego.Router("/m/api/getquarterTargelist", &NewCommonApiController{}, "Get:GetQuarterTargeList")
37
+	beego.Router("/m/api/getmonthtarge", &NewCommonApiController{}, "Get:GetMonthTarget")
38
+	beego.Router("/m/api/getquarterbloodlist", &NewCommonApiController{}, "Get:GetQuarterBloodList")
39
+	beego.Router("/m/api/getmonthbloolist", &NewCommonApiController{}, "Get:GetMonthBLoodList")
40
+	beego.Router("/m/api/gettargetnostanddetail", &NewCommonApiController{}, "Get:GetTargetNoStandDetail")
41
+	beego.Router("/m/api/gettargestanddetail", &NewCommonApiController{}, "Get:GetTargetStandDetail")
34 42
 }

+ 19 - 41
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Просмотреть файл

@@ -1178,10 +1178,23 @@ func (this *NewDialysisApiController) GetDoctorAdviceDetail() {
1178 1178
 
1179 1179
 func (this *NewDialysisApiController) DeleteManagement() {
1180 1180
 	groupno, _ := this.GetInt64("id")
1181
-	fmt.Print("id是什么", groupno)
1181
+	patientid, _ := this.GetInt64("patientid")
1182
+	patient, _ := service.GetPatientDetailTwo(patientid)
1182 1183
 	orgId := this.GetMobileAdminUserInfo().Org.Id
1183
-	fmt.Print("机构ID", orgId)
1184
-	err := service.DeleteManagement(groupno, orgId)
1184
+	err := service.DeleteManagement(groupno, orgId, patient.BloodId)
1185
+	fmt.Println("错误是什么", err)
1186
+	returnData := make(map[string]interface{}, 0)
1187
+	returnData["msg"] = "ok"
1188
+	this.ServeSuccessJSON(returnData)
1189
+	return
1190
+}
1191
+
1192
+func (this *NewDialysisApiController) DeleteManageMentTwo() {
1193
+	groupno, _ := this.GetInt64("id")
1194
+	patientid, _ := this.GetInt64("patientid")
1195
+	fmt.Println("patientid------------------------------------", patientid)
1196
+	orgId := this.GetMobileAdminUserInfo().Org.Id
1197
+	err := service.DeleteManagement(groupno, orgId, patientid)
1185 1198
 	fmt.Println("错误是什么", err)
1186 1199
 	returnData := make(map[string]interface{}, 0)
1187 1200
 	returnData["msg"] = "ok"
@@ -2637,44 +2650,9 @@ func (this *NewDialysisApiController) GetNewPatientId() {
2637 2650
 
2638 2651
 func (this *NewDialysisApiController) UpdateImage() {
2639 2652
 
2640
-	adminUserInfo := this.GetMobileAdminUserInfo()
2641
-
2642
-	es, _ := service.GetPatinentHead(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)
2643
-
2644
-	action := "update"
2645
-	timeNow := time.Now().Unix()
2646
-	if es == nil {
2647
-		es = new(models.SgjUserAdminPatientHead)
2648
-		es.Status = 1
2649
-		es.UserOrgId = adminUserInfo.Org.Id
2650
-		es.AppId = adminUserInfo.App.Id
2651
-		es.Ctime = timeNow
2652
-		es.Creator = adminUserInfo.AdminUser.Id
2653
-		action = "create"
2654
-	}
2655
-	es.Mtime = timeNow
2656
-
2657
-	var esdata models.SgjUserAdminPatientHead
2658
-	var err error
2659
-	if err = json.Unmarshal(this.Ctx.Input.RequestBody, &esdata); err != nil {
2660
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2661
-		return
2662
-	}
2663
-
2664
-	es.Hash = esdata.Hash
2665
-	es.Url = beego.AppConfig.String("qiniu_domain") + esdata.Hash
2666
-
2667
-	if action == "create" {
2668
-		err = service.CreateAdminUserHead(es)
2669
-	} else {
2670
-		err = service.SaveAdminUserHead(es)
2671
-	}
2672
-	if err != nil {
2673
-		fmt.Println(err)
2674
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
2675
-		return
2676
-	}
2653
+	hash := this.GetString("hash")
2654
+	var Url = beego.AppConfig.String("qiniu_domain") + hash
2677 2655
 	this.ServeSuccessJSON(map[string]interface{}{
2678
-		"electronic_signature": es,
2656
+		"electronic_signature": Url,
2679 2657
 	})
2680 2658
 }

+ 2 - 1
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Просмотреть файл

@@ -155,5 +155,6 @@ func NewMobileAPIControllersRegisterRouters() {
155 155
 	beego.Router("/m/api/patient/getmobile", &NewDialysisApiController{}, "Get:GetMobile")
156 156
 	beego.Router("/m/api/patient/getorgs", &NewDialysisApiController{}, "Get:GetOrgs")
157 157
 	beego.Router("/m/api/patient/getnewpatientid", &NewDialysisApiController{}, "Get:GetNewPatientId")
158
-	beego.Router("/m/api/patient/updateimage", &NewDialysisApiController{}, "Post:UpdateImage")
158
+	beego.Router("/m/api/patient/updateimage", &NewDialysisApiController{}, "Get:UpdateImage")
159
+	beego.Router("/m/api/patient/deletemanagementtwo", &NewDialysisApiController{}, "Delete:DeleteManageMentTwo")
159 160
 }

+ 87 - 0
models/common_models.go Просмотреть файл

@@ -395,6 +395,11 @@ type ProjectCountOne struct {
395 395
 	NoCount int64
396 396
 }
397 397
 
398
+type ProjectCountTwo struct {
399
+	Name  string
400
+	Count int64
401
+}
402
+
398 403
 type ProjectCount struct {
399 404
 	Total string
400 405
 	Count int64
@@ -474,3 +479,85 @@ type TreatTotalStruct struct {
474 479
 	Number string `json:"number"`
475 480
 	ModeID string `json:"mode_id"`
476 481
 }
482
+
483
+type XTMonitoringRecord struct {
484
+	ID                        int64   `gorm:"column:id" json:"id"`
485
+	UserOrgId                 int64   `gorm:"column:user_org_id" json:"user_org_id"`
486
+	PatientId                 int64   `gorm:"column:patient_id" json:"patient_id"`
487
+	DialysisOrderId           int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id"`
488
+	MonitoringDate            int64   `gorm:"column:monitoring_date" json:"monitoring_date"`
489
+	OperateTime               int64   `gorm:"column:operate_time" json:"operate_time"`
490
+	MonitoringTime            string  `gorm:"column:monitoring_time" json:"monitoring_time"`
491
+	PulseFrequency            float64 `gorm:"column:pulse_frequency" json:"pulse_frequency"`
492
+	BreathingRate             float64 `gorm:"column:breathing_rate" json:"breathing_rate"`
493
+	SystolicBloodPressure     float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
494
+	DiastolicBloodPressure    float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
495
+	BloodPressureType         int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`
496
+	Pic                       string  `gorm:"column:pic" json:"pic"`
497
+	BloodFlowVolume           float64 `gorm:"column:blood_flow_volume" json:"blood_flow_volume"`
498
+	VenousPressure            float64 `gorm:"column:venous_pressure" json:"venous_pressure"`
499
+	VenousPressureType        int64   `gorm:"column:venous_pressure_type" json:"venous_pressure_type"`
500
+	ArterialPressure          float64 `gorm:"column:arterial_pressure" json:"arterial_pressure"`
501
+	ArterialPressureType      int64   `gorm:"column:arterial_pressure_type" json:"arterial_pressure_type"`
502
+	TransmembranePressure     float64 `gorm:"column:transmembrane_pressure" json:"transmembrane_pressure"`
503
+	TransmembranePressureType int64   `gorm:"column:transmembrane_pressure_type" json:"transmembrane_pressure_type"`
504
+	UltrafiltrationRate       float64 `gorm:"column:ultrafiltration_rate" json:"ultrafiltration_rate"`
505
+	UltrafiltrationVolume     float64 `gorm:"column:ultrafiltration_volume" json:"ultrafiltration_volume"`
506
+	SodiumConcentration       float64 `gorm:"column:sodium_concentration" json:"sodium_concentration"`
507
+	DialysateTemperature      float64 `gorm:"column:dialysate_temperature" json:"dialysate_temperature"`
508
+	Temperature               float64 `gorm:"column:temperature" json:"temperature"`
509
+	ReplacementRate           float64 `gorm:"column:replacement_rate" json:"replacement_rate"`
510
+	DisplacementQuantity      float64 `gorm:"column:displacement_quantity" json:"displacement_quantity"`
511
+	Ktv                       float64 `gorm:"column:ktv" json:"ktv"`
512
+	Symptom                   string  `gorm:"column:symptom" json:"symptom"`
513
+	Dispose                   string  `gorm:"column:dispose" json:"dispose"`
514
+	Result                    string  `gorm:"column:result" json:"result"`
515
+	MonitoringNurse           int64   `gorm:"column:monitoring_nurse" json:"monitoring_nurse"`
516
+	Status                    int64   `gorm:"column:status" json:"status"`
517
+	CreatedTime               int64   `gorm:"column:created_time" json:"created_time"`
518
+	UpdatedTime               int64   `gorm:"column:updated_time" json:"updated_time"`
519
+	Conductivity              float64 `gorm:"column:conductivity" json:"conductivity"`
520
+	DisplacementFlowQuantity  float64 `gorm:"column:displacement_flow_quantity" json:"displacement_flow_quantity"`
521
+	BloodOxygenSaturation     string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
522
+	Creator                   int64   `gorm:"column:creator" json:"creator" form:"creator"`
523
+	Modify                    int64   `gorm:"column:modify" json:"modify" form:"modify"`
524
+	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
525
+	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
526
+	Sort                      int64   `gorm:"column:sort" json:"sort"`
527
+}
528
+
529
+func (XTMonitoringRecord) TableName() string {
530
+	return "xt_monitoring_record"
531
+}
532
+
533
+type VmMonitoringRecord struct {
534
+	ID                     int64   `gorm:"column:id" json:"id"`
535
+	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id"`
536
+	PatientId              int64   `gorm:"column:patient_id" json:"patient_id"`
537
+	MonitoringTime         string  `gorm:"column:monitoring_time" json:"monitoring_time"`
538
+	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
539
+	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
540
+}
541
+
542
+func (VmMonitoringRecord) TableName() string {
543
+	return "xt_monitoring_record"
544
+}
545
+
546
+type XtPatientsInspection struct {
547
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
548
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
549
+	OrgId        int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
550
+	ItemId       int64  `gorm:"column:item_id" json:"item_id" form:"item_id"`
551
+	ItemName     string `gorm:"column:item_name" json:"item_name" form:"item_name"`
552
+	InspectType  int64  `gorm:"column:inspect_type" json:"inspect_type" form:"inspect_type"`
553
+	InspectValue string `gorm:"column:inspect_value" json:"inspect_value" form:"inspect_value"`
554
+	InspectDate  int64  `gorm:"column:inspect_date" json:"inspect_date" form:"inspect_date"`
555
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
556
+	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
557
+	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
558
+	Name         string `gorm:"column:name" json:"name" form:"name"`
559
+	MinRange     string `gorm:"column:min_range" json:"min_range" form:"min_range"`
560
+	LargeRange   string `gorm:"column:large_range" json:"large_range" form:"large_range"`
561
+	RangeType    int64  `gorm:"column:range_type" json:"range_type" form:"range_type"`
562
+	RangeValue   string `gorm:"column:range_value" json:"range_value" form:"range_value"`
563
+}

+ 523 - 32
service/common_service.go Просмотреть файл

@@ -413,7 +413,7 @@ func GetDialysisPatientList(startime int64, endtime int64, page int64, limit int
413 413
 
414 414
 func GetLastSort(orgid int64) (models.XtQualityControlStandard, error) {
415 415
 	standard := models.XtQualityControlStandard{}
416
-	err := XTReadDB().Model(&standard).Where("user_org_id = ? and status =1", orgid).Last(&standard).Error
416
+	err := XTReadDB().Model(&standard).Where("user_org_id = ? and status =1 and is_status = 1", orgid).Last(&standard).Error
417 417
 	return standard, err
418 418
 }
419 419
 
@@ -796,12 +796,12 @@ func GetNormDataByOrgId(orgid int64) (standard []*models.QualityControlStandard,
796 796
 
797 797
 	db := XTReadDB().Table("xt_quality_control_standard as x").Where("x.status =1")
798 798
 	if orgid > 0 {
799
-		db = db.Where("x.user_org_id = ?", orgid)
799
+		db = db.Where("x.user_org_id = ? and x.is_status = 1", orgid)
800 800
 	}
801 801
 	table := XTReadDB().Table("xt_inspection_reference as s")
802 802
 	fmt.Println(table)
803 803
 
804
-	err = db.Order("x.sort asc,x.created_time asc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,s.unit,s.project_name,s.item_name,x.range_value,x.range_type").
804
+	err = db.Order("x.sort asc,x.created_time asc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,s.unit,s.project_name,s.item_name,x.range_value,x.range_type,x.is_status").
805 805
 		Joins("left join xt_inspection_reference as s on (s.item_id = x.inspection_minor AND s.org_id > 0) OR (s.id = x.inspection_minor AND s.org_id = 0)").Scan(&standard).Error
806 806
 	return standard, err
807 807
 }
@@ -810,7 +810,7 @@ func GetNormData(orgid int64) (standard []*models.QualityControlStandard, err er
810 810
 
811 811
 	db := XTReadDB().Table("xt_quality_control_standard as x").Where("x.status =1")
812 812
 	if orgid >= 0 {
813
-		db = db.Where("x.user_org_id = ?", orgid)
813
+		db = db.Where("x.user_org_id = ? and x.is_status = 1", orgid)
814 814
 	}
815 815
 	table := XTReadDB().Table("xt_inspection_reference as s")
816 816
 	fmt.Println(table)
@@ -856,16 +856,16 @@ func GetFirstQuarter(orgid int64, startime int64, endtime int64) (inspection []*
856 856
 }
857 857
 
858 858
 func GetQuarterTotalCount(orgid int64, startime int64, endtime int64, lapseto int64) (inspection []*models.VmPatientInspectionTwo, err error) {
859
-
859
+	fmt.Println(lapseto)
860 860
 	db := XTReadDB().Table("xt_inspection as x ").Where("x.status = 1")
861 861
 	table := XTReadDB().Table("xt_inspection_reference as r")
862 862
 	fmt.Println(table)
863
-	d := XTReadDB().Table("xt_patients as s")
864
-	fmt.Println(d)
863
+	//d := XTReadDB().Table("xt_patients as s")
864
+	//fmt.Println(d)
865 865
 	q := XTReadDB().Table("x.xt_quality_control_standard as q")
866 866
 	fmt.Println(q)
867 867
 	if orgid > 0 {
868
-		db = db.Where("x.org_id = ? and x.inspect_value+0 <> 0 and r.range_type = 1 and q.user_org_id = ?", orgid, orgid)
868
+		db = db.Where("x.org_id = ? and x.inspect_value+0 <> 0 and r.range_type = 1 and q.user_org_id = ? and q.is_status = 1", orgid, orgid)
869 869
 	}
870 870
 	if startime > 0 {
871 871
 		db = db.Where("x.inspect_date >=?", startime)
@@ -873,27 +873,27 @@ func GetQuarterTotalCount(orgid int64, startime int64, endtime int64, lapseto in
873 873
 	if endtime > 0 {
874 874
 		db = db.Where("x.inspect_date <=?", endtime)
875 875
 	}
876
-	if lapseto == 0 {
877
-		db = db.Where("s.lapseto = 1 or s.lapseto = 2")
878
-	}
879
-	if lapseto > 0 {
880
-		db = db.Where("s.lapseto = ?", lapseto)
881
-	}
882
-	err = db.Group("x.item_id").Select("sum(case when x.inspect_date >=? and x.inspect_date<=? then 1 else 0 end) as total,sum(case when x.inspect_value+0>=q.min_range+0 and x.inspect_value +0 <= q.large_range+0 and x.inspect_date >=? and x.inspect_date <=? then 1 else 0 end) as count,x.item_id,q.sort", startime, endtime, startime, endtime).Joins("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 ) ").Joins("left join xt_patients as  s on s.id = x.patient_id").Joins("left join xt_quality_control_standard as q on q.inspection_minor = x.item_id").Scan(&inspection).Error
876
+	//if lapseto == 0 {
877
+	//	db = db.Where("s.lapseto = 1 or s.lapseto = 2")
878
+	//}
879
+	//if lapseto > 0 {
880
+	//	db = db.Where("s.lapseto = ?", lapseto)
881
+	//}
882
+	err = db.Group("x.item_id").Select("sum(case when x.inspect_date >=? and x.inspect_date<=? then 1 else 0 end) as total,sum(case when x.inspect_value+0>=q.min_range+0 and x.inspect_value +0 <= q.large_range+0 and x.inspect_date >=? and x.inspect_date <=? then 1 else 0 end) as count,x.item_id,q.sort", startime, endtime, startime, endtime).Joins("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 ) ").Joins("left join xt_quality_control_standard as q on q.inspection_minor = x.item_id").Scan(&inspection).Error
883 883
 	return inspection, err
884 884
 }
885 885
 
886 886
 func GetQuarterTotalCountTwo(orgid int64, startime int64, endtime int64, lapseto int64) (inspection []*models.VmPatientInspectionTwo, err error) {
887
-
887
+	fmt.Println(lapseto)
888 888
 	db := XTReadDB().Table("xt_inspection as x ").Where("x.status = 1")
889 889
 	table := XTReadDB().Table("xt_inspection_reference as r")
890 890
 	fmt.Println(table)
891
-	d := XTReadDB().Table("xt_patients as s")
892
-	fmt.Println(d)
891
+	//d := XTReadDB().Table("xt_patients as s")
892
+	//fmt.Println(d)
893 893
 	q := XTReadDB().Table("x.xt_quality_control_standard as q")
894 894
 	fmt.Println(q)
895 895
 	if orgid > 0 {
896
-		db = db.Where("x.org_id = ?  and r.range_type = 2 and q.user_org_id = ? and x.inspect_value <>''", orgid, orgid)
896
+		db = db.Where("x.org_id = ?  and r.range_type = 2 and q.user_org_id = ? and q.is_status = 1 and x.inspect_value <>''", orgid, orgid)
897 897
 	}
898 898
 	if startime > 0 {
899 899
 		db = db.Where("x.inspect_date >=?", startime)
@@ -901,13 +901,13 @@ func GetQuarterTotalCountTwo(orgid int64, startime int64, endtime int64, lapseto
901 901
 	if endtime > 0 {
902 902
 		db = db.Where("x.inspect_date <=?", endtime)
903 903
 	}
904
-	if lapseto == 0 {
905
-		db = db.Where("s.lapseto = 1 or s.lapseto = 2")
906
-	}
907
-	if lapseto > 0 {
908
-		db = db.Where("s.lapseto = ?", lapseto)
909
-	}
910
-	err = db.Group("x.item_id").Select("sum(case when x.inspect_date >=? and x.inspect_date<=? then 1 else 0 end) as total,sum(case when q.range_value = x.inspect_value and x.inspect_date >=? and x.inspect_date <=? then 1 else 0 end) as count,x.item_id,q.sort", startime, endtime, startime, endtime).Joins("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 ) ").Joins("left join xt_patients as  s on s.id = x.patient_id").Joins("left join xt_quality_control_standard as q on q.inspection_minor = x.item_id").Scan(&inspection).Error
904
+	//if lapseto == 0 {
905
+	//	db = db.Where("s.lapseto = 1 or s.lapseto = 2")
906
+	//}
907
+	//if lapseto > 0 {
908
+	//	db = db.Where("s.lapseto = ?", lapseto)
909
+	//}
910
+	err = db.Group("x.item_id").Select("sum(case when x.inspect_date >=? and x.inspect_date<=? then 1 else 0 end) as total,sum(case when q.range_value = x.inspect_value and x.inspect_date >=? and x.inspect_date <=? then 1 else 0 end) as count,x.item_id,q.sort", startime, endtime, startime, endtime).Joins("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 ) ").Joins("left join xt_quality_control_standard as q on q.inspection_minor = x.item_id").Scan(&inspection).Error
911 911
 	return inspection, err
912 912
 }
913 913
 
@@ -2390,7 +2390,7 @@ func GetPatientsControl(orgid int64, lapstor int64, startime int64, endtime int6
2390 2390
 		db = db.Where("x.inspect_date <=?", endtime)
2391 2391
 	}
2392 2392
 	offset := (page - 1) * limit
2393
-	err = db.Select("x.id,x.patient_id,s.name,s.dialysis_no,x.inspect_date").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_quality_control_standard as r on x.item_id = r.inspection_minor ").Where("r.user_org_id = ? and r.status = 1", orgid).Group("x.inspect_date").Count(&total).Offset(offset).Limit(limit).Scan(&inspection).Error
2393
+	err = db.Select("x.id,x.patient_id,s.name,s.dialysis_no,x.inspect_date").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_quality_control_standard as r on x.item_id = r.inspection_minor ").Where("r.user_org_id = ? and r.status = 1 and r.is_status = 1", orgid).Group("x.inspect_date").Count(&total).Offset(offset).Limit(limit).Scan(&inspection).Error
2394 2394
 
2395 2395
 	return inspection, total, err
2396 2396
 }
@@ -2455,7 +2455,7 @@ func GetLastPatientsControl(orgid int64, lapstor int64, startime int64, endtime
2455 2455
 	if endtime > 0 {
2456 2456
 		db = db.Where("x.inspect_date <=?", endtime)
2457 2457
 	}
2458
-	err = db.Group("x.id").Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,s.dialysis_no,r.range_max,r.range_min,d.sort,d.min_range,d.large_range,d.range_value,d.range_type").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("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)").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Where("d.min_range<>''and d.user_org_id = ?", orgid).Order("x.inspect_date desc").Scan(&inspection).Error
2458
+	err = db.Group("x.id").Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,s.dialysis_no,r.range_max,r.range_min,d.sort,d.min_range,d.large_range,d.range_value,d.range_type").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("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)").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Where("d.min_range<>''and d.user_org_id = ? and d.is_status =1", orgid).Order("x.inspect_date desc").Scan(&inspection).Error
2459 2459
 
2460 2460
 	return inspection, err
2461 2461
 }
@@ -2473,7 +2473,7 @@ func GetTotalPatientsControl(orgid int64, startime int64, endtime int64) (inspec
2473 2473
 	if endtime > 0 {
2474 2474
 		db = db.Where("x.inspect_date <=?", endtime)
2475 2475
 	}
2476
-	err = db.Select("x.id").Joins("RIGHT JOIN xt_quality_control_standard as s on x.project_id = s.inspection_major and x.item_id = s.inspection_minor and x.org_id = s.user_org_id ").Where("s.status = 1").Count(&total).Scan(&inspection).Error
2476
+	err = db.Select("x.id").Joins("RIGHT JOIN xt_quality_control_standard as s on x.project_id = s.inspection_major and x.item_id = s.inspection_minor and x.org_id = s.user_org_id ").Where("s.status = 1 and s.is_status =1").Count(&total).Scan(&inspection).Error
2477 2477
 	return inspection, total, err
2478 2478
 }
2479 2479
 func GetStandControl(orgid int64, startime int64, endtime int64) (inspection []*models.PatientInspectionCount, total int64, err error) {
@@ -2489,7 +2489,7 @@ func GetStandControl(orgid int64, startime int64, endtime int64) (inspection []*
2489 2489
 	if endtime > 0 {
2490 2490
 		db = db.Where("x.inspect_date <=?", endtime)
2491 2491
 	}
2492
-	db = db.Where("s.status = 1")
2492
+	db = db.Where("s.status = 1 and s.is_status = 1")
2493 2493
 	err = db.Select("x.id").Joins("RIGHT JOIN xt_quality_control_standard as s on x.project_id = s.inspection_major and x.item_id = s.inspection_minor and x.org_id = s.user_org_id ").Where("x.inspect_value+0 >= s.min_range + 0 and x.inspect_value+0 <= s.large_range + 0 ").Count(&total).Scan(&inspection).Error
2494 2494
 	return inspection, total, err
2495 2495
 }
@@ -2507,7 +2507,7 @@ func GetStandControlOne(orgid int64, startime int64, endtime int64) (inspection
2507 2507
 	if endtime > 0 {
2508 2508
 		db = db.Where("x.inspect_date <=?", endtime)
2509 2509
 	}
2510
-	db = db.Where("s.status = 1")
2510
+	db = db.Where("s.status = 1 and s.is_status = 1")
2511 2511
 	err = db.Select("x.id").Joins("RIGHT JOIN xt_quality_control_standard as s on x.project_id = s.inspection_major and x.item_id = s.inspection_minor and x.org_id = s.user_org_id ").Where("x.inspect_value = s.range_value").Count(&total).Scan(&inspection).Error
2512 2512
 	return inspection, total, err
2513 2513
 }
@@ -2571,7 +2571,7 @@ func GetInfectiousControl(orgid int64, lapstor int64, startime int64, endtime in
2571 2571
 	if endtime > 0 {
2572 2572
 		db = db.Where("x.inspect_date <=?", endtime)
2573 2573
 	}
2574
-	err = db.Group("x.id").Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,s.dialysis_no,r.range_max,r.range_min,d.sort,d.min_range,d.large_range,d.range_value,d.range_type").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("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)").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Where("d.range_value <>''and d.user_org_id = ?", orgid).Order("x.inspect_date desc").Scan(&inspection).Error
2574
+	err = db.Group("x.id").Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,s.dialysis_no,r.range_max,r.range_min,d.sort,d.min_range,d.large_range,d.range_value,d.range_type").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("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)").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Where("d.range_value <>''and d.user_org_id = ? and d.is_status = 1", orgid).Order("x.inspect_date desc").Scan(&inspection).Error
2575 2575
 
2576 2576
 	return inspection, err
2577 2577
 }
@@ -2722,3 +2722,494 @@ func UpdateBloodPressure(st *models.XtQualityControlStandard, id int64) error {
2722 2722
 	return err
2723 2723
 
2724 2724
 }
2725
+
2726
+func GetSystolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecord, total int64, err error) {
2727
+
2728
+	db := XTReadDB().Table("xt_monitoring_record as x")
2729
+	err = db.Select("x.id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.systolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2730
+	return record, total, err
2731
+}
2732
+
2733
+func GetStandSystolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecord, total int64, err error) {
2734
+
2735
+	db := XTReadDB().Table("xt_monitoring_record as x").Where("x.status = 1")
2736
+	err = db.Select("x.id,s.sort").Joins("left join xt_quality_control_standard as s on s.user_org_id = x.user_org_id").Where("s.status = 1 and s.is_status = 0 and s.user_org_id = ? and x.user_org_id =? and x.monitoring_date>=? and x.monitoring_date <=? and s.inspection_minor = -1 and s.inspection_major = 0 and x.systolic_blood_pressure <> 0 and x.systolic_blood_pressure +0 >= s.min_range +0 and x.systolic_blood_pressure +0 <= s.large_range +0", orgid, orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2737
+	return record, total, err
2738
+}
2739
+
2740
+func GetDiastolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecord, total int64, err error) {
2741
+
2742
+	db := XTReadDB().Table("xt_monitoring_record as x")
2743
+	err = db.Select("x.id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.diastolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2744
+	return record, total, err
2745
+}
2746
+
2747
+func GetDiastolicStandPressure(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecord, total int64, err error) {
2748
+	db := XTReadDB().Table("xt_monitoring_record as x").Where("x.status = 1")
2749
+	err = db.Select("x.id,s.sort").Joins("left join xt_quality_control_standard as s on s.user_org_id = x.user_org_id").Where("s.status = 1 and s.is_status = 0 and s.user_org_id = ? and x.user_org_id =? and x.monitoring_date>=? and x.monitoring_date <=? and s.inspection_minor = -2 and s.inspection_major = 0 and x.diastolic_blood_pressure <> 0 and x.diastolic_blood_pressure +0 >= s.min_range +0 and x.diastolic_blood_pressure +0 <= s.large_range +0", orgid, orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2750
+	return record, total, err
2751
+}
2752
+
2753
+func GetQuarterTargeStand(orgid int64, firststart int64, firstend int64, sencondstart int64, sencondend int64, threestart int64, threeend int64, fourstart int64, fourend int64) (inspection []*models.ProjectCountTwo, err error) {
2754
+
2755
+	db := readDb.Table("xt_inspection as x ").Where("x.status=1")
2756
+	countSQL := "SELECT nnd AS 'name',COUNT(*) AS 'count' FROM(" +
2757
+		"SELECT " +
2758
+		"CASE " +
2759
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '1'" +
2760
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '2'" +
2761
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '3'" +
2762
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '4'" +
2763
+		" ELSE '其他'" +
2764
+		"END AS nnd FROM xt_inspection as x right join xt_quality_control_standard AS s ON x.project_id = s.inspection_major AND x.item_id = s.inspection_minor AND x.org_id = s.user_org_id where x.inspect_value+0<>0 and x.status = 1  and x.inspect_type = 1 and s.is_status = 1 and s.status = 1 and x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0"
2765
+	countParams := make([]interface{}, 0)
2766
+	countParams = append(countParams, firststart)
2767
+	countParams = append(countParams, firstend)
2768
+	countParams = append(countParams, sencondstart)
2769
+	countParams = append(countParams, sencondend)
2770
+	countParams = append(countParams, threestart)
2771
+	countParams = append(countParams, threeend)
2772
+	countParams = append(countParams, fourstart)
2773
+	countParams = append(countParams, fourend)
2774
+	if orgid > 0 {
2775
+		db = db.Where("x.org_id=?", orgid)
2776
+		countSQL += " AND x.org_id=?"
2777
+		countParams = append(countParams, orgid)
2778
+
2779
+		db = db.Where("x.inspect_date>=?", firststart)
2780
+		countSQL += " AND x.inspect_date>=?"
2781
+		countParams = append(countParams, firststart)
2782
+
2783
+		db = db.Where("x.inspect_date<=?", fourend)
2784
+		countSQL += " AND x.inspect_date<=?"
2785
+		countParams = append(countParams, fourend)
2786
+
2787
+	}
2788
+	countSQL += ")a GROUP BY nnd"
2789
+	err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
2790
+	return
2791
+}
2792
+
2793
+func GetQuarterTargeNoStand(orgid int64, firststart int64, firstend int64, sencondstart int64, sencondend int64, threestart int64, threeend int64, fourstart int64, fourend int64) (inspection []*models.ProjectCountTwo, err error) {
2794
+
2795
+	db := readDb.Table("xt_inspection as x ").Where("x.status=1")
2796
+	countSQL := "SELECT nnd AS 'name',COUNT(*) AS 'count' FROM(" +
2797
+		"SELECT " +
2798
+		"CASE " +
2799
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '1'" +
2800
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '2'" +
2801
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '3'" +
2802
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '4'" +
2803
+		" ELSE '其他'" +
2804
+		"END AS nnd FROM xt_inspection as x right join xt_quality_control_standard AS s ON x.project_id = s.inspection_major AND x.item_id = s.inspection_minor AND x.org_id = s.user_org_id where x.inspect_value+0<>0 and x.status = 1  and x.inspect_type = 1 and s.is_status = 1 and s.status = 1 and (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0)"
2805
+	countParams := make([]interface{}, 0)
2806
+	countParams = append(countParams, firststart)
2807
+	countParams = append(countParams, firstend)
2808
+	countParams = append(countParams, sencondstart)
2809
+	countParams = append(countParams, sencondend)
2810
+	countParams = append(countParams, threestart)
2811
+	countParams = append(countParams, threeend)
2812
+	countParams = append(countParams, fourstart)
2813
+	countParams = append(countParams, fourend)
2814
+	if orgid > 0 {
2815
+		db = db.Where("x.org_id=?", orgid)
2816
+		countSQL += " AND x.org_id=?"
2817
+		countParams = append(countParams, orgid)
2818
+
2819
+		db = db.Where("x.inspect_date>=?", firststart)
2820
+		countSQL += " AND x.inspect_date>=?"
2821
+		countParams = append(countParams, firststart)
2822
+
2823
+		db = db.Where("x.inspect_date<=?", fourend)
2824
+		countSQL += " AND x.inspect_date<=?"
2825
+		countParams = append(countParams, fourend)
2826
+
2827
+	}
2828
+	countSQL += ")a GROUP BY nnd"
2829
+	err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
2830
+	return
2831
+}
2832
+
2833
+func GetContagionQuarterTargeStand(orgid int64, firststart int64, firstend int64, sencondstart int64, sencondend int64, threestart int64, threeend int64, fourstart int64, fourend int64) (inspection []*models.ProjectCountTwo, err error) {
2834
+
2835
+	db := readDb.Table("xt_inspection as x ").Where("x.status=1")
2836
+	countSQL := "SELECT nnd AS 'name',COUNT(*) AS 'count' FROM(" +
2837
+		"SELECT " +
2838
+		"CASE " +
2839
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '1'" +
2840
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = s.range_value  THEN '2'" +
2841
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = s.range_value THEN '3'" +
2842
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = s.range_value THEN '4'" +
2843
+		" ELSE '其他'" +
2844
+		"END AS nnd FROM xt_inspection as x right join xt_quality_control_standard AS s ON x.project_id = s.inspection_major AND x.item_id = s.inspection_minor AND x.org_id = s.user_org_id where x.inspect_value<>'' and x.status = 1  and x.inspect_type = 2 and s.is_status = 1 and s.status = 1 and  x.inspect_value = s.range_value"
2845
+	countParams := make([]interface{}, 0)
2846
+	countParams = append(countParams, firststart)
2847
+	countParams = append(countParams, firstend)
2848
+	countParams = append(countParams, sencondstart)
2849
+	countParams = append(countParams, sencondend)
2850
+	countParams = append(countParams, threestart)
2851
+	countParams = append(countParams, threeend)
2852
+	countParams = append(countParams, fourstart)
2853
+	countParams = append(countParams, fourend)
2854
+	if orgid > 0 {
2855
+		db = db.Where("x.org_id=?", orgid)
2856
+		countSQL += " AND x.org_id=?"
2857
+		countParams = append(countParams, orgid)
2858
+
2859
+		db = db.Where("x.inspect_date>=?", firststart)
2860
+		countSQL += " AND x.inspect_date>=?"
2861
+		countParams = append(countParams, firststart)
2862
+
2863
+		db = db.Where("x.inspect_date<=?", fourend)
2864
+		countSQL += " AND x.inspect_date<=?"
2865
+		countParams = append(countParams, fourend)
2866
+
2867
+	}
2868
+	countSQL += ")a GROUP BY nnd"
2869
+	err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
2870
+	return
2871
+}
2872
+
2873
+func GetContagionTargeNoStand(orgid int64, firststart int64, firstend int64, sencondstart int64, sencondend int64, threestart int64, threeend int64, fourstart int64, fourend int64) (inspection []*models.ProjectCountTwo, err error) {
2874
+
2875
+	db := readDb.Table("xt_inspection as x ").Where("x.status=1")
2876
+	countSQL := "SELECT nnd AS 'name',COUNT(*) AS 'count' FROM(" +
2877
+		"SELECT " +
2878
+		"CASE " +
2879
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '1'" +
2880
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value <> s.range_value  THEN '2'" +
2881
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value <> s.range_value THEN '3'" +
2882
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value <> s.range_value THEN '4'" +
2883
+		" ELSE '其他'" +
2884
+		"END AS nnd FROM xt_inspection as x right join xt_quality_control_standard AS s ON x.project_id = s.inspection_major AND x.item_id = s.inspection_minor AND x.org_id = s.user_org_id where x.inspect_value<>'' and x.status = 1  and x.inspect_type = 2 and s.is_status = 1 and s.status = 1 and  x.inspect_value <> s.range_value"
2885
+	countParams := make([]interface{}, 0)
2886
+	countParams = append(countParams, firststart)
2887
+	countParams = append(countParams, firstend)
2888
+	countParams = append(countParams, sencondstart)
2889
+	countParams = append(countParams, sencondend)
2890
+	countParams = append(countParams, threestart)
2891
+	countParams = append(countParams, threeend)
2892
+	countParams = append(countParams, fourstart)
2893
+	countParams = append(countParams, fourend)
2894
+	if orgid > 0 {
2895
+		db = db.Where("x.org_id=?", orgid)
2896
+		countSQL += " AND x.org_id=?"
2897
+		countParams = append(countParams, orgid)
2898
+
2899
+		db = db.Where("x.inspect_date>=?", firststart)
2900
+		countSQL += " AND x.inspect_date>=?"
2901
+		countParams = append(countParams, firststart)
2902
+
2903
+		db = db.Where("x.inspect_date<=?", fourend)
2904
+		countSQL += " AND x.inspect_date<=?"
2905
+		countParams = append(countParams, fourend)
2906
+
2907
+	}
2908
+	countSQL += ")a GROUP BY nnd"
2909
+	err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
2910
+	return
2911
+}
2912
+
2913
+func GetMonthTargetStand(orgId, 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.ProjectCountTwo, err error) {
2914
+
2915
+	db := readDb.Table("xt_inspection as x ").Where("x.status=1")
2916
+	countSQL := "SELECT nnd AS 'name',COUNT(*) AS 'count' FROM(" +
2917
+		"SELECT " +
2918
+		"CASE " +
2919
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '1'" +
2920
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '2'" +
2921
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '3'" +
2922
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '4'" +
2923
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '5'" +
2924
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '6'" +
2925
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '7'" +
2926
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '8'" +
2927
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '9'" +
2928
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '10'" +
2929
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '11'" +
2930
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0 THEN '12'" +
2931
+		" ELSE '其他'" +
2932
+		"END AS nnd FROM xt_inspection as x right join xt_quality_control_standard AS s ON x.project_id = s.inspection_major AND x.item_id = s.inspection_minor AND x.org_id = s.user_org_id where x.inspect_value+0<>0 and x.status = 1  and x.inspect_type = 1 and s.is_status = 1 and s.status = 1 and x.inspect_value + 0 >= s.min_range + 0 AND x.inspect_value + 0 <= s.large_range + 0"
2933
+	countParams := make([]interface{}, 0)
2934
+	countParams = append(countParams, januaryStartStrUnix)
2935
+	countParams = append(countParams, januaryEndStrUnix)
2936
+	countParams = append(countParams, febStartStrStrUnix)
2937
+	countParams = append(countParams, febEndStrUnix)
2938
+	countParams = append(countParams, marchStartStrUnix)
2939
+	countParams = append(countParams, marchEndStrUnix)
2940
+	countParams = append(countParams, aprStartStrUnix)
2941
+	countParams = append(countParams, aprEndStrsUnix)
2942
+	countParams = append(countParams, mayStartStrUnix)
2943
+	countParams = append(countParams, mayEndStrsUnix)
2944
+	countParams = append(countParams, junStartStrUnix)
2945
+	countParams = append(countParams, junEndStrsUnix)
2946
+	countParams = append(countParams, julStartStrUnix)
2947
+	countParams = append(countParams, julEndStrsUnix)
2948
+	countParams = append(countParams, augStartStrUnix)
2949
+	countParams = append(countParams, augEndStrsUnix)
2950
+	countParams = append(countParams, sepStartStrUnix)
2951
+	countParams = append(countParams, sepEndStrsUnix)
2952
+	countParams = append(countParams, octStartStrUnix)
2953
+	countParams = append(countParams, octEndStrsUnix)
2954
+	countParams = append(countParams, novStartStrUnix)
2955
+	countParams = append(countParams, novEndStrsUnix)
2956
+	countParams = append(countParams, decStartStrUnix)
2957
+	countParams = append(countParams, decEndStrsUnix)
2958
+	if orgId > 0 {
2959
+		db = db.Where("x.org_id=?", orgId)
2960
+		countSQL += " AND x.org_id=?"
2961
+		countParams = append(countParams, orgId)
2962
+
2963
+		db = db.Where("x.inspect_date>=?", januaryStartStrUnix)
2964
+		countSQL += " AND x.inspect_date>=?"
2965
+		countParams = append(countParams, januaryStartStrUnix)
2966
+
2967
+		db = db.Where("x.inspect_date<=?", decStartStrUnix)
2968
+		countSQL += " AND x.inspect_date<=?"
2969
+		countParams = append(countParams, decEndStrsUnix)
2970
+
2971
+	}
2972
+	countSQL += ")a GROUP BY nnd"
2973
+	err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
2974
+	return
2975
+}
2976
+
2977
+func GetMonthTargetNoStand(orgId, 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.ProjectCountTwo, err error) {
2978
+
2979
+	db := readDb.Table("xt_inspection as x ").Where("x.status=1")
2980
+	countSQL := "SELECT nnd AS 'name',COUNT(*) AS 'count' FROM(" +
2981
+		"SELECT " +
2982
+		"CASE " +
2983
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '1'" +
2984
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '2'" +
2985
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '3'" +
2986
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '4'" +
2987
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '5'" +
2988
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '6'" +
2989
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '7'" +
2990
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '8'" +
2991
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '9'" +
2992
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '10'" +
2993
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '11'" +
2994
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0) THEN '12'" +
2995
+		" ELSE '其他'" +
2996
+		"END AS nnd FROM xt_inspection as x right join xt_quality_control_standard AS s ON x.project_id = s.inspection_major AND x.item_id = s.inspection_minor AND x.org_id = s.user_org_id where x.inspect_value+0<>0 and x.status = 1  and x.inspect_type = 1 and s.is_status = 1 and s.status = 1 and  (x.inspect_value + 0 < s.min_range + 0 or x.inspect_value + 0 > s.large_range + 0)"
2997
+	countParams := make([]interface{}, 0)
2998
+	countParams = append(countParams, januaryStartStrUnix)
2999
+	countParams = append(countParams, januaryEndStrUnix)
3000
+	countParams = append(countParams, febStartStrStrUnix)
3001
+	countParams = append(countParams, febEndStrUnix)
3002
+	countParams = append(countParams, marchStartStrUnix)
3003
+	countParams = append(countParams, marchEndStrUnix)
3004
+	countParams = append(countParams, aprStartStrUnix)
3005
+	countParams = append(countParams, aprEndStrsUnix)
3006
+	countParams = append(countParams, mayStartStrUnix)
3007
+	countParams = append(countParams, mayEndStrsUnix)
3008
+	countParams = append(countParams, junStartStrUnix)
3009
+	countParams = append(countParams, junEndStrsUnix)
3010
+	countParams = append(countParams, julStartStrUnix)
3011
+	countParams = append(countParams, julEndStrsUnix)
3012
+	countParams = append(countParams, augStartStrUnix)
3013
+	countParams = append(countParams, augEndStrsUnix)
3014
+	countParams = append(countParams, sepStartStrUnix)
3015
+	countParams = append(countParams, sepEndStrsUnix)
3016
+	countParams = append(countParams, octStartStrUnix)
3017
+	countParams = append(countParams, octEndStrsUnix)
3018
+	countParams = append(countParams, novStartStrUnix)
3019
+	countParams = append(countParams, novEndStrsUnix)
3020
+	countParams = append(countParams, decStartStrUnix)
3021
+	countParams = append(countParams, decEndStrsUnix)
3022
+	if orgId > 0 {
3023
+		db = db.Where("x.org_id=?", orgId)
3024
+		countSQL += " AND x.org_id=?"
3025
+		countParams = append(countParams, orgId)
3026
+
3027
+		db = db.Where("x.inspect_date>=?", januaryStartStrUnix)
3028
+		countSQL += " AND x.inspect_date>=?"
3029
+		countParams = append(countParams, januaryStartStrUnix)
3030
+
3031
+		db = db.Where("x.inspect_date<=?", decStartStrUnix)
3032
+		countSQL += " AND x.inspect_date<=?"
3033
+		countParams = append(countParams, decEndStrsUnix)
3034
+
3035
+	}
3036
+	countSQL += ")a GROUP BY nnd"
3037
+	err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
3038
+	return
3039
+}
3040
+
3041
+func GetMonthcontagionTargeStand(orgId, 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.ProjectCountTwo, err error) {
3042
+
3043
+	db := readDb.Table("xt_inspection as x ").Where("x.status=1")
3044
+	countSQL := "SELECT nnd AS 'name',COUNT(*) AS 'count' FROM(" +
3045
+		"SELECT " +
3046
+		"CASE " +
3047
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '1'" +
3048
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '2'" +
3049
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '3'" +
3050
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '4'" +
3051
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '5'" +
3052
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '6'" +
3053
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '7'" +
3054
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '8'" +
3055
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '9'" +
3056
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '10'" +
3057
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '11'" +
3058
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value = s.range_value THEN '12'" +
3059
+		" ELSE '其他'" +
3060
+		"END AS nnd FROM xt_inspection as x right join xt_quality_control_standard AS s ON x.project_id = s.inspection_major AND x.item_id = s.inspection_minor AND x.org_id = s.user_org_id where x.inspect_value<>'' and x.status = 1  and x.inspect_type = 2 and s.is_status = 1 and s.status = 1 and  x.inspect_value = s.range_value"
3061
+	countParams := make([]interface{}, 0)
3062
+	countParams = append(countParams, januaryStartStrUnix)
3063
+	countParams = append(countParams, januaryEndStrUnix)
3064
+	countParams = append(countParams, febStartStrStrUnix)
3065
+	countParams = append(countParams, febEndStrUnix)
3066
+	countParams = append(countParams, marchStartStrUnix)
3067
+	countParams = append(countParams, marchEndStrUnix)
3068
+	countParams = append(countParams, aprStartStrUnix)
3069
+	countParams = append(countParams, aprEndStrsUnix)
3070
+	countParams = append(countParams, mayStartStrUnix)
3071
+	countParams = append(countParams, mayEndStrsUnix)
3072
+	countParams = append(countParams, junStartStrUnix)
3073
+	countParams = append(countParams, junEndStrsUnix)
3074
+	countParams = append(countParams, julStartStrUnix)
3075
+	countParams = append(countParams, julEndStrsUnix)
3076
+	countParams = append(countParams, augStartStrUnix)
3077
+	countParams = append(countParams, augEndStrsUnix)
3078
+	countParams = append(countParams, sepStartStrUnix)
3079
+	countParams = append(countParams, sepEndStrsUnix)
3080
+	countParams = append(countParams, octStartStrUnix)
3081
+	countParams = append(countParams, octEndStrsUnix)
3082
+	countParams = append(countParams, novStartStrUnix)
3083
+	countParams = append(countParams, novEndStrsUnix)
3084
+	countParams = append(countParams, decStartStrUnix)
3085
+	countParams = append(countParams, decEndStrsUnix)
3086
+	if orgId > 0 {
3087
+		db = db.Where("x.org_id=?", orgId)
3088
+		countSQL += " AND x.org_id=?"
3089
+		countParams = append(countParams, orgId)
3090
+
3091
+		db = db.Where("x.inspect_date>=?", januaryStartStrUnix)
3092
+		countSQL += " AND x.inspect_date>=?"
3093
+		countParams = append(countParams, januaryStartStrUnix)
3094
+
3095
+		db = db.Where("x.inspect_date<=?", decStartStrUnix)
3096
+		countSQL += " AND x.inspect_date<=?"
3097
+		countParams = append(countParams, decEndStrsUnix)
3098
+
3099
+	}
3100
+	countSQL += ")a GROUP BY nnd"
3101
+	err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
3102
+	return
3103
+}
3104
+
3105
+func GetMonthcontagionTargeNoStand(orgId, 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.ProjectCountTwo, err error) {
3106
+
3107
+	db := readDb.Table("xt_inspection as x ").Where("x.status=1")
3108
+	countSQL := "SELECT nnd AS 'name',COUNT(*) AS 'count' FROM(" +
3109
+		"SELECT " +
3110
+		"CASE " +
3111
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '1'" +
3112
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '2'" +
3113
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '3'" +
3114
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '4'" +
3115
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '5'" +
3116
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '6'" +
3117
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '7'" +
3118
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '8'" +
3119
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '9'" +
3120
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '10'" +
3121
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '11'" +
3122
+		" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND  x.inspect_value <> s.range_value THEN '12'" +
3123
+		" ELSE '其他'" +
3124
+		"END AS nnd FROM xt_inspection as x right join xt_quality_control_standard AS s ON x.project_id = s.inspection_major AND x.item_id = s.inspection_minor AND x.org_id = s.user_org_id where x.inspect_value<>'' and x.status = 1  and x.inspect_type = 2 and s.is_status = 1 and s.status = 1 and  x.inspect_value <> s.range_value"
3125
+	countParams := make([]interface{}, 0)
3126
+	countParams = append(countParams, januaryStartStrUnix)
3127
+	countParams = append(countParams, januaryEndStrUnix)
3128
+	countParams = append(countParams, febStartStrStrUnix)
3129
+	countParams = append(countParams, febEndStrUnix)
3130
+	countParams = append(countParams, marchStartStrUnix)
3131
+	countParams = append(countParams, marchEndStrUnix)
3132
+	countParams = append(countParams, aprStartStrUnix)
3133
+	countParams = append(countParams, aprEndStrsUnix)
3134
+	countParams = append(countParams, mayStartStrUnix)
3135
+	countParams = append(countParams, mayEndStrsUnix)
3136
+	countParams = append(countParams, junStartStrUnix)
3137
+	countParams = append(countParams, junEndStrsUnix)
3138
+	countParams = append(countParams, julStartStrUnix)
3139
+	countParams = append(countParams, julEndStrsUnix)
3140
+	countParams = append(countParams, augStartStrUnix)
3141
+	countParams = append(countParams, augEndStrsUnix)
3142
+	countParams = append(countParams, sepStartStrUnix)
3143
+	countParams = append(countParams, sepEndStrsUnix)
3144
+	countParams = append(countParams, octStartStrUnix)
3145
+	countParams = append(countParams, octEndStrsUnix)
3146
+	countParams = append(countParams, novStartStrUnix)
3147
+	countParams = append(countParams, novEndStrsUnix)
3148
+	countParams = append(countParams, decStartStrUnix)
3149
+	countParams = append(countParams, decEndStrsUnix)
3150
+	if orgId > 0 {
3151
+		db = db.Where("x.org_id=?", orgId)
3152
+		countSQL += " AND x.org_id=?"
3153
+		countParams = append(countParams, orgId)
3154
+
3155
+		db = db.Where("x.inspect_date>=?", januaryStartStrUnix)
3156
+		countSQL += " AND x.inspect_date>=?"
3157
+		countParams = append(countParams, januaryStartStrUnix)
3158
+
3159
+		db = db.Where("x.inspect_date<=?", decStartStrUnix)
3160
+		countSQL += " AND x.inspect_date<=?"
3161
+		countParams = append(countParams, decEndStrsUnix)
3162
+
3163
+	}
3164
+	countSQL += ")a GROUP BY nnd"
3165
+	err = readDb.Raw(countSQL, countParams...).Scan(&inspection).Error
3166
+	return
3167
+}
3168
+
3169
+func GetQuarterBloodList(orgid int64, januaryStartStrUnix int64, januaryEndStrUnix int64) (record []*models.VmMonitoringRecord, err error) {
3170
+
3171
+	db := XTReadDB().Table("xt_monitoring_record as x")
3172
+	err = db.Select("x.id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.monitoring_date,x.patient_id,x.user_org_id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.systolic_blood_pressure <> 0 and x.diastolic_blood_pressure <> 0", orgid, januaryStartStrUnix, januaryEndStrUnix).Group("x.monitoring_date,x.patient_id").Scan(&record).Error
3173
+	return record, err
3174
+}
3175
+
3176
+func GetTaregetNoStandDetail(orgid int64, startime int64, endtime int64) (inspection []*models.XtPatientsInspection, err error) {
3177
+
3178
+	db := XTReadDB().Table("xt_inspection as x")
3179
+	err = db.Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,d.sort,d.min_range,d.large_range,d.range_value,d.range_type,x.inspect_type,x.org_id").Joins("left join xt_patients AS s ON s.id = x.patient_id").Joins("RIGHT JOIN xt_quality_control_standard AS d ON d.inspection_minor = x.item_id AND d.inspection_major = x.project_id AND x.org_id = d.user_org_id").Where("x.status = 1	and x.inspect_type = 1 and x.org_id = ? and x.inspect_value + 0 <> 0 and x.inspect_date >=? and x.inspect_date<=? and d.user_org_id = ? and d.is_status=1 and d.status = 1 and (x.inspect_value+0 < d.min_range+0  or x.inspect_value+0 > d.large_range + 0)", orgid, startime, endtime, orgid).Group("x.id").Order("x.inspect_date DESC").Scan(&inspection).Error
3180
+	return inspection, err
3181
+}
3182
+
3183
+func GetConfigurationNoStandDetail(orgid int64, startime int64, endtime int64) (inspection []*models.XtPatientsInspection, err error) {
3184
+	db := XTReadDB().Table("xt_inspection as x")
3185
+	err = db.Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,d.sort,d.min_range,d.large_range,d.range_value,d.range_type,x.inspect_type,x.org_id").Joins("left join xt_patients AS s ON s.id = x.patient_id").Joins("RIGHT JOIN xt_quality_control_standard AS d ON d.inspection_minor = x.item_id AND d.inspection_major = x.project_id AND x.org_id = d.user_org_id").Where("x.status = 1	and x.inspect_type = 2 and x.org_id = ? and x.inspect_value  <> '' and x.inspect_date >=? and x.inspect_date<=? and d.user_org_id = ? and d.is_status=1 and d.status = 1 and (x.inspect_value <> d.range_value)", orgid, startime, endtime, orgid).Group("x.id").Order("x.inspect_date DESC").Scan(&inspection).Error
3186
+	return inspection, err
3187
+}
3188
+
3189
+func GetInspectNoStandList(orgid int64, startime int64, endtime int64, limit int64, page int64) (inspection []*models.XtPatientsInspection, err error) {
3190
+
3191
+	db := XTReadDB().Table("xt_inspection as x")
3192
+	offset := (page - 1) * limit
3193
+	err = db.Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,d.sort,d.min_range,d.large_range,d.range_value,d.range_type,x.inspect_type,x.org_id").Joins("left join xt_patients AS s ON s.id = x.patient_id").Joins("RIGHT JOIN xt_quality_control_standard AS d ON d.inspection_minor = x.item_id AND d.inspection_major = x.project_id AND x.org_id = d.user_org_id").Where("x.status = 1	and x.inspect_type = 1 and x.org_id = ? and x.inspect_value + 0 <> 0 and x.inspect_date >=? and x.inspect_date<=? and d.user_org_id = ? and d.is_status=1 and d.status = 1 and (x.inspect_value+0 < d.min_range+0  or x.inspect_value+0 > d.large_range + 0)", orgid, startime, endtime, orgid).Group("x.id").Offset(offset).Limit(limit).Order("x.inspect_date DESC").Scan(&inspection).Error
3194
+	return inspection, err
3195
+}
3196
+
3197
+func GetTargetStandDetail(orgid int64, startime int64, endtime int64) (inspection []*models.XtPatientsInspection, err error) {
3198
+	db := XTReadDB().Table("xt_inspection as x")
3199
+	err = db.Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,d.sort,d.min_range,d.large_range,d.range_value,d.range_type,x.inspect_type,x.org_id").Joins("left join xt_patients AS s ON s.id = x.patient_id").Joins("RIGHT JOIN xt_quality_control_standard AS d ON d.inspection_minor = x.item_id AND d.inspection_major = x.project_id AND x.org_id = d.user_org_id").Where("x.status = 1	and x.inspect_type = 1 and x.org_id = ? and x.inspect_value + 0 <> 0 and x.inspect_date >=? and x.inspect_date<=? and d.user_org_id = ? and d.is_status=1 and d.status = 1 and x.inspect_value+0 >=d.min_range+0  and x.inspect_value+0 <= d.large_range + 0", orgid, startime, endtime, orgid).Group("x.id").Order("x.inspect_date DESC").Scan(&inspection).Error
3200
+	return inspection, err
3201
+}
3202
+
3203
+func GetConfigurationStandDetail(orgid int64, startime int64, endtime int64) (inspection []*models.XtPatientsInspection, err error) {
3204
+	db := XTReadDB().Table("xt_inspection as x")
3205
+	err = db.Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,d.sort,d.min_range,d.large_range,d.range_value,d.range_type,x.inspect_type,x.org_id").Joins("left join xt_patients AS s ON s.id = x.patient_id").Joins("RIGHT JOIN xt_quality_control_standard AS d ON d.inspection_minor = x.item_id AND d.inspection_major = x.project_id AND x.org_id = d.user_org_id").Where("x.status = 1	and x.inspect_type = 2 and x.org_id = ? and x.inspect_value  <> '' and x.inspect_date >=? and x.inspect_date<=? and d.user_org_id = ? and d.is_status=1 and d.status = 1 and (x.inspect_value = d.range_value)", orgid, startime, endtime, orgid).Group("x.id").Order("x.inspect_date DESC").Scan(&inspection).Error
3206
+	return inspection, err
3207
+}
3208
+
3209
+func GetStandList(orgid int64, startime int64, endtime int64, limit int64, page int64) (inspection []*models.XtPatientsInspection, err error) {
3210
+	db := XTReadDB().Table("xt_inspection as x")
3211
+	offset := (page - 1) * limit
3212
+	err = db.Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,d.sort,d.min_range,d.large_range,d.range_value,d.range_type,x.inspect_type,x.org_id").Joins("left join xt_patients AS s ON s.id = x.patient_id").Joins("RIGHT JOIN xt_quality_control_standard AS d ON d.inspection_minor = x.item_id AND d.inspection_major = x.project_id AND x.org_id = d.user_org_id").Where("x.status = 1	and x.inspect_type = 1 and x.org_id = ? and x.inspect_value + 0 <> 0 and x.inspect_date >=? and x.inspect_date<=? and d.user_org_id = ? and d.is_status=1 and d.status = 1 and x.inspect_value+0 >=d.min_range+0  and x.inspect_value+0 <= d.large_range + 0", orgid, startime, endtime, orgid).Group("x.id").Offset(offset).Limit(limit).Order("x.inspect_date DESC").Scan(&inspection).Error
3213
+
3214
+	return inspection, err
3215
+}

+ 2 - 2
service/patientmanage_service.go Просмотреть файл

@@ -913,9 +913,9 @@ func GetDoctorAdviceDetail(state int64, id int64, orgid int64) (advices []*model
913 913
 	return advices, err
914 914
 }
915 915
 
916
-func DeleteManagement(groupid int64, orgid int64) error {
916
+func DeleteManagement(groupid int64, orgid int64, patientid int64) error {
917 917
 
918
-	err := XTWriteDB().Model(models.DoctorAdvice{}).Where("start_time =? and user_org_id = ?", groupid, orgid).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
918
+	err := XTWriteDB().Model(models.DoctorAdvice{}).Where("start_time =? and user_org_id = ? and patient_id =?", groupid, orgid, patientid).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
919 919
 	return err
920 920
 }
921 921