Browse Source

2024/6/17

28169 1 month ago
parent
commit
56e31c9523

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

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

+ 2 - 0
controllers/gobal_config_api_controller.go View File

@@ -2368,7 +2368,9 @@ func (c *GobalConfigApiController) GetSingleOrderDetail() {
2368 2368
 	manufacturerList, err := service.GetAllManufacturerList(orgId)
2369 2369
 	drugFlowList, _ := service.GetDrugStockFlowDetail(start_time, orgId)
2370 2370
 	flowlist, _ := service.GetSingeOrderFlow(id, orgId)
2371
+
2371 2372
 	drugList, _ := service.GetDrugFlowList(id, orgId)
2373
+
2372 2374
 	drugListOne, _ := service.GetDrugFlowListGroupByIdOne(id, orgId)
2373 2375
 	drugListFlow, err := service.GetDrugFlowListGroupById(id, orgId)
2374 2376
 

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

@@ -309,6 +309,7 @@ func (c *PatientApiController) EditDoctorAdvice() {
309 309
 	//2.一组医嘱内有多条医嘱(不包括子医嘱)的情况下,需要为修改的那条医嘱重新分配组号,并修改医嘱开始时间
310 310
 	var err error
311 311
 	var isChangeGroup bool
312
+
312 313
 	if advice.ParentId == 0 {
313 314
 		adviceSlice, _ := service.FindAdviceByGoroupNo(adminUserInfo.Org.Id, advice.GroupNo)
314 315
 		sourceAdvice, _ := service.FindOldDoctorAdvice(adminUserInfo.Org.Id, advice.ID)
@@ -360,6 +361,8 @@ func (c *PatientApiController) EditDoctorAdvice() {
360 361
 					keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":advice_list_all"
361 362
 					redis.Set(keyOne, "", time.Second)
362 363
 				}
364
+			} else {
365
+				err = service.UpdateDoctorAdvice(&advice)
363 366
 			}
364 367
 
365 368
 		} else if len(adviceSlice) > 1 {
@@ -414,6 +417,8 @@ func (c *PatientApiController) EditDoctorAdvice() {
414 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,7 +197,7 @@ func (this *NewStockApiController) GetHisDrugCodeQuery() {
197 197
 	}
198 198
 
199 199
 	list, total, _ := service.GetHisDrugCodeQuery(orgId, startTime, endTime, limit, page, is_sale)
200
-
200
+	fmt.Println("totla------------------------", total)
201 201
 	drug, _ := service.GetAllDrugList(orgId)
202 202
 
203 203
 	codeConfig, _ := service.GetDrugCodeConfig(orgId)

+ 48 - 3
service/stock_service.go View File

@@ -11021,6 +11021,7 @@ func SaveDrugOpen(open models.XtDrugCodeOpen) error {
11021 11021
 
11022 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 11025
 	db := XTReadDB().Model(&models.HisDoctorAdviceInfo{}).Where("status=1")
11025 11026
 
11026 11027
 	if orgId > 0 {
@@ -11034,19 +11035,63 @@ func GetHisDrugCodeQuery(orgId int64, start_time int64, end_time int64, limit in
11034 11035
 		db = db.Where("advice_date<=?", end_time)
11035 11036
 	}
11036 11037
 
11037
-	offset := (page - 1) * limit
11038
-
11039 11038
 	if is_sale == 1 {
11040 11039
 		db = db.Where("is_upload = 1")
11041 11040
 	}
11042 11041
 	if is_sale == 2 {
11043 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 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 11095
 func GetDrugWarehouseOutInfoByDrugCode(drug_id int64, patient_id int64, advice_date int64, user_org_id int64) (outinfo []*models.XtDrugWarehouseOutInfo, err error) {
11051 11096
 
11052 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