|
@@ -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
|
|