|
@@ -152,6 +152,16 @@ func SelfDrugRouters() {
|
152
|
152
|
beego.Router("/api/drug/getselfdrugbatchnumber", &SelfDrugApiController{}, "Get:GetSelfDrugBatchNumber")
|
153
|
153
|
|
154
|
154
|
beego.Router("/api/drug/postsetfdrugwarehouseout", &SelfDrugApiController{}, "Post:PostSelfDrugWarehouseOut")
|
|
155
|
+
|
|
156
|
+ beego.Router("/api/drug/getallselfdrugwarehouseoutlist", &SelfDrugApiController{}, "Get:GetAllSelfDrugWarehouseOutList")
|
|
157
|
+
|
|
158
|
+ beego.Router("/api/drug/deleteselfwarehouseout", &SelfDrugApiController{}, "Get:DeleteSelfWarehouseOut")
|
|
159
|
+
|
|
160
|
+ beego.Router("/api/drug/getselfdrugwarehouseoutbyid", &SelfDrugApiController{}, "Get:GetSelfDrugWarehouseOutById")
|
|
161
|
+
|
|
162
|
+ beego.Router("/api/drug/modifyselfdrugwarehouseout", &SelfDrugApiController{}, "Post:ModifySelfDrugWarehouseOut")
|
|
163
|
+
|
|
164
|
+ beego.Router("/api/drug/getselfdrugquery", &SelfDrugApiController{}, "Get:GetSelfDrugQuery")
|
155
|
165
|
}
|
156
|
166
|
|
157
|
167
|
func (this *SelfDrugApiController) GetCurrentPatient() {
|
|
@@ -4799,31 +4809,31 @@ func (c *SelfDrugApiController) ModifySelfDrugWarehouse() {
|
4799
|
4809
|
total, _ := service.FindSelfAllWarehouseTotal(adminUserInfo.CurrentOrgId, tx)
|
4800
|
4810
|
total = total + 1
|
4801
|
4811
|
|
4802
|
|
- operation_time := time.Now().Unix()
|
4803
|
|
- creater := adminUserInfo.AdminUser.Id
|
|
4812
|
+ //operation_time := time.Now().Unix()
|
|
4813
|
+ //creater := adminUserInfo.AdminUser.Id
|
4804
|
4814
|
|
4805
|
4815
|
warehousing_order := "YPRKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
4806
|
4816
|
|
4807
|
|
- warehousing := models.XtSelfDrugWarehouse{
|
4808
|
|
- ID: warehousing_id,
|
4809
|
|
- WarehousingOrder: warehousing_order,
|
4810
|
|
- OperationTime: operation_time,
|
4811
|
|
- OrgId: adminUserInfo.CurrentOrgId,
|
4812
|
|
- Creater: creater,
|
4813
|
|
- Ctime: time.Now().Unix(),
|
4814
|
|
- Status: 1,
|
4815
|
|
- WarehousingTime: warehousingDate.Unix(),
|
4816
|
|
- Type: 0,
|
4817
|
|
- StorehouseId: 0,
|
4818
|
|
- IsCheck: 2,
|
4819
|
|
- PatientId: patient_id,
|
4820
|
|
- }
|
4821
|
|
- if warehousing_id == 0 {
|
4822
|
|
- service.AddSelfDrugWarehouse(&warehousing, tx)
|
4823
|
|
- }
|
4824
|
|
- if warehousing_id > 0 {
|
4825
|
|
- service.UpdateSelfDrugWarehouse(&warehousing, tx)
|
4826
|
|
- }
|
|
4817
|
+ //warehousing := models.XtSelfDrugWarehouse{
|
|
4818
|
+ // ID: warehousing_id,
|
|
4819
|
+ // WarehousingOrder: warehousing_order,
|
|
4820
|
+ // OperationTime: operation_time,
|
|
4821
|
+ // OrgId: adminUserInfo.CurrentOrgId,
|
|
4822
|
+ // Creater: creater,
|
|
4823
|
+ // Ctime: time.Now().Unix(),
|
|
4824
|
+ // Status: 1,
|
|
4825
|
+ // WarehousingTime: warehousingDate.Unix(),
|
|
4826
|
+ // Type: 0,
|
|
4827
|
+ // StorehouseId: 0,
|
|
4828
|
+ // IsCheck: 2,
|
|
4829
|
+ // PatientId: patient_id,
|
|
4830
|
+ //}
|
|
4831
|
+ //if warehousing_id == 0 {
|
|
4832
|
+ // service.AddSelfDrugWarehouse(&warehousing, tx)
|
|
4833
|
+ //}
|
|
4834
|
+ //if warehousing_id > 0 {
|
|
4835
|
+ // service.UpdateSelfDrugWarehouse(&warehousing, tx)
|
|
4836
|
+ //}
|
4827
|
4837
|
info, _ := service.FindLastSelfWarehousing(adminUserInfo.CurrentOrgId, patient_id, tx)
|
4828
|
4838
|
dataBody := make(map[string]interface{}, 0)
|
4829
|
4839
|
err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
@@ -4924,7 +4934,7 @@ func (c *SelfDrugApiController) ModifySelfDrugWarehouse() {
|
4924
|
4934
|
warehouseInfo := &models.XtSelfDrugWarehouseInfo{
|
4925
|
4935
|
ID: id,
|
4926
|
4936
|
WarehousingOrder: warehousing_order,
|
4927
|
|
- WarehousingId: info.ID,
|
|
4937
|
+ WarehousingId: warehousing_id,
|
4928
|
4938
|
DrugId: drug_id,
|
4929
|
4939
|
Number: number,
|
4930
|
4940
|
ProductDate: productDates,
|
|
@@ -4966,7 +4976,7 @@ func (c *SelfDrugApiController) ModifySelfDrugWarehouse() {
|
4966
|
4976
|
}
|
4967
|
4977
|
}
|
4968
|
4978
|
|
4969
|
|
- list, _ := service.FindSelfDrugWarehouseInfoListById(info.ID, adminUserInfo.CurrentOrgId, patient_id, tx)
|
|
4979
|
+ list, _ := service.FindSelfDrugWarehouseInfoListById(warehousing_id, adminUserInfo.CurrentOrgId, patient_id, tx)
|
4970
|
4980
|
manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
|
4971
|
4981
|
dealerList, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
|
4972
|
4982
|
var drugType = "药品类型"
|
|
@@ -5005,7 +5015,7 @@ func (c *SelfDrugApiController) DeleteSelfDrugWarehouse() {
|
5005
|
5015
|
|
5006
|
5016
|
func (c *SelfDrugApiController) TocheckSelfWarehouseingInfo() {
|
5007
|
5017
|
|
5008
|
|
- id, _ := c.GetInt64("id")
|
|
5018
|
+ id, _ := c.GetInt64("warehousing_id")
|
5009
|
5019
|
patient_id, _ := c.GetInt64("patient_id")
|
5010
|
5020
|
orgId := c.GetAdminUserInfo().CurrentOrgId
|
5011
|
5021
|
info, _ := service.GetSelfWarehouseInfoByWarehouseInfo(id, patient_id, orgId)
|
|
@@ -5153,8 +5163,6 @@ func (c *SelfDrugApiController) GetSelfDrugBatchNumber() {
|
5153
|
5163
|
|
5154
|
5164
|
func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5155
|
5165
|
|
5156
|
|
- fmt.Println("开启===========================================================")
|
5157
|
|
-
|
5158
|
5166
|
db := service.XTWriteDB()
|
5159
|
5167
|
tx := db.Begin()
|
5160
|
5168
|
defer func() {
|
|
@@ -5166,11 +5174,14 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5166
|
5174
|
}()
|
5167
|
5175
|
patient_id, _ := c.GetInt64("patient_id")
|
5168
|
5176
|
warehouse_out_id, _ := c.GetInt64("warehouse_out_id")
|
|
5177
|
+
|
5169
|
5178
|
ctime := time.Now().Unix()
|
5170
|
5179
|
adminUserInfo := c.GetAdminUserInfo()
|
5171
|
5180
|
|
5172
|
5181
|
warehousing_out_time := c.GetString("warehousing_out_time")
|
|
5182
|
+
|
5173
|
5183
|
warehousingOutDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", warehousing_out_time)
|
|
5184
|
+
|
5174
|
5185
|
if parseDateErr != nil {
|
5175
|
5186
|
c.ErrorLog("日期(%v)解析错误:%v", warehousingOutDate, parseDateErr)
|
5176
|
5187
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -5186,7 +5197,7 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5186
|
5197
|
number = number + total
|
5187
|
5198
|
warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
|
5188
|
5199
|
operation_time := time.Now().Unix()
|
5189
|
|
- fmt.Println("operation_time=================================", operation_time)
|
|
5200
|
+
|
5190
|
5201
|
creater := adminUserInfo.AdminUser.Id
|
5191
|
5202
|
//创建一个出库单
|
5192
|
5203
|
warehouseOut := models.XtSelfDrugWarehouseOut{
|
|
@@ -5240,24 +5251,304 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5240
|
5251
|
return
|
5241
|
5252
|
}
|
5242
|
5253
|
|
5243
|
|
- if items["price"] == nil || reflect.TypeOf(items["price"]).String() != "string" {
|
5244
|
|
- utils.ErrorLog("price")
|
|
5254
|
+ count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
|
|
5255
|
+
|
|
5256
|
+ remark := items["remark"].(string)
|
|
5257
|
+ max_unit := items["max_unit"].(string)
|
|
5258
|
+ dealer := int64(items["dealer"].(float64))
|
|
5259
|
+
|
|
5260
|
+ manufacturer := int64(items["manufacturer"].(float64))
|
|
5261
|
+
|
|
5262
|
+ batch_number := items["batch_number"].(string)
|
|
5263
|
+
|
|
5264
|
+ warehouse_info_id := int64(items["warehouse_info_id"].(float64))
|
|
5265
|
+ var productDates int64
|
|
5266
|
+ var expiryDates int64
|
|
5267
|
+ if items["expiry_date"] == nil || reflect.TypeOf(items["expiry_date"]).String() != "string" {
|
|
5268
|
+ expiryDates = 0
|
|
5269
|
+ } else {
|
|
5270
|
+ if len(items["expiry_date"].(string)) == 0 {
|
|
5271
|
+ expiryDates = 0
|
|
5272
|
+
|
|
5273
|
+ } else {
|
|
5274
|
+ expiryDate, _ := items["expiry_date"].(string)
|
|
5275
|
+ expiry_date, _ := utils.ParseTimeStringToTime("2006-01-02", expiryDate)
|
|
5276
|
+ expiryDates = expiry_date.Unix()
|
|
5277
|
+
|
|
5278
|
+ }
|
|
5279
|
+
|
|
5280
|
+ }
|
|
5281
|
+ if items["product_date"] == nil || reflect.TypeOf(items["product_date"]).String() != "string" {
|
|
5282
|
+ productDates = 0
|
|
5283
|
+ } else {
|
|
5284
|
+ if len(items["product_date"].(string)) == 0 {
|
|
5285
|
+ productDates = 0
|
|
5286
|
+
|
|
5287
|
+ } else {
|
|
5288
|
+ productDate, _ := items["product_date"].(string)
|
|
5289
|
+ product_date, _ := utils.ParseTimeStringToTime("2006-01-02", productDate)
|
|
5290
|
+ productDates = product_date.Unix()
|
|
5291
|
+ }
|
|
5292
|
+ }
|
|
5293
|
+
|
|
5294
|
+ stock_count, _ := items["stock_count"].(string)
|
|
5295
|
+
|
|
5296
|
+ id := int64(items["id"].(float64))
|
|
5297
|
+
|
|
5298
|
+ class_type, _ := items["class_type"].(string)
|
|
5299
|
+
|
|
5300
|
+ warehouseOutInfo := &models.XtSelfDrugWarehouseOutInfo{
|
|
5301
|
+ ID: id,
|
|
5302
|
+ WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
|
5303
|
+ WarehouseOutId: lastWarehouseOut.ID,
|
|
5304
|
+ DrugId: drug_id,
|
|
5305
|
+ Count: count,
|
|
5306
|
+ Price: 0,
|
|
5307
|
+ TotalPrice: 0,
|
|
5308
|
+ Status: 1,
|
|
5309
|
+ Ctime: warehousingOutDate.Unix(),
|
|
5310
|
+ Mtime: ctime,
|
|
5311
|
+ Remark: remark,
|
|
5312
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
5313
|
+ Type: 0,
|
|
5314
|
+ Manufacturer: manufacturer,
|
|
5315
|
+ Dealer: dealer,
|
|
5316
|
+ RetailPrice: 0,
|
|
5317
|
+ RetailTotalPrice: 0,
|
|
5318
|
+ CountUnit: max_unit,
|
|
5319
|
+ ExpiryDate: expiryDates,
|
|
5320
|
+ ProductDate: productDates,
|
|
5321
|
+ Number: "",
|
|
5322
|
+ BatchNumber: batch_number,
|
|
5323
|
+ IsSys: 0,
|
|
5324
|
+ WarehouseInfoId: warehouse_info_id,
|
|
5325
|
+ AdminUserId: 0,
|
|
5326
|
+ StockCount: stock_count,
|
|
5327
|
+ IsCheck: 2,
|
|
5328
|
+ SysRecordTime: warehousingOutDate.Unix(),
|
|
5329
|
+ PatientId: patient_id,
|
|
5330
|
+ ClassType: class_type,
|
|
5331
|
+ }
|
|
5332
|
+ warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
|
|
5333
|
+
|
|
5334
|
+ }
|
|
5335
|
+ }
|
|
5336
|
+ }
|
|
5337
|
+
|
|
5338
|
+ //调用出库逻辑
|
|
5339
|
+ for _, item := range warehousingOutInfo {
|
|
5340
|
+ if item.ID == 0 {
|
|
5341
|
+ errOne := service.AddSelfSigleDrugWarehouseOutInfo(item, tx)
|
|
5342
|
+ fmt.Println(errOne)
|
|
5343
|
+ }
|
|
5344
|
+ if item.ID > 0 {
|
|
5345
|
+ service.UpdatedSelfDrugWarehouseInfo(item, item.ID, tx)
|
|
5346
|
+ }
|
|
5347
|
+
|
|
5348
|
+ }
|
|
5349
|
+
|
|
5350
|
+ list, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
|
|
5351
|
+
|
|
5352
|
+ manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
|
|
5353
|
+
|
|
5354
|
+ warehousingOutInfoList, _ := service.GetSelfDrugWarehouseOutListById(lastWarehouseOut.ID, adminUserInfo.CurrentOrgId, tx)
|
|
5355
|
+
|
|
5356
|
+ var drugType = "药品类型"
|
|
5357
|
+ drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
|
|
5358
|
+ drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, adminUserInfo.CurrentOrgId)
|
|
5359
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
5360
|
+ "msg": "2",
|
|
5361
|
+ "drug_name": "",
|
|
5362
|
+ "dose": "",
|
|
5363
|
+ "dose_unit": "",
|
|
5364
|
+ "min_number": "",
|
|
5365
|
+ "min_unit": "",
|
|
5366
|
+ "max_unit": "",
|
|
5367
|
+ "dealerList": list,
|
|
5368
|
+ "manufacturerList": manufacturerList,
|
|
5369
|
+ "warehousingOutInfo": warehousingOutInfoList,
|
|
5370
|
+ "warehouseOut": lastWarehouseOut,
|
|
5371
|
+ "drugTypeList": drugTypeList,
|
|
5372
|
+ })
|
|
5373
|
+ return
|
|
5374
|
+}
|
|
5375
|
+
|
|
5376
|
+func (c *SelfDrugApiController) GetAllSelfDrugWarehouseOutList() {
|
|
5377
|
+
|
|
5378
|
+ keyword := c.GetString("keyword")
|
|
5379
|
+
|
|
5380
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
5381
|
+
|
|
5382
|
+ start_time := c.GetString("start_time")
|
|
5383
|
+
|
|
5384
|
+ end_time := c.GetString("end_time")
|
|
5385
|
+
|
|
5386
|
+ timeLayout := "2006-01-02"
|
|
5387
|
+ loc, _ := time.LoadLocation("Local")
|
|
5388
|
+ var startTime int64
|
|
5389
|
+ if len(start_time) > 0 {
|
|
5390
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
5391
|
+ if err != nil {
|
|
5392
|
+ fmt.Println(err)
|
|
5393
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5394
|
+ return
|
|
5395
|
+ }
|
|
5396
|
+ startTime = theTime.Unix()
|
|
5397
|
+ }
|
|
5398
|
+ var endTime int64
|
|
5399
|
+ if len(end_time) > 0 {
|
|
5400
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
5401
|
+ if err != nil {
|
|
5402
|
+ utils.ErrorLog(err.Error())
|
|
5403
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5404
|
+ return
|
|
5405
|
+ }
|
|
5406
|
+ endTime = theTime.Unix()
|
|
5407
|
+ }
|
|
5408
|
+ orgId := c.GetAdminUserInfo().CurrentOrgId
|
|
5409
|
+ baseList, _ := service.GetAllBaseDrugListByKeyWord(keyword, orgId)
|
|
5410
|
+ var ids []int64
|
|
5411
|
+ for _, item := range baseList {
|
|
5412
|
+ ids = append(ids, item.ID)
|
|
5413
|
+ }
|
|
5414
|
+ outInfo, _ := service.GetAllSelfDrugWarehouseOutList(ids, patient_id, startTime, endTime, orgId)
|
|
5415
|
+
|
|
5416
|
+ manufacturerList, _ := service.GetAllManufacturerList(orgId)
|
|
5417
|
+ dealerList, _ := service.GetAllDealerList(orgId)
|
|
5418
|
+ var drugType = "药品类型"
|
|
5419
|
+ drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
|
|
5420
|
+ drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
|
|
5421
|
+
|
|
5422
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
5423
|
+ "outInfo": outInfo,
|
|
5424
|
+ "manufacturerList": manufacturerList,
|
|
5425
|
+ "dealerList": dealerList,
|
|
5426
|
+ "drugTypeList": drugTypeList,
|
|
5427
|
+ })
|
|
5428
|
+}
|
|
5429
|
+
|
|
5430
|
+func (c *SelfDrugApiController) DeleteSelfWarehouseOut() {
|
|
5431
|
+
|
|
5432
|
+ id, _ := c.GetInt64("id")
|
|
5433
|
+
|
|
5434
|
+ service.DeleteSelfWarehouseOut(id)
|
|
5435
|
+
|
|
5436
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
5437
|
+ "msg": "ok",
|
|
5438
|
+ })
|
|
5439
|
+
|
|
5440
|
+ return
|
|
5441
|
+}
|
|
5442
|
+
|
|
5443
|
+func (c *SelfDrugApiController) GetSelfDrugWarehouseOutById() {
|
|
5444
|
+
|
|
5445
|
+ id, _ := c.GetInt64("id")
|
|
5446
|
+ orgId := c.GetAdminUserInfo().CurrentOrgId
|
|
5447
|
+ outInfo, _ := service.GetSelfDrugWarehouseOutById(id)
|
|
5448
|
+
|
|
5449
|
+ manufacturerList, _ := service.GetAllManufacturerList(orgId)
|
|
5450
|
+ dealerList, _ := service.GetAllDealerList(orgId)
|
|
5451
|
+ var drugType = "药品类型"
|
|
5452
|
+ drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
|
|
5453
|
+ drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
|
|
5454
|
+
|
|
5455
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
5456
|
+ "outInfo": outInfo,
|
|
5457
|
+ "manufacturerList": manufacturerList,
|
|
5458
|
+ "dealerList": dealerList,
|
|
5459
|
+ "drugTypeList": drugTypeList,
|
|
5460
|
+ })
|
|
5461
|
+}
|
|
5462
|
+
|
|
5463
|
+func (c *SelfDrugApiController) ModifySelfDrugWarehouseOut() {
|
|
5464
|
+
|
|
5465
|
+ db := service.XTWriteDB()
|
|
5466
|
+ tx := db.Begin()
|
|
5467
|
+ defer func() {
|
|
5468
|
+ if r := recover(); r != nil {
|
|
5469
|
+ tx.Rollback()
|
|
5470
|
+ } else {
|
|
5471
|
+ tx.Commit()
|
|
5472
|
+ }
|
|
5473
|
+ }()
|
|
5474
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
5475
|
+ warehouse_out_id, _ := c.GetInt64("warehouse_out_id")
|
|
5476
|
+ ctime := time.Now().Unix()
|
|
5477
|
+ adminUserInfo := c.GetAdminUserInfo()
|
|
5478
|
+ warehousing_out_time := c.GetString("warehousing_out_time")
|
|
5479
|
+ warehousingOutDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", warehousing_out_time)
|
|
5480
|
+ if parseDateErr != nil {
|
|
5481
|
+ c.ErrorLog("日期(%v)解析错误:%v", warehousingOutDate, parseDateErr)
|
|
5482
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5483
|
+ return
|
|
5484
|
+ }
|
|
5485
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
5486
|
+ timeArr := strings.Split(timeStr, "-")
|
|
5487
|
+ total, _ := service.FindAllSelfDrugWarehouseOut(adminUserInfo.CurrentOrgId, tx)
|
|
5488
|
+
|
|
5489
|
+ total = total + 1
|
|
5490
|
+ warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
|
|
5491
|
+ number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
|
|
5492
|
+ number = number + total
|
|
5493
|
+ warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
|
|
5494
|
+ operation_time := time.Now().Unix()
|
|
5495
|
+
|
|
5496
|
+ creater := adminUserInfo.AdminUser.Id
|
|
5497
|
+ //创建一个出库单
|
|
5498
|
+ warehouseOut := models.XtSelfDrugWarehouseOut{
|
|
5499
|
+ WarehouseOutOrderNumber: warehousing_out_order,
|
|
5500
|
+ OperationTime: operation_time,
|
|
5501
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
5502
|
+ Creater: creater,
|
|
5503
|
+ Ctime: ctime,
|
|
5504
|
+ Status: 1,
|
|
5505
|
+ WarehouseOutTime: warehousingOutDate.Unix(),
|
|
5506
|
+ Type: 0,
|
|
5507
|
+ PatientId: patient_id,
|
|
5508
|
+ IsCheck: 2,
|
|
5509
|
+ }
|
|
5510
|
+
|
|
5511
|
+ lastWarehouseOut, _ := service.GetSelfDrugLastWarehouseOut(adminUserInfo.CurrentOrgId, tx)
|
|
5512
|
+
|
|
5513
|
+ dataBody := make(map[string]interface{}, 0)
|
|
5514
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
5515
|
+ if err != nil {
|
|
5516
|
+ utils.ErrorLog(err.Error())
|
|
5517
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5518
|
+ return
|
|
5519
|
+ }
|
|
5520
|
+ //出库单详情
|
|
5521
|
+ var warehousingOutInfo []*models.XtSelfDrugWarehouseOutInfo
|
|
5522
|
+ //把前端的参数加工为出库单详情
|
|
5523
|
+ if dataBody["stockOut"] != nil && reflect.TypeOf(dataBody["stockOut"]).String() == "[]interface {}" {
|
|
5524
|
+ thisStockIn, _ := dataBody["stockOut"].([]interface{})
|
|
5525
|
+
|
|
5526
|
+ if len(thisStockIn) > 0 {
|
|
5527
|
+ for _, item := range thisStockIn {
|
|
5528
|
+
|
|
5529
|
+ items := item.(map[string]interface{})
|
|
5530
|
+
|
|
5531
|
+ if items["drug_id"] == nil || reflect.TypeOf(items["drug_id"]).String() != "float64" {
|
|
5532
|
+ utils.ErrorLog("drug_id")
|
|
5533
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5534
|
+ return
|
|
5535
|
+ }
|
|
5536
|
+ drug_id := int64(items["drug_id"].(float64))
|
|
5537
|
+
|
|
5538
|
+ if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "string" {
|
|
5539
|
+ utils.ErrorLog("count")
|
5245
|
5540
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
5246
|
5541
|
return
|
5247
|
5542
|
}
|
5248
|
|
- price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
5249
|
5543
|
|
5250
|
5544
|
count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
|
5251
|
5545
|
|
5252
|
|
- total := float64(count) * price
|
5253
|
|
- retail_price_total := float64(count) * price
|
5254
|
5546
|
remark := items["remark"].(string)
|
5255
|
5547
|
max_unit := items["max_unit"].(string)
|
5256
|
5548
|
dealer := int64(items["dealer"].(float64))
|
5257
|
5549
|
|
5258
|
5550
|
manufacturer := int64(items["manufacturer"].(float64))
|
5259
|
5551
|
|
5260
|
|
- number := items["number"].(string)
|
5261
|
5552
|
batch_number := items["batch_number"].(string)
|
5262
|
5553
|
|
5263
|
5554
|
warehouse_info_id := int64(items["warehouse_info_id"].(float64))
|
|
@@ -5290,19 +5581,8 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5290
|
5581
|
}
|
5291
|
5582
|
}
|
5292
|
5583
|
|
5293
|
|
- admin_user_id := int64(items["admin_user_id"].(float64))
|
5294
|
|
-
|
5295
|
|
- //if items["last_price"] == nil || reflect.TypeOf(items["last_price"]).String() != "string" {
|
5296
|
|
- // utils.ErrorLog("last_price")
|
5297
|
|
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
5298
|
|
- // return
|
5299
|
|
- //}
|
5300
|
|
- //last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
|
5301
|
|
-
|
5302
|
5584
|
stock_count, _ := items["stock_count"].(string)
|
5303
|
5585
|
|
5304
|
|
- patient_id := int64(items["patient_id"].(float64))
|
5305
|
|
-
|
5306
|
5586
|
id := int64(items["id"].(float64))
|
5307
|
5587
|
|
5308
|
5588
|
class_type, _ := items["class_type"].(string)
|
|
@@ -5313,8 +5593,8 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5313
|
5593
|
WarehouseOutId: lastWarehouseOut.ID,
|
5314
|
5594
|
DrugId: drug_id,
|
5315
|
5595
|
Count: count,
|
5316
|
|
- Price: price,
|
5317
|
|
- TotalPrice: total,
|
|
5596
|
+ Price: 0,
|
|
5597
|
+ TotalPrice: 0,
|
5318
|
5598
|
Status: 1,
|
5319
|
5599
|
Ctime: warehousingOutDate.Unix(),
|
5320
|
5600
|
Mtime: ctime,
|
|
@@ -5323,16 +5603,16 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5323
|
5603
|
Type: 0,
|
5324
|
5604
|
Manufacturer: manufacturer,
|
5325
|
5605
|
Dealer: dealer,
|
5326
|
|
- RetailPrice: price,
|
5327
|
|
- RetailTotalPrice: retail_price_total,
|
|
5606
|
+ RetailPrice: 0,
|
|
5607
|
+ RetailTotalPrice: 0,
|
5328
|
5608
|
CountUnit: max_unit,
|
5329
|
5609
|
ExpiryDate: expiryDates,
|
5330
|
5610
|
ProductDate: productDates,
|
5331
|
|
- Number: number,
|
|
5611
|
+ Number: "",
|
5332
|
5612
|
BatchNumber: batch_number,
|
5333
|
5613
|
IsSys: 0,
|
5334
|
5614
|
WarehouseInfoId: warehouse_info_id,
|
5335
|
|
- AdminUserId: admin_user_id,
|
|
5615
|
+ AdminUserId: 0,
|
5336
|
5616
|
StockCount: stock_count,
|
5337
|
5617
|
IsCheck: 2,
|
5338
|
5618
|
SysRecordTime: warehousingOutDate.Unix(),
|
|
@@ -5361,7 +5641,7 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5361
|
5641
|
|
5362
|
5642
|
manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
|
5363
|
5643
|
|
5364
|
|
- warehousingOutInfoList, _ := service.GetDrugWarehouseOutListById(lastWarehouseOut.ID, adminUserInfo.CurrentOrgId)
|
|
5644
|
+ warehousingOutInfoList, _ := service.GetSelfDrugWarehouseOutListById(warehouse_out_id, adminUserInfo.CurrentOrgId, tx)
|
5365
|
5645
|
|
5366
|
5646
|
var drugType = "药品类型"
|
5367
|
5647
|
drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
|
|
@@ -5382,3 +5662,10 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
|
5382
|
5662
|
})
|
5383
|
5663
|
return
|
5384
|
5664
|
}
|
|
5665
|
+
|
|
5666
|
+func (c *SelfDrugApiController) GetSelfDrugQuery() {
|
|
5667
|
+
|
|
5668
|
+ orgId := c.GetAdminUserInfo().CurrentOrgId
|
|
5669
|
+
|
|
5670
|
+ service.GetSelfDrugQuery(orgId)
|
|
5671
|
+}
|