csx пре 4 година
родитељ
комит
70be8813a2

+ 33 - 18
conf/app.conf Прегледај датотеку

1
 appname = 血透
1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3
 runmode = dev
3
 runmode = dev
4
 
4
 
5
 # 1
5
 # 1
150
 readmysqlport = 3306
150
 readmysqlport = 3306
151
 readmysqluser = root
151
 readmysqluser = root
152
 readmysqlpass = 1Q2W3e4r!@#$
152
 readmysqlpass = 1Q2W3e4r!@#$
153
-readmysqlname = sgj_xt
153
+readmysqlname = test_xt
154
 
154
 
155
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
155
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
156
 writemysqlport = 3306
156
 writemysqlport = 3306
157
 writemysqluser = root
157
 writemysqluser = root
158
 writemysqlpass = 1Q2W3e4r!@#$
158
 writemysqlpass = 1Q2W3e4r!@#$
159
-writemysqlname = sgj_xt
159
+writemysqlname = test_xt
160
 
160
 
161
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
161
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
162
 readuserport = 3306
162
 readuserport = 3306
163
 readuseruser = root
163
 readuseruser = root
164
 readuserpass = 1Q2W3e4r!@#$
164
 readuserpass = 1Q2W3e4r!@#$
165
-readusername = sgj_users
165
+readusername = test_users
166
 
166
 
167
 
167
 
168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169
 writeuserport = 3306
169
 writeuserport = 3306
170
 writeuseruser = root
170
 writeuseruser = root
171
 writeuserpass = 1Q2W3e4r!@#$
171
 writeuserpass = 1Q2W3e4r!@#$
172
-writeusername = sgj_users
172
+writeusername = test_users
173
 
173
 
174
 
174
 
175
 
175
 
221
 redispasswrod = 123456
221
 redispasswrod = 123456
222
 redisdb = 0
222
 redisdb = 0
223
 
223
 
224
-niprocart =  83
225
-jms = 80
226
-fistula_needle_set = 81
227
-fistula_needle_set_16 = 82
228
-hemoperfusion = 85
229
-dialyser_sterilised = 84
230
-filtryzer = 79
231
-dialyzers = 10000
232
-injector = 10001
233
-bloodlines = 10002
234
-tubingHemodialysis = 10003
235
-package = 10004
236
-aliquid = 10005
224
+
225
+        niprocart =  63
226
+        jms = 58
227
+        fistula_needle_set = 65
228
+        fistula_needle_set_16 = 64
229
+        hemoperfusion = 55
230
+        dialyser_sterilised = 12
231
+        filtryzer = 53
232
+                dialyzers = 8
233
+                injector = 81
234
+                bloodlines = 42
235
+        tubingHemodialysis = 30
236
+        package = 82
237
+        aliquid = 83
238
+
239
+#niprocart =  83
240
+#jms = 80
241
+#fistula_needle_set = 81
242
+#fistula_needle_set_16 = 82
243
+#hemoperfusion = 85
244
+#dialyser_sterilised = 84
245
+#filtryzer = 79
246
+#dialyzers = 10000
247
+#injector = 10001
248
+#bloodlines = 10002
249
+#tubingHemodialysis = 10003
250
+#package = 10004
251
+#aliquid = 10005

+ 41 - 6
controllers/new_mobile_api_controllers/index_evaluation_api_controller.go Прегледај датотеку

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
+	"XT_New/models"
5
 	"XT_New/service/statistics_service"
6
 	"XT_New/service/statistics_service"
6
 	"XT_New/utils"
7
 	"XT_New/utils"
7
 	"fmt"
8
 	"fmt"
24
 //初始化数据
25
 //初始化数据
25
 func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
26
 func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
26
 	adminUserInfo := this.GetMobileAdminUserInfo()
27
 	adminUserInfo := this.GetMobileAdminUserInfo()
27
-	references, _ := statistics_service.FindOrgQualityControlStandardInspectionReference(adminUserInfo.Org.Id)
28
+	var references []*models.InspectionReference
29
+	count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
30
+	if count <= 0 {
31
+		references, _ = statistics_service.FindOrgInspectionReference(0, 1)
32
+		references2, _ := statistics_service.FindOrgInspectionReference(0, 2)
33
+		references = append(references, references2...)
34
+
35
+	} else {
36
+		references, _ = statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id, 1)
37
+		references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id, 2)
38
+		references = append(references, references2...)
39
+
40
+	}
41
+
28
 	this.ServeSuccessJSON(map[string]interface{}{
42
 	this.ServeSuccessJSON(map[string]interface{}{
29
 		"references": references,
43
 		"references": references,
30
 	})
44
 	})
31
 
45
 
