Procházet zdrojové kódy

11月8日库存管理

XMLWAN před 3 roky
rodič
revize
b9c8ca5e0c

+ 5 - 1
controllers/dialysis_record_api_controller.go Zobrazit soubor

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

+ 37 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Zobrazit soubor

@@ -89,7 +89,7 @@ func (this *DialysisAPIController) Scheduals() {
89 89
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
90 90
 
91 91
 	scheduals_json_str, _ := redis.Get(key).Result()
92
-
92
+	redis.Set(key, "", time.Second)
93 93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
94 94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
95 95
 
@@ -188,8 +188,27 @@ func (this *DialysisAPIController) Scheduals() {
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 208
 			this.ServeSuccessJSON(map[string]interface{}{
192 209
 				"scheduals": scheduals,
210
+				"project":   project,
211
+				"goodList":  goodList,
193 212
 			})
194 213
 		}
195 214
 
@@ -201,11 +220,28 @@ func (this *DialysisAPIController) Scheduals() {
201 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 239
 		this.ServeSuccessJSON(map[string]interface{}{
206 240
 			"scheduals": dat,
207 241
 			"redis":     "true",
208 242
 			"date":      schedualDate,
243
+			"project":   project,
244
+			"goodList":  goodList,
209 245
 		})
210 246
 
211 247
 	}
@@ -531,7 +567,6 @@ func (this *DialysisAPIController) DialysisRecord() {
531 567
 		// 先走redis,没有走数据库
532 568
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
533 569
 	}
534
-
535 570
 	returnData := map[string]interface{}{
536 571
 		"patient":                        patient,
537 572
 		"schedual":                       schedual,

+ 1 - 3
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Zobrazit soubor

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

+ 16 - 0
service/dialysis_service.go Zobrazit soubor

@@ -1644,3 +1644,19 @@ func GetCheckTeamProject(team_id int64, patient_id int64, record_date int64, use
1644 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 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
+}