Browse Source

新功能

csx 4 years ago
parent
commit
70be8813a2

+ 33 - 18
conf/app.conf View File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode = dev
4 4
 
5 5
 # 1
@@ -150,26 +150,26 @@ readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
150 150
 readmysqlport = 3306
151 151
 readmysqluser = root
152 152
 readmysqlpass = 1Q2W3e4r!@#$
153
-readmysqlname = sgj_xt
153
+readmysqlname = test_xt
154 154
 
155 155
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
156 156
 writemysqlport = 3306
157 157
 writemysqluser = root
158 158
 writemysqlpass = 1Q2W3e4r!@#$
159
-writemysqlname = sgj_xt
159
+writemysqlname = test_xt
160 160
 
161 161
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
162 162
 readuserport = 3306
163 163
 readuseruser = root
164 164
 readuserpass = 1Q2W3e4r!@#$
165
-readusername = sgj_users
165
+readusername = test_users
166 166
 
167 167
 
168 168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169 169
 writeuserport = 3306
170 170
 writeuseruser = root
171 171
 writeuserpass = 1Q2W3e4r!@#$
172
-writeusername = sgj_users
172
+writeusername = test_users
173 173
 
174 174
 
175 175
 
@@ -221,16 +221,31 @@ redisport = 6379
221 221
 redispasswrod = 123456
222 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 View File

@@ -2,6 +2,7 @@ package new_mobile_api_controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
+	"XT_New/models"
5 6
 	"XT_New/service/statistics_service"
6 7
 	"XT_New/utils"
7 8
 	"fmt"
@@ -24,11 +25,35 @@ func (this *IndexEvaluationApiController) GetAdminUser() {
24 25
 //初始化数据
25 26
 func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
26 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 42
 	this.ServeSuccessJSON(map[string]interface{}{
29 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,10 +63,20 @@ func (this *IndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueDat
38 63
 	item_id, _ := this.GetInt64("item_id")
39 64
 	adminUserInfo := this.GetMobileAdminUserInfo()
40 65
 	var range_vaule []string
66
+	var qcs models.InspectionReference
67
+
41 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 80
 	} else {
46 81
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
47 82
 		for _, item := range inspection {
@@ -84,7 +119,7 @@ func (this *IndexEvaluationApiController) GetInspectionChartData() {
84 119
 	var range_value string
85 120
 	if range_type == 1 {
86 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 124
 	} else {
90 125
 
@@ -218,7 +253,7 @@ func (this *IndexEvaluationApiController) GetPatientInspectionBarChartData() {
218 253
 	if range_type == 1 {
219 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 258
 	} else {
224 259
 

+ 29 - 6
controllers/pc_index_evaluation_api_controller.go View File

@@ -2,6 +2,7 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
+	"XT_New/models"
5 6
 	"XT_New/service/statistics_service"
6 7
 	"XT_New/utils"
7 8
 	"github.com/astaxie/beego"
@@ -51,7 +52,20 @@ type PCIndexEvaluationApiController struct {
51 52
 //初始化数据
52 53
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
53 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 69
 	this.ServeSuccessJSON(map[string]interface{}{
56 70
 		"references": references,
57 71
 	})
@@ -64,10 +78,19 @@ func (this *PCIndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueD
64 78
 	item_id, _ := this.GetInt64("item_id")
65 79
 	adminUserInfo := this.GetAdminUserInfo()
66 80
 	var range_vaule []string
81
+	var qcs models.InspectionReference
67 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 95
 	} else {
73 96
 
@@ -113,7 +136,7 @@ func (this *PCIndexEvaluationApiController) GetInspectionChartData() {
113 136
 	var range_value string
114 137
 	if range_type == 1 {
115 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 141
 	} else {
119 142
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
@@ -246,7 +269,7 @@ func (this *PCIndexEvaluationApiController) GetPatientInspectionBarChartData() {
246 269
 	var range_value string
247 270
 	if range_type == 1 {
248 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 274
 	} else {
252 275
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)

+ 15 - 0
controllers/schedule_api_controller.go View File

@@ -570,9 +570,24 @@ func (this *ScheduleApiController) PrintInitData() {
570 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 587
 	this.ServeSuccessJSON(map[string]interface{}{
574 588
 		"schedules": schedules,
575 589
 		"monday":    monday.Unix(),
590
+		"days":      days,
576 591
 	})
577 592
 }
578 593
 

+ 8 - 2
service/statistics_service/index_evaluation_service.go View File

@@ -1431,9 +1431,9 @@ func FindOrgInspectionReferenceRangeTypeValue(user_org_id int64, project_id int6
1431 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 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 1437
 	return
1438 1438
 }
1439 1439
 
@@ -1769,3 +1769,9 @@ func FindOrgQualityControlStandardInspectionReferenceById(user_org_id int64, pro
1769 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 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
+}