Browse Source

2024/6/17

28169 1 week ago
parent
commit
338d35ec0b
43 changed files with 2092 additions and 777 deletions
  1. BIN
      XT_New.exe
  2. 8 8
      controllers/base_api_controller.go
  3. 16 7
      controllers/dialysis_api_controller.go
  4. 10 0
      controllers/dialysis_record_api_controller.go
  5. 6 1
      controllers/doctors_api_controller.go
  6. 2 0
      controllers/drug_pharmacy_management_controller.go
  7. 32 10
      controllers/drug_stock_api_contorller.go
  8. 8 4
      controllers/gobal_config_api_controller.go
  9. 576 459
      controllers/his_api_controller.go
  10. 0 1
      controllers/inspection_api_controller.go
  11. 6 2
      controllers/mobile_api_controllers/check_weight_api_controller.go
  12. 42 7
      controllers/mobile_api_controllers/dialysis_api_controller.go
  13. 322 56
      controllers/mobile_api_controllers/patient_api_controller.go
  14. 0 1
      controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go
  15. 6 4
      controllers/new_mobile_api_controllers/mobile_his_api_controller.go
  16. 2 0
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  17. 22 9
      controllers/print_data_api_controller.go
  18. 8 1
      controllers/schedule_api_controller.go
  19. 2 0
      controllers/self_drug_api_congtroller.go
  20. 143 0
      controllers/sign_api_controller.go
  21. 34 7
      controllers/stock_in_api_controller.go
  22. 3 0
      enums/error_code.go
  23. 80 79
      models/good_models.go
  24. 62 0
      models/new_stock_models.go
  25. 17 0
      models/patient_models.go
  26. 83 83
      models/stock_models.go
  27. 3 3
      service/dialysis_parameter_service.go
  28. 23 0
      service/dialysis_service.go
  29. 1 0
      service/dialysis_solution_service.go
  30. 14 2
      service/drug_stock_service.go
  31. 24 4
      service/gobal_config_service.go
  32. 9 0
      service/inspection_service.go
  33. 1 0
      service/mobile_dialysis_service.go
  34. 37 8
      service/new_warehouse_service.go
  35. 14 5
      service/patient_service.go
  36. 2 0
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go
  37. 42 2
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go
  38. 9 0
      service/schedule_service.go
  39. 7 0
      service/self_drug_service.go
  40. 15 0
      service/sign_service.go
  41. 6 6
      service/statistis_qc_service.go
  42. 120 7
      service/stock_service.go
  43. 275 1
      service/warhouse_service.go

BIN
XT_New.exe View File


+ 8 - 8
controllers/base_api_controller.go View File

