28169 il y a 1 an
Parent
révision
1bbb823c3e

+ 1 - 1
controllers/drug_stock_api_contorller.go Voir le fichier

@@ -241,7 +241,7 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
241 241
 
242 242
 				warehouseInfo := &models.DrugWarehouseInfo{
243 243
 					ID:               id,
244
-					WarehousingOrder: warehousing.WarehousingOrder,
244
+					WarehousingOrder: info.WarehousingOrder,
245 245
 					WarehousingId:    info.ID,
246 246
 					DrugId:           drug_id,
247 247
 					Number:           number,

+ 68 - 52
controllers/his_api_controller.go Voir le fichier

@@ -104,6 +104,30 @@ func HisManagerApiRegistRouters() {
104 104
 
105 105
 	beego.Router("/api/changeorderdesc", &HisApiController{}, "get:ChangeOrderDesc")
106 106
 
107
+	beego.Router("/api/getfapiaonumber", &HisApiController{}, "get:GetFaPiaoNumber")
108
+
109
+}
110
+func (c *HisApiController) GetFaPiaoNumber() {
111
+	max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
112
+	count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
113
+	fmt.Println(count)
114
+	var zero string
115
+	number := count + 1
116
+	if number >= 1000 {
117
+		zero = "0000" + strconv.FormatInt(number, 10)
118
+	} else if number >= 10000 {
119
+		zero = "000" + strconv.FormatInt(number, 10)
120
+	} else if number >= 100000 {
121
+		zero = "00" + strconv.FormatInt(number, 10)
122
+	} else if number >= 1000000 {
123
+		zero = "0" + strconv.FormatInt(number, 10)
124
+	} else {
125
+		zero = strconv.FormatInt(number, 10)
126
+	}
127
+	c.ServeSuccessJSON(map[string]interface{}{
128
+		"fapiao_number": zero,
129
+	})
130
+	return
107 131
 }
108 132
 func (c *HisApiController) ChangeOrderDesc() {
109 133
 	id, _ := c.GetInt64("id")
@@ -3859,8 +3883,8 @@ func (c *HisApiController) DeletePrescription() {
3859 3883
 					if item.Type == 3 && item.IsOut == 1 {
3860 3884
 						good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
3861 3885
 						f_count, _ := strconv.ParseFloat(item.Count, 64)
3862
-						//good.Total = good.Total + f_count
3863
-						//service.UpdateGoodInfo(&good)
3886
+						good.Total = good.Total + f_count
3887
+						service.UpdateGoodInfo(&good)
3864 3888
 						operation_time := time.Now().Unix()
3865 3889
 						creater := c.GetAdminUserInfo().AdminUser.Id
3866 3890
 						//创建退库单
@@ -3977,21 +4001,6 @@ func (c *HisApiController) DeletePrescription() {
3977 4001
 								service.UpdateSumAddCancelCount(c.GetAdminUserInfo().CurrentOrgId, item.ProjectId, houseConfig.StorehouseOutInfo, total_count)
3978 4002
 								//出库数量减少
3979 4003
 								service.UpdateSumCount(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId, total_count)
3980
-
3981
-								//防止先出库 后开药的情况,查找当天是否出库完全
3982
-								numberList, _ := service.GetHisPrescriptionNumberList(item.ProjectId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId, item.PatientId)
3983
-								if len(numberList) == 0 {
3984
-									infor, _ := service.GetWarehouseOutnfoByProjectId(item.ProjectId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId, item.PatientId)
3985
-
3986
-									for _, item := range infor {
3987
-										//退库数量
3988
-										service.UpdateWarehouseInfoByProject(item.ProjectId, item.WarehouseInfotId, c.GetAdminUserInfo().CurrentOrgId, item.Count)
3989
-									}
3990
-
3991
-									//清空数据表
3992
-									service.UpdateWarehouseInfoByPatientId(item.ProjectId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId, item.PatientId)
3993
-
3994
-								}
3995 4004
 							}
3996 4005
 
3997 4006
 							if info.Count < total_count {
@@ -4098,20 +4107,6 @@ func (c *HisApiController) DeletePrescription() {
4098 4107
 							//更新基础库库存
4099 4108
 							service.UpdateGoodInfoSumCountSix(item.ProjectId, flush_count, c.GetAdminUserInfo().CurrentOrgId)
4100 4109
 
4101
-							//防止先出库 后开药的情况,查找当天是否出库完全
4102
-							numberList, _ := service.GetHisPrescriptionNumberList(item.ProjectId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId, item.PatientId)
4103
-							if len(numberList) == 0 {
4104
-								infor, _ := service.GetWarehouseOutnfoByProjectId(item.ProjectId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId, item.PatientId)
4105
-
4106
-								for _, item := range infor {
4107
-									//退库数量
4108
-									service.UpdateWarehouseInfoByProject(item.ProjectId, item.WarehouseInfotId, c.GetAdminUserInfo().CurrentOrgId, item.Count)
4109
-								}
4110
-
4111
-								//清空数据表
4112
-								service.UpdateWarehouseInfoByPatientId(item.ProjectId, item.RecordDate, c.GetAdminUserInfo().CurrentOrgId, item.PatientId)
4113
-
4114
-							}
4115 4110
 						}
4116 4111
 
4117 4112
 					}
@@ -4168,7 +4163,8 @@ func (c *HisApiController) DeletePrescription() {
4168 4163
 					for _, it := range goodList {
4169 4164
 						flush_count += it.StockCount
4170 4165
 					}
4171
-
4166
+					fmt.Println("历史出库数据", info.Count)
4167
+					fmt.Println("出库数量", total_count)
4172 4168
 					if info.ID > 0 {
4173 4169
 						cancelStockInfo := models.CancelStockInfo{
4174 4170
 							GoodId:          item.ProjectId,
@@ -4214,6 +4210,7 @@ func (c *HisApiController) DeletePrescription() {
4214 4210
 									flush_count_one += it.StockCount
4215 4211
 								}
4216 4212
 								//查询该批次是否有退库数据
4213
+								//flow, _ := service.GetWarehouseStockFlow(it.WarehouseInfotId, it.GoodId, c.GetAdminUserInfo().CurrentOrgId, it.PatientId, it.SysRecordTime)
4217 4214
 								creater := c.GetAdminUserInfo().AdminUser.Id
4218 4215
 
4219 4216
 								flow := models.VmStockFlow{
@@ -4251,10 +4248,48 @@ func (c *HisApiController) DeletePrescription() {
4251 4248
 								}
4252 4249
 								service.CreateStockFlowOne(flow)
4253 4250
 
4251
+								//if flow.ID > 0 {
4252
+								//	service.AddCountFlowOne(it.WarehouseInfotId, it.GoodId, c.GetAdminUserInfo().CurrentOrgId, it.PatientId, it.Count, it.SysRecordTime, flush_count_one)
4253
+								//}
4254 4254
 							}
4255 4255
 
4256 4256
 						}
4257 4257
 
4258
+						//flow := models.VmStockFlow{
4259
+						//	WarehousingId:           info.WarehouseInfotId,
4260
+						//	GoodId:                  item.ProjectId,
4261
+						//	Number:                  info.Number,
4262
+						//	LicenseNumber:           info.LicenseNumber,
4263
+						//	Count:                   prescribingNumber,
4264
+						//	UserOrgId:               c.GetAdminUserInfo().CurrentOrgId,
4265
+						//	PatientId:               item.PatientId,
4266
+						//	SystemTime:              info.SysRecordTime,
4267
+						//	ConsumableType:          7,
4268
+						//	IsSys:                   0,
4269
+						//	WarehousingOrder:        "",
4270
+						//	WarehouseOutId:          info.WarehouseOutId,
4271
+						//	WarehouseOutOrderNumber: info.WarehouseOutOrderNumber,
4272
+						//	IsEdit:                  0,
4273
+						//	CancelStockId:           cancel.ID,
4274
+						//	CancelOrderNumber:       cancel.OrderNumber,
4275
+						//	Manufacturer:            manufacturer.ID,
4276
+						//	Dealer:                  0,
4277
+						//	Creator:                 c.GetAdminUserInfo().CurrentOrgId,
4278
+						//	UpdateCreator:           0,
4279
+						//	Status:                  1,
4280
+						//	Ctime:                   time.Now().Unix(),
4281
+						//	Mtime:                   0,
4282
+						//	Price:                   info.Price,
4283
+						//	WarehousingDetailId:     info.WarehouseInfotId,
4284
+						//	WarehouseOutDetailId:    info.ID,
4285
+						//	CancelOutDetailId:       cancelInfo.ID,
4286
+						//	ProductDate:             info.ProductDate,
4287
+						//	ExpireDate:              info.ExpiryDate,
4288
+						//	StorehouseId:            houseConfig.StorehouseOutInfo,
4289
+						//	OverCount:               flush_count,
4290
+						//}
4291
+						//service.CreateStockFlowOne(flow)
4292
+
4258 4293
 						//退库数量增加
4259 4294
 						service.UpdateSumAddCancelCount(c.GetAdminUserInfo().CurrentOrgId, item.ProjectId, houseConfig.StorehouseOutInfo, total_count)
4260 4295
 						//出库数量减少
@@ -4263,13 +4298,11 @@ func (c *HisApiController) DeletePrescription() {
4263 4298
 						//查询已出库数量
4264 4299
 						dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
4265 4300
 
4266
-						//如果当前处方数量 小于 出库数量
4267 4301
 						if prescribingNumber < dialysisInfo.Count {
4268 4302
 							//改变数量
4269 4303
 							service.UpdateAutoGood(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId, item.ID, prescribingNumber)
4270 4304
 						}
4271 4305
 
4272
-						//如果当前处方数量 大于或者等于出库数量
4273 4306
 						if prescribingNumber >= dialysisInfo.Count {
4274 4307
 							//删除出库表
4275 4308
 							service.DeleteAutoRedeceDetailTwenty(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId, item.ID)
@@ -4283,7 +4316,7 @@ func (c *HisApiController) DeletePrescription() {
4283 4316
 
4284 4317
 						//更新库存
4285 4318
 						msgerrkonde := service.UpdateSumGood(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId, flush_count_one)
4286
-						fmt.Println("msgerrkonde", msgerrkonde)
4319
+						fmt.Println("msgerrkonde23332323", msgerrkonde)
4287 4320
 
4288 4321
 						//更新基础库库存
4289 4322
 						service.UpdateGoodInfoReduceSumCount(item.ProjectId, flush_count_one, c.GetAdminUserInfo().CurrentOrgId)
@@ -6802,23 +6835,6 @@ func (c *HisApiController) GetUploadInfo() {
6802 6835
 	tmp_decimal := c.GetString("tmp_decimal")
6803 6836
 
6804 6837
 	//last_order, _ := service.GetLastHisOrderThree(c.GetAdminUserInfo().CurrentOrgId)
6805
-	max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
6806
-	count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
6807
-	fmt.Println(count)
6808
-	var zero string
6809
-	number := count + 1
6810
-	if number >= 1000 {
6811
-		zero = "0000" + strconv.FormatInt(number, 10)
6812
-	} else if number >= 10000 {
6813
-		zero = "000" + strconv.FormatInt(number, 10)
6814
-	} else if number >= 100000 {
6815
-		zero = "00" + strconv.FormatInt(number, 10)
6816
-	} else if number >= 1000000 {
6817
-		zero = "0" + strconv.FormatInt(number, 10)
6818
-	} else {
6819
-		zero = strconv.FormatInt(number, 10)
6820
-	}
6821
-	fapiao_number = zero
6822 6838
 
6823 6839
 	var decimal float64 //本次使用的押金
6824 6840
 	var errmsg error

+ 23 - 1
controllers/mobile_api_controllers/check_weight_api_controller.go Voir le fichier

@@ -437,6 +437,12 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
437 437
 				newprescribe.DialysisDurationMinute = 0
438 438
 				newprescribe.BloodAccess = dialysisSolution.BloodAccess
439 439
 			}
440
+
441
+			if adminUserInfo.Org.Id == 10445 {
442
+				lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
443
+				newprescribe.Remark = lastDialysisPrescription.Remark
444
+			}
445
+
440 446
 			//插入透析处方
441 447
 			err := service.AddSigleRecord(&newprescribe)
442 448
 
@@ -538,6 +544,11 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
538 544
 					newprescribe.DialysisDurationMinute = 0
539 545
 					newprescribe.BloodAccess = dialysisSolution.BloodAccess
540 546
 				}
547
+
548
+				if adminUserInfo.Org.Id == 10445 {
549
+					lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
550
+					newprescribe.Remark = lastDialysisPrescription.Remark
551
+				}
541 552
 				err := service.AddSigleRecord(&newprescribe)
542 553
 
543 554
 				//记录日志
@@ -629,6 +640,10 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
629 640
 					newprescribe.DialysisDurationMinute = 0
630 641
 					newprescribe.BloodAccess = dialysisSolution.BloodAccess
631 642
 				}
643
+				if adminUserInfo.Org.Id == 10445 {
644
+					lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
645
+					newprescribe.Remark = lastDialysisPrescription.Remark
646
+				}
632 647
 				err := service.AddSigleRecord(&newprescribe)
633 648
 
634 649
 				//记录日志
@@ -671,7 +686,10 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
671 686
 				newprescribe.DewaterAmount = dewater_amount
672 687
 				newprescribe.TargetUltrafiltration = dewater_amount
673 688
 				newprescribe.Status = 1
674
-
689
+				if adminUserInfo.Org.Id == 10445 {
690
+					lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
691
+					newprescribe.Remark = lastDialysisPrescription.Remark
692
+				}
675 693
 				err := service.AddSigleRecord(&newprescribe)
676 694
 				//记录日志
677 695
 				byterequest, _ := json.Marshal(newprescribe)
@@ -713,6 +731,10 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
713 731
 			if adminUserInfo.Org.Id == 10340 {
714 732
 				dialysisPrescribe.TargetUltrafiltration = 0
715 733
 			}
734
+			if adminUserInfo.Org.Id == 10445 {
735
+				lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
736
+				dialysisPrescribe.Remark = lastDialysisPrescription.Remark
737
+			}
716 738
 			updateErr := service.UpDateDialysisPrescription(dialysisPrescribe)
717 739
 			//记录日志
718 740
 			byterequest, _ := json.Marshal(dialysisPrescribe)

+ 3 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Voir le fichier

@@ -600,6 +600,8 @@ func (this *DialysisAPIController) DialysisRecord() {
600 600
 	if remind_config.ID > 0 && remind_config.IsOpen == 1 {
601 601
 		remind_lists, _ = service.GetAllInspectionRemind(adminInfo.Org.Id, patientID)
602 602
 	}
603
+
604
+	lastDialysisPrescription, _ := service.GetLastDialysisPrescription(patientID, adminInfo.Org.Id)
603 605
 	returnData := map[string]interface{}{
604 606
 		"patient":                        patient,
605 607
 		"schedual":                       schedual,
@@ -634,6 +636,7 @@ func (this *DialysisAPIController) DialysisRecord() {
634 636
 		"prescription_open":              prescriptionConfig.IsOpen,
635 637
 		"lastOrder":                      lastOrder,
636 638
 		"remind_lists":                   remind_lists,
639
+		"lastDialysisPrescription":       lastDialysisPrescription,
637 640
 	}
638 641
 
639 642
 	this.ServeSuccessJSON(returnData)

+ 2 - 0
controllers/stock_in_api_controller.go Voir le fichier

@@ -1363,6 +1363,7 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1363 1363
 			}
1364 1364
 		}
1365 1365
 	}
1366
+	fmt.Println("warehouseOut_id", warehouseOut_id)
1366 1367
 	if warehouseOut_id == 0 {
1367 1368
 		//查询是否生成出库单
1368 1369
 		_, errcodes := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
@@ -1370,6 +1371,7 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1370 1371
 			service.AddSigleWarehouseOut(&warehouseOut)
1371 1372
 		}
1372 1373
 	}
1374
+
1373 1375
 	if warehouseOut_id > 0 {
1374 1376
 		service.UpdateSingleWarehoseOut(warehouseOut_id, storehouse_id)
1375 1377
 	}

+ 1 - 1
service/stock_service.go Voir le fichier

@@ -5553,7 +5553,7 @@ func DeleteDrugAutoWarehouseSeven(drugid int64, patient_id int64, record_time in
5553 5553
 
5554 5554
 	err := XTWriteDB().Model(models.DrugAutomaticReduceDetail{}).Where("drug_id = ? and patient_id = ? and record_time = ? and status = 1 and advice_id = ?", drugid, patient_id, record_time, advice_id).Updates(map[string]interface{}{"status": 0}).Error
5555 5555
 	//err = XTWriteDB().Model(models.DrugWarehouseOutInfo{}).Where("drug_id = ? and patient_id = ? and sys_record_time = ? and status = 1 and advice_id = ?", drugid, patient_id, record_time, advice_id).Updates(map[string]interface{}{"status": 0}).Error
5556
-	//err = XTWriteDB().Model(models.DrugFlow{}).Where("drug_id = ? and patient_id = ? and system_time = ? and status = 1 and advice_id = ?", drugid, patient_id, record_time, advice_id).Updates(map[string]interface{}{"status": 0}).Error
5556
+	err = XTWriteDB().Model(models.DrugFlow{}).Where("drug_id = ? and patient_id = ? and system_time = ? and status = 1 and advice_id = ?", drugid, patient_id, record_time, advice_id).Updates(map[string]interface{}{"status": 0}).Error
5557 5557
 	return err
5558 5558
 }
5559 5559