Browse Source

2024/6/17

28169 4 months ago
parent
commit
56e31c9523

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10742 //机构id
86
+		subscibe.OrgId = 10138 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10742 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10138 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 12123 //4
97
 		adminUserInfo.CurrentAppId = 12123 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10742 //机构id小英9675或4
332
+		subscibe.OrgId = 10138 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10742 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10138 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 12123 //4
343
 		adminUserInfo.CurrentAppId = 12123 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 2 - 0
controllers/gobal_config_api_controller.go View File

2368
 	manufacturerList, err := service.GetAllManufacturerList(orgId)
2368
 	manufacturerList, err := service.GetAllManufacturerList(orgId)
2369
 	drugFlowList, _ := service.GetDrugStockFlowDetail(start_time, orgId)
2369
 	drugFlowList, _ := service.GetDrugStockFlowDetail(start_time, orgId)
2370
 	flowlist, _ := service.GetSingeOrderFlow(id, orgId)
2370
 	flowlist, _ := service.GetSingeOrderFlow(id, orgId)
2371
+
2371
 	drugList, _ := service.GetDrugFlowList(id, orgId)
2372
 	drugList, _ := service.GetDrugFlowList(id, orgId)
2373
+
2372
 	drugListOne, _ := service.GetDrugFlowListGroupByIdOne(id, orgId)
2374
 	drugListOne, _ := service.GetDrugFlowListGroupByIdOne(id, orgId)
2373
 	drugListFlow, err := service.GetDrugFlowListGroupById(id, orgId)
2375
 	drugListFlow, err := service.GetDrugFlowListGroupById(id, orgId)
2374
 
2376
 

+ 5 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

309
 	//2.一组医嘱内有多条医嘱(不包括子医嘱)的情况下,需要为修改的那条医嘱重新分配组号,并修改医嘱开始时间
309
 	//2.一组医嘱内有多条医嘱(不包括子医嘱)的情况下,需要为修改的那条医嘱重新分配组号,并修改医嘱开始时间
310
 	var err error
310
 	var err error
311
 	var isChangeGroup bool
311
 	var isChangeGroup bool
312
+
312
 	if advice.ParentId == 0 {
313
 	if advice.ParentId == 0 {
313
 		adviceSlice, _ := service.FindAdviceByGoroupNo(adminUserInfo.Org.Id, advice.GroupNo)
314
 		adviceSlice, _ := service.FindAdviceByGoroupNo(adminUserInfo.Org.Id, advice.GroupNo)
314
 		sourceAdvice, _ := service.FindOldDoctorAdvice(adminUserInfo.Org.Id, advice.ID)
315
 		sourceAdvice, _ := service.FindOldDoctorAdvice(adminUserInfo.Org.Id, advice.ID)
360
 					keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":advice_list_all"
361
 					keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":advice_list_all"
361
 					redis.Set(keyOne, "", time.Second)
362
 					redis.Set(keyOne, "", time.Second)
362
 				}
363
 				}
364
+			} else {
365
+				err = service.UpdateDoctorAdvice(&advice)
363
 			}
366
 			}
364
 
367
 
365
 		} else if len(adviceSlice) > 1 {
368
 		} else if len(adviceSlice) > 1 {
414
 					isChangeGroup = true
417
 					isChangeGroup = true
415
 
418
 
416
 				}
419
 				}
420
+			} else {
421
+				err = service.UpdateDoctorAdvice(&advice)
417
 			}
422
 			}
418
 
423
 
419
 		}
424
 		}

+ 1 - 1
controllers/new_stock_api_controller.go View File

197
 	}
197
 	}
198
 
198
 
199
 	list, total, _ := service.GetHisDrugCodeQuery(orgId, startTime, endTime, limit, page, is_sale)
199
 	list, total, _ := service.GetHisDrugCodeQuery(orgId, startTime, endTime, limit, page, is_sale)
200
-
200
+	fmt.Println("totla------------------------", total)
201
 	drug, _ := service.GetAllDrugList(orgId)
201
 	drug, _ := service.GetAllDrugList(orgId)
202
 
202
 
203
 	codeConfig, _ := service.GetDrugCodeConfig(orgId)
203
 	codeConfig, _ := service.GetDrugCodeConfig(orgId)

+ 48 - 3
service/stock_service.go View File

11021
 
11021
 
