XMLWAN 4 years ago
parent
commit
733844e382

+ 4 - 4
controllers/base_api_controller.go View File

@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 1
84
-		subscibe.OrgId = 7957
84
+		subscibe.OrgId = 9538
85 85
 		subscibe.PeriodStart = 1538035409
86 86
 		subscibe.PeriodEnd = 1569571409
87 87
 		subscibe.State = 1
@@ -91,7 +91,7 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 7957
94
+		adminUserInfo.CurrentOrgId = 9538
95 95
 		adminUserInfo.CurrentAppId = 18
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
@@ -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 = 9538
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 = 9538
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 View File

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

+ 23 - 7
controllers/new_mobile_api_controllers/common_api_controller.go View File

@@ -167,14 +167,30 @@ func (this *CommonApiController) GetConfigurationDetail() {
167 167
 
168 168
 func (this *CommonApiController) GetAllInspectionminor() {
169 169
 
170
-	minor, err := service.GetAllInspectionMinor(0)
171
-	if err != nil {
172
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
173
-		return
170
+	info := this.GetAdminUserInfo()
171
+	orgid := info.CurrentOrgId
172
+	major, _ := service.GetInspectionMajor(orgid)
173
+
174
+	if len(major) == 0 {
175
+		minor, err := service.GetAllInspectionMinor(0)
176
+		if err != nil {
177
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
178
+			return
179
+		}
180
+		this.ServeSuccessJSON(map[string]interface{}{
181
+			"minor": minor,
182
+		})
183
+	} else {
184
+		minor, err := service.GetAllInspectionMinor(orgid)
185
+		if err != nil {
186
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
187
+			return
188
+		}
189
+		this.ServeSuccessJSON(map[string]interface{}{
190
+			"minor": minor,
191
+		})
174 192
 	}
175
-	this.ServeSuccessJSON(map[string]interface{}{
176
-		"minor": minor,
177
-	})
193
+
178 194
 }
179 195
 
180 196
 func (this *CommonApiController) UpdateConfiguration() {

+ 3 - 3
service/common_service.go View File

@@ -2522,7 +2522,7 @@ func GetQualityControlById(orgid int64, patientid int64, startime int64, endtime
2522 2522
 	if inspectdate > 0 {
2523 2523
 		db = db.Where("x.inspect_date = ?", inspectdate)
2524 2524
 	}
2525
-	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,r.unit,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.id = x.item_id").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Order("x.inspect_date desc").Scan(&inspection).Error
2525
+	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,r.unit,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.id = x.item_id").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Order("x.inspect_date asc").Scan(&inspection).Error
2526 2526
 
2527 2527
 	return inspection, err
2528 2528
 }
@@ -2537,7 +2537,7 @@ func GetPatientComplianceDetail(orgid int64, patientid int64, startime int64, en
2537 2537
 	fmt.Println("d2", d2)
2538 2538
 
2539 2539
 	if orgid > 0 {
2540
-		db = db.Where("x.org_id = ?", orgid)
2540
+		db = db.Where("x.org_id = ? and (x.inspect_value <> '' or x.inspect_value+0 <> 0)", orgid)
2541 2541
 	}
2542 2542
 	if patientid > 0 {
2543 2543
 		db = db.Where("x.patient_id = ?", patientid)
@@ -2552,7 +2552,7 @@ func GetPatientComplianceDetail(orgid int64, patientid int64, startime int64, en
2552 2552
 		db = db.Where("x.item_id = ?", itemid)
2553 2553
 	}
2554 2554
 
2555
-	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,r.unit").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_inspection_reference as r on r.id = x.item_id").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Order("x.inspect_date desc").Scan(&inspection).Error
2555
+	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,r.unit,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.id = x.item_id").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Order("x.inspect_date asc").Scan(&inspection).Error
2556 2556
 
2557 2557
 	return inspection, err
2558 2558
 }