Sfoglia il codice sorgente

11月9日库存管理

XMLWAN 1 anno fa
parent
commit
bdfceac9ed

+ 1 - 1
conf/app.conf Vedi File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode =dev
4 4
 #dev/prod
5 5
 

+ 2 - 2
controllers/dialysis_api_controller.go Vedi File

@@ -2962,11 +2962,11 @@ func (c *DialysisApiController) GetDialysisOrder() {
2962 2962
 
2963 2963
 	check, _ := service.FindDoubleCheckById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2964 2964
 
2965
-	if adminUserInfo.CurrentOrgId != 10101 && adminUserInfo.CurrentOrgId != 10445 {
2965
+	if adminUserInfo.CurrentOrgId != 10101 && adminUserInfo.CurrentOrgId != 10445 && adminUserInfo.CurrentOrgId != 10345 {
2966 2966
 		dialysis_count, _ := service.GetDialysisOrderCount(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2967 2967
 		patientInfo.TotalDialysis = dialysis_count
2968 2968
 	}
2969
-	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 {
2969
+	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 10345 {
2970 2970
 
2971 2971
 		if xttime <= 1640966400 {
2972 2972
 			dialysis_count, _ := service.GetDialysisOrderCountOne(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)

+ 2 - 2
controllers/dialysis_record_api_controller.go Vedi File

@@ -1015,13 +1015,13 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1015 1015
 	//
1016 1016
 	//service.UpdateDialysisOrder(patientID, recordDate.Unix(), adminUserInfo.CurrentOrgId, dialysisCount.Count)
1017 1017
 
1018
-	if adminUserInfo.CurrentOrgId != 10101 && adminUserInfo.CurrentOrgId != 10445 && adminUserInfo.CurrentOrgId != 3877 {
1018
+	if adminUserInfo.CurrentOrgId != 10101 && adminUserInfo.CurrentOrgId != 10445 && adminUserInfo.CurrentOrgId != 3877 && adminUserInfo.CurrentOrgId != 10345 {
1019 1019
 		//统计该患者总次数
1020 1020
 		dialysisCount, _ := service.GetDialysisTotalCount(adminUserInfo.CurrentOrgId, patientID)
1021 1021
 		service.UpdateDialysisOrder(patientID, recordDate.Unix(), adminUserInfo.CurrentOrgId, dialysisCount.Count)
1022 1022
 	}
1023 1023
 
1024
-	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 3877 {
1024
+	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10345 {
1025 1025
 		//统计该患者总次数
1026 1026
 		dialysisCount, _ := service.GetDialysisTotalCountOne(adminUserInfo.CurrentOrgId, patientID)
1027 1027
 		service.UpdateDialysisOrder(patientID, recordDate.Unix(), adminUserInfo.CurrentOrgId, dialysisCount.Count)

+ 50 - 41
controllers/his_api_controller.go Vedi File

@@ -2356,21 +2356,24 @@ func (c *HisApiController) CreateHisPrescription() {
2356 2356
 					StorehouseId: houseConfig.StorehouseOutInfo,
2357 2357
 					ProjectId:    item.ID,
2358 2358
 				}
2359
+				goodinfo, _ := service.GetGoodInformationByGoodIdThirty(item.ProjectId)
2360
+				if goodinfo.IsUser == 2 || goodinfo.IsUser == 0 {
2361
+					service.ConsumablePrescriptionDelivery(adminInfo.CurrentOrgId, item.PatientId, item.RecordDate, &dialyPrepareOne, &lastOut, creater, parseIntCount)
2359 2362
 
2360
-				service.ConsumablePrescriptionDelivery(adminInfo.CurrentOrgId, item.PatientId, item.RecordDate, &dialyPrepareOne, &lastOut, creater, parseIntCount)
2363
+					//查询剩余库存
2364
+					goodList, _ := service.GetAllGoodSumCount(item.ProjectId, adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo)
2365
+					var sum_count int64
2366
+					for _, item := range goodList {
2367
+						sum_count += item.StockCount
2368
+					}
2361 2369
 
2362
-				//查询剩余库存
2363
-				goodList, _ := service.GetAllGoodSumCount(item.ProjectId, adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo)
2364
-				var sum_count int64
2365
-				for _, item := range goodList {
2366
-					sum_count += item.StockCount
2367
-				}
2370
+					//更新剩余库存
2371
+					service.UpdateGoodFlushCount(houseConfig.StorehouseOutInfo, item.ProjectId, adminInfo.CurrentOrgId, sum_count)
2368 2372
 
2369
-				//更新剩余库存
2370
-				service.UpdateGoodFlushCount(houseConfig.StorehouseOutInfo, item.ProjectId, adminInfo.CurrentOrgId, sum_count)
2373
+					//耗材
2374
+					service.UpdateGoodSumCountSeven(sum_count, item.ProjectId, adminInfo.CurrentOrgId)
2375
+				}
2371 2376
 
2372
-				//耗材
2373
-				service.UpdateGoodSumCountSeven(sum_count, item.ProjectId, adminInfo.CurrentOrgId)
2374 2377
 			}
2375 2378
 		}
2376 2379
 	}
@@ -2673,10 +2676,11 @@ func (c *HisApiController) DeletePrescription() {
2673 2676
 	prescription_id, _ := c.GetInt64("id")
2674 2677
 	projects, _ := service.GetHisPrescriptionProjectsByID(prescription_id)
2675 2678
 	advices, _ := service.GetHisPrescriptionAdviceByID(prescription_id)
2676
-	_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
2679
+	//_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
2677 2680
 
2678 2681
 	_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
2679 2682
 
2683
+	drugOutConfig, _ := service.FindDrugOutConfigById(c.GetAdminUserInfo().CurrentOrgId)
2680 2684
 	//耗材保存处方出库
2681 2685
 	goodOutConfig, _ := service.FindGoodOutConfigById(c.GetAdminUserInfo().CurrentOrgId)
2682 2686
 	//已收费和已发药限制逻辑
@@ -3021,7 +3025,6 @@ func (c *HisApiController) DeletePrescription() {
3021 3025
 			if goodOutConfig.IsOpen == 1 {
3022 3026
 
3023 3027
 				if item.Type == 3 {
3024
-					fmt.Println("出库数量99999999999999999999999999", item.Count)
3025 3028
 					good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
3026 3029
 					f_count, _ := strconv.ParseFloat(item.Count, 64)
3027 3030
 					good.Total = good.Total + f_count
@@ -3275,7 +3278,7 @@ func (c *HisApiController) DeletePrescription() {
3275 3278
 		}
3276 3279
 
3277 3280
 	} else {
3278
-		if drugStockConfig.IsOpen == 1 {
3281
+		if drugOutConfig.IsOpen == 1 {
3279 3282
 			if len(advices) > 0 {
3280 3283
 				for _, item := range advices {
3281 3284
 					creater := c.GetAdminUserInfo().AdminUser.Id
@@ -3296,7 +3299,9 @@ func (c *HisApiController) DeleteDoctorAdvice() {
3296 3299
 	id, _ := c.GetInt64("id")
3297 3300
 	advice, _ := service.GetHisDoctorAdvicesById(id)
3298 3301
 
3299
-	_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
3302
+	//_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
3303
+
3304
+	drugOutConfig, _ := service.FindDrugOutConfigById(c.GetAdminUserInfo().CurrentOrgId)
3300 3305
 
3301 3306
 	//已收费和已发药的限制逻辑
3302 3307
 	isCharge := false
@@ -3378,7 +3383,8 @@ func (c *HisApiController) DeleteDoctorAdvice() {
3378 3383
 				service.DrugAutoAddCancelInfo(&advice, creater)
3379 3384
 			}
3380 3385
 		} else {
3381
-			if drugStockConfig.IsOpen == 1 {
3386
+
3387
+			if drugOutConfig.IsOpen == 1 {
3382 3388
 
3383 3389
 				//查询是否在处方中出库
3384 3390
 				openConfig, _ := service.GetDrugOpenConfigOne(c.GetAdminUserInfo().CurrentOrgId)
@@ -6278,22 +6284,23 @@ func (c *HisApiController) GetUploadInfo() {
6278 6284
 
6279 6285
 				for _, item := range infoList {
6280 6286
 					medical, _ := service.GetBaseDrugMedical(item.DrugId)
6281
-					//药品出库
6282
-					service.HisSettleDrugsDelivery(item.UserOrgId, adminUser.AdminUser.Id, item, order.ID)
6283
-					//查询默认仓库
6284
-					storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
6285
-					//查询默认仓库剩余多少库存
6286
-					var sum_count int64
6287
-					stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
6288
-					for _, its := range stockInfo {
6289
-						if its.MaxUnit == medical.MaxUnit {
6290
-							its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
6287
+					if medical.IsUse == 2 {
6288
+						//药品出库
6289
+						service.HisSettleDrugsDelivery(item.UserOrgId, adminUser.AdminUser.Id, item, order.ID)
6290
+						//查询默认仓库
6291
+						storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
6292
+						//查询默认仓库剩余多少库存
6293
+						var sum_count int64
6294
+						stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
6295
+						for _, its := range stockInfo {
6296
+							if its.MaxUnit == medical.MaxUnit {
6297
+								its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
6298
+							}
6299
+							sum_count += its.StockMaxNumber + its.StockMinNumber
6291 6300
 						}
6292
-						sum_count += its.StockMaxNumber + its.StockMinNumber
6301
+						service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
6302
+						service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
6293 6303
 					}
6294
-					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
6295
-					service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
6296
-
6297 6304
 				}
6298 6305
 				orgId := c.GetAdminUserInfo().CurrentOrgId
6299 6306
 
@@ -6351,20 +6358,22 @@ func (c *HisApiController) GetUploadInfo() {
6351 6358
 							Status:       1,
6352 6359
 							StorehouseId: houseConfig.StorehouseOutInfo,
6353 6360
 						}
6361
+						goodInfo, _ := service.GetGoodInformationByGoodIdThirty(item.GoodId)
6362
+						//非零用
6363
+						if goodInfo.IsUser == 2 || goodInfo.IsUser == 0 {
6364
+							service.ConsumableSettleDelivery(adminUser.CurrentOrgId, his.PatientId, his.RecordDate, &dialyPrepareOne, &lastOut, adminUser.AdminUser.Id, order.ID)
6365
+							//查询剩余库存
6366
+							goodList, _ := service.GetAllGoodSumCount(item.GoodId, adminUser.CurrentOrgId, houseConfig.StorehouseOutInfo)
6367
+							var sum_count int64
6368
+							for _, item := range goodList {
6369
+								sum_count += item.StockCount
6370
+							}
6371
+							service.UpdateGoodFlushCount(houseConfig.StorehouseOutInfo, item.GoodId, adminUser.CurrentOrgId, sum_count)
6354 6372
 
6355
-						//err = service.CreateDialysisBeforePrepareOne(&dialyPrepareOne)
6356
-
6357
-						service.ConsumableSettleDelivery(adminUser.CurrentOrgId, his.PatientId, his.RecordDate, &dialyPrepareOne, &lastOut, adminUser.AdminUser.Id, order.ID)
6358
-						//查询剩余库存
6359
-						goodList, _ := service.GetAllGoodSumCount(item.GoodId, adminUser.CurrentOrgId, houseConfig.StorehouseOutInfo)
6360
-						var sum_count int64
6361
-						for _, item := range goodList {
6362
-							sum_count += item.StockCount
6373
+							//耗材
6374
+							service.UpdateGoodSumCountSeven(sum_count, item.GoodId, adminUser.CurrentOrgId)
6363 6375
 						}
6364
-						service.UpdateGoodFlushCount(houseConfig.StorehouseOutInfo, item.GoodId, adminUser.CurrentOrgId, sum_count)
6365 6376
 
6366
-						//耗材
6367
-						service.UpdateGoodSumCountSeven(sum_count, item.GoodId, adminUser.CurrentOrgId)
6368 6377
 					}
6369 6378
 				}
6370 6379
 

+ 2 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Vedi File

@@ -2346,13 +2346,13 @@ func (this *DialysisAPIController) StartDialysis() {
2346 2346
 		createErr := service.MobileCreateDialysisOrder(adminUserInfo.Org.Id, patientID, dialysisRecord)
2347 2347
 		service.UpdateMobilePatient(adminUserInfo.Org.Id, patientID, schedule_remark)
2348 2348
 
2349
-		if adminUserInfo.Org.Id != 10101 && adminUserInfo.Org.Id != 10445 && adminUserInfo.Org.Id != 3877 {
2349
+		if adminUserInfo.Org.Id != 10101 && adminUserInfo.Org.Id != 10445 && adminUserInfo.Org.Id != 3877 && adminUserInfo.Org.Id != 10345 {
2350 2350
 			//统计该患者总次数
2351 2351
 			dialysisCount, _ := service.GetDialysisTotalCount(adminUserInfo.Org.Id, patientID)
2352 2352
 			service.UpdateDialysisOrder(patientID, recordDate.Unix(), adminUserInfo.Org.Id, dialysisCount.Count)
2353 2353
 		}
2354 2354
 
2355
-		if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 3877 {
2355
+		if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10345 {
2356 2356
 			//统计该患者总次数
2357 2357
 			dialysisCount, _ := service.GetDialysisTotalCountOne(adminUserInfo.Org.Id, patientID)
2358 2358
 			service.UpdateDialysisOrder(patientID, recordDate.Unix(), adminUserInfo.Org.Id, dialysisCount.Count)

+ 7 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Vedi File

@@ -2869,3 +2869,10 @@ func (this *NewDialysisApiController) GetTreateSummary() {
2869 2869
 		return
2870 2870
 	}
2871 2871
 }
2872
+
2873
+func (this *NewDialysisApiController) CommitDialysisOrder() {
2874
+
2875
+	org_id := this.GetMobileAdminUserInfo().Org.Id
2876
+	fmt.Println("org_id ===23232323232332", org_id)
2877
+
2878
+}

+ 2 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Vedi File

@@ -166,6 +166,8 @@ func NewMobileAPIControllersRegisterRouters() {
166 166
 	beego.Router("/m/api/patient/getvascularaccessdetail", &NewDialysisApiController{}, "Get:GetVascularAccessDetail")
167 167
 	beego.Router("/m/api/patient/getalldoctorlist", &NewDialysisApiController{}, "Get:GetAllDoctorList")
168 168
 	beego.Router("/m/api/patient/gettreatesummay", &NewDialysisApiController{}, "Get:GetTreateSummary")
169
+	//脚本
170
+	beego.Router("/m/api/patient/commitdialysisOrder", &NewDialysisApiController{}, "Get:CommitDialysisOrder")
169 171
 
170 172
 	//His相关
171 173
 	beego.Router("/m/api/hispatientlist/get", &MobileHisApiController{}, "Get:GetHisPatientList")

+ 23 - 9
controllers/print_data_api_controller.go Vedi File

@@ -37,7 +37,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
37 37
 	idStrs := strings.Split(schIDStr, ",")
38 38
 	adminUserInfo := this.GetAdminUserInfo()
39 39
 
40
-	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
40
+	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 {
41 41
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42 42
 		for _, item := range schedules {
43 43
 
@@ -81,10 +81,10 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
81 81
 			item.Summer = summerVM
82 82
 
83 83
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
84
-			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 {
84
+			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
85 85
 				item.Count = list.Count
86 86
 			}
87
-			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
87
+			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
88 88
 				if item.ScheduleDate <= 1640966400 {
89 89
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
90 90
 
@@ -127,18 +127,32 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
127 127
 		})
128 128
 	}
129 129
 
130
-	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9671 {
130
+	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 {
131 131
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
132 132
 		for _, item := range schedules {
133 133
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
134
-			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 {
134
+			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
135 135
 				item.Count = list.Count
136 136
 			}
137
-			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
138
-				listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
137
+			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
138
+				//listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
139 139
 
140
-				item.Patient.TotalDialysis = listOne.Count
141
-				item.Count = listOne.Count
140
+				//item.Patient.TotalDialysis = listOne.Count
141
+				//item.Count = listOne.Count
142
+
143
+				if item.ScheduleDate <= 1640966400 {
144
+					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
145
+
146
+					item.Patient.TotalDialysis = listOne.Count
147
+					item.Count = listOne.Count
148
+				}
149
+
150
+				if item.ScheduleDate >= 1672502400 {
151
+					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
152
+
153
+					item.Patient.TotalDialysis = listOne.Count
154
+					item.Count = listOne.Count
155
+				}
142 156
 			}
143 157
 		}
144 158
 		if getScheduleErr != nil {

+ 1 - 1
main.go Vedi File

@@ -15,7 +15,7 @@ func main() {
15 15
 
16 16
 	//service.BeginAutoCreateWeekDisinfectionJob()
17 17
 	//service.BeginAutoCreatePlanJob()
18
-	//service.AutoClearSchedules()
18
+	//	//service.AutoClearSchedules()
19 19
 	//service.BeginAutoCreateStaffScheduleJob()
20 20
 	//service.BeginAutoCreateDrugJob()
21 21
 	//service.BeginAutoCreateStockJob()