Browse Source

11月9日库存管理

XMLWAN 2 years ago
parent
commit
cb853295c2

+ 65 - 1
controllers/dialysis_api_controller.go View File

@@ -85,6 +85,10 @@ func DialysisApiRegistRouters() {
85 85
 	beego.Router("/api/patient/getdialysisparameter", &DialysisApiController{}, "Get:GetDialysisParameterList")
86 86
 
87 87
 	beego.Router("/api/patient/getdialysisgoodtotalcount", &DialysisApiController{}, "Get:GetDialysisGoodTotalCount")
88
+
89
+	beego.Router("/api/patient/getdialysisadvicescheduelist", &DialysisApiController{}, "Get:GetDialysisAdviceSchedulist")
90
+
91
+	beego.Router("/api/patient/getdialysisparametergoodlist", &DialysisApiController{}, "Get:GetDialysisParameterGoodList")
88 92
 }
89 93
 
90 94
 func (c *DialysisApiController) GetQueueCall() {
@@ -4422,7 +4426,7 @@ func (this *DialysisApiController) GetDialysisGoodTotalCount() {
4422 4426
 
4423 4427
 	partion_type, _ := this.GetInt64("partion_type")
4424 4428
 
4425
-	start_time := this.GetString("schedule_date")
4429
+	start_time := this.GetString("selected_date")
4426 4430
 	timeLayout := "2006-01-02"
4427 4431
 	loc, _ := time.LoadLocation("Local")
4428 4432
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
@@ -4439,3 +4443,63 @@ func (this *DialysisApiController) GetDialysisGoodTotalCount() {
4439 4443
 		return
4440 4444
 	}
4441 4445
 }
4446
+
4447
+func (this *DialysisApiController) GetDialysisAdviceSchedulist() {
4448
+
4449
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4450
+
4451
+	schedule_type, _ := this.GetInt64("schedule_type")
4452
+
4453
+	partion_type, _ := this.GetInt64("partion_type")
4454
+
4455
+	start_time := this.GetString("selected_date")
4456
+	timeLayout := "2006-01-02"
4457
+	loc, _ := time.LoadLocation("Local")
4458
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
4459
+
4460
+	list, err := service.GetDialysisAdviceSchedulist(orgId, schedule_type, partion_type, startTime.Unix())
4461
+	drug, _ := service.GetAllDrugMap(orgId)
4462
+	//获取长期医嘱
4463
+	adviceList, _ := service.GetAllLongAdviceList(orgId)
4464
+	//获取医嘱模版
4465
+	templateList, _ := service.GetAllHisAdviceTemplateList(orgId)
4466
+	if err == nil {
4467
+		this.ServeSuccessJSON(map[string]interface{}{
4468
+			"list":         list,
4469
+			"drug":         drug,
4470
+			"adviceList":   adviceList,
4471
+			"templateList": templateList,
4472
+		})
4473
+		return
4474
+
4475
+	} else {
4476
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
4477
+		return
4478
+	}
4479
+}
4480
+
4481
+func (this *DialysisApiController) GetDialysisParameterGoodList() {
4482
+
4483
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4484
+
4485
+	schedule_type, _ := this.GetInt64("schedule_type")
4486
+
4487
+	partion_type, _ := this.GetInt64("partion_type")
4488
+
4489
+	start_time := this.GetString("selected_date")
4490
+	timeLayout := "2006-01-02"
4491
+	loc, _ := time.LoadLocation("Local")
4492
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
4493
+
4494
+	list, err := service.GetDialysisParameterGoodList(orgId, schedule_type, partion_type, startTime.Unix())
4495
+	if err == nil {
4496
+		this.ServeSuccessJSON(map[string]interface{}{
4497
+			"list": list,
4498
+		})
4499
+		return
4500
+
4501
+	} else {
4502
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
4503
+		return
4504
+	}
4505
+}

+ 7 - 7
controllers/his_api_controller.go View File

@@ -2009,7 +2009,7 @@ func (c *HisApiController) CreateHisPrescription() {
2009 2009
 							p.HisPatientId = his_patient_id
2010 2010
 							p.Status = 1
2011 2011
 							p.StartTime = pTime
2012
-
2012
+							p.IsOut = 2
2013 2013
 							errcode := c.setProjectWithJSON(&p, project.(map[string]interface{}))
2014 2014
 							if errcode > 0 {
2015 2015
 								c.ServeFailJSONWithSGJErrorCode(errcode)
@@ -2524,7 +2524,7 @@ func (c *HisApiController) DeletePrescription() {
2524 2524
 		for _, item := range projects {
2525 2525
 			service.DeletePrintInfo(item.ID) //删除打印信息
2526 2526
 			if stockConfig.IsOpen == 1 {
2527
-				if item.Type == 3 {
2527
+				if item.Type == 3 && item.IsOut == 1 {
2528 2528
 					good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
2529 2529
 					f_count, _ := strconv.ParseFloat(item.Count, 64)
2530 2530
 					good.Total = good.Total + f_count
@@ -2659,9 +2659,6 @@ func (c *HisApiController) DeletePrescription() {
2659 2659
 							service.DeleteAutoRedeceDetailTen(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
2660 2660
 						}
2661 2661
 
2662
-						////删除出库表
2663
-						//service.DeleteAutoRedeceDetailTen(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
2664
-
2665 2662
 						//退库数量增加
2666 2663
 						service.UpdateSumAddCancelCount(c.GetAdminUserInfo().CurrentOrgId, item.ProjectId, houseConfig.StorehouseOutInfo, total_count)
2667 2664
 						//出库数量减少
@@ -2932,7 +2929,7 @@ func (c *HisApiController) DeleteProject() {
2932 2929
 			fmt.Println(err)
2933 2930
 		}
2934 2931
 
2935
-		if project.Type == 3 {
2932
+		if project.Type == 3 && project.IsOut == 1 {
2936 2933
 			houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
2937 2934
 			good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
2938 2935
 			f_count, _ := strconv.ParseFloat(project.Count, 64)
@@ -3016,7 +3013,7 @@ func (c *HisApiController) DeleteProject() {
3016 3013
 					Count:                   prescribingNumber,
3017 3014
 					UserOrgId:               adminInfo.CurrentOrgId,
3018 3015
 					PatientId:               project.PatientId,
3019
-					SystemTime:              time.Now().Unix(),
3016
+					SystemTime:              info.SysRecordTime,
3020 3017
 					ConsumableType:          7,
3021 3018
 					IsSys:                   0,
3022 3019
 					WarehousingOrder:        "",
@@ -3175,6 +3172,9 @@ func (c *HisApiController) DeleteProject() {
3175 3172
 			}
3176 3173
 			err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
3177 3174
 			fmt.Println(err)
3175
+		} else {
3176
+			err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
3177
+			fmt.Println(err)
3178 3178
 		}
3179 3179
 
3180 3180
 	}

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

@@ -777,6 +777,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
777 777
 												sum_count += its.StockMaxNumber + its.StockMinNumber
778 778
 											}
779 779
 											service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
780
+											//剩余库存
781
+											service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
780 782
 										}
781 783
 									}
782 784
 								} else {
@@ -798,6 +800,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
798 800
 											sum_count += its.StockMaxNumber + its.StockMinNumber
799 801
 										}
800 802
 										service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
803
+										//剩余库存
804
+										service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
801 805
 									}
802 806
 								}
803 807
 							}
@@ -899,6 +903,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
899 903
 										sum_count += its.StockMaxNumber + its.StockMinNumber
900 904
 									}
901 905
 									service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
906
+									//剩余库存
907
+									service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
902 908
 									c.ServeSuccessJSON(map[string]interface{}{
903 909
 										"msg":    "1",
904 910
 										"advice": advice,
@@ -1214,6 +1220,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1214 1220
 										sum_count += its.StockMaxNumber + its.StockMinNumber
1215 1221
 									}
1216 1222
 									service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1223
+									//剩余库存
1224
+									service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1217 1225
 								}
1218 1226
 
1219 1227
 							}

+ 1 - 0
models/his_models.go View File

@@ -859,6 +859,7 @@ type HisPrescriptionProject struct {
859 859
 	IsCheckTeam          int64        `gorm:"-" json:"is_check_team" form:"is_check_team"`
860 860
 	HisOrderInfo         HisOrderInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"order_info"`
861 861
 	ExecutionFrequencyId int64        `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
862
+	IsOut                int64        `gorm:"column:is_out" json:"is_out" form:"is_out"` //新增字段
862 863
 }
863 864
 
864 865
 func (HisPrescriptionProject) TableName() string {

+ 2 - 0
models/schedule_models.go View File

@@ -308,6 +308,8 @@ type VmBloodSchedule struct {
308 308
 	DialysisSolution           DialysisSolution           `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
309 309
 	DialysisPrescription       DialysisPrescription       `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,RecordDate" json:"dialysis_prescription"`
310 310
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,AssessmentDate" json:"assessment_befor_dislysis"`
311
+	XtDoctorAdvice             XtDoctorAdvice             `gorm:"ForeignKey:PatientId,AdviceDate;AssociationForeignKey:PatientId,AdviceDate" json:"xt_doctor_advice"`
312
+	HisDoctorAdvice            HisDoctorAdvice            `gorm:"ForeignKey:PatientId,AdviceDate;AssociationForeignKey:PatientId,AdviceDate" json:"his_doctor_advice"`
311 313
 }
312 314
 
313 315
 func (VmBloodSchedule) TableName() string {

+ 58 - 0
service/dialysis_solution_service.go View File

@@ -188,3 +188,61 @@ func GetDialysisGoodTotalCount(orgID int64, schedule_type int64, partition_id in
188 188
 	return schedule, err
189 189
 
190 190
 }
191
+
192
+func GetDialysisAdviceSchedulist(orgID int64, schedule_type int64, partition_id int64, scheduleDate int64) (schedule []*models.VmBloodSchedule, err error) {
193
+
194
+	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("status = 1")
195
+
196
+	if scheduleDate > 0 {
197
+		db = db.Where("schedule_date = ?", scheduleDate)
198
+	}
199
+	if schedule_type > 0 {
200
+		db = db.Where("schedule_type = ?", schedule_type)
201
+	}
202
+	if partition_id > 0 {
203
+		db = db.Where("partition_id = ?", partition_id)
204
+	}
205
+	if orgID > 0 {
206
+		db = db.Where("user_org_id  = ?", orgID)
207
+	}
208
+	err = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
209
+		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
210
+		Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ?", orgID, scheduleDate).
211
+		Preload("HisDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ?", orgID, scheduleDate).
212
+		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
213
+
214
+	return schedule, err
215
+
216
+}
217
+
218
+func GetAllDrugMap(org_id int64) (list []*BaseDrugLib, err error) {
219
+
220
+	err = readDb.Model(&BaseDrugLib{}).Where("org_id = ?  AND status = 1", org_id).Find(&list).Error
221
+	return list, err
222
+}
223
+
224
+func GetDialysisParameterGoodList(orgID int64, schedule_type int64, partition_id int64, scheduleDate int64) (schedule []*models.VmBloodSchedule, err error) {
225
+
226
+	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("status = 1")
227
+
228
+	if scheduleDate > 0 {
229
+		db = db.Where("schedule_date = ?", scheduleDate)
230
+	}
231
+	if schedule_type > 0 {
232
+		db = db.Where("schedule_type = ?", schedule_type)
233
+	}
234
+	if partition_id > 0 {
235
+		db = db.Where("partition_id = ?", partition_id)
236
+	}
237
+	if orgID > 0 {
238
+		db = db.Where("user_org_id  = ?", orgID)
239
+	}
240
+	err = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
241
+		Preload("DialysisPrescription", "status = 1 and user_org_id = ?", orgID).
242
+		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
243
+		Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ?", orgID, scheduleDate).
244
+		Preload("HisDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ?", orgID, scheduleDate).
245
+		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
246
+
247
+	return schedule, err
248
+}

+ 62 - 13
service/new_warehouse_service.go View File

@@ -14,7 +14,7 @@ import (
14 14
 //耗材出库
15 15
 func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, goods *models.DialysisBeforePrepare, warehouseOut *models.WarehouseOut, count int64) (err error) {
16 16
 
17
-	fmt.Println("出库数量2333333333333333333333333333333333hhha", goods.Count)
17
+	//fmt.Println("出库数量2333333333333333333333333333333333hhha", goods.Count)
18 18
 	//开事务
19 19
 	var deliver_number int64 = 0
20 20
 	var stock_number int64 = 0
@@ -47,6 +47,8 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
47 47
 		if errThree != nil {
48 48
 			return errThree
49 49
 		}
50
+		//更新his_prescripton_project出库状态值
51
+		UpdateHisPrescriptionProjectStatus(goods.GoodId, record_time, orgID, patient_id)
50 52
 
51 53
 		//查询剩余库存
52 54
 		goodList, _ := GetAllGoodSumCount(goods.GoodId, orgID)
@@ -83,9 +85,12 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
83 85
 			OverCount:               sum_count,
84 86
 		}
85 87
 		warehouseOutInfo.Count = count
86
-
88
+		if orgID == 9671 || orgID == 10265 {
89
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
90
+			warehouseOutInfo.Price = goodsInfo.PackingPrice
91
+		}
87 92
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
88
-		fmt.Println("errcodes2333232233232wode3223", errcodes, goods.ProjectId)
93
+		//fmt.Println("errcodes2333232233232wode3223", errcodes, goods.ProjectId)
89 94
 		if errcodes == gorm.ErrRecordNotFound {
90 95
 			errOne := AddSigleWarehouseOutInfo(warehouseOutInfo)
91 96
 			if errOne != nil {
@@ -94,8 +99,8 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
94 99
 		} else if errcodes == nil {
95 100
 
96 101
 			outInfoOne, _ := GetWarehouseOutInfoIsExistTwo(goods.GoodId, patient_id, record_time, goods.ProjectId)
97
-			fmt.Println("goods.cout23323233223232323w", count)
98
-			fmt.Println("outInfoOnewowowwowowowowowo", outInfoOne.Count)
102
+			//fmt.Println("goods.cout23323233223232323w", count)
103
+			//fmt.Println("outInfoOnewowowwowowowowowo", outInfoOne.Count)
99 104
 			if count != outInfoOne.Count {
100 105
 				UpdatedWarehouseOutInfo(warehouseOutInfo, goods.GoodId, patient_id, record_time, goods.ProjectId)
101 106
 			}
@@ -116,12 +121,13 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
116 121
 		for _, item := range flowGoodTwo {
117 122
 			out_count_one += item.Count
118 123
 		}
119
-		fmt.Println("deliver_number", deliver_number)
120
-		fmt.Println("out_count", out_count)
121
-		fmt.Println("count", count)
122
-		fmt.Println("cancel_out_count2333233", out_count_one)
124
+		//fmt.Println("deliver_number", deliver_number)
125
+		//fmt.Println("out_count", out_count)
126
+		//fmt.Println("count", count)
127
+		//fmt.Println("cancel_out_count2333233", out_count_one)
123 128
 		//如果本次出库数据大于历史出库数据 新增1条流水
124 129
 		if count > (out_count - out_count_one) {
130
+
125 131
 			flow := models.VmStockFlow{
126 132
 				WarehouseOutId:          warehouseOut.ID,
127 133
 				WarehousingId:           warehouse.ID,
@@ -151,6 +157,11 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
151 157
 				OverCount:               sum_count,
152 158
 				BuyPrice:                warehouse.Price,
153 159
 			}
160
+			if orgID == 9671 || orgID == 10265 {
161
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
162
+				flow.Price = goodsInfo.PackingPrice
163
+				flow.BuyPrice = goodsInfo.BuyPrice
164
+			}
154 165
 			errThre := CreateStockFlowOne(flow)
155 166
 			if errThre != nil {
156 167
 				return errThre
@@ -217,7 +228,10 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
217 228
 				StorehouseId:    goods.StorehouseId,
218 229
 				IsCheck:         1,
219 230
 			}
220
-
231
+			if orgID == 9671 || orgID == 10265 {
232
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
233
+				cancelStockInfo.Price = goodsInfo.PackingPrice
234
+			}
221 235
 			CreateCancelStockInfoOne(&cancelStockInfo)
222 236
 
223 237
 			cancelInfo, _ := GetLastCancelStockInfoByGoodId(goods.GoodId)
@@ -256,6 +270,11 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
256 270
 				BuyPrice:                warehouse.Price,
257 271
 				ProjectId:               goods.ProjectId,
258 272
 			}
273
+			if orgID == 9671 || orgID == 10265 {
274
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
275
+				flow.Price = goodsInfo.PackingPrice
276
+				flow.BuyPrice = goodsInfo.BuyPrice
277
+			}
259 278
 			CreateStockFlowOne(flow)
260 279
 		}
261 280
 
@@ -330,9 +349,12 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
330 349
 			OverCount:               sum_count,
331 350
 		}
332 351
 		warehouseOutInfo.Count = stock_number
333
-
352
+		if orgID == 9671 || orgID == 10265 {
353
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
354
+			warehouseOutInfo.Price = goodsInfo.PackingPrice
355
+		}
334 356
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
335
-		fmt.Println("errcodes23332322332323223", errcodes, goods.ProjectId)
357
+		//fmt.Println("errcodes23332322332323223", errcodes, goods.ProjectId)
336 358
 		if errcodes == gorm.ErrRecordNotFound {
337 359
 			errOne := AddSigleWarehouseOutInfo(warehouseOutInfo)
338 360
 			if errOne != nil {
@@ -391,6 +413,11 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
391 413
 				OverCount:               sum_count,
392 414
 				BuyPrice:                warehouse.Price,
393 415
 			}
416
+			if orgID == 9671 || orgID == 10265 {
417
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
418
+				flow.Price = goodsInfo.PackingPrice
419
+				flow.BuyPrice = goodsInfo.BuyPrice
420
+			}
394 421
 			errThre := CreateStockFlowOne(flow)
395 422
 			if errThre != nil {
396 423
 				return errThre
@@ -453,7 +480,10 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
453 480
 				StorehouseId:    goods.StorehouseId,
454 481
 				IsCheck:         1,
455 482
 			}
456
-
483
+			if orgID == 9671 || orgID == 10265 {
484
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
485
+				cancelStockInfo.Price = goodsInfo.PackingPrice
486
+			}
457 487
 			CreateCancelStockInfoOne(&cancelStockInfo)
458 488
 
459 489
 			cancelInfo, _ := GetLastCancelStockInfoByGoodId(goods.GoodId)
@@ -492,6 +522,11 @@ func ConsumablesGoodDelivery(orgID int64, patient_id int64, record_time int64, g
492 522
 				BuyPrice:                warehouse.Price,
493 523
 				ProjectId:               goods.ProjectId,
494 524
 			}
525
+			if orgID == 9671 || orgID == 10265 {
526
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
527
+				flow.Price = goodsInfo.PackingPrice
528
+				flow.BuyPrice = goodsInfo.BuyPrice
529
+			}
495 530
 			CreateStockFlowOne(flow)
496 531
 		}
497 532
 
@@ -2024,3 +2059,17 @@ func UpdateDrugWarehouseOutByPatientId(patient_id int64, advice_date int64, orgi
2024 2059
 	err := XTWriteDB().Model(&models.DrugWarehouseOutInfo{}).Where("patient_id = ? and sys_record_time = ? and org_id = ? and status = 1", patient_id, advice_date, orgid).Update(map[string]interface{}{"count": info.Count, "count_unit": info.CountUnit}).Error
2025 2060
 	return err
2026 2061
 }
2062
+
2063
+func FindeGoodInfo(orgid int64, id int64) (models.GoodInformation, error) {
2064
+
2065
+	information := models.GoodInformation{}
2066
+	err := XTReadDB().Where("org_id = ? and id = ? and status = 1", orgid, id).Find(&information).Error
2067
+	return information, err
2068
+}
2069
+
2070
+func UpdateHisPrescriptionProjectStatus(project_id int64, record_time int64, user_org_id int64, patient_id int64) (models.HisPrescriptionProject, error) {
2071
+
2072
+	project := models.HisPrescriptionProject{}
2073
+	err := XTWriteDB().Model(&project).Where("project_id  = ? and record_date = ? and user_org_id = ? and patient_id = ? and status = 1", project_id, record_time, user_org_id, patient_id).Update(map[string]interface{}{"is_out": 2}).Error
2074
+	return project, err
2075
+}