11022
 func GetHisDrugCodeQuery(orgId int64, start_time int64, end_time int64, limit int64, page int64, is_sale int64) (list []*models.HisDoctorAdviceInfo, total int64, err error) {
11022
 func GetHisDrugCodeQuery(orgId int64, start_time int64, end_time int64, limit int64, page int64, is_sale int64) (list []*models.HisDoctorAdviceInfo, total int64, err error) {
11023
 
11023
 
11024
+	offset := (page - 1) * limit
11024
 	db := XTReadDB().Model(&models.HisDoctorAdviceInfo{}).Where("status=1")
11025
 	db := XTReadDB().Model(&models.HisDoctorAdviceInfo{}).Where("status=1")
11025
 
11026
 
11026
 	if orgId > 0 {
11027
 	if orgId > 0 {
11034
 		db = db.Where("advice_date<=?", end_time)
11035
 		db = db.Where("advice_date<=?", end_time)
11035
 	}
11036
 	}
11036
 
11037
 
11037
-	offset := (page - 1) * limit
11038
-
11039
 	if is_sale == 1 {
11038
 	if is_sale == 1 {
11040
 		db = db.Where("is_upload = 1")
11039
 		db = db.Where("is_upload = 1")
11041
 	}
11040
 	}
11042
 	if is_sale == 2 {
11041
 	if is_sale == 2 {
11043
 		db = db.Where("is_upload = 2 or is_upload =0")
11042
 		db = db.Where("is_upload = 2 or is_upload =0")
11044
 	}
11043
 	}
11045
-	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&list).Error
11044
+
11045
+	err = db.Count(&total).Error
11046
+
11047
+	err = db.Offset(offset).Limit(limit).Order("record_date desc").Find(&list).Error
11046
 
11048
 
11047
 	return list, total, err
11049
 	return list, total, err
11048
 }
11050
 }
11049
 
11051
 
11052
+func GetDoctorAdviceInfoList(page int64, limit int64, orgId int64, start_time int64, end_time int64, is_sale int64) ([]models.HisDoctorAdviceInfo, int64, error) {
11053
+	var list []models.HisDoctorAdviceInfo
11054
+	var total int64
11055
+
11056
+	// 计算偏移量
11057
+	offset := (page - 1) * limit
11058
+
11059
+	// 初始化数据库查询
11060
+	db := XTReadDB().Model(&models.HisDoctorAdviceInfo{})
11061
+
11062
+	// 构建 WHERE 子句
11063
+	query := db.Where("status=1")
11064
+	if orgId > 0 {
11065
+		query = query.Where("user_org_id=?", orgId)
11066
+	}
11067
+	if start_time > 0 {
11068
+		query = query.Where("advice_date >= ?", start_time)
11069
+	}
11070
+	if end_time > 0 {
11071
+		query = query.Where("advice_date <= ?", end_time)
11072
+	}
11073
+	if is_sale == 1 {
11074
+		query = query.Where("is_upload = 1")
11075
+	}
11076
+	if is_sale == 2 {
11077
+		query = query.Where("is_upload IN (?, ?)", 2, 0) // 使用 IN 替代 OR,通常性能更好
11078
+	}
11079
+
11080
+	// 获取总记录数
11081
+	err := query.Count(&total).Error
11082
+	if err != nil {
11083
+		return nil, 0, err
11084
+	}
11085
+
11086
+	// 获取分页后的数据
11087
+	err = query.Offset(offset).Limit(limit).Order("record_date desc").Find(&list).Error
11088
+	if err != nil {
11089
+		return nil, 0, err
11090
+	}
11091
+
11092
+	return list, total, nil
11093
+}
11094
+
11050
 func GetDrugWarehouseOutInfoByDrugCode(drug_id int64, patient_id int64, advice_date int64, user_org_id int64) (outinfo []*models.XtDrugWarehouseOutInfo, err error) {
11095
 func GetDrugWarehouseOutInfoByDrugCode(drug_id int64, patient_id int64, advice_date int64, user_org_id int64) (outinfo []*models.XtDrugWarehouseOutInfo, err error) {
11051
 
11096
 
11052
 	err = XTReadDB().Where("drug_id = ? and patient_id = ? and sys_record_time =? and org_id = ? and status =1", drug_id, patient_id, advice_date, user_org_id).Find(&outinfo).Error
11097
 	err = XTReadDB().Where("drug_id = ? and patient_id = ? and sys_record_time =? and org_id = ? and status =1", drug_id, patient_id, advice_date, user_org_id).Find(&outinfo).Error