XMLWAN 3 лет назад
Родитель
Сommit
b9c8ca5e0c

+ 5 - 1
controllers/dialysis_record_api_controller.go Просмотреть файл

165
 					redis.Set(key, scheduals_json, time.Second*60)
165
 					redis.Set(key, scheduals_json, time.Second*60)
166
 				}
166
 				}
167
 			}
167
 			}
168
+			information, _ := service.GetAdminUserRoleInformation(orgID)
168
 
169
 
169
 			this.ServeSuccessJSON(map[string]interface{}{
170
 			this.ServeSuccessJSON(map[string]interface{}{
170
-				"schedules": scheduals,
171
+				"schedules":   scheduals,
172
+				"information": information,
171
 			})
173
 			})
172
 
174
 
173
 		}
175
 		}
394
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
396
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
395
 	}
397
 	}
396
 
398
 
399
+	information, _ := service.GetAdminUserRoleInformation(adminInfo.CurrentOrgId)
397
 	returnData := map[string]interface{}{
400
 	returnData := map[string]interface{}{
398
 		"patient":                     patient,
401
 		"patient":                     patient,
399
 		"schedual":                    schedual,
402
 		"schedual":                    schedual,
423
 		"stockType":                   stockType,
426
 		"stockType":                   stockType,
424
 		"prepare":                     prepare,
427
 		"prepare":                     prepare,
425
 		"lastAssessment":              lastAssessment,
428
 		"lastAssessment":              lastAssessment,
429
+		"information":                 information,
426
 	}
430
 	}
427
 	this.ServeSuccessJSON(returnData)
431
 	this.ServeSuccessJSON(returnData)
428
 
432
 

+ 37 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Просмотреть файл

89
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
89
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
90
 
90
 
91
 	scheduals_json_str, _ := redis.Get(key).Result()
91
 	scheduals_json_str, _ := redis.Get(key).Result()
92
-
92
+	redis.Set(key, "", time.Second)
93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
95
 
95
 
188
 				}
188
 				}
189
 			}
189
 			}
190
 
190
 
191
+			//获取今日所有的处方开的耗材
192
+			project, _ := service.GetAllHisProjectPrescription(orgID, date.Unix())
193
+
194
+			//获取今日透析准备的数据
195
+			goodList, err := service.MobileGetDialysisGoodsSeven(orgID, date.Unix())
196
+
197
+			list, err := service.MobileGetDialysisGoodsSix(orgID, date.Unix())
198
+
199
+			for _, item := range goodList {
200
+				for _, it := range list {
201
+					if item.RecordDate == it.RecordDate && it.PatientId == it.PatientId {
202
+						item.Children = append(item.Children, it)
203
+					}
204
+				}
205
+			}
206
+
207
+			fmt.Println("goodlist888888888888888888888", goodList, err)
191
 			this.ServeSuccessJSON(map[string]interface{}{
208
 			this.ServeSuccessJSON(map[string]interface{}{
192
 				"scheduals": scheduals,
209
 				"scheduals": scheduals,
210
+				"project":   project,
211
+				"goodList":  goodList,
193
 			})
212
 			})
194
 		}
213
 		}
195
 
214
 
201
 		} else {
220
 		} else {
202
 
221
 
203
 		}
222
 		}
223
+		//获取今日所有的处方开的耗材
224
+		project, _ := service.GetAllHisProjectPrescription(orgID, date.Unix())
225
+
226
+		//获取今日透析准备的数据
227
+		goodList, err := service.MobileGetDialysisGoodsSeven(orgID, date.Unix())
228
+		fmt.Println("goodlist23323232323233232332233223323233", goodList, err)
229
+
230
+		list, err := service.MobileGetDialysisGoodsSix(orgID, date.Unix())
204
 
231
 
232
+		for _, item := range goodList {
233
+			for _, it := range list {
234
+				if item.RecordDate == it.RecordDate && it.PatientId == it.PatientId {
235
+					item.Children = append(item.Children, it)
236
+				}
237
+			}
238
+		}
205
 		this.ServeSuccessJSON(map[string]interface{}{
239
 		this.ServeSuccessJSON(map[string]interface{}{
206
 			"scheduals": dat,
240
 			"scheduals": dat,
207
 			"redis":     "true",
241
 			"redis":     "true",
208
 			"date":      schedualDate,
242
 			"date":      schedualDate,
243
+			"project":   project,
244
+			"goodList":  goodList,
209
 		})
245
 		})
