csx 4 gadus atpakaļ
vecāks
revīzija
868fd95abf

+ 10 - 2
controllers/new_mobile_api_controllers/index_evaluation_api_controller.go Parādīt failu

@@ -276,9 +276,16 @@ func (this *IndexEvaluationApiController) GetPatientInspectionBarChartData() {
276 276
 
277 277
 	var range_value string
278 278
 	if range_type == 1 {
279
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
279
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
280
+
281
+		if count <= 0 {
282
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
283
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
280 284
 
281
-		range_value = qcs.RangeMin + "," + qcs.RangeMax
285
+		} else {
286
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
287
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
288
+		}
282 289
 
283 290
 	} else {
284 291
 
@@ -290,6 +297,7 @@ func (this *IndexEvaluationApiController) GetPatientInspectionBarChartData() {
290 297
 				range_value = range_value + "," + item.InspectValue
291 298
 			}
292 299
 		}
300
+
293 301
 	}
294 302
 
295 303
 	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)

+ 11 - 3
controllers/pc_index_evaluation_api_controller.go Parādīt failu

@@ -278,10 +278,19 @@ func (this *PCIndexEvaluationApiController) GetPatientInspectionBarChartData() {
278 278
 
279 279
 	var range_value string
280 280
 	if range_type == 1 {
281
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
282
-		range_value = qcs.RangeMin + "," + qcs.RangeMax
281
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
282
+
283
+		if count <= 0 {
284
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
285
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
286
+
287
+		} else {
288
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
289
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
290
+		}
283 291
 
284 292
 	} else {
293
+
285 294
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
286 295
 		for _, item := range inspection {
287 296
 			if len(range_value) == 0 {
@@ -292,7 +301,6 @@ func (this *PCIndexEvaluationApiController) GetPatientInspectionBarChartData() {
292 301
 		}
293 302
 
294 303
 	}
295
-
296 304
 	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)
297 305
 	this.ServeSuccessJSON(map[string]interface{}{
298 306
 		"data": data,