@@ -72,10 +72,10 @@ func (this *BaseAuthAPIController) Prepare() {
72 72
 	this.BaseAPIController.Prepare()
73 73
 	if this.GetAdminUserInfo() == nil {
74 74
 		var userAdmin models.AdminUser
75
-		userAdmin.Id = 2301
75
+		userAdmin.Id = 4522
76 76
 		userAdmin.Mobile = "13318599895"
77 77
 
78
-		userAdmin.Id = 2301 //4,809
78
+		userAdmin.Id = 4522 //4,809
79 79
 		userAdmin.Mobile = "12222222222"
80 80
 		userAdmin.IsSuperAdmin = true
81 81
 		userAdmin.Status = 1
@@ -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 = 10164 //机构id
86
+		subscibe.OrgId = 10028 //机构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 = 10164 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10028 //机构id小英9675或4
97 97
 		adminUserInfo.CurrentAppId = 12123 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
@@ -318,10 +318,10 @@ func (this *BaseServeAPIController) Prepare() {
318 318
 	this.BaseAPIController.Prepare()
319 319
 	if this.GetAdminUserInfo() == nil {
320 320
 		var userAdmin models.AdminUser
321
-		userAdmin.Id = 2301
321
+		userAdmin.Id = 4522
322 322
 		userAdmin.Mobile = "13318599895"
323 323
 
324
-		userAdmin.Id = 2301 //4,809
324
+		userAdmin.Id = 4522 //4,809
325 325
 		userAdmin.Mobile = "12222222222"
326 326
 		userAdmin.IsSuperAdmin = false
327 327
 		userAdmin.Status = 1
@@ -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 = 10164 //机构id小英9675或4
332
+		subscibe.OrgId = 10028 //机构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 = 10164 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10028 //机构id小英9675或4
343 343
 		adminUserInfo.CurrentAppId = 12123 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes

+ 16 - 7
controllers/dialysis_api_controller.go View File

@@ -2858,7 +2858,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2858 2858
 			service.CreateDialysisFinish(finish)
2859 2859
 		}
2860 2860
 
2861
-		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10731 || adminUserInfo.CurrentOrgId == 10727 {
2861
+		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10751 {
2862 2862
 			var dewater_amount float64
2863 2863
 			dewater_amount = 0
2864 2864
 			if dry_weight > 0 {
@@ -3227,8 +3227,8 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3227 3227
 		dewater_amount = 0
3228 3228
 		if evaluation.DryWeight > 0 {
3229 3229
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3230
-			if templateInfo.TemplateId == 17 || templateInfo.TemplateId == 22 || templateInfo.TemplateId == 21 || templateInfo.TemplateId == 34 || adminUserInfo.CurrentOrgId == 10551 {
3231
-				if adminUserInfo.CurrentOrgId != 10551 {
3230
+			if templateInfo.TemplateId == 17 || templateInfo.TemplateId == 22 || templateInfo.TemplateId == 21 || templateInfo.TemplateId == 34 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10751 {
3231
+				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10751 {
3232 3232
 					dewater_amount = dewater_amount * 1000
3233 3233
 				}
3234 3234
 
@@ -3505,12 +3505,14 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3505 3505
 		}
3506 3506
 
3507 3507
 		//针对孝昌康桥超滤率计算问题
3508
-		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10726 {
3508
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10742 || adminUserInfo.CurrentOrgId == 10751 {
3509 3509
 			if assessmentBeforeDislysis.ID == 0 {
3510 3510
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3511 3511
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3512 3512
 					dewater_amount = assessmentBeforeDislysis.WeightBefore - assessmentBeforeDislysis.DryWeight - assessmentBeforeDislysis.AdditionalWeight
3513
-
3513
+					if adminUserInfo.CurrentOrgId == 10751 {
3514
+						dewater_amount = dewater_amount * 1000
3515
+					}
3514 3516
 					service.UpdateMobileGetDialysisPrescribe(dialysisPrescribeOne.ID, dewater_amount)
3515 3517
 				}
3516 3518
 			}
@@ -3519,7 +3521,9 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3519 3521
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3520 3522
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3521 3523
 					dewater_amount = assessmentBeforeDislysis.WeightBefore - assessmentBeforeDislysis.DryWeight - assessmentBeforeDislysis.AdditionalWeight
3522
-
3524
+					if adminUserInfo.CurrentOrgId == 10751 {
3525
+						dewater_amount = dewater_amount * 1000
3526
+					}
3523 3527
 					service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
3524 3528
 				}
3525 3529
 			}
@@ -6004,8 +6008,13 @@ func (c *DialysisApiController) UploadDryWeight() {
6004 6008
 				var dewater_amount float64
6005 6009
 
6006 6010
 				dewater_amount = beforAssesment.WeightBefore - dry_weight - beforAssesment.AdditionalWeight
6011
+				if adminUserInfo.CurrentOrgId != 10702 {
6012
+					service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
6013
+				}
6014
+				if adminUserInfo.CurrentOrgId == 10702 {
6015
+					service.UpdatePatientDialysisPrscriptionOne(dialysisPrescription.ID, dewater_amount)
6016
+				}
6007 6017
 
6008
-				service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
6009 6018
 				//获取key,清空redis
6010 6019
 				key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_prescribe"
6011 6020
 				redis := service.RedisClient()

+ 10 - 0
controllers/dialysis_record_api_controller.go View File

@@ -87,6 +87,8 @@ func (this *DialysisRecordAPIController) GetSchedules() {
87 87
 		redis.Set(key, scheduals_json_str, time.Second*60)
88 88
 	}
89 89
 
90
+	redis.Set(key, "", time.Second)
91
+
90 92
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
91 93
 
92 94
 		scheduals, err := service.GetDialysisSchedualsOne(orgID, date.Unix())
@@ -111,6 +113,8 @@ func (this *DialysisRecordAPIController) GetSchedules() {
111 113
 
112 114
 				inforMation, _ := service.GetTodayInforMation(orgID, date.Unix())
113 115
 
116
+				solution, _ := service.GetDialysisSolutionByDate(orgID)
117
+
114 118
 				for key, item := range scheduals {
115 119
 
116 120
 					for _, infor := range inforMation {
@@ -173,6 +177,12 @@ func (this *DialysisRecordAPIController) GetSchedules() {
173 177
 							break
174 178
 						}
175 179
 					}
180
+
181
+					for _, solut := range solution {
182
+						if solut.PatientId == item.PatientId && solut.ModeId == item.ModeId {
183
+							scheduals[key].DialysisSolution = solut
184
+						}
185
+					}
176 186
 				}
177 187
 
178 188
 				//缓存数据

+ 6 - 1
controllers/doctors_api_controller.go View File

@@ -372,7 +372,12 @@ func (c *DoctorsApiController) UpdatedDryWeightData() {
372 372
 
373 373
 			dewater_amount = beforAssesment.WeightBefore - dry_weight - beforAssesment.AdditionalWeight
374 374
 
375
-			service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
375
+			if adminUserInfo.CurrentOrgId != 10702 {
376
+				service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
377
+			}
378
+			if adminUserInfo.CurrentOrgId == 10702 {
379
+				service.UpdatePatientDialysisPrscriptionOne(dialysisPrescription.ID, dewater_amount)
380
+			}
376 381
 			//获取key,清空redis
377 382
 			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_prescribe"
378 383
 			redis := service.RedisClient()

+ 2 - 0
controllers/drug_pharmacy_management_controller.go View File

@@ -46,9 +46,11 @@ func (this *PharmacyApiController) GetTodayAdviceList() {
46 46
 	//获取药房发药药品库数据
47 47
 	appId := this.GetAdminUserInfo().CurrentAppId
48 48
 	doctorlist, err := service.GetAllDoctorSix(orgId, appId)
49
+	drug, _ := service.GetAllBaseDrugList(orgId)
49 50
 	if err == nil {
50 51
 		this.ServeSuccessJSON(map[string]interface{}{
51 52
 			"doctorlist": doctorlist,
53
+			"drug":       drug,
52 54
 		})
53 55
 	} else {
54 56
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)

+ 32 - 10
controllers/drug_stock_api_contorller.go View File

@@ -3169,6 +3169,7 @@ func (c *StockDrugApiController) GetDrugWarehouseInfoPrint() {
3169 3169
 	order_type, _ := c.GetInt64("order_type")
3170 3170
 
3171 3171
 	storehouse_id, _ := c.GetInt64("storehouse_id")
3172
+	drug_id, _ := c.GetInt64("drug_id")
3172 3173
 	timeLayout := "2006-01-02"
3173 3174
 	loc, _ := time.LoadLocation("Local")
3174 3175
 
@@ -3195,7 +3196,7 @@ func (c *StockDrugApiController) GetDrugWarehouseInfoPrint() {
3195 3196
 	adminUserInfo := c.GetAdminUserInfo()
3196 3197
 	orgId := adminUserInfo.CurrentOrgId
3197 3198
 	if order_type == 1 {
3198
-		list, err := service.GetDrugWarehouseInfoPrint(startTime, endTime, orgId, storehouse_id)
3199
+		list, err := service.GetDrugWarehouseInfoPrint(startTime, endTime, orgId, storehouse_id, drug_id)
3199 3200
 		manufacturerList, _ := service.GetAllManufacturerList(orgId)
3200 3201
 		dealerList, _ := service.GetAllDealerList(orgId)
3201 3202
 		if err == nil {
@@ -3215,6 +3216,8 @@ func (c *StockDrugApiController) GetDrugOutOrderPrint() {
3215 3216
 	end_time := c.GetString("end_time")
3216 3217
 	order_type, _ := c.GetInt64("order_type")
3217 3218
 	storehouse_id, _ := c.GetInt64("storehouse_id")
3219
+	drug_id, _ := c.GetInt64("drug_id")
3220
+	order_way, _ := c.GetInt64("order_way")
3218 3221
 	timeLayout := "2006-01-02"
3219 3222
 	loc, _ := time.LoadLocation("Local")
3220 3223
 
@@ -3243,7 +3246,7 @@ func (c *StockDrugApiController) GetDrugOutOrderPrint() {
3243 3246
 	dealerList, _ := service.GetAllDealerList(orgId)
3244 3247
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3245 3248
 	if order_type == 2 {
3246
-		list, err := service.GetDrugOutOrderInfoPrintList(startTime, endTime, orgId, storehouse_id)
3249
+		list, err := service.GetDrugOutOrderInfoPrintList(startTime, endTime, orgId, storehouse_id, drug_id, order_way)
3247 3250
 		if err == nil {
3248 3251
 			c.ServeSuccessJSON(map[string]interface{}{
3249 3252
 				"list":             list,
@@ -3388,6 +3391,20 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3388 3391
 			DrugCode:                item.DrugCode,
3389 3392
 		}
3390 3393
 		service.CreateNewDrugFlowTwo(flow, tx)
3394
+
3395
+		infoLog := models.XtDrugWarehouseInfoLog{
3396
+
3397
+			DrugId:          item.DrugId,
3398
+			WarehouseInfoId: item.ID,
3399
+			RecordDate:      time.Now().Unix(),
3400
+			UserOrgId:       item.OrgId,
3401
+			Status:          1,
3402
+			Ctime:           time.Now().Unix(),
3403
+			Mtime:           time.Now().Unix(),
3404
+		}
3405
+
3406
+		service.CreateInfoLog(infoLog, tx)
3407
+
3391 3408
 		//更新基础库剩余库存
3392 3409
 		service.UpdateNewMedicalSumCount(item.DrugId, sum_count, sum_in_count, item.OrgId, tx)
3393 3410
 
@@ -3569,7 +3586,7 @@ func (c *StockDrugApiController) ReturnCheckWarehouseingInfo() {
3569 3586
 
3570 3587
 func (c *StockDrugApiController) CheckDrugOut() {
3571 3588
 
3572
-	warehouse_out_id, _ := c.GetInt64("warehouse_out_id")
3589
+	warehouseOutId, _ := c.GetInt64("warehouse_out_id")
3573 3590
 	orgId := c.GetAdminUserInfo().CurrentOrgId
3574 3591
 	// 开始外部循环的事务
3575 3592
 	db := service.XTWriteDB()
@@ -3582,8 +3599,8 @@ func (c *StockDrugApiController) CheckDrugOut() {
3582 3599
 		}
3583 3600
 	}()
3584 3601
 
3585
-	warehousingOutInfoList, _ := service.GetNewDrugWarehouseOutListById(warehouse_out_id, orgId, tx)
3586
-	drugWarehouseOut, _ := service.GetNewDrugWarehouseOutByLastId(warehouse_out_id, tx)
3602
+	warehousingOutInfoList, _ := service.GetNewDrugWarehouseOutListById(warehouseOutId, orgId, tx)
3603
+	drugWarehouseOut, _ := service.GetNewDrugWarehouseOutByLastId(warehouseOutId, tx)
3587 3604
 
3588 3605
 	for _, it := range warehousingOutInfoList {
3589 3606
 		var total_count int64
@@ -3628,7 +3645,7 @@ func (c *StockDrugApiController) CheckDrugOut() {
3628 3645
 			return
3629 3646
 		}
3630 3647
 	}
3631
-	warehousingOutInfoListTwo, _ := service.GetNewDrugWarehouseOutListById(warehouse_out_id, orgId, tx)
3648
+	warehousingOutInfoListTwo, _ := service.GetNewDrugWarehouseOutListById(warehouseOutId, orgId, tx)
3632 3649
 
3633 3650
 	for _, it := range warehousingOutInfoListTwo {
3634 3651
 		medical, _ := service.GetBaseDrugMedical(it.DrugId)
@@ -3650,7 +3667,7 @@ func (c *StockDrugApiController) CheckDrugOut() {
3650 3667
 		service.AddNewDrugCount(it.DrugId, it.OrgId, it.StorehouseId, out_count_one, tx)
3651 3668
 
3652 3669
 	}
3653
-	warehousingOutInfoListThree, _ := service.GetNewDrugWarehouseOutListById(warehouse_out_id, orgId, tx)
3670
+	warehousingOutInfoListThree, _ := service.GetNewDrugWarehouseOutListById(warehouseOutId, orgId, tx)
3654 3671
 
3655 3672
 	var is_success = 2
3656 3673
 	for _, it := range warehousingOutInfoListThree {
@@ -3699,7 +3716,7 @@ func (c *StockDrugApiController) CheckDrugOut() {
3699 3716
 			}
3700 3717
 
3701 3718
 			var flow_count int64
3702
-
3719
+			var flow_count_one int64
3703 3720
 			//查询该药品的出库数量
3704 3721
 			drugflowlist, _ := service.GetDrugOutFlowByWarehouseOut(it.DrugId, it.ID, it.OrgId, tx)
3705 3722
 			if len(drugflowlist) > 0 {
@@ -3707,17 +3724,20 @@ func (c *StockDrugApiController) CheckDrugOut() {
3707 3724
 
3708 3725
 					if items.MaxUnit == medical.MaxUnit && medical.MaxUnit != medical.MinUnit {
3709 3726
 						flow_count = items.Count * medical.MinNumber
3727
+						flow_count_one += flow_count
3710 3728
 					}
3711 3729
 					if items.MaxUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
3712 3730
 						flow_count = items.Count
3731
+						flow_count_one += flow_count
3713 3732
 					}
3714 3733
 					if items.MaxUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
3715 3734
 						flow_count = items.Count
3735
+						flow_count_one += flow_count
3716 3736
 					}
3717 3737
 				}
3718 3738
 			}
3719 3739
 
3720
-			if now_count != flow_count {
3740
+			if now_count != flow_count_one {
3721 3741
 				is_success = 1
3722 3742
 				tx.Rollback()
3723 3743
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFlow)
@@ -3731,7 +3751,7 @@ func (c *StockDrugApiController) CheckDrugOut() {
3731 3751
 		IsCheck: 1,
3732 3752
 	}
3733 3753
 	//更新审核状态
3734
-	service.UpdateNewCheckDrugOut(out, warehouse_out_id, tx)
3754
+	service.UpdateNewCheckDrugOut(out, warehouseOutId, tx)
3735 3755
 
3736 3756
 	//查询
3737 3757
 	if is_success != 1 {
@@ -3883,6 +3903,8 @@ func (c *StockDrugApiController) ToReturnCheck() {
3883 3903
 
3884 3904
 		service.UpdateNewDrugStockCount(item.DrugId, item.OrgId, item.StorehouseId, over_count, tx)
3885 3905
 
3906
+		service.UpdateDrugWarehouseOutInfoLog(item.ID, item.DrugId, tx)
3907
+
3886 3908
 	}
3887 3909
 	tx.Commit()
3888 3910
 	c.ServeSuccessJSON(map[string]interface{}{

+ 8 - 4
controllers/gobal_config_api_controller.go View File

@@ -1734,6 +1734,7 @@ func (c *GobalConfigApiController) GetDrugInDetail() {
1734 1734
 	start_time := c.GetString("start_time")
1735 1735
 	end_time := c.GetString("end_time")
1736 1736
 	storehouse_id, _ := c.GetInt64("storehouse_id")
1737
+	drug_id, _ := c.GetInt64("drug_id")
1737 1738
 	timeLayout := "2006-01-02"
1738 1739
 	loc, _ := time.LoadLocation("Local")
1739 1740
 	var startTime int64
@@ -1763,7 +1764,7 @@ func (c *GobalConfigApiController) GetDrugInDetail() {
1763 1764
 	page, _ := c.GetInt64("page")
1764 1765
 	limit, _ := c.GetInt64("limit")
1765 1766
 
1766
-	detail, total, err := service.GetDrugInOrderDetail(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit, storehouse_id)
1767
+	detail, total, err := service.GetDrugInOrderDetail(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit, storehouse_id, drug_id)
1767 1768
 
1768 1769
 	var drugType = "药品类型"
1769 1770
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
@@ -1858,7 +1859,9 @@ func (c *GobalConfigApiController) GetDrugOutDetail() {
1858 1859
 	keyword := c.GetString("keyword")
1859 1860
 	limit, _ := c.GetInt64("limit")
1860 1861
 	page, _ := c.GetInt64("page")
1861
-	order, total, err := service.GetDrugOutOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit, storehouse_id)
1862
+	drug_id, _ := c.GetInt64("drug_id")
1863
+	order_way, _ := c.GetInt64("order_way")
1864
+	order, total, err := service.GetDrugOutOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit, storehouse_id, drug_id, order_way)
1862 1865
 
1863 1866
 	houseList, _ := service.GetAllStoreHouseList(adminInfo.CurrentOrgId)
1864 1867
 	patientsList, _ := service.GetAllpatient(adminInfo.CurrentOrgId)
@@ -1911,8 +1914,9 @@ func (c *GobalConfigApiController) GetDrugCancelDetail() {
1911 1914
 	keyword := c.GetString("keyword")
1912 1915
 	limit, _ := c.GetInt64("limit")
1913 1916
 	page, _ := c.GetInt64("page")
1914
-	orderPrint, _ := service.GetDrugCancelOrderPrint(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, storehouse_id)
1915
-	order, total, err := service.GetDrugCancelOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit, storehouse_id)
1917
+	drug_id, _ := c.GetInt64("drug_id")
1918
+	orderPrint, _ := service.GetDrugCancelOrderPrint(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, storehouse_id, drug_id)
1919
+	order, total, err := service.GetDrugCancelOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit, storehouse_id, drug_id)
1916 1920
 	var drugType = "药品类型"
1917 1921
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
1918 1922
 	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, adminInfo.CurrentOrgId)

File diff suppressed because it is too large
+ 576 - 459
controllers/his_api_controller.go


+ 0 - 1
controllers/inspection_api_controller.go View File

@@ -1142,7 +1142,6 @@ func (c *InspectionApiController) EditPatientNewInspection() {
1142 1142
 
1143 1143
 	inspection.ID = id
1144 1144
 
1145
-	fmt.Println("id------------------------------", id)
1146 1145
 }
1147 1146
 
1148 1147
 func (c *InspectionApiController) GetInpsectionByPatientGroup() {

+ 6 - 2
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -326,7 +326,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
326 326
 
327 327
 	}
328 328
 
329
-	if adminUserInfo.Org.Id == 10727 {
329
+	if adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10751 {
330 330
 		dewater_amount = dewater_amount * 1000
331 331
 	}
332 332
 
@@ -930,6 +930,10 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
930 930
 				evaluation.DialysisCount = lastPredialysisEvaluation.DialysisCount             //呼吸频次
931 931
 				evaluation.Phinholing = lastPredialysisEvaluation.Phinholing                   //针眼
932 932
 
933
+				if adminUserInfo.Org.Id == 10742 {
934
+					evaluation.BeforSymptoms = lastPredialysisEvaluation.BeforSymptoms
935
+				}
936
+
933 937
 				if adminUserInfo.Org.Id == 10702 {
934 938
 					evaluation.PreDialysisDrugs = "无"
935 939
 				}
@@ -977,7 +981,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
977 981
 		}
978 982
 
979 983
 		//针对患者称重两次没有数据的问题
980
-		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10740 || adminUserInfo.Org.Id == 10742 || adminUserInfo.Org.Id == 10745 {
984
+		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10740 || adminUserInfo.Org.Id == 10745 {
981 985
 
982 986
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
983 987
 			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)

+ 42 - 7
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -570,11 +570,11 @@ func (this *DialysisAPIController) DialysisRecord() {
570 570
 	//var index int64 = 0
571 571
 	for _, item := range temp_team_projects {
572 572
 		//组套里面非检验项目的
573
-		if item.HisProject.CostClassify != 3 {
573
+		if item.HisProject.CostClassify != 3 && item.HisProject.CostClassify != 104 {
574 574
 			projects = append(projects, item)
575 575
 		}
576 576
 		//组套里面检验项目的
577
-		if item.HisProject.CostClassify == 3 {
577
+		if item.HisProject.CostClassify == 3 || item.HisProject.CostClassify == 104 {
578 578
 			team_projects = append(team_projects, item)
579 579
 		}
580 580
 	}
@@ -3051,7 +3051,7 @@ func (c *DialysisAPIController) Finish() {
3051 3051
 
3052 3052
 	}
3053 3053
 
3054
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 || adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10735 {
3054
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 || adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10735 || adminUserInfo.Org.Id == 10742 {
3055 3055
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3056 3056
 
3057 3057
 		if adminUserInfo.Org.Id != 10702 {
@@ -3687,6 +3687,15 @@ func (this *DialysisAPIController) StartDialysis() {
3687 3687
 
3688 3688
 	schedule, err := service.GetDayScheduleByBedid(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
3689 3689
 
3690
+	if adminUserInfo.Org.Id == 10679 || adminUserInfo.Org.Id == 10164 {
3691
+
3692
+		record, _ := service.GetDialysisPrescriptionByRecord(adminUserInfo.Org.Id, patientID, schedulestartTime)
3693
+		if record.ID == 0 {
3694
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePrescription)
3695
+			return
3696
+		}
3697
+	}
3698
+
3690 3699
 	//查询该床位是否有人用了
3691 3700
 	order, _ := service.GetDialysisOrderByBedIdTwo(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
3692 3701
 
@@ -3980,11 +3989,16 @@ func (this *DialysisAPIController) StartDialysis() {
3980 3989
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3981 3990
 			}
3982 3991
 
3983
-			if adminUserInfo.Org.Id == 10644 {
3992
+			if adminUserInfo.Org.Id == 10644 || adminUserInfo.Org.Id == 10751 {
3984 3993
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3985 3994
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3986 3995
 			}
3987 3996
 
3997
+			if adminUserInfo.Org.Id == 10751 {
3998
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater / float64(totalMin) * 60 * 1000)
3999
+				ultrafiltration_rate = ultrafiltration_rate / 1000
4000
+			}
4001
+
3988 4002
 			if adminUserInfo.Org.Id == 10667 {
3989 4003
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3990 4004
 				ultrafiltration_rate = ultrafiltration_rate / 1000
@@ -4103,7 +4117,7 @@ func (this *DialysisAPIController) StartDialysis() {
4103 4117
 	}
4104 4118
 
4105 4119
 	//只针对广慈医院
4106
-	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10517 || adminUserInfo.Org.Id == 10679 {
4120
+	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10517 || adminUserInfo.Org.Id == 10679 || adminUserInfo.Org.Id == 10742 {
4107 4121
 		// 查询病人是否有透前评估数据
4108 4122
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4109 4123
 
@@ -5276,6 +5290,13 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5276 5290
 
5277 5291
 			}
5278 5292
 
5293
+			if adminInfo.Org.Id == 10751 {
5294
+
5295
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater / float64(totalMin) * 60 * 1000)
5296
+				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5297
+
5298
+			}
5299
+
5279 5300
 			if adminInfo.Org.Id == 10551 || adminInfo.Org.Id == 10617 || adminInfo.Org.Id == 10580 || adminInfo.Org.Id == 10629 {
5280 5301
 
5281 5302
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
@@ -5379,6 +5400,13 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5379 5400
 		record.UltrafiltrationVolume = ultrafiltration_volume / 1000
5380 5401
 	}
5381 5402
 
5403
+	if adminInfo.Org.Id == 10751 {
5404
+
5405
+		ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5406
+
5407
+		record.UltrafiltrationVolume = ultrafiltration_volume / 1000
5408
+	}
5409
+
5382 5410
 	if adminInfo.Org.Id == 10551 || adminInfo.Org.Id == 10617 || adminInfo.Org.Id == 10580 {
5383 5411
 		ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5384 5412
 
@@ -6733,8 +6761,13 @@ func (c *DialysisAPIController) UploadDryWeight() {
6733 6761
 				var dewater_amount float64
6734 6762
 
6735 6763
 				dewater_amount = beforAssesment.WeightBefore - dry_weight - beforAssesment.AdditionalWeight
6764
+				if adminUserInfo.Org.Id != 10702 {
6765
+					service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
6766
+				}
6767
+				if adminUserInfo.Org.Id == 10702 {
6768
+					service.UpdatePatientDialysisPrscriptionOne(dialysisPrescription.ID, dewater_amount)
6769
+				}
6736 6770
 
6737
-				service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
6738 6771
 				//获取key,清空redis
6739 6772
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_prescribe"
6740 6773
 				redis := service.RedisClient()
@@ -12126,7 +12159,7 @@ func (c *DialysisAPIController) SaveSelfChildDrugLongAdivce() {
12126 12159
 		StopTime:              0,
12127 12160
 		StopReason:            "",
12128 12161
 		StopDoctor:            0,
12129
-		StopState:             0,
12162
+		StopState:             2,
12130 12163
 		ParentId:              parent_id,
12131 12164
 		ExecutionTime:         0,
12132 12165
 		ExecutionStaff:        0,
@@ -12610,6 +12643,8 @@ func (c *DialysisAPIController) SaveLongAdviceTemplate() {
12610 12643
 
12611 12644
 		advice.AdviceDoctor = advice_doctor
12612 12645
 
12646
+		advice.StopState = 2
12647
+
12613 12648
 		advices = append(advices, &advice)
12614 12649
 	}
12615 12650
 

+ 322 - 56
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -676,13 +676,13 @@ func (c *PatientApiController) ExecDoctorAdvice() {
676 676
 		if groupno > 0 {
677 677
 			advices, _ := service.FindAllDoctorAdviceByGoroupNoThree(adminUserInfo.Org.Id, groupno, patient_id, record_date)
678 678
 
679
-			fmt.Println("advices---------------------------------------------", advices)
680 679
 			for _, item := range advices {
681 680
 
682 681
 				//自备药
683 682
 				selfPrescriptionOutOpenOne, _ := service.GetSelfPrescriptionOutOpen(adminUserInfo.Org.Id)
684 683
 
685 684
 				if selfPrescriptionOutOpenOne.IsOpen == 1 {
685
+
686 686
 					//查询库存是否
687 687
 					selfBasedrug, _ := service.GetSelfBasedrugByIdTwo(advice.DrugId, advice.UserOrgId)
688 688
 
@@ -709,15 +709,19 @@ func (c *PatientApiController) ExecDoctorAdvice() {
709 709
 							count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
710 710
 							prescribing_number_total_one = count
711 711
 						}
712
-						if prescribing_number_total_one > selfDrugStockCount.FlushCount {
713
-							c.ServeSuccessJSON(map[string]interface{}{
714
-								"msg":    "2",
715
-								"advice": advice,
716
-								"ids":    ids,
717
-							})
718
-							return
712
+						if advice.UserOrgId != 10164 && advice.UserOrgId != 10744 {
713
+
714
+							if prescribing_number_total_one > selfDrugStockCount.FlushCount {
715
+								c.ServeSuccessJSON(map[string]interface{}{
716
+									"msg":    "2",
717
+									"advice": advice,
718
+									"ids":    ids,
719
+								})
720
+								return
719 721
 
722
+							}
720 723
 						}
724
+
721 725
 					}
722 726
 
723 727
 				}
@@ -770,6 +774,18 @@ func (c *PatientApiController) ExecDoctorAdvice() {
770 774
 						}
771 775
 					}()
772 776
 
777
+					if strings.Contains(item.AdviceName, "自备") {
778
+						fmt.Println("hahhahahahahhh")
779
+						if item.DrugId == 0 {
780
+							c.ServeSuccessJSON(map[string]interface{}{
781
+								"msg":    "12",
782
+								"advice": item,
783
+								"ids":    ids,
784
+							})
785
+							return
786
+						}
787
+					}
788
+
773 789
 					selfBasedrug, _ := service.GetSelfBasedrugById(item.DrugId, item.UserOrgId, tx)
774 790
 
775 791
 					if selfBasedrug.IsSelfDrug == 1 {
@@ -787,13 +803,15 @@ func (c *PatientApiController) ExecDoctorAdvice() {
787 803
 							total_count += items.StockMaxNumber + items.StockMinNumber
788 804
 						}
789 805
 
790
-						if total_count == 0 {
791
-							c.ServeSuccessJSON(map[string]interface{}{
792
-								"msg":    "2",
793
-								"advice": item,
794
-								"ids":    ids,
795
-							})
796
-							return
806
+						if item.UserOrgId != 10740 && item.UserOrgId != 10164 {
807
+							if total_count == 0 {
808
+								c.ServeSuccessJSON(map[string]interface{}{
809
+									"msg":    "2",
810
+									"advice": item,
811
+									"ids":    ids,
812
+								})
813
+								return
814
+							}
797 815
 						}
798 816
 
799 817
 						//判断单位是否相等
@@ -818,16 +836,126 @@ func (c *PatientApiController) ExecDoctorAdvice() {
818 836
 
819 837
 						}
820 838
 
821
-						if prescribing_number_total > total_count {
822
-							c.ServeSuccessJSON(map[string]interface{}{
823
-								"msg":    "3",
824
-								"advice": item,
825
-							})
826
-							return
839
+						if item.UserOrgId != 10740 && item.UserOrgId != 10164 {
840
+
841
+							if prescribing_number_total > total_count {
842
+								c.ServeSuccessJSON(map[string]interface{}{
843
+									"msg":    "3",
844
+									"advice": item,
845
+								})
846
+								return
847
+							}
827 848
 						}
849
+
828 850
 						var warehousingOutInfo []*models.XtSelfDrugWarehouseOutInfo
829
-						//出库
830
-						if prescribing_number_total <= total_count {
851
+
852
+						if item.UserOrgId != 10164 {
853
+							//出库
854
+							if prescribing_number_total <= total_count {
855
+								timeStr := time.Now().Format("2006-01-02")
856
+								timeArr := strings.Split(timeStr, "-")
857
+								total, _ := service.FindAllSelfDrugWarehouseOut(adminUserInfo.Org.Id, tx)
858
+
859
+								total = total + 1
860
+								warehousing_out_order := strconv.FormatInt(adminUserInfo.Org.Id, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
861
+								number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
862
+								number = number + total
863
+								warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
864
+								operation_time := time.Now().Unix()
865
+
866
+								creater := c.GetMobileAdminUserInfo().AdminUser.Id
867
+								//创建一个出库单
868
+								drugWarehouseOut := models.XtSelfDrugWarehouseOut{
869
+									WarehouseOutOrderNumber: warehousing_out_order,
870
+									OperationTime:           operation_time,
871
+									OrgId:                   adminUserInfo.Org.Id,
872
+									Creater:                 creater,
873
+									Ctime:                   time.Now().Unix(),
874
+									Status:                  1,
875
+									WarehouseOutTime:        item.AdviceDate,
876
+									Type:                    0,
877
+									PatientId:               advice.PatientId,
878
+									IsCheck:                 1,
879
+									IsSys:                   1,
880
+								}
881
+
882
+								//查询今日是否有出库数据
883
+								lastWarehouseOut, _ := service.GetSelfDrugLastWarehouseOutTwety(adminUserInfo.Org.Id, item.AdviceDate, tx, 1)
884
+
885
+								if lastWarehouseOut.ID == 0 {
886
+									service.AddSelfSigleDrugWarehouseOut(&drugWarehouseOut, tx)
887
+								}
888
+
889
+								//查询今日是否有出库数据
890
+								lastWarehouseOutOne, _ := service.GetSelfDrugLastWarehouseOutTwety(adminUserInfo.Org.Id, item.AdviceDate, tx, 1)
891
+
892
+								var warehousing_out_order_str string
893
+								if lastWarehouseOut.ID == 0 {
894
+									warehousing_out_order_str = warehousing_out_order
895
+								} else {
896
+									warehousing_out_order_str = lastWarehouseOut.WarehouseOutOrderNumber
897
+								}
898
+
899
+								//出库
900
+								warehouseOutInfo := &models.XtSelfDrugWarehouseOutInfo{
901
+									WarehouseOutId:          lastWarehouseOutOne.ID,
902
+									WarehouseOutOrderNumber: warehousing_out_order_str,
903
+									DrugId:                  item.DrugId,
904
+									Count:                   prescribing_number_total,
905
+									Price:                   0,
906
+									TotalPrice:              0,
907
+									Status:                  1,
908
+									Ctime:                   item.AdviceDate,
909
+									Mtime:                   item.AdviceDate,
910
+									Remark:                  "",
911
+									OrgId:                   item.UserOrgId,
912
+									Type:                    0,
913
+									Manufacturer:            selfBasedrug.Manufacturer,
914
+									Dealer:                  selfBasedrug.Dealer,
915
+									RetailPrice:             0,
916
+									RetailTotalPrice:        0,
917
+									CountUnit:               selfBasedrug.MinUnit,
918
+									ExpiryDate:              0,
919
+									ProductDate:             0,
920
+									Number:                  "",
921
+									BatchNumber:             "",
922
+									IsSys:                   0,
923
+									WarehouseInfoId:         0,
924
+									AdminUserId:             0,
925
+									StockCount:              "",
926
+									IsCheck:                 1,
927
+									SysRecordTime:           item.AdviceDate,
928
+									PatientId:               item.PatientId,
929
+									AdviceId:                item.ID,
930
+									ClassType:               "",
931
+								}
932
+								warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
933
+
934
+								for _, it := range warehousingOutInfo {
935
+
936
+									medical, _ := service.GetSelfBaseDrugMedical(it.DrugId, tx)
937
+									drup, _ := service.FindSelfBaseDrugLibRecord(it.OrgId, it.DrugId, tx)
938
+
939
+									//出库逻辑
940
+									service.AutoSelfDrugDeliverInfoFourtyTwo(adminUserInfo.Org.Id, it.Count, &lastWarehouseOut, &drup, it, it.CountUnit, tx)
941
+
942
+									//查询剩余库存
943
+									stockInfo, _ := service.GetSelfDrugAllStockInfo(it.PatientId, it.OrgId, it.DrugId, tx)
944
+									var sum_count int64
945
+									for _, its := range stockInfo {
946
+										if its.MaxUnit == medical.MaxUnit {
947
+											its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
948
+										}
949
+										sum_count += its.StockMaxNumber + its.StockMinNumber
950
+									}
951
+									service.UpdateSelfDrugStockCount(it.DrugId, it.OrgId, it.PatientId, sum_count, tx)
952
+								}
953
+							}
954
+						}
955
+
956
+						//重庆
957
+						if item.UserOrgId == 10164 {
958
+							//出库
831 959
 							timeStr := time.Now().Format("2006-01-02")
832 960
 							timeArr := strings.Split(timeStr, "-")
833 961
 							total, _ := service.FindAllSelfDrugWarehouseOut(adminUserInfo.Org.Id, tx)
@@ -911,8 +1039,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
911 1039
 
912 1040
 								medical, _ := service.GetSelfBaseDrugMedical(it.DrugId, tx)
913 1041
 								drup, _ := service.FindSelfBaseDrugLibRecord(it.OrgId, it.DrugId, tx)
1042
+
914 1043
 								//出库逻辑
915
-								service.AutoSelfDrugDeliverInfoFourtyTwo(adminUserInfo.Org.Id, it.Count, &lastWarehouseOut, &drup, it, it.CountUnit, tx)
1044
+								service.AutoNewSelfDrugDeliverInfoFourtyTwo(adminUserInfo.Org.Id, it.Count, &lastWarehouseOut, &drup, it, it.CountUnit, tx)
916 1045
 
917 1046
 								//查询剩余库存
918 1047
 								stockInfo, _ := service.GetSelfDrugAllStockInfo(it.PatientId, it.OrgId, it.DrugId, tx)
@@ -925,6 +1054,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
925 1054
 								}
926 1055
 								service.UpdateSelfDrugStockCount(it.DrugId, it.OrgId, it.PatientId, sum_count, tx)
927 1056
 							}
1057
+
928 1058
 						}
929 1059
 
930 1060
 					}
@@ -967,14 +1097,19 @@ func (c *PatientApiController) ExecDoctorAdvice() {
967 1097
 							count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
968 1098
 							prescribing_number_total_one = count
969 1099
 						}
970
-						if prescribing_number_total_one > selfDrugStockCount.FlushCount {
971
-							c.ServeSuccessJSON(map[string]interface{}{
972
-								"msg":    "2",
973
-								"advice": advice,
974
-								"ids":    ids,
975
-							})
976
-							return
1100
+
1101
+						if advice.UserOrgId != 10164 && advice.UserOrgId != 10740 {
1102
+
1103
+							if prescribing_number_total_one > selfDrugStockCount.FlushCount {
1104
+								c.ServeSuccessJSON(map[string]interface{}{
1105
+									"msg":    "2",
1106
+									"advice": advice,
1107
+									"ids":    ids,
1108
+								})
1109
+								return
1110
+							}
977 1111
 						}
1112
+
978 1113
 					}
979 1114
 
980 1115
 				}
@@ -1027,13 +1162,16 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1027 1162
 							total_count += items.StockMaxNumber + items.StockMinNumber
1028 1163
 						}
1029 1164
 
1030
-						if total_count == 0 {
1031
-							c.ServeSuccessJSON(map[string]interface{}{
1032
-								"msg":    "2",
1033
-								"advice": item,
1034
-								"ids":    ids,
1035
-							})
1036
-							return
1165
+						if item.UserOrgId != 10740 && item.UserOrgId != 10164 {
1166
+
1167
+							if total_count == 0 {
1168
+								c.ServeSuccessJSON(map[string]interface{}{
1169
+									"msg":    "2",
1170
+									"advice": item,
1171
+									"ids":    ids,
1172
+								})
1173
+								return
1174
+							}
1037 1175
 						}
1038 1176
 
1039 1177
 						//判断单位是否相等
@@ -1058,16 +1196,126 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1058 1196
 
1059 1197
 						}
1060 1198
 
1061
-						if prescribing_number_total > total_count {
1062
-							c.ServeSuccessJSON(map[string]interface{}{
1063
-								"msg":    "3",
1064
-								"advice": item,
1065
-							})
1066
-							return
1199
+						if item.UserOrgId != 10164 && item.UserOrgId != 10740 {
1200
+							if prescribing_number_total > total_count {
1201
+								c.ServeSuccessJSON(map[string]interface{}{
1202
+									"msg":    "3",
1203
+									"advice": item,
1204
+								})
1205
+								return
1206
+							}
1067 1207
 						}
1208
+
1068 1209
 						var warehousingOutInfo []*models.XtSelfDrugWarehouseOutInfo
1069
-						//出库
1070
-						if prescribing_number_total <= total_count {
1210
+
1211
+						if item.UserOrgId != 10164 && item.UserOrgId != 10740 {
1212
+
1213
+							//出库
1214
+							if prescribing_number_total <= total_count {
1215
+								timeStr := time.Now().Format("2006-01-02")
1216
+								timeArr := strings.Split(timeStr, "-")
1217
+								total, _ := service.FindAllSelfDrugWarehouseOut(adminUserInfo.Org.Id, tx)
1218
+
1219
+								total = total + 1
1220
+								warehousing_out_order := strconv.FormatInt(adminUserInfo.Org.Id, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
1221
+								number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
1222
+								number = number + total
1223
+								warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
1224
+								operation_time := time.Now().Unix()
1225
+
1226
+								creater := c.GetMobileAdminUserInfo().AdminUser.Id
1227
+
1228
+								//创建一个出库单
1229
+								drugWarehouseOut := models.XtSelfDrugWarehouseOut{
1230
+									WarehouseOutOrderNumber: warehousing_out_order,
1231
+									OperationTime:           operation_time,
1232
+									OrgId:                   adminUserInfo.Org.Id,
1233
+									Creater:                 creater,
1234
+									Ctime:                   time.Now().Unix(),
1235
+									Status:                  1,
1236
+									WarehouseOutTime:        item.AdviceDate,
1237
+									Type:                    0,
1238
+									PatientId:               advice.PatientId,
1239
+									IsCheck:                 1,
1240
+									IsSys:                   1,
1241
+								}
1242
+
1243
+								//查询今日是否有出库数据
1244
+								lastWarehouseOut, _ := service.GetSelfDrugLastWarehouseOutTwety(adminUserInfo.Org.Id, item.AdviceDate, tx, 1)
1245
+
1246
+								if lastWarehouseOut.ID == 0 {
1247
+									service.AddSelfSigleDrugWarehouseOut(&drugWarehouseOut, tx)
1248
+								}
1249
+
1250
+								//查询今日是否有出库数据
1251
+								lastWarehouseOutOne, _ := service.GetSelfDrugLastWarehouseOutTwety(adminUserInfo.Org.Id, item.AdviceDate, tx, 1)
1252
+
1253
+								var warehousing_out_order_str string
1254
+								if lastWarehouseOut.ID == 0 {
1255
+									warehousing_out_order_str = warehousing_out_order
1256
+								} else {
1257
+									warehousing_out_order_str = lastWarehouseOut.WarehouseOutOrderNumber
1258
+								}
1259
+
1260
+								//出库
1261
+								warehouseOutInfo := &models.XtSelfDrugWarehouseOutInfo{
1262
+									WarehouseOutId:          lastWarehouseOutOne.ID,
1263
+									WarehouseOutOrderNumber: warehousing_out_order_str,
1264
+									DrugId:                  item.DrugId,
1265
+									Count:                   prescribing_number_total,
1266
+									Price:                   0,
1267
+									TotalPrice:              0,
1268
+									Status:                  1,
1269
+									Ctime:                   item.AdviceDate,
1270
+									Mtime:                   item.AdviceDate,
1271
+									Remark:                  "",
1272
+									OrgId:                   item.UserOrgId,
1273
+									Type:                    0,
1274
+									Manufacturer:            selfBasedrug.Manufacturer,
1275
+									Dealer:                  selfBasedrug.Dealer,
1276
+									RetailPrice:             0,
1277
+									RetailTotalPrice:        0,
1278
+									CountUnit:               selfBasedrug.MinUnit,
1279
+									ExpiryDate:              0,
1280
+									ProductDate:             0,
1281
+									Number:                  "",
1282
+									BatchNumber:             "",
1283
+									IsSys:                   0,
1284
+									WarehouseInfoId:         0,
1285
+									AdminUserId:             0,
1286
+									StockCount:              "",
1287
+									IsCheck:                 1,
1288
+									SysRecordTime:           item.AdviceDate,
1289
+									PatientId:               item.PatientId,
1290
+									AdviceId:                item.ID,
1291
+									ClassType:               "",
1292
+								}
1293
+								warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1294
+
1295
+								for _, it := range warehousingOutInfo {
1296
+
1297
+									medical, _ := service.GetSelfBaseDrugMedical(it.DrugId, tx)
1298
+									drup, _ := service.FindSelfBaseDrugLibRecord(it.OrgId, it.DrugId, tx)
1299
+									//出库逻辑
1300
+									service.AutoSelfDrugDeliverInfoFourtyTwo(adminUserInfo.Org.Id, it.Count, &lastWarehouseOut, &drup, it, it.CountUnit, tx)
1301
+
1302
+									//查询剩余库存
1303
+									stockInfo, _ := service.GetSelfDrugAllStockInfo(it.PatientId, it.OrgId, it.DrugId, tx)
1304
+									var sum_count int64
1305
+									for _, its := range stockInfo {
1306
+										if its.MaxUnit == medical.MaxUnit {
1307
+											its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1308
+										}
1309
+										sum_count += its.StockMaxNumber + its.StockMinNumber
1310
+									}
1311
+									service.UpdateSelfDrugStockCount(it.DrugId, it.OrgId, it.PatientId, sum_count, tx)
1312
+								}
1313
+							}
1314
+						}
1315
+
1316
+						//重庆
1317
+						if item.UserOrgId == 10164 || item.UserOrgId == 10740 {
1318
+
1071 1319
 							timeStr := time.Now().Format("2006-01-02")
1072 1320
 							timeArr := strings.Split(timeStr, "-")
1073 1321
 							total, _ := service.FindAllSelfDrugWarehouseOut(adminUserInfo.Org.Id, tx)
@@ -1153,7 +1401,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1153 1401
 								medical, _ := service.GetSelfBaseDrugMedical(it.DrugId, tx)
1154 1402
 								drup, _ := service.FindSelfBaseDrugLibRecord(it.OrgId, it.DrugId, tx)
1155 1403
 								//出库逻辑
1156
-								service.AutoSelfDrugDeliverInfoFourtyTwo(adminUserInfo.Org.Id, it.Count, &lastWarehouseOut, &drup, it, it.CountUnit, tx)
1404
+								service.AutoNewSelfDrugDeliverInfoFourtyTwo(adminUserInfo.Org.Id, it.Count, &lastWarehouseOut, &drup, it, it.CountUnit, tx)
1157 1405
 
1158 1406
 								//查询剩余库存
1159 1407
 								stockInfo, _ := service.GetSelfDrugAllStockInfo(it.PatientId, it.OrgId, it.DrugId, tx)
@@ -1167,7 +1415,6 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1167 1415
 								service.UpdateSelfDrugStockCount(it.DrugId, it.OrgId, it.PatientId, sum_count, tx)
1168 1416
 							}
1169 1417
 						}
1170
-
1171 1418
 					}
1172 1419
 
1173 1420
 				}
@@ -1187,8 +1434,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1187 1434
 
1188 1435
 		//针对普宁
1189 1436
 		if adminUserInfo.Org.Id != 10599 {
1190
-			fmt.Println("开始时间--------------------", advice.StartTime)
1191
-			fmt.Println("theTime---------------------", theTime.Unix())
1437
+
1192 1438
 			if advice.StartTime > theTime.Unix() {
1193 1439
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
1194 1440
 				return
@@ -2814,6 +3060,19 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
2814 3060
 			Mtime:         time.Now().Unix(),
2815 3061
 		}
2816 3062
 		service.ModifyHisPrescriptionProject(&project, ids)
3063
+
3064
+		if adminUserInfo.Org.Id == 10644 {
3065
+			projectList, _ := service.GetHisPrescriptionProjectByIds(ids)
3066
+			if len(projectList) > 0 {
3067
+				for _, item := range projectList {
3068
+					if item.TeamId > 0 {
3069
+						service.ModfifyProjectListByIds(item.TeamId, theTime.Unix(), item.RecordDate, item.PatientId)
3070
+					}
3071
+
3072
+				}
3073
+			}
3074
+		}
3075
+
2817 3076
 		//记录日志
2818 3077
 		projectquerst, _ := json.Marshal(project)
2819 3078
 		projectLog := models.XtDoctorAdviceLog{
@@ -3494,7 +3753,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
3494 3753
 	if evaluation.DryWeight > 0 {
3495 3754
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3496 3755
 
3497
-		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 || template.TemplateId == 32 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10551 || adminUserInfo.Org.Id == 10579 || adminUserInfo.Org.Id == 10580 || adminUserInfo.Org.Id == 10585 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10727 {
3756
+		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 || template.TemplateId == 32 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10551 || adminUserInfo.Org.Id == 10579 || adminUserInfo.Org.Id == 10580 || adminUserInfo.Org.Id == 10585 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10751 {
3498 3757
 
3499 3758
 			if adminUserInfo.Org.Id != 10551 && adminUserInfo.Org.Id != 10579 && adminUserInfo.Org.Id != 10580 && adminUserInfo.Org.Id != 10585 {
3500 3759
 				dewater_amount = dewater_amount * 1000
@@ -4219,11 +4478,14 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4219 4478
 	}
4220 4479
 
4221 4480
 	//针对孝昌康桥超滤率计算问题
4222
-	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10726 || adminUserInfo.Org.Id == 10164 {
4481
+	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10726 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 10751 {
4223 4482
 		if evaluation.ID == 0 {
4224 4483
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4225 4484
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4226 4485
 				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
4486
+				if adminUserInfo.Org.Id == 10751 {
4487
+					dewater_amount = dewater_amount * 1000
4488
+				}
4227 4489
 				service.UpdateMobileGetDialysisPrescribe(dialysisPrescribeOne.ID, dewater_amount)
4228 4490
 			}
4229 4491
 		}
@@ -4232,14 +4494,17 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4232 4494
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4233 4495
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4234 4496
 				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
4497
+				if adminUserInfo.Org.Id == 10751 {
4498
+					dewater_amount = dewater_amount * 1000
4499
+				}
4235 4500
 				service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
4236 4501
 			}
4237 4502
 		}
4238 4503
 
4239 4504
 	}
4240 4505
 
4241
-	//古镇乐生
4242
-	if adminUserInfo.Org.Id == 10731 {
4506
+	// 小尹
4507
+	if adminUserInfo.Org.Id == 10164 {
4243 4508
 		if evaluation.ID == 0 {
4244 4509
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4245 4510
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
@@ -4302,7 +4567,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4302 4567
 	}
4303 4568
 
4304 4569
 	//揭阳
4305
-	if adminUserInfo.Org.Id == 10597 {
4570
+	if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10742 {
4306 4571
 		if evaluation.ID == 0 {
4307 4572
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4308 4573
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
@@ -4312,7 +4577,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4312 4577
 		}
4313 4578
 	}
4314 4579
 
4315
-	if adminUserInfo.Org.Id == 10597 {
4580
+	if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10742 {
4316 4581
 
4317 4582
 		if evaluation.ID > 0 {
4318 4583
 
@@ -6985,6 +7250,7 @@ func (c *PatientApiController) ExecProject() {
6985 7250
 				ids = append(ids, items.ID)
6986 7251
 			}
6987 7252
 			err := service.UpdateTeamProjectExceStatus(ids, adminInfo.AdminUser.Id, theTime.Unix())
7253
+
6988 7254
 			if err == nil {
6989 7255
 				c.ServeSuccessJSON(map[string]interface{}{
6990 7256
 					"project": project,

+ 0 - 1
controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go View File

@@ -71,7 +71,6 @@ func (this *DialysisParamerterApiController) GetMobileDialysisParameters() {
71 71
 	} else {
72 72
 		dialysisSchedule, err, total := service.GetDialysisParameter(orgid, theTime.Unix(), scheduleType, partitionType, page, limit)
73 73
 
74
-		fmt.Println("dialysisSchedule------------------------", dialysisSchedule)
75 74
 		//查询今日排班的病人
76 75
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
77 76
 

+ 6 - 4
controllers/new_mobile_api_controllers/mobile_his_api_controller.go View File

@@ -1,10 +1,6 @@
1 1
 package new_mobile_api_controllers
2 2
 
3 3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8 4
 	"encoding/json"
9 5
 	"fmt"
10 6
 	"math/rand"
@@ -12,6 +8,11 @@ import (
12 8
 	"strconv"
13 9
 	"strings"
14 10
 	"time"
11
+
12
+	"XT_New/enums"
13
+	"XT_New/models"
14
+	"XT_New/service"
15
+	"XT_New/utils"
15 16
 )
16 17
 
17 18
 type MobileHisApiController struct {
@@ -328,6 +329,7 @@ func (c *MobileHisApiController) DeletePrescription() {
328 329
 	}
329 330
 }
330 331
 func (c *MobileHisApiController) DeleteDoctorAdvice() {
332
+
331 333
 	id, _ := c.GetInt64("id")
332 334
 	advice, _ := service.GetHisDoctorAdvicesById(id)
333 335
 	err := service.DelelteDoctorAdvice(id, c.GetMobileAdminUserInfo().Org.Id)

+ 2 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

@@ -1398,6 +1398,8 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1398 1398
 
1399 1399
 	deathtime := dataBody["death_time"].(string)
1400 1400
 
1401
+	fmt.Println("deathTime=-------------------", deathtime)
1402
+
1401 1403
 	deathtimes, err := time.ParseInLocation(timeLayouts+" 15:04:05", deathtime+" 00:00:00", loc)
1402 1404
 	//times, err := utils.ParseTimeStringToTime(timeLayout, fistdate+"00:00:00")
1403 1405
 	death_time := deathtimes.Unix()

+ 22 - 9
controllers/print_data_api_controller.go View File

@@ -162,18 +162,28 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
162 162
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
163 163
 			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
164 164
 				if this.GetAdminUserInfo().CurrentOrgId == 10445 {
165
-					if item.ScheduleDate <= 1703952000 {
165
+
166
+					if item.ScheduleDate >= 1640966400 && item.ScheduleDate <= 1672416000 {
167
+						listOne, _ := service.GetDialysisOrderCountNewTen(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
168
+						item.Patient.TotalDialysis = listOne.Count
169
+						item.Count = listOne.Count
170
+					}
171
+
172
+					if item.ScheduleDate >= 1672502400 && item.ScheduleDate <= 1703952000 {
173
+						listOne, _ := service.GetDialysisOrderCountTwenty(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
174
+						item.Patient.TotalDialysis = listOne.Count
175
+						item.Count = listOne.Count
176
+					}
177
+
178
+					if item.ScheduleDate >= 1704038400 && item.ScheduleDate <= 1735574400 {
179
+
166 180
 						listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
167 181
 
168 182
 						item.Patient.TotalDialysis = listOne.Count
169 183
 						item.Count = listOne.Count
170 184
 					}
171 185
 
172
-					if item.ScheduleDate >= 1704038400 {
173
-						fmt.Println("寄哪里地方阿道夫阿道夫")
174
-						//listOrder, _ := service.GetDialysisOrderCountNight(item.PatientID, item.ScheduleDate)
175
-						//fmt.Println("")
176
-						//item.Count = listOrder.DialysisTotal
186
+					if item.ScheduleDate >= 1735660800 {
177 187
 
178 188
 						listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
179 189
 
@@ -339,8 +349,11 @@ func (this *PrintDataAPIController) GetGoodDetailPrintList() {
339 349
 	start_time := this.GetString("start_time")
340 350
 	end_time := this.GetString("end_time")
341 351
 	storehouse_id, _ := this.GetInt64("storehouse_id")
352
+	good_id, _ := this.GetInt64("good_id")
342 353
 	adminUserInfo := this.GetAdminUserInfo()
343 354
 
355
+	order_way, _ := this.GetInt64("order_way")
356
+
344 357
 	timeLayout := "2006-01-02"
345 358
 	loc, _ := time.LoadLocation("Local")
346 359
 	var startTime int64
@@ -367,7 +380,7 @@ func (this *PrintDataAPIController) GetGoodDetailPrintList() {
367 380
 
368 381
 	//入库详情
369 382
 	if types == 1 {
370
-		list, err := service.GetWarehouseInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page, storehouse_id)
383
+		list, err := service.GetWarehouseInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page, storehouse_id, good_id)
371 384
 		if err != nil {
372 385
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
373 386
 			return
@@ -380,9 +393,9 @@ func (this *PrintDataAPIController) GetGoodDetailPrintList() {
380 393
 	//出库详情
381 394
 	if types == 2 {
382 395
 		//list, err := service.GetWarehouseOutInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
383
-		list, _ := service.GetWarehouseOutInfoPrintList(adminUserInfo.CurrentOrgId, startTime, endTime)
396
+		list, _ := service.GetWarehouseOutInfoPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, good_id, order_way)
384 397
 
385
-		stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, adminUserInfo.CurrentOrgId)
398
+		stockTotal, err := service.GetOutStockTotalCountThree(startTime, endTime, adminUserInfo.CurrentOrgId, good_id)
386 399
 		if err != nil {
387 400
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
388 401
 			return

+ 8 - 1
controllers/schedule_api_controller.go View File

@@ -4859,7 +4859,7 @@ func (c *ScheduleApiController) GetScheduleOne() {
4859 4859
 	}
4860 4860
 
4861 4861
 	//查询排班里面的空透析器
4862
-	if adminInfo.CurrentOrgId == 10375 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 9538 {
4862
+	if adminInfo.CurrentOrgId == 10375 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 9538 || adminInfo.CurrentOrgId == 10742 || adminInfo.CurrentOrgId == 10387 || adminInfo.CurrentOrgId == 10740 {
4863 4863
 
4864 4864
 		schedulesFive, _ := service.GetWeekScheduleFive(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4865 4865
 
@@ -4877,8 +4877,12 @@ func (c *ScheduleApiController) GetScheduleOne() {
4877 4877
 				if len(solution.DialysisIrrigation) > 0 {
4878 4878
 					DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
4879 4879
 				}
4880
+				if len(solution.DialysisStrainer) > 0 {
4881
+					DialysisMachineName = DialysisMachineName + "," + solution.DialysisStrainer
4882
+				}
4880 4883
 				item.DialysisMachineName = DialysisMachineName
4881 4884
 				service.UpdateSchOne(item.ID, item.DialysisMachineName)
4885
+
4882 4886
 			}
4883 4887
 			if item.ScheduleDate < timeNewDate.Unix() {
4884 4888
 				prescriptionList, _ := service.GetDialysisPrescriptionList(item.PatientId, item.UserOrgId, item.ScheduleDate)
@@ -4893,6 +4897,9 @@ func (c *ScheduleApiController) GetScheduleOne() {
4893 4897
 				if len(prescriptionList.DialysisIrrigation) > 0 {
4894 4898
 					DialysisMachineName = DialysisMachineName + "," + prescriptionList.DialysisIrrigation
4895 4899
 				}
4900
+				if len(prescriptionList.DialysisStrainer) > 0 {
4901
+					DialysisMachineName = DialysisMachineName + "," + prescriptionList.DialysisStrainer
4902
+				}
4896 4903
 				item.DialysisMachineName = DialysisMachineName
4897 4904
 				service.UpdateSchOne(item.ID, item.DialysisMachineName)
4898 4905
 			}

+ 2 - 0
controllers/self_drug_api_congtroller.go View File

@@ -4079,6 +4079,8 @@ func (this *SelfDrugApiController) GetPurchaseNewDrugQuery() {
4079 4079
 
4080 4080
 	limit, _ := this.GetInt64("limit")
4081 4081
 
4082
+	fmt.Println("lismt", limit)
4083
+
4082 4084
 	start_time := this.GetString("start_time")
4083 4085
 	end_time := this.GetString("end_time")
4084 4086
 	orgId := this.GetAdminUserInfo().CurrentOrgId

+ 143 - 0
controllers/sign_api_controller.go View File

@@ -1296,6 +1296,149 @@ func (this *SignApiController) ToAutoDiagnose() {
1296 1296
 	//	}
1297 1297
 	//}
1298 1298
 
1299
+	//advice, _ := service.GetDoctorAdviceListByUserOrgId(10740, 1736179200)
1300
+	//
1301
+	//db := service.XTWriteDB()
1302
+	//tx := db.Begin()
1303
+	//defer func() {
1304
+	//	if r := recover(); r != nil {
1305
+	//		tx.Rollback()
1306
+	//	} else {
1307
+	//		tx.Commit()
1308
+	//	}
1309
+	//}()
1310
+	//for _, item := range advice {
1311
+	//
1312
+	//	//查找该患者是否出库了
1313
+	//	outInfo, _ := service.GetSelfDrugWarehouseOutInfo(item.PatientId, item.DrugId, item.AdviceDate)
1314
+	//	if outInfo.ID == 0 {
1315
+	//		timeStr := time.Now().Format("2006-01-02")
1316
+	//		timeArr := strings.Split(timeStr, "-")
1317
+	//		total, _ := service.FindAllSelfDrugWarehouseOut(10740, tx)
1318
+	//
1319
+	//		total = total + 1
1320
+	//		warehousing_out_order := strconv.FormatInt(10740, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
1321
+	//		number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
1322
+	//		number = number + total
1323
+	//		warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
1324
+	//		operation_time := time.Now().Unix()
1325
+	//
1326
+	//		creater := this.GetAdminUserInfo().AdminUser.Id
1327
+	//
1328
+	//		//创建一个出库单
1329
+	//		drugWarehouseOut := models.XtSelfDrugWarehouseOut{
1330
+	//			WarehouseOutOrderNumber: warehousing_out_order,
1331
+	//			OperationTime:           operation_time,
1332
+	//			OrgId:                   10740,
1333
+	//			Creater:                 creater,
1334
+	//			Ctime:                   time.Now().Unix(),
1335
+	//			Status:                  1,
1336
+	//			WarehouseOutTime:        item.AdviceDate,
1337
+	//			Type:                    0,
1338
+	//			PatientId:               item.PatientId,
1339
+	//			IsCheck:                 1,
1340
+	//			IsSys:                   1,
1341
+	//		}
1342
+	//
1343
+	//		//查询今日是否有出库数据
1344
+	//		lastWarehouseOut, _ := service.GetSelfDrugLastWarehouseOutTwety(10740, item.AdviceDate, tx, 1)
1345
+	//
1346
+	//		if lastWarehouseOut.ID == 0 {
1347
+	//			service.AddSelfSigleDrugWarehouseOut(&drugWarehouseOut, tx)
1348
+	//		}
1349
+	//
1350
+	//		//查询今日是否有出库数据
1351
+	//		lastWarehouseOutOne, _ := service.GetSelfDrugLastWarehouseOutTwety(10740, item.AdviceDate, tx, 1)
1352
+	//
1353
+	//		var warehousing_out_order_str string
1354
+	//		if lastWarehouseOut.ID == 0 {
1355
+	//			warehousing_out_order_str = warehousing_out_order
1356
+	//		} else {
1357
+	//			warehousing_out_order_str = lastWarehouseOut.WarehouseOutOrderNumber
1358
+	//		}
1359
+	//
1360
+	//		//查询库存是否
1361
+	//		selfBasedrug, _ := service.GetSelfBasedrugByIdTwo(item.DrugId, item.UserOrgId)
1362
+	//		var prescribing_number_total_one int64
1363
+	//		//判断单位是否相等
1364
+	//		if selfBasedrug.MaxUnit == item.PrescribingNumberUnit && selfBasedrug.MaxUnit != selfBasedrug.MinUnit {
1365
+	//			prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
1366
+	//			count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1367
+	//			//转化为最小单位
1368
+	//			prescribing_number_total_one = count * selfBasedrug.MinNumber
1369
+	//		}
1370
+	//
1371
+	//		if selfBasedrug.MinUnit == item.PrescribingNumberUnit && selfBasedrug.MaxUnit != selfBasedrug.MinUnit {
1372
+	//			prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
1373
+	//			count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1374
+	//			prescribing_number_total_one = count
1375
+	//
1376
+	//		}
1377
+	//
1378
+	//		if selfBasedrug.MinUnit == item.PrescribingNumberUnit && selfBasedrug.MaxUnit == selfBasedrug.MinUnit {
1379
+	//			prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
1380
+	//			count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1381
+	//			prescribing_number_total_one = count
1382
+	//		}
1383
+	//
1384
+	//		//出库
1385
+	//		warehouseOutInfo := &models.XtSelfDrugWarehouseOutInfo{
1386
+	//			WarehouseOutId:          lastWarehouseOutOne.ID,
1387
+	//			WarehouseOutOrderNumber: warehousing_out_order_str,
1388
+	//			DrugId:                  item.DrugId,
1389
+	//			Count:                   prescribing_number_total_one,
1390
+	//			Price:                   0,
1391
+	//			TotalPrice:              0,
1392
+	//			Status:                  1,
1393
+	//			Ctime:                   item.AdviceDate,
1394
+	//			Mtime:                   item.AdviceDate,
1395
+	//			Remark:                  "",
1396
+	//			OrgId:                   item.UserOrgId,
1397
+	//			Type:                    0,
1398
+	//			Manufacturer:            selfBasedrug.Manufacturer,
1399
+	//			Dealer:                  selfBasedrug.Dealer,
1400
+	//			RetailPrice:             0,
1401
+	//			RetailTotalPrice:        0,
1402
+	//			CountUnit:               selfBasedrug.MinUnit,
1403
+	//			ExpiryDate:              0,
1404
+	//			ProductDate:             0,
1405
+	//			Number:                  "",
1406
+	//			BatchNumber:             "",
1407
+	//			IsSys:                   0,
1408
+	//			WarehouseInfoId:         0,
1409
+	//			AdminUserId:             0,
1410
+	//			StockCount:              "",
1411
+	//			IsCheck:                 1,
1412
+	//			SysRecordTime:           item.AdviceDate,
1413
+	//			PatientId:               item.PatientId,
1414
+	//			AdviceId:                item.ID,
1415
+	//			ClassType:               "",
1416
+	//		}
1417
+	//		var warehousingOutInfo []*models.XtSelfDrugWarehouseOutInfo
1418
+	//		warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1419
+	//
1420
+	//		for _, it := range warehousingOutInfo {
1421
+	//
1422
+	//			medical, _ := service.GetSelfBaseDrugMedical(it.DrugId, tx)
1423
+	//			drup, _ := service.FindSelfBaseDrugLibRecord(it.OrgId, it.DrugId, tx)
1424
+	//			//出库逻辑
1425
+	//			service.AutoNewSelfDrugDeliverInfoFourtyTwo(item.UserOrgId, it.Count, &lastWarehouseOut, &drup, it, it.CountUnit, tx)
1426
+	//
1427
+	//			//查询剩余库存
1428
+	//			stockInfo, _ := service.GetSelfDrugAllStockInfo(it.PatientId, it.OrgId, it.DrugId, tx)
1429
+	//			var sum_count int64
1430
+	//			for _, its := range stockInfo {
1431
+	//				if its.MaxUnit == medical.MaxUnit {
1432
+	//					its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1433
+	//				}
1434
+	//				sum_count += its.StockMaxNumber + its.StockMinNumber
1435
+	//			}
1436
+	//			service.UpdateSelfDrugStockCount(it.DrugId, it.OrgId, it.PatientId, sum_count, tx)
1437
+	//		}
1438
+	//	}
1439
+	//}
1440
+	//tx.Commit()
1441
+
1299 1442
 	this.ServeSuccessJSON(map[string]interface{}{
1300 1443
 		"msg": "ok",
1301 1444
 	})

+ 34 - 7
controllers/stock_in_api_controller.go View File

@@ -2957,6 +2957,10 @@ func (this *StockManagerApiController) GetDetailInfo() {
2957 2957
 
2958 2958
 	storehouse_id, _ := this.GetInt64("storehouse_id")
2959 2959
 
2960
+	good_id, _ := this.GetInt64("good_id")
2961
+
2962
+	order_way, _ := this.GetInt64("order_way")
2963
+
2960 2964
 	timeLayout := "2006-01-02"
2961 2965
 	loc, _ := time.LoadLocation("Local")
2962 2966
 	var startTime int64
@@ -2993,9 +2997,12 @@ func (this *StockManagerApiController) GetDetailInfo() {
2993 2997
 	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
2994 2998
 	dealerList, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
2995 2999
 	patientsList, _ := service.GetAllpatient(adminUserInfo.CurrentOrgId)
3000
+	var goodKind = "耗材种类"
3001
+	goodKindParent, _ := service.GetDrugDataConfig(0, goodKind)
3002
+	goodKindList, _ := service.GetParentDataConfig(goodKindParent.ID, adminUserInfo.CurrentOrgId)
2996 3003
 	if types == 1 {
2997
-		list, total, err = service.FindStockInDetailList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
2998
-		_, total_price = service.GetStockInDetailTotal(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3004
+		list, total, err = service.FindStockInDetailList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id, good_id)
3005
+		_, total_price = service.GetStockInDetailTotal(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id, good_id)
2999 3006
 
3000 3007
 		if err == nil {
3001 3008
 			this.ServeSuccessJSON(map[string]interface{}{
@@ -3006,14 +3013,15 @@ func (this *StockManagerApiController) GetDetailInfo() {
3006 3013
 				"manufacturerList": manufacturerList,
3007 3014
 				"dealerList":       dealerList,
3008 3015
 				"patientsList":     patientsList,
3016
+				"goodKindList":     goodKindList,
3009 3017
 			})
3010 3018
 		} else {
3011 3019
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3012 3020
 		}
3013 3021
 
3014 3022
 	} else if types == 2 {
3015
-		list1, total, err = service.FindStockOutDetailList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3016
-		_, total_price = service.GetStockOutDetailTotal(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3023
+		list1, total, err = service.FindStockOutDetailList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id, good_id, order_way)
3024
+		_, total_price = service.GetStockOutDetailTotal(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id, good_id, order_way)
3017 3025
 		if err == nil {
3018 3026
 			this.ServeSuccessJSON(map[string]interface{}{
3019 3027
 				"list":             list1,
@@ -3023,6 +3031,7 @@ func (this *StockManagerApiController) GetDetailInfo() {
3023 3031
 				"manufacturerList": manufacturerList,
3024 3032
 				"dealerList":       dealerList,
3025 3033
 				"patientsList":     patientsList,
3034
+				"goodKindList":     goodKindList,
3026 3035
 			})
3027 3036
 		} else {
3028 3037
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -3037,13 +3046,14 @@ func (this *StockManagerApiController) GetDetailInfo() {
3037 3046
 				"manufacturerList": manufacturerList,
3038 3047
 				"dealerList":       dealerList,
3039 3048
 				"patientsList":     patientsList,
3049
+				"goodKindList":     goodKindList,
3040 3050
 			})
3041 3051
 		} else {
3042 3052
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3043 3053
 		}
3044 3054
 	} else if types == 4 {
3045
-		list3, total, err = service.FindCancelDetailList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3046
-		listGroup, err := service.FindeCancelGroup(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3055
+		list3, total, err = service.FindCancelDetailList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id, good_id)
3056
+		listGroup, err := service.FindeCancelGroup(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id, good_id)
3047 3057
 		if err == nil {
3048 3058
 			this.ServeSuccessJSON(map[string]interface{}{
3049 3059
 				"list":             list3,
@@ -3053,6 +3063,7 @@ func (this *StockManagerApiController) GetDetailInfo() {
3053 3063
 				"manufacturerList": manufacturerList,
3054 3064
 				"dealerList":       dealerList,
3055 3065
 				"patientsList":     patientsList,
3066
+				"goodKindList":     goodKindList,
3056 3067
 			})
3057 3068
 		} else {
3058 3069
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -7413,6 +7424,8 @@ func (this *StockManagerApiController) ReturnCheckWarehouseOut() {
7413 7424
 	// 查询出库数据
7414 7425
 	list, err := service.GetNewWarehouseOutById(id, orgId, tx)
7415 7426
 	for _, item := range list {
7427
+
7428
+		service.ModifyGoodOutInfoLog(item.GoodId, item.ID, tx)
7416 7429
 		//回退库存
7417 7430
 		service.UpdateaNewGoodWarehouseInfo(item.Count, item.GoodId, item.OrgId, item.WarehouseInfotId, tx)
7418 7431
 
@@ -7541,6 +7554,19 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7541 7554
 			//创建出库流水
7542 7555
 			service.CreateNewStockFlowOne(stockFlow, tx)
7543 7556
 
7557
+			infoLog := models.XtGoodWarehouseInfoLog{
7558
+
7559
+				GoodId:          item.GoodId,
7560
+				WarehouseInfoId: item.ID,
7561
+				RecordDate:      time.Now().Unix(),
7562
+				UserOrgId:       item.OrgId,
7563
+				Status:          1,
7564
+				Ctime:           time.Now().Unix(),
7565
+				Mtime:           time.Now().Unix(),
7566
+			}
7567
+
7568
+			service.CreateGoodWarehouseInfoLog(infoLog, tx)
7569
+
7544 7570
 			//查询该仓库是否有数据
7545 7571
 			stockCount, _ := service.GetNewGoodStockCount(orgId, item.StorehouseId, item.GoodId, tx)
7546 7572
 			if stockCount.ID == 0 {
@@ -7625,6 +7651,7 @@ func (this *StockManagerApiController) ReturnCheckWarehouseInfo() {
7625 7651
 	}
7626 7652
 
7627 7653
 	err := service.UpdateNewWarehouseInfoMap(list, warehousing_info_id, orgId, tx)
7654
+
7628 7655
 	tx.Commit()
7629 7656
 	if err == nil {
7630 7657
 		this.ServeSuccessJSON(map[string]interface{}{
@@ -8130,7 +8157,7 @@ func (this *StockManagerApiController) UpdateBaseDrugListByUserOrgID() {
8130 8157
 	//	service.UpdateDealerManufacturerOne(item.ID, manufacturer.ManufacturerName)
8131 8158
 	//}
8132 8159
 
8133
-	drugList, _ := service.GetAllBaseDrugListTwentyOne(10215)
8160
+	drugList, _ := service.GetAllBaseDrugListTwentyOne(10480)
8134 8161
 
8135 8162
 	for _, item := range drugList {
8136 8163
 		var drug_spec = item.Dose + item.DoseUnit + "*" + strconv.FormatInt(item.MinNumber, 10) + item.MinUnit + "/" + item.MaxUnit

+ 3 - 0
enums/error_code.go View File

@@ -289,6 +289,8 @@ const ( // ErrorCode
289 289
 	ErrorCodeAuthWrong = 600000013
290 290
 
291 291
 	ErrorCodeFlow = 600000014
292
+
293
+	ErrorCodePrescription = 600000015
292 294
 )
293 295
 
294 296
 var ErrCodeMsgs = map[int]string{
@@ -555,6 +557,7 @@ var ErrCodeMsgs = map[int]string{
555 557
 	ErrorTimeCodeParamWrong: "时间跨度不能超过一个月",
556 558
 	ErrorCodeAuthWrong:      "尚未实名认证,请先认证",
557 559
 	ErrorCodeFlow:           "网络错误,数据异常,审核失败",
560
+	ErrorCodePrescription:   "请先开处方",
558 561
 }
559 562
 
560 563
 type SGJError struct {

+ 80 - 79
models/good_models.go View File

@@ -238,85 +238,86 @@ func (GoodInfoSevenThirty) TableName() string {
238 238
 }
239 239
 
240 240
 type XtGoodInformationFourty struct {
241
-	ID                          int64   `gorm:"column:id" json:"id" form:"id"`
242
-	GoodCode                    string  `gorm:"column:good_code" json:"good_code" form:"good_code"`
243
-	SpecificationName           string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
244
-	GoodTypeId                  int64   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
245
-	GoodUnit                    int64   `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
246
-	BuyPrice                    float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
247
-	SellPrice                   float64 `gorm:"column:sell_price" json:"sell_price" form:"sell_price"`
248
-	Remark                      string  `gorm:"column:remark" json:"remark" form:"remark"`
249
-	Ctime                       int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
250
-	Mtime                       int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
251
-	Manufacturer                int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
252
-	Dealer                      int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
253
-	ExpiryDateWarnDayCount      int64   `gorm:"column:expiry_date_warn_day_count" json:"expiry_date_warn_day_count" form:"expiry_date_warn_day_count"`
254
-	StockWarnCount              int64   `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
255
-	IsReuse                     int64   `gorm:"column:is_reuse" json:"is_reuse" form:"is_reuse"`
256
-	Status                      int64   `gorm:"column:status" json:"status" form:"status"`
257
-	FilmArea                    string  `gorm:"column:film_area" json:"film_area" form:"film_area"`
258
-	IsUse                       int64   `gorm:"column:is_use" json:"is_use" form:"is_use"`
259
-	FilmMaterialQuality         string  `gorm:"column:film_material_quality" json:"film_material_quality" form:"film_material_quality"`
260
-	OrgId                       int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
261
-	Modifier                    int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
262
-	Creater                     int64   `gorm:"column:creater" json:"creater" form:"creater"`
263
-	GoodName                    string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
264
-	Pinyin                      string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
265
-	Wubi                        string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
266
-	GoodKind                    int64   `gorm:"column:good_kind" json:"good_kind" form:"good_kind"`
267
-	MedicalInsuranceLevel       int64   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
268
-	RetailPrice                 float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
269
-	MedicalInsuranceNumber      string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
270
-	IsSpecialDiseases           int64   `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
271
-	IsRecord                    int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
272
-	StatisticsCategory          int64   `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
273
-	GoodStatus                  string  `gorm:"column:good_status" json:"good_status" form:"good_status"`
274
-	DefaultCount                int64   `gorm:"column:default_count" json:"default_count" form:"default_count"`
275
-	IsDefault                   int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
276
-	IsChargeUse                 int64   `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
277
-	IsChargePredict             int64   `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
278
-	IsStatisticsWork            int64   `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
279
-	Sign                        int64   `gorm:"column:sign" json:"sign" form:"sign"`
280
-	Sort                        int64   `gorm:"column:sort" json:"sort" form:"sort"`
281
-	IsDoctorUse                 int64   `gorm:"column:is_doctor_use" json:"is_doctor_use" form:"is_doctor_use"`
282
-	Agent                       string  `gorm:"column:agent" json:"agent" form:"agent"`
283
-	GoodNumber                  string  `gorm:"column:good_number" json:"good_number" form:"good_number"`
284
-	CommdityCode                string  `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
285
-	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
286
-	ProductionType              string  `gorm:"column:production_type" json:"production_type" form:"production_type"`
287
-	SpecialMedical              string  `gorm:"column:special_medical" json:"special_medical" form:"special_medical"`
288
-	IsMark                      int64   `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
289
-	Total                       float64 `gorm:"column:total" json:"total" form:"total"`
290
-	MinNumber                   int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
291
-	PackingUnit                 string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
292
-	PackingPrice                float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
293
-	DefaultCountUnit            string  `gorm:"column:default_count_unit" json:"default_count_unit" form:"default_count_unit"`
294
-	MinUnit                     string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
295
-	RegisterNumber              string  `gorm:"column:register_number" json:"register_number" form:"register_number"`
296
-	ProvincesCode               string  `gorm:"column:provinces_code" json:"provinces_code" form:"provinces_code"`
297
-	IsUser                      int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
298
-	Number                      string  `gorm:"column:number" json:"number" form:"number"`
299
-	IsWarehouse                 int64   `gorm:"column:is_warehouse" json:"is_warehouse" form:"is_warehouse"`
300
-	BatchRetaiPrice             float64 `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
301
-	SumCount                    int64   `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
302
-	SumInCount                  int64   `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
303
-	TotalCount                  int64   `gorm:"column:total_count" json:"total_count" form:"total_count"`
304
-	SumOutCount                 int64   `gorm:"column:sum_out_count" json:"sum_out_count" form:"sum_out_count"`
305
-	SumCancelCount              int64   `gorm:"column:sum_cancel_count" json:"sum_cancel_count" form:"sum_cancel_count"`
306
-	IsPrint                     int64   `gorm:"column:is_print" json:"is_print" form:"is_print"`
307
-	FirstLetter                 string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
308
-	ZuobiaoId                   string  `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
309
-	Bck01b                      string  `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
310
-	Bby01                       string  `gorm:"column:bby01" json:"bby01" form:"bby01"`
311
-	Bbx01                       string  `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
312
-	TotalCountOne               int64   `gorm:"column:total_count_one" json:"total_count_one" form:"total_count_one"`
313
-	DepartMent                  string  `gorm:"column:depart_ment" json:"depart_ment" form:"depart_ment"`
314
-	DepartMentCode              string  `gorm:"column:depart_ment_code" json:"depart_ment_code" form:"depart_ment_code"`
315
-	TotalCountTwo               int64   `gorm:"column:total_count_two" json:"total_count_two" form:"total_count_two"`
316
-	CodeName                    string  `gorm:"column:code_name" json:"code_name" form:"code_name"`
317
-	OrgName                     string  `gorm:"column:org_name" json:"org_name" form:"org_name"`
318
-	GoodTypeName                string  `gorm:"column:good_type_name" json:"good_type_name" form:"good_type_name"`
319
-	IsShow                      int64   `gorm:"column:is_show" json:"is_show" form:"is_show"`
241
+	ID                          int64     `gorm:"column:id" json:"id" form:"id"`
242
+	GoodCode                    string    `gorm:"column:good_code" json:"good_code" form:"good_code"`
243
+	SpecificationName           string    `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
244
+	GoodTypeId                  int64     `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
245
+	GoodUnit                    int64     `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
246
+	BuyPrice                    float64   `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
247
+	SellPrice                   float64   `gorm:"column:sell_price" json:"sell_price" form:"sell_price"`
248
+	Remark                      string    `gorm:"column:remark" json:"remark" form:"remark"`
249
+	Ctime                       int64     `gorm:"column:ctime" json:"ctime" form:"ctime"`
250
+	Mtime                       int64     `gorm:"column:mtime" json:"mtime" form:"mtime"`
251
+	Manufacturer                int64     `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
252
+	Dealer                      int64     `gorm:"column:dealer" json:"dealer" form:"dealer"`
253
+	ExpiryDateWarnDayCount      int64     `gorm:"column:expiry_date_warn_day_count" json:"expiry_date_warn_day_count" form:"expiry_date_warn_day_count"`
254
+	StockWarnCount              int64     `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
255
+	IsReuse                     int64     `gorm:"column:is_reuse" json:"is_reuse" form:"is_reuse"`
256
+	Status                      int64     `gorm:"column:status" json:"status" form:"status"`
257
+	FilmArea                    string    `gorm:"column:film_area" json:"film_area" form:"film_area"`
258
+	IsUse                       int64     `gorm:"column:is_use" json:"is_use" form:"is_use"`
259
+	FilmMaterialQuality         string    `gorm:"column:film_material_quality" json:"film_material_quality" form:"film_material_quality"`
260
+	OrgId                       int64     `gorm:"column:org_id" json:"org_id" form:"org_id"`
261
+	Modifier                    int64     `gorm:"column:modifier" json:"modifier" form:"modifier"`
262
+	Creater                     int64     `gorm:"column:creater" json:"creater" form:"creater"`
263
+	GoodName                    string    `gorm:"column:good_name" json:"good_name" form:"good_name"`
264
+	Pinyin                      string    `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
265
+	Wubi                        string    `gorm:"column:wubi" json:"wubi" form:"wubi"`
266
+	GoodKind                    int64     `gorm:"column:good_kind" json:"good_kind" form:"good_kind"`
267
+	MedicalInsuranceLevel       int64     `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
268
+	RetailPrice                 float64   `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
269
+	MedicalInsuranceNumber      string    `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
270
+	IsSpecialDiseases           int64     `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
271
+	IsRecord                    int64     `gorm:"column:is_record" json:"is_record" form:"is_record"`
272
+	StatisticsCategory          int64     `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
273
+	GoodStatus                  string    `gorm:"column:good_status" json:"good_status" form:"good_status"`
274
+	DefaultCount                int64     `gorm:"column:default_count" json:"default_count" form:"default_count"`
275
+	IsDefault                   int64     `gorm:"column:is_default" json:"is_default" form:"is_default"`
276
+	IsChargeUse                 int64     `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
277
+	IsChargePredict             int64     `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
278
+	IsStatisticsWork            int64     `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
279
+	Sign                        int64     `gorm:"column:sign" json:"sign" form:"sign"`
280
+	Sort                        int64     `gorm:"column:sort" json:"sort" form:"sort"`
281
+	IsDoctorUse                 int64     `gorm:"column:is_doctor_use" json:"is_doctor_use" form:"is_doctor_use"`
282
+	Agent                       string    `gorm:"column:agent" json:"agent" form:"agent"`
283
+	GoodNumber                  string    `gorm:"column:good_number" json:"good_number" form:"good_number"`
284
+	CommdityCode                string    `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
285
+	SocialSecurityDirectoryCode string    `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
286
+	ProductionType              string    `gorm:"column:production_type" json:"production_type" form:"production_type"`
287
+	SpecialMedical              string    `gorm:"column:special_medical" json:"special_medical" form:"special_medical"`
288
+	IsMark                      int64     `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
289
+	Total                       float64   `gorm:"column:total" json:"total" form:"total"`
290
+	MinNumber                   int64     `gorm:"column:min_number" json:"min_number" form:"min_number"`
291
+	PackingUnit                 string    `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
292
+	PackingPrice                float64   `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
293
+	DefaultCountUnit            string    `gorm:"column:default_count_unit" json:"default_count_unit" form:"default_count_unit"`
294
+	MinUnit                     string    `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
295
+	RegisterNumber              string    `gorm:"column:register_number" json:"register_number" form:"register_number"`
296
+	ProvincesCode               string    `gorm:"column:provinces_code" json:"provinces_code" form:"provinces_code"`
297
+	IsUser                      int64     `gorm:"column:is_user" json:"is_user" form:"is_user"`
298
+	Number                      string    `gorm:"column:number" json:"number" form:"number"`
299
+	IsWarehouse                 int64     `gorm:"column:is_warehouse" json:"is_warehouse" form:"is_warehouse"`
300
+	BatchRetaiPrice             float64   `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
301
+	SumCount                    int64     `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
302
+	SumInCount                  int64     `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
303
+	TotalCount                  int64     `gorm:"column:total_count" json:"total_count" form:"total_count"`
304
+	SumOutCount                 int64     `gorm:"column:sum_out_count" json:"sum_out_count" form:"sum_out_count"`
305
+	SumCancelCount              int64     `gorm:"column:sum_cancel_count" json:"sum_cancel_count" form:"sum_cancel_count"`
306
+	IsPrint                     int64     `gorm:"column:is_print" json:"is_print" form:"is_print"`
307
+	FirstLetter                 string    `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
308
+	ZuobiaoId                   string    `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
309
+	Bck01b                      string    `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
310
+	Bby01                       string    `gorm:"column:bby01" json:"bby01" form:"bby01"`
311
+	Bbx01                       string    `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
312
+	TotalCountOne               int64     `gorm:"column:total_count_one" json:"total_count_one" form:"total_count_one"`
313
+	DepartMent                  string    `gorm:"column:depart_ment" json:"depart_ment" form:"depart_ment"`
314
+	DepartMentCode              string    `gorm:"column:depart_ment_code" json:"depart_ment_code" form:"depart_ment_code"`
315
+	TotalCountTwo               int64     `gorm:"column:total_count_two" json:"total_count_two" form:"total_count_two"`
316
+	CodeName                    string    `gorm:"column:code_name" json:"code_name" form:"code_name"`
317
+	OrgName                     string    `gorm:"column:org_name" json:"org_name" form:"org_name"`
318
+	GoodTypeName                string    `gorm:"column:good_type_name" json:"good_type_name" form:"good_type_name"`
319
+	IsShow                      int64     `gorm:"column:is_show" json:"is_show" form:"is_show"`
320
+	GoodsType                   GoodsType `gorm:"ForeignKey:ID;AssociationForeignKey:GoodTypeId" json:"type"`
320 321
 }
321 322
 
322 323
 func (XtGoodInformationFourty) TableName() string {

+ 62 - 0
models/new_stock_models.go View File

@@ -492,3 +492,65 @@ type DrugFlowTwenty struct {
492 492
 func (DrugFlowTwenty) TableName() string {
493 493
 	return "xt_drug_flow"
494 494
 }
495
+
496
+type XtGoodWarehouseInfoLog struct {
497
+	ID              int64 `gorm:"column:id" json:"id" form:"id"`
498
+	GoodId          int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
499
+	WarehouseInfoId int64 `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
500
+	RecordDate      int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
501
+	UserOrgId       int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
502
+	Status          int64 `gorm:"column:status" json:"status" form:"status"`
503
+	Ctime           int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
504
+	Mtime           int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
505
+}
506
+
507
+func (XtGoodWarehouseInfoLog) TableName() string {
508
+	return "xt_good_warehouse_info_log"
509
+}
510
+
511
+type XtGoodWarehouseOutInfoLog struct {
512
+	ID                 int64 `gorm:"column:id" json:"id" form:"id"`
513
+	UserOrgId          int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
514
+	GoodId             int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
515
+	RecordDate         int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
516
+	WarehouseOutInfoId int64 `gorm:"column:warehouse_out_info_id" json:"warehouse_out_info_id" form:"warehouse_out_info_id"`
517
+	Status             int64 `gorm:"column:status" json:"status" form:"status"`
518
+	Ctime              int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
519
+	Mtime              int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
520
+	BatchNumberId      int64 `gorm:"column:batch_number_id" json:"batch_number_id" form:"batch_number_id"`
521
+}
522
+
523
+func (XtGoodWarehouseOutInfoLog) TableName() string {
524
+	return "xt_good_warehouse_out_info_log"
525
+}
526
+
527
+type XtDrugWarehouseOutInfoLog struct {
528
+	ID                 int64 `gorm:"column:id" json:"id" form:"id"`
529
+	UserOrgId          int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
530
+	DrugId             int64 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
531
+	WarehouseOutInfoId int64 `gorm:"column:warehouse_out_info_id" json:"warehouse_out_info_id" form:"warehouse_out_info_id"`
532
+	RecordDate         int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
533
+	Status             int64 `gorm:"column:status" json:"status" form:"status"`
534
+	Ctime              int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
535
+	Mtime              int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
536
+	BatchNumberId      int64 `gorm:"column:batch_number_id" json:"batch_number_id" form:"batch_number_id"`
537
+}
538
+
539
+func (XtDrugWarehouseOutInfoLog) TableName() string {
540
+	return "xt_drug_warehouse_out_info_log"
541
+}
542
+
543
+type XtDrugWarehouseInfoLog struct {
544
+	ID              int64 `gorm:"column:id" json:"id" form:"id"`
545
+	DrugId          int64 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
546
+	WarehouseInfoId int64 `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
547
+	RecordDate      int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
548
+	UserOrgId       int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
549
+	Status          int64 `gorm:"column:status" json:"status" form:"status"`
550
+	Ctime           int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
551
+	Mtime           int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
552
+}
553
+
554
+func (XtDrugWarehouseInfoLog) TableName() string {
555
+	return "xt_drug_warehouse_info_log"
556
+}

+ 17 - 0
models/patient_models.go View File

@@ -3103,3 +3103,20 @@ func (BtInspection) TableName() string {
3103 3103
 
3104 3104
 	return "xt_inspection"
3105 3105
 }
3106
+
3107
+type XtInspectionOne struct {
3108
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
3109
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
3110
+	OrgId        int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
3111
+	ProjectId    int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
3112
+	ItemId       int64  `gorm:"column:item_id" json:"item_id" form:"item_id"`
3113
+	ItemName     string `gorm:"column:item_name" json:"item_name" form:"item_name"`
3114
+	ProjectName  string `gorm:"column:project_name" json:"project_name" form:"project_name"`
3115
+	InspectType  int64  `gorm:"column:inspect_type" json:"inspect_type" form:"inspect_type"`
3116
+	InspectValue string `gorm:"column:inspect_value" json:"inspect_value" form:"inspect_value"`
3117
+	InspectDate  int64  `gorm:"column:inspect_date" json:"inspect_date" form:"inspect_date"`
3118
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
3119
+	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
3120
+	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
3121
+	Count        int64
3122
+}

+ 83 - 83
models/stock_models.go View File

@@ -143,42 +143,42 @@ func (XtWarehouse) TableName() string {
143 143
 }
144 144
 
145 145
 type WarehousingInfo struct {
146
-	ID                        int64       `gorm:"column:id" json:"id"`
147
-	WarehousingId             int64       `gorm:"column:warehousing_id" json:"warehousing_id"`
148
-	GoodId                    int64       `gorm:"column:good_id" json:"good_id"`
149
-	GoodTypeId                int64       `gorm:"column:good_type_id" json:"good_type_id"`
150
-	Number                    string      `gorm:"column:number" json:"number"`
151
-	ProductDate               int64       `gorm:"column:product_date" json:"product_date"`
152
-	ExpiryDate                int64       `gorm:"column:expiry_date" json:"expiry_date"`
153
-	WarehousingCount          int64       `gorm:"column:warehousing_count" json:"warehousing_count"`
154
-	WarehousingUnit           string      `gorm:"column:warehousing_unit" json:"warehousing_unit"`
155
-	Price                     float64     `gorm:"column:price" json:"price"`
156
-	TotalPrice                float64     `gorm:"column:total_price" json:"total_price"`
157
-	Dealer                    int64       `gorm:"column:dealer" json:"dealer"`
158
-	Manufacturer              int64       `gorm:"column:manufacturer" json:"manufacturer"`
159
-	Remark                    string      `gorm:"column:remark" json:"remark"`
160
-	Ctime                     int64       `gorm:"column:ctime" json:"ctime"`
161
-	Mtime                     int64       `gorm:"column:mtime" json:"mtime"`
162
-	Status                    int64       `gorm:"column:status" json:"status"`
163
-	OrgId                     int64       `gorm:"column:org_id" json:"org_id"`
164
-	IsReturn                  int64       `gorm:"column:is_return" json:"is_return"`
165
-	StockCount                int64       `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
166
-	Warehousing               Warehousing `ForeignKey:WarehousingId json:"warehouse"`
167
-	WarehousingOrder          string      `gorm:"column:warehousing_order" json:"warehousing_order"`
168
-	GoodInfo                  GoodInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
169
-	Type                      int64       `gorm:"column:type" json:"type"`
170
-	LicenseNumber             string      `gorm:"column:license_number" json:"license_number" form:"license_number"`
171
-	WarehouseInfoId           int64       `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
172
-	PackingPrice              float64     `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
173
-	SupplyWarehouseId         int64       `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
174
-	SupplyWarehouseDetailInfo int64       `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
175
-	StorehouseId              int64       `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
176
-	SecondWarehouseInfoId     int64       `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
177
-	IsCheck                   int64       `gorm:"column:is_check" json:"is_check" form:"is_check"`
178
-	RegisterNumber            string      `gorm:"column:register_number" json:"register_number" form:"register_number"`
179
-	ManafacturerName          string      `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
180
-	DealerName                string      `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
181
-	GoodCode                  string      `gorm:"column:good_code" json:"good_code" form:"good_code"`
146
+	ID                        int64                   `gorm:"column:id" json:"id"`
147
+	WarehousingId             int64                   `gorm:"column:warehousing_id" json:"warehousing_id"`
148
+	GoodId                    int64                   `gorm:"column:good_id" json:"good_id"`
149
+	GoodTypeId                int64                   `gorm:"column:good_type_id" json:"good_type_id"`
150
+	Number                    string                  `gorm:"column:number" json:"number"`
151
+	ProductDate               int64                   `gorm:"column:product_date" json:"product_date"`
152
+	ExpiryDate                int64                   `gorm:"column:expiry_date" json:"expiry_date"`
153
+	WarehousingCount          int64                   `gorm:"column:warehousing_count" json:"warehousing_count"`
154
+	WarehousingUnit           string                  `gorm:"column:warehousing_unit" json:"warehousing_unit"`
155
+	Price                     float64                 `gorm:"column:price" json:"price"`
156
+	TotalPrice                float64                 `gorm:"column:total_price" json:"total_price"`
157
+	Dealer                    int64                   `gorm:"column:dealer" json:"dealer"`
158
+	Manufacturer              int64                   `gorm:"column:manufacturer" json:"manufacturer"`
159
+	Remark                    string                  `gorm:"column:remark" json:"remark"`
160
+	Ctime                     int64                   `gorm:"column:ctime" json:"ctime"`
161
+	Mtime                     int64                   `gorm:"column:mtime" json:"mtime"`
162
+	Status                    int64                   `gorm:"column:status" json:"status"`
163
+	OrgId                     int64                   `gorm:"column:org_id" json:"org_id"`
164
+	IsReturn                  int64                   `gorm:"column:is_return" json:"is_return"`
165
+	StockCount                int64                   `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
166
+	Warehousing               Warehousing             `ForeignKey:WarehousingId json:"warehouse"`
167
+	WarehousingOrder          string                  `gorm:"column:warehousing_order" json:"warehousing_order"`
168
+	GoodInfo                  XtGoodInformationFourty `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId"json:"GoodInfo" `
169
+	Type                      int64                   `gorm:"column:type" json:"type"`
170
+	LicenseNumber             string                  `gorm:"column:license_number" json:"license_number" form:"license_number"`
171
+	WarehouseInfoId           int64                   `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
172
+	PackingPrice              float64                 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
173
+	SupplyWarehouseId         int64                   `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
174
+	SupplyWarehouseDetailInfo int64                   `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
175
+	StorehouseId              int64                   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
176
+	SecondWarehouseInfoId     int64                   `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
177
+	IsCheck                   int64                   `gorm:"column:is_check" json:"is_check" form:"is_check"`
178
+	RegisterNumber            string                  `gorm:"column:register_number" json:"register_number" form:"register_number"`
179
+	ManafacturerName          string                  `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
180
+	DealerName                string                  `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
181
+	GoodCode                  string                  `gorm:"column:good_code" json:"good_code" form:"good_code"`
182 182
 }
183 183
 
184 184
 func (WarehousingInfo) TableName() string {
@@ -262,53 +262,53 @@ func (WarehouseOut) TableName() string {
262 262
 }
263 263
 
264 264
 type WarehouseOutInfo struct {
265
-	ID                      int64                `gorm:"column:id" json:"id"`
266
-	WarehouseOutId          int64                `gorm:"column:warehouse_out_id" json:"warehouse_out_id"`
267
-	WarehouseInfotId        int64                `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
268
-	GoodId                  int64                `gorm:"column:good_id" json:"good_id"`
269
-	GoodTypeId              int64                `gorm:"column:good_type_id" json:"good_type_id"`
270
-	WarehousingOutTarget    int64                `gorm:"column:warehousing_out_target" json:"warehousing_out_target"`
271
-	Count                   int64                `gorm:"column:count" json:"count"`
272
-	Price                   float64              `gorm:"column:price" json:"price"`
273
-	TotalPrice              float64              `gorm:"column:total_price" json:"total_price"`
274
-	ProductDate             int64                `gorm:"column:product_date" json:"product_date"`
275
-	ExpiryDate              int64                `gorm:"column:expiry_date" json:"expiry_date"`
276
-	Mtime                   int64                `gorm:"column:mtime" json:"mtime"`
277
-	Ctime                   int64                `gorm:"column:ctime" json:"ctime"`
278
-	Status                  int64                `gorm:"column:status" json:"status"`
279
-	OrgId                   int64                `gorm:"column:org_id" json:"org_id"`
280
-	Remark                  string               `gorm:"column:remark" json:"remark"`
281
-	IsCancel                int64                `gorm:"column:is_cancel" json:"is_cancel"`
282
-	WarehouseOut            WarehouseOut         `ForeignKey:WarehouseOutId json:"WarehouseOut"`
283
-	WarehouseOutOrderNumber string               `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number"`
284
-	GoodInfo                GoodInfo             `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
285
-	Type                    int64                `gorm:"column:type" json:"type"`
286
-	Dealer                  int64                `gorm:"column:dealer" json:"dealer"`
287
-	Manufacturer            int64                `gorm:"column:manufacturer" json:"manufacturer"`
288
-	IsSys                   int64                `gorm:"column:is_sys" json:"is_sys"`
289
-	SysRecordTime           int64                `gorm:"column:sys_record_time" json:"sys_record_time"`
290
-	PatientId               int64                `gorm:"column:patient_id" json:"patient_id"`
291
-	Number                  string               `gorm:"column:number" json:"number" form:"number"`
292
-	LicenseNumber           string               `gorm:"column:license_number" json:"license_number" form:"license_number"`
293
-	ConsumableType          int64                `gorm:"column:consumable_type" json:"consumable_type" form:"consumable_type"`
294
-	ProjectId               int64                `gorm:"column:project_id" json:"project_id" form:"project_id"`
295
-	SupplyCancelOutId       int64                `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
296
-	SupplyWarehouseId       int64                `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
297
-	IsSource                int64                `gorm:"column:is_source" json:"is_source" form:"is_source"`
298
-	StorehouseId            int64                `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
299
-	SecondWarehouseInfoId   int64                `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
300
-	AdminUserId             int64                `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
301
-	BuyPrice                float64              `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
302
-	StockCount              string               `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
303
-	IsCheck                 int64                `gorm:"column:is_check" json:"is_check" form:"is_check"`
304
-	RegisterNumber          string               `gorm:"column:register_number" json:"register_number" form:"register_number"`
305
-	WarehousingInfo         WarehousingInfo      `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseInfotId" `
306
-	VmStockFlow             VmStockFlow          `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseOutDetailId" json:"stock_flow"`
307
-	OverCount               int64                `gorm:"column:over_count" json:"over_count" form:"over_count"`
308
-	OrderId                 int64                `gorm:"column:order_id" json:"order_id" form:"order_id"`
309
-	WarehousingInfoNight    WarehousingInfoNight `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseInfotId"`
310
-	DealerName              string               `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
311
-	ClassType               string               `gorm:"column:class_type" json:"class_type" form:"class_type"`
265
+	ID                      int64                   `gorm:"column:id" json:"id"`
266
+	WarehouseOutId          int64                   `gorm:"column:warehouse_out_id" json:"warehouse_out_id"`
267
+	WarehouseInfotId        int64                   `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
268
+	GoodId                  int64                   `gorm:"column:good_id" json:"good_id"`
269
+	GoodTypeId              int64                   `gorm:"column:good_type_id" json:"good_type_id"`
270
+	WarehousingOutTarget    int64                   `gorm:"column:warehousing_out_target" json:"warehousing_out_target"`
271
+	Count                   int64                   `gorm:"column:count" json:"count"`
272
+	Price                   float64                 `gorm:"column:price" json:"price"`
273
+	TotalPrice              float64                 `gorm:"column:total_price" json:"total_price"`
274
+	ProductDate             int64                   `gorm:"column:product_date" json:"product_date"`
275
+	ExpiryDate              int64                   `gorm:"column:expiry_date" json:"expiry_date"`
276
+	Mtime                   int64                   `gorm:"column:mtime" json:"mtime"`
277
+	Ctime                   int64                   `gorm:"column:ctime" json:"ctime"`
278
+	Status                  int64                   `gorm:"column:status" json:"status"`
279
+	OrgId                   int64                   `gorm:"column:org_id" json:"org_id"`
280
+	Remark                  string                  `gorm:"column:remark" json:"remark"`
281
+	IsCancel                int64                   `gorm:"column:is_cancel" json:"is_cancel"`
282
+	WarehouseOut            WarehouseOut            `ForeignKey:WarehouseOutId json:"WarehouseOut"`
283
+	WarehouseOutOrderNumber string                  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number"`
284
+	GoodInfo                XtGoodInformationFourty `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId"json:"GoodInfo" `
285
+	Type                    int64                   `gorm:"column:type" json:"type"`
286
+	Dealer                  int64                   `gorm:"column:dealer" json:"dealer"`
287
+	Manufacturer            int64                   `gorm:"column:manufacturer" json:"manufacturer"`
288
+	IsSys                   int64                   `gorm:"column:is_sys" json:"is_sys"`
289
+	SysRecordTime           int64                   `gorm:"column:sys_record_time" json:"sys_record_time"`
290
+	PatientId               int64                   `gorm:"column:patient_id" json:"patient_id"`
291
+	Number                  string                  `gorm:"column:number" json:"number" form:"number"`
292
+	LicenseNumber           string                  `gorm:"column:license_number" json:"license_number" form:"license_number"`
293
+	ConsumableType          int64                   `gorm:"column:consumable_type" json:"consumable_type" form:"consumable_type"`
294
+	ProjectId               int64                   `gorm:"column:project_id" json:"project_id" form:"project_id"`
295
+	SupplyCancelOutId       int64                   `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
296
+	SupplyWarehouseId       int64                   `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
297
+	IsSource                int64                   `gorm:"column:is_source" json:"is_source" form:"is_source"`
298
+	StorehouseId            int64                   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
299
+	SecondWarehouseInfoId   int64                   `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
300
+	AdminUserId             int64                   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
301
+	BuyPrice                float64                 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
302
+	StockCount              string                  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
303
+	IsCheck                 int64                   `gorm:"column:is_check" json:"is_check" form:"is_check"`
304
+	RegisterNumber          string                  `gorm:"column:register_number" json:"register_number" form:"register_number"`
305
+	WarehousingInfo         WarehousingInfo         `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseInfotId" `
306
+	VmStockFlow             VmStockFlow             `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseOutDetailId" json:"stock_flow"`
307
+	OverCount               int64                   `gorm:"column:over_count" json:"over_count" form:"over_count"`
308
+	OrderId                 int64                   `gorm:"column:order_id" json:"order_id" form:"order_id"`
309
+	WarehousingInfoNight    WarehousingInfoNight    `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseInfotId"`
310
+	DealerName              string                  `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
311
+	ClassType               string                  `gorm:"column:class_type" json:"class_type" form:"class_type"`
312 312
 }
313 313
 
314 314
 func (WarehouseOutInfo) TableName() string {

+ 3 - 3
service/dialysis_parameter_service.go View File

@@ -122,12 +122,12 @@ func GetDialysisParameter(orgID int64, schedulDate int64, schedulType int64, par
122 122
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, schedulDate).
123 123
 		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
124 124
 		Preload("DialysisSolution", "status=1 and user_org_id = ? and solution_status = 1", orgID)
125
-	db = db.Where("xt_schedule.status = 1 AND user_org_id = ?", orgID)
125
+	db = db.Where("xt_schedule.status = 1 AND xt_schedule.user_org_id = ?", orgID)
126 126
 	if schedulDate > 0 {
127
-		db = db.Where("schedule_date = ?", schedulDate)
127
+		db = db.Where("xt_schedule.schedule_date = ?", schedulDate)
128 128
 	}
129 129
 	if schedulType > 0 {
130
-		db = db.Where("schedule_type = ?", schedulType)
130
+		db = db.Where("xt_schedule.schedule_type = ?", schedulType)
131 131
 	}
132 132
 	if partitionType > 0 {
133 133
 		db = db.Joins("inner join xt_device_number on xt_device_number.id = xt_schedule.bed_id and xt_device_number.zone_id = ? and xt_device_number.status = 1", partitionType)

+ 23 - 0
service/dialysis_service.go View File

@@ -1613,6 +1613,22 @@ func ModifyHisPrescriptionProject(m *models.HisPrescriptionProject, ids []string
1613 1613
 	return err
1614 1614
 }
1615 1615
 
1616
+func GetHisPrescriptionProjectByIds(ids []string) (project []*models.HisPrescriptionProject, err error) {
1617
+
1618
+	err = readDb.Where("id IN(?) and status=1", ids).Find(&project).Error
1619
+
1620
+	return project, err
1621
+}
1622
+
1623
+func ModfifyProjectListByIds(id int64, exeTime int64, record_date int64, patient_id int64) (models.HisPrescriptionProject, error) {
1624
+
1625
+	project := models.HisPrescriptionProject{}
1626
+
1627
+	err := writeDb.Model(&project).Where("team_id = ? and status=1 and execution_state = 1 and record_date = ? and patient_id=?", id, record_date, patient_id).Updates(map[string]interface{}{"execution_time": exeTime}).Error
1628
+
1629
+	return project, err
1630
+}
1631
+
1616 1632
 func FindHisProjectById(orgID int64, id int64) (advice models.HisPrescriptionProject, err error) {
1617 1633
 	err = readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id=? and status=1 and id = ?", orgID, id).First(&advice).Error
1618 1634
 	return
@@ -2167,6 +2183,13 @@ func GetTodayInforMation(orgid int64, record_date int64) (list []*NewDeviceInfor
2167 2183
 	return list, err
2168 2184
 }
2169 2185
 
2186
+func GetDialysisSolutionByDate(org_id int64) (solution []*models.DialysisSolution, err error) {
2187
+
2188
+	err = XTReadDB().Where("user_org_id = ? and solution_status = 1 and status=1", org_id).Find(&solution).Error
2189
+
2190
+	return solution, err
2191
+}
2192
+
2170 2193
 func GetFiledConfig(orgid int64) (models.FiledConfig, error) {
2171 2194
 
2172 2195
 	config := models.FiledConfig{}

+ 1 - 0
service/dialysis_solution_service.go View File

@@ -601,6 +601,7 @@ func GetHisDialysisGoodCountTwo(orgID int64, schedule_type int64, partition_id [
601 601
 		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
602 602
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
603 603
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
604
+		Preload("DialysisSolution", "status=1 and user_org_id =? and solution_status =1", orgID).
604 605
 		Preload("HisPrescriptionTemplateSix", func(db *gorm.DB) *gorm.DB {
605 606
 			return db.Where("user_org_id = ? and status = 1", orgID).Preload("HisPrescriptionInfoTemplateSix", func(db *gorm.DB) *gorm.DB {
606 607
 				return db.Where("user_org_id = ? and status = 1 and type = 2", orgID).Preload("HisPrescriptionProjectTemplateSeven", func(db *gorm.DB) *gorm.DB {

+ 14 - 2
service/drug_stock_service.go View File

@@ -194,7 +194,7 @@ func GetDrugCancelExportList(orderid []string, orgid int64) (info []*models.Drug
194 194
 	return info, err
195 195
 }
196 196
 
197
-func GetDrugWarehouseInfoPrint(startime int64, endtime int64, orgid int64, storehouse_id int64) (info []*models.XtDrugWarehouseInfo, err error) {
197
+func GetDrugWarehouseInfoPrint(startime int64, endtime int64, orgid int64, storehouse_id int64, drug_id int64) (info []*models.XtDrugWarehouseInfo, err error) {
198 198
 
199 199
 	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1")
200 200
 	if startime > 0 {
@@ -209,6 +209,9 @@ func GetDrugWarehouseInfoPrint(startime int64, endtime int64, orgid int64, store
209 209
 	if storehouse_id > 0 {
210 210
 		db = db.Where("storehouse_id =?", storehouse_id)
211 211
 	}
212
+	if drug_id > 0 {
213
+		db = db.Where("drug_id = ?", drug_id)
214
+	}
212 215
 	err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,sum(x.warehousing_count) as warehousing_count,x.price,x.total_price,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.warehouseing_unit,x.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.batch_number,x.dealer,x.manufacturer").Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Group("x.drug_id").Find(&info).Error
213 216
 
214 217
 	//err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,sum(x.warehousing_count) as warehousing_count,x.price,x.total_price,x.dealer,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.warehouseing_unit,x.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.batch_number").Group("x.drug_id").Find(&DrugWarehouseInfo{}).Error
@@ -264,7 +267,7 @@ func GetDrugOutOrderPrintList(startime int64, endtime int64, orgid int64) (list
264 267
 	return list, err
265 268
 }
266 269
 
267
-func GetDrugOutOrderInfoPrintList(startime int64, endtime int64, orgid int64, storehouse_id int64) (list []*models.SgjDrugWarehouseOutInfo, err error) {
270
+func GetDrugOutOrderInfoPrintList(startime int64, endtime int64, orgid int64, storehouse_id int64, drug_id int64, order_way int64) (list []*models.SgjDrugWarehouseOutInfo, err error) {
268 271
 
269 272
 	db := XTReadDB().Table("xt_drug_warehouse_out_info").Where("status = 1 and is_check=1")
270 273
 	if startime > 0 {
@@ -279,6 +282,15 @@ func GetDrugOutOrderInfoPrintList(startime int64, endtime int64, orgid int64, st
279 282
 	if storehouse_id > 0 {
280 283
 		db = db.Where("storehouse_id=?", storehouse_id)
281 284
 	}
285
+	if drug_id > 0 {
286
+		db = db.Where("drug_id = ?", drug_id)
287
+	}
288
+	if order_way == 1 {
289
+		db = db.Where("is_sys !=1")
290
+	}
291
+	if order_way == 2 {
292
+		db = db.Where("is_sys = 1")
293
+	}
282 294
 	err = db.Preload("XtDrugWarehouseInfo", "status=1 and org_id =?", orgid).Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Find(&list).Error
283 295
 	return list, err
284 296
 }

+ 24 - 4
service/gobal_config_service.go View File

@@ -317,7 +317,7 @@ func GetExportHisOrderListBySetlTIME(user_org_id int64, start_time string, end_t
317 317
 	return
318 318
 }
319 319
 
320
-func GetDrugInOrderDetail(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64, storehouse_id int64) (drugInfo []*models.BloodDrugWarehouseInfo, total int64, err error) {
320
+func GetDrugInOrderDetail(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64, storehouse_id int64, drug_id int64) (drugInfo []*models.BloodDrugWarehouseInfo, total int64, err error) {
321 321
 
322 322
 	likeKey := "%" + keyword + "%"
323 323
 	offset := (page - 1) * limit
@@ -341,6 +341,9 @@ func GetDrugInOrderDetail(startime int64, endtime int64, orgid int64, orderType
341 341
 	if storehouse_id > 0 {
342 342
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
343 343
 	}
344
+	if drug_id > 0 {
345
+		db = db.Where("x.drug_id = ?", drug_id)
346
+	}
344 347
 
345 348
 	if len(keyword) > 0 {
346 349
 		db = db.Joins("left join sgj_xt.xt_drug_warehouse as o on o.id = x.warehousing_id  left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = o.creater")
@@ -392,7 +395,7 @@ func GetDrugReturnOrder(startime int64, endtime int64, orgid int64, orderType in
392 395
 	return returninfo, total, err
393 396
 }
394 397
 
395
-func GetDrugOutOrder(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64, storehouse_id int64) (outinfo []*models.BloodDrugWarehouseOutInfo, total int64, err error) {
398
+func GetDrugOutOrder(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64, storehouse_id int64, drug_id int64, order_way int64) (outinfo []*models.BloodDrugWarehouseOutInfo, total int64, err error) {
396 399
 
397 400
 	likeKey := "%" + keyword + "%"
398 401
 	offset := (page - 1) * limit
@@ -419,6 +422,16 @@ func GetDrugOutOrder(startime int64, endtime int64, orgid int64, orderType int64
419 422
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
420 423
 	}
421 424
 
425
+	if drug_id > 0 {
426
+		db = db.Where("x.drug_id = ?", drug_id)
427
+	}
428
+	if order_way == 1 {
429
+		db = db.Where("x.is_sys!=1")
430
+	}
431
+	if order_way == 2 {
432
+		db = db.Where("x.is_sys=1")
433
+	}
434
+
422 435
 	if len(keyword) > 0 {
423 436
 		db = db.Joins("left join sgj_xt.xt_drug_warehouse_out as o on o.id = x.warehouse_out_id  left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = o.creater").Group("x.id")
424 437
 		db = db.Where("x.warehouse_out_order_number like ? or b.drug_name like ?  or r.user_name like ?", likeKey, likeKey, likeKey)
@@ -434,7 +447,7 @@ func GetDrugOutOrder(startime int64, endtime int64, orgid int64, orderType int64
434 447
 	return outinfo, total, err
435 448
 }
436 449
 
437
-func GetDrugCancelOrderPrint(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, storehouse_id int64) (info []*models.BloodDrugCancelStockInfo, err error) {
450
+func GetDrugCancelOrderPrint(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, storehouse_id int64, drug_id int64) (info []*models.BloodDrugCancelStockInfo, err error) {
438 451
 	likeKey := "%" + keyword + "%"
439 452
 	db := XTReadDB().Table("xt_drug_cancel_stock_info as x").Where("x.status =1")
440 453
 	dbOne := XTReadDB().Table("xt_base_drug as s").Where("s.status =1")
@@ -459,6 +472,10 @@ func GetDrugCancelOrderPrint(startime int64, endtime int64, orgid int64, orderTy
459 472
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
460 473
 	}
461 474
 
475
+	if drug_id > 0 {
476
+		db = db.Where("x.drug_id = ?", drug_id)
477
+	}
478
+
462 479
 	if manufacturerId > 0 {
463 480
 		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,s.dealer,s.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Where("t.manufacturer = ?", manufacturerId).Order("x.ctime desc").Group("x.drug_id").Scan(&info).Error
464 481
 	} else {
@@ -468,7 +485,7 @@ func GetDrugCancelOrderPrint(startime int64, endtime int64, orgid int64, orderTy
468 485
 	return info, err
469 486
 }
470 487
 
471
-func GetDrugCancelOrder(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64, storehouse_id int64) (cancel []*models.BloodDrugCancelStockInfo, total int64, err error) {
488
+func GetDrugCancelOrder(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64, storehouse_id int64, drug_id int64) (cancel []*models.BloodDrugCancelStockInfo, total int64, err error) {
472 489
 
473 490
 	likeKey := "%" + keyword + "%"
474 491
 	offset := (page - 1) * limit
@@ -491,6 +508,9 @@ func GetDrugCancelOrder(startime int64, endtime int64, orgid int64, orderType in
491 508
 	if storehouse_id > 0 {
492 509
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
493 510
 	}
511
+	if drug_id > 0 {
512
+		db = db.Where("x.drug_id = ?", drug_id)
513
+	}
494 514
 	if len(keyword) > 0 {
495 515
 		db = db.Joins("left join sgj_xt.xt_drug_cancel_stock as o on o.id = x.cancel_stock_id  left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = o.creater").Group("o.id")
496 516
 

+ 9 - 0
service/inspection_service.go View File

@@ -368,6 +368,15 @@ func GetInspectionGroup(patient_id int64, org_id int64) (inspection []*models.Ne
368 368
 	return inspection, err
369 369
 }
370 370
 
371
+func GetInspectionGroupOne(org_id int64) (inspection []*models.XtInspectionOne, err error) {
372
+
373
+	//XTReadDB().Model(&inspection).Where("(org_id = ? or org_id = 0) and status=1", patient_id, org_id).Find()
374
+
375
+	err = readDb.Raw("SELECT r.project_name,r.project_id,x.inspect_date FROM xt_inspection as x LEFT JOIN xt_inspection_reference as r on r.project_id = x.project_id WHERE (x.org_id = ? or x.org_id = 0) and x.project_id >0 GROUP BY r.project_id ", org_id).Scan(&inspection).Error
376
+
377
+	return inspection, err
378
+}
379
+
371 380
 func GetLastInspectionProject(patient_id int64, org_id int64, project_id int64) (models.XtInspection, error) {
372 381
 
373 382
 	inspection := models.XtInspection{}

+ 1 - 0
service/mobile_dialysis_service.go View File

@@ -130,6 +130,7 @@ type MDialysisScheduleVM struct {
130 130
 	Advices                  []*VMDoctorAdvice                 `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
131 131
 	TreatmentSummary         *VMTreatmentSummary               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatment_summary"`
132 132
 	NewDeviceInformation     *NewDeviceInformation             `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"device_information"`
133
+	DialysisSolution         *models.DialysisSolution          `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
133 134
 }
134 135
 
135 136
 func (MDialysisScheduleVM) TableName() string {

+ 37 - 8
service/new_warehouse_service.go View File

@@ -602,6 +602,18 @@ func UpdateNewDrugStockCount(drug_id int64, org_id int64, storehouse_id int64, f
602 602
 	return err
603 603
 }
604 604
 
605
+func UpdateDrugWarehouseOutInfoLog(id int64, drug_id int64, tx *gorm.DB) (models.XtDrugWarehouseOutInfoLog, error) {
606
+
607
+	outInfoLog := models.XtDrugWarehouseOutInfoLog{}
608
+
609
+	err := tx.Model(&outInfoLog).Where("warehouse_out_info_id = ? and drug_id = ? and status=1", id, drug_id).Update(map[string]interface{}{"status": 0}).Error
610
+	if err != nil {
611
+		tx.Rollback()
612
+		return outInfoLog, err
613
+	}
614
+	return outInfoLog, err
615
+}
616
+
605 617
 func AddDrugCount(drug_id int64, org_id int64, storehouse_id int64, out_count int64) error {
606 618
 
607 619
 	ut := XTWriteDB().Begin()
@@ -4496,19 +4508,21 @@ func HisStoryBloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, war
4496 4508
 
4497 4509
 	if lastWarehouse.MaxUnit != lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
4498 4510
 		if lastWarehouse.StockMinNumber >= drup.MinNumber {
4511
+			fmt.Println("hahhahahahahhaah")
4499 4512
 			var stockMax int64
4500 4513
 			var stockMin int64
4501 4514
 			stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
4502 4515
 			stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
4503 4516
 
4504 4517
 			ChangeNewMaxNumber(lastWarehouse.ID, stockMax, tx)
4518
+
4505 4519
 			UpdateNewMinNumber(lastWarehouse.ID, stockMin, tx)
4506 4520
 
4507 4521
 		}
4508 4522
 	}
4509 4523
 
4510 4524
 	if lastWarehouse.MaxUnit == lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
4511
-
4525
+		fmt.Println("ooowowowowowowowowowo")
4512 4526
 		lastWarehouse.StockMaxNumber = lastWarehouse.StockMaxNumber + lastWarehouse.StockMinNumber
4513 4527
 		ChangeNewMaxNumberOne(lastWarehouse.ID, lastWarehouse.StockMaxNumber, tx)
4514 4528
 
@@ -4533,8 +4547,8 @@ func HisStoryBloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, war
4533 4547
 
4534 4548
 	}
4535 4549
 
4536
-	//fmt.Println("stock_number", stock_number)
4537
-	//fmt.Println("deliver_number=============", deliver_number)
4550
+	fmt.Println("stock_number", stock_number)
4551
+	fmt.Println("deliver_number=============", deliver_number)
4538 4552
 	// 当库存数量大于或等于出库数量的话,则正常出库该批次
4539 4553
 	if stock_number >= deliver_number {
4540 4554
 
@@ -4544,6 +4558,9 @@ func HisStoryBloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, war
4544 4558
 		maxNumber = deliver_number / drup.MinNumber
4545 4559
 		minNumber = deliver_number % drup.MinNumber
4546 4560
 
4561
+		fmt.Println("max_Number=====================", maxNumber)
4562
+		fmt.Println("minNumber=====================", minNumber)
4563
+
4547 4564
 		if warehouse.StockMaxNumber == 0 && drup.MaxUnit == drup.MinUnit {
4548 4565
 			minNumber = maxNumber
4549 4566
 		}
@@ -4556,15 +4573,18 @@ func HisStoryBloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, war
4556 4573
 
4557 4574
 		if drup.MinUnit == warehouse.MaxUnit && drup.MaxUnit != drup.MinUnit {
4558 4575
 
4576
+			fmt.Println("金1")
4577
+
4559 4578
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber*drup.MinNumber
4560 4579
 		}
4561 4580
 
4562 4581
 		if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit != drup.MinUnit {
4563
-
4582
+			fmt.Println("jin2")
4564 4583
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
4565 4584
 		}
4566
-		if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit == drup.MinUnit {
4567 4585
 
4586
+		if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit == drup.MinUnit {
4587
+			fmt.Println("jin3")
4568 4588
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
4569 4589
 		}
4570 4590
 
@@ -4577,11 +4597,20 @@ func HisStoryBloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, war
4577 4597
 
4578 4598
 		warehouse.Mtime = time.Now().Unix()
4579 4599
 
4580
-		//fmt.Println("hahhahahah", warehouse.StockMinNumber)
4581
-		//fmt.Println("howowowoowow", minNumber)
4600
+		fmt.Println("hahhahahah", warehouse.StockMinNumber)
4601
+		fmt.Println("howowowoowow", minNumber)
4582 4602
 		if warehouse.StockMinNumber < minNumber {
4583 4603
 
4584
-			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
4604
+			if warehouse.MaxUnit != warehouse.MinUnit {
4605
+				//改动的地方
4606
+				warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
4607
+			}
4608
+
4609
+			if warehouse.MaxUnit == warehouse.MinUnit {
4610
+				//改动的地方
4611
+				warehouse.StockMaxNumber = warehouse.StockMaxNumber - minNumber
4612
+			}
4613
+
4585 4614
 			if warehouse.MaxUnit != warehouse.MinUnit {
4586 4615
 				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
4587 4616
 			}

+ 14 - 5
service/patient_service.go View File

@@ -83,11 +83,11 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
83 83
 
84 84
 	}
85 85
 	if lapseto != 2 && lapseto != 3 {
86
-		if orgID != 10579 && orgID != 10600 && orgID != 10587 {
86
+		if orgID != 10579 && orgID != 10600 && orgID != 10587 && orgID != 10745 {
87 87
 			err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious,p.patient_type").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
88 88
 		}
89 89
 
90
-		if orgID == 10579 || orgID == 10600 {
90
+		if orgID == 10579 || orgID == 10600 || orgID == 10745 {
91 91
 			err = db.Order("p.dialysis_no asc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious,p.patient_type").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
92 92
 		}
93 93
 
@@ -1921,6 +1921,15 @@ func UpdatePatientDialysisPrscription(id int64, dewater_amount float64) (models.
1921 1921
 	return prescription, err
1922 1922
 }
1923 1923
 
1924
+func UpdatePatientDialysisPrscriptionOne(id int64, dewater_amount float64) (models.XtDialysisPrescription, error) {
1925
+
1926
+	prescription := models.XtDialysisPrescription{}
1927
+
1928
+	err := XTWriteDB().Model(&prescription).Where("id = ? and status =1", id).Update(map[string]interface{}{"target_ultrafiltration": dewater_amount}).Error
1929
+
1930
+	return prescription, err
1931
+}
1932
+
1924 1933
 func FindLastDryWeightAdjust(orgID int64, id int64) (weight models.SgjPatientDryweight, err error) {
1925 1934
 	err = readDb.Model(&models.SgjPatientDryweight{}).Where("user_org_id=? and patient_id=? and status=1", orgID, id).Order("id desc").First(&weight).Error
1926 1935
 	return
@@ -4602,7 +4611,7 @@ func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64,
4602 4611
 	if org_id > 0 {
4603 4612
 		db = db.Where("user_org_id = ?", org_id)
4604 4613
 	}
4605
-	err = db.Find(&berfor).Error
4614
+	err = db.Order("assessment_date asc").Find(&berfor).Error
4606 4615
 	return berfor, err
4607 4616
 }
4608 4617
 
@@ -4632,7 +4641,7 @@ func GetLastAfterWeight(patient_id int64, assessment_date int64, user_org_id int
4632 4641
 
4633 4642
 	afterDislysis := models.XtAssessmentAfterDislysis{}
4634 4643
 
4635
-	err := XTReadDB().Where("patient_id = ? and assessment_date <? and user_org_id =? and status=1", patient_id, assessment_date, user_org_id).Order("assessment_date asc").Last(&afterDislysis).Error
4644
+	err := XTReadDB().Where("patient_id = ? and assessment_date = ? and user_org_id =? and status=1", patient_id, assessment_date, user_org_id).Order("assessment_date asc").Last(&afterDislysis).Error
4636 4645
 
4637 4646
 	return afterDislysis, err
4638 4647
 }
@@ -4684,7 +4693,7 @@ func GetAutoPatientDryWeight(patient_id int64, start_time int64, end_time int64,
4684 4693
 func GetPatientLastDryWeightObj(patient_id int64, start_time int64, end_time int64, org_id int64) (models.SgjPatientDryweight, error) {
4685 4694
 
4686 4695
 	dryweight := models.SgjPatientDryweight{}
4687
-	err := XTReadDB().Where("patient_id =? and user_org_id = ? and status=1", patient_id, org_id).Order("id asc").Last(&dryweight).Error
4696
+	err := XTReadDB().Where("patient_id =? and user_org_id = ? and status=1", patient_id, org_id, start_time, end_time).Order("id asc").Last(&dryweight).Error
4688 4697
 	return dryweight, err
4689 4698
 }
4690 4699
 

+ 2 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go View File

@@ -112,6 +112,7 @@ type DialysisOrderVM struct {
112 112
 	PunctureNeedle     string          `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
113 113
 	BloodDrawing       int64           `gorm:"column:blood_drawing" json:"blood_drawing" form:"blood_drawing"`
114 114
 	DialysisStrainer   string          `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
115
+	ChangeNurse        int64           `gorm:"column:change_nurse" json:"change_nurse" form:"change_nurse"`
115 116
 }
116 117
 
117 118
 func (DialysisOrderVM) TableName() string {
@@ -311,6 +312,7 @@ type AssessmentBeforeDislysisVM struct {
311 312
 	LienNecessary                  int64   `gorm:"column:lien_necessary" json:"lien_necessary" form:"lien_necessary"`
312 313
 	PathwayFormationTime           int64   `gorm:"column:pathway_formation_time" json:"pathway_formation_time" form:"pathway_formation_time"`
313 314
 	PunctureNeedleDirection        string  `gorm:"column:puncture_needle_direction" json:"puncture_needle_direction" form:"puncture_needle_direction"`
315
+	BeforSymptoms                  string  `gorm:"column:befor_symptoms" json:"befor_symptoms" form:"befor_symptoms"`
314 316
 }
315 317
 
316 318
 func (AssessmentBeforeDislysisVM) TableName() string {

+ 42 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go View File

@@ -234,6 +234,19 @@ func GetDialysisOrderCountTen(patient_id int64, recordDate int64) (models.VmDial
234 234
 //	return
235 235
 //}
236 236
 
237
+func GetDialysisOrderCountNewTen(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
238
+
239
+	order := models.VmDialysisOrder{}
240
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1640966400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
241
+	return order, err
242
+}
243
+
244
+func GetDialysisOrderCountTwenty(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
245
+	order := models.VmDialysisOrder{}
246
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1672502400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
247
+	return order, err
248
+}
249
+
237 250
 func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
238 251
 	order := models.VmDialysisOrder{}
239 252
 	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1704038400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
@@ -253,6 +266,19 @@ func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoM
253 266
 	return autoMatic, err
254 267
 }
255 268
 
269
+func GetOutStockTotalCountThree(startime int64, endtime int64, orgid int64, good_id int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
270
+
271
+	db := p_service.XTReadDB()
272
+
273
+	if good_id > 0 {
274
+		err = db.Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and x.`status` = 1 and x.good_id=?)  as b GROUP BY good_id", orgid, startime, endtime, good_id).Scan(&autoMatic).Error
275
+	} else {
276
+		err = db.Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and x.`status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error
277
+	}
278
+
279
+	return autoMatic, err
280
+}
281
+
256 282
 func GetCoutWareseOutInfo(startime int64, endtime int64, orgid int64) (houseOutInfo []*models.VmWarehouseOutInfo, err error) {
257 283
 
258 284
 	db := p_service.XTReadDB().Table("xt_warehouse_out_info as x").Where("x.status  =1")
@@ -266,11 +292,16 @@ func GetGoodInfomationList(orgid int64) (goodInfo []*models.GoodInfo, err error)
266 292
 	return goodInfo, err
267 293
 }
268 294
 
269
-func GetWarehouseInfoGoodDetailPrintList(orgid int64, startime int64, endtime int64, limit int64, page int64, storehouse_id int64) (info []*models.VmWarehousingInfo, err error) {
295
+func GetWarehouseInfoGoodDetailPrintList(orgid int64, startime int64, endtime int64, limit int64, page int64, storehouse_id int64, good_id int64) (info []*models.VmWarehousingInfo, err error) {
270 296
 	//offset := (page - 1) * limit
271 297
 	db := p_service.XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1")
272 298
 	table := p_service.XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
273 299
 	fmt.Println(table)
300
+
301
+	if good_id > 0 {
302
+		db = db.Where("x.good_id = ?", good_id)
303
+	}
304
+
274 305
 	if orgid > 0 {
275 306
 		db = db.Where("x.org_id = ?", orgid)
276 307
 	}
@@ -309,7 +340,7 @@ func GetWarehouseOutInfoGoodDetailPrintList(orgid int64, startime int64, endtime
309 340
 
310 341
 }
311 342
 
312
-func GetWarehouseOutInfoPrintList(orgid int64, startime int64, endtime int64) (out []*models.SgjWarehouseOutInfo, err error) {
343
+func GetWarehouseOutInfoPrintList(orgid int64, startime int64, endtime int64, good_id int64, order_way int64) (out []*models.SgjWarehouseOutInfo, err error) {
313 344
 
314 345
 	db := p_service.XTReadDB().Table("xt_warehouse_out_info as x").Where("x.status = 1")
315 346
 	table := p_service.XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
@@ -317,6 +348,15 @@ func GetWarehouseOutInfoPrintList(orgid int64, startime int64, endtime int64) (o
317 348
 	tableOne := p_service.XTReadDB().Table("xt_warehouse_info as p").Where("p.status = 1")
318 349
 	fmt.Println(table)
319 350
 	fmt.Println("tableOne", tableOne)
351
+	if good_id > 0 {
352
+		db = db.Where("x.good_id = ?", good_id)
353
+	}
354
+	if order_way == 1 {
355
+		db = db.Where("x.is_sys!=1")
356
+	}
357
+	if order_way == 2 {
358
+		db = db.Where("x.is_sys==1")
359
+	}
320 360
 	if orgid > 0 {
321 361
 		db = db.Where("x.org_id = ?", orgid)
322 362
 	}

+ 9 - 0
service/schedule_service.go View File

@@ -235,6 +235,15 @@ func GetDayScheduleByBedid(orgID, start, bed_id int64, schedule_type int64) (sch
235 235
 	return
236 236
 }
237 237
 
238
+func GetDialysisPrescriptionByRecord(orgID int64, patient_id int64, record_date int64) (models.DialysisPrescription, error) {
239
+
240
+	prescription := models.DialysisPrescription{}
241
+
242
+	err = readDb.Where("user_org_id = ? and patient_id = ? and record_date = ? and status=1", orgID, patient_id, record_date).Find(&prescription).Error
243
+
244
+	return prescription, err
245
+}
246
+
238 247
 func GetDayScheduleByOrder(orgID, start, bed_id int64, schedule_type int64) (schedule models.DialysisOrder, err error) {
239 248
 	err = readDb.Model(&models.DialysisOrder{}).Where("user_org_id=?  and dialysis_date=? and bed_id=? and status=1 AND schedual_type = ?", orgID, start, bed_id, schedule_type).First(&schedule).Error
240 249
 	return

+ 7 - 0
service/self_drug_service.go View File

@@ -138,6 +138,13 @@ func GetBaseDrugMedical(id int64) (models.XtBaseDrug, error) {
138 138
 	return drug, err
139 139
 }
140 140
 
141
+func GetLastDrugWarehouseInfoList(drug_id int64) (info []*models.XtDrugWarehouseInfo, err error) {
142
+
143
+	err = XTReadDB().Where("drug_id = ? and status=1 and (stock_max_number > 0 or stock_min_number>0) and is_check =1", drug_id).Find(&info).Error
144
+
145
+	return info, err
146
+}
147
+
141 148
 func GetNewBaseDrugMedical(id int64, tx *gorm.DB) (models.XtBaseDrug, error) {
142 149
 	drug := models.XtBaseDrug{}
143 150
 	err := tx.Model(&drug).Where("id = ? and status = 1", id).Find(&drug).Error

+ 15 - 0
service/sign_service.go View File

@@ -2385,3 +2385,18 @@ func CreteStockCheckQuery(query models.XtStockCheckQuery) error {
2385 2385
 
2386 2386
 	return err
2387 2387
 }
2388
+
2389
+func GetDoctorAdviceListByUserOrgId(user_org_id int64, advice_date int64) (advice []*models.DoctorAdvice, err error) {
2390
+
2391
+	err = XTReadDB().Where("user_org_id  = ? and advice_date = ? and status=1", user_org_id, advice_date).Find(&advice).Error
2392
+
2393
+	return advice, err
2394
+}
2395
+
2396
+func GetSelfDrugWarehouseOutInfo(patient_id int64, drug_id int64, advice_Date int64) (models.XtSelfDrugWarehouseOutInfo, error) {
2397
+
2398
+	outInfo := models.XtSelfDrugWarehouseOutInfo{}
2399
+	err := XTReadDB().Where("patient_id = ? and drug_id = ? and sys_record_time = ? and status=1", patient_id, drug_id, advice_Date).Find(&outInfo).Error
2400
+
2401
+	return outInfo, err
2402
+}

+ 6 - 6
service/statistis_qc_service.go View File

@@ -718,8 +718,8 @@ func GetDialysisCompletionRate(org_id int64, start_time int64, end_time int64) (
718 718
         SELECT
719 719
             CASE
720 720
                 WHEN ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) <= 15 THEN '达到透析处方时间'
721
-                WHEN TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) < -15 THEN '超出处方时间'
722
-                ELSE '未达到处方时间'
721
+                WHEN TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) < -15 THEN '未达到处方时间'
722
+                ELSE '超出处方时间'
723 723
             END AS dialysis_status,
724 724
             COUNT(*) AS count
725 725
         FROM
@@ -845,13 +845,13 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
845 845
 	   JOIN
846 846
 	       xt_assessment_after_dislysis a ON o.dialysis_date = a.assessment_date AND o.patient_id = a.patient_id AND a.user_org_id = ?
847 847
 	   WHERE
848
-	       o.stage = 2 AND o.user_org_id = ? AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) < -15
848
+	       o.stage = 2 AND o.user_org_id = ? AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) > 15
849 849
 	`
850 850
 		readDb.Table("xt_dialysis_order o").
851 851
 			Joins("JOIN xt_patients pp ON o.patient_id = pp.id AND pp.user_org_id = ?", org_id).
852 852
 			Joins("JOIN xt_dialysis_prescription p ON o.dialysis_date = p.record_date AND o.patient_id = p.patient_id AND p.user_org_id = ?", org_id).
853 853
 			Joins("JOIN xt_assessment_after_dislysis a ON o.dialysis_date = a.assessment_date AND o.patient_id = a.patient_id AND a.user_org_id = ?", org_id).
854
-			Where("o.stage = 2 AND o.user_org_id = ? AND o.dialysis_date >= ? AND o.dialysis_date <= ? and TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) < 0", org_id, start_time, end_time).Count(&total)
854
+			Where("o.stage = 2 AND o.user_org_id = ? AND o.dialysis_date >= ? AND o.dialysis_date <= ? and TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) > 15", org_id, start_time, end_time).Count(&total)
855 855
 
856 856
 	} else if mode == 3 {
857 857
 		query = `
@@ -874,13 +874,13 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
874 874
 	   JOIN
875 875
 	       xt_assessment_after_dislysis a ON o.dialysis_date = a.assessment_date AND o.patient_id = a.patient_id AND a.user_org_id = ?
876 876
 	   WHERE
877
-	       o.stage = 2 AND o.user_org_id = ? AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) > 15
877
+	       o.stage = 2 AND o.user_org_id = ? AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) < -15
878 878
 	`
879 879
 		readDb.Table("xt_dialysis_order o").
880 880
 			Joins("JOIN xt_patients pp ON o.patient_id = pp.id AND pp.user_org_id = ?", org_id).
881 881
 			Joins("JOIN xt_dialysis_prescription p ON o.dialysis_date = p.record_date AND o.patient_id = p.patient_id AND p.user_org_id = ?", org_id).
882 882
 			Joins("JOIN xt_assessment_after_dislysis a ON o.dialysis_date = a.assessment_date AND o.patient_id = a.patient_id AND a.user_org_id = ?", org_id).
883
-			Where("o.stage = 2 AND o.user_org_id = ? AND o.dialysis_date >= ? AND o.dialysis_date <= ? and TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) > 15", org_id, start_time, end_time).Count(&total)
883
+			Where("o.stage = 2 AND o.user_org_id = ? AND o.dialysis_date >= ? AND o.dialysis_date <= ? and TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) < 0", org_id, start_time, end_time).Count(&total)
884 884
 
885 885
 	}
886 886
 

+ 120 - 7
service/stock_service.go View File

@@ -933,6 +933,15 @@ func CreateNewDrugFlowOne(flow models.DrugFlow, tx *gorm.DB) error {
933 933
 	}
934 934
 	return err
935 935
 }
936
+func CreateDrugOutInfoLog(log models.XtDrugWarehouseOutInfoLog, tx *gorm.DB) error {
937
+
938
+	err := tx.Create(&log).Error
939
+	if err != nil {
940
+		tx.Rollback()
941
+		return err
942
+	}
943
+	return err
944
+}
936 945
 
937 946
 func UpdateDrugFlowSeven(patientid int64, recorddate int64, drugid int64, advice_id int64, id int64) (models.DrugAutomaticReduceDetail, error) {
938 947
 	detail := models.DrugAutomaticReduceDetail{}
@@ -982,6 +991,16 @@ func CreateNewDrugFlowTwo(flow *models.DrugFlow, tx *gorm.DB) error {
982 991
 	return err
983 992
 }
984 993
 
994
+func CreateInfoLog(log models.XtDrugWarehouseInfoLog, tx *gorm.DB) error {
995
+	err := tx.Create(&log).Error
996
+	if err != nil {
997
+		tx.Rollback()
998
+		return err
999
+	}
1000
+
1001
+	return err
1002
+}
1003
+
985 1004
 func FindLastWarehousingInfo(order string) (info models.WarehousingInfo, err error) {
986 1005
 	err = readDb.Model(&models.WarehousingInfo{}).Where("warehousing_order = ? AND status = 1", order).Last(&info).Error
987 1006
 
@@ -3427,10 +3446,15 @@ type StockDetailModel struct {
3427 3446
 	Types            int64   `gorm:"types" json:"types"`
3428 3447
 }
3429 3448
 
3430
-func FindStockInDetailList(orgId int64, page int64, limit int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64) (list []*models.WarehousingInfo, total int64, err error) {
3449
+func FindStockInDetailList(orgId int64, page int64, limit int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64, good_id int64) (list []*models.WarehousingInfo, total int64, err error) {
3431 3450
 
3432 3451
 	db := readDb.Model(&models.WarehousingInfo{})
3433 3452
 	db = db.Where("xt_warehouse_info.org_id = ? AND xt_warehouse_info.status = 1 AND xt_warehouse_info.is_check = 1", orgId)
3453
+
3454
+	if good_id > 0 {
3455
+
3456
+		db = db.Where("xt_warehouse_info.good_id = ?", good_id)
3457
+	}
3434 3458
 	if len(keywords) > 0 {
3435 3459
 		likeKey := "%" + keywords + "%"
3436 3460
 		//db = db.Joins("join xt_warehouse on xt_warehouse.id = xt_warehouse_info.warehousing_id AND ")
@@ -3463,9 +3487,12 @@ func FindStockInDetailList(orgId int64, page int64, limit int64, startTime int64
3463 3487
 	return
3464 3488
 }
3465 3489
 
3466
-func GetStockInDetailTotal(orgId int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64) (err error, totalPrice float64) {
3490
+func GetStockInDetailTotal(orgId int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64, good_id int64) (err error, totalPrice float64) {
3467 3491
 	db := readDb.Model(&models.WarehousingInfo{})
3468 3492
 	db = db.Where("xt_warehouse_info.org_id = ? AND xt_warehouse_info.status = 1", orgId)
3493
+	if good_id > 0 {
3494
+		db = db.Where("good_id = ?", good_id)
3495
+	}
3469 3496
 	if len(keywords) > 0 {
3470 3497
 		likeKey := "%" + keywords + "%"
3471 3498
 		//db = db.Joins("join xt_warehouse on xt_warehouse.id = xt_warehouse_info.warehousing_id AND ")
@@ -3504,7 +3531,7 @@ func FloatRound(f float64, n int) float64 {
3504 3531
 	return res
3505 3532
 }
3506 3533
 
3507
-func FindStockOutDetailList(orgId int64, page int64, limit int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64) (list []*models.WarehouseOutInfo, total int64, err error) {
3534
+func FindStockOutDetailList(orgId int64, page int64, limit int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64, good_id int64, order_way int64) (list []*models.WarehouseOutInfo, total int64, err error) {
3508 3535
 
3509 3536
 	if orgId == 9671 {
3510 3537
 		db := readDb.Model(&models.WarehouseOutInfo{})
@@ -3543,7 +3570,15 @@ func FindStockOutDetailList(orgId int64, page int64, limit int64, startTime int6
3543 3570
 	} else {
3544 3571
 		db := readDb.Model(&models.WarehouseOutInfo{})
3545 3572
 		db = db.Where("xt_warehouse_out_info.org_id = ? AND xt_warehouse_out_info.status = 1 AND xt_warehouse_out_info.is_check = 1 AND xt_warehouse_out_info.count <> 0 ", orgId)
3546
-
3573
+		if good_id > 0 {
3574
+			db = db.Where("good_id = ?", good_id)
3575
+		}
3576
+		if order_way == 1 {
3577
+			db = db.Where("xt_warehouse_out_info.is_sys =0")
3578
+		}
3579
+		if order_way == 2 {
3580
+			db = db.Where("xt_warehouse_out_info.is_sys !=0")
3581
+		}
3547 3582
 		if len(keywords) > 0 {
3548 3583
 			likeKey := "%" + keywords + "%"
3549 3584
 			db = db.Joins("join xt_warehouse_out on xt_warehouse_out.id = xt_warehouse_out_info.warehouse_out_id AND xt_warehouse_out.warehouse_out_time >=? AND xt_warehouse_out.warehouse_out_time<= ? AND xt_warehouse_out.status = 1 AND xt_warehouse_out.org_id = ?", startTime, endTime, orgId)
@@ -3578,7 +3613,7 @@ func FindStockOutDetailList(orgId int64, page int64, limit int64, startTime int6
3578 3613
 
3579 3614
 }
3580 3615
 
3581
-func GetStockOutDetailTotal(orgId int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64) (err error, totalPrice float64) {
3616
+func GetStockOutDetailTotal(orgId int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64, good_id int64, order_way int64) (err error, totalPrice float64) {
3582 3617
 	db := readDb.Model(&models.WarehouseOutInfo{})
3583 3618
 	db = db.Where("xt_warehouse_out_info.org_id = ? AND xt_warehouse_out_info.status = 1  AND xt_warehouse_out_info.count > 0", orgId)
3584 3619
 
@@ -3593,6 +3628,18 @@ func GetStockOutDetailTotal(orgId int64, startTime int64, endTime int64, keyword
3593 3628
 		db = db.Joins("join xt_warehouse_out on xt_warehouse_out.id = xt_warehouse_out_info.warehouse_out_id and   xt_warehouse_out.org_id = xt_warehouse_out_info.org_id AND xt_warehouse_out.warehouse_out_time >=? AND xt_warehouse_out.warehouse_out_time<= ? AND xt_warehouse_out.status = 1 AND xt_warehouse_out.org_id = ?", startTime, endTime, orgId)
3594 3629
 	}
3595 3630
 
3631
+	if good_id > 0 {
3632
+		db = db.Where("xt_warehouse_out_info.good_id = ?", good_id)
3633
+	}
3634
+
3635
+	if order_way == 1 {
3636
+		db = db.Where("xt_warehouse_out_info.is_sys = ?", 0)
3637
+	}
3638
+
3639
+	if order_way == 2 {
3640
+		db = db.Where("xt_warehouse_out_info.is_sys != ?", 0)
3641
+	}
3642
+
3596 3643
 	if manufacturer > 0 {
3597 3644
 		db = db.Joins("join xt_warehouse_out as wa on wa.id = xt_warehouse_out_info.warehouse_out_id AND wa.manufacturer =?", manufacturer)
3598 3645
 	}
@@ -3651,7 +3698,7 @@ func FindSalesReturnDetailList(orgId int64, page int64, limit int64, startTime i
3651 3698
 	return
3652 3699
 }
3653 3700
 
3654
-func FindeCancelGroup(orgId int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64) (list []*models.CancelStockInfo, err error) {
3701
+func FindeCancelGroup(orgId int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64, good_id int64) (list []*models.CancelStockInfo, err error) {
3655 3702
 	db := readDb.Model(&models.CancelStockInfo{})
3656 3703
 	db = db.Where("xt_cancel_stock_info.org_id = ? AND xt_cancel_stock_info.status = 1", orgId)
3657 3704
 	if len(keywords) > 0 {
@@ -3676,6 +3723,9 @@ func FindeCancelGroup(orgId int64, startTime int64, endTime int64, keywords stri
3676 3723
 	if storehouse_id > 0 {
3677 3724
 		db = db.Where("xt_cancel_stock_info.storehouse_id = ?", order_type)
3678 3725
 	}
3726
+	if good_id > 0 {
3727
+		db = db.Where("xt_cancel_stock_info.good_id = ?", good_id)
3728
+	}
3679 3729
 
3680 3730
 	db = db.Preload("CancelStock", "status = 1 AND org_id = ?", orgId)
3681 3731
 	db = db.Preload("GoodInfo", "status = 1 AND org_id = ?", orgId)
@@ -3684,7 +3734,7 @@ func FindeCancelGroup(orgId int64, startTime int64, endTime int64, keywords stri
3684 3734
 	return
3685 3735
 }
3686 3736
 
3687
-func FindCancelDetailList(orgId int64, page int64, limit int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64) (list []*models.CancelStockInfo, total int64, err error) {
3737
+func FindCancelDetailList(orgId int64, page int64, limit int64, startTime int64, endTime int64, keywords string, manufacturer int64, order_type int64, dealer int64, storehouse_id int64, good_id int64) (list []*models.CancelStockInfo, total int64, err error) {
3688 3738
 	db := readDb.Model(&models.CancelStockInfo{})
3689 3739
 	db = db.Where("xt_cancel_stock_info.org_id = ? AND xt_cancel_stock_info.status = 1", orgId)
3690 3740
 	if len(keywords) > 0 {
@@ -3708,6 +3758,9 @@ func FindCancelDetailList(orgId int64, page int64, limit int64, startTime int64,
3708 3758
 	if storehouse_id > 0 {
3709 3759
 		db = db.Where("xt_cancel_stock_info.storehouse_id = ?", storehouse_id)
3710 3760
 	}
3761
+	if good_id > 0 {
3762
+		db = db.Where("xt_cancel_stock_info.good_id =?", good_id)
3763
+	}
3711 3764
 
3712 3765
 	db = db.Preload("CancelStock", "status = 1 AND org_id = ?", orgId)
3713 3766
 	db = db.Preload("GoodInfo", "status = 1 AND org_id = ?", orgId)
@@ -5925,6 +5978,26 @@ func CreateNewStockFlowOne(flow models.VmStockFlow, tx *gorm.DB) error {
5925 5978
 	return err
5926 5979
 }
5927 5980
 
5981
+func CreateOutInfoLog(log models.XtGoodWarehouseOutInfoLog, tx *gorm.DB) error {
5982
+
5983
+	err := tx.Create(&log).Error
5984
+	if err != nil {
5985
+		tx.Rollback()
5986
+		return err
5987
+	}
5988
+	return err
5989
+}
5990
+
5991
+func CreateGoodWarehouseInfoLog(log models.XtGoodWarehouseInfoLog, tx *gorm.DB) error {
5992
+
5993
+	err := tx.Create(&log).Error
5994
+	if err != nil {
5995
+		tx.Rollback()
5996
+		return err
5997
+	}
5998
+	return err
5999
+}
6000
+
5928 6001
 func CreateStockFlowSix(flow *models.VmStockFlow) error {
5929 6002
 
5930 6003
 	err := XTWriteDB().Create(&flow).Error
@@ -8510,6 +8583,20 @@ func UpdateaGoodWarehouseInfo(count int64, good_id int64, orgid int64, warehouse
8510 8583
 
8511 8584
 }
8512 8585
 
8586
+func ModifyGoodOutInfoLog(good_id int64, id int64, tx *gorm.DB) (models.XtGoodWarehouseOutInfoLog, error) {
8587
+
8588
+	outInfoLog := models.XtGoodWarehouseOutInfoLog{}
8589
+
8590
+	err := tx.Model(&outInfoLog).Where("good_id = ? and warehouse_out_info_id = ?", good_id, id).Updates(map[string]interface{}{"status": 0}).Error
8591
+
8592
+	if err != nil {
8593
+		tx.Rollback()
8594
+		return outInfoLog, err
8595
+	}
8596
+	return outInfoLog, err
8597
+
8598
+}
8599
+
8513 8600
 func UpdateaNewGoodWarehouseInfo(count int64, good_id int64, orgid int64, warehouse_info_id int64, tx *gorm.DB) error {
8514 8601
 
8515 8602
 	err := tx.Model(&models.WarehousingInfo{}).Where("good_id = ?  and org_id = ? and status = 1 and id = ?", good_id, orgid, warehouse_info_id).UpdateColumn("stock_count", gorm.Expr("stock_count + ?", count)).Error
@@ -8569,6 +8656,7 @@ func ModifyNewGoodWarehouseOut(id int64, tx *gorm.DB) error {
8569 8656
 		tx.Rollback()
8570 8657
 		return err
8571 8658
 	}
8659
+
8572 8660
 	return err
8573 8661
 }
8574 8662
 
@@ -8926,6 +9014,12 @@ func ReturnNewCheckWarehouseingInfo(id int64, orgid int64, tx *gorm.DB) error {
8926 9014
 		tx.Rollback()
8927 9015
 		return err
8928 9016
 	}
9017
+
9018
+	err = tx.Model(models.XtDrugWarehouseInfoLog{}).Where("warehouse_info_id = ? and status=1", id).Update(map[string]interface{}{"status": 0}).Error
9019
+	if err != nil {
9020
+		tx.Rollback()
9021
+		return err
9022
+	}
8929 9023
 	return err
8930 9024
 }
8931 9025
 
@@ -9936,6 +10030,12 @@ func GetSettleOpenConfigByOrgId(user_org_id int64) (models.HisSettleStockConfig,
9936 10030
 	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&config).Error
9937 10031
 	return config, nil
9938 10032
 }
10033
+func GetGoodWareHouseOutInfoByGood(good_id int64, sys_record_time int64, user_org_id int64) (info []*models.WarehouseOutInfo, err error) {
10034
+
10035
+	err = XTReadDB().Where("good_id= ? and sys_record_time = ? and org_id = ? and status=1", good_id, sys_record_time, user_org_id).Find(&info).Error
10036
+
10037
+	return info, err
10038
+}
9939 10039
 
9940 10040
 func GetGoodInformationByGoodIdOne(good_id int64) (models.GoodInformationFourty, error) {
9941 10041
 
@@ -9944,6 +10044,13 @@ func GetGoodInformationByGoodIdOne(good_id int64) (models.GoodInformationFourty,
9944 10044
 	return info, err
9945 10045
 }
9946 10046
 
10047
+func GetGoodWarehouseInfoByGoodList(good_id int64) (info []*models.WarehousingInfo, err error) {
10048
+
10049
+	err = XTReadDB().Where("good_id = ? and status =1 and stock_count>0 and is_check = 1", good_id).Find(&info).Error
10050
+
10051
+	return info, err
10052
+}
10053
+
9947 10054
 func GetAllWarehouseInfo(good_id int64, user_org_id int64) (info []*models.WarehousingInfo, err error) {
9948 10055
 
9949 10056
 	err = XTReadDB().Where("good_id = ? and user_org_id =? and status=1 and is_check =1", good_id, user_org_id).Find(&info).Error
@@ -10441,6 +10548,12 @@ func UpdateNewWarehouseInfoMap(list []*models.WarehousingInfo, warehousing_info_
10441 10548
 			return err
10442 10549
 		}
10443 10550
 
10551
+		err = tx.Model(models.XtGoodWarehouseInfoLog{}).Where("warehouse_info_id = ? and status=1", item.ID).Update(map[string]interface{}{"status": 0}).Error
10552
+		if err != nil {
10553
+			tx.Rollback()
10554
+			return err
10555
+		}
10556
+
10444 10557
 	}
10445 10558
 	err := tx.Model(&models.Warehousing{}).Where("id = ? and status = 1", warehousing_info_id).Update(map[string]interface{}{"is_check": 2}).Error
10446 10559
 	if err != nil {

+ 275 - 1
service/warhouse_service.go View File

@@ -10910,6 +10910,20 @@ func ConsumablesNewDeliveryThirty(orgID int64, record_time int64, goods *models.
10910 10910
 		//创建出库流水
10911 10911
 		CreateNewStockFlowOne(stockFlow, tx)
10912 10912
 
10913
+		outInfoLog := models.XtGoodWarehouseOutInfoLog{
10914
+
10915
+			UserOrgId:          goods.OrgId,
10916
+			GoodId:             goods.GoodId,
10917
+			RecordDate:         record_time,
10918
+			WarehouseOutInfoId: goods.ID,
10919
+			Status:             1,
10920
+			Ctime:              time.Now().Unix(),
10921
+			Mtime:              time.Now().Unix(),
10922
+			BatchNumberId:      warehouse.ID,
10923
+		}
10924
+
10925
+		CreateOutInfoLog(outInfoLog, tx)
10926
+
10913 10927
 		//添加入库ID
10914 10928
 		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, tx)
10915 10929
 
@@ -10975,6 +10989,19 @@ func ConsumablesNewDeliveryThirty(orgID int64, record_time int64, goods *models.
10975 10989
 		//创建出库流水
10976 10990
 		CreateNewStockFlowOne(stockFlow, tx)
10977 10991
 
10992
+		outInfoLog := models.XtGoodWarehouseOutInfoLog{
10993
+			UserOrgId:          goods.OrgId,
10994
+			GoodId:             goods.GoodId,
10995
+			RecordDate:         record_time,
10996
+			WarehouseOutInfoId: goods.ID,
10997
+			Status:             1,
10998
+			Ctime:              time.Now().Unix(),
10999
+			Mtime:              time.Now().Unix(),
11000
+			BatchNumberId:      warehouse.ID,
11001
+		}
11002
+
11003
+		CreateOutInfoLog(outInfoLog, tx)
11004
+
10978 11005
 		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, tx)
10979 11006
 
10980 11007
 		//更新出库数量
@@ -11205,7 +11232,20 @@ func AutoNewDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, wareh
11205 11232
 			drugflow.Price = advice.Price
11206 11233
 		}
11207 11234
 
11208
-		CreateDrugFlowOne(drugflow)
11235
+		CreateNewDrugFlowOne(drugflow, tx)
11236
+
11237
+		outInfoLog := models.XtDrugWarehouseOutInfoLog{
11238
+			UserOrgId:          advice.OrgId,
11239
+			DrugId:             advice.DrugId,
11240
+			WarehouseOutInfoId: drugWareInfo.ID,
11241
+			RecordDate:         advice.SysRecordTime,
11242
+			Status:             1,
11243
+			Ctime:              time.Now().Unix(),
11244
+			Mtime:              time.Now().Unix(),
11245
+			BatchNumberId:      warehouse.ID,
11246
+		}
11247
+
11248
+		CreateDrugOutInfoLog(outInfoLog, tx)
11209 11249
 
11210 11250
 		//更新出库id
11211 11251
 		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, tx)
@@ -11275,6 +11315,18 @@ func AutoNewDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, wareh
11275 11315
 		}
11276 11316
 
11277 11317
 		CreateNewDrugFlowOne(drugflow, tx)
11318
+
11319
+		outInfoLog := models.XtDrugWarehouseOutInfoLog{
11320
+			UserOrgId:          advice.OrgId,
11321
+			DrugId:             advice.DrugId,
11322
+			WarehouseOutInfoId: drugWareInfo.ID,
11323
+			RecordDate:         advice.SysRecordTime,
11324
+			Status:             1,
11325
+			Ctime:              time.Now().Unix(),
11326
+			Mtime:              time.Now().Unix(),
11327
+			BatchNumberId:      warehouse.ID,
11328
+		}
11329
+		CreateDrugOutInfoLog(outInfoLog, tx)
11278 11330
 		//更新出库id
11279 11331
 		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, tx)
11280 11332
 		// 出库完成后,要将该批次库存清零
@@ -11288,3 +11340,225 @@ func AutoNewDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, wareh
11288 11340
 
11289 11341
 	return
11290 11342
 }
11343
+
11344
+// 药品手动出库 递归方式
11345
+func AutoNewSelfDrugDeliverInfoFourtyTwo(orgID int64, prescribingNumber int64, warehouseout *models.XtSelfDrugWarehouseOut, drup *models.BaseDrugLib, advice *models.XtSelfDrugWarehouseOutInfo, unit string, tx *gorm.DB) (err error) {
11346
+
11347
+	// 判断处方里药品单位是拆零单位还是包装单位,	如果是包装单位,则根据规格,将包装数量转为拆零数量
11348
+	var deliver_number int64 = 0
11349
+
11350
+	var drug_price float64
11351
+	if advice.CountUnit == drup.MaxUnit {
11352
+		deliver_number = prescribingNumber * drup.MinNumber
11353
+
11354
+	} else {
11355
+		deliver_number = prescribingNumber
11356
+
11357
+	}
11358
+	if advice.CountUnit == drup.MaxUnit {
11359
+		drug_price = drup.RetailPrice
11360
+	}
11361
+	fmt.Println(drug_price)
11362
+
11363
+	if advice.CountUnit == drup.MinUnit {
11364
+		drug_price = drup.MinPrice
11365
+	}
11366
+
11367
+	if advice.CountUnit != drup.MaxUnit || advice.CountUnit != drup.MinUnit {
11368
+		drug_price = drup.RetailPrice
11369
+	}
11370
+
11371
+	// 根据先进先出原则,查询最先入库的批次,进行出库
11372
+	// 如果没有对应的库存,则报错
11373
+	lastWarehouse, _ := FindSelfLastDrugWarehousingInfoByID(advice.DrugId, advice.PatientId, tx)
11374
+
11375
+	if lastWarehouse.MaxUnit != lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
11376
+		if lastWarehouse.StockMinNumber >= drup.MinNumber {
11377
+			var stockMax int64
11378
+			var stockMin int64
11379
+			stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
11380
+			stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
11381
+
11382
+			ChangeSelfMaxNumber(lastWarehouse.ID, stockMax, tx)
11383
+			UpdateSelfMinNumber(lastWarehouse.ID, stockMin, tx)
11384
+
11385
+		}
11386
+	}
11387
+
11388
+	if lastWarehouse.MaxUnit == lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
11389
+
11390
+		lastWarehouse.StockMaxNumber = lastWarehouse.StockMaxNumber + lastWarehouse.StockMinNumber
11391
+		ChangeSelfMaxNumberOne(lastWarehouse.ID, lastWarehouse.StockMaxNumber, tx)
11392
+
11393
+	}
11394
+
11395
+	warehouse, err := FindSelfLastDrugWarehousingInfoByID(advice.DrugId, advice.PatientId, tx)
11396
+
11397
+	var maxNumber int64 = 0
11398
+	var minNumber int64 = 0
11399
+
11400
+	maxNumber = deliver_number / drup.MinNumber
11401
+	minNumber = deliver_number % drup.MinNumber
11402
+
11403
+	if warehouse.StockMaxNumber == 0 && drup.MaxUnit == drup.MinUnit {
11404
+		minNumber = maxNumber
11405
+	}
11406
+
11407
+	if drup.MaxUnit != drup.MinUnit {
11408
+		if warehouse.StockMaxNumber < maxNumber && warehouse.StockMinNumber < minNumber {
11409
+			return errors.New("库存数量不足")
11410
+		}
11411
+	}
11412
+
11413
+	if drup.MinUnit == warehouse.MaxUnit && drup.MaxUnit != drup.MinUnit {
11414
+
11415
+		warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber*drup.MinNumber
11416
+	}
11417
+
11418
+	if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit != drup.MinUnit {
11419
+
11420
+		warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
11421
+	}
11422
+	if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit == drup.MinUnit {
11423
+
11424
+		warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
11425
+	}
11426
+
11427
+	if warehouse.StockMaxNumber < 0 {
11428
+		warehouse.StockMaxNumber = 0
11429
+	}
11430
+	if warehouse.StockMinNumber < 0 {
11431
+		warehouse.StockMinNumber = 0
11432
+	}
11433
+
11434
+	warehouse.Mtime = time.Now().Unix()
11435
+
11436
+	if warehouse.StockMinNumber < minNumber {
11437
+
11438
+		warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
11439
+		if warehouse.MaxUnit != warehouse.MinUnit {
11440
+			warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
11441
+		}
11442
+		if minNumber == 2 && warehouse.MaxUnit == warehouse.MinUnit && warehouse.StockMinNumber == 0 {
11443
+			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
11444
+		}
11445
+	} else {
11446
+
11447
+		if minNumber > 0 {
11448
+			if (warehouse.StockMinNumber - minNumber) >= 0 {
11449
+				warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
11450
+			}
11451
+
11452
+		}
11453
+
11454
+		if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
11455
+
11456
+			if warehouse.StockMinNumber > 0 {
11457
+				if warehouse.StockMinNumber-deliver_number >= 0 {
11458
+					warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
11459
+				}
11460
+
11461
+			}
11462
+
11463
+		}
11464
+
11465
+	}
11466
+
11467
+	if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit && warehouse.MaxUnit != warehouse.MinUnit {
11468
+		if (warehouse.StockMinNumber - deliver_number) >= 0 {
11469
+			warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
11470
+		}
11471
+
11472
+	}
11473
+
11474
+	if drup.MaxUnit != drup.MinUnit {
11475
+		if warehouse.StockMaxNumber < 0 && warehouse.StockMinNumber < 0 {
11476
+			return errors.New("库存数量不足")
11477
+		}
11478
+	}
11479
+	if warehouse.StockMinNumber <= 0 {
11480
+		warehouse.StockMinNumber = 0
11481
+	}
11482
+
11483
+	errThree := UpDateSelfDrugWarehouseInfoByStock(&warehouse, tx)
11484
+
11485
+	if errThree != nil {
11486
+		return errors.New("扣减库存失败")
11487
+	}
11488
+
11489
+	//查询该药品剩余库存
11490
+	infolist, _ := FindSelfDrugWarehouseInfoFlushCount(advice.DrugId, advice.OrgId, tx)
11491
+	var over_count int64
11492
+	for _, its := range infolist {
11493
+		if its.MaxUnit == drup.MaxUnit {
11494
+			its.StockMaxNumber = its.StockMaxNumber * drup.MinNumber
11495
+		}
11496
+		over_count += its.StockMaxNumber + its.StockMinNumber
11497
+	}
11498
+
11499
+	//更新出库id
11500
+	//查询今日该药品该患者是否有出库数据
11501
+	lastDrugOutInfo, _ := GetSelfNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.SysRecordTime, advice.OrgId, advice.AdviceId, warehouse.ID, tx)
11502
+
11503
+	if lastDrugOutInfo.ID == 0 {
11504
+		advice.WarehouseInfoId = lastWarehouse.ID
11505
+		AddSelfSigleDrugWarehouseOutInfo(advice, tx)
11506
+	}
11507
+	if lastDrugOutInfo.ID > 0 {
11508
+		advice.WarehouseInfoId = lastWarehouse.ID
11509
+		//删除在新增
11510
+		UpdateSelfDrugWarehouseOutInfoTen(lastDrugOutInfo.PatientId, lastDrugOutInfo.SysRecordTime, advice.ID, tx)
11511
+
11512
+		AddSelfSigleDrugWarehouseOutInfo(advice, tx)
11513
+
11514
+	}
11515
+
11516
+	drugWareInfo, _ := GetSelfLastWarehouseOutInfoById(advice.DrugId, tx)
11517
+	drugflow := models.XtSelfDrugFlow{
11518
+		WarehouseOutId:          warehouseout.ID,
11519
+		WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
11520
+		DrugId:                  advice.DrugId,
11521
+		Number:                  warehouse.Number,
11522
+		ProductDate:             advice.ProductDate,
11523
+		ExpireDate:              advice.ExpiryDate,
11524
+		Count:                   deliver_number,
11525
+		Price:                   warehouse.RetailPrice,
11526
+		Status:                  1,
11527
+		Ctime:                   advice.SysRecordTime,
11528
+		Mtime:                   time.Now().Unix(),
11529
+		UserOrgId:               advice.OrgId,
11530
+		Manufacturer:            advice.Manufacturer,
11531
+		Dealer:                  advice.Dealer,
11532
+		BatchNumber:             warehouse.BatchNumber,
11533
+		MaxUnit:                 drup.MinUnit,
11534
+		ConsumableType:          3,
11535
+		IsEdit:                  1,
11536
+		Creator:                 0,
11537
+		IsSys:                   0,
11538
+		WarehouseOutDetailId:    drugWareInfo.ID,
11539
+		AdviceId:                advice.ID,
11540
+		SupplyWarehouseId:       warehouse.SupplyWarehouseId,
11541
+		StorehouseId:            advice.StorehouseId,
11542
+		AdminUserId:             advice.AdminUserId,
11543
+		LastPrice:               warehouse.Price,
11544
+		StockCount:              advice.StockCount,
11545
+		WarehousingDetailId:     warehouse.ID,
11546
+		OverCount:               over_count,
11547
+		RetailPrice:             drug_price, //手动出库出库价格
11548
+		WarehousingId:           warehouse.ID,
11549
+		SystemTime:              advice.SysRecordTime,
11550
+		PatientId:               advice.PatientId,
11551
+		Remark:                  advice.Remark,
11552
+		OperateTime:             time.Now().Unix(),
11553
+	}
11554
+	if warehouse.RetailPrice == 0 {
11555
+		drugflow.Price = advice.Price
11556
+	}
11557
+
11558
+	CreateSelfDrugFlowOne(drugflow, tx)
11559
+
11560
+	//出库数量相加
11561
+	AddSelfDrugCount(advice.DrugId, orgID, advice.PatientId, drugflow.Count, tx)
11562
+
11563
+	return
11564
+}