46
+	//adminUserInfo := this.GetMobileAdminUserInfo()
47
+	//
48
+	//
49
+	//
50
+	//references, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id,1)
51
+	//references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id,2)
52
+	//references = append(references, references2...)
53
+	//this.ServeSuccessJSON(map[string]interface{}{
54
+	//	"references": references,
55
+	//})
56
+
32
 }
57
 }
33
 
58
 
34
 //获取取值范围
59
 //获取取值范围
38
 	item_id, _ := this.GetInt64("item_id")
63
 	item_id, _ := this.GetInt64("item_id")
39
 	adminUserInfo := this.GetMobileAdminUserInfo()
64
 	adminUserInfo := this.GetMobileAdminUserInfo()
40
 	var range_vaule []string
65
 	var range_vaule []string
66
+	var qcs models.InspectionReference
67
+
41
 	if range_type == 1 {
68
 	if range_type == 1 {
42
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
43
-		range_vaule = append(range_vaule, qcs.MinRange)
44
-		range_vaule = append(range_vaule, qcs.LargeRange)
69
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
70
+
71
+		if count <= 0 {
72
+			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
73
+		} else {
74
+			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
75
+
76
+		}
77
+		//qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
78
+		range_vaule = append(range_vaule, qcs.RangeMin)
79
+		range_vaule = append(range_vaule, qcs.RangeMax)
45
 	} else {
80
 	} else {
46
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
81
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
47
 		for _, item := range inspection {
82
 		for _, item := range inspection {
84
 	var range_value string
119
 	var range_value string
85
 	if range_type == 1 {
120
 	if range_type == 1 {
86
 		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
121
 		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
87
-		range_value = qcs.MinRange + "," + qcs.LargeRange
122
+		range_value = qcs.RangeMin + "," + qcs.RangeMax
88
 
123
 
89
 	} else {
124
 	} else {
90
 
125
 
218
 	if range_type == 1 {
253
 	if range_type == 1 {
219
 		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
254
 		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
220
 
255
 
221
-		range_value = qcs.MinRange + "," + qcs.LargeRange
256
+		range_value = qcs.RangeMin + "," + qcs.RangeMax
222
 
257
 
223
 	} else {
258
 	} else {
224
 
259
 

+ 29 - 6
controllers/pc_index_evaluation_api_controller.go Прегледај датотеку

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
+	"XT_New/models"
5
 	"XT_New/service/statistics_service"
6
 	"XT_New/service/statistics_service"
6
 	"XT_New/utils"
7
 	"XT_New/utils"
7
 	"github.com/astaxie/beego"
8
 	"github.com/astaxie/beego"
51
 //初始化数据
52
 //初始化数据
52
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
53
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
53
 	adminUserInfo := this.GetAdminUserInfo()
54
 	adminUserInfo := this.GetAdminUserInfo()
54
-	references, _ := statistics_service.FindOrgQualityControlStandardInspectionReference(adminUserInfo.CurrentOrgId)
55
+
56
+	var references []*models.InspectionReference
57
+	count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
58
+	if count <= 0 {
59
+		references, _ = statistics_service.FindOrgInspectionReference(0, 1)
60
+		references2, _ := statistics_service.FindOrgInspectionReference(0, 2)
61
+		references = append(references, references2...)
62
+
63
+	} else {
64
+		references, _ = statistics_service.FindOrgInspectionReference(adminUserInfo.CurrentOrgId, 1)
65
+		references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.CurrentOrgId, 2)
66
+		references = append(references, references2...)
67
+
68
+	}
55
 	this.ServeSuccessJSON(map[string]interface{}{
69
 	this.ServeSuccessJSON(map[string]interface{}{
56
 		"references": references,
70
 		"references": references,
57
 	})
71
 	})
64
 	item_id, _ := this.GetInt64("item_id")
78
 	item_id, _ := this.GetInt64("item_id")
65
 	adminUserInfo := this.GetAdminUserInfo()
79
 	adminUserInfo := this.GetAdminUserInfo()
66
 	var range_vaule []string
80
 	var range_vaule []string
81
+	var qcs models.InspectionReference
67
 	if range_type == 1 {
82
 	if range_type == 1 {
68
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
69
-		range_vaule = append(range_vaule, qcs.MinRange)
70
-		range_vaule = append(range_vaule, qcs.LargeRange)
83
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
84
+
85
+		if count <= 0 {
86
+			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
87
+		} else {
88
+			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
89
+
90
+		}
91
+
92
+		range_vaule = append(range_vaule, qcs.RangeMin)
93
+		range_vaule = append(range_vaule, qcs.RangeMax)
71
 
94
 
72
 	} else {
95
 	} else {
73
 
96
 
113
 	var range_value string
136
 	var range_value string
114
 	if range_type == 1 {
137
 	if range_type == 1 {
115
 		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
138
 		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
116
-		range_value = qcs.MinRange + "," + qcs.LargeRange
139
+		range_value = qcs.RangeMin + "," + qcs.RangeMax
117
 
140
 
118
 	} else {
141
 	} else {
119
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
142
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
246
 	var range_value string
269
 	var range_value string
247
 	if range_type == 1 {
270
 	if range_type == 1 {
248
 		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
271
 		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
249
-		range_value = qcs.MinRange + "," + qcs.LargeRange
272
+		range_value = qcs.RangeMin + "," + qcs.RangeMax
250
 
273
 
251
 	} else {
274
 	} else {
252
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
275
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)

+ 15 - 0
controllers/schedule_api_controller.go Прегледај датотеку

570
 		return
570
 		return
571
 	}
571
 	}
572
 
572
 
573
+	thisTime := time.Now()
574
+
575
+	weekDay := int(thisTime.Weekday())
576
+	if weekDay == 0 {
577
+		weekDay = 7
578
+	}
579
+	weekEnd := 7 - weekDay
580
+	weekStart := weekEnd - 6
581
+	days := make([]string, 0)
582
+	for index := weekStart; index <= weekEnd; index++ {
583
+		theDay := thisTime.AddDate(0, 0, index)
584
+		days = append(days, theDay.Format("2006-01-02"))
585
+	}
586
+
573
 	this.ServeSuccessJSON(map[string]interface{}{
587
 	this.ServeSuccessJSON(map[string]interface{}{
574
 		"schedules": schedules,
588
 		"schedules": schedules,
575
 		"monday":    monday.Unix(),
589
 		"monday":    monday.Unix(),
590
+		"days":      days,
576
 	})
591
 	})
577
 }
592
 }
578
 
593
 

+ 8 - 2
service/statistics_service/index_evaluation_service.go Прегледај датотеку

1431
 	return
1431
 	return
1432
 }
1432
 }
1433
 
1433
 
1434
-func FindOrgConfigRangeTypeValue(user_org_id int64, project_id int64, item_id int64) (qcs QualityControlStandard, err error) {
1434
+func FindOrgConfigRangeTypeValue(user_org_id int64, project_id int64, item_id int64) (qcs models.InspectionReference, err error) {
1435
 	db := service.XTReadDB()
1435
 	db := service.XTReadDB()
1436
-	err = db.Model(&QualityControlStandard{}).Where("status = 1 AND user_org_id = ? AND inspection_major = ? AND inspection_minor = ?", user_org_id, project_id, item_id).First(&qcs).Error
1436
+	err = db.Model(&models.InspectionReference{}).Where("status = 1 AND org_id = ? AND project_id = ? AND id = ?", user_org_id, project_id, item_id).First(&qcs).Error
1437
 	return
1437
 	return
1438
 }
1438
 }
1439
 
1439
 
1769
 	err = db.Raw("Select reference.project_name as project_name,qcs.inspection_major as project_id, qcs.inspection_minor as id,reference.item_name as item_name,qcs.range_type as range_type,reference.range_min as range_min, reference.range_max as range_max,reference.unit as  unit,qcs.range_value as range_value   from xt_quality_control_standard qcs Left JOIN xt_inspection_reference reference ON  qcs.inspection_major = reference.project_id and qcs.inspection_minor = reference.id and  (reference.org_id = ? OR org_id = 0)  Where qcs.user_org_id = ?  AND qcs.status = 1 AND qcs.inspection_major = ? AND qcs.inspection_minor = ?", user_org_id, user_org_id, project_id, item_id).Scan(&references).Error
1769
 	err = db.Raw("Select reference.project_name as project_name,qcs.inspection_major as project_id, qcs.inspection_minor as id,reference.item_name as item_name,qcs.range_type as range_type,reference.range_min as range_min, reference.range_max as range_max,reference.unit as  unit,qcs.range_value as range_value   from xt_quality_control_standard qcs Left JOIN xt_inspection_reference reference ON  qcs.inspection_major = reference.project_id and qcs.inspection_minor = reference.id and  (reference.org_id = ? OR org_id = 0)  Where qcs.user_org_id = ?  AND qcs.status = 1 AND qcs.inspection_major = ? AND qcs.inspection_minor = ?", user_org_id, user_org_id, project_id, item_id).Scan(&references).Error
1770
 	return
1770
 	return
1771
 }
1771
 }
1772
+
1773
+func FindOrgInspectionCount(user_org_id int64) (count int64, err error) {
1774
+	db := service.XTReadDB()
1775
+	err = db.Model(&models.InspectionReference{}).Where("status = 1 AND org_id = ?", user_org_id).Count(&count).Error
1776
+	return
1777
+}