Explorar el Código

库存调拨修改

28169 hace 2 años
padre
commit
2984f47131

+ 1 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Ver fichero

@@ -87,10 +87,9 @@ func (this *DialysisAPIController) Scheduals() {
87 87
 	defer redis.Close()
88 88
 
89 89
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
90
-
90
+	redis.Set(key, "", time.Second)
91 91
 	scheduals_json_str, _ := redis.Get(key).Result()
92 92
 
93
-	redis.Set(key, "", time.Second)
94 93
 	patients, _ := service.GetAllPatientListSix(orgID)
95 94
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
96 95
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)

+ 3 - 3
controllers/mobile_api_controllers/patient_api_controller.go Ver fichero

@@ -3193,13 +3193,13 @@ func (c *PatientApiController) GetPatientMonitor() {
3193 3193
 			//获取所有分区
3194 3194
 			zoneList, _ := service.GetAllZoneByList(orgID)
3195 3195
 			//获取透析处方
3196
-			prescriptions, _ := service.GetAllPrescriptionByList(orgID, theStartTime)
3196
+			prescriptions, _ := service.GetAllPrescriptionByListSix(orgID, theStartTime)
3197 3197
 			//获取透前评估
3198 3198
 			assessmentBefores, _ := service.GetAllAssessmentBeforesByListOne(orgID, theStartTime)
3199 3199
 			//获取上机
3200 3200
 			dialysisOrders, _ := service.GetAllDialysisOrdersByListSix(orgID, theStartTime)
3201 3201
 			//获取透后
3202
-			AssessmentAfterDislysis, _ := service.GetAllAssessmentAfterDislysisByListOne(orgID, theStartTime)
3202
+			AssessmentAfterDislysis, _ := service.GetAllAssessmentAfterDislysisByListSix(orgID, theStartTime)
3203 3203
 
3204 3204
 			//获取透后监测
3205 3205
 			monitorlist, _ := service.GetAllMonitorList(orgID, theStartTime)
@@ -3349,7 +3349,7 @@ func (c *PatientApiController) GetPatientDialysisSolutionList() {
3349 3349
 	return
3350 3350
 }
3351 3351
 
3352
-//GetDoctorAdvices 医嘱列表
3352
+// GetDoctorAdvices 医嘱列表
3353 3353
 func (c *PatientApiController) GetDoctorAdvices() {
3354 3354
 	id, _ := c.GetInt64("id", 0)
3355 3355
 	adviceType, _ := c.GetInt64("advice_type", 0)

+ 1 - 0
controllers/schedule_api_controller.go Ver fichero

@@ -3379,6 +3379,7 @@ func (this *ScheduleApiController) GetNextWeekDayScheduleOne() {
3379 3379
 	}
3380 3380
 
3381 3381
 	schedule, err := service.GetNextWeekDayScheduleSix(week_type, week_time, start_time, end_time, adminUserInfo.CurrentOrgId, zone, theStartTIme)
3382
+	fmt.Println("schedule------------------------------------------------", len(schedule))
3382 3383
 	for _, item := range schedule {
3383 3384
 		order, _ := service.GetLastDialysisOrder(adminUserInfo.CurrentOrgId, item.PatientId, theStartTIme)
3384 3385
 		item.XtDialysisOrderSix = order

+ 68 - 0
service/patient_service.go Ver fichero

@@ -2358,6 +2358,40 @@ func GetAllDialysisOrdersByListSeven(orgID int64, scheduleDate int64) (dialysisO
2358 2358
 	return dialysisOrders, err
2359 2359
 }
2360 2360
 
2361
+func GetAllPrescriptionByListSix(orgID int64, scheduleDate int64) (prescriptions []*models.VMDialysisPrescription, err error) {
2362
+
2363
+	err = readDb.Model(&models.VMDialysisPrescription{}).Where("status= 1 and user_org_id = ? and record_date = ?", orgID, scheduleDate).Find(&prescriptions).Error
2364
+	return prescriptions, err
2365
+	//redis := RedisClient()
2366
+	//defer redis.Close()
2367
+	//key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":prescriptions_list_all"
2368
+	//redis.Set(key, "", time.Second)
2369
+	//prescriptions_list_all, _ := redis.Get(key).Result()
2370
+	//
2371
+	//if len(prescriptions_list_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2372
+	//	err = readDb.Model(&models.VMDialysisPrescription{}).Where("status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).Find(&prescriptions).Error
2373
+	//	if err != nil {
2374
+	//		if err == gorm.ErrRecordNotFound {
2375
+	//			return nil, nil
2376
+	//		} else {
2377
+	//			return nil, err
2378
+	//		}
2379
+	//	} else {
2380
+	//		if len(prescriptions) > 0 {
2381
+	//			//缓存数据
2382
+	//			prescriptions_list_all, err := json.Marshal(&prescriptions)
2383
+	//			if err == nil {
2384
+	//				redis.Set(key, prescriptions_list_all, time.Second*60*60*18)
2385
+	//			}
2386
+	//		}
2387
+	//		return prescriptions, nil
2388
+	//	}
2389
+	//} else { //缓存数据了数据,将redis缓存的json字符串转为map
2390
+	//	json.Unmarshal([]byte(prescriptions_list_all), &prescriptions)
2391
+	//	return prescriptions, nil
2392
+	//}
2393
+}
2394
+
2361 2395
 func GetAllPrescriptionByList(orgID int64, scheduleDate int64) (prescriptions []*models.VMDialysisPrescription, err error) {
2362 2396
 
2363 2397
 	redis := RedisClient()
@@ -2458,6 +2492,40 @@ func GetAllDialysisOrdersByListOne(orgID int64, scheduleDate int64) (dialysisOrd
2458 2492
 	}
2459 2493
 }
2460 2494
 
2495
+func GetAllAssessmentAfterDislysisByListSix(orgID int64, scheduleDate int64) (assessmentAfterDislysis []*models.VMAssessmentAfterDislysis, err error) {
2496
+
2497
+	err = readDb.Model(&models.VMAssessmentAfterDislysis{}).Where("status=1 and user_org_id = ? and assessment_date = ?", orgID, scheduleDate).Find(&assessmentAfterDislysis).Error
2498
+	return assessmentAfterDislysis, err
2499
+	//redis := RedisClient()
2500
+	//defer redis.Close()
2501
+	//key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":assessment_after_dislysis_list_all"
2502
+	//redis.Set(key, "", time.Second)
2503
+	//assessment_after_dislysis__all, _ := redis.Get(key).Result()
2504
+	//
2505
+	//if len(assessment_after_dislysis__all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2506
+	//	err = readDb.Model(&models.VMAssessmentAfterDislysis{}).Where("status = 1  AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).Find(&assessmentAfterDislysis).Error
2507
+	//	if err != nil {
2508
+	//		if err == gorm.ErrRecordNotFound {
2509
+	//			return nil, nil
2510
+	//		} else {
2511
+	//			return nil, err
2512
+	//		}
2513
+	//	} else {
2514
+	//		if len(assessmentAfterDislysis) > 0 {
2515
+	//			//缓存数据
2516
+	//			assessment_after_dislysis__all, err := json.Marshal(&assessmentAfterDislysis)
2517
+	//			if err == nil {
2518
+	//				redis.Set(key, assessment_after_dislysis__all, time.Second*60*60*18)
2519
+	//			}
2520
+	//		}
2521
+	//		return assessmentAfterDislysis, nil
2522
+	//	}
2523
+	//} else { //缓存数据了数据,将redis缓存的json字符串转为map
2524
+	//	json.Unmarshal([]byte(assessment_after_dislysis__all), &assessmentAfterDislysis)
2525
+	//	return assessmentAfterDislysis, nil
2526
+	//}
2527
+}
2528
+
2461 2529
 func GetAllAssessmentAfterDislysisByListOne(orgID int64, scheduleDate int64) (assessmentAfterDislysis []*models.VMAssessmentAfterDislysis, err error) {
2462 2530
 	redis := RedisClient()
2463 2531
 	defer redis.Close()