|
@@ -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
|