210
 
246
 
211
 	}
247
 	}
531
 		// 先走redis,没有走数据库
567
 		// 先走redis,没有走数据库
532
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
568
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
533
 	}
569
 	}
534
-
535
 	returnData := map[string]interface{}{
570
 	returnData := map[string]interface{}{
536
 		"patient":                        patient,
571
 		"patient":                        patient,
537
 		"schedual":                       schedual,
572
 		"schedual":                       schedual,

+ 1 - 3
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Просмотреть файл

2810
 	loc, _ := time.LoadLocation("Local")
2810
 	loc, _ := time.LoadLocation("Local")
2811
 
2811
 
2812
 	startTime := this.GetString("start_time")
2812
 	startTime := this.GetString("start_time")
2813
-	fmt.Println("开始烧豆腐阿方阿方阿方", startTime)
2814
 
2813
 
2815
 	endTime := this.GetString("end_time")
2814
 	endTime := this.GetString("end_time")
2816
 	startTimeUnix, _ := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
2815
 	startTimeUnix, _ := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
2822
 
2821
 
2823
 	patient_id, _ := this.GetInt64("patient_id")
2822
 	patient_id, _ := this.GetInt64("patient_id")
2824
 
2823
 
2825
-	fmt.Println("hhhhhhhhhhhhhhhkaishi", startTimeUnix.Unix())
2826
 	list, total, err := service.GetTreateSummary(startTimeUnix.Unix(), endTimeUnix.Unix(), limit, page, creater, patient_id)
2824
 	list, total, err := service.GetTreateSummary(startTimeUnix.Unix(), endTimeUnix.Unix(), limit, page, creater, patient_id)
2827
 
2825
 
2828
 	//var inspectionTemplate []*models.VmInspection
2826
 	//var inspectionTemplate []*models.VmInspection
2834
 			item.Children = append(item.Children, it)
2832
 			item.Children = append(item.Children, it)
2835
 		}
2833
 		}
2836
 	}
2834
 	}
2837
-	fmt.Println("hhhhhhhhhhhhh99999999999999", list)
2835
+
2838
 	if err == nil {
2836
 	if err == nil {
2839
 		this.ServeSuccessJSON(map[string]interface{}{
2837
 		this.ServeSuccessJSON(map[string]interface{}{
2840
 			"list":  list,
2838
 			"list":  list,

+ 16 - 0
service/dialysis_service.go Просмотреть файл

1644
 	err = readDb.Model(&models.HisPrescriptionProject{}).Joins("JOIN xt_his_project as p On p.id = his_prescription_project.project_id AND p.cost_classify = 3").Where("his_prescription_project.team_id IN (?) AND his_prescription_project.patient_id = ? AND his_prescription_project.user_org_id = ? AND his_prescription_project.record_date = ? AND his_prescription_project.status = 1", team_id, patient_id, user_org_id, record_date).Find(&ps).Error
1644
 	err = readDb.Model(&models.HisPrescriptionProject{}).Joins("JOIN xt_his_project as p On p.id = his_prescription_project.project_id AND p.cost_classify = 3").Where("his_prescription_project.team_id IN (?) AND his_prescription_project.patient_id = ? AND his_prescription_project.user_org_id = ? AND his_prescription_project.record_date = ? AND his_prescription_project.status = 1", team_id, patient_id, user_org_id, record_date).Find(&ps).Error
1645
 	return
1645
 	return
1646
 }
1646
 }
1647
+
1648
+func GetAdminUserRoleInformation(orgid int64) (models.SgjOrgFollow, error) {
1649
+
1650
+	follow := models.SgjOrgFollow{}
1651
+
1652
+	db := UserReadDB().Table("sgj_org_follow as f").Where("f.status = 1")
1653
+	table := UserReadDB().Table("sgj_admin as a").Where("a.status = 1")
1654
+	fmt.Println(table)
1655
+
1656
+	if orgid > 0 {
1657
+		db = db.Where("org_id = ?", orgid)
1658
+	}
1659
+
1660
+	err := db.Select("f.org_id,f.admin_user_id,a.name,a.phone,a.camera,a.wechat,a.qqchat,a.email").Joins("left join sgj_admin as a on a.id = f.admin_user_id").Scan(&follow).Error
1661
+	return follow, err
1